コード例 #1
0
 NFCSTATUS
 phHciNfc_Send_Admin_Event (
                      phHciNfc_sContext_t   *psHciContext,
                      void                  *pHwRef,
                      uint8_t               event,
                      uint8_t               length,
                      void                  *params
                     )
{
    phHciNfc_HCP_Packet_t       *hcp_packet = NULL;
    phHciNfc_AdminGate_Info_t   *p_admin_info=NULL;
    NFCSTATUS                   status = NFCSTATUS_SUCCESS;

    if( (NULL == psHciContext) 
        || (NULL == pHwRef) 
      )
    {
      status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
    }
    else
    {
        psHciContext->tx_total = 0 ;
        length +=  HCP_HEADER_LEN ;
        p_admin_info = psHciContext->p_admin_info;

        if( EVT_HOT_PLUG ==   event )
        {

            /* Use the HCP Packet Structure to Construct the send HCP
                * Packet data.
                */
            hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
            phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                                    (uint8_t) HCI_ADMIN_PIPE_ID,
                                    HCP_MSG_TYPE_EVENT, event);
        }
        else
        {
            status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_INSTRUCTION);
        }

        if( NFCSTATUS_SUCCESS == status )
        {
            p_admin_info->admin_pipe_info->sent_msg_type = HCP_MSG_TYPE_EVENT;
            p_admin_info->admin_pipe_info->prev_msg = event ;
            p_admin_info->admin_pipe_info->param_info = params ;
            psHciContext->tx_total = length;
            psHciContext->response_pending = FALSE ;
            status = phHciNfc_Send_HCP( (void *)psHciContext, (void *)pHwRef );
            p_admin_info->admin_pipe_info->prev_status = NFCSTATUS_PENDING;
        }
    }

    return status;
}
コード例 #2
0
static 
NFCSTATUS
phHciNfc_Send_SWP_Event(
                       phHciNfc_sContext_t      *psHciContext,
                       void                     *pHwRef,
                       uint8_t                  pipe_id,
                       uint8_t                  event
                       )
{
    phHciNfc_HCP_Packet_t   *hcp_packet = NULL;
    phHciNfc_HCP_Message_t  *hcp_message = NULL;
    phHciNfc_Pipe_Info_t    *p_pipe_info = NULL;
    uint8_t                 length = 0;
    uint8_t                 i=0;
    NFCSTATUS               status = NFCSTATUS_SUCCESS;

    p_pipe_info = (phHciNfc_Pipe_Info_t *) 
                    psHciContext->p_pipe_list[pipe_id];
    psHciContext->tx_total = 0 ;
    length = (length + HCP_HEADER_LEN);

    hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
    /* Construct the HCP Frame */
    phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                            (uint8_t) pipe_id, 
                            HCP_MSG_TYPE_EVENT, event);

    hcp_message = &(hcp_packet->msg.message);

    phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
                            i, 
                            (uint8_t *)p_pipe_info->param_info,
                            p_pipe_info->param_length);
    length = (uint8_t)(length + i + p_pipe_info->param_length);

    p_pipe_info->sent_msg_type = HCP_MSG_TYPE_EVENT ;
    p_pipe_info->prev_msg = event ;
    psHciContext->tx_total = length;

    /* Send the Constructed HCP packet to the lower layer */
    status = phHciNfc_Send_HCP( psHciContext, pHwRef );
    if(NFCSTATUS_PENDING == status)
    {
        ((phHciNfc_SWP_Info_t *)psHciContext->p_swp_info)->current_seq = 
            ((phHciNfc_SWP_Info_t *)psHciContext->p_swp_info)->next_seq;
        p_pipe_info->prev_status = status;
    }

    return status;
}
コード例 #3
0
NFCSTATUS
phHciNfc_Send_Felica_Command(
                              phHciNfc_sContext_t   *psContext,
                              void                  *pHwRef,
                              uint8_t               pipe_id,
                              uint8_t               cmd
                              )
{
    NFCSTATUS                   status = NFCSTATUS_SUCCESS;
    phHciNfc_sContext_t         *psHciContext = 
                                (phHciNfc_sContext_t *)psContext ;
    if( (NULL == psHciContext) || (NULL == pHwRef) )
    {
        status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
    }
    else if((NULL == psHciContext->p_felica_info) || 
        (HCI_FELICA_ENABLE != 
        ((phHciNfc_Felica_Info_t *)(psHciContext->p_felica_info))->
        enable_felica_gate) || 
        (HCI_UNKNOWN_PIPE_ID == 
        ((phHciNfc_Felica_Info_t *)(psHciContext->p_felica_info))->
        pipe_id) || 
        (pipe_id != 
        ((phHciNfc_Felica_Info_t *)(psHciContext->p_felica_info))->
        pipe_id))
    {
        status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
    }
    else
    {
        phHciNfc_Felica_Info_t     *p_fel_info=NULL;
        phHciNfc_Pipe_Info_t        *p_pipe_info=NULL;
        phHciNfc_HCP_Packet_t       *hcp_packet = NULL;
        phHciNfc_HCP_Message_t      *hcp_message = NULL;
        uint8_t                     i = 0, 
                                    length = HCP_HEADER_LEN;

        p_fel_info = (phHciNfc_Felica_Info_t *)
                            psHciContext->p_felica_info ;
        p_pipe_info = p_fel_info->p_pipe_info;
        if(NULL == p_pipe_info )
        {
            status = PHNFCSTVAL(CID_NFC_HCI, 
                                NFCSTATUS_INVALID_HCI_SEQUENCE);
        }
        else
        {
            psHciContext->tx_total = 0 ;
            hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
            /* Construct the HCP Frame */
            phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                            (uint8_t) pipe_id, HCP_MSG_TYPE_COMMAND, cmd);
            switch(cmd)
            {
                case NXP_FELICA_RAW:
                {
                    /*  
                    Buffer shall be updated with 
                    TO -              Time out (1 byte)
                    Status -          b0 to b2 indicate valid bits (1 byte)
                    Data  -           params received from this function 
                    */
                    hcp_message = &(hcp_packet->msg.message);

                    /* Time out */
                    hcp_message->payload[i++] = FELICA_TIMEOUT ;
                    /* Status */
                    hcp_message->payload[i++] = FELICA_STATUS;

                    phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
                                        i, (uint8_t *)p_pipe_info->param_info,
                                        p_pipe_info->param_length);
                    length =(uint8_t)(length + i + p_pipe_info->param_length);
                    break;
                }
                case NXP_FELICA_CMD:
                {
                    /* 
                    Buffer shall be updated with 
                    Cmd -               Authentication A/B, read/write 
                    (1 byte)
                    Data  -             params received from this function 
                    */
                    hcp_message = &(hcp_packet->msg.message);

                    /* Command */
                    hcp_message->payload[i++] = 
                                 psHciContext->p_xchg_info->params.tag_info.cmd_type ;
                    phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
                                        i, (uint8_t *)p_pipe_info->param_info,
                                        p_pipe_info->param_length);
                    length =(uint8_t)(length + i + p_pipe_info->param_length);
                    break;
                }
                default:
                {
                    status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_COMMAND);
                    break;
                }
            }
            if (NFCSTATUS_SUCCESS == status)
            {
                p_pipe_info->sent_msg_type = (uint8_t)HCP_MSG_TYPE_COMMAND;
                p_pipe_info->prev_msg = cmd;
                psHciContext->tx_total = length;
                psHciContext->response_pending = TRUE;

                /* Send the Constructed HCP packet to the lower layer */
                status = phHciNfc_Send_HCP( psHciContext, pHwRef);
                p_pipe_info->prev_status = status;
            }
        }
    }
    return status;
}
コード例 #4
0
/*!
 * \brief Receives the HCI Admin Commands from the corresponding peripheral device.
 *
 * This function receives  the HCI Admin Commands from the connected NFC Pheripheral
 * device
 */
