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_NfcIPMgmt.h                                                 *
22 * \brief HCI NFCIP-1 Management Routines.                                    *
23 *                                                                             *
24 *                                                                             *
25 * Project: NFC-FRI-1.1                                                        *
26 *                                                                             *
27 * $Date: Tue Jun 30 17:09:29 2009 $                                           *
28 * $Author: ing04880 $                                                         *
29 * $Revision: 1.1 $                                                            *
30 * $Aliases: NFC_FRI1.1_WK926_R28_2,NFC_FRI1.1_WK926_R28_3,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,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 #ifndef PHHCINFC_ISO15693_H
36 #define PHHCINFC_ISO15693_H
37 
38 /*@}*/
39 
40 
41 /**
42 *  \name HCI
43 *
44 * File: \ref phHciNfc_ISO15693.h
45 *
46 */
47 /*@{*/
48 #define PHHCINFC_ISO15693_FILEREVISION "$Revision: 1.1 $" /**< \ingroup grp_file_attributes */
49 #define PHHCINFC_ISO15693_FILEALIASES  "$Aliases: NFC_FRI1.1_WK926_R28_2,NFC_FRI1.1_WK926_R28_3,NFC_FRI1.1_WK928_R29_1,NFC_FRI1.1_WK930_R30_1,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 */
50 /*@}*/
51 
52 /*
53 ***************************** Header File Inclusion ****************************
54 */
55 
56 #include <phHciNfc_Generic.h>
57 
58 /*
59 ****************************** Macro Definitions *******************************
60 */
61 /* Enable the ISO 15693 */
62 #define HCI_ISO_15693_ENABLE                    0x01U
63 #define HCI_ISO_15693_INFO_SEQ                  0x02U
64 
65 #define NXP_ISO15693_CMD                        0x20U
66 
67 
68 /*
69 ******************** Enumeration and Structure Definition **********************
70 */
71 
72 typedef enum phHciNfc_ISO15693_Seq{
73     ISO15693_INVENTORY,
74     ISO15693_AFI,
75     ISO15693_END_SEQUENCE,
76     ISO15693_INVALID_SEQ
77 } phHciNfc_ISO15693_Seq_t;
78 
79 typedef struct phHciNfc_ISO15693_Info{
80     phHciNfc_ISO15693_Seq_t         current_seq;
81     phHciNfc_ISO15693_Seq_t         next_seq;
82     phHciNfc_Pipe_Info_t            *ps_15693_pipe_info;
83     uint8_t                         pipe_id;
84     uint8_t                         multiple_tgts_found;
85     phHal_sRemoteDevInformation_t   iso15693_info;
86     uint8_t                         enable_iso_15693_gate;
87 }phHciNfc_ISO15693_Info_t;
88 
89 
90 /*
91 *********************** Function Prototype Declaration *************************
92 */
93 
94 /*!
95 * \brief Allocates the resources of ISO15693 management gate.
96 *
97 * This function Allocates the resources of the ISO15693 management
98 * gate Information Structure.
99 *
100 */
101 extern
102 NFCSTATUS
103 phHciNfc_ISO15693_Init_Resources(
104                                   phHciNfc_sContext_t     *psHciContext
105                                   );
106 
107 /**
108 * \ingroup grp_hci_nfc
109 *
110 *   The phHciNfc_ISO15693_Get_PipeID function gives the pipe id of the ISO15693
111 *   gate
112 *
113 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
114 *                                       context Structure.
115 *   \param[in]  pHwRef                  pHwRef is the Information of
116 *                                       the Device Interface Link
117 *
118 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
119 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
120 *                                       could not be interpreted properly.
121 *
122 */
123 extern
124 NFCSTATUS
125 phHciNfc_ISO15693_Get_PipeID(
126                               phHciNfc_sContext_t     *psHciContext,
127                               uint8_t                 *ppipe_id
128                               );
129 
130 /**
131 * \ingroup grp_hci_nfc
132 *
133 *  The phHciNfc_ISO15693_Update_PipeInfo function updates the pipe_id of the ISO15693
134 *  gate management Structure.
135 *
136 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
137 *                                      context Structure.
138 *  \param[in]  pipeID                  pipeID of the ISO15693 gate
139 *  \param[in]  pPipeInfo               Update the pipe Information of the ISO15693
140 *                                      gate
141 *
142 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.
143 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
144 *                                      could not be interpreted properly.
145 *
146 */
147 
148 extern
149 NFCSTATUS
150 phHciNfc_ISO15693_Update_PipeInfo(
151                                    phHciNfc_sContext_t     *psHciContext,
152                                    uint8_t                 pipeID,
153                                    phHciNfc_Pipe_Info_t    *pPipeInfo
154                                    );
155 
156 /**
157 * \ingroup grp_hci_nfc
158 *
159 *   The phHciNfc_ISO15693_Update_Info function stores the data sent by the
160 *   upper layer.
161 *
162 *   \param[in]  psHciContext     psHciContext is the pointer to HCI Layer
163 *                                context Structure.
164 *   \param[in]  infotype         To enable the ISO 15693 gate
165 *   \param[in]  iso_15693_info   ISO 15693 gate info
166 *
167 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
168 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
169 *                                       could not be interpreted properly.
170 *
171 */
172 extern
173 NFCSTATUS
174 phHciNfc_ISO15693_Update_Info(
175                              phHciNfc_sContext_t        *psHciContext,
176                              uint8_t                    infotype,
177                              void                       *iso_15693_info
178                              );
179 
180 /**
181 * \ingroup grp_hci_nfc
182 *
183 *   The phHciNfc_ISO15693_Sequence function executes the sequence of operations, to
184 *   get the NXP_ISO15693_INVENTORY, NXP_ISO15693_AFI.
185 *
186 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
187 *                                       context Structure.
188 *   \param[in]  pHwRef                  pHwRef is the Information of
189 *                                       the Device Interface Link
190 *
191 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
192 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
193 *                                       could not be interpreted properly.
194 *
195 */
196 extern
197 NFCSTATUS
198 phHciNfc_ISO15693_Info_Sequence (
199                        void             *psHciHandle,
200                        void             *pHwRef
201                        );
202 
203 /**
204 * \ingroup grp_hci_nfc
205 *
206 *   The phHciNfc_Send_ISO15693_Command function executes the command sent by the
207 *   upper layer, depending on the commands defined.
208 *
209 *   \param[in]  psContext        psContext is the pointer to HCI Layer
210 *                                context Structure.
211 *   \param[in]  pHwRef           pHwRef is the Information of
212 *                                the Device Interface Link
213 *   \param[in]  pipe_id          pipeID of the ISO 15693 gate
214 *   \param[in]  cmd              command that needs to be sent to the device
215 *
216 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
217 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
218 *                                       could not be interpreted properly.
219 *
220 */
221 extern
222 NFCSTATUS
223 phHciNfc_Send_ISO15693_Command(
224                               phHciNfc_sContext_t   *psHciContext,
225                               void                  *pHwRef,
226                               uint8_t               pipe_id,
227                               uint8_t               cmd
228                               );
229 
230 /**
231 * \ingroup grp_hci_nfc
232 *
233 *  The phHciNfc_ISO15693_Set_AFI function updates the AFI value
234 *
235 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
236 *                                      context Structure.
237 *  \param[in]  pipeID                  pipeID of the ISO 15693 gate
238 *  \param[in]  pPipeInfo               Update the pipe Information of the ISO
239 *                                      15693 gate
240 *
241 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.
242 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
243 *                                      could not be interpreted properly.
244 *
245 */
246 extern
247 NFCSTATUS
248 phHciNfc_ISO15693_Set_AFI(
249                                void         *psContext,
250                                void         *pHwRef,
251                                uint8_t      afi_value
252                                );
253 
254 #endif /* #ifndef PHHCINFC_ISO15693_H */
255 
256 
257