• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PH_ADD_COMPCODE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PH_ADD_COMPCODE函数的典型用法代码示例。如果您正苦于以下问题:C++ PH_ADD_COMPCODE函数的具体用法?C++ PH_ADD_COMPCODE怎么用?C++ PH_ADD_COMPCODE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PH_ADD_COMPCODE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: phalI15693_Sw_GetSystemInformation

phStatus_t phalI15693_Sw_GetSystemInformation(
    phalI15693_Sw_DataParams_t * pDataParams,
    uint8_t ** ppRxBuffer,
    uint16_t * pRxLength
    )
{
    phStatus_t  PH_MEMLOC_REM statusTmp;
    uint8_t     PH_MEMLOC_REM bCommand[1];
    uint8_t     PH_MEMLOC_REM bExpLength;

    /* Build command */
    bCommand[0] = PHAL_I15693_SW_CMD_GET_SYSTEM_INFO;

    /* Clear Option bit */
    PH_CHECK_SUCCESS_FCT(statusTmp, phalI15693_Sw_Int_SetOptionBit(pDataParams, PHAL_I15693_OPTION_OFF));

    /* Set short timeout. */
    PH_CHECK_SUCCESS_FCT(statusTmp, phpalSli15693_SetConfig(
        pDataParams->pPalSli15693DataParams,
        PHPAL_SLI15693_CONFIG_TIMEOUT_US,
        PHPAL_SLI15693_TIMEOUT_SHORT_US));

    /* Proceed with the command in lower layers */
    PH_CHECK_SUCCESS_FCT(statusTmp, phpalSli15693_Exchange(
        pDataParams->pPalSli15693DataParams,
        PH_EXCHANGE_DEFAULT,
        bCommand,
        1,
        ppRxBuffer,
        pRxLength));

    /* Check number of data received */
    if (*pRxLength == 0)
    {
        return PH_ADD_COMPCODE(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_I15693);
    }

    /* Expected length is 9 by default */
    bExpLength = 9;

    /* Check for DSFID byte */
    if ((*ppRxBuffer[0]) & PHAL_I15693_INFO_FLAGS_DSFID)
    {
        ++bExpLength;
    }

    /* Check for AFI byte */
    if ((*ppRxBuffer[0]) & PHAL_I15693_INFO_FLAGS_AFI)
    {
        ++bExpLength;
    }

    /* Check for MEMSIZE bytes */
    if ((*ppRxBuffer[0]) & PHAL_I15693_INFO_FLAGS_MEMSIZE)
    {
        bExpLength += 2;
    }

    /* Check for ICREF byte */
    if ((*ppRxBuffer[0]) & PHAL_I15693_INFO_FLAGS_ICREF)
    {
        ++bExpLength;
    }

    /* Check response length */
    if (*pRxLength < bExpLength)
    {
        return PH_ADD_COMPCODE(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_I15693);
    }

    return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_I15693);
}
开发者ID:zhaohuizhang,项目名称:DanMan,代码行数:72,代码来源:phalI15693_Sw.c


示例2: phalMfdf_Int_ComputeErrorResponse


//.........这里部分代码省略.........
        break;

    case PHAL_MFDF_RESP_NO_CHANGES:
        status = PHAL_MFDF_NO_CHANGES;
        break;

    case PHAL_MFDF_RESP_ERR_OUT_OF_EEPROM_ERROR:
        status = PHAL_MFDF_ERR_OUT_OF_EEPROM_ERROR;
        break;

    case PHAL_MFDF_RESP_ERR_INTEGRITY_ERROR:
        status = PHAL_MFDF_ERR_PICC_CRYPTO;
        break;

    case PHAL_MFDF_RESP_ERR_PARAMETER_ERROR:
        status = PHAL_MFDF_ERR_PARAMETER_ERROR;
        break;

    case PHAL_MFDF_RESP_NO_SUCH_KEY:
        status = PHAL_MFDF_ERR_NO_SUCH_KEY;
        break;

    case PHAL_MFDF_RESP_ERR_LENGTH_ERROR:
        status = PH_ERR_LENGTH_ERROR;
        break;

    case PHAL_MFDF_RESP_PERMISSION_DENIED:
        status = PHAL_MFDF_ERR_PERMISSION_DENIED;
        break;

    case PHAL_MFDF_RESP_APPLICATION_NOT_FOUND:
        status = PHAL_MFDF_ERR_APPLICATION_NOT_FOUND;
        break;

    case PHAL_MFDF_RESP_ERR_AUTHENTICATION_ERROR:
        status = PH_ERR_AUTH_ERROR;
        break;

    case PHAL_MFDF_RESP_ADDITIONAL_FRAME:
        status = PH_ERR_SUCCESS_CHAINING;
        break;

    case PHAL_MFDF_RESP_ERR_BOUNDARY_ERROR:
        status = PHAL_MFDF_ERR_BOUNDARY_ERROR;
        break;

    case PHAL_MFDF_RESP_ERR_COMMAND_ABORTED:
        status = PHAL_MFDF_ERR_COMMAND_ABORTED;
        break;

    case PHAL_MFDF_RESP_ERR_COUNT:
        status = PHAL_MFDF_ERR_COUNT;
        break;

    case PHAL_MFDF_RESP_ERR_DUPLICATE:
        status = PHAL_MFDF_ERR_DUPLICATE;
        break;

    case PHAL_MFDF_RESP_ERR_FILE_NOT_FOUND:
        status = PHAL_MFDF_ERR_FILE_NOT_FOUND;
        break;

    case PHAL_MFDF_RESP_ERR_APPL_INTEGRITY_ERROR:
    case PHAL_MFDF_RESP_ERR_PICC_INTEGRITY:
    case PHAL_MFDF_RESP_ERR_EEPROM:
    case PHAL_MFDF_RESP_ERR_FILE_INTEGRITY:
    case PHAL_MFDF_RESP_ERR_PIC_DISABLED:
    case PHAL_MFDF_RESP_ILLEGAL_COMMAND_CODE:
        status = PHAL_MFDF_ERR_DF_GEN_ERROR;
        PH_CHECK_SUCCESS_FCT(statusTmp, phalMfdf_SetConfig(
            pDataParams,
            PHAL_MFDF_ADDITIONAL_INFO,
            wStatus));
        break;

    case PHAL_MFDF_ISO7816_ERR_WRONG_LENGTH:
    case PHAL_MFDF_ISO7816_ERR_WRONG_LE:
    case PHAL_MFDF_ISO7816_ERR_FILE_NOT_FOUND:
    case PHAL_MFDF_ISO7816_ERR_WRONG_PARAMS:
    case PHAL_MFDF_ISO7816_ERR_WRONG_LC:
    case PHAL_MFDF_ISO7816_ERR_NO_PRECISE_DIAGNOSTICS:
    case PHAL_MFDF_ISO7816_ERR_EOF_REACHED:
    case PHAL_MFDF_ISO7816_ERR_FILE_ACCESS:
    case PHAL_MFDF_ISO7816_ERR_FILE_EMPTY:
    case PHAL_MFDF_ISO7816_ERR_MEMORY_FAILURE:
    case PHAL_MFDF_ISO7816_ERR_INCORRECT_PARAMS:
    case PHAL_MFDF_ISO7816_ERR_WRONG_CLA:
    case PHAL_MFDF_ISO7816_ERR_UNSUPPORTED_INS:
        status = PHAL_MFDF_ERR_DF_7816_GEN_ERROR;
        PH_CHECK_SUCCESS_FCT(statusTmp, phalMfdf_SetConfig(
            pDataParams,
            PHAL_MFDF_ADDITIONAL_INFO,
            wStatus));
        break;

    default:
        status = PH_ERR_PROTOCOL_ERROR;
    }
    return PH_ADD_COMPCODE(status, PH_COMP_AL_MFDF);
}
开发者ID:halilercikan,项目名称:DWMS,代码行数:101,代码来源:phalMfdf_Int.c