static
 NFCSTATUS
 phHciNfc_Recv_Admin_Cmd (
                        void                *psContext,
                        void                *pHwRef,
                        uint8_t             *pCmd,
#ifdef ONE_BYTE_LEN
                        uint8_t             length
#else
                        uint16_t            length
#endif
                     )
{
    phHciNfc_sContext_t         *psHciContext = 
                                    (phHciNfc_sContext_t *)psContext ;
    phHciNfc_HCP_Packet_t       *hcp_packet = NULL;
    phHciNfc_HCP_Message_t      *hcp_message = NULL;
    phHciNfc_AdminGate_Info_t   *p_admin_info=NULL;
    phHciNfc_Pipe_Info_t        *p_pipe_info = NULL;
    uint8_t                     index=0;
    uint8_t                     pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;
    uint8_t                     cmd = (uint8_t) HCP_MSG_INSTRUCTION_INVALID;
    uint8_t                     response = (uint8_t) ANY_OK;
    NFCSTATUS                   status = NFCSTATUS_SUCCESS;

    if( (NULL == psHciContext) 
        || (NULL == pHwRef) 
        || (HCP_HEADER_LEN > length ) 
      )
    {
      status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
    }
    else
    {
        hcp_packet = (phHciNfc_HCP_Packet_t *)pCmd;
        hcp_message = &hcp_packet->msg.message;
        p_admin_info = psHciContext->p_admin_info;
        /* Get the Command instruction bits from the Message Header */
        cmd = (uint8_t) GET_BITS8( hcp_message->msg_header,
            HCP_MSG_INSTRUCTION_OFFSET, HCP_MSG_INSTRUCTION_LEN);

        switch( cmd )
        {
            /* These are notifications sent by the Host Controller */
            case ADM_NOTIFY_PIPE_CREATED:
            {
                pipe_id = hcp_message->payload[RESPONSE_PIPEID_OFFSET];
                p_pipe_info = (phHciNfc_Pipe_Info_t *)
                        phOsalNfc_GetMemory(sizeof(phHciNfc_Pipe_Info_t));
                if(NULL != p_pipe_info)
                {
                    /* The Source Host is the UICC Host */
                    p_pipe_info->pipe.source.host_id = 
                                    hcp_message->payload[index++];
                    /* The Source Gate is same as the Destination Gate */
                    p_pipe_info->pipe.source.gate_id    = 
                                    hcp_message->payload[index++];
                    /* The Source Host is the Terminal Host */
                    p_pipe_info->pipe.dest.host_id = 
                                    hcp_message->payload[index++];
                    p_pipe_info->pipe.dest.gate_id  = 
                                    hcp_message->payload[index++];
                    p_pipe_info->pipe.pipe_id   = 
                                    hcp_message->payload[index++];
                }
                status = phHciNfc_Update_PipeInfo(psHciContext,
                    &(p_admin_info->pipe_seq), pipe_id, p_pipe_info);

                if( NFCSTATUS_SUCCESS == status )
                {
                    psHciContext->p_pipe_list[pipe_id] = p_pipe_info;
                    if (NULL != p_pipe_info)
                    {
                        p_pipe_info->pipe.pipe_id = pipe_id;
                    }
                }
                break;
            }
            case ADM_NOTIFY_PIPE_DELETED:
            {
                pipe_id = hcp_message->payload[index++];
                p_pipe_info = psHciContext->p_pipe_list[pipe_id];
                if ( NULL != p_pipe_info )
                {
                        status = phHciNfc_Update_PipeInfo(
                            psHciContext, &(p_admin_info->pipe_seq),
                             (uint8_t) HCI_UNKNOWN_PIPE_ID, p_pipe_info);
                    if(NFCSTATUS_SUCCESS == status )
                    {
                        phOsalNfc_FreeMemory(p_pipe_info);
                        psHciContext->p_pipe_list[pipe_id] = NULL;
                    }
                }
                break;
            }
            /* TODO: Since we receive the Host ID, we need to clear
             * all the pipes created with the host
             */
            case ADM_NOTIFY_ALL_PIPE_CLEARED:
            {
                break;
            }
            /* case ADM_CREATE_PIPE: */
            /* case ADM_DELETE_PIPE: */
            /* case ADM_CLEAR_ALL_PIPE: */
            default:
            {
                response = ANY_E_CMD_NOT_SUPPORTED;
                status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_COMMAND_NOT_SUPPORTED);
                break;
            }
        }
        hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
        phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                                (uint8_t) HCI_ADMIN_PIPE_ID,
                                HCP_MSG_TYPE_RESPONSE, response );
        psHciContext->tx_total = HCP_HEADER_LEN;
        status = phHciNfc_Send_HCP( (void *)psHciContext, (void *)pHwRef );

        p_admin_info->admin_pipe_info->recv_msg_type = HCP_MSG_TYPE_COMMAND;
        p_admin_info->admin_pipe_info->sent_msg_type = HCP_MSG_TYPE_RESPONSE;
        p_admin_info->admin_pipe_info->prev_msg = response;
        p_admin_info->admin_pipe_info->prev_status = NFCSTATUS_PENDING;
    }
    return status;
}
コード例 #5
0
 NFCSTATUS
 phHciNfc_Send_Admin_Cmd (
                      phHciNfc_sContext_t   *psHciContext,
                      void                  *pHwRef,
                      uint8_t               cmd,
                      uint8_t               length,
                      void                  *params
                     )
{
    phHciNfc_HCP_Packet_t       *hcp_packet = NULL;
    phHciNfc_HCP_Message_t      *hcp_message = NULL;
    phHciNfc_AdminGate_Info_t   *p_admin_info=NULL;
    phHciNfc_Pipe_Info_t        *p_pipe_info = NULL;
    uint8_t                     i=0;
    NFCSTATUS                   status = NFCSTATUS_SUCCESS;

    if( (NULL == psHciContext) 
        || (NULL == pHwRef) 
        || (NULL == params)
      )
    {
      status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
    }
    else
    {
        p_pipe_info = (phHciNfc_Pipe_Info_t *)  params;
        psHciContext->tx_total = 0 ;
        length +=  HCP_HEADER_LEN ;
        p_admin_info = psHciContext->p_admin_info;
        switch(  cmd )
        {
            case ADM_CREATE_PIPE:
            {
                hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
                /* Use the HCP Packet Structure to Construct the send HCP
                * Packet data.
                */
                phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                                        (uint8_t) HCI_ADMIN_PIPE_ID,
                                        HCP_MSG_TYPE_COMMAND, cmd);
                hcp_message = &(hcp_packet->msg.message);

                /* Source HOST ID Parameter is not passed as a 
                 * parameter in the HCI SPEC */

                /* hcp_message->payload[i++] = p_pipe_info->pipe.source.host_id; */
                hcp_message->payload[i++] = p_pipe_info->pipe.source.gate_id;
                hcp_message->payload[i++] = p_pipe_info->pipe.dest.host_id;
                hcp_message->payload[i++] = p_pipe_info->pipe.dest.gate_id;
                break;
            }
            case ADM_DELETE_PIPE:
            {
                uint8_t     pipe_id = (uint8_t) HCI_UNKNOWN_PIPE_ID;

                pipe_id = p_pipe_info->pipe.pipe_id;
                if( pipe_id < PIPETYPE_DYNAMIC )
                {
                    /* The Static Pipes cannot be Deleted */
                    status = PHNFCSTVAL(CID_NFC_HCI,
                                    NFCSTATUS_INVALID_PARAMETER );
                    HCI_DEBUG("phHciNfc_Send_Admin_Cmd: Static Pipe %u "
                                                "Cannot be Deleted \n",pipe_id);
                }
                else
                {

                    /* Use the HCP Packet Structure to Construct the send HCP
                     * Packet data.
                     */
                    hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
                    phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                                            (uint8_t) HCI_ADMIN_PIPE_ID,
                                            HCP_MSG_TYPE_COMMAND, cmd);
                    hcp_message = &(hcp_packet->msg.message);
                    hcp_message->payload[i++] = pipe_id ;
                }
                break;
            }
            case ADM_CLEAR_ALL_PIPE:
            {

                /* Use the HCP Packet Structure to Construct the send HCP
                 * Packet data.
                 */
                hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
                phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                                        (uint8_t) HCI_ADMIN_PIPE_ID,
                                        HCP_MSG_TYPE_COMMAND, cmd);
                hcp_message = &(hcp_packet->msg.message);
                break;
            }
            /* These are notifications and can not be sent by the Host */
            /* case ADM_NOTIFY_PIPE_CREATED: */
            /* case ADM_NOTIFY_PIPE_DELETED: */
            /* case ADM_NOTIFY_ALL_PIPE_CLEARED: */
            default:
                status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_COMMAND);
                break;
        }
        if( NFCSTATUS_SUCCESS == status )
        {
            p_admin_info->admin_pipe_info->sent_msg_type = HCP_MSG_TYPE_COMMAND;
            p_admin_info->admin_pipe_info->prev_msg = cmd;
            p_admin_info->admin_pipe_info->param_info = p_pipe_info;
            psHciContext->tx_total = length;
            psHciContext->response_pending = TRUE;
            status = phHciNfc_Send_HCP( (void *)psHciContext, (void *)pHwRef );
            p_admin_info->admin_pipe_info->prev_status = NFCSTATUS_PENDING;
        }
    }

    return status;
}
コード例 #6
0
NFCSTATUS
phHciNfc_Send_ReaderA_Command(
    phHciNfc_sContext_t   *psHciContext,
    void                  *pHwRef,
    uint8_t               pipe_id,
    uint8_t               cmd
)
{
    NFCSTATUS                   status = NFCSTATUS_SUCCESS;

    if( (NULL == psHciContext) || (NULL == pHwRef) )
    {
        status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_PARAMETER);
    }
    else if((NULL == psHciContext->p_reader_a_info) ||
            (HCI_READER_A_ENABLE !=
             ((phHciNfc_ReaderA_Info_t *)(psHciContext->p_reader_a_info))->
             enable_rdr_a_gate) ||
            (HCI_UNKNOWN_PIPE_ID ==
             ((phHciNfc_ReaderA_Info_t *)(psHciContext->p_reader_a_info))->
             pipe_id) ||
            (pipe_id !=
             ((phHciNfc_ReaderA_Info_t *)(psHciContext->p_reader_a_info))->
             pipe_id))
    {
        status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_FEATURE_NOT_SUPPORTED);
    }
    else
    {
        phHciNfc_ReaderA_Info_t     *p_rdr_a_info=NULL;
        phHciNfc_Pipe_Info_t        *p_pipe_info=NULL;
        phHciNfc_HCP_Packet_t       *hcp_packet = NULL;
        phHciNfc_HCP_Message_t      *hcp_message = NULL;
        uint8_t                     i = 0;
        uint16_t                    length = HCP_HEADER_LEN;

        p_rdr_a_info = (phHciNfc_ReaderA_Info_t *)
                       psHciContext->p_reader_a_info ;
        p_pipe_info = p_rdr_a_info->p_pipe_info;
        if(NULL == p_pipe_info )
        {
            status = PHNFCSTVAL(CID_NFC_HCI,
                                NFCSTATUS_INVALID_HCI_SEQUENCE);
        }
        else
        {
            psHciContext->tx_total = 0 ;
            hcp_packet = (phHciNfc_HCP_Packet_t *) psHciContext->send_buffer;
            /* Construct the HCP Frame */
            switch(cmd)
            {
            case NXP_WRA_CONTINUE_ACTIVATION:
            case NXP_WR_ACTIVATE_ID:
            {
                phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                                        (uint8_t) pipe_id, HCP_MSG_TYPE_COMMAND, cmd);
                break;
            }

            case NXP_MIFARE_RAW:
            {
                if (p_pipe_info->param_length < RDR_A_MIFARE_RAW_LENGTH)
                {
                    status = PHNFCSTVAL(CID_NFC_HCI,
                                        NFCSTATUS_INVALID_PARAMETER);
                }
                else
                {
                    /*
                        Buffer shall be updated with
                        TO -              Time out (1 byte)
                        Status -          b0 to b2 indicate valid bits (1 byte)
                        Data (with CRC) - params received from this function
                    */
                    hcp_message = &(hcp_packet->msg.message);
#ifdef ENABLE_MIFARE_RAW
                    /* Time out */
                    hcp_message->payload[i++] = NXP_MIFARE_XCHG_TIMEOUT ;
                    /* Status */
                    hcp_message->payload[i++] = RDR_A_MIFARE_STATUS;
#else
                    cmd = NXP_MIFARE_CMD;
#endif /* #ifdef ENABLE_MIFARE_RAW */
                    phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                                            (uint8_t) pipe_id, HCP_MSG_TYPE_COMMAND, cmd);

                    phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
                                             i, (uint8_t *)p_pipe_info->param_info,
#ifdef ENABLE_MIFARE_RAW
                                             p_pipe_info->param_length);
#else
                                             (p_pipe_info->param_length - 2));
#endif /* #ifdef ENABLE_MIFARE_RAW */

#ifdef ENABLE_MIFARE_RAW
                    length =(uint16_t)(length + i + p_pipe_info->param_length);
#else
                    length =(uint16_t)(length + i + p_pipe_info->param_length - 2);
#endif /* #ifdef ENABLE_MIFARE_RAW */
                }
                break;
            }
            case NXP_MIFARE_CMD:
            {
                /*
                    Buffer shall be updated with
                    Cmd -               Authentication A/B, read/write
                                        (1 byte)
                    Addr -              Address associated with Mifare cmd
                                        (1 byte)
                    Data  -             params received from this function
                */
                phHciNfc_Build_HCPFrame(hcp_packet,HCP_CHAINBIT_DEFAULT,
                                        (uint8_t) pipe_id, HCP_MSG_TYPE_COMMAND, cmd);
                hcp_message = &(hcp_packet->msg.message);

                /* Command */
                hcp_message->payload[i++] =
                    psHciContext->p_xchg_info->params.tag_info.cmd_type ;
                /* Address */
                hcp_message->payload[i++] =
                    psHciContext->p_xchg_info->params.tag_info.addr ;
                phHciNfc_Append_HCPFrame((uint8_t *)hcp_message->payload,
                                         i, (uint8_t *)p_pipe_info->param_info,
                                         p_pipe_info->param_length);
                length =(uint16_t)(length + i + p_pipe_info->param_length);
                break;
            }
            default:
            {
                status = PHNFCSTVAL(CID_NFC_HCI, NFCSTATUS_INVALID_HCI_COMMAND);
                break;
            }
            }
            if (NFCSTATUS_SUCCESS == status)
            {
                p_pipe_info->sent_msg_type = (uint8_t)HCP_MSG_TYPE_COMMAND;
                p_pipe_info->prev_msg = cmd;
                psHciContext->tx_total = length;
                psHciContext->response_pending = TRUE;

                /* Send the Constructed HCP packet to the lower layer */
                status = phHciNfc_Send_HCP( psHciContext, pHwRef);
                p_pipe_info->prev_status = status;
            }
        }
    }
    return status;
}