summaryrefslogtreecommitdiffstats
path: root/src/phHciNfc_DevMgmt.c
diff options
context:
space:
mode:
authorRob von Behren <jrvb@google.com>2011-09-16 15:05:25 -0700
committerJeff Hamilton <jham@android.com>2011-09-20 23:28:26 -0500
commit6dd948323de0f31b413c9f19a905f1c145c9c456 (patch)
tree2f91ca33fbb6521fe21ad80f79e5e3c9c0d92a2c /src/phHciNfc_DevMgmt.c
parent71b688d07db1e7fd32a1e02f29b9779f0d0db377 (diff)
downloadexternal_libnfc-nxp-6dd948323de0f31b413c9f19a905f1c145c9c456.zip
external_libnfc-nxp-6dd948323de0f31b413c9f19a905f1c145c9c456.tar.gz
external_libnfc-nxp-6dd948323de0f31b413c9f19a905f1c145c9c456.tar.bz2
Manual port of 6900b4 from gingerbread:
Patch to add Secure Download Mechanism in the libnfc This patch permit to support secure download update and also to avoid locking states in case of download failures Bug: 5331837 Change-Id: Ia5b6d9baf57231b0193bbbe85c88c7df557017c6
Diffstat (limited to 'src/phHciNfc_DevMgmt.c')
-rw-r--r--src/phHciNfc_DevMgmt.c58
1 files changed, 41 insertions, 17 deletions
diff --git a/src/phHciNfc_DevMgmt.c b/src/phHciNfc_DevMgmt.c
index ef3aa78..9517741 100644
--- a/src/phHciNfc_DevMgmt.c
+++ b/src/phHciNfc_DevMgmt.c
@@ -71,6 +71,7 @@
#define NXP_EVT_INFO_EXT_RF_FIELD 0x12U
#define NXP_EVT_INFO_MEM_VIOLATION 0x13U
#define NXP_EVT_INFO_TEMP_OVERHEAT 0x14U
+#define NXP_EVT_INFO_LLC_ERROR 0x15U
#define NFC_DEV_TXLDO_MASK 0x03U
@@ -578,7 +579,9 @@ phHciNfc_DevMgmt_Initialise(
NFC_FELICA_RC_ADDR , config );
if(NFCSTATUS_PENDING == status )
{
- if (HCI_SELF_TEST == psHciContext->init_mode )
+
+ if ((HCI_SELF_TEST == psHciContext->init_mode )
+ || (HCI_NFC_DEVICE_TEST == psHciContext->init_mode ))
{
p_device_mgmt_info->next_seq =
DEV_MGMT_GPIO_PDIR;
@@ -653,18 +656,27 @@ phHciNfc_DevMgmt_Initialise(
#endif /* #if ( NXP_NFC_IFC_TIMEOUT & 0x01 ) */
case DEV_MGMT_TX_LDO:
{
- config = (NFC_DEV_HWCONF_DEFAULT |
+#if ( NXP_HAL_VERIFY_EEPROM_CRC & 0x01U )
+ if (0 != p_device_mgmt_info->eeprom_crc)
+ {
+ status = NFCSTATUS_FAILED;
+ }
+ else
+#endif
+ {
+ config = (NFC_DEV_HWCONF_DEFAULT |
(NXP_DEFAULT_TX_LDO & NFC_DEV_TXLDO_MASK));
- status = phHciNfc_DevMgmt_Configure( psHciContext, pHwRef,
+ status = phHciNfc_DevMgmt_Configure( psHciContext, pHwRef,
NFC_ADDRESS_HW_CONF , config );
- if(NFCSTATUS_PENDING == status )
- {
+ if(NFCSTATUS_PENDING == status )
+ {
#if ( SW_TYPE_RF_TUNING_BF & 0x01)
- p_device_mgmt_info->next_seq = DEV_MGMT_ANAIRQ_CONF;
+ p_device_mgmt_info->next_seq = DEV_MGMT_ANAIRQ_CONF;
#else
- p_device_mgmt_info->next_seq = DEV_MGMT_CLK_REQ;
+ p_device_mgmt_info->next_seq = DEV_MGMT_CLK_REQ;
#endif
- /* status = NFCSTATUS_SUCCESS; */
+ /* status = NFCSTATUS_SUCCESS; */
+ }
}
break;
}
@@ -1064,17 +1076,20 @@ phHciNfc_DevMgmt_Update_Sequence(
{
p_device_mgmt_info->current_seq = DEV_MGMT_PIPE_OPEN;
p_device_mgmt_info->next_seq = DEV_MGMT_PIPE_OPEN ;
- }break;
+ break;
+ }
case UPDATE_SEQ:
{
p_device_mgmt_info->current_seq = p_device_mgmt_info->next_seq;
- }break;
+ break;
+ }
case REL_SEQ:
{
p_device_mgmt_info->current_seq = DEV_MGMT_EVT_AUTONOMOUS;
p_device_mgmt_info->next_seq = DEV_MGMT_EVT_AUTONOMOUS ;
- }break;
+ break;
+ }
default:
{
break;
@@ -1119,6 +1134,8 @@ phHciNfc_DevMgmt_Test(
}
else
{
+ phHciNfc_DevMgmt_Info_t *p_device_mgmt_info = (phHciNfc_DevMgmt_Info_t *)
+ psHciContext->p_device_mgmt_info ;
p_pipe_info = ((phHciNfc_DevMgmt_Info_t *)
psHciContext->p_device_mgmt_info)->p_pipe_info ;
switch(test_type)
@@ -1136,6 +1153,8 @@ phHciNfc_DevMgmt_Test(
p_pipe_info->param_info = test_param->buffer;
p_pipe_info->param_length = (uint8_t)test_param->length;
}
+ p_device_mgmt_info->test_result.buffer = NULL;
+ p_device_mgmt_info->test_result.length = 0;
status =
phHciNfc_Send_DevMgmt_Command( psHciContext, pHwRef,
pipe_id, (uint8_t)test_type );
@@ -1225,15 +1244,15 @@ phHciNfc_Recv_DevMgmt_Response(
break;
}
case NXP_DBG_READ:
- {
- *p_device_mgmt_info->p_val = (uint8_t)( length > HCP_HEADER_LEN ) ?
- pResponse[HCP_HEADER_LEN]: 0;
- p_device_mgmt_info->p_val = NULL;
-
- }
/* fall through */
case NXP_DBG_WRITE:
{
+ if( NULL != p_device_mgmt_info->p_val )
+ {
+ *p_device_mgmt_info->p_val = (uint8_t)( length > HCP_HEADER_LEN ) ?
+ pResponse[HCP_HEADER_LEN]: 0;
+ p_device_mgmt_info->p_val = NULL;
+ }
break;
}
/* Self Test Commands */
@@ -1363,6 +1382,11 @@ phHciNfc_Recv_DevMgmt_Event(
p_device_mgmt_info->overheat_status;
break;
}
+ case NXP_EVT_INFO_LLC_ERROR:
+ {
+ event_info.eventType = NFC_INFO_LLC_ERROR;
+ break;
+ }
default:
{
status = PHNFCSTVAL(CID_NFC_HCI,