示例3: phnpSnep_Client_Init

/* SNEP Client Initialization API */
phStatus_t phnpSnep_Client_Init( void                           *pDataParams,
                                phnpSnep_Fri_Config_t           *pConfigInfo,
                                ph_NfcHandle                     hRemDevHandle,
                                pphnpSnep_Fri_ConnectCB_t        pConnClientCb,
                                phnpSnep_Fri_ClientSession_t    *pClient,
                                void                            *pContext)
{
    phStatus_t status = PH_ERR_SUCCESS;

    PH_LOG_HELPER_ALLOCATE_TEXT(bFunctionName, "phnpSnep_Client_Init");
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pConfigInfo);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pConnClientCb);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pClientSession);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pContext);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(status);
    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
    PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_ENTER);
    PH_ASSERT_NULL (pDataParams);
    PH_ASSERT_NULL (pConfigInfo);
    PH_ASSERT_NULL (pConnClientCb);
    PH_ASSERT_NULL (pClient);
    PH_ASSERT_NULL (pContext);


    /* Check data parameters */
    if (PH_GET_COMPCODE(pDataParams) != PH_COMP_NP_SNEP)
    {
        status = PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_NP_SNEP);

        PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
        PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_INFO, status_log, &status);
        PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_LEAVE);
        return status;
    }

    /* perform operation on active layer */
    switch (PH_GET_COMPID(pDataParams))
    {
#ifdef NXPBUILD__PHNP_SNEP_FRI
    case PHNP_SNEP_FRI_ID:
    status = phnpSnep_Fri_Client_Init( pDataParams,
                                       pConfigInfo,
                                       hRemDevHandle,
                                       pConnClientCb,
                                       pClient,
                                       pContext
                                      );
        break;
#endif /* NXPBUILD__PHNP_SNEP_FRI */

    default:
        status = PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_NP_SNEP);
        break;
    }

    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
    PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_INFO, status_log, &status);
    PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_LEAVE);


    return status;

}
开发者ID:idodoyo,项目名称:nxprdlib,代码行数:64,代码来源:phnpSnep.c


示例4: phbalReg_GetPortList

phStatus_t phbalReg_GetPortList(
                                void * pDataParams,
                                uint16_t wPortBufSize,
                                uint8_t * pPortNames,
                                uint16_t * pNumOfPorts
                                )
{
    phStatus_t PH_MEMLOC_REM status;
#ifdef NXPBUILD__PH_LOG
    uint16_t PH_MEMLOC_REM wCnt;
    uint16_t PH_MEMLOC_REM wLen;
#endif /* NXPBUILD__PH_LOG */

    PH_LOG_HELPER_ALLOCATE_TEXT(bFunctionName, "phbalReg_GetPortList");
    /*PH_LOG_HELPER_ALLOCATE_PARAMNAME(pDataParams);*/
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(wPortBufSize);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pPortNames);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pNumOfPorts);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(status);
    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
    PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_DEBUG, wPortBufSize_log, &wPortBufSize);
    PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_ENTER);
    PH_ASSERT_NULL (pDataParams);
    PH_ASSERT_NULL (pPortNames);
    PH_ASSERT_NULL (pNumOfPorts);

    /* Check data parameters */
    if (PH_GET_COMPCODE(pDataParams) != PH_COMP_BAL)
    {
		status = PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_BAL);

        PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
        PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_INFO, status_log, &status);
        PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_LEAVE);

        return status; 
    }

    /* perform operation on active layer */
    switch (PH_GET_COMPID(pDataParams))
    {
#ifdef NXPBUILD__PHBAL_REG_STUB
    case PHBAL_REG_STUB_ID:
        status = phbalReg_Stub_GetPortList((phbalReg_Stub_DataParams_t*)pDataParams, wPortBufSize, pPortNames, pNumOfPorts);
        break;
#endif /* NXPBUILD__PHBAL_REG_STUB */

#ifdef NXPBUILD__PHBAL_REG_LPC1768SPI
    case PHBAL_REG_LPC1768SPI_ID:
        status = phbalReg_Lpc1768Spi_GetPortList((phbalReg_Lpc1768Spi_DataParams_t *)pDataParams, wPortBufSize, pPortNames, pNumOfPorts);
        break;
#endif /* NXPBUILD__PHBAL_REG_LPC1768SPI */

#ifdef NXPBUILD__PHBAL_REG_LPC1768I2C
    case PHBAL_REG_LPC1768I2C_ID:
        status = phbalReg_Lpc1768I2c_GetPortList((phbalReg_Lpc1768I2c_DataParams_t *)pDataParams, wPortBufSize, pPortNames, pNumOfPorts);
        break;
#endif /* NXPBUILD__PHBAL_REG_LPC1768SPI */

    default:
        status = PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_BAL);
        break;
    }

    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
#ifdef NXPBUILD__PH_LOG
    if ((status & PH_ERR_MASK) == PH_ERR_SUCCESS)
    {
        for (wCnt = 0; wCnt < *pNumOfPorts; wCnt++)
        {
            wLen = (uint16_t)strlen((char*)pPortNames);
            PH_LOG_HELPER_ADDPARAM_BUFFER(PH_LOG_LOGTYPE_DEBUG, pPortNames_log, pPortNames, wLen);
            pPortNames += wLen;
        }
    }
#endif /* NXPBUILD__PH_LOG */
    PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_DEBUG, pNumOfPorts_log, pNumOfPorts);
    PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_INFO, status_log, &status);
    PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_LEAVE);

    return status;
}
开发者ID:ipskid,项目名称:clev663,代码行数:82,代码来源:phbalReg.c


示例5: phalMfdf_ExchangeCmd

