diff --git a/helium/radio-helium-commands.h b/helium/radio-helium-commands.h index 352017e2a8356e9448dc9c3e4b2ab7170c3d9875..da02f52dd0b497dd10bc5fa0f184a47ffa08e8e5 100644 --- a/helium/radio-helium-commands.h +++ b/helium/radio-helium-commands.h @@ -97,6 +97,7 @@ enum helium_cmd_t { HCI_FM_HELIUM_AF_JUMP_RSSI_TH, HCI_FM_HELIUM_BLEND_SINRHI, HCI_FM_HELIUM_BLEND_RMSSIHI, + HCI_FM_HELIUM_RDS_GRP_COUNTERS_EXT, HCI_FM_HELIUM_AGC_UCCTRL = 0x8000043, /* 0x8000043 */ HCI_FM_HELIUM_AGC_GAIN_STATE, diff --git a/helium/radio-helium.h b/helium/radio-helium.h index cb72cd557f13ec767f3ea97a20ea710f130afdc1..44377487f16beb92c81d4f37f6af51bb89409cbc 100644 --- a/helium/radio-helium.h +++ b/helium/radio-helium.h @@ -164,6 +164,7 @@ typedef void (*ert_cb)(char *ert); typedef void (*disable_cb)(); typedef void (*callback_thread_event)(unsigned int evt); typedef void (*rds_grp_cntrs_cb)(char *rds_params); +typedef void (*rds_grp_cntrs_ext_cb)(char *rds_params); typedef void (*fm_peek_cb)(char *peek_rsp); typedef void (*fm_ssbi_peek_cb)(char *ssbi_peek_rsp); typedef void (*fm_agc_gain_cb)(char *agc_gain_rsp); @@ -197,6 +198,7 @@ typedef struct { ert_cb ert_update_cb; disable_cb disabled_cb; rds_grp_cntrs_cb rds_grp_cntrs_rsp_cb; + rds_grp_cntrs_ext_cb rds_grp_cntrs_ext_rsp_cb; fm_peek_cb fm_peek_rsp_cb; fm_ssbi_peek_cb fm_ssbi_peek_rsp_cb; fm_agc_gain_cb fm_agc_gain_rsp_cb; @@ -304,6 +306,9 @@ struct radio_hci_dev { /*HCI Status parameters commands*/ #define HCI_OCF_FM_READ_GRP_COUNTERS 0x0001 +#define HCI_OCF_FM_READ_GRP_COUNTERS_EXT 0x0002 + + /*HCI Diagnostic commands*/ #define HCI_OCF_FM_PEEK_DATA 0x0002 #define HCI_OCF_FM_POKE_DATA 0x0003 @@ -1250,6 +1255,7 @@ int helium_cancel_search_req(); int hci_fm_set_recv_conf_req (struct hci_fm_recv_conf_req *conf); int hci_fm_get_program_service_req (); int hci_fm_get_rds_grpcounters_req (int val); +int hci_fm_get_rds_grpcounters_ext_req (int val); int hci_fm_set_notch_filter_req (int val); int helium_set_sig_threshold_req(char th); int helium_rds_grp_mask_req(struct hci_fm_rds_grp_req *rds_grp_msk); diff --git a/helium/radio_helium_hal.c b/helium/radio_helium_hal.c index 2412b426fec4d8fdc571e236f2299d8f43095d7e..c3dc5594befe08a797e97b5220de83fd803c4c5a 100644 --- a/helium/radio_helium_hal.c +++ b/helium/radio_helium_hal.c @@ -105,7 +105,7 @@ static void hci_cc_conf_rsp(char *ev_rsp) static void hci_cc_fm_disable_rsp(char *ev_buff) { char status; - int ret; + int ret; if (ev_buff == NULL) { ALOGE("%s:%s, buffer is null\n", LOG_TAG, __func__); @@ -115,15 +115,13 @@ static void hci_cc_fm_disable_rsp(char *ev_buff) status = (char) *ev_buff; radio_hci_req_complete(status); if (radio->mode == FM_TURNING_OFF) { - jni_cb->disabled_cb(); radio->mode = FM_OFF; jni_cb->disabled_cb(); jni_cb->thread_evt_cb(1); //close the userial port and power off the chip ret = fm_power(FM_RADIO_DISABLE); ALOGI("fm power off status = %d", ret); - ALOGE("%s:calling fm userial close\n", LOG_TAG ); - // sleep(1); + ALOGI("%s:calling fm userial close\n", LOG_TAG ); fm_userial_close(); // fm_power(FM_RADIO_DISABLE); } @@ -150,14 +148,29 @@ static void hci_cc_rds_grp_cntrs_rsp(char *ev_buff) return; } status = ev_buff[0]; - ALOGE("%s:%s, status =%d\n", LOG_TAG, __func__,status); - if(status < 0) - { + ALOGI("%s:%s, status =%d\n", LOG_TAG, __func__,status); + if (status < 0) { ALOGE("%s:%s, read rds_grp_cntrs failed status=%d\n", LOG_TAG, __func__,status); } jni_cb->rds_grp_cntrs_rsp_cb(&ev_buff[1]); } +static void hci_cc_rds_grp_cntrs_ext_rsp(char *ev_buff) +{ + char status; + int i; + if (ev_buff == NULL) { + ALOGE("%s:%s, buffer is null\n", LOG_TAG, __func__); + return; + } + status = ev_buff[0]; + ALOGI("%s:%s, status =%d\n", LOG_TAG, __func__,status); + if (status < 0) { + ALOGE("%s:%s, read rds_grp_cntrs_ext failed status=%d\n", LOG_TAG, __func__,status); + } + jni_cb->rds_grp_cntrs_ext_rsp_cb(&ev_buff[1]); +} + static void hci_cc_riva_peek_rsp(char *ev_buff) { char status; @@ -440,6 +453,9 @@ static inline void hci_cmd_complete_event(char *buff) case hci_status_param_op_pack(HCI_OCF_FM_READ_GRP_COUNTERS): hci_cc_rds_grp_cntrs_rsp(pbuf); break; + case hci_status_param_op_pack(HCI_OCF_FM_READ_GRP_COUNTERS_EXT): + hci_cc_rds_grp_cntrs_ext_rsp(pbuf); + break; case hci_diagnostic_cmd_op_pack(HCI_OCF_FM_PEEK_DATA): hci_cc_riva_peek_rsp(buff); break; @@ -761,7 +777,7 @@ static void hci_ev_rt_plus_tag(char *buff) static void hci_ev_ext_country_code(char *buff) { char *data = NULL; - int len = 15; + int len = ECC_EVENT_BUFSIZE; ALOGD("%s:%s: start", LOG_TAG, __func__); data = malloc(len); if (data != NULL) { @@ -1293,6 +1309,15 @@ static int set_fm_ctrl(int cmd, int val) } break; + case HCI_FM_HELIUM_RDS_GRP_COUNTERS_EXT: + ALOGD("%s: rds_grp counter read value=%d ", LOG_TAG,val); + ret = hci_fm_get_rds_grpcounters_ext_req(val); + if (ret < 0) { + radio->g_rds_grp_proc_ps = saved_val; + goto end ; + } + break; + case HCI_FM_HELIUM_SET_NOTCH_FILTER: ALOGD("%s: set notch filter notch=%d ", LOG_TAG,val); ret = hci_fm_set_notch_filter_req(val); diff --git a/helium/radio_helium_hal_cmds.c b/helium/radio_helium_hal_cmds.c index f9c307a144f33363b53c4cb9c4cc014916a9dff0..8feb41f87fc2d7274d50ab10f5862eea92d2e36a 100644 --- a/helium/radio_helium_hal_cmds.c +++ b/helium/radio_helium_hal_cmds.c @@ -178,6 +178,16 @@ int hci_fm_get_rds_grpcounters_req (int val) return send_fm_cmd_pkt(opcode, sizeof(val), &val); } +int hci_fm_get_rds_grpcounters_ext_req (int val) +{ + uint16_t opcode = 0; + + opcode = hci_opcode_pack(HCI_OGF_FM_STATUS_PARAMETERS_CMD_REQ, + HCI_OCF_FM_READ_GRP_COUNTERS_EXT); + return send_fm_cmd_pkt(opcode, sizeof(val), &val); +} + + int hci_fm_set_notch_filter_req (int val) { uint16_t opcode = 0; diff --git a/jni/android_hardware_fm.cpp b/jni/android_hardware_fm.cpp index dd439fc291494604fcff56263de5d7d616ae28cb..163ce9bcf7638a67b0064121d7616b5c75fa9791 100644 --- a/jni/android_hardware_fm.cpp +++ b/jni/android_hardware_fm.cpp @@ -104,6 +104,8 @@ typedef void (*ert_cb)(char *ert); typedef void (*disable_cb)(); typedef void (*callback_thread_event)(unsigned int evt); typedef void (*rds_grp_cntrs_cb)(char *rds_params); +typedef void (*rds_grp_cntrs_ext_cb)(char *rds_params); + typedef void (*fm_peek_cb)(char *peek_rsp); typedef void (*fm_ssbi_peek_cb)(char *ssbi_peek_rsp); typedef void (*fm_agc_gain_cb)(char *agc_gain_rsp); @@ -363,6 +365,11 @@ void rds_grp_cntrs_rsp_cb(char * evt_buffer) ALOGD("rds_grp_cntrs_rsp_cb"); } +void rds_grp_cntrs_ext_rsp_cb(char * evt_buffer) +{ + ALOGE("rds_grp_cntrs_ext_rsp_cb"); +} + void fm_disabled_cb() { ALOGE("DISABLE"); @@ -485,6 +492,7 @@ typedef struct { ert_cb ert_update_cb; disable_cb disabled_cb; rds_grp_cntrs_cb rds_grp_cntrs_rsp_cb; + rds_grp_cntrs_ext_cb rds_grp_cntrs_ext_rsp_cb; fm_peek_cb fm_peek_rsp_cb; fm_ssbi_peek_cb fm_ssbi_peek_rsp_cb; fm_agc_gain_cb fm_agc_gain_rsp_cb; @@ -527,6 +535,7 @@ static fm_vendor_callbacks_t fm_callbacks = { fm_ert_update_cb, fm_disabled_cb, rds_grp_cntrs_rsp_cb, + rds_grp_cntrs_ext_rsp_cb, fm_peek_rsp_cb, fm_ssbi_peek_rsp_cb, fm_agc_gain_rsp_cb,