15d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*
25d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Copyright (C) 2010 NXP Semiconductors
35d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
45d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Licensed under the Apache License, Version 2.0 (the "License");
55d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * you may not use this file except in compliance with the License.
65d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * You may obtain a copy of the License at
75d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
85d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      http://www.apache.org/licenses/LICENSE-2.0
95d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Unless required by applicable law or agreed to in writing, software
115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * distributed under the License is distributed on an "AS IS" BASIS,
125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * See the License for the specific language governing permissions and
145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * limitations under the License.
155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*!
185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \file  phFriNfc_OvrHal.c
195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Overlapped HAL
205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Project: NFC-FRI
225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Creator: Gerald Kersch
235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Date: Wed May  5 10:47:27 2010 $
255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Changed by: $Author: ing02260 $
265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Revision: 1.37 $
275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Aliases: NFC_FRI1.1_WK1017_R34_3,NFC_FRI1.1_WK1023_R35_1 $
285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phFriNfc_OvrHal.h>
325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phOsalNfc.h>
335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phFriNfc_NdefMap.h>
345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phFriNfc_SmtCrdFmt.h>
355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef PHFRINFC_OVRHAL_MOCKUP  /* */
385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly//#include <phLibNfc_Gen.h>
395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif /* PHFRINFC_OVRHAL_MOCKUP */
405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*
415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*
425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly*/
445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define MAX_MIF_PACKET_LEN                      0x0FU
453043b52934292173592f27dcbb054321001a3017Jan Brands#define MIFARE_PLUS_UID_INDEX_TO_COPY           0x03U
465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define MIFARE_PLUS_UID_LENGTH                  0x07U
475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define MIFARE_CLASSIC_UID_LENGTH               0x04U
485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define MIFARE_UID_LEN_TO_COPY                  0x04U
495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void phFriNfc_OvrHal_CB_Send(void *context,
515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    NFCSTATUS status);
525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void phFriNfc_OvrHal_CB_Receive(void *context,
535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                       phNfc_sData_t *pDataInfo,
545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                       NFCSTATUS status);
555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void phFriNfc_OvrHal_CB_Transceive(void *context,
565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               phHal_sRemoteDevInformation_t *RemoteDevHandle,
575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               phNfc_sData_t  *pRecvdata,
585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               NFCSTATUS status
595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               );
605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void phFriNfc_OvrHal_CB_ConnectDisconnect(void *context,
615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               phHal_sRemoteDevInformation_t *RemoteDevHandle,
625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               NFCSTATUS status
635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               );
645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void  phFriNfc_OvrHal_SetComplInfo(phFriNfc_OvrHal_t *OvrHal,
665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                   phFriNfc_CplRt_t  *CompletionInfo,
675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                   uint8_t            Operation);
685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Transceive(phFriNfc_OvrHal_t              *OvrHal,
705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phFriNfc_CplRt_t               *CompletionInfo,
715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phHal_sRemoteDevInformation_t  *RemoteDevInfo,
725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phHal_uCmdList_t                Cmd,
735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phHal_sDepAdditionalInfo_t     *DepAdditionalInfo,
745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     uint8_t                        *SendBuf,
755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     uint16_t                        SendLength,
765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     uint8_t                        *RecvBuf,
775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     uint16_t                       *RecvLength)
785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    NFCSTATUS status = NFCSTATUS_PENDING;
805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t i = 0;
815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint32_t length = SendLength;
825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /* To remove "warning (VS C4100) : unreferenced formal parameter" */
845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    PHNFC_UNUSED_VARIABLE(DepAdditionalInfo);
855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /* Check the Input Parameters */
875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    if ((NULL == OvrHal) || (NULL == CompletionInfo) || (NULL == RemoteDevInfo)
885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        || (NULL == (void*)SendBuf) || (NULL == RecvBuf) || (NULL == RecvLength)
895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        || ((phHal_eJewel_PICC != RemoteDevInfo->RemDevType) && (0 == SendLength)))
905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        status = PHNFCSTVAL(CID_FRI_NFC_OVR_HAL, NFCSTATUS_INVALID_PARAMETER);
935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    else
955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        /* 16 is the maximum data, that can be sent to the mifare standard */
975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        static uint8_t      mif_send_buf[MAX_MIF_PACKET_LEN] = {0};
985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        /* Populate the Transfer info structure */
995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        OvrHal->TranceiveInfo.cmd = Cmd;
1005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        /* Populate the Send Buffer Info */
1025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        if((phHal_eMifare_PICC == RemoteDevInfo->RemDevType)
1035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            || (phHal_eISO14443_3A_PICC == RemoteDevInfo->RemDevType))
1045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
1055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->TranceiveInfo.addr = SendBuf[i++];
1065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            length = (SendLength - i);
1075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            if ((phHal_eMifareAuthentA == Cmd.MfCmd)
1095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                || (phHal_eMifareAuthentB == Cmd.MfCmd))
1105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            {
1115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                uint8_t     uid_index = 0;
1125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                /* Authentication requires UID in the send buffer */
1135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                uint8_t     uid_len =
1145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        RemoteDevInfo->RemoteDevInfo.Iso14443A_Info.UidLength;
1155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                OvrHal->TranceiveInfo.sSendData.buffer = mif_send_buf;
1165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                switch (uid_len)
1185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                {
1195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    case MIFARE_PLUS_UID_LENGTH:
1205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    {
1215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        uid_index = MIFARE_PLUS_UID_INDEX_TO_COPY;
1225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        uid_len = MIFARE_UID_LEN_TO_COPY;
1235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        break;
1245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    }
1255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    case MIFARE_CLASSIC_UID_LENGTH:
1275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    {
1285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        uid_index = 0;
1295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        break;
1305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    }
1315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    default:
1335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    {
1345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        status = PHNFCSTVAL (CID_FRI_NFC_OVR_HAL,
1355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                            NFCSTATUS_READ_FAILED);
1365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        break;
1375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    }
1385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                }
1395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                if (NFCSTATUS_PENDING == status)
1415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                {
1425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    /* copy uid to the send buffer for the authentication */
1435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    (void)memcpy ((void *)mif_send_buf,
1445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        (void *)&RemoteDevInfo->RemoteDevInfo.Iso14443A_Info.Uid[uid_index],
1455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                        uid_len);
1465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    (void)memcpy((mif_send_buf + uid_len), &(SendBuf[i]), length);
1485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                    length += uid_len;
1495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                }
1505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            }
1515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            else
1525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            {
1535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                OvrHal->TranceiveInfo.sSendData.buffer = &SendBuf[i++];
1545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            }
1555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->TranceiveInfo.sSendData.length = length;
1565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
1575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        else
1585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
1595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->TranceiveInfo.sSendData.buffer = &SendBuf[i++];
1605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->TranceiveInfo.sSendData.length = length;
1615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
1625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        if (NFCSTATUS_PENDING == status)
1645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
1655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            /* Populate the Receive buffer */
1665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->TranceiveInfo.sRecvData.buffer = RecvBuf;
1675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->TranceiveInfo.sRecvData.length = *RecvLength;
1685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->pndef_recv_length = RecvLength;
1695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            phFriNfc_OvrHal_SetComplInfo(OvrHal,CompletionInfo, PH_FRINFC_OVRHAL_TRX);
1705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            /* Call the HAL 4.0 Transceive Function */
1725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            status = phHal4Nfc_Transceive (OvrHal->psHwReference,
1735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                            &OvrHal->TranceiveInfo, RemoteDevInfo,
1745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                            phFriNfc_OvrHal_CB_Transceive, (void *)OvrHal);
1755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
1765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
1785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    return status;
1795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
1815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Receive(phFriNfc_OvrHal_t              *OvrHal,
1835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  phFriNfc_CplRt_t               *CompletionInfo,
1845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  phHal_sRemoteDevInformation_t  *RemoteDevInfo,
1855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  uint8_t                        *RecvBuf,
1865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  uint16_t                       *RecvLength)
1875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
1885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   NFCSTATUS status = NFCSTATUS_PENDING;
1895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   /* Check the Input Parameters */
1915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   if(   (NULL==OvrHal)  || (NULL==CompletionInfo) || (NULL==RemoteDevInfo)
1925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      || (NULL==RecvBuf) || (NULL==RecvLength) )
1935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   {
1945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      status = PHNFCSTVAL(CID_FRI_NFC_OVR_HAL ,NFCSTATUS_INVALID_PARAMETER);
1955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   }
1965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   else
1975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   {
1985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      /* Get the remote dev type */
1995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      OvrHal->TransactInfo.remotePCDType = RemoteDevInfo->RemDevType;
2005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      /* Save the receive buffer for use in callback */
2015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      OvrHal->sReceiveData.buffer = RecvBuf;
2025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      OvrHal->sReceiveData.length = *RecvLength;
2035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      OvrHal->pndef_recv_length = RecvLength;
2055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      /* Set the callback */
2075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      phFriNfc_OvrHal_SetComplInfo(OvrHal, CompletionInfo, PH_FRINFC_OVRHAL_RCV);
2085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      /* Call the HAL 4.0 Receive Function */
2105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      status = phHal4Nfc_Receive( OvrHal->psHwReference,
2115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  &OvrHal->TransactInfo,
2125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  phFriNfc_OvrHal_CB_Receive,
2135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  (void *)OvrHal);
2145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   }
2155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   return status;
2165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
2175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Send(phFriNfc_OvrHal_t              *OvrHal,
2195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               phFriNfc_CplRt_t               *CompletionInfo,
2205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               phHal_sRemoteDevInformation_t  *RemoteDevInfo,
2215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               uint8_t                        *SendBuf,
2225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               uint16_t                       SendLength)
2235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
2245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   NFCSTATUS status = NFCSTATUS_PENDING;
2255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   /* Check the Input Parameters */
2275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   if(   (NULL==OvrHal) || (NULL==CompletionInfo) || (NULL==RemoteDevInfo) || (NULL==SendBuf)  )
2285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   {
2295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      status = PHNFCSTVAL(CID_FRI_NFC_OVR_HAL ,NFCSTATUS_INVALID_PARAMETER);
2305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   }
2315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   else
2325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   {
2335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      /* Get the remote dev type */
2345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      OvrHal->TransactInfo.remotePCDType = RemoteDevInfo->RemDevType;
2355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      /* Save the receive buffer for use in callback */
2365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      OvrHal->sSendData.buffer = SendBuf;
2375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      OvrHal->sSendData.length = SendLength;
2385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      /* Set the callback */
2405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      phFriNfc_OvrHal_SetComplInfo(OvrHal, CompletionInfo, PH_FRINFC_OVRHAL_SND);
2415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      /* Call the HAL 4.0 Receive Function */
2435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      status = phHal4Nfc_Send( OvrHal->psHwReference,
2445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               &OvrHal->TransactInfo,
2455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               OvrHal->sSendData,
2465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               phFriNfc_OvrHal_CB_Send,
2475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               (void *)OvrHal);
2485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   }
2495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   return status;
2505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
2515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifndef PH_FRINFC_MAP_MIFARESTD_DISABLED
2535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Reconnect(phFriNfc_OvrHal_t              *OvrHal,
2565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phFriNfc_CplRt_t               *CompletionInfo,
2575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phHal_sRemoteDevInformation_t  *RemoteDevInfo)
2585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
2595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    NFCSTATUS status = NFCSTATUS_PENDING;
2605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /* Check the Input Parameters */
2625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    if((NULL == OvrHal) || (NULL == CompletionInfo) || (NULL == RemoteDevInfo))
2635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
2645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        status = PHNFCSTVAL(CID_FRI_NFC_OVR_HAL ,NFCSTATUS_INVALID_PARAMETER);
2655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
2665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    else
2675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
2685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         phFriNfc_OvrHal_SetComplInfo(OvrHal, CompletionInfo, PH_FRINFC_OVRHAL_DIS);
2695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         status = phHal4Nfc_Connect(
2715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                             OvrHal->psHwReference,
2725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                             RemoteDevInfo,
2735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                             phFriNfc_OvrHal_CB_ConnectDisconnect,
2745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                             (void *)OvrHal);
2755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
2765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    return status;
2785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
2795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Connect(phFriNfc_OvrHal_t              *OvrHal,
2835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                        phFriNfc_CplRt_t               *CompletionInfo,
2845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                        phHal_sRemoteDevInformation_t  *RemoteDevInfo,
2855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                        phHal_sDevInputParam_t         *DevInputParam)
2865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
2875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    NFCSTATUS status = NFCSTATUS_PENDING;
2885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /* Check the Input Parameters */
2905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    if((NULL == OvrHal) || (NULL == CompletionInfo) || (NULL == RemoteDevInfo) ||
2915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        (NULL == DevInputParam))
2925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
2935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        status = PHNFCSTVAL(CID_FRI_NFC_OVR_HAL ,NFCSTATUS_INVALID_PARAMETER);
2945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
2955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    else
2965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
2975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        phFriNfc_OvrHal_SetComplInfo(OvrHal, CompletionInfo, PH_FRINFC_OVRHAL_CON);
2985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        status = phHal4Nfc_Connect(
3005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    OvrHal->psHwReference,
3015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    RemoteDevInfo,
3025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    phFriNfc_OvrHal_CB_ConnectDisconnect,
3035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    (void *)OvrHal
3045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    );
3055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
3065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    return status;
3085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
3095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif
3115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void phFriNfc_OvrHal_CB_Transceive(void *context,
3135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                          phHal_sRemoteDevInformation_t *RemoteDevHandle,
3145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                          phNfc_sData_t  *pRecvdata,
3155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                          NFCSTATUS status
3165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                          )
3175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
3195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_OvrHal_t       *OvrHal = (phFriNfc_OvrHal_t *)context;
3205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    if (NULL != OvrHal)
3225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
323143acf0b768ce3c2f61de2add5ca339479defd57daniel_Tomas        if(NULL != pRecvdata && OvrHal->TranceiveInfo.sRecvData.buffer != NULL && pRecvdata->buffer != NULL)
3245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
3255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly           /* Work-around for the NFCIP Tranceive API */
3265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            memcpy(OvrHal->TranceiveInfo.sRecvData.buffer, pRecvdata->buffer, pRecvdata->length);
3275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            if (OvrHal->pndef_recv_length != NULL)
3285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            {
3295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly               *OvrHal->pndef_recv_length = (uint16_t) pRecvdata->length;
3305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            }
3315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
3325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        if(NULL != RemoteDevHandle)
3335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
3345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            /* Fix for Warning 4100 */
3355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            RemoteDevHandle=RemoteDevHandle;
3365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
3375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        if (NULL != OvrHal->TemporaryCompletionInfo.CompletionRoutine)
3395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
3405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->TemporaryCompletionInfo.CompletionRoutine(
3415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                OvrHal->TemporaryCompletionInfo.Context,
3425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                status);
3435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
3445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
3455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
3465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void phFriNfc_OvrHal_CB_Send(void *context,
3485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    NFCSTATUS status)
3495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
3505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_OvrHal_t *OvrHal = (phFriNfc_OvrHal_t *)context;
3515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    if (NULL != OvrHal)
3535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
3545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        if (NULL != OvrHal->TemporarySndCompletionInfo.CompletionRoutine)
3555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
3565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->TemporarySndCompletionInfo.CompletionRoutine(
3575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                OvrHal->TemporarySndCompletionInfo.Context,
3585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                status);
3595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
3605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
3615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
3625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void phFriNfc_OvrHal_CB_Receive(void *context,
3645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                       phNfc_sData_t *pDataInfo,
3655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                       NFCSTATUS status)
3665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
3675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_OvrHal_t *OvrHal = (phFriNfc_OvrHal_t *)context;
3685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    if (NULL != OvrHal)
3705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
3715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        /* Copy the received buffer */
372143acf0b768ce3c2f61de2add5ca339479defd57daniel_Tomas        if(NULL != pDataInfo && OvrHal->sReceiveData.buffer != NULL && pDataInfo->buffer != NULL)
3735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
3745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            memcpy(OvrHal->sReceiveData.buffer, pDataInfo->buffer, pDataInfo->length);
3755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            *OvrHal->pndef_recv_length = (uint16_t) pDataInfo->length;
3765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
3775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        if (NULL != OvrHal->TemporaryRcvCompletionInfo.CompletionRoutine)
3795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
3805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            OvrHal->TemporaryRcvCompletionInfo.CompletionRoutine(
3815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                OvrHal->TemporaryRcvCompletionInfo.Context,
3825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                status);
3835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
3845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
3855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
3865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void phFriNfc_OvrHal_CB_ConnectDisconnect(void *context,
3885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               phHal_sRemoteDevInformation_t *RemoteDevHandle,
3895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               NFCSTATUS status
3905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               )
3915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
3935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_OvrHal_t   *OvrHal = (phFriNfc_OvrHal_t *)context;
3945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    if (NULL != OvrHal)
3965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    {
3975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        if (RemoteDevHandle != NULL)
3985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
3995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            /* Fix for Warning 4100 */
4005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            RemoteDevHandle = RemoteDevHandle;
4015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
4025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        else
4035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        {
4045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly            status = NFCSTATUS_FAILED;
4055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        }
4065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        OvrHal->TemporaryCompletionInfo.CompletionRoutine(
4085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                OvrHal->TemporaryCompletionInfo.Context, status);
4095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    }
4105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
4125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellystatic void  phFriNfc_OvrHal_SetComplInfo(phFriNfc_OvrHal_t *OvrHal,
4145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                   phFriNfc_CplRt_t  *CompletionInfo,
4155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                   uint8_t            Operation)
4165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
4175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
4185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   OvrHal->Operation = Operation;
4195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   switch(Operation)
4205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   {
4215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      case PH_FRINFC_OVRHAL_RCV:
4225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      {
4235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         OvrHal->TemporaryRcvCompletionInfo.CompletionRoutine = CompletionInfo->CompletionRoutine;
4245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         OvrHal->TemporaryRcvCompletionInfo.Context = CompletionInfo->Context;
4255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         break;
4265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      }
4275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      case PH_FRINFC_OVRHAL_SND:
4285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      {
4295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         OvrHal->TemporarySndCompletionInfo.CompletionRoutine = CompletionInfo->CompletionRoutine;
4305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         OvrHal->TemporarySndCompletionInfo.Context = CompletionInfo->Context;
4315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         break;
4325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      }
4335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      default:
4345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      {
4355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         OvrHal->TemporaryCompletionInfo.CompletionRoutine = CompletionInfo->CompletionRoutine;
4365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         OvrHal->TemporaryCompletionInfo.Context = CompletionInfo->Context;
4375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly         break;
4385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly      }
4395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly   }
4405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly}
441