Initialize Tizen 2.3
[adaptation/devices/nfc-plugin-nxp.git] / src / phHciNfc_Felica.h
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_Felica.h                                                 *
22 * \brief HCI Felica Management Routines.                                    *
23 *                                                                             *
24 *                                                                             *
25 * Project: NFC-FRI-1.1                                                        *
26 *                                                                             *
27 * $Date: Fri Jun  5 12:10:53 2009 $                                           *
28 * $Author: ing02260 $                                                         *
29 * $Revision: 1.3 $                                                            *
30 * $Aliases: NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,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_FELICA_H
36 #define PHHCINFC_FELICA_H
37
38 /*@}*/
39
40
41 /**
42 *  \name HCI
43 *
44 * File: \ref phHciNfc_Felica.h
45 *
46 */
47 /*@{*/
48 #define PHHCINFC_FELICA_FILEREVISION "$Revision: 1.3 $" /**< \ingroup grp_file_attributes */
49 #define PHHCINFC_FELICA_FILEALIASES  "$Aliases: NFC_FRI1.1_WK924_PREP1,NFC_FRI1.1_WK924_R27_1,NFC_FRI1.1_WK926_R28_1,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
62 /* Commands exposed to the upper layer */
63
64 /* Enable the Felica */
65 #define HCI_FELICA_ENABLE                   0x01U
66 #define HCI_FELICA_INFO_SEQ                 0x02U
67
68 /* Felica read write commands */
69 #define NXP_FELICA_RAW                      0x20U
70 #define NXP_FELICA_CMD                      0x21U
71
72 /*
73 ******************** Enumeration and Structure Definition **********************
74 */
75 typedef enum phHciNfc_Felica_Seq{
76     FELICA_SYSTEMCODE,
77     FELICA_CURRENTIDM,
78     FELICA_CURRENTPMM,
79     FELICA_END_SEQUENCE,
80     FELICA_INVALID_SEQ
81 } phHciNfc_Felica_Seq_t;
82
83 /* Information structure for the Felica Gate */
84 typedef struct phHciNfc_Felica_Info{
85     /* Current running Sequence of the Felica Management */
86     phHciNfc_Felica_Seq_t           current_seq;
87     /* Next running Sequence of the Felica Management */
88     phHciNfc_Felica_Seq_t           next_seq;
89     /* Pointer to the Felica pipe information */
90     phHciNfc_Pipe_Info_t            *p_pipe_info;
91     uint8_t                         pipe_id;
92     /* Flag to say about the multiple targets */
93     uint8_t                         multiple_tgts_found;
94     /* Felica information */
95     phHal_sRemoteDevInformation_t   felica_info;
96     /* Enable or disable reader gate */
97     uint8_t                         enable_felica_gate;
98     /* UICC re-activation status */
99     uint8_t                         uicc_activation;
100 } phHciNfc_Felica_Info_t;
101
102 /*
103 *********************** Function Prototype Declaration *************************
104 */
105
106 /*!
107 * \brief Allocates the resources of Felica management gate.
108 *
109 * This function Allocates the resources of the Felica management
110 * gate Information Structure.
111
112 */
113 extern
114 NFCSTATUS
115 phHciNfc_Felica_Init_Resources(
116                                 phHciNfc_sContext_t     *psHciContext
117                                 );
118
119 /**
120 * \ingroup grp_hci_nfc
121 *
122 *   The phHciNfc_Felica_Get_PipeID function gives the pipe id of the Felica 
123 *   gate
124 *
125 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
126 *                                       context Structure.
127 *   \param[in]  pHwRef                  pHwRef is the Information of
128 *                                       the Device Interface Link
129 *
130 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
131 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
132 *                                       could not be interpreted properly.
133 *
134 */
135 extern
136 NFCSTATUS
137 phHciNfc_Felica_Get_PipeID(
138                             phHciNfc_sContext_t     *psHciContext,
139                             uint8_t                 *ppipe_id
140                             );
141
142
143 /**
144 * \ingroup grp_hci_nfc
145 *
146 *  The phHciNfc_Felica_Update_PipeInfo function updates the pipe_id of the Felica
147 *  gate management Structure.
148 *
149 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
150 *                                      context Structure.
151 *  \param[in]  pipeID                  pipeID of the Felica gate
152 *  \param[in]  pPipeInfo               Update the pipe Information of the reader 
153 *                                      A gate
154 *
155 *  \retval NFCSTATUS_SUCCESS           Function execution is successful.
156 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
157 *                                      could not be interpreted properly.
158 *
159 */
160
161 extern
162 NFCSTATUS
163 phHciNfc_Felica_Update_PipeInfo(
164                                  phHciNfc_sContext_t     *psHciContext,
165                                  uint8_t                 pipeID,
166                                  phHciNfc_Pipe_Info_t    *pPipeInfo
167                                  );
168
169 /**
170 * \ingroup grp_hci_nfc
171 *
172 *   The phHciNfc_ReaderA_Update_Info function updated the felica gate info.
173 *
174 *   \param[in]  psHciContext     psHciContext is the pointer to HCI Layer
175 *                                context Structure.
176 *   \param[in]  infotype         To enable the felica gate
177 *   \param[in]  fel_info         felica gate info
178 *
179 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
180 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
181 *                                       could not be interpreted properly.
182 */
183 extern 
184 NFCSTATUS
185 phHciNfc_Felica_Update_Info(
186                              phHciNfc_sContext_t        *psHciContext,
187                              uint8_t                    infotype,
188                              void                       *fel_info
189                              );
190
191 /**
192 * \ingroup grp_hci_nfc
193 *
194 *   The phHciNfc_Felica_Info_Sequence function executes the sequence of operations, to
195 *   get the SYSTEM CODE, IDM, PPM.
196 *
197 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
198 *                                       context Structure.
199 *   \param[in]  pHwRef                  pHwRef is the Information of
200 *                                       the Device Interface Link
201 *
202 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
203 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
204 *                                       could not be interpreted properly.
205 *
206 */
207 extern
208 NFCSTATUS
209 phHciNfc_Felica_Info_Sequence (
210                                 void             *psHciHandle,
211                                 void             *pHwRef
212                                 );
213
214 /**
215 * \ingroup grp_hci_nfc
216 *
217 *   The phHciNfc_Felica_Request_Mode function is to know about the felica tag is 
218 *   in the field or not
219 *
220 *   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
221 *                                       context Structure.
222 *   \param[in]  pHwRef                  pHwRef is the Information of
223 *                                       the Device Interface Link
224 *
225 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
226 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
227 *                                       could not be interpreted properly.
228 *
229 */
230 extern 
231 NFCSTATUS
232 phHciNfc_Felica_Request_Mode(
233                               phHciNfc_sContext_t   *psHciContext,
234                               void                  *pHwRef);
235
236 /**
237 * \ingroup grp_hci_nfc
238 *
239 *   The phHciNfc_Send_Felica_Command function executes the command sent by the 
240 *   upper layer, depending on the commands defined.
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]  pipe_id          pipeID of the Felica gate 
247 *   \param[in]  cmd              command that needs to be sent to the device
248 *   \param[in]  length           information length sent by the caller
249 *   \param[in]  params           information related to the command
250 *
251 *   \retval NFCSTATUS_SUCCESS           Function execution is successful.
252 *   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
253 *                                       could not be interpreted properly.
254 */
255 extern
256 NFCSTATUS
257 phHciNfc_Send_Felica_Command(
258                              phHciNfc_sContext_t   *psContext,
259                              void                  *pHwRef,
260                              uint8_t               pipe_id,
261                              uint8_t               cmd
262                              );
263
264 #endif /* #ifndef PHHCINFC_FELICA_H */
265
266