1/*
2 * Copyright (C) 2010 NXP Semiconductors
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17
18/*!
19
20* \file  phDal4Nfc.h
21* \brief Common DAL for the upper layer.
22*
23* Project: NFC-FRI-1.1
24*
25* $Date: Tue Nov 10 13:56:45 2009 $
26* $Author: ing07299 $
27* $Revision: 1.38 $
28* $Aliases: 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 $
29*
30*/
31
32#ifndef PHDAL4NFC_H
33#define PHDAL4NFC_H
34
35/**
36*  \name DAl4 NFC
37*
38* File: \ref phDal4Nfc.h
39*
40*/
41/*@{*/
42#define PH_DAL4NFC_FILEREVISION "$Revision: 1.38 $" /**< \ingroup grp_file_attributes */
43#define PH_DAL4NFC_FILEALIASES    "$Aliases: 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 $"
44 /**< \ingroup grp_file_attributes */
45/*@}*/
46/*************************** Includes *******************************/
47/** \defgroup grp_nfc_dal DAL Component
48 *
49 *
50 *
51 */
52/**< Basic type definitions */
53#include <phNfcTypes.h>
54/**< Generic Interface Layer Function Definitions */
55#include <phNfcInterface.h>
56/*********************** End of includes ****************************/
57
58/***************************** Macros *******************************/
59 /**< Used for messaging by DAL as well as Upper Layers */
60#define PH_DAL4NFC_MESSAGE_BASE  PH_LIBNFC_DEFERREDCALL_MSG
61
62/************************ End of macros *****************************/
63
64
65/********************* Structures and enums *************************/
66
67/**
68 * \ingroup grp_nfc_dal
69 *
70 * DAL context : This contains the information of the upper layer callback
71 * and hardware reference.
72 */
73typedef struct phDal4Nfc_SContext
74{
75	phNfcIF_sCallBack_t		cb_if;		/**<Callback info registered by upper layer*/
76	volatile uint8_t		hw_valid;	/**<Flag - shows Hardware present or not */
77	void					*pHwRef;	/**<Hardware Reference*/
78}phDal4Nfc_SContext_t,*pphDal4Nfc_SContext_t;
79
80/**
81 * \ingroup grp_nfc_dal
82 *
83 * DAL enum for Messages : This contains the enums used for
84 * posting messages to the application.
85 */
86typedef enum phDal4Nfc_Messages_en
87{
88    /**<Read message type used to post Read DAL Message to dispatch routine.Dispatch routine
89	calls read callback registered by upper layer */
90    PHDAL4NFC_READ_MESSAGE = 0,
91    /**<Readwait message type used to post Read wait DAL Message to dispatch routine.Dispatch routine
92	calls read wait callback registered by upper layer */
93	PHDAL4NFC_READWAIT_MESSAGE,
94	/**<Write message type used to post write DAL Message to dispatch routine.Dispatch routine
95	calls write wait callback registered by upper layer */
96    PHDAL4NFC_WRITE_MESSAGE,
97	/**<Notify message type used to post Notify DAL Message to dispatch routine.Dispatch routine
98	calls notify callback registered by upper layer */
99    PHDAL4NFC_NOTIFY_MESSAGE
100}phDal4Nfc_Messages_en_t;
101
102/**
103 * \ingroup grp_nfc_dal
104 *
105 * \brief DAL Message structure definition.This structure contains
106 *
107 * This structure contains details like  message type,read ,read wait and write callbacks
108 * reference details as registered by upper layer.
109 */
110typedef struct phDal4Nfc_Message
111{
112    /**<Refenrece to context.Context can be DAL context  */
113	void                                *pContext;
114    /**<Reference to hardware reference strucutre */
115	void                                *pHwRef;
116	/**<DAL message of type \ref phDal4Nfc_Messages_en_t*/
117    phDal4Nfc_Messages_en_t             eMsgType;
118	/**<Transaction specific information of type \ref phNfc_sTransactionInfo_t*/
119    phNfc_sTransactionInfo_t            transactInfo;
120	/**<Reference to read callback,registered by upper layer.This is of type \ref pphNfcIF_Transact_Completion_CB_t*/
121    pphNfcIF_Transact_Completion_CB_t   readCbPtr;
122	/**<Reference to write callback ,registered by upper layer.This is of type \ref pphNfcIF_Transact_Completion_CB_t*/
123    pphNfcIF_Transact_Completion_CB_t   writeCbPtr;
124} phDal4Nfc_Message_t,*pphDal4Nfc_Message_t;
125
126/**
127 * \ingroup grp_nfc_dal
128 *\brief Possible DAL Configuration exposed to upper layer.
129 * Typically this should be port name (Ex:"COM1","COM2") to which PN544 is connected.
130 */
131#define   ENUM_DAL_LINK_TYPE_COM1 ENUM_LINK_TYPE_COM1
132#define   ENUM_DAL_LINK_TYPE_COM2 ENUM_LINK_TYPE_COM2
133#define   ENUM_DAL_LINK_TYPE_COM3 ENUM_LINK_TYPE_COM3
134#define   ENUM_DAL_LINK_TYPE_COM4 ENUM_LINK_TYPE_COM4
135#define   ENUM_DAL_LINK_TYPE_COM5 ENUM_LINK_TYPE_COM5
136#define   ENUM_DAL_LINK_TYPE_COM6 ENUM_LINK_TYPE_COM6
137#define   ENUM_DAL_LINK_TYPE_COM7 ENUM_LINK_TYPE_COM7
138#define   ENUM_DAL_LINK_TYPE_COM8 ENUM_LINK_TYPE_COM8
139#define   ENUM_DAL_LINK_TYPE_I2C ENUM_LINK_TYPE_I2C
140#define   ENUM_DAL_LINK_TYPE_USB ENUM_LINK_TYPE_USB
141#define   ENUM_DAL_LINK_TYPE_TCP ENUM_LINK_TYPE_TCP
142
143#define   ENUM_DAL_LINK_TYPE_NB ENUM_LINK_TYPE_NB
144typedef phLibNfc_eConfigLinkType phDal4Nfc_eConfigLinkType;
145
146typedef phLibNfc_sConfig_t phDal4Nfc_sConfig_t;
147typedef phLibNfc_sConfig_t *pphDal4Nfc_sConfig_t;
148
149/****************** End of structures and enums *********************/
150
151/******************** Function declarations *************************/
152
153/**
154 * \ingroup grp_nfc_dal
155 *
156 *\brief Allows to register upper layer with DAL layer.
157 * This API allows upper layer to register with DAL layer.As part of registration
158 *<br>1.Exports DAL interfaces and DAL layer context to upper layer.
159 *Exported DAL interfaces are :
160 *<br><br>.phDal4Nfc_Shutdown
161 *<br><br>.phDal4Nfc_Write
162 *<br><br>.phDal4Nfc_Read
163 *<br><br>.phDal4Nfc_ReadWait
164 *<br><br>.phDal4Nfc_ReadWaitCancel
165 *<br><br>phDal4Nfc_Unregister
166 *<br><br>.Registeres upper layer callbacks and upper layer context with DAL layer.
167 *For details refer to \ref phNfcIF_sReference_t.
168 *Registration details are valid unless upper layer calls \ref phDal4Nfc_Unregister()
169 or \ref phDal4Nfc_Shutdown called.
170
171 * \param[in,out] psRefer   holds  DAL exported interface references once registration
172 *							sucessful.This also contains transmit and receive buffer
173 *							references.
174 *
175 * \param[in]     if_cb		Contains upper layer callback reference details, which are used
176 *							by DAL layer during callback notification.
177 *							These callbacks gets registered with DAL layer.
178 *
179
180 * \param[out]	 psIFConf  Currently this parameter not used.This  parameter to be other than NULL.
181 *
182 *
183 * \retval NFCSTATUS_SUCCESS             Operation is successful.
184 * \retval NFCSTATUS_INVALID_PARAMETER   At least one parameter of the function is invalid.
185 *
186 *\msc
187 *ClientApp,UpperLayer,phDal4Nfc;
188 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
189 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
190 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
191 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
192 *\endmsc
193 */
194
195 extern
196 NFCSTATUS
197 phDal4Nfc_Register(
198                 phNfcIF_sReference_t   *psRefer,
199                 phNfcIF_sCallBack_t    if_cb,
200                 void *psIFConf
201                 );
202
203
204/**
205 * \ingroup grp_nfc_dal
206 *
207 * \brief  Allows upper layer to unregister with DAL layer.
208 * This interface allows to unregister upper layer callback interfaces with DAL layer.
209 * \note: Once this this API is called DAL layer stops notifying upper layer callbacks in case
210 * any events reported within DAL.
211 *
212 * \param[in]  pContext        DAL context is provided by the upper layer.
213 *                             The DAL context earlier was given to the
214 *                             upper layer through the \ref
215 *                             \e phDal4Nfc_Register() function.
216 * \param[in]  pHwRef		   for future use .Currently this parameter is not used.
217 *                             This needs to be other than NULL.
218 *
219 * \retval NFCSTATUS_SUCCESS             Unregistration successful.
220 * \retval NFCSTATUS_INVALID_PARAMETER   At least one parameter of the function is invalid.
221 *
222 *\msc
223 *ClientApp,UpperLayer,phDal4Nfc;
224 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
225 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
226 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
227 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
228 *--- [label="Upper layer can issue Unregistration later"];
229 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Unregister()",URL="\ref phDal4Nfc_Unregister"];
230 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
231 *\endmsc
232 */
233
234
235 extern
236 NFCSTATUS
237 phDal4Nfc_Unregister(
238                   void   *pContext,
239                   void   *pHwRef
240                   );
241
242
243/**
244
245 * \ingroup grp_nfc_dal
246 *
247 *\brief This interface allows to initialize DAL layer.
248 * This API implements initialization of DAL layer. This includes :
249 *
250 * <br><br>. Initialize parameters for HW Interface.
251 *<br><br>. Initializing read and writer threads.
252 *<br><br>. Initializing read and write task specific events and event specific configurations.
253 *<br><br>. Initializing DAL layer specific details.
254 *
255 * \param[in]  pContext        DAL context provided by the upper layer.
256 *                             The DAL context will be exported to the
257 *							   upper layer via upper layer registration interface.
258 * \param[in]  pHwRef          information of the hardware
259 *
260 * \retval NFCSTATUS_SUCCESS            DAL initialization successful.
261 * \retval NFCSTATUS_INVALID_DEVICE     The device is not enumerated or the
262 *                                      Hardware Reference points to a device
263 *										which does not exist. Alternatively,
264 *                                      also already open devices produce this
265 *                                      error.
266 * \retval NFCSTATUS_INVALID_PARAMETER  At least one parameter of the function
267 *                                      is invalid.
268 *
269 *\msc
270 *ClientApp,UpperLayer,phDal4Nfc;
271 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
272 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
273 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
274 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
275 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Init()",URL="\ref	phDal4Nfc_Init"];
276 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
277 *--- [label="DAL intialised ,read for read /write operations"];
278 *\endmsc
279 */
280
281 extern
282 NFCSTATUS
283 phDal4Nfc_Init(
284             void  *pContext,
285             void  *pHwRef
286             );
287
288
289/**
290 * \ingroup grp_nfc_dal
291 *
292 * \brief This API implements Deintialisation of DAL layer.
293 *
294 *This API implements Deintialisation of DAL layer. It includes :
295 *<br><br>.Releases all the resources.( context,memory resources,read/write buffers).
296 *<br><br>.closes COMxx port which is used during DAL session.
297 *<br><br>.Terminates Reader and writer tasks.
298 *
299 * \param[in]  pContext        DAL context is provided by the upper layer.
300 *                             The DAL context earlier was given to the
301 *                             upper layer through the
302 *                             \ref \e phDal4Nfc_Register() function
303 * \param[in]  pHwRef           hardware reference context.
304 *
305 * \retval NFCSTATUS_SUCCESS            DAL shutdown successful
306 * \retval NFCSTATUS_FAILED             DAL shutdown failed(example.unable to
307 *                                      suspend thread, close HW Interface etc.)
308 * \retval NFCSTATUS_INVALID_PARAMETER  At least one parameter of the function
309 *                                      is invalid.
310 *
311 *\msc
312 *ClientApp,UpperLayer,phDal4Nfc;
313 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
314 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
315 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
316 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
317 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Init()",URL="\ref	phDal4Nfc_Init"];
318 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
319 *--- [label="Perform read write operation"];
320 *--- [label="DAL can be shutdown during upper layer deinit sequence"];
321 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Shutdown()",URL="\ref phDal4Nfc_Shutdown"];
322 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
323 *\endmsc
324 */
325
326 extern
327 NFCSTATUS
328 phDal4Nfc_Shutdown(
329                 void *pContext,
330                 void *pHwRef
331                 );
332
333/**
334 * \ingroup grp_nfc_dal
335 *
336 * \brief Allows to write data block to HW Interface.
337 *
338 * This asynchronous function writes the given block of data to the driver.
339 * This interface enables writer thread in case their is no write requests pending and returns
340 * sucessfully.Once writer thread completes write operation, it notifies upper layer using callback
341 * mechanism .
342 * \note writer thread notifies upper layer callback notified using  windows messaging  mechanism
343 * under deferred call context.
344 *
345 *
346 * \param[in]  pContext        DAL context is provided by the upper layer.
347 *                             The DAL
348 *                             context earlier was given to the upper layer
349 *                             through the \ref \e phDal4Nfc_Register() function
350 * \param[in]  pHwRef          information of the hardware.
351 * \param[in]  pBuffer         The information given by the upper layer to
352 *                             send it to the lower layer
353 * \param[in]  length          The length of pLlc_Buf, that needs to be sent
354 *                             to the lower layer is given by the upper layer
355 *
356 * \retval NFCSTATUS_PENDING                If the command is yet to be process.
357 * \retval NFCSTATUS_BUSY                   BUSY with previous write operation
358 * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has
359 *                                          been disconnected meanwhile
360 * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the function
361 *                                          is invalid.
362 *
363 *\msc
364 *ClientApp,UpperLayer,phDal4Nfc;
365*--- [label="Configure,intialise DAL layer and Register with DAL "];
366 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Write()",URL="\ref  phDal4Nfc_Write()"];
367 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
368 *--- [label="DAL posts write message to main thread under deferred call context"];
369 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
370 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
371 *phDal4Nfc=>UpperLayer	[label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"];
372 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
373 *\endmsc
374 */
375 extern
376 NFCSTATUS
377 phDal4Nfc_Write(
378             void *pContext,
379             void *pHwRef,
380             uint8_t *pBuffer,
381             uint16_t length
382             );
383
384
385/**
386 * \ingroup grp_nfc_dal
387 *
388 * \brief Allows to Read data block from HW Interface.
389 *
390 * This asynchronous function reads the data from the driver in which length
391 * and the required buffer are sent by upper layer. This interface enables
392 * reader thread in case there is no read requests pending and returns sucessfully.
393 * Once read operation is complete, it notifies  to upper layer through callback
394 * registered in the \b \e phDal4Nfc_Register() function.
395 *
396 *
397 * \param[in]  pContext        DAL context is provided by the upper layer.
398 *                             The DAL context earlier was given to the
399 *                             upper layer through the
400 *                             \b \e phDal4Nfc_Register() function
401 * \param[in]  pHwRef          Information of the hardware
402 * \param[in]  pBuffer         The information given by the upper layer to
403 *                             receive data from the lower layer
404 * \param[in]  length          The length of pBuffer given by the upper layer
405 *
406 * \retval NFCSTATUS_PENDING                If the command is yet to be processed.
407 * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the function
408 *                                          is invalid.
409 * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has
410 *                                          been disconnected meanwhile
411 *
412 *\msc
413 *ClientApp,UpperLayer,phDal4Nfc;
414 *--- [label="Configure,intialise DAL layer and Register with DAL "];
415 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Write()",URL="\ref phDal4Nfc_Write()"];
416 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
417 *--- [label="DAL posts write message to main thread under deferred call context"];
418 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
419 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
420 *phDal4Nfc=>UpperLayer	[label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"];
421 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
422 *--- [label="upper layer can issue read request"];
423 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Read()",URL="\ref phDal4Nfc_Read()"];
424 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
425 *--- [label="DAL posts read message to main thread under deferred call context"];
426 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
427 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
428 *phDal4Nfc=>UpperLayer	[label="receive_complete",URL="\ref  phDal4Nfc_DeferredCb()"];
429 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
430
431 *\endmsc
432 */
433
434 extern
435 NFCSTATUS
436 phDal4Nfc_Read(
437            void *pContext,
438            void *pHwRef,
439            uint8_t *pBuffer,
440            uint16_t length
441            );
442
443/**
444 * \ingroup grp_nfc_dal
445 *
446 * \brief Allows to wait before reading data block from HW Interface.
447 *
448 * This asynchronous function waits before reading the data from the
449 * driver in which length  and the required buffer are sent by upper layer.
450 * This interface  enables reader thread  to wait for predefined time period
451 * (predefined time period is configurable by the DAL implementer) to complete
452 * read request.Once read operation is complete, it notifies to upper layer
453 * through callback registered in the \b \e phDal4Nfc_Register()
454 * function. Read request is expected to get complete within this time.
455 *
456 * \param[in]  pContext        DAL context is provided by the upper layer.
457 *                             The DAL context earlier was given to the
458 *							   upper layer through the
459 *                             \b \e phDal4Nfc_Register() function
460 * \param[in]  pHwRef          Information of the hardware
461 * \param[in]  pBuffer         The information given by the upper layer to
462 *                             receive data from the lower layer
463 * \param[in]  length          The length of pBuffer given by the upper layer
464 *
465 * \retval NFCSTATUS_SUCCESS                DAL receive successful
466 * \retval NFCSTATUS_BUSY                   BUSY with previous receive operation
467 * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the
468 *                                          function is invalid.
469 * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has
470 *                                          been disconnected meanwhile
471 *
472 *
473 *\msc
474 *ClientApp,UpperLayer,phDal4Nfc;
475 *--- [label="Configure,intialise DAL layer and Register with DAL "];
476 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Write()",URL="\ref  phDal4Nfc_Write()"];
477 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
478 *--- [label="DAL posts write message to main thread under deferred call context"];
479 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
480 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
481 *phDal4Nfc=>UpperLayer	[label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"];
482 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
483 *--- [label="upper layer can issue read wait request "];
484 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_ReadWait()",URL="\ref phDal4Nfc_ReadWait()"];
485 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
486 *--- [label="DAL posts read wait message to main thread under deferred call context"];
487 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
488 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
489 *phDal4Nfc=>UpperLayer	[label="receive_complete",URL="\ref  phDal4Nfc_DeferredCb()"];
490 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
491 *
492 *\endmsc
493 */
494
495
496 extern
497 NFCSTATUS
498 phDal4Nfc_ReadWait(
499                void *pContext,
500                void *pHwRef,
501                uint8_t *pBuffer,
502                uint16_t length
503                );
504
505
506/**
507 * \ingroup grp_nfc_dal
508 *
509 *\brief  Aborts read wait opertaion.
510 *
511 * This asynchronous function issues cancellation of the outstanding
512 * \b \e phDal4Nfc_ReadWait request.If upper layer wants to cancel the
513 * ongoing read wait operation this function is used. e.g. to abort the
514 * transactions.
515 *
516 * \param[in]  pContext        DAL context is provided by the upper layer.
517 *                             The DAL context earlier was given to the
518 *                             upper layer through the
519 *                             \b \e phDal4Nfc_Register() function
520 * \param[in]  pHwRef          Information of the hardware
521 *
522 * \retval NFCSTATUS_SUCCESS                    DAL receive successful
523 * \retval NFCSTATUS_INVALID_PARAMETER          At least one parameter of the
524 *                                              function is invalid.
525 * \retval NFCSTATUS_INVALID_DEVICE             The device has not been opened
526 *                                              or has been disconnected meanwhile
527 * \retval NFCSTATUS_BOARD_COMMUNICATION_ERROR  A board communication error occurred
528                                                (e.g. configuration went wrong).
529 *
530 *
531 *\msc
532 *ClientApp,UpperLayer,phDal4Nfc;
533 *--- [label="Configure,intialise DAL layer and Register with DAL "];
534 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Write()",URL="\ref  phDal4Nfc_Write()"];
535 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
536 *--- [label="DAL posts write message to main thread under deferred call context"];
537 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
538 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref Call phDal4Nfc_DeferredCb()"];
539 *phDal4Nfc=>UpperLayer	[label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"];
540 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
541 *--- [label="upper layer can issue read wait request "];
542 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_ReadWait()",URL="\ref phDal4Nfc_ReadWait()"];
543 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
544 *--- [label="Issue Read wait cancel request here"];
545 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_ReadWaitCancel()",URL="\ref phDal4Nfc_ReadWaitCancel()"];
546 **UpperLayer<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
547 *\endmsc
548 */
549 extern
550 NFCSTATUS
551 phDal4Nfc_ReadWaitCancel(
552                        void *pContext,
553                        void *pHwRef
554                        );
555
556/**
557 * \ingroup grp_nfc_dal
558 *
559 * \brief DAL config function
560 * This synchronous function configures the given HW Interface and
561 * sends the HANDLE to the caller.
562 *
563 * \param[in]       config     DAL configuration details as provided
564 *                             by the upper layer.
565 * \param[in,out]   phwref     pointer to which valid Handle to DAL
566 *                             interface is assigned.
567 *
568 * \retval NFCSTATUS_SUCCESS                    Configuration happened successfully.
569 * \retval NFCSTATUS_INVALID_PARAMETER          At least one parameter of the function
570 *                                              is invalid.
571 * \retval NFCSTATUS_FAILED                     Configuration failed(example.unable to
572 *                                              open HW Interface).
573 * \retval NFCSTATUS_INVALID_DEVICE             The device has not been opened or
574 *                                              has been disconnected meanwhile
575 * \retval NFCSTATUS_BOARD_COMMUNICATION_ERROR  A board communication error occurred
576                                                (e.g. configuration went wrong).
577 *\msc
578 *ClientApp,UpperLayer,phDal4Nfc;
579 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
580 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
581 *\endmsc
582 */
583 extern
584 NFCSTATUS
585 phDal4Nfc_Config (
586                pphDal4Nfc_sConfig_t config,
587                void **phwref
588                );
589
590 /**
591 * \ingroup grp_nfc_dal
592 *
593 * \brief Release configuration for the given HW Interface.
594 *
595 * \copydoc page_reg Release all the variables of the DAL component, that has been
596 *      initialised in \b phDal4Nfc_Config function (Synchronous function).
597 *
598 * \param[in] pHwRef            Link information of the hardware
599 *
600 * \retval NFCSTATUS_SUCCESS            DAL Configuration Released successfully.
601 * \retval NFCSTATUS_FAILED             Configuration release failed(example: Unable to close Com port).
602 *
603 *\msc
604 *ClientApp,UpperLayer,phDal4Nfc;
605 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
606 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
607 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
608 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
609 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Init()",URL="\ref	phDal4Nfc_Init"];
610 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
611 *--- [label="Perform read write operation"];
612 *--- [label="DAL resources can be released during upper layer deinit sequence"];
613 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Shutdown()",URL="\ref	phDal4Nfc_Shutdown"];
614 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
615 *ClientApp=>phDal4Nfc [label="phDal4Nfc_ConfigRelease()",URL="\ref phDal4Nfc_ConfigRelease"];
616 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
617 *\endmsc
618 */
619extern
620NFCSTATUS
621phDal4Nfc_ConfigRelease(
622    void        *pHwRef);
623
624extern
625NFCSTATUS
626phDal4Nfc_Reset(long level);
627
628extern
629NFCSTATUS
630phDal4Nfc_Download();
631
632/******************** Function declarations *************************/
633
634#endif /* PHDALNFC_H */
635
636/****************************************** END OF FILE ***************************************************/
637
638