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*                                                                             *
21* \file  phHciNfc_CE_A.h                                             *
22* \brief HCI card emulation management routines.                              *
23*                                                                             *
24*                                                                             *
25* Project: NFC-FRI-1.1                                                        *
26*                                                                             *
27* $Date: Fri Aug 14 17:01:27 2009 $                                           *
28* $Author: ing04880 $                                                         *
29* $Revision: 1.5 $                                                            *
30* $Aliases: 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 $                                                                *
31*                                                                             *
32* =========================================================================== *
33*/
34
35
36#ifndef PHHCINFC_CE_A_H
37#define PHHCINFC_CE_A_H
38
39/*@}*/
40
41
42/**
43*  \name HCI
44*
45* File: \ref phHciNfc_CE_A.h
46*
47*/
48/*@{*/
49#define PHHCINFC_CE_A_FILEREVISION "$Revision: 1.5 $" /**< \ingroup grp_file_attributes */
50#define PHHCINFC_CE_A_FILEALIASES  "$Aliases: 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 */
51/*@}*/
52
53/*
54***************************** Header File Inclusion ****************************
55*/
56
57#include <phHciNfc_Generic.h>
58
59/*
60****************************** Macro Definitions *******************************
61*/
62
63#define HOST_CE_A_MODE_INDEX                (0x01U)
64#define HOST_CE_A_UID_REG_INDEX             (0x02U)
65#define HOST_CE_A_SAK_INDEX                 (0x03U)
66#define HOST_CE_A_ATQA_INDEX                (0x04U)
67#define HOST_CE_A_APP_DATA_INDEX            (0x05U)
68#define HOST_CE_A_FWI_SFGT_INDEX            (0x06U)
69#define HOST_CE_A_CID_INDEX                 (0x07U)
70#define HOST_CE_A_CLT_INDEX                 (0x08U)
71#define HOST_CE_A_DATA_RATE_INDEX           (0x09U)
72
73
74/*
75******************** Enumeration and Structure Definition **********************
76*/
77
78/* Sequence list */
79typedef enum phHciNfc_CE_A_Seq{
80    HOST_CE_A_INVALID_SEQ,
81    HOST_CE_A_PIPE_OPEN,
82    HOST_CE_A_SAK_SEQ,
83    HOST_CE_A_ATQA_SEQ,
84    HOST_CE_A_ENABLE_SEQ,
85    HOST_CE_A_DISABLE_SEQ,
86    HOST_CE_A_PIPE_CLOSE,
87    HOST_CE_A_PIPE_DELETE
88}phHciNfc_CE_A_Seq_t;
89
90/* Information structure for the card emulation A Gate */
91typedef struct phHciNfc_CE_A_Info{
92
93    phHciNfc_CE_A_Seq_t         current_seq;
94    phHciNfc_CE_A_Seq_t         next_seq;
95    /* Pointer to the card emulation A pipe information */
96    phHciNfc_Pipe_Info_t        *p_pipe_info;
97    uint8_t                     pipe_id;
98
99} phHciNfc_CE_A_Info_t;
100
101/*
102*********************** Function Prototype Declaration *************************
103*/
104
105/*!
106 * \brief Allocates the resources of card emulation A management gate.
107 *
108 * This function Allocates the resources of the card emulation A management
109 * gate Information Structure.
110 *
111 */
112extern
113NFCSTATUS
114phHciNfc_CE_A_Init_Resources(
115                                phHciNfc_sContext_t     *psHciContext
116                         );
117
118/**
119* \ingroup grp_hci_nfc
120*
121*   The phHciNfc_CE_A_Get_PipeID function gives the pipe id of the card
122*   emulation A gate
123*
124*   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
125*                                       context Structure.
126*   \param[in]  pHwRef                  pHwRef is the Information of
127*                                       the Device Interface Link
128*
129*   \retval NFCSTATUS_SUCCESS           Function execution is successful.
130*   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
131*                                       could not be interpreted properly.
132*
133*/
134extern
135NFCSTATUS
136phHciNfc_CE_A_Get_PipeID(
137                            phHciNfc_sContext_t     *psHciContext,
138                            uint8_t                 *ppipe_id
139                            );
140
141/**
142* \ingroup grp_hci_nfc
143*
144*  The phHciNfc_CE_A_Update_PipeInfo function updates the pipe_id of the card
145*  emulation A gate management Structure.
146*
147*  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
148*                                      context Structure.
149*  \param[in]  pipeID                  pipeID of the card emulation A gate
150*  \param[in]  pPipeInfo               Update the pipe Information of the reader
151*                                      A gate
152*
153*  \retval NFCSTATUS_SUCCESS           Function execution is successful.
154*  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
155*                                      could not be interpreted properly.
156*
157*/
158
159extern
160NFCSTATUS
161phHciNfc_CE_A_Update_PipeInfo(
162                                  phHciNfc_sContext_t     *psHciContext,
163                                  uint8_t                 pipeID,
164                                  phHciNfc_Pipe_Info_t    *pPipeInfo
165                                  );
166
167/**
168* \ingroup grp_hci_nfc
169*
170*  The phHciNfc_CE_A_SendData_Event function sends data to the lo
171*
172*  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
173*                                      context Structure.
174*  \param[in]  pHwRef                  pHwRef is the Information of
175*                                      the Device Interface Link
176*  \param[in]  pipeID                  pipeID of the card emulation A gate
177*  \param[in]  pPipeInfo               Update the pipe Information of the reader
178*                                      A gate
179*
180*  \retval NFCSTATUS_SUCCESS           Function execution is successful.
181*  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
182*                                      could not be interpreted properly.
183*
184*/
185#ifdef CE_A_SEND_EVENT
186extern
187NFCSTATUS
188phHciNfc_CE_A_SendData_Event(
189                             void               *psContext,
190                             void               *pHwRef,
191                             uint8_t            *pEvent,
192                             uint8_t            length
193                       );
194#endif /* #ifdef CE_A_SEND_EVENT */
195
196/**
197* \ingroup grp_hci_nfc
198*
199*  The phHciNfc_CE_A_Mode function sends data to the set the card emulation mode
200*
201*  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
202*                                      context Structure.
203*  \param[in]  pHwRef                  pHwRef is the Information of
204*                                      the Device Interface Link
205*  \param[in]  enable_type             type to enable
206*
207*  \retval NFCSTATUS_SUCCESS           Function execution is successful.
208*  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
209*                                      could not be interpreted properly.
210*
211*/
212extern
213NFCSTATUS
214phHciNfc_CE_A_Mode(
215                            void        *psHciHandle,
216                            void        *pHwRef,
217                            uint8_t     enable_type
218                  );
219
220/**
221* \ingroup grp_hci_nfc
222*
223*  The phHciNfc_CE_A_Initialise function opens the CE A and set all the
224*   required parameters for CE A
225*
226*  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
227*                                      context Structure.
228*  \param[in]  pHwRef                  pHwRef is the Information of
229*                                      the Device Interface Link
230*
231*  \retval NFCSTATUS_SUCCESS           Function execution is successful.
232*  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
233*                                      could not be interpreted properly.
234*
235*/
236extern
237NFCSTATUS
238phHciNfc_CE_A_Initialise(
239                        phHciNfc_sContext_t     *psHciContext,
240                        void                    *pHwRef
241                        );
242
243/**
244* \ingroup grp_hci_nfc
245*
246*  The phHciNfc_CE_A_Initialise function close the CE A and reset all the
247*   required parameters to default value of CE A
248*
249*  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
250*                                      context Structure.
251*  \param[in]  pHwRef                  pHwRef is the Information of
252*                                      the Device Interface Link
253*
254*  \retval NFCSTATUS_SUCCESS           Function execution is successful.
255*  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
256*                                      could not be interpreted properly.
257*
258*/
259extern
260NFCSTATUS
261phHciNfc_CE_A_Release(
262                        phHciNfc_sContext_t     *psHciContext,
263                        void                    *pHwRef
264                        );
265
266
267/**
268* \ingroup grp_hci_nfc
269*
270*  The phHciNfc_CE_A_Update_Seq function to update CE A sequence depending on the
271*  specified \ref seq_type
272*
273*  \param[in]  psHciContext             psHciContext is the pointer to HCI Layer
274*                                       context Structure.
275*  \param[in]  seq_type                 sequence type specified in
276*                                       \ref phHciNfc_eSeqType_t
277*
278*  \retval NFCSTATUS_SUCCESS           Function execution is successful.
279*  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
280*                                      could not be interpreted properly.
281*
282*/
283extern
284NFCSTATUS
285phHciNfc_CE_A_Update_Seq(
286                        phHciNfc_sContext_t     *psHciContext,
287                        phHciNfc_eSeqType_t     seq_type
288                    );
289#endif /* PHHCINFC_CE_A_H */
290
291
292