/*
*
* Should take care of wrapping and unwrapping if ISO 7816 Wrapped mode
* Does not handle any chaining or CMAC generation/verification or encryption/decryption
*/
phStatus_t phalMfdf_ExchangeCmd(
                                void * pDataParams, 
                                void * pPalMifareDataParams,
                                uint8_t bWrappedMode,
                                uint8_t * pSendBuff,
                                uint16_t wCmdLen,
                                uint8_t * pResponse,
                                uint16_t * pRxlen
                                )
{
    uint16_t    PH_MEMLOC_REM wFrameLen;
    uint8_t     PH_MEMLOC_REM * pRecv;
    phStatus_t  PH_MEMLOC_REM statusTmp;
    uint8_t     PH_MEMLOC_REM bStatusByte = 0xFF;
    uint8_t     PH_MEMLOC_REM pApdu[5] = { PHAL_MFDF_WRAPPEDAPDU_CLA, 0x00, PHAL_MFDF_WRAPPEDAPDU_P1, PHAL_MFDF_WRAPPEDAPDU_P2, 0x00 };

    if (bWrappedMode)
    {
        wFrameLen = PHAL_MFDF_MAXWRAPPEDAPDU_SIZE;
    }
    else
    {
        wFrameLen = PHAL_MFDF_MAXDFAPDU_SIZE;
    }

    if (wCmdLen > wFrameLen)
    {
        return PH_ADD_COMPCODE(PH_ERR_BUFFER_OVERFLOW, PH_COMP_AL_MFDF);
    }

    /* Send the data to PICC */
    if (bWrappedMode)
    {
        pApdu[1] = pSendBuff[0]; /* Desfire cmd code in INS */
        pApdu[4] = (uint8_t)(wCmdLen) - 0x01u;

        PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4(
            pPalMifareDataParams,
            pApdu[4] == 0x00 ? PH_EXCHANGE_DEFAULT : PH_EXCHANGE_BUFFER_FIRST,
            pApdu,
            PHAL_MFDF_WRAP_HDR_LEN,
            &pRecv,
            pRxlen));

        if (pApdu[4] != 0x00)
        {
            PH_CHECK_SUCCESS_FCT(statusTmp,  phpalMifare_ExchangeL4(
                pPalMifareDataParams,
                PH_EXCHANGE_BUFFER_CONT,
                &pSendBuff[1],
                wCmdLen - 1,
                &pRecv,
                pRxlen));

            /* Le byte */
            PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4(
                pPalMifareDataParams,
                PH_EXCHANGE_BUFFER_LAST,
                &pApdu[2], /* Le is always zero in wrapped mode. */
                0x01,
                &pRecv,
                pRxlen));
        }
    }
    else
    {
        PH_CHECK_SUCCESS_FCT(statusTmp, phpalMifare_ExchangeL4(
            pPalMifareDataParams,
            PH_EXCHANGE_DEFAULT,
            pSendBuff,
            wCmdLen,
            &pRecv,
            pRxlen));
    }
    if (bWrappedMode)
    {
        memcpy(pResponse, pRecv, (*pRxlen) - 2); /* PRQA S 3200 */
        bStatusByte = pRecv[(*pRxlen) - 1];
        (*pRxlen) -= 2;
    } 
    else 
    {
        memcpy(pResponse, &pRecv[1], (*pRxlen) - 1); /* PRQA S 3200 */
        bStatusByte = pRecv[0];
        (*pRxlen) -= 1;
    }
    return phalMfdf_Int_ComputeErrorResponse(pDataParams, bStatusByte);
}
开发者ID:halilercikan,项目名称:DWMS,代码行数:93,代码来源:phalMfdf_Int.c


示例6: phalTop_Sw_Int_T4T_CheckNdef

