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.h
195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Overlapped HAL
205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Project: NFC-FRI
225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Creator: Gerald Kersch
235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Date: Tue May 19 10:30:18 2009 $
255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * Changed by: $Author: ing07336 $
265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Revision: 1.13 $
275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * $Aliases: NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $
285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifndef PHFRINFC_OVRHAL_H
325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PHFRINFC_OVRHAL_H
335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phFriNfc.h>
355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#ifdef PH_HAL4_ENABLE
365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHal4Nfc.h>
375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#else
385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phHalNfc.h>
395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif
405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcCompId.h>
415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#include <phNfcStatus.h>
425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \name Overlapped HAL
465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * File: \ref phFriNfc_OvrHal.h
485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_FILEREVISION "$Revision: 1.13 $" /** \ingroup grp_file_attributes */
525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_FILEALIASES  "$Aliases: NFC_FRI1.1_WK922_PREP1,NFC_FRI1.1_WK920_R25_1,NFC_FRI1.1_WK922_R26_1,NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,NFC_FRI1.1_WK934_PREP_1,NFC_FRI1.1_WK934_R31_1,NFC_FRI1.1_WK941_PREP1,NFC_FRI1.1_WK941_PREP2,NFC_FRI1.1_WK941_1,NFC_FRI1.1_WK943_R32_1,NFC_FRI1.1_WK949_PREP1,NFC_FRI1.1_WK943_R32_10,NFC_FRI1.1_WK943_R32_13,NFC_FRI1.1_WK943_R32_14,NFC_FRI1.1_WK1007_R33_1,NFC_FRI1.1_WK1007_R33_4,NFC_FRI1.1_WK1017_PREP1,NFC_FRI1.1_WK1017_R34_1,NFC_FRI1.1_WK1017_R34_2,NFC_FRI1.1_WK1023_R35_1 $"      /** \ingroup grp_file_attributes */
535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/** \defgroup grp_fri_nfc_ovr_hal Overlapped HAL
575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  This component encapsulates the HAL functions, suited for the NFC-FRI overlapped way of operation. The HAL itself
595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  is used as it is, wrapped by this component. The purpose of the wrapper is to de-couple a blocking I/O, as used by
605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  the HAL, from the overlapped I/O operation mode the FRI is using.
615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \par Device Based Functions
635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  NFC Device Based Functions are used to address the NFC device (local device) directly.
645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  These are all functions that use no Remote Device Information.
655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \par Connection Based Functions
675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  Connection Based Functions use the Remote Device Information to describe a connection
685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  to a certain Remote Device.
695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \par Component Instance Sharing
715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  FRI components accessing one NFC device share one instance of the Overlapped HAL. Therefore
725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  each calling FRI component must specify - together with the call - where to deliver the
735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  response of the overlapped operation.
745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \par Lowest Layer
765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  The Overlapped HAL represents the NFC Device, the lowest layer of the FRI components.
775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \par Completion Forced
795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  The \b HAL \b functions (and underlying functions) of this library must complete before a new call can
805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  be issued. No HAL operation must be pending.
815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \name OVR HAL Constants
875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_MAX_NUM_MOCKUP_PARAM           255    /**< Number of mockup indices that are are prepared. */
905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/* Harsha: changed from 48 to 128, to work with the Mifare 4k TCs */
915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_MAX_NUM_MOCKUP_RDI             4     /**< Max. number of mockup RDIs. */
925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_MAX_TEST_DELAY                 1000  /**< Max. test delay in OVR HAL. */
935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_POLL_PAYLOAD_LEN               5     /**< Length of the POLL payload. */ /* @GK/5.6.06 */
945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/
955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@}*/ /* defgroup... */
965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/** \defgroup grp_ovr_hal_cmd Overlapped HAL Command List
985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \ingroup grp_fri_nfc_ovr_hal
995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  These are the command definitions for the Overlapped HAL. They are used internally by the
1005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  implementation of the component.
1015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/*@{*/
1035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_NUL             (0)     /**< \brief We're in NO command */
1045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_ENU             (1)     /**< \brief Enumerate */
1065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_OPE             (2)     /**< \brief Open */
1075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_CLO             (3)     /**< \brief Close */
1085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_GDC             (4)     /**< \brief Get Dev Caps */
1095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_POL             (5)     /**< \brief Poll */
1105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_CON             (6)     /**< \brief Connect */
1115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_DIS             (7)     /**< \brief Disconnect */
1125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_TRX             (8)     /**< \brief Transceive */
1135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_STM             (9)     /**< \brief Start Target Mode */
1145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_SND             (10)     /**< \brief Send */
1155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_RCV             (11)    /**< \brief Receive */
1165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_IOC             (12)    /**< \brief IOCTL */
1175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#define PH_FRINFC_OVRHAL_TST             (255)   /**< \brief OVR HAL test-related command */
1195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/** \ingroup grp_fri_nfc_ovr_hal
1215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \brief Post Message Function for Overlapped HAL
1225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \copydoc page_reg
1245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This is required by the Overlapped HAL in order to call the blocking (original HAL) in another
1265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * thread. This function is required in addition to \ref pphFriNfc_OvrHalPresetParm to be
1275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * implemented in the integrating software.
1285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \par First Parameter: Context of the Integration
1305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      Set to the value, the Integration has provided when initialising this component.
1315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellytypedef void (*pphFriNfc_OvrHalPostMsg_t)(void*);
1335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/** \ingroup grp_fri_nfc_ovr_hal
1355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \brief Abort Function (to be defined/implemented by the Integration)
1365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \copydoc page_reg
1385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This is required by the Overlapped HAL in order abort a pending Overlapped HAL operation. This funtion will be
1405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * internally called by the \ref phFriNfc_OvrHal_Abort function.
1415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \par First Parameter: Context of the Integration
1435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      Set to the value, the Integration has provided when initialising this component.
1445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \par Return value:
1465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      As defined by the integration
1475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellytypedef NFCSTATUS (*pphFriNfc_OvrHalAbort_t)(void*);
1495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellytypedef void (*pphOvrHal_CB_t) (phHal_sRemoteDevInformation_t *RemoteDevHandle,
1525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                NFCSTATUS status,
1535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                phNfc_sData_t  *pRecvdata,
1545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                void *context);
1555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/** \ingroup grp_fri_nfc_ovr_hal
1575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \brief Preset Function to prepare the parameters in the HAL
1585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \copydoc page_reg
1605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * This function (pointer) is called by the Overlapped HAL to prepare the function call parameters
1625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * in the HAL before posting the start message. As we have an asynchronously running FRI, but a
1635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * synchronous HAL, the calls need to be "decoupled". This means, the HAL needs to run under
1645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * a different time-base (or thread/task etc.). The consequence is that the data exchange between
1655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * FRI and HAL must be done as required by the integration/system itself. The declaration
1665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * of the function pointer allows for the integrating software to implement whatever functionality
1675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * is required to convey the data.
1685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \par First Parameter
1715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      Context of the Integration Set to the value, the Integration has provided when initialising
1725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      this component.
1735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \par Second Parameter:
1755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      \b HAL \b Command, as defined in the module \ref grp_ovr_hal_cmd.
1765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \par Third Parameter:
1785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      \b Pointers to a specific structure containing the parameters of the HAL functions to be
1795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      called.
1805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \par Forth parameter:
1825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      Immediate Operation result (not the result of the HAL operation). Usually this is
1835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      \ref NFCSTATUS_PENDING (for a successfully triggered HAL I/O or an error value that is
1845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      returned by the HAL immediately, such as \ref NFCSTATUS_INVALID_PARAMETER.
1855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \par Return value:
1875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      A boolean (\ref grp_special_conventions) value. The integration implementation must ensure
1885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *      that, if the function \b succeeds, the return value is \b TRUE, otherwise false.
1895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
1905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellytypedef uint8_t (*pphFriNfc_OvrHalPresetParm)(void*, uint16_t, void*, NFCSTATUS*);
1915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
1925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/** \ingroup grp_fri_nfc_ovr_hal
1935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  \brief Overlapped HAL Context
1945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
1955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  The Overlapped HAL structure. This structure contains the HAL "context" that
1965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  is required by the FRI on a connection basis. Please note that the Overlapped HAL is
1975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  a shared component, requiring a special completion notification mechanism.
1985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *  Read more in the description of this component.
1995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
2015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pellytypedef struct phFriNfc_OvrHal
2025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly{
2035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Currently active operation of the component. If no operation is pending, the content of this member is
2045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  \ref PH_FRINFC_OVRHAL_NUL .  The component refuses a new call if the contenet is different, namely one
2055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  of the other values defined in \ref grp_ovr_hal_cmd .
2065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t                         Operation;
2085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** The \b temporary pointer to the completion routine information. The HAL needs - for each call - to be told about the
2105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  completion routine of the upper (calling) component. This major difference to other components is because
2115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  some functions of the HAL are connection-based and some are not. Moreover it is because the HAL is shared
2125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  among the FRI components. So, with a variety of potential callers it is required for each caller to instruct
2135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  the HAL about the "delivery" address of the response for each individual call.
2145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_CplRt_t                TemporaryCompletionInfo;
2165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_CplRt_t                TemporaryRcvCompletionInfo;
2175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phFriNfc_CplRt_t                TemporarySndCompletionInfo;
2185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Points to a function within the Integration that presets the parameters for the actual
2205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  HAL call.
2215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    pphFriNfc_OvrHalPresetParm      Presetparameters;
2235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Posts a message to the actual HAL integration, starting a  NFC HAL I/O with the pre-set
2255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  parameters.
2265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    pphFriNfc_OvrHalPostMsg_t       PostMsg;
2285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** The context of the Integration (the SW around this component). This is needed to let
2305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  the Overlapped HAL access the Integration's functionality to post a message to another
2315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  thread.
2325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    void                           *IntegrationContext;
2345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Device reference returned during enumeration: This has to be filled in by the integrating software after
2365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly        a call to the HAL Enumerate function (not contained in the overlapped HAl API). */
2375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phHal_sHwReference_t           *psHwReference;
2385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** This flag is set by the ABORT function. The OVR HAL then does no I/O to the real HAL
2405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  or to the mockup any more but just completed with the ABORTED status.
2415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint8_t OperationAborted;
2435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Abort function to be implemented by the integration. This parameter can be (optionally) initialized
2455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  via the call of \ref phFriNfc_OvrHal_Reset_Abort function.
2465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     *  If it is not NULL, the function pointed by \ref will be internally called by the \ref phFriNfc_OvrHal_Abort function.
2475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    pphFriNfc_OvrHalAbort_t      AbortIntegrationFunction;
2495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** Integration-defined Context passed as a parameter of the \ref AbortIntegrationFunction.
2515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2525d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    void*                        AbortIntegrationContext;
2535d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2545d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    void*                        OvrCompletion;
2555d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2565d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phHal_sTransceiveInfo_t      TranceiveInfo;
2575d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2585d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** TODO
2595d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2605d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phNfc_sData_t                sReceiveData;
2615d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2625d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** TODO
2635d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2645d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phNfc_sData_t                sSendData;
2655d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2665d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    /** TODO
2675d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly     */
2685d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    phHal4Nfc_TransactInfo_t     TransactInfo;
2695d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2705d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly    uint16_t                     *pndef_recv_length;
2715d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly} phFriNfc_OvrHal_t;
2725d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
2735d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
2745d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \ingroup grp_fri_nfc_ovr_hal
2755d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2765d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief Transceive Data to/from a Remote Device
2775d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2785d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \copydoc page_ovr
2795d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2805d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in]      OvrHal               Component Context.
2815d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in]      CompletionInfo       \copydoc phFriNfc_OvrHal_t::TemporaryCompletionInfo
2825d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in,out]  RemoteDevInfo        Remote Device Information.
2835d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in]      Cmd                  Command to perform.
2845d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[out]     DepAdditionalInfo    Protocol Information.
2855d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in]      SendBuf              Pointer to the data to send.
2865d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in]      SendLength           Length, in bytes, of the Send Buffer.
2875d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[out]     RecvBuf              Pointer to the buffer that receives the data.
2885d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \param[in,out]  RecvLength           Length, in bytes, of the received data.
2895d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
2905d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_PENDING                The operation is pending.
2915d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE_REQUEST \copydoc phFriNfc_OvrHal_t::Operation
2925d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_SUCCESS                Success.
2935d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_PARAMETER      One or more of the supplied parameters could not be
2945d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                          properly interpreted.
2955d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has been disconnected
2965d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *                                          meanwhile.
2975d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_CMD_ABORTED            The caller/driver has aborted the request.
2985d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_BUFFER_TOO_SMALL       The buffer provided by the caller is too small.
2995d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \retval NFCSTATUS_RF_TIMEOUT             No data has been received within the TIMEOUT period.
3005d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3015d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \note Please refer to HAL Transceive for a detailed description of the
3025d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *       underlying function and the propagated parameters.
3035d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3045d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3055d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3065d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Transceive(phFriNfc_OvrHal_t              *OvrHal,
3075d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phFriNfc_CplRt_t               *CompletionInfo,
3085d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phHal_sRemoteDevInformation_t  *RemoteDevInfo,
3095d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phHal_uCmdList_t                Cmd,
3105d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     phHal_sDepAdditionalInfo_t     *DepAdditionalInfo,
3115d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     uint8_t                        *SendBuf,
3125d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     uint16_t                        SendLength,
3135d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     uint8_t                        *RecvBuf,
3145d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                     uint16_t                       *RecvLength);
3155d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3165d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
3175d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \ingroup grp_fri_nfc_ovr_hal
3185d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3195d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief TODO
3205d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3215d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3225d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Receive(phFriNfc_OvrHal_t              *OvrHal,
3235d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  phFriNfc_CplRt_t               *CompletionInfo,
3245d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  phHal_sRemoteDevInformation_t  *RemoteDevInfo,
3255d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  uint8_t                        *RecvBuf,
3265d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  uint16_t                       *RecvLength);
3275d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3285d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly/**
3295d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \ingroup grp_fri_nfc_ovr_hal
3305d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3315d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly * \brief TODO
3325d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly *
3335d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly */
3345d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Send(phFriNfc_OvrHal_t              *OvrHal,
3355d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               phFriNfc_CplRt_t               *CompletionInfo,
3365d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               phHal_sRemoteDevInformation_t  *RemoteDevInfo,
3375d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               uint8_t                        *SendBuf,
3385d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                               uint16_t                       SendLength);
3395d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3405d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3415d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Reconnect(phFriNfc_OvrHal_t              *OvrHal,
3425d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    phFriNfc_CplRt_t               *CompletionInfo,
3435d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                    phHal_sRemoteDevInformation_t  *RemoteDevInfo);
3445d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3455d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3465d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick PellyNFCSTATUS phFriNfc_OvrHal_Connect(phFriNfc_OvrHal_t              *OvrHal,
3475d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  phFriNfc_CplRt_t               *CompletionInfo,
3485d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  phHal_sRemoteDevInformation_t  *RemoteDevInfo,
3495d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly                                  phHal_sDevInputParam_t         *DevInputParam);
3505d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly
3515d9927ba30ba449badb9f6df0fbeb4d6aedc6e2aNick Pelly#endif
352