diff options
| -rw-r--r-- | halimpl/bcm2079x/adaptation/HalAdaptation.cpp | 3 | ||||
| -rw-r--r-- | halimpl/bcm2079x/adaptation/patchram.cpp | 11 | ||||
| -rw-r--r-- | halimpl/bcm2079x/hal/hal/nfc_hal_api.c | 18 | ||||
| -rw-r--r-- | halimpl/bcm2079x/hal/hal/nfc_hal_dm.c | 2 | ||||
| -rw-r--r-- | halimpl/bcm2079x/hal/hal/nfc_hal_dm_cfg.c | 17 | ||||
| -rw-r--r-- | halimpl/bcm2079x/hal/hal/nfc_hal_main.c | 40 | ||||
| -rwxr-xr-x | src/adaptation/NfcAdaptation.cpp | 2 | ||||
| -rw-r--r-- | src/hal/int/nfc_hal_int.h | 4 | ||||
| -rwxr-xr-x | src/include/config.h | 1 | ||||
| -rw-r--r-- | src/nfa/ee/nfa_ee_act.c | 5 | ||||
| -rw-r--r-- | src/nfa/ee/nfa_ee_main.c | 15 | ||||
| -rw-r--r-- | src/nfa/hci/nfa_hci_main.c | 5 | ||||
| -rw-r--r-- | src/nfa/int/nfa_ee_int.h | 2 |
13 files changed, 116 insertions, 9 deletions
diff --git a/halimpl/bcm2079x/adaptation/HalAdaptation.cpp b/halimpl/bcm2079x/adaptation/HalAdaptation.cpp index c29eb64..d834b57 100644 --- a/halimpl/bcm2079x/adaptation/HalAdaptation.cpp +++ b/halimpl/bcm2079x/adaptation/HalAdaptation.cpp @@ -303,8 +303,7 @@ int HaiPreDiscover (const bcm2079x_dev_t* device) ALOGD ("%s: enter", __FUNCTION__); int retval = EACCES; - HAL_NfcPreDiscover (); - retval = 0; + retval = HAL_NfcPreDiscover () ? 1 : 0; ALOGD ("%s: exit %d", __FUNCTION__, retval); return retval; } diff --git a/halimpl/bcm2079x/adaptation/patchram.cpp b/halimpl/bcm2079x/adaptation/patchram.cpp index 343eab2..a9083d7 100644 --- a/halimpl/bcm2079x/adaptation/patchram.cpp +++ b/halimpl/bcm2079x/adaptation/patchram.cpp @@ -44,10 +44,13 @@ static void * sI2cFixPrmBuf = NULL; static UINT8 sConfig [CONFIG_MAX_LEN]; static StartupConfig sStartupConfig; static StartupConfig sLptdConfig; +static StartupConfig sPreDiscoveryConfig; extern UINT8 *p_nfc_hal_dm_start_up_cfg; //defined in the HAL static UINT8 nfa_dm_start_up_vsc_cfg[CONFIG_MAX_LEN]; extern UINT8 *p_nfc_hal_dm_start_up_vsc_cfg; //defined in the HAL extern UINT8 *p_nfc_hal_dm_lptd_cfg; //defined in the HAL +extern UINT8 *p_nfc_hal_pre_discover_cfg; //defined in the HAL + extern tSNOOZE_MODE_CONFIG gSnoozeModeCfg; extern tNFC_HAL_CFG *p_nfc_hal_cfg; static void mayDisableSecureElement (StartupConfig& config); @@ -309,6 +312,7 @@ static void getNfaValues() p_nfc_hal_cfg->nfc_hal_prm_nvm_required = TRUE; //don't download firmware if controller cannot detect EERPOM sStartupConfig.initialize (); sLptdConfig.initialize (); + sPreDiscoveryConfig.initialize(); actualLen = GetStrValue (NAME_NFA_DM_START_UP_CFG, (char*)sConfig, sizeof(sConfig)); @@ -354,6 +358,13 @@ static void getNfaValues() mayDisableSecureElement (sStartupConfig); p_nfc_hal_dm_start_up_cfg = const_cast<UINT8*> (sStartupConfig.getInternalBuffer ()); + + actualLen = GetStrValue(NAME_NFA_DM_PRE_DISCOVERY_CFG, (char*)sConfig, sizeof(sConfig)); + if (actualLen) + { + sPreDiscoveryConfig.append (sConfig, actualLen); + p_nfc_hal_pre_discover_cfg = const_cast<UINT8*> (sPreDiscoveryConfig.getInternalBuffer ()); + } } /******************************************************************************* diff --git a/halimpl/bcm2079x/hal/hal/nfc_hal_api.c b/halimpl/bcm2079x/hal/hal/nfc_hal_api.c index 742f542..2cd95b2 100644 --- a/halimpl/bcm2079x/hal/hal/nfc_hal_api.c +++ b/halimpl/bcm2079x/hal/hal/nfc_hal_api.c @@ -233,6 +233,24 @@ BOOLEAN HAL_NfcPreDiscover (void) { BOOLEAN status = FALSE; + NFC_HDR *p_msg; + + HAL_TRACE_API0 ("HAL_NfcPreDiscover ()"); + if (nfc_hal_cb.pre_discover_done == FALSE) + { + nfc_hal_cb.pre_discover_done = TRUE; + if (p_nfc_hal_pre_discover_cfg && *p_nfc_hal_pre_discover_cfg) + { + status = TRUE; + /* Send message to NFC_HAL_TASK */ + if ((p_msg = (NFC_HDR *)GKI_getpoolbuf (NFC_HAL_NCI_POOL_ID)) != NULL) + { + p_msg->event = NFC_HAL_EVT_PRE_DISCOVER; + GKI_send_msg (NFC_HAL_TASK, NFC_HAL_TASK_MBOX, p_msg); + } + } + } + HAL_TRACE_API1 ("HAL_NfcPreDiscover status:%d", status); return status; } diff --git a/halimpl/bcm2079x/hal/hal/nfc_hal_dm.c b/halimpl/bcm2079x/hal/hal/nfc_hal_dm.c index 2b4aba6..4b0f034 100644 --- a/halimpl/bcm2079x/hal/hal/nfc_hal_dm.c +++ b/halimpl/bcm2079x/hal/hal/nfc_hal_dm.c @@ -998,6 +998,8 @@ void nfc_hal_dm_init (void) nfc_hal_cb.hci_cb.hci_timer.p_cback = nfc_hal_hci_timeout_cback; + nfc_hal_cb.pre_discover_done = FALSE; + nfc_post_reset_cb.spd_nvm_detection_cur_count = 0; nfc_post_reset_cb.spd_skip_on_power_cycle = FALSE; diff --git a/halimpl/bcm2079x/hal/hal/nfc_hal_dm_cfg.c b/halimpl/bcm2079x/hal/hal/nfc_hal_dm_cfg.c index 68ee089..76208c4 100644 --- a/halimpl/bcm2079x/hal/hal/nfc_hal_dm_cfg.c +++ b/halimpl/bcm2079x/hal/hal/nfc_hal_dm_cfg.c @@ -82,6 +82,23 @@ UINT8 nfc_hal_dm_start_up_vsc_cfg[] = { UINT8 *p_nfc_hal_dm_start_up_vsc_cfg = NULL; +/* the SetConfig at HAL_NfcPreDiscover. This is done once after HAL_NfcOpen */ +UINT8 nfc_hal_pre_discover_cfg[] = { + /* TLV len */ 0x0A, + /* B0 */ NCI_PARAM_ID_SWPCFG, + /* B1 */ 0x08, + /* B2 */ 0x01, + /* B3 */ 0x08, + /* B4 */ 0x00, + /* B5 */ 0x04, + /* B6 */ 0x80, + /* B7 */ 0xC3, + /* B8 */ 0xC9, + /* B9 */ 0x01 +}; + +UINT8 *p_nfc_hal_pre_discover_cfg = NULL; + /* LPTD parameters (LowPowerTagDetection) * This is typical values for 20791B2 * The timing and threshold parameters used for a customer handset/hardware may vary diff --git a/halimpl/bcm2079x/hal/hal/nfc_hal_main.c b/halimpl/bcm2079x/hal/hal/nfc_hal_main.c index a3fb215..7a7284a 100644 --- a/halimpl/bcm2079x/hal/hal/nfc_hal_main.c +++ b/halimpl/bcm2079x/hal/hal/nfc_hal_main.c @@ -53,7 +53,6 @@ static void nfc_hal_main_userial_cback (tUSERIAL_PORT port, tUSERIAL_EVT evt, tU static void nfc_hal_main_handle_terminate (void); static void nfc_hal_main_timeout_cback (void *p_tle); - #if (NFC_HAL_DEBUG == TRUE) const char * const nfc_hal_init_state_str[] = { @@ -132,6 +131,41 @@ static void nfc_hal_main_open_transport (void) /******************************************************************************* ** +** Function nfa_hal_pre_discover_done_cback +** +** Description Pre-discovery CFG is sent. +** +** Returns nothing +** +*******************************************************************************/ +void nfa_hal_pre_discover_done_cback (tNFC_HAL_NCI_EVT event, UINT16 data_len, UINT8 *p_data) +{ + NFC_HAL_SET_INIT_STATE(NFC_HAL_INIT_STATE_IDLE); + nfc_hal_main_stop_quick_timer (&nfc_hal_cb.ncit_cb.nci_wait_rsp_timer); + nfc_hal_cb.p_stack_cback (HAL_NFC_PRE_DISCOVER_CPLT_EVT, HAL_NFC_STATUS_OK); +} + +/******************************************************************************* +** +** Function nfa_hal_send_pre_discover_cfg +** +** Description sending Pre-discovery CFG +** +** Returns nothing +** +*******************************************************************************/ +void nfa_hal_send_pre_discover_cfg (void) +{ + if (nfc_hal_dm_set_config (p_nfc_hal_pre_discover_cfg [0], + &p_nfc_hal_pre_discover_cfg[1], + nfa_hal_pre_discover_done_cback) != HAL_NFC_STATUS_OK) + { + nfa_hal_pre_discover_done_cback(0, 0, NULL); + } +} + +/******************************************************************************* +** ** Function nfc_hal_main_send_error ** ** Description send an Error event to NFC stack @@ -628,6 +662,10 @@ UINT32 nfc_hal_main_task (UINT32 param) nfc_hal_hci_evt_hdlr ((tNFC_HAL_HCI_EVENT_DATA *) p_msg); break; + case NFC_HAL_EVT_PRE_DISCOVER: + NFC_HAL_SET_INIT_STATE(NFC_HAL_INIT_STATE_W4_PREDISCOVER_DONE); + nfa_hal_send_pre_discover_cfg (); + break; case NFC_HAL_EVT_CONTROL_GRANTED: nfc_hal_dm_send_pend_cmd (); diff --git a/src/adaptation/NfcAdaptation.cpp b/src/adaptation/NfcAdaptation.cpp index a589528..adcb41c 100755 --- a/src/adaptation/NfcAdaptation.cpp +++ b/src/adaptation/NfcAdaptation.cpp @@ -452,7 +452,7 @@ BOOLEAN NfcAdaptation::HalPrediscover () if (mHalDeviceContext) { - mHalDeviceContext->pre_discover (mHalDeviceContext); + retval = mHalDeviceContext->pre_discover (mHalDeviceContext); } return retval; } diff --git a/src/hal/int/nfc_hal_int.h b/src/hal/int/nfc_hal_int.h index 96e9095..cf821f3 100644 --- a/src/hal/int/nfc_hal_int.h +++ b/src/hal/int/nfc_hal_int.h @@ -420,6 +420,7 @@ typedef struct /* data members for NFC_HAL-HCI */ tNFC_HAL_HCI_CB hci_cb; + UINT8 pre_discover_done; /* TRUE, when the prediscover config is complete */ UINT8 max_rf_credits; /* NFC Max RF data credits */ UINT8 trace_level; /* NFC HAL trace level */ @@ -432,7 +433,7 @@ extern tNFC_HAL_CB nfc_hal_cb; #define nfc_hal_cb (*nfc_hal_cb_ptr) extern tNFC_HAL_CB *nfc_hal_cb_ptr; #endif - +extern UINT8 *p_nfc_hal_pre_discover_cfg; /**************************************************************************** ** Internal nfc functions ****************************************************************************/ @@ -468,6 +469,7 @@ void nfc_hal_dm_pre_init_nfcc (void); void nfc_hal_dm_shutting_down_nfcc (void); BOOLEAN nfc_hal_dm_power_mode_execute (tNFC_HAL_LP_EVT event); void nfc_hal_dm_send_pend_cmd (void); +tHAL_NFC_STATUS nfc_hal_dm_set_config (UINT8 tlv_size, UINT8 *p_param_tlvs, tNFC_HAL_NCI_CBACK *p_cback); /* nfc_hal_prm.c */ void nfc_hal_prm_spd_reset_ntf (UINT8 reset_reason, UINT8 reset_type); diff --git a/src/include/config.h b/src/include/config.h index 0c27f60..7ecb4f8 100755 --- a/src/include/config.h +++ b/src/include/config.h @@ -78,6 +78,7 @@ int GetNumValue(const char* name, void* p_value, unsigned long len); #define NAME_PRESERVE_STORAGE "PRESERVE_STORAGE" #define NAME_NFA_MAX_EE_SUPPORTED "NFA_MAX_EE_SUPPORTED" #define NAME_NFCC_ENABLE_TIMEOUT "NFCC_ENABLE_TIMEOUT" +#define NAME_NFA_DM_PRE_DISCOVERY_CFG "NFA_DM_PRE_DISCOVERY_CFG" #define LPTD_PARAM_LEN (40) diff --git a/src/nfa/ee/nfa_ee_act.c b/src/nfa/ee/nfa_ee_act.c index 78400ed..aa16911 100644 --- a/src/nfa/ee/nfa_ee_act.c +++ b/src/nfa/ee/nfa_ee_act.c @@ -81,7 +81,6 @@ const UINT8 nfa_ee_proto_list[NFA_EE_NUM_PROTO] = NFC_PROTOCOL_NFC_DEP }; -static void nfa_ee_check_restore_complete(void); static void nfa_ee_report_discover_req_evt(void); static void nfa_ee_build_discover_req_evt (tNFA_EE_DISCOVER_REQ *p_evt_data); /******************************************************************************* @@ -741,7 +740,7 @@ void nfa_ee_report_disc_done(BOOLEAN notify_enable_done) ** Returns TRUE, if all NFA_EE_STATUS_PENDING bits are removed ** *******************************************************************************/ -static BOOLEAN nfa_ee_restore_ntf_done(void) +BOOLEAN nfa_ee_restore_ntf_done(void) { tNFA_EE_ECB *p_cb; BOOLEAN is_done = TRUE; @@ -1069,7 +1068,7 @@ void nfa_ee_nci_disc_ntf(tNFA_EE_MSG *p_data) ** Returns void ** *******************************************************************************/ -static void nfa_ee_check_restore_complete(void) +void nfa_ee_check_restore_complete(void) { UINT32 xx; tNFA_EE_ECB *p_cb; diff --git a/src/nfa/ee/nfa_ee_main.c b/src/nfa/ee/nfa_ee_main.c index 8af4290..6ec22e7 100644 --- a/src/nfa/ee/nfa_ee_main.c +++ b/src/nfa/ee/nfa_ee_main.c @@ -268,6 +268,7 @@ void nfa_ee_proc_hci_info_cback (void) { UINT32 xx; tNFA_EE_ECB *p_cb; + tNFA_EE_MSG data; NFA_TRACE_DEBUG0 ("nfa_ee_proc_hci_info_cback ()"); /* if NFCC power state is change to full power */ @@ -285,6 +286,20 @@ void nfa_ee_proc_hci_info_cback (void) nfa_ee_restore_one_ecb (p_cb); } } + + if (nfa_ee_restore_ntf_done()) + { + nfa_ee_check_restore_complete(); + if (nfa_ee_cb.em_state == NFA_EE_EM_STATE_INIT_DONE) + { + if (nfa_ee_cb.discv_timer.in_use) + { + nfa_sys_stop_timer (&nfa_ee_cb.discv_timer); + data.hdr.event = NFA_EE_DISCV_TIMEOUT_EVT; + nfa_ee_evt_hdlr((BT_HDR *)&data); + } + } + } } /******************************************************************************* diff --git a/src/nfa/hci/nfa_hci_main.c b/src/nfa/hci/nfa_hci_main.c index 76d7f38..1423c15 100644 --- a/src/nfa/hci/nfa_hci_main.c +++ b/src/nfa/hci/nfa_hci_main.c @@ -98,7 +98,6 @@ void nfa_hci_ee_info_cback (tNFA_EE_DISC_STS status) case NFA_EE_DISC_STS_ON: /* NFCEE Discovery is in progress */ nfa_hci_cb.ee_disc_cmplt = TRUE; - nfa_hci_cb.ee_disable_disc = FALSE; nfa_hci_cb.num_ee_dis_req_ntf = 0; nfa_hci_cb.num_hot_plug_evts = 0; nfa_hci_cb.conn_id = 0; @@ -106,6 +105,8 @@ void nfa_hci_ee_info_cback (tNFA_EE_DISC_STS status) break; case NFA_EE_DISC_STS_OFF: + if (nfa_hci_cb.ee_disable_disc) + break; nfa_hci_cb.ee_disable_disc = TRUE; /* Discovery operation is complete, retrieve discovery result */ NFA_EeGetInfo (&num_nfcee, ee_info); @@ -481,6 +482,8 @@ void nfa_hci_dh_startup_complete (void) else if ( (nfa_hci_cb.num_nfcee > 1) &&(nfa_hci_cb.num_ee_dis_req_ntf != (nfa_hci_cb.num_nfcee - 1)) ) { + if (nfa_hci_cb.hci_state == NFA_HCI_STATE_RESTORE) + nfa_hci_cb.ee_disable_disc = TRUE; /* Received HOT PLUG EVT, we will also wait for EE DISC REQ Ntf(s) */ nfa_sys_start_timer (&nfa_hci_cb.timer, NFA_HCI_RSP_TIMEOUT_EVT, p_nfa_hci_cfg->hci_netwk_enable_timeout); } diff --git a/src/nfa/int/nfa_ee_int.h b/src/nfa/int/nfa_ee_int.h index 5093bce..89211c1 100644 --- a/src/nfa/int/nfa_ee_int.h +++ b/src/nfa/int/nfa_ee_int.h @@ -460,6 +460,8 @@ void nfa_ee_reg_cback_enable_done (tNFA_EE_ENABLE_DONE_CBACK *p_cback); extern void nfa_ee_proc_hci_info_cback (void); void nfa_ee_check_disable (void); +BOOLEAN nfa_ee_restore_ntf_done(void); +void nfa_ee_check_restore_complete(void); #endif /* NFA_P2P_INT_H */ |