phStatus_t phalTop_Sw_Int_T4T_CheckNdef(
                                        phalTop_T4T_t * pT4T,
                                        uint8_t * pNdefPresence
                                        )
{
    uint16_t PH_MEMLOC_REM status;
    uint16_t PH_MEMLOC_REM pBytesRead;
    uint8_t  PH_MEMLOC_REM *ppRxBuffer;
    uint8_t  PH_MEMLOC_REM aFid_MApp[2] = {0x00, 0x3F}; /* Master Application ISO File ID */
    uint8_t  PH_MEMLOC_REM aFid_CC[2] = {0x03, 0xE1};
    uint8_t  PH_MEMLOC_REM aNdefApp_Name[7] = {0xD2, 0x76, 0x00,        /**< DF Name buffer */
                                               0x00, 0x85, 0x01, 0x01};
    uint8_t  PH_MEMLOC_REM aNdefApp_Len = 0X07;
    uint8_t  PH_MEMLOC_REM *pFCI;
    uint16_t PH_MEMLOC_REM *pwFCILen = 0;
    uint16_t PH_MEMLOC_REM wNdef_Fid;
    uint16_t PH_MEMLOC_REM wErrorCode;
    phalMfdf_Sw_DataParams_t PH_MEMLOC_REM *pMfdf;
    pMfdf = (phalMfdf_Sw_DataParams_t *)(pT4T->phalT4TDataParams);

    pMfdf->bWrappedMode = 1;
    pT4T->bNdefSupport = PH_UNSUPPORTED;
    pT4T->bNdefFormatted = PH_UNSUPPORTED;
    pT4T->bNdefPresence = false;
    *pNdefPresence = PH_OFF;

    /* Select the NDEF Tag Application with ISO File id of the Application */
    status = phalMfdf_IsoSelectFile(
        pT4T->phalT4TDataParams,
        PH_EXCHANGE_DEFAULT,
        0x04,
        0,                                          /* Look for File ID of 0xE105 */
        aNdefApp_Name,
        aNdefApp_Len,
        &pFCI,
        pwFCILen
        );
    if((status & PH_ERR_MASK) == PH_ERR_IO_TIMEOUT)
    {
        return status;
    }

    /* If No Valid Application is found then Format to make Tag as NDEF */
    wErrorCode = pMfdf->wAdditionalInfo;
    if(wErrorCode == 0x6A82)                             /* PHAL_MFDF_ISO7816_ERR_FILE_NOT_FOUND = 0x6A82*/
    {
        PH_CHECK_SUCCESS_FCT(status, phalTop_Sw_Int_T4T_FormatNdef(pT4T));
        PH_CHECK_SUCCESS_FCT(status, phalMfdf_IsoSelectFile(
            pT4T->phalT4TDataParams,
            PH_EXCHANGE_DEFAULT,
            0x04,
            0,
            aNdefApp_Name,
            aNdefApp_Len,
            &pFCI,
            pwFCILen
            ));
    }

    if((status & PH_ERR_MASK) == PH_ERR_SUCCESS)
    {
    	pT4T->bNdefFormatted = PH_SUPPORTED;

        /* Select the Capability Container (CC) file once NDEF Tag Application is selected */
        PH_CHECK_SUCCESS_FCT(status, phalMfdf_IsoSelectFile(
            pT4T->phalT4TDataParams,
            0x0C,                              /* If bOption == 00 FCI(file control info) is returned. If 0x0C no FCI returned */
            0x00,
            aFid_CC,                                          /* Look for File ID of 0xE103 */
            NULL,
            0x00,
            &pFCI,
            pwFCILen
            ));

        /* Read the CC file and select the NDEF file */
        PH_CHECK_SUCCESS_FCT(status, phalMfdf_IsoReadBinary(
            pT4T->phalT4TDataParams,
            PH_EXCHANGE_DEFAULT,
            0x00,                                             /* File offset where to start reading data */
            0x00,
            0x0F,                                             /* number of bytes to read. If 0, then entire file to be read */
            &ppRxBuffer,
            &pBytesRead
            ));

        pT4T->wCCLEN = ((uint16_t)ppRxBuffer[PHAL_TOP_T4T_CCLEN_OFFSET] << 8) | ppRxBuffer[PHAL_TOP_T4T_CCLEN_OFFSET + 1];
        if(pT4T->wCCLEN < 0x000F)
        {
            return PH_ADD_COMPCODE(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_TOP);
        }

        if(ppRxBuffer[PHAL_TOP_T4T_NDEFTLV_OFFSET] == PHAL_TOP_T4T_NDEF_TLV)
        {
            pT4T->bRa = ppRxBuffer[PHAL_TOP_T4T_NDEFTLV_OFFSET + 6];

            if(pT4T->bRa == PHAL_TOP_T4T_NDEF_FILE_READ)
            {
                pT4T->bWa = ppRxBuffer[PHAL_TOP_T4T_NDEFTLV_OFFSET + 7];
                pT4T->bVno = ppRxBuffer[PHAL_TOP_T4T_VERSION_OFFSET];
//.........这里部分代码省略.........
开发者ID:idodoyo,项目名称:nxprdlib,代码行数:101,代码来源:phalTop_Sw_Int_T4T.c


示例7: phbalReg_SetPort

phStatus_t phbalReg_SetPort(
                            void * pDataParams,
                            uint8_t * pPortName
                            )
{
    phStatus_t PH_MEMLOC_REM status;

    PH_LOG_HELPER_ALLOCATE_TEXT(bFunctionName, "phbalReg_SetPort");
    /*PH_LOG_HELPER_ALLOCATE_PARAMNAME(pDataParams);*/
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pPortName);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(status);
    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
    PH_LOG_HELPER_ADDPARAM_BUFFER(PH_LOG_LOGTYPE_DEBUG, pPortName_log, pPortName, (uint16_t)strlen((char*)pPortName));
    PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_ENTER);
    PH_ASSERT_NULL (pDataParams);
    PH_ASSERT_NULL (pPortName);

    /* Check data parameters */
    if (PH_GET_COMPCODE(pDataParams) != PH_COMP_BAL)
    {
		status = PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_BAL);

        PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
        PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_INFO, status_log, &status);
        PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_LEAVE);

        return status;
    }

    /* perform operation on active layer */
    switch (PH_GET_COMPID(pDataParams))
    {
#ifdef NXPBUILD__PHBAL_REG_STUB
    case PHBAL_REG_STUB_ID:
        status = phbalReg_Stub_SetPort((phbalReg_Stub_DataParams_t*)pDataParams, pPortName);
        break;
#endif /* NXPBUILD__PHBAL_REG_STUB */

#ifdef NXPBUILD__PHBAL_REG_LPC1768SPI
    case PHBAL_REG_LPC1768SPI_ID:
        status = phbalReg_Lpc1768Spi_SetPort((phbalReg_Lpc1768Spi_DataParams_t *)pDataParams, pPortName);
        break;
#endif /* NXPBUILD__PHBAL_REG_LPC1768SPI */

#ifdef NXPBUILD__PHBAL_REG_LPC1768I2C
    case PHBAL_REG_LPC1768I2C_ID:
        status = phbalReg_Lpc1768I2c_SetPort((phbalReg_Lpc1768I2c_DataParams_t *)pDataParams, pPortName);
        break;
#endif /* NXPBUILD__PHBAL_REG_LPC1768SPI */

    default:
        status = PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_BAL);
        break;
    }

    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
    PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_INFO, status_log, &status);
    PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_LEAVE);

    return status;
}
开发者ID:ipskid,项目名称:clev663,代码行数:61,代码来源:phbalReg.c


示例8: phalTop_Sw_Int_T3T_CheckNdef

phStatus_t phalTop_Sw_Int_T3T_CheckNdef(
                                        phalTop_T3T_t * pT3T,
                                        uint8_t * pNdefPresence
                                        )
{
    phStatus_t PH_MEMLOC_REM status;
    uint8_t    PH_MEMLOC_REM wLength;
    uint8_t    PH_MEMLOC_REM bNDEFSystemCode[2] = { 0x12, 0xFC};
    uint8_t    PH_MEMLOC_REM bSystemCode[2] = { 0x88, 0xB4};
    uint8_t    PH_MEMLOC_REM wMoreCardsAvailable;
    uint8_t    PH_MEMLOC_REM bBlockList[2] = { 0x80, 0x00};   /* Read Zero Block to get Attribute Block */
    uint8_t    PH_MEMLOC_REM bMCBlockList[2] = { 0x80, 0x88}; /* Memory Configuration(MC) Block is 88h */
    uint8_t    PH_MEMLOC_REM bReadServiceList[2] = { 0x0B, 0x00};
    uint8_t    PH_MEMLOC_REM bRxNumBlocks = 0;
    uint8_t    PH_MEMLOC_REM bBlockData[16];

    *pNdefPresence = PH_OFF;
    pT3T->bNdefPresence = PH_OFF;
    pT3T->bNdefSupport = PH_UNSUPPORTED;
    pT3T->bNdefFormatted = PH_UNSUPPORTED;

    status = phalFelica_ActivateCard(
        pT3T->phalT3TDataParams,
        bNDEFSystemCode,
        0X00,
        pT3T->bUid,
        &wLength,
        &wMoreCardsAvailable);

    if ((status & PH_ERR_MASK) == PH_ERR_SUCCESS)
    {
        pT3T->bNdefSupport = PH_SUPPORTED;
        pT3T->bNdefFormatted = PH_SUPPORTED;

        PH_CHECK_SUCCESS_FCT(status, phalFelica_Read(
            pT3T->phalT3TDataParams,
            0x01,
            bReadServiceList,
            0x01,
            bBlockList,
            0x02,
            &bRxNumBlocks,
            bBlockData));

        pT3T->bVno = bBlockData[0];
        pT3T->bNbr = bBlockData[1];
        pT3T->bNbw = bBlockData[2];
        pT3T->bNmaxb = (uint16_t)(((uint16_t)bBlockData[3] << 8) | bBlockData[4]);
        pT3T->bRwa = bBlockData[10];
        pT3T->wNdefLength = (uint16_t)(((uint32_t)bBlockData[11] << 16) | (((uint16_t)bBlockData[12] << 8) | bBlockData[13]));

        if((pT3T->wNdefLength != 0) && ((pT3T->bVno == PHAL_TOP_T3T_NDEF_SUPPORTED_VNO1)
            || (pT3T->bVno == PHAL_TOP_T3T_NDEF_SUPPORTED_VNO2)))
        {
            pT3T->bNdefPresence = PH_ON;
            *pNdefPresence = PH_ON;

            if(pT3T->bRwa == PHAL_TOP_T3T_AIB_RWA_RW)
            {
                pT3T->bTagState = PHAL_TOP_T3T_STATE_READWRITE;
            }
            else if(pT3T->bRwa == PHAL_TOP_T3T_AIB_RWA_RO)
            {
                pT3T->bTagState = PHAL_TOP_T3T_STATE_READONLY;
            }
            else
            {
                /* Do Nothing */
            }
        }
        else if(pT3T->wNdefLength == 0)
        {
            pT3T->bTagState = PHAL_TOP_T3T_STATE_INITIALIZED;
        }
        else
        {
            /* Do Nothing */
        }
    }
    else
    {
        /* Check if the Tag is Formattable or not and update NdefSupport flag */
        status = phalFelica_ActivateCard(
            pT3T->phalT3TDataParams,
            bSystemCode,
            0,                                                    /* Time Slot */
            pT3T->bUid,
            &wLength,
            &wMoreCardsAvailable);
        if ((status & PH_ERR_MASK) != PH_ERR_SUCCESS)
        {
        	/* This is not a valid T3T TAG. */
        	return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_TOP);
    }

        /* Read MC(Memory Configuration) Block to get SYS_OP Value */
        PH_CHECK_SUCCESS_FCT(status, phalFelica_Read(
            pT3T->phalT3TDataParams,
            0x01,
            bReadServiceList,
//.........这里部分代码省略.........
开发者ID:ipskid,项目名称:clev663,代码行数:101,代码来源:phalTop_Sw_Int_T3T.c


示例9: phalTop_Sw_Int_T3T_WriteNdef

phStatus_t phalTop_Sw_Int_T3T_WriteNdef(
                                        phalTop_T3T_t * pT3T,
                                        uint8_t * pData,
                                        uint16_t wLength
                                        )
{
    phStatus_t PH_MEMLOC_REM status;
    uint16_t   PH_MEMLOC_REM wTempIndex;
    uint16_t   PH_MEMLOC_REM wIndex;
    uint16_t   PH_MEMLOC_REM wCheckSum;
    uint8_t    PH_MEMLOC_REM bBlockData[16];
    uint8_t    PH_MEMLOC_REM bAttBlock[2] = { 0x80, 0x00};   /* Read Zero Block to get Attribute Block */
    uint8_t    PH_MEMLOC_REM bBlockList[2] = { 0x80, 0x01};  /* First Block to Write Ndef Data */
    uint8_t    PH_MEMLOC_REM bReadServiceList[2] = { 0x0B, 0x00};
    uint8_t    PH_MEMLOC_REM bWriteServiceList[2] = { 0x09, 0x00};
    uint8_t    PH_MEMLOC_REM bRxNumBlocks = 0;


    if(!((pT3T->bNdefFormatted == PH_SUPPORTED) || (pT3T->bNdefSupport == PH_SUPPORTED)))
    {
        return PH_ADD_COMPCODE(PHAL_TOP_ERR_NOT_FORMATTED, PH_COMP_AL_TOP);
    }

    /* Check NDEF length */
    if((wLength > (pT3T->bNmaxb * PHAL_TOP_T3T_BLOCK_SIZE)) || (wLength == 0))
    {
        return PH_ADD_COMPCODE(PH_ERR_INVALID_PARAMETER, PH_COMP_AL_TOP);
    }

    /* Read and Update Attribute Block before Writing NDEF */
    PH_CHECK_SUCCESS_FCT(status, phalFelica_Read(
        pT3T->phalT3TDataParams,
        0x01,
        bReadServiceList,
        0x01,                                                /* wNoBlocks */
        bAttBlock,
        0x02,
        &bRxNumBlocks,
        bBlockData));

    if(bBlockData[0x0A] != PHAL_TOP_T3T_AIB_RWA_RW)
    {
        return PH_ADD_COMPCODE(PHAL_TOP_ERR_READONLY_TAG, PH_COMP_AL_TOP);
    }

    bBlockData[PHAL_TOP_T3T_WRITE_FLAG_ADDRESS] = PHAL_TOP_T3T_WRITE_FLAG_SET;
    bBlockData[11] = 0x00U;
    bBlockData[12] = 0x00U;
    bBlockData[13] = 0x00U;

    /* Calculate CheckSum */
    for(wIndex = 0, wCheckSum = 0; wIndex < 14; wIndex++)
    {
        wCheckSum += bBlockData[wIndex];
    }
    bBlockData[14] = (uint8_t)(wCheckSum >> 8);
    bBlockData[15] = (uint8_t)(wCheckSum & 0x00FF);

    PH_CHECK_SUCCESS_FCT(status, phalFelica_Write(
        pT3T->phalT3TDataParams,
        0x01,
        bWriteServiceList,
        0x01,
        bAttBlock,
        0x02,
        bBlockData));

    /* Write NDEF Data */
    for(wIndex = 0, wTempIndex = 0;
        wIndex < (wLength / PHAL_TOP_T3T_BLOCK_SIZE);
        wIndex++)
    {
        memcpy(&bBlockData[0], &pData[wTempIndex], PHAL_TOP_T3T_BLOCK_SIZE);    /* PRQA S 3200 */

        PH_CHECK_SUCCESS_FCT(status, phalFelica_Write(
            pT3T->phalT3TDataParams,
            0x01,
            bWriteServiceList,
            0x01,
            bBlockList,
            0x02,
            bBlockData));

        wTempIndex += 16;
        if(bBlockList[1] == 0xFF)
        {
            bBlockList[0] += 1;
        }
        else
        {
            bBlockList[1] += 1;
        }
    }

    /* Write the remaining NDEF bytes in the Last Block after adding padding bytes */
    wIndex = wLength % PHAL_TOP_T3T_BLOCK_SIZE;
    if (wIndex != 0)
    {
        memcpy(&bBlockData[0], &pData[wTempIndex], wIndex);     /* PRQA S 3200 */
        memset(&bBlockData[wIndex], 0x00, PHAL_TOP_T3T_BLOCK_SIZE - wIndex);    /* PRQA S 3200 */
//.........这里部分代码省略.........
开发者ID:ipskid,项目名称:clev663,代码行数:101,代码来源:phalTop_Sw_Int_T3T.c


示例10: phalTop_Sw_Int_T3T_FormatNdef

phStatus_t phalTop_Sw_Int_T3T_FormatNdef(
    phalTop_T3T_t * pT3T
    )
{
    phStatus_t PH_MEMLOC_REM status;
    uint16_t   PH_MEMLOC_REM wIndex;
    uint16_t   PH_MEMLOC_REM wCheckSum;
    uint8_t    PH_MEMLOC_REM bBlockData[16];
    uint8_t    PH_MEMLOC_REM bBlockList[2] = { 0x80, 0x00};   /* Read Zero Block to get Attribute Block */
    uint8_t    PH_MEMLOC_REM bSystemCode[2] = { 0x88, 0xB4};
    uint8_t    PH_MEMLOC_REM bReadServiceList[2] = { 0x0B, 0x00};
    uint8_t    PH_MEMLOC_REM bWriteServiceList[2] = { 0x09, 0x00};
    uint8_t    PH_MEMLOC_REM bRxNumBlocks = 0;
    uint8_t    PH_MEMLOC_REM bMCBlockList[2] = { 0x80, 0x88}; /* Memory Configuration(MC) Block is 88h */
    uint8_t    PH_MEMLOC_REM wLength;
    uint8_t    PH_MEMLOC_REM wMoreCardsAvailable;

    if(pT3T->bNdefSupport != PH_SUPPORTED)
    {
        /* Write MC Block to change Tag to NDEF Complaiant as CheckNDEF falied to activate Tag as NDEF. */
        PH_CHECK_SUCCESS_FCT(status, phalFelica_ActivateCard(
            pT3T->phalT3TDataParams,
            bSystemCode,
            0,                                                    /* Time Slot */
            pT3T->bUid,
            &wLength,
            &wMoreCardsAvailable));

        /* Read MC(Memory Configuration) Block to get SYS_OP Value */
        PH_CHECK_SUCCESS_FCT(status, phalFelica_Read(
            pT3T->phalT3TDataParams,
            0x01,
            bReadServiceList,
            0x01,
            bMCBlockList,
            0x02,
            &bRxNumBlocks,
            bBlockData));

        if((bBlockData[0] == 0xFF) && (bBlockData[1] == 0xFF) && (bBlockData[2] == 0xFF)
            && (bBlockData[3] == 0x00) && (bBlockData[4] == 0xFF))
        {
            bBlockData[3] = 0x01;

            PH_CHECK_SUCCESS_FCT(status, phalFelica_Write(
                pT3T->phalT3TDataParams,
                0x01,
                bWriteServiceList,
                0x01,
                bMCBlockList,
                0x02,
                bBlockData));
        }
        else if((bBlockData[0] == 0xFF) && (bBlockData[1] == 0xFF) && (bBlockData[2] == 0xFF)
            && (bBlockData[3] == 0x01) && (bBlockData[4] == 0xFF))
        {
            /* Proceed with write of Attribute Information block */
        }
        else
        {
            return PH_ADD_COMPCODE(PHAL_TOP_ERR_INVALID_TAG, PH_COMP_AL_TOP);
        }
    }

    /* Write Attribute Information Block(AIB) with some Nbr and Nbw values */
    if((pT3T->bVno == PHAL_TOP_T3T_NDEF_SUPPORTED_VNO1) ||
        (pT3T->bVno == PHAL_TOP_T3T_NDEF_SUPPORTED_VNO2))
    {
        bBlockData[0] = pT3T->bVno;
    }
    else
    {
        bBlockData[0] = 0x11;
    }
    bBlockData[1] = 0x01;                                 /* Value of Nbr for Felica Lite is 1 */
    bBlockData[2] = 0x01;                                 /* Value of Nbw for Felica Lite is 1 */
    if(pT3T->bNmaxb < 0x000D)
    {
        bBlockData[3] = 0x00;                             /* MSB Value of Nmaxb */
        bBlockData[4] = 0x0D;                             /* LSB Value of Nmaxb */
    }
    else
    {
        bBlockData[3] = (uint8_t)((uint16_t)(pT3T->bNmaxb & 0xFF00) >> 8);
        bBlockData[4] = (uint8_t)(pT3T->bNmaxb & 0x00FF);
    }
    bBlockData[5] = 0x00;
    bBlockData[6] = 0x00;
    bBlockData[7] = 0x00;
    bBlockData[8] = 0x00;
    bBlockData[PHAL_TOP_T3T_WRITE_FLAG_ADDRESS] = 0x00U;
    bBlockData[10] = PHAL_TOP_T3T_AIB_RWA_RW;
    bBlockData[11] = 0x00U;
    bBlockData[12] = 0x00U;
    bBlockData[13] = 0x00U;

    for(wIndex = 0, wCheckSum = 0; wIndex < 14; wIndex++)
    {
        wCheckSum += bBlockData[wIndex];
    }
//.........这里部分代码省略.........
开发者ID:ipskid,项目名称:clev663,代码行数:101,代码来源:phalTop_Sw_Int_T3T.c


示例11: phalTop_Sw_Int_T3T_ReadNdef

phStatus_t phalTop_Sw_Int_T3T_ReadNdef(
                                       phalTop_T3T_t * pT3T,
                                       uint8_t * pData,
                                       uint16_t * pLength
                                       )
{
    phStatus_t PH_MEMLOC_REM status;
    uint16_t   PH_MEMLOC_REM wIndex;                             /* Block Index */
    uint16_t   PH_MEMLOC_REM wTempIndex;
    uint8_t    PH_MEMLOC_REM bBlockData[240];
    uint8_t    PH_MEMLOC_REM bReadBlocks;
    uint8_t    PH_MEMLOC_REM bReadNo;
    uint8_t    PH_MEMLOC_REM bCount = 0;
    uint32_t    PH_MEMLOC_REM bNdefLength;
    uint8_t    PH_MEMLOC_REM bWriteServiceList[2] = { 0x09, 0x00};
    uint8_t    PH_MEMLOC_REM bBlockList[0x1E] = { 0x80, 0x01, 0x80, 0x02, 0x80, 0x03, 0x80, 0x04, 0x80, 0x05,
        0x80, 0x06, 0x80, 0x07, 0x80, 0x08, 0x80, 0x09, 0x80, 0x0A,
        0x80, 0x0B, 0x80, 0x0C, 0x80, 0x0D, 0x80, 0x0E, 0x80, 0x0F};
    uint8_t    PH_MEMLOC_REM bRxNumBlocks = 0;

    if(pT3T->bNdefPresence != PH_ON)
    {
        return PH_ADD_COMPCODE(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_TOP);
    }
    if(!((pT3T->bTagState == PHAL_TOP_T3T_STATE_READWRITE) || (pT3T->bTagState == PHAL_TOP_T3T_STATE_READONLY)))
    {
        return PH_ADD_COMPCODE(PH_ERR_PROTOCOL_ERROR, PH_COMP_AL_TOP);
    }

    bReadBlocks = pT3T->bNbr;
    if(bReadBlocks == 0x00)
    {
        bReadBlocks = 0x01;
    }
    else if(bReadBlocks > 0x0F)
    {
        /* Assumed Max Nbr value is 0x0F */
        bReadBlocks = 0x0F;
    }
    else
    {
        /* Do Nothing */
    }

    bNdefLength = pT3T->wNdefLength;
    bReadNo = (uint8_t)(bNdefLength / (bReadBlocks * PHAL_TOP_T3T_BLOCK_SIZE));
    if(bNdefLength % (bReadBlocks * PHAL_TOP_T3T_BLOCK_SIZE))
    {
        bReadNo += 1;
    }

    for(wIndex = 0x01, wTempIndex = 0;
        wIndex <= bReadNo;
        wIndex++)
    {
        PH_CHECK_SUCCESS_FCT(status, phalFelica_Read(
            pT3T->phalT3TDataParams,
            0x01,
            bWriteServiceList,
            bReadBlocks,
            bBlockList,
            (bReadBlocks * 2),
            &bRxNumBlocks,
            bBlockData));

        if(bNdefLength <= (bReadBlocks * PHAL_TOP_T3T_BLOCK_SIZE))
        {
            /* Copy the remaining bytes in the Block excluding the padding bytes */
            memcpy(&pData[wTempIndex], &bBlockData[0], bNdefLength);    /* PRQA S 3200 */
        }
        else
        {
            bNdefLength = bNdefLength - (bReadBlocks * PHAL_TOP_T3T_BLOCK_SIZE);
            memcpy(&pData[wTempIndex], &bBlockData[0], (bReadBlocks * PHAL_TOP_T3T_BLOCK_SIZE));    /* PRQA S 3200 */
            wTempIndex = wTempIndex + (bReadBlocks * PHAL_TOP_T3T_BLOCK_SIZE);
            for(bCount = 0; bCount < bReadBlocks; bCount++)
            {
                bBlockList[(bCount * 2)+ 1] += bReadBlocks;
            }
        }
    }
    *pLength = (uint16_t) pT3T->wNdefLength;
    return PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_AL_TOP);
}
开发者ID:ipskid,项目名称:clev663,代码行数:84,代码来源:phalTop_Sw_Int_T3T.c


示例12: phpalEpcUid_Sw_ActivateCard

phStatus_t phpalEpcUid_Sw_ActivateCard(
                                       phpalEpcUid_Sw_DataParams_t * pDataParams,
                                       uint8_t bTagType,
                                       uint8_t bNumSlots,
                                       uint8_t * pMask,
                                       uint8_t bMaskBitLength,
                                       uint8_t bHash,
                                       uint8_t * pRxBuffer,
                                       uint8_t * pRxLength,
                                       uint8_t * pMoreCardsAvailable
                                       )
{
    phStatus_t  PH_MEMLOC_REM status;
    phStatus_t  PH_MEMLOC_REM statusTmp;
    phStatus_t  PH_MEMLOC_REM statusReturned;
    uint8_t     PH_MEMLOC_REM bNumSlotsTmp;
    uint16_t    PH_MEMLOC_REM wNumSlotsDec;
    uint8_t     PH_MEMLOC_REM bCardsPresent;

    /* reset pMoreCardsAvailable flag */
    *pMoreCardsAvailable = PH_OFF;

    /* init. return status */
    statusReturned = PH_ADD_COMPCODE(PH_ERR_SUCCESS, PH_COMP_HAL);

    do
    {
        /* Reset card present state */
        bCardsPresent = PH_OFF;
        
        /* Start a new Response Round and scan slot 0 */
        status = phpalEpcUid_Sw_BeginRound(
            pDataParams,
            bTagType,
            bNumSlots,
            pMask,
            bMaskBitLength,
            bHash,
            pRxBuffer,
            pRxLength);

        /* Return on parameter error */
        if ((status & PH_ERR_MASK) == PH_ERR_INVALID_PARAMETER)
        {
            return status;
        }

        /* Calculate number of slots in decimal */
		wNumSlotsDec = 0x01;
        if (bNumSlots > PHPAL_EPCUID_NUMSLOTS_1)
        {
            bNumSlotsTmp = bNumSlots;
            do 
            {
                bNumSlotsTmp >>= 1;
                wNumSlotsDec <<= 1;
            } while (bNumSlotsTmp);

            wNumSlotsDec <<= 1;
        }
        bNumSlotsTmp = bNumSlots;

		/* Do for all further requested slots */
		while (wNumSlotsDec--)
		{
			/* Multiple labels found in current slot */
            if (((status & PH_ERR_MASK) == PH_ERR_COLLISION_ERROR) ||
                ((status & PH_ERR_MASK) == PH_ERR_INTEGRITY_ERROR))
			{
				bCardsPresent = PH_ON;
				*pMoreCardsAvailable = PH_ON;

                /* Store collision error in case it can't be resolved */
                if ((statusReturned & PH_ERR_MASK) == PH_ERR_SUCCESS)
                {
                    statusReturned = status;
                }
			}
            else
            {
                /* Store timeout error if integrity / collision error has not happened */
                if ((status & PH_ERR_MASK) == PH_ERR_IO_TIMEOUT)
                {
                    if ((statusReturned & PH_ERR_MASK) == PH_ERR_SUCCESS)
                    {
                        statusReturned = status;
                    }
                }
                /* Return on success or other errors */
                else
				{
					return status;
				}
			}

            /* Last slot -> send CloseSlotLast */
            if (wNumSlotsDec == 0)
            {
                /* Send CloseSlot command */
                PH_CHECK_SUCCESS_FCT(statusTmp, phpalEpcUid_Sw_CloseSlot(
//.........这里部分代码省略.........
开发者ID:halilercikan,项目名称:DWMS,代码行数:101,代码来源:phpalEpcUid_Sw.c


示例13: phpalMifare_MfcAuthenticate

phStatus_t phpalMifare_MfcAuthenticate(
                                       void * pDataParams,
                                       uint8_t bBlockNo,
                                       uint8_t bKeyType,
                                       uint8_t * pKey,
                                       uint8_t * pUid
                                       )
{
    phStatus_t PH_MEMLOC_REM status;

    PH_LOG_HELPER_ALLOCATE_TEXT(bFunctionName, "phpalMifare_MfcAuthenticate");
    /*PH_LOG_HELPER_ALLOCATE_PARAMNAME(pDataParams);*/
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(bBlockNo);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(bKeyType);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pKey);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pUid);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(status);
    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
    PH_LOG_HELPER_ADDPARAM_UINT8(PH_LOG_LOGTYPE_DEBUG, bBlockNo_log, &bBlockNo);
    PH_LOG_HELPER_ADDPARAM_UINT8(PH_LOG_LOGTYPE_DEBUG, bKeyType_log, &bKeyType);
    PH_LOG_HELPER_ADDPARAM_BUFFER(PH_LOG_LOGTYPE_DEBUG, pKey_log, pKey, 6);
    PH_LOG_HELPER_ADDPARAM_BUFFER(PH_LOG_LOGTYPE_DEBUG, pUid_log, pUid, 4);
    PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_ENTER);
	PH_ASSERT_NULL (pDataParams);
	PH_ASSERT_NULL (pKey);
	PH_ASSERT_NULL (pUid);

    /* Check data parameters */
    if (PH_GET_COMPCODE(pDataParams) != PH_COMP_PAL_MIFARE)
    {
        PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
        PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_INFO, status_log, &status);
        PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_LEAVE);

        return PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_PAL_MIFARE);
    }

    /* perform operation on active layer */
    switch (PH_GET_COMPID(pDataParams))
    {
#ifdef NXPBUILD__PHPAL_MIFARE_STUB
    case PHPAL_MIFARE_STUB_ID:
        status = phpalMifare_Stub_MfcAuthenticate(
            (phpalMifare_Stub_DataParams_t *)pDataParams,
            bBlockNo,
            bKeyType,
            pKey,
            pUid);
        break;
#endif /* NXPBUILD__PHPAL_MIFARE_STUB */

#ifdef NXPBUILD__PHPAL_MIFARE_SW
    case PHPAL_MIFARE_SW_ID:
        status = phpalMifare_Sw_MfcAuthenticate(
            (phpalMifare_Sw_DataParams_t *)pDataParams,
            bBlockNo,
            bKeyType,
            pKey,
            pUid);
        break;
#endif /* NXPBUILD__PHPAL_MIFARE_SW */

#ifdef NXPBUILD__PHPAL_MIFARE_SAMAV2_X
    case PHPAL_MIFARE_SAMAV2_X_ID:
        status = phpalMifare_SamAV2_X_MfcAuthenticate(
            (phpalMifare_SamAV2_X_DataParams_t *)pDataParams,
            bBlockNo,
            bKeyType,
            pKey,
            pUid);
        break;
#endif /* NXPBUILD__PHPAL_MIFARE_SAMAV2_X */

#ifdef NXPBUILD__PHPAL_MIFARE_RD710
    case PHPAL_MIFARE_RD710_ID:
        status = phpalMifare_Rd710_MfcAuthenticate(
            (phpalMifare_Rd710_DataParams_t *)pDataParams,
            bBlockNo,
            bKeyType,
            pKey,
            pUid);
        break;
#endif /* NXPBUILD__PHPAL_MIFARE_RD710 */

    default:
        status = PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_PAL_MIFARE);
        break;
    }

    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
    PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_INFO, status_log, &status);
    PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_LEAVE);

    return status;
}
开发者ID:halilercikan,项目名称:DWMS,代码行数:95,代码来源:phpalMifare.c


示例14: phpalMifare_ExchangeL3

phStatus_t phpalMifare_ExchangeL3(
                                  void * pDataParams,
                                  uint16_t wOption,
                                  uint8_t * pTxBuffer,
                                  uint16_t wTxLength,
                                  uint8_t ** ppRxBuffer,
                                  uint16_t * pRxLength
                                  )
{
    phStatus_t PH_MEMLOC_REM status;

    PH_LOG_HELPER_ALLOCATE_TEXT(bFunctionName, "phpalMifare_ExchangeL3");
    /*PH_LOG_HELPER_ALLOCATE_PARAMNAME(pDataParams);*/
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(wOption);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(pTxBuffer);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(ppRxBuffer);
    PH_LOG_HELPER_ALLOCATE_PARAMNAME(status);
    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
    PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_DEBUG, wOption_log, &wOption);
    PH_LOG_HELPER_ADDPARAM_BUFFER(PH_LOG_LOGTYPE_DEBUG, pTxBuffer_log, pTxBuffer, wTxLength);
    PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_ENTER);
	PH_ASSERT_NULL (pDataParams);
	if (wTxLength) PH_ASSERT_NULL (pTxBuffer);

    /* Check data parameters */
    if (PH_GET_COMPCODE(pDataParams) != PH_COMP_PAL_MIFARE)
    {
        PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
        PH_LOG_HELPER_ADDPARAM_UINT16(PH_LOG_LOGTYPE_INFO, status_log, &status);
        PH_LOG_HELPER_EXECUTE(PH_LOG_OPTION_CATEGORY_LEAVE);

        return PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_PAL_MIFARE);
    }

    /* perform operation on active layer */
    switch (PH_GET_COMPID(pDataParams))
    {
#ifdef NXPBUILD__PHPAL_MIFARE_STUB
    case PHPAL_MIFARE_STUB_ID:
        status = phpalMifare_Stub_ExchangeL3(
            (phpalMifare_Stub_DataParams_t *)pDataParams,
            wOption,
            pTxBuffer,
            wTxLength,
            ppRxBuffer,
            pRxLength);
        break;
#endif /* NXPBUILD__PHPAL_MIFARE_STUB */

#ifdef NXPBUILD__PHPAL_MIFARE_SW
    case PHPAL_MIFARE_SW_ID:
        status = phpalMifare_Sw_ExchangeL3(
            (phpalMifare_Sw_DataParams_t *)pDataParams,
            wOption,
            pTxBuffer,
            wTxLength,
            ppRxBuffer,
            pRxLength);
        break;
#endif /* NXPBUILD__PHPAL_MIFARE_SW */

#ifdef NXPBUILD__PHPAL_MIFARE_SAMAV2_X
    case PHPAL_MIFARE_SAMAV2_X_ID:
        status = phpalMifare_SamAV2_X_ExchangeL3(
            (phpalMifare_SamAV2_X_DataParams_t *)pDataParams,
            wOption,
            pTxBuffer,
            wTxLength,
            ppRxBuffer,
            pRxLength);
        break;
#endif /* NXPBUILD__PHPAL_MIFARE_SAMAV2_X */

#ifdef NXPBUILD__PHPAL_MIFARE_RD710
    case PHPAL_MIFARE_RD710_ID:
        status = phpalMifare_Rd710_ExchangeL3(
            (phpalMifare_Rd710_DataParams_t *)pDataParams,
            wOption,
            pTxBuffer,
            wTxLength,
            ppRxBuffer,
            pRxLength);
        break;
#endif /* NXPBUILD__PHPAL_MIFARE_RD710 */

    default:
        status = PH_ADD_COMPCODE(PH_ERR_INVALID_DATA_PARAMS, PH_COMP_PAL_MIFARE);
        break;
    }

    PH_LOG_HELPER_ADDSTRING(PH_LOG_LOGTYPE_INFO, bFunctionName);
#ifdef NXPBUILD__PH_LOG
    if ((((status & PH_ERR_MASK) == PH_ERR_SUCCESS) ||
        ((status & PH_ERR_MASK) == PH_ERR_SUCCESS_CHAINING) ||
        ((status & PH_ERR_MASK) == PH_ERR_SUCCESS_INCOMPLETE_BYTE)) &&
        !(wOption & PH_EXCHANGE_BUFFERED_BIT) &&
        (ppRxBuffer != NULL))
    {
        PH_LOG_HELPER_ADDPARAM_BUFFER(PH_LOG_LOGTYPE_DEBUG, ppRxBuffer_log, *ppRxBuffer, *pRxLength);
    }
//.........这里部分代码省略.........
开发者ID:halilercikan,项目名称:DWMS,代码行数:101,代码来源:phpalMifare.c


示例15: phpalI14443p4a_Sw_Rats

该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PH_ASSERT_NULL函数代码示例发布时间:2022-05-30
下一篇:
C++ PHY_WRITE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap