[Bak] 备份

This commit is contained in:
gaoyang3513
2024-07-16 10:21:38 +08:00
parent f272362680
commit fc490c00fb
8 changed files with 78 additions and 55 deletions

View File

@ -29,7 +29,7 @@
defined (NXPBUILD__PHHAL_HW_RC663) || \ defined (NXPBUILD__PHHAL_HW_RC663) || \
defined (NXPBUILD__PHHAL_HW_PN7462AU) || \ defined (NXPBUILD__PHHAL_HW_PN7462AU) || \
defined (NXPBUILD__PHHAL_HW_PN7642) defined (NXPBUILD__PHHAL_HW_PN7642)
#define PH_EXAMPLE1_LPCD_ENABLE /* If LPCD needs to be configured and used over HAL or over DiscLoop */ // #define PH_EXAMPLE1_LPCD_ENABLE /* If LPCD needs to be configured and used over HAL or over DiscLoop */
#endif #endif
#define LISTEN_PHASE_TIME_MS 300 /* Listen Phase TIME */ #define LISTEN_PHASE_TIME_MS 300 /* Listen Phase TIME */

View File

@ -299,7 +299,7 @@ void PrintErrorInfo(phStatus_t wStatus)
DEBUG_PRINTF("\t PH_COMP_OSAL"); DEBUG_PRINTF("\t PH_COMP_OSAL");
break; break;
default: default:
DEBUG_PRINTF("\t 0x%x",(wStatus & PH_COMPID_MASK)); DEBUG_PRINTF("\t 0x%x",(wStatus & PH_COMP_MASK));
break; break;
} }
@ -368,6 +368,7 @@ void PrintErrorInfo(phStatus_t wStatus)
DEBUG_PRINTF("\t 0x%x",(wStatus & PH_ERR_MASK)); DEBUG_PRINTF("\t 0x%x",(wStatus & PH_ERR_MASK));
break; break;
} }
DEBUG_PRINTF("\n");
} }
/****************************************************************************** /******************************************************************************

View File

@ -25,6 +25,7 @@
/* Local headers */ /* Local headers */
#include "NfcrdlibEx8_HCE_T4T.h" #include "NfcrdlibEx8_HCE_T4T.h"
#include "phacDiscLoop.h"
#ifdef NXPBUILD__PHHAL_HW_PN7462AU #ifdef NXPBUILD__PHHAL_HW_PN7462AU
#include "phhalRng.h" #include "phhalRng.h"
@ -34,6 +35,10 @@
** Definitions ** Definitions
*******************************************************************************/ *******************************************************************************/
#define BSP_MOD 1
#define BSP_MOD_POLL_MODE 0
#define ENABLE_DISC_CONFIG 1
#ifdef NXPBUILD__PHHAL_HW_RC663 #ifdef NXPBUILD__PHHAL_HW_RC663
# warning "This example is not supported for RC663" # warning "This example is not supported for RC663"
int main() { int main() {
@ -233,7 +238,7 @@ int main(void)
return 0; return 0;
} }
#ifdef ENABLE_DISC_CONFIG #if ENABLE_DISC_CONFIG
/** /**
* This function will load/configure Discovery loop with default values based on interested profile * This function will load/configure Discovery loop with default values based on interested profile
* Application can read these values from EEPROM area and load/configure Discovery loop via SetConfig * Application can read these values from EEPROM area and load/configure Discovery loop via SetConfig
@ -499,7 +504,7 @@ uint16_t NFCForumProcess(uint16_t wEntryPoint, phStatus_t DiscLoopStatus)
uint16_t wNumberOfTags = 0; uint16_t wNumberOfTags = 0;
uint16_t wValue; uint16_t wValue;
uint8_t bIndex; uint8_t bIndex;
uint16_t wReturnEntryPoint; uint16_t wReturnEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_LISTEN;
if(wEntryPoint == PHAC_DISCLOOP_ENTRY_POINT_POLL) if(wEntryPoint == PHAC_DISCLOOP_ENTRY_POINT_POLL)
{ {
@ -673,7 +678,6 @@ uint16_t NFCForumProcess(uint16_t wEntryPoint, phStatus_t DiscLoopStatus)
/* Update the Entry point to LISTEN mode. */ /* Update the Entry point to LISTEN mode. */
wReturnEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_LISTEN; wReturnEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_LISTEN;
} }
else else
{ {
@ -691,20 +695,15 @@ uint16_t NFCForumProcess(uint16_t wEntryPoint, phStatus_t DiscLoopStatus)
CHECK_STATUS(status); CHECK_STATUS(status);
status = phhalHw_EventWait(pHal, LISTEN_PHASE_TIME_MS); status = phhalHw_EventWait(pHal, LISTEN_PHASE_TIME_MS);
if((status & PH_ERR_MASK) == PH_ERR_IO_TIMEOUT)
{
wReturnEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_POLL;
}
else
{
wReturnEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_LISTEN;
}
} }
else else
{ {
if((DiscLoopStatus & PH_ERR_MASK) == PHAC_DISCLOOP_ACTIVATED_BY_PEER) if((DiscLoopStatus & PH_ERR_MASK) == PHAC_DISCLOOP_ACTIVATED_BY_PEER)
{ {
DEBUG_PRINTF (" \n Device activated in listen mode... \n"); DEBUG_PRINTF (" \n Device activated in listen mode... \n");
/* On successful activated by Peer, switch to LISTEN mode */
wReturnEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_POLL;
} }
else if ((DiscLoopStatus & PH_ERR_MASK) == PH_ERR_INVALID_PARAMETER) else if ((DiscLoopStatus & PH_ERR_MASK) == PH_ERR_INVALID_PARAMETER)
{ {
@ -721,14 +720,12 @@ uint16_t NFCForumProcess(uint16_t wEntryPoint, phStatus_t DiscLoopStatus)
} }
else else
{ {
DEBUG_ERROR_PRINT(PrintErrorInfo(status)); DEBUG_ERROR_PRINT(PrintErrorInfo(DiscLoopStatus));
}
}
} }
} }
/* On successful activated by Peer, switch to LISTEN mode */
wReturnEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_POLL;
}
}
return wReturnEntryPoint; return wReturnEntryPoint;
} }
@ -744,7 +741,7 @@ void TReaderLibrary(
) )
{ {
phStatus_t status, statustmp; phStatus_t status, statustmp;
uint16_t wEntryPoint; uint16_t wEntryPoint, wConfig, *pValue;
phacDiscLoop_Profile_t bProfile = PHAC_DISCLOOP_PROFILE_UNKNOWN; phacDiscLoop_Profile_t bProfile = PHAC_DISCLOOP_PROFILE_UNKNOWN;
/* This call shall allocate secure context before calling any secure function, /* This call shall allocate secure context before calling any secure function,
@ -760,7 +757,7 @@ void TReaderLibrary(
CHECK_STATUS(status); CHECK_STATUS(status);
#endif /* NXPBUILD__PHHAL_HW_TARGET */ #endif /* NXPBUILD__PHHAL_HW_TARGET */
#ifdef ENABLE_DISC_CONFIG #if ENABLE_DISC_CONFIG
#ifndef ENABLE_EMVCO_PROF #ifndef ENABLE_EMVCO_PROF
bProfile = PHAC_DISCLOOP_PROFILE_NFC; bProfile = PHAC_DISCLOOP_PROFILE_NFC;
#else #else
@ -770,13 +767,7 @@ void TReaderLibrary(
LoadProfile(bProfile); LoadProfile(bProfile);
#endif /* ENABLE_DISC_CONFIG */ #endif /* ENABLE_DISC_CONFIG */
#define BSP_MOD 1
#if BSP_MOD #if BSP_MOD
/* Get Listen Configuration */
status = phacDiscLoop_GetConfig(pParams, PHAC_DISCLOOP_CONFIG_PAS_LIS_TECH_CFG, &bSaveLisTechCfg);
CHECK_STATUS(status);
#if BSP_MOD_POLL_MODE #if BSP_MOD_POLL_MODE
/* Get Poll Configuration */ /* Get Poll Configuration */
status = phacDiscLoop_GetConfig(pParams, PHAC_DISCLOOP_CONFIG_PAS_POLL_TECH_CFG, &bSavePollTechCfg); status = phacDiscLoop_GetConfig(pParams, PHAC_DISCLOOP_CONFIG_PAS_POLL_TECH_CFG, &bSavePollTechCfg);
@ -788,23 +779,53 @@ void TReaderLibrary(
#endif /* BSP_MOD_POLL_MODE */ #endif /* BSP_MOD_POLL_MODE */
#endif /* BSP_MOD */ #endif /* BSP_MOD */
/* Be in card emulation mode */ /* Get Poll Configuration */
while(bInfLoop) status = phacDiscLoop_GetConfig(pParams, PHAC_DISCLOOP_CONFIG_PAS_POLL_TECH_CFG, &bSavePollTechCfg);
{ CHECK_STATUS(status);
/* Get Passive Configuration */
status = phacDiscLoop_GetConfig(pParams, PHAC_DISCLOOP_CONFIG_PAS_LIS_TECH_CFG, &bSaveLisTechCfg);
CHECK_STATUS(status);
/* Start in listem mode */ /* Start in listem mode */
wEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_LISTEN; wEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_LISTEN;
/* Set Listem Configuration */ /* Be in card emulation mode */
statustmp = phacDiscLoop_SetConfig(pParams, PHAC_DISCLOOP_CONFIG_PAS_LIS_TECH_CFG, bSaveLisTechCfg); while(bInfLoop) {
CHECK_STATUS(statustmp); // wEntryPoint = PHAC_DISCLOOP_ENTRY_POINT_LISTEN;
wConfig = wEntryPoint ? PHAC_DISCLOOP_CONFIG_PAS_LIS_TECH_CFG : PHAC_DISCLOOP_CONFIG_ACT_POLL_TECH_CFG;
pValue = wEntryPoint ? &bSaveLisTechCfg : &bSavePollTechCfg;
/* Set Configuration */
status = phacDiscLoop_SetConfig(pParams, wConfig, *pValue);
CHECK_STATUS(status);
if (wEntryPoint) {
/* Set Discovery poll state to detection */
status = phacDiscLoop_SetConfig(pParams, PHAC_DISCLOOP_CONFIG_NEXT_POLL_STATE, PHAC_DISCLOOP_POLL_STATE_DETECTION);
CHECK_STATUS(status);
/* Switch off RF field */
status = phhalHw_FieldOff(pHal);
CHECK_STATUS(status);
/* Wait for field-off time-out */
status = phhalHw_Wait(pHal, PHHAL_HW_TIME_MICROSECONDS, 5100);
CHECK_STATUS(status);
}
/* Start discovery loop in listen mode */ /* Start discovery loop in listen mode */
status = phacDiscLoop_Run(pParams, wEntryPoint); status = phacDiscLoop_Run(pParams, wEntryPoint);
if((status & PH_ERR_MASK) != PHAC_DISCLOOP_EXTERNAL_RFOFF) DEBUG_PRINTF("[%s|%u] Debug, Mode[%s] State[0x%04X].\n",__FUNCTION__, __LINE__, wEntryPoint ? "Listen" : "Poll", status);
DEBUG_PRINTF("[%s|%u] Debug, Mode[Listen] State[0x%04X].\n",__FUNCTION__, __LINE__, status);
wEntryPoint = NFCForumProcess(wEntryPoint, status);
// /* Wait for field-off time-out */
// statustmp = phhalHw_Wait(pHal, PHHAL_HW_TIME_MICROSECONDS, 5100);
// CHECK_STATUS(statustmp);
/* T4T Card Emulation mode */ /* T4T Card Emulation mode */
T4TCardEmulation(status); //T4TCardEmulation(status);
#if BSP_MOD_POLL_MODE #if BSP_MOD_POLL_MODE
/* Start in poll mode */ /* Start in poll mode */
@ -826,9 +847,9 @@ void TReaderLibrary(
statustmp = phacDiscLoop_SetConfig(pParams, PHAC_DISCLOOP_CONFIG_PAS_POLL_TECH_CFG, bSavePollTechCfg); statustmp = phacDiscLoop_SetConfig(pParams, PHAC_DISCLOOP_CONFIG_PAS_POLL_TECH_CFG, bSavePollTechCfg);
CHECK_STATUS(statustmp); CHECK_STATUS(statustmp);
// /* Switch off RF field */ /* Switch off RF field */
// statustmp = phhalHw_FieldOff(pHal); statustmp = phhalHw_FieldOff(pHal);
// CHECK_STATUS(statustmp); CHECK_STATUS(statustmp);
/* Wait for field-off time-out */ /* Wait for field-off time-out */
statustmp = phhalHw_Wait(pHal, PHHAL_HW_TIME_MICROSECONDS, 5100); statustmp = phhalHw_Wait(pHal, PHHAL_HW_TIME_MICROSECONDS, 5100);

View File

@ -73,15 +73,15 @@
(((((uint16_t)(x[0]) << 8) & 0xFF00) | (x[1])) + 2) : 0) (((((uint16_t)(x[0]) << 8) & 0xFF00) | (x[1])) + 2) : 0)
/* Enable(1) / Disable(0) printing error/info */ /* Enable(1) / Disable(0) printing error/info */
#define DETECT_ERROR 0 //#define DETECT_ERROR 0
//
#if DETECT_ERROR //#if DETECT_ERROR
#define DEBUG_ERROR_PRINT CHECK_STATUS // #define DEBUG_ERROR_PRINT CHECK_STATUS
#define PRINT_INFO(...) DEBUG_PRINTF(__VA_ARGS__) // #define PRINT_INFO(...) DEBUG_PRINTF(__VA_ARGS__)
#else /* DETECT_ERROR */ //#else /* DETECT_ERROR */
#define DEBUG_ERROR_PRINT(x) // #define DEBUG_ERROR_PRINT(x)
#define PRINT_INFO(...) // #define PRINT_INFO(...)
#endif /* DETECT_ERROR */ //#endif /* DETECT_ERROR */
/* Print system critical errors (with which execution can't proceed further) /* Print system critical errors (with which execution can't proceed further)
* and halt the execution. */ * and halt the execution. */

View File

@ -143,7 +143,7 @@ extern phhalHw_Pn76xx_DataParams_t * pHal;
/**************************************************Prints if error is detected**************************************************************/ /**************************************************Prints if error is detected**************************************************************/
/* Enable(1) / Disable(0) printing error/info */ /* Enable(1) / Disable(0) printing error/info */
#define DETECT_ERROR 0 #define DETECT_ERROR 1
#if DETECT_ERROR #if DETECT_ERROR
#define DEBUG_ERROR_PRINT(x) x #define DEBUG_ERROR_PRINT(x) x

View File

@ -249,9 +249,9 @@ void phApp_PrintTagInfo(phacDiscLoop_Sw_DataParams_t *pDataParams, uint16_t wNum
*/ */
void PrintErrorInfo(phStatus_t wStatus) void PrintErrorInfo(phStatus_t wStatus)
{ {
DEBUG_PRINTF("\n ErrorInfo Comp:"); DEBUG_PRINTF("\t ErrorInfo Comp:");
switch(wStatus & 0xFF00) switch(wStatus & PH_COMP_MASK)
{ {
case PH_COMP_BAL: case PH_COMP_BAL:
DEBUG_PRINTF("\t PH_COMP_BAL"); DEBUG_PRINTF("\t PH_COMP_BAL");
@ -299,7 +299,7 @@ void PrintErrorInfo(phStatus_t wStatus)
DEBUG_PRINTF("\t PH_COMP_OSAL"); DEBUG_PRINTF("\t PH_COMP_OSAL");
break; break;
default: default:
DEBUG_PRINTF("\t 0x%x",(wStatus & PH_COMPID_MASK)); DEBUG_PRINTF("\t %#X",(wStatus & PH_COMP_MASK));
break; break;
} }
@ -365,9 +365,10 @@ void PrintErrorInfo(phStatus_t wStatus)
DEBUG_PRINTF("\t PHAC_DISCLOOP_COLLISION_PENDING"); DEBUG_PRINTF("\t PHAC_DISCLOOP_COLLISION_PENDING");
break; break;
default: default:
DEBUG_PRINTF("\t 0x%x",(wStatus & PH_ERR_MASK)); DEBUG_PRINTF("\t %#X", (wStatus & PH_ERR_MASK));
break; break;
} }
DEBUG_PRINTF("\n");
} }
/****************************************************************************** /******************************************************************************

View File

@ -318,7 +318,7 @@ phStatus_t phhalHw_Pn5180_Init(
pDataParams->bSkipSend = PH_OFF; pDataParams->bSkipSend = PH_OFF;
pDataParams->bTransmited = PH_OFF; pDataParams->bTransmited = PH_OFF;
pDataParams->bMfcCryptoEnabled = PH_OFF; pDataParams->bMfcCryptoEnabled = PH_OFF;
pDataParams->bCardMode = PH_OFF; pDataParams->bCardMode = PH_ON;
pDataParams->bBalConnectionType = PHHAL_HW_BAL_CONNECTION_SPI; pDataParams->bBalConnectionType = PHHAL_HW_BAL_CONNECTION_SPI;
pDataParams->pRFISRCallback = &phhalHw_Pn5180_EventCallback; pDataParams->pRFISRCallback = &phhalHw_Pn5180_EventCallback;
pDataParams->pTimerISRCallBack = &phhalHw_Pn5180_GuardTimeCallBck; pDataParams->pTimerISRCallBack = &phhalHw_Pn5180_GuardTimeCallBck;

View File

@ -152,7 +152,7 @@
defined (NXPBUILD__PHHAL_HW_RC663) || \ defined (NXPBUILD__PHHAL_HW_RC663) || \
defined (NXPBUILD__PHHAL_HW_PN7462AU) || \ defined (NXPBUILD__PHHAL_HW_PN7462AU) || \
defined (NXPBUILD__PHHAL_HW_PN7642) defined (NXPBUILD__PHHAL_HW_PN7642)
#define NXPBUILD__PHAC_DISCLOOP_LPCD /**< SRC to enable LPCD is included. */ // #define NXPBUILD__PHAC_DISCLOOP_LPCD /**< SRC to enable LPCD is included. */
#endif #endif
#ifdef NXPBUILD__PHPAL_I14443P3A_SW #ifdef NXPBUILD__PHPAL_I14443P3A_SW