Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 181428
b: refs/heads/master
c: 67ae1d2
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Feb 26, 2010
1 parent ce68167 commit 0485191
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: dcb0c53331c0cfcac52d0921d3e3d06fdb2c417a
refs/heads/master: 67ae1d26bd9291280874b49b9f388722682fe58f
4 changes: 3 additions & 1 deletion trunk/drivers/media/dvb/siano/smscoreapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,8 @@ struct smscore_device_t {
#define MSG_SMS_DAB_CHANNEL 607
#define MSG_SMS_GET_PID_FILTER_LIST_REQ 608
#define MSG_SMS_GET_PID_FILTER_LIST_RES 609
#define MSG_SMS_GET_STATISTICS_RES 616
#define MSG_SMS_GET_STATISTICS_REQ 615
#define MSG_SMS_HO_PER_SLICES_IND 630
#define MSG_SMS_SET_ANTENNA_CONFIG_REQ 651
#define MSG_SMS_SET_ANTENNA_CONFIG_RES 652
Expand Down Expand Up @@ -340,7 +342,7 @@ struct SmsFirmware_ST {
/* Statistics information returned as response for
* SmsHostApiGetStatistics_Req */
struct SMSHOSTLIB_STATISTICS_S {
u32 Reserved; /* Reserved */
u8 Reserved[5]; /* Reserved */

/* Common parameters */
u32 IsRfLocked; /* 0 - not locked, 1 - locked */
Expand Down
73 changes: 68 additions & 5 deletions trunk/drivers/media/dvb/siano/smsdvb.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,39 @@ static int smsdvb_onresponse(void *context, struct smscore_buffer_t *cb)
is_status_update = true;
break;
}
case MSG_SMS_GET_STATISTICS_RES: {
struct SMSHOSTLIB_STATISTICS_S *p =
(struct SMSHOSTLIB_STATISTICS_S *)(phdr + 1);
struct RECEPTION_STATISTICS_S *pReceptionData =
&client->sms_stat_dvb.ReceptionData;

sms_info("MSG_SMS_GET_STATISTICS_RES");

is_status_update = true;
pReceptionData->IsDemodLocked = p->IsDemodLocked;
if (!pReceptionData->IsDemodLocked) {
pReceptionData->SNR = 0;
pReceptionData->BER = 0;
pReceptionData->BERErrorCount = 0;
pReceptionData->InBandPwr = 0;
pReceptionData->ErrorTSPackets = 0;

complete(&client->tune_done);
break;
}

pReceptionData->SNR = p->SNR;
pReceptionData->BER = p->BER;
pReceptionData->BERErrorCount = p->BERErrorCount;
pReceptionData->InBandPwr = p->InBandPwr;
pReceptionData->ErrorTSPackets = p->ErrorTSPackets;

complete(&client->tune_done);
break;
}
default:
sms_info("Unhandled message %d", phdr->msgType);

}
smscore_putbuffer(client->coredev, cb);

Expand Down Expand Up @@ -326,6 +359,20 @@ static int smsdvb_sendrequest_and_wait(struct smsdvb_client_t *client,
0 : -ETIME;
}

static int smsdvb_send_statistics_request(struct smsdvb_client_t *client)
{
int rc;
struct SmsMsgHdr_ST Msg = { MSG_SMS_GET_STATISTICS_REQ,
DVBT_BDA_CONTROL_MSG_ID,
HIF_TASK,
sizeof(struct SmsMsgHdr_ST), 0 };

rc = smsdvb_sendrequest_and_wait(client, &Msg, sizeof(Msg),
&client->tune_done);

return rc;
}

static inline int led_feedback(struct smsdvb_client_t *client)
{
if (client->fe_status & FE_HAS_LOCK)
Expand All @@ -338,33 +385,43 @@ static inline int led_feedback(struct smsdvb_client_t *client)

static int smsdvb_read_status(struct dvb_frontend *fe, fe_status_t *stat)
{
int rc;
struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);

rc = smsdvb_send_statistics_request(client);

*stat = client->fe_status;

led_feedback(client);

return 0;
return rc;
}

static int smsdvb_read_ber(struct dvb_frontend *fe, u32 *ber)
{
int rc;
struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);

rc = smsdvb_send_statistics_request(client);

*ber = client->sms_stat_dvb.ReceptionData.BER;

led_feedback(client);

return 0;
return rc;
}

static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
{
int rc;

struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);

rc = smsdvb_send_statistics_request(client);

if (client->sms_stat_dvb.ReceptionData.InBandPwr < -95)
*strength = 0;
else if (client->sms_stat_dvb.ReceptionData.InBandPwr > -29)
Expand All @@ -376,31 +433,37 @@ static int smsdvb_read_signal_strength(struct dvb_frontend *fe, u16 *strength)

led_feedback(client);

return 0;
return rc;
}

static int smsdvb_read_snr(struct dvb_frontend *fe, u16 *snr)
{
int rc;
struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);

rc = smsdvb_send_statistics_request(client);

*snr = client->sms_stat_dvb.ReceptionData.SNR;

led_feedback(client);

return 0;
return rc;
}

static int smsdvb_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
{
int rc;
struct smsdvb_client_t *client;
client = container_of(fe, struct smsdvb_client_t, frontend);

rc = smsdvb_send_statistics_request(client);

*ucblocks = client->sms_stat_dvb.ReceptionData.ErrorTSPackets;

led_feedback(client);

return 0;
return rc;
}

static int smsdvb_get_tune_settings(struct dvb_frontend *fe,
Expand Down

0 comments on commit 0485191

Please sign in to comment.