summaryrefslogtreecommitdiffstats
path: root/src/phDal4Nfc.h
blob: 3cbb58541a8e9953ae425bc7b49374747a9f48ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
/*
 * Copyright (C) 2010 NXP Semiconductors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


/*!

* \file  phDal4Nfc.h
* \brief Common DAL for the upper layer.
*
* Project: NFC-FRI-1.1
*
* $Date: Tue Nov 10 13:56:45 2009 $
* $Author: ing07299 $
* $Revision: 1.38 $
* $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 $
*
*/

#ifndef PHDAL4NFC_H
#define PHDAL4NFC_H

/**
*  \name DAl4 NFC
*
* File: \ref phDal4Nfc.h
*
*/
/*@{*/
#define PH_DAL4NFC_FILEREVISION "$Revision: 1.38 $" /**< \ingroup grp_file_attributes */
#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 $"
 /**< \ingroup grp_file_attributes */
/*@}*/
/*************************** Includes *******************************/
/** \defgroup grp_nfc_dal DAL Component
 *
 *
 *
 */
#include <hardware/nfc.h>
/**< Basic type definitions */
#include <phNfcTypes.h>
/**< Generic Interface Layer Function Definitions */
#include <phNfcInterface.h>
/*********************** End of includes ****************************/

/***************************** Macros *******************************/
 /**< Used for messaging by DAL as well as Upper Layers */
#define PH_DAL4NFC_MESSAGE_BASE  PH_LIBNFC_DEFERREDCALL_MSG

/************************ End of macros *****************************/


/********************* Structures and enums *************************/

/**
 * \ingroup grp_nfc_dal
 *
 * DAL context : This contains the information of the upper layer callback
 * and hardware reference.
 */
typedef struct phDal4Nfc_SContext
{
	phNfcIF_sCallBack_t		cb_if;		/**<Callback info registered by upper layer*/
	volatile uint8_t		hw_valid;	/**<Flag - shows Hardware present or not */
	void					*pHwRef;	/**<Hardware Reference*/
	nfc_pn544_device_t		*pDev;		/**<Android HAL reference*/
}phDal4Nfc_SContext_t,*pphDal4Nfc_SContext_t;

/**
 * \ingroup grp_nfc_dal
 *
 * DAL enum for Messages : This contains the enums used for
 * posting messages to the application.
 */
typedef enum phDal4Nfc_Messages_en
{
    /**<Read message type used to post Read DAL Message to dispatch routine.Dispatch routine
	calls read callback registered by upper layer */
    PHDAL4NFC_READ_MESSAGE = 0,
    /**<Readwait message type used to post Read wait DAL Message to dispatch routine.Dispatch routine
	calls read wait callback registered by upper layer */
	PHDAL4NFC_READWAIT_MESSAGE,
	/**<Write message type used to post write DAL Message to dispatch routine.Dispatch routine
	calls write wait callback registered by upper layer */
    PHDAL4NFC_WRITE_MESSAGE,
	/**<Notify message type used to post Notify DAL Message to dispatch routine.Dispatch routine
	calls notify callback registered by upper layer */
    PHDAL4NFC_NOTIFY_MESSAGE
}phDal4Nfc_Messages_en_t;

/**
 * \ingroup grp_nfc_dal
 *
 * \brief DAL Message structure definition.This structure contains
 *
 * This structure contains details like  message type,read ,read wait and write callbacks
 * reference details as registered by upper layer.
 */
typedef struct phDal4Nfc_Message
{
    /**<Refenrece to context.Context can be DAL context  */
	void                                *pContext;
    /**<Reference to hardware reference strucutre */
	void                                *pHwRef;
	/**<DAL message of type \ref phDal4Nfc_Messages_en_t*/
    phDal4Nfc_Messages_en_t             eMsgType;
	/**<Transaction specific information of type \ref phNfc_sTransactionInfo_t*/
    phNfc_sTransactionInfo_t            transactInfo;
	/**<Reference to read callback,registered by upper layer.This is of type \ref pphNfcIF_Transact_Completion_CB_t*/
    pphNfcIF_Transact_Completion_CB_t   readCbPtr;
	/**<Reference to write callback ,registered by upper layer.This is of type \ref pphNfcIF_Transact_Completion_CB_t*/
    pphNfcIF_Transact_Completion_CB_t   writeCbPtr;
} phDal4Nfc_Message_t,*pphDal4Nfc_Message_t;

typedef phLibNfc_sConfig_t phDal4Nfc_sConfig_t;
typedef phLibNfc_sConfig_t *pphDal4Nfc_sConfig_t;

/****************** End of structures and enums *********************/

/******************** Function declarations *************************/

/**
 * \ingroup grp_nfc_dal
 *
 *\brief Allows to register upper layer with DAL layer.
 * This API allows upper layer to register with DAL layer.As part of registration
 *<br>1.Exports DAL interfaces and DAL layer context to upper layer.
 *Exported DAL interfaces are :
 *<br><br>.phDal4Nfc_Shutdown
 *<br><br>.phDal4Nfc_Write
 *<br><br>.phDal4Nfc_Read
 *<br><br>.phDal4Nfc_ReadWait
 *<br><br>.phDal4Nfc_ReadWaitCancel
 *<br><br>phDal4Nfc_Unregister
 *<br><br>.Registeres upper layer callbacks and upper layer context with DAL layer.
 *For details refer to \ref phNfcIF_sReference_t.
 *Registration details are valid unless upper layer calls \ref phDal4Nfc_Unregister()
 or \ref phDal4Nfc_Shutdown called.

 * \param[in,out] psRefer   holds  DAL exported interface references once registration
 *							sucessful.This also contains transmit and receive buffer
 *							references.
 *
 * \param[in]     if_cb		Contains upper layer callback reference details, which are used
 *							by DAL layer during callback notification.
 *							These callbacks gets registered with DAL layer.
 *

 * \param[out]	 psIFConf  Currently this parameter not used.This  parameter to be other than NULL.
 *
 *
 * \retval NFCSTATUS_SUCCESS             Operation is successful.
 * \retval NFCSTATUS_INVALID_PARAMETER   At least one parameter of the function is invalid.
 *
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *\endmsc
 */

 extern
 NFCSTATUS
 phDal4Nfc_Register(
                 phNfcIF_sReference_t   *psRefer,
                 phNfcIF_sCallBack_t    if_cb,
                 void *psIFConf
                 );


/**
 * \ingroup grp_nfc_dal
 *
 * \brief  Allows upper layer to unregister with DAL layer.
 * This interface allows to unregister upper layer callback interfaces with DAL layer.
 * \note: Once this this API is called DAL layer stops notifying upper layer callbacks in case
 * any events reported within DAL.
 *
 * \param[in]  pContext        DAL context is provided by the upper layer.
 *                             The DAL context earlier was given to the
 *                             upper layer through the \ref
 *                             \e phDal4Nfc_Register() function.
 * \param[in]  pHwRef		   for future use .Currently this parameter is not used.
 *                             This needs to be other than NULL.
 *
 * \retval NFCSTATUS_SUCCESS             Unregistration successful.
 * \retval NFCSTATUS_INVALID_PARAMETER   At least one parameter of the function is invalid.
 *
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *--- [label="Upper layer can issue Unregistration later"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Unregister()",URL="\ref phDal4Nfc_Unregister"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *\endmsc
 */


 extern
 NFCSTATUS
 phDal4Nfc_Unregister(
                   void   *pContext,
                   void   *pHwRef
                   );


/**

 * \ingroup grp_nfc_dal
 *
 *\brief This interface allows to initialize DAL layer.
 * This API implements initialization of DAL layer. This includes :
 *
 * <br><br>. Initialize parameters for HW Interface.
 *<br><br>. Initializing read and writer threads.
 *<br><br>. Initializing read and write task specific events and event specific configurations.
 *<br><br>. Initializing DAL layer specific details.
 *
 * \param[in]  pContext        DAL context provided by the upper layer.
 *                             The DAL context will be exported to the
 *							   upper layer via upper layer registration interface.
 * \param[in]  pHwRef          information of the hardware
 *
 * \retval NFCSTATUS_SUCCESS            DAL initialization successful.
 * \retval NFCSTATUS_INVALID_DEVICE     The device is not enumerated or the
 *                                      Hardware Reference points to a device
 *										which does not exist. Alternatively,
 *                                      also already open devices produce this
 *                                      error.
 * \retval NFCSTATUS_INVALID_PARAMETER  At least one parameter of the function
 *                                      is invalid.
 *
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Init()",URL="\ref	phDal4Nfc_Init"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *--- [label="DAL intialised ,read for read /write operations"];
 *\endmsc
 */

 extern
 NFCSTATUS
 phDal4Nfc_Init(
             void  *pContext,
             void  *pHwRef
             );


/**
 * \ingroup grp_nfc_dal
 *
 * \brief This API implements Deintialisation of DAL layer.
 *
 *This API implements Deintialisation of DAL layer. It includes :
 *<br><br>.Releases all the resources.( context,memory resources,read/write buffers).
 *<br><br>.closes COMxx port which is used during DAL session.
 *<br><br>.Terminates Reader and writer tasks.
 *
 * \param[in]  pContext        DAL context is provided by the upper layer.
 *                             The DAL context earlier was given to the
 *                             upper layer through the
 *                             \ref \e phDal4Nfc_Register() function
 * \param[in]  pHwRef           hardware reference context.
 *
 * \retval NFCSTATUS_SUCCESS            DAL shutdown successful
 * \retval NFCSTATUS_FAILED             DAL shutdown failed(example.unable to
 *                                      suspend thread, close HW Interface etc.)
 * \retval NFCSTATUS_INVALID_PARAMETER  At least one parameter of the function
 *                                      is invalid.
 *
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Init()",URL="\ref	phDal4Nfc_Init"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *--- [label="Perform read write operation"];
 *--- [label="DAL can be shutdown during upper layer deinit sequence"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Shutdown()",URL="\ref phDal4Nfc_Shutdown"];
 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *\endmsc
 */

 extern
 NFCSTATUS
 phDal4Nfc_Shutdown(
                 void *pContext,
                 void *pHwRef
                 );

/**
 * \ingroup grp_nfc_dal
 *
 * \brief Allows to write data block to HW Interface.
 *
 * This asynchronous function writes the given block of data to the driver.
 * This interface enables writer thread in case their is no write requests pending and returns
 * sucessfully.Once writer thread completes write operation, it notifies upper layer using callback
 * mechanism .
 * \note writer thread notifies upper layer callback notified using  windows messaging  mechanism
 * under deferred call context.
 *
 *
 * \param[in]  pContext        DAL context is provided by the upper layer.
 *                             The DAL
 *                             context earlier was given to the upper layer
 *                             through the \ref \e phDal4Nfc_Register() function
 * \param[in]  pHwRef          information of the hardware.
 * \param[in]  pBuffer         The information given by the upper layer to
 *                             send it to the lower layer
 * \param[in]  length          The length of pLlc_Buf, that needs to be sent
 *                             to the lower layer is given by the upper layer
 *
 * \retval NFCSTATUS_PENDING                If the command is yet to be process.
 * \retval NFCSTATUS_BUSY                   BUSY with previous write operation
 * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has
 *                                          been disconnected meanwhile
 * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the function
 *                                          is invalid.
 *
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
*--- [label="Configure,intialise DAL layer and Register with DAL "];
 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Write()",URL="\ref  phDal4Nfc_Write()"];
 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
 *--- [label="DAL posts write message to main thread under deferred call context"];
 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
 *phDal4Nfc=>UpperLayer	[label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"];
 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
 *\endmsc
 */
 extern
 NFCSTATUS
 phDal4Nfc_Write(
             void *pContext,
             void *pHwRef,
             uint8_t *pBuffer,
             uint16_t length
             );


/**
 * \ingroup grp_nfc_dal
 *
 * \brief Allows to Read data block from HW Interface.
 *
 * This asynchronous function reads the data from the driver in which length
 * and the required buffer are sent by upper layer. This interface enables
 * reader thread in case there is no read requests pending and returns sucessfully.
 * Once read operation is complete, it notifies  to upper layer through callback 
 * registered in the \b \e phDal4Nfc_Register() function.
 *
 *
 * \param[in]  pContext        DAL context is provided by the upper layer.
 *                             The DAL context earlier was given to the
 *                             upper layer through the
 *                             \b \e phDal4Nfc_Register() function
 * \param[in]  pHwRef          Information of the hardware
 * \param[in]  pBuffer         The information given by the upper layer to
 *                             receive data from the lower layer
 * \param[in]  length          The length of pBuffer given by the upper layer
 *
 * \retval NFCSTATUS_PENDING                If the command is yet to be processed.
 * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the function
 *                                          is invalid.
 * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has
 *                                          been disconnected meanwhile
 *
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
 *--- [label="Configure,intialise DAL layer and Register with DAL "];
 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Write()",URL="\ref phDal4Nfc_Write()"];
 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
 *--- [label="DAL posts write message to main thread under deferred call context"];
 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
 *phDal4Nfc=>UpperLayer	[label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"];
 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
 *--- [label="upper layer can issue read request"];
 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Read()",URL="\ref phDal4Nfc_Read()"];
 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
 *--- [label="DAL posts read message to main thread under deferred call context"];
 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
 *phDal4Nfc=>UpperLayer	[label="receive_complete",URL="\ref  phDal4Nfc_DeferredCb()"];
 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];

 *\endmsc
 */

 extern
 NFCSTATUS
 phDal4Nfc_Read(
            void *pContext,
            void *pHwRef,
            uint8_t *pBuffer,
            uint16_t length
            );

/**
 * \ingroup grp_nfc_dal
 *
 * \brief Allows to wait before reading data block from HW Interface.
 *
 * This asynchronous function waits before reading the data from the
 * driver in which length  and the required buffer are sent by upper layer.  
 * This interface  enables reader thread  to wait for predefined time period
 * (predefined time period is configurable by the DAL implementer) to complete  
 * read request.Once read operation is complete, it notifies to upper layer 
 * through callback registered in the \b \e phDal4Nfc_Register()
 * function. Read request is expected to get complete within this time.
 *
 * \param[in]  pContext        DAL context is provided by the upper layer.
 *                             The DAL context earlier was given to the
 *							   upper layer through the
 *                             \b \e phDal4Nfc_Register() function
 * \param[in]  pHwRef          Information of the hardware
 * \param[in]  pBuffer         The information given by the upper layer to
 *                             receive data from the lower layer
 * \param[in]  length          The length of pBuffer given by the upper layer
 *
 * \retval NFCSTATUS_SUCCESS                DAL receive successful
 * \retval NFCSTATUS_BUSY                   BUSY with previous receive operation
 * \retval NFCSTATUS_INVALID_PARAMETER      At least one parameter of the
 *                                          function is invalid.
 * \retval NFCSTATUS_INVALID_DEVICE         The device has not been opened or has
 *                                          been disconnected meanwhile
 *
 *
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
 *--- [label="Configure,intialise DAL layer and Register with DAL "];
 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Write()",URL="\ref  phDal4Nfc_Write()"];
 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
 *--- [label="DAL posts write message to main thread under deferred call context"];
 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
 *phDal4Nfc=>UpperLayer	[label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"];
 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
 *--- [label="upper layer can issue read wait request "];
 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_ReadWait()",URL="\ref phDal4Nfc_ReadWait()"];
 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
 *--- [label="DAL posts read wait message to main thread under deferred call context"];
 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref  phDal4Nfc_DeferredCb()"];
 *phDal4Nfc=>UpperLayer	[label="receive_complete",URL="\ref  phDal4Nfc_DeferredCb()"];
 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
 *
 *\endmsc
 */


 extern
 NFCSTATUS
 phDal4Nfc_ReadWait(
                void *pContext,
                void *pHwRef,
                uint8_t *pBuffer,
                uint16_t length
                );


/**
 * \ingroup grp_nfc_dal
 *
 *\brief  Aborts read wait opertaion.
 *
 * This asynchronous function issues cancellation of the outstanding 
 * \b \e phDal4Nfc_ReadWait request.If upper layer wants to cancel the 
 * ongoing read wait operation this function is used. e.g. to abort the
 * transactions.
 *
 * \param[in]  pContext        DAL context is provided by the upper layer.
 *                             The DAL context earlier was given to the
 *                             upper layer through the
 *                             \b \e phDal4Nfc_Register() function
 * \param[in]  pHwRef          Information of the hardware
 *
 * \retval NFCSTATUS_SUCCESS                    DAL receive successful
 * \retval NFCSTATUS_INVALID_PARAMETER          At least one parameter of the
 *                                              function is invalid.
 * \retval NFCSTATUS_INVALID_DEVICE             The device has not been opened
 *                                              or has been disconnected meanwhile
 * \retval NFCSTATUS_BOARD_COMMUNICATION_ERROR  A board communication error occurred
                                                (e.g. configuration went wrong).
 *
 *
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
 *--- [label="Configure,intialise DAL layer and Register with DAL "];
 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_Write()",URL="\ref  phDal4Nfc_Write()"];
 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
 *--- [label="DAL posts write message to main thread under deferred call context"];
 *phDal4Nfc=>phDal4Nfc [label="phDal4Nfc_DeferredCall()",URL="\ref	phDal4Nfc_DeferredCall()"];
 *ClientApp=>phDal4Nfc	[label="phDal4Nfc_DeferredCb()",URL="\ref Call phDal4Nfc_DeferredCb()"];
 *phDal4Nfc=>UpperLayer	[label="send_complete",URL="\ref phDal4Nfc_DeferredCb()"];
 *ClientApp<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
 *--- [label="upper layer can issue read wait request "];
 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_ReadWait()",URL="\ref phDal4Nfc_ReadWait()"];
 *UpperLayer<<phDal4Nfc	[label="NFCSTATUS_PENDING"];
 *--- [label="Issue Read wait cancel request here"];
 *UpperLayer=>phDal4Nfc	[label="phDal4Nfc_ReadWaitCancel()",URL="\ref phDal4Nfc_ReadWaitCancel()"];
 **UpperLayer<<phDal4Nfc	[label="NFCSTATUS_SUCCESS"];
 *\endmsc
 */
 extern
 NFCSTATUS
 phDal4Nfc_ReadWaitCancel(
                        void *pContext,
                        void *pHwRef
                        );

/**
 * \ingroup grp_nfc_dal
 *
 * \brief DAL config function
 * This synchronous function configures the given HW Interface and
 * sends the HANDLE to the caller.
 *
 * \param[in]       config     DAL configuration details as provided
 *                             by the upper layer. 
 * \param[in,out]   phwref     pointer to which valid Handle to DAL
 *                             interface is assigned.
 *
 * \retval NFCSTATUS_SUCCESS                    Configuration happened successfully.
 * \retval NFCSTATUS_INVALID_PARAMETER          At least one parameter of the function
 *                                              is invalid.
 * \retval NFCSTATUS_FAILED                     Configuration failed(example.unable to
 *                                              open HW Interface).
 * \retval NFCSTATUS_INVALID_DEVICE             The device has not been opened or
 *                                              has been disconnected meanwhile
 * \retval NFCSTATUS_BOARD_COMMUNICATION_ERROR  A board communication error occurred
                                                (e.g. configuration went wrong).
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *\endmsc
 */
 extern
 NFCSTATUS
 phDal4Nfc_Config (
                pphDal4Nfc_sConfig_t config,
                void **phwref
                );

 /**
 * \ingroup grp_nfc_dal
 *
 * \brief Release configuration for the given HW Interface.
 *
 * \copydoc page_reg Release all the variables of the DAL component, that has been 
 *      initialised in \b phDal4Nfc_Config function (Synchronous function).
 *
 * \param[in] pHwRef            Link information of the hardware
 *
 * \retval NFCSTATUS_SUCCESS            DAL Configuration Released successfully.
 * \retval NFCSTATUS_FAILED             Configuration release failed(example: Unable to close Com port).
 *
 *\msc
 *ClientApp,UpperLayer,phDal4Nfc;
 *ClientApp=>phDal4Nfc [label="phDal4Nfc_Config()",URL="\ref phDal4Nfc_Config"];
 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Register()",URL="\ref phDal4Nfc_Register"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Init()",URL="\ref	phDal4Nfc_Init"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *--- [label="Perform read write operation"];
 *--- [label="DAL resources can be released during upper layer deinit sequence"];
 *UpperLayer=>phDal4Nfc [label="phDal4Nfc_Shutdown()",URL="\ref	phDal4Nfc_Shutdown"];
 *UpperLayer<<phDal4Nfc [label="NFCSTATUS_SUCCESS"];
 *ClientApp=>phDal4Nfc [label="phDal4Nfc_ConfigRelease()",URL="\ref phDal4Nfc_ConfigRelease"];
 *ClientApp<<phDal4Nfc [label="NFCSTATUS_SUCCESS"]; 
 *\endmsc
 */
extern 
NFCSTATUS 
phDal4Nfc_ConfigRelease(
    void        *pHwRef);

extern 
NFCSTATUS 
phDal4Nfc_Reset(long level);

extern 
NFCSTATUS 
phDal4Nfc_Download();

/******************** Function declarations *************************/

#endif /* PHDALNFC_H */

/****************************************** END OF FILE ***************************************************/