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_RFReaderB.h                                                 *
22 * \brief HCI Reader B Management Routines.                                    *
23 *                                                                             *
24 *                                                                             *
25 * Project: NFC-FRI-1.1                                                        *
26 *                                                                             *
27 * $Date: Fri Aug 14 17:01:26 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 #ifndef PHHCINFC_RFREADERB_H
36 #define PHHCINFC_RFREADERB_H
37 
38 /*@}*/
39 
40 
41 /**
42 *  \name HCI
43 *
44 * File: \ref phHciNfc_ReaderB.h
45 *
46 */
47 /*@{*/
48 #define PHHCINFC_RFREADERB_FILEREVISION "$Revision: 1.5 $" /**< \ingroup grp_file_attributes */
49 #define PHHCINFC_RFREADERB_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 */
50 /*@}*/
51 
52 /*
53 ***************************** Header File Inclusion ****************************
54 */
55 
56 #include <phHciNfc_Generic.h>
57 
58 /*
59 ****************************** Macro Definitions *******************************
60 */
61 
62 /* Enable the reader B */
63 #define HCI_READER_B_ENABLE                 0x01U
64 #define HCI_READER_B_INFO_SEQ               0x02U
65 
66 /*
67 ******************** Enumeration and Structure Definition **********************
68 */
69 typedef enum phHciNfc_ReaderB_Seq{
70     RDR_B_PUPI,
71     RDR_B_APP_DATA,
72     RDR_B_AFI,
73     RDR_B_HIGHER_LAYER_RESP,
74     RDR_B_HIGHER_LAYER_DATA,
75     RDR_B_END_SEQUENCE,
76     RDR_B_INVALID_SEQ
77 } phHciNfc_ReaderB_Seq_t;
78 
79 /* Information structure for the reader B Gate */
80 typedef struct phHciNfc_ReaderB_Info{
81     /* Current running Sequence of the reader B Management */
82     phHciNfc_ReaderB_Seq_t          current_seq;
83     /* Next running Sequence of the reader B Management */
84     phHciNfc_ReaderB_Seq_t          next_seq;
85     /* Pointer to the reader B pipe information */
86     phHciNfc_Pipe_Info_t            *p_pipe_info;
87     uint8_t                         pipe_id;
88     /* Flag to say about the multiple targets */
89     uint8_t                         multiple_tgts_found;
90     /* Reader B information */
91     phHal_sRemoteDevInformation_t   reader_b_info;
92     /* Enable or disable reader gate */
93     uint8_t                         enable_rdr_b_gate;
94     /* UICC re-activation status */
95     uint8_t                         uicc_activation;
96 } phHciNfc_ReaderB_Info_t;
97 
98 /*
99 *********************** Function Prototype Declaration *************************
100 */
101 
102 /*!
103 * \brief Allocates the resources of reader B management gate.
104 *
105 * This function Allocates the resources of the reader B management
106 * gate Information Structure.
107 *
108 */
109 extern
110 NFCSTATUS
111 phHciNfc_ReaderB_Init_Resources(
112                                 phHciNfc_sContext_t     *psHciContext
113                                 );
114 
115 /**
116 * \ingroup grp_hci_nfc
117 *
118 *   The phHciNfc_ReaderB_Get_PipeID function gives the pipe id of the reader B
119 *   gate
120 *
121 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
122 *                                       context Structure.
123 *   \param[in]  pHwRef                  pHwRef is the Information of
124 *                                       the Device Interface Link
125 *
126 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
127 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
128 *                                       could not be interpreted properly.
129 *
130 */
131 extern
132 NFCSTATUS
133 phHciNfc_ReaderB_Get_PipeID(
134                             phHciNfc_sContext_t     *psHciContext,
135                             uint8_t                 *ppipe_id
136                             );
137 
138 
139 /**
140 * \ingroup grp_hci_nfc
141 *
142 *  The phHciNfc_ReaderB_Update_PipeInfo function updates the pipe_id of the reader B
143 *  gate management Structure.
144 *
145 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
146 *                                      context Structure.
147 *  \param[in]  pipeID                  pipeID of the reader B gate
148 *  \param[in]  pPipeInfo               Update the pipe Information of the reader
149 *                                      A gate
150 *
151 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.
152 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
153 *                                      could not be interpreted properly.
154 *
155 */
156 
157 extern
158 NFCSTATUS
159 phHciNfc_ReaderB_Update_PipeInfo(
160                                  phHciNfc_sContext_t     *psHciContext,
161                                  uint8_t                 pipeID,
162                                  phHciNfc_Pipe_Info_t    *pPipeInfo
163                                  );
164 
165 /**
166 * \ingroup grp_hci_nfc
167 *
168 *   The phHciNfc_ReaderB_Info_Sequence function executes the sequence of operations, to
169 *   get the PUPI, AFI, APPLICATION_DATA  etc.
170 *
171 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
172 *                                       context Structure.
173 *   \param[in]  pHwRef                  pHwRef is the Information of
174 *                                       the Device Interface Link
175 *
176 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
177 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
178 *                                       could not be interpreted properly.
179 *
180 */
181 extern
182 NFCSTATUS
183 phHciNfc_ReaderB_Info_Sequence (
184                                 void             *psHciHandle,
185                                 void             *pHwRef
186                                 );
187 
188 /**
189 * \ingroup grp_hci_nfc
190 *
191 *   The phHciNfc_ReaderB_Update_Info function updates the reader B information.
192 *
193 *   \param[in]  psHciContext     psHciContext is the pointer to HCI Layer
194 *                                context Structure.
195 *   \param[in]  infotype         To enable the reader B gate
196 *   \param[in]  rdr_b_info       reader B gate info
197 *
198 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
199 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
200 *                                       could not be interpreted properly.
201 *
202 */
203 extern
204 NFCSTATUS
205 phHciNfc_ReaderB_Update_Info(
206                              phHciNfc_sContext_t        *psHciContext,
207                              uint8_t                    infotype,
208                              void                       *rdr_b_info
209                              );
210 
211 /**
212 * \ingroup grp_hci_nfc
213 *
214 *   The phHciNfc_ReaderB_Set_LayerData function updates higher layer data
215 *   registry
216 *
217 *   \param[in]  psContext        psContext is the pointer to HCI Layer
218 *                                context Structure.
219 *   \param[in]  pHwRef           pHwRef is the Information of
220 *                                the Device Interface Link
221 *   \param[in]  layer_data_info  layer data information
222 *
223 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
224 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
225 *                                       could not be interpreted properly.
226 *
227 */
228 extern
229 NFCSTATUS
230 phHciNfc_ReaderB_Set_LayerData(
231                         void            *psContext,
232                         void            *pHwRef,
233                         phNfc_sData_t   *layer_data_info
234                         );
235 
236 /**
237 * \ingroup grp_hci_nfc
238 *
239 *   The phHciNfc_ReaderB_Set_AFI function updates application family
240 *   identifier registry
241 *
242 *   \param[in]  psContext        psContext is the pointer to HCI Layer
243 *                                context Structure.
244 *   \param[in]  pHwRef           pHwRef is the Information of
245 *                                the Device Interface Link
246 *   \param[in]  afi_value        to afi value update
247 *
248 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
249 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
250 *                                       could not be interpreted properly.
251 *
252 */
253 extern
254 NFCSTATUS
255 phHciNfc_ReaderB_Set_AFI(
256                         void         *psContext,
257                         void         *pHwRef,
258                         uint8_t      afi_value
259                         );
260 #endif /* #ifndef PHHCINFC_RFREADERB_H */
261 
262 
263