EVE 1.0
nfc-nxp-hal.h
1 
2 /******************************************************************************
3  * NXP lib communication interface HAL (SPI related)
4  *****************************************************************************/
5 
6 phStatus_t phbalReg_Stub_GetPortList(phbalReg_Stub_DataParams_t * pDataParams,
7  uint16_t wPortBufSize,
8  uint8_t * pPortNames,
9  uint16_t * pNumOfPorts);
10 
11 phStatus_t phbalReg_Stub_SetPort(phbalReg_Stub_DataParams_t * pDataParams,
12  uint8_t * pPortName);
13 
14 phStatus_t phbalReg_Stub_OpenPort(phbalReg_Stub_DataParams_t * pDataParams);
15 
16 phStatus_t phbalReg_Stub_ClosePort(phbalReg_Stub_DataParams_t * pDataParams);
17 
18 phStatus_t phbalReg_Stub_Exchange(phbalReg_Stub_DataParams_t * pDataParams,
19  uint16_t wOption,
20  uint8_t * pTxBuffer,
21  uint16_t wTxLength,
22  uint16_t wRxBufSize,
23  uint8_t * pRxBuffer,
24  uint16_t * pRxLength);
25 
26 phStatus_t phbalReg_Stub_SetConfig(phbalReg_Stub_DataParams_t * pDataParams,
27  uint16_t wConfig,
28  uint16_t wValue);
29 
30 phStatus_t phbalReg_Stub_GetConfig(phbalReg_Stub_DataParams_t * pDataParams,
31  uint16_t wConfig,
32  uint16_t * pValue);
33 
34 
35 /******************************************************************************
36  * NXP lib OS AL (timers)
37  *****************************************************************************/
38 
39 /**
40  * \defgroup phPlatform Component : Stub
41  * \ingroup pn512
42  * \brief These Components implement the Osal commands.
43  * \{
44  */
45 
46 #define PLATFORM_MAX_TIMERS 3U /**< Maximum number of timers available */
47 #define TIMER_USED 1U /**< Indicates that the timer is used */
48 #define TIMER_FREE 0U /**< Indicates that the timer is free */
49 #ifndef TIME_INTERVAL
50 #define TIME_INTERVAL (SystemFrequency/100 - 1)
51 #endif
52 
53 /**
54 *
55 * \brief Timer callback interface which will be called once registered timer
56 * timeout expires.
57 * \param[in] TimerId Timer Id for which callback is called.
58 * \retval None
59 */
60 typedef void (*ppCallBck_t)(void *pContext);
61 
62 typedef struct Timer_Struct
63 {
64  uint32_t dwTimerId; /**< ID of the timer */
65  uint8_t bTimerFree; /**< Indicates whether the current timer is free or used */
66  ppCallBck_t pApplicationCallback; /**< The call back function for this timer */
67  void *pContext; /**< The argument to the call back function */
68 } Timer_Struct_t;
69 
70 /**
71 * \brief OSAL parameter structure
72 */
73 typedef struct
74 {
75  uint16_t wId; /**< ID of this component, do not modify */
76  Timer_Struct_t gTimers[PLATFORM_MAX_TIMERS]; /**< Timer structure */
78 
79 /**
80 * Initializes the Stub timer component
81 *
82 * \return status code
83 * \retval #PH_ERR_SUCCESS Operation successful.
84 *
85 */
86 phStatus_t phPlatform_Init(phPlatform_DataParams_t *pDataParams); /**<[In] Data parameters representing this component */
87 
88 /** \defgroup phOsal Operating System Abstraction Layer
89 * \brief These Components implement the Osal commands.
90 * @{
91 */
92 
93 #define PH_PLATFORM_TIMER_UNIT_US 0x00U /**< Indicates that the specified delay is in microseconds.*/
94 #define PH_PLATFORM_TIMER_UNIT_MS 0x01U /**< Indicates that the specified delay is in milliseconds. */
95 #define PH_PLATFORM_INVALID_TIMER_ID 0xFFFFFFFF /**< Invalid Timer Id. */
96 
97 /**
98  * \name Platform error codes
99  *@{
100  */
101 
102 #define PH_PLATFORM_ERR_NO_FREE_TIMER (PH_ERR_CUSTOM_BEGIN + 0) /**< Error condition indicating that no timer is available for allocation. */
103 #define PH_PLATFORM_ERR_INVALID_TIMER (PH_ERR_CUSTOM_BEGIN + 1) /**< Indicates that the timer ID that was supplied was invalid. */
104 
105 /** @} */
106 
107 /* *****************************************************************************************************************
108 * Function Prototypes
109 * ***************************************************************************************************************** */
110 /**
111 * \brief Initialize platform timers.
112 *
113 * \return Status code
114 * \retval #PH_ERR_SUCCESS Operation successful.
115 * USED BY APP ONLY
116 */
117 phStatus_t phPlatform_Timer_Init(phPlatform_DataParams_t *pDataParams); /**< [In] Pointer to this layers parameter structure. */
118 
119 
120 /**
121 * \brief Allocates a free timer.
122 * Note:
123 *
124 * \return Status code
125 * \retval #PH_ERR_SUCCESS Operation successful.
126 * \retval #PH_PLATFORM_ERR_NO_FREE_TIMER No Free Timer available to create.
127 */
128 phStatus_t phPlatform_Timer_Create(phPlatform_DataParams_t *pDataParams, /**< [In] Pointer to this layers parameter structure. */
129  uint32_t *timerId /**< [Out] Timer Id */
130  );
131 
132 /**
133 * \brief Start the timer.
134 * Note: Valid Timer ID should be provided. Timer ID is provided by calling \ref phPlatform_Timer_Create function.
135 *
136 * \return Status code
137 * \retval #PH_ERR_SUCCESS Operation successful.
138 * \retval #PH_ERR_INVALID_PARAMETER Invalid input parameter.
139 * \retval #PH_PLATFORM_ERR_INVALID_TIMER Provided Timer ID is not created.
140 */
141 phStatus_t phPlatform_Timer_Start(phPlatform_DataParams_t *pDataParams, /**< [In] Pointer to this layers parameter structure. */
142  uint32_t dwTimerId, /**< [In] Timer Id */
143  uint32_t dwRegTimeCnt, /**< [In] Time delay count */
144  uint16_t wOption, /**< [In] Option parameter to mention delay in Units
145  (either #PH_PLATFORM_TIMER_UNIT_US or #PH_PLATFORM_TIMER_UNIT_MS). */
146  ppCallBck_t pApplication_callback, /**< [In] Callback to be called on time out */
147  void *pContext /**< [In] Callback function context */
148  );
149 
150 /**
151 * \brief Get Elapsed Delay from timer which is created and started before calling this API.
152 *
153 * \return Status code
154 * \retval #PH_ERR_SUCCESS Operation successful.
155 * \retval #PH_ERR_INVALID_PARAMETER Invalid input parameter.
156 * \retval #PH_PLATFORM_ERR_INVALID_TIMER Provided Timer ID is not created.
157 * NOT USED
158 */
159 phStatus_t phPlatform_Timer_GetElapsedDelay(phPlatform_DataParams_t *pDataParams, /**< [In] Pointer to this layers parameter structure. */
160  uint32_t dwTimerId, /**< [In] Timer Id */
161  uint16_t wOption, /**< [In] Option parameter to mention delay in Units
162  (either #PH_PLATFORM_TIMER_UNIT_US or #PH_PLATFORM_TIMER_UNIT_MS). */
163  uint32_t *dwGetElapsedDelay /**< [Out] Measured Delay after Timer Start in milli/micro seconds based on input option. */
164  );
165 /**
166 * \brief Stop the timer.
167 *
168 * \return Status code
169 * \retval #PH_ERR_SUCCESS Operation successful.
170 * \retval Other Depending on implementation and underlying component.
171 */
172 phStatus_t phPlatform_Timer_Stop(phPlatform_DataParams_t *pDataParams, /**< [In] Pointer to this layers parameter structure. */
173  uint32_t dwTimerId /**< [In] Timer Id */
174  );
175 
176 /**
177 * \brief Timer wait function.
178 *
179 * \return Status code
180 * \retval #PH_ERR_SUCCESS Operation successful.
181 * \retval #PH_PLATFORM_ERR_NO_FREE_TIMER No Free Timer available to create.
182 * NOT USED
183 */
184 phStatus_t phPlatform_Timer_Wait(phPlatform_DataParams_t *pDataParams, /**< [In] Pointer to this layers parameter structure. */
185  uint8_t bTimerDelayUnit, /**< [In] Delay value unit could be in microseconds or milliseconds */
186  uint16_t wDelay /**< [In] Time Delay */
187  );
188 
189 /**
190 * \brief Resets the timer allocated to the application which is created by \ref phPlatform_Timer_Create.
191 *
192 * \return Status code
193 * \retval #PH_ERR_SUCCESS Operation successful.
194 * \retval #PH_PLATFORM_ERR_INVALID_TIMER Provided Timer ID is not created.
195 */
196 phStatus_t phPlatform_Timer_Reset(phPlatform_DataParams_t *pDataParams, /**< [In] Pointer to this layers parameter structure. */
197  uint32_t dwtimerId /**< [In] Timer Id */
198  );
199 
200 
201 /**
202 * \brief Delete or Deallocate the timer.
203 *
204 * \return Status code
205 * \retval #PH_ERR_SUCCESS Operation successful.
206 * \retval #PH_PLATFORM_ERR_INVALID_TIMER Provided Timer ID is not created.
207 */
208 phStatus_t phPlatform_Timer_Delete(phPlatform_DataParams_t *pDataParams, /**< [In] Pointer to this layers parameter structure. */
209  uint32_t dwTimerId /**< [In] Timer Id */
210  );
211 
212 /**
213 * \brief Execute the Callback registered to the timer.
214 *
215 * \return Status code
216 * \retval #PH_ERR_SUCCESS Operation successful.
217 * \retval Other Depending on implementation and underlying component.
218 * NOT USED
219 */
220 phStatus_t phPlatform_Timer_ExecCallback(phPlatform_DataParams_t *pDataParams, /**< [In] Pointer to this layers parameter structure. */
221  uint32_t dwTimerId /**< [In] Timer Id */
222  );
223 /** \} */
224 
225 /** \} */
phStatus_t phPlatform_Timer_Delete(phPlatform_DataParams_t *pDataParams, uint32_t dwTimerId)
Delete or Deallocate the timer.
phStatus_t phPlatform_Timer_Wait(phPlatform_DataParams_t *pDataParams, uint8_t bTimerDelayUnit, uint16_t wDelay)
Timer wait function.
phStatus_t phPlatform_Timer_Start(phPlatform_DataParams_t *pDataParams, uint32_t dwTimerId, uint32_t dwRegTimeCnt, uint16_t wOption, ppCallBck_t pApplication_callback, void *pContext)
Start the timer. Note: Valid Timer ID should be provided. Timer ID is provided by calling phPlatform_...
phStatus_t phPlatform_Timer_Stop(phPlatform_DataParams_t *pDataParams, uint32_t dwTimerId)
Stop the timer.
phStatus_t phPlatform_Timer_Create(phPlatform_DataParams_t *pDataParams, uint32_t *timerId)
Allocates a free timer. Note:
phStatus_t phPlatform_Timer_Init(phPlatform_DataParams_t *pDataParams)
Initialize platform timers.
OSAL parameter structure.
Definition: nfc-nxp-hal.h:73
#define PLATFORM_MAX_TIMERS
Definition: nfc-nxp-hal.h:46
phStatus_t phPlatform_Init(phPlatform_DataParams_t *pDataParams)
phStatus_t phPlatform_Timer_GetElapsedDelay(phPlatform_DataParams_t *pDataParams, uint32_t dwTimerId, uint16_t wOption, uint32_t *dwGetElapsedDelay)
Get Elapsed Delay from timer which is created and started before calling this API.
void(* ppCallBck_t)(void *pContext)
Timer callback interface which will be called once registered timer timeout expires.
Definition: nfc-nxp-hal.h:60
phStatus_t phPlatform_Timer_ExecCallback(phPlatform_DataParams_t *pDataParams, uint32_t dwTimerId)
Execute the Callback registered to the timer.
phStatus_t phPlatform_Timer_Reset(phPlatform_DataParams_t *pDataParams, uint32_t dwtimerId)
Resets the timer allocated to the application which is created by phPlatform_Timer_Create.