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_Pipe.h                                                      *
22 * \brief HCI Header for the Pipe Management.                                  *
23 *                                                                             *
24 *                                                                             *
25 * Project: NFC-FRI-1.1                                                        *
26 *                                                                             *
27 * $Date: Fri Aug 14 17:01:27 2009 $                                           *
28 * $Author: ing04880 $                                                         *
29 * $Revision: 1.17 $                                                            *
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 
37 #ifndef PHHCINFC_PIPE_H
38 #define PHHCINFC_PIPE_H
39 
40 /*@}*/
41 
42 
43 /**
44  *  \name HCI
45  *
46  * File: \ref phHciNfc_Pipe.h
47  *
48  */
49 /*@{*/
50 #define PHHCINFC_PIPE_FILEREVISION "$Revision: 1.17 $" /**< \ingroup grp_file_attributes */
51 #define PHHCINFC_PIPE_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 */
52 /*@}*/
53 
54 /*
55 ***************************** Header File Inclusion ****************************
56 */
57 
58 #include <phHciNfc.h>
59 #include <phHciNfc_Generic.h>
60 
61 /*
62 ****************************** Macro Definitions *******************************
63 */
64 
65 #define PIPEINFO_SIZE               0x04U
66 #define PIPEID_LEN                  0x01U
67 
68 #define RESPONSE_GATEID_OFFSET      0x03U
69 #define RESPONSE_PIPEID_OFFSET      0x04U
70 
71 
72 #define PIPETYPE_STATIC_LINK        0x00U
73 #define PIPETYPE_STATIC_ADMIN       0x01U
74 #define PIPETYPE_DYNAMIC            0x02U
75 
76 /*
77 ******************** Enumeration and Structure Definition **********************
78 */
79 
80 typedef enum phHciNfc_PipeMgmt_Seq{
81     /* Pipe for Identitiy Management   */
82     PIPE_IDMGMT_CREATE      = 0x00U,
83     /* Pipe for Configuring PN544 Nfc Device  */
84     PIPE_PN544MGMT_CREATE,
85     /* Pipe for Configuring Polling Wheel  */
86     PIPE_POLLINGLOOP_CREATE,
87     /* Pipes for Configuring the RF Readers  */
88     PIPE_READER_A_CREATE,
89     PIPE_READER_B_CREATE,
90     PIPE_READER_F_CREATE,
91     PIPE_READER_JWL_CREATE,
92     PIPE_READER_ISO15693_CREATE,
93     /* Pipes for configuring the Card Emulation  */
94     PIPE_CARD_A_CREATE,
95     PIPE_CARD_A_DELETE,
96     PIPE_CARD_B_CREATE,
97     PIPE_CARD_B_DELETE,
98     PIPE_CARD_F_CREATE,
99     PIPE_CARD_F_DELETE,
100     /* Pipes for Peer to Peer Communication  */
101     PIPE_NFC_INITIATOR_CREATE,
102     PIPE_NFC_TARGET_CREATE,
103     /* Secure Element Commands */
104     PIPE_WI_CREATE,
105     PIPE_SWP_CREATE,
106     /* Connectiviy Gate Pipe */
107     PIPE_CONNECTIVITY,
108 
109     /* Clearing all the created Pipes  */
110     PIPE_DELETE_ALL,
111     PIPE_MGMT_END
112 } phHciNfc_PipeMgmt_Seq_t;
113 
114 /** \defgroup grp_hci_nfc HCI Component
115  *
116  *
117  */
118 
119 /*
120 *********************** Function Prototype Declaration *************************
121 */
122 
123 /*!
124  * \brief Creates the Pipes of all the Supported Gates .
125  *
126  * This function Creates the pipes for all the supported gates
127  */
128 
129 extern
130 NFCSTATUS
131 phHciNfc_Create_All_Pipes(
132                                 phHciNfc_sContext_t          *psHciContext,
133                                 void                         *pHwRef,
134                                 phHciNfc_PipeMgmt_Seq_t      *p_pipe_seq
135                           );
136 
137 /*!
138  * \brief Deletes the Pipes of all the Supported Gates .
139  *
140  * This function Deletes the pipes for all the supported gates
141  */
142 extern
143 NFCSTATUS
144 phHciNfc_Delete_All_Pipes(
145                                 phHciNfc_sContext_t             *psHciContext,
146                                 void                            *pHwRef,
147                                 phHciNfc_PipeMgmt_Seq_t         pipeSeq
148                           );
149 
150 /*!
151  * \brief Updates the Information of Pipes of all the Supported Gates .
152  *
153  * This function Updates the pipe information for all the supported gates
154  */
155 
156 extern
157 NFCSTATUS
158 phHciNfc_Update_PipeInfo(
159                                 phHciNfc_sContext_t             *psHciContext,
160                                 phHciNfc_PipeMgmt_Seq_t         *pPipeSeq,
161                                 uint8_t                         pipe_id,
162                                 phHciNfc_Pipe_Info_t            *pPipeInfo
163                       );
164 
165 /**
166  * \ingroup grp_hci_nfc
167  *
168  *  The phHciNfc_Open_Pipe function opens
169  *  .
170  *
171  *  \param[in]  psContext               psContext is pointer to the context
172  *                                      Structure of the HCI Layer.
173  *  \param[in]  pHwRef                  pHwRef is the Information of
174  *                                      the Device Interface Link .
175  *  \param[in]  pPipeHandle             pPipeHandle is the handle used to open
176  *                                      the Static or Dynamically Created Pipe.
177  *
178  *  \retval NFCSTATUS_PENDING           Pipe Open is pending.
179  *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
180  *                                      could not be interpreted properly.
181  *  \retval Other errors                Errors related to the lower layers
182  *
183  */
184 
185  extern
186  NFCSTATUS
187  phHciNfc_Open_Pipe (
188                         phHciNfc_sContext_t     *psContext,
189                         void                    *pHwRef,
190                         phHciNfc_Pipe_Info_t    *pPipeHandle
191                         );
192 
193 /**
194  * \ingroup grp_hci_nfc
195  *
196  *  The phHciNfc_Close_Pipe function closes
197  *  .
198  *
199  *  \param[in]  psContext               psContext is pointer to the context
200  *                                      Structure of the HCI Layer.
201  *  \param[in]  pHwRef                  pHwRef is the Information of
202  *                                      the Device Interface Link .
203  *  \param[in]  pPipeHandle             pPipeHandle is the handle used to closes
204  *                                      the Static or Dynamically Created Pipe.
205  *
206  *  \retval NFCSTATUS_PENDING           Pipe close is pending.
207  *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
208  *                                      could not be interpreted properly.
209  *  \retval Other errors                Errors related to the lower layers
210  *
211  */
212 
213  extern
214  NFCSTATUS
215  phHciNfc_Close_Pipe (
216                         phHciNfc_sContext_t     *psContext,
217                         void                    *pHwRef,
218                         phHciNfc_Pipe_Info_t    *pPipeHandle
219                         );
220 
221 /**
222  * \ingroup grp_hci_nfc
223  *
224  *  The phHciNfc_Delete_Pipe function deletes the dynamically created pipe
225  *  using the supplied pipe handle.
226  *
227  *  \param[in]  psContext               psContext is pointer to the context
228  *                                      Structure of the HCI Layer.
229  *  \param[in]  pHwRef                  pHwRef is the Information of
230  *                                      the Device Interface Link .
231  *  \param[in]  pPipeHandle             pPipeHandle is the handle used to delete
232  *                                      the Dynamically Created Pipe.
233  *
234  *  \retval NFCSTATUS_PENDING           Pipe Deletion is pending.
235  *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
236  *                                      could not be interpreted properly.
237  *
238  */
239 
240 extern
241 NFCSTATUS
242 phHciNfc_Delete_Pipe(
243                         phHciNfc_sContext_t     *psHciContext,
244                         void                    *pHwRef,
245                         phHciNfc_Pipe_Info_t    *pPipeHandle
246                     );
247 
248 /*!
249  * \brief Creates and Update the Pipes during the Session
250  *
251  * This function Creates and Update the Pipes of all the Supported Gates
252  * for the already initialised session.
253  */
254 
255 extern
256 NFCSTATUS
257 phHciNfc_Update_Pipe(
258                         phHciNfc_sContext_t     *psHciContext,
259                         void                    *pHwRef,
260                         phHciNfc_PipeMgmt_Seq_t *p_pipe_seq
261                     );
262 
263 
264 extern
265 NFCSTATUS
266 phHciNfc_CE_Pipes_OP(
267                             phHciNfc_sContext_t             *psHciContext,
268                             void                            *pHwRef,
269                             phHciNfc_PipeMgmt_Seq_t         *p_pipe_seq
270                      );
271 
272 #endif
273 
274