summaryrefslogtreecommitdiffstats
path: root/src/phHciNfc_DevMgmt.h
blob: e88601306a100ba8be6c8395c96ed9bce1e40a42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
/*
 * Copyright (C) 2010 NXP Semiconductors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/*!
* =========================================================================== *
*                                                                             *
*                                                                             *
* \file  phHciNfc_DevMgmt.h                                                   *
* \brief HCI Header for the PN544 Device Management Gate.                     *
*                                                                             *
*                                                                             *
* Project: NFC-FRI-1.1                                                        *
*                                                                             *
* $Date: Tue Jun  8 09:30:49 2010 $                                           *
* $Author: ing04880 $                                                         *
* $Revision: 1.15 $                                                            *
* $Aliases: NFC_FRI1.1_WK1023_R35_1 $  
*                                                                             *
* =========================================================================== *
*/


#ifndef PHHCINFC_DEVMGMT_H
#define PHHCINFC_DEVMGMT_H

/*@}*/


/**
 *  \name HCI
 *
 * File: \ref phHciNfc_DevMgmt.h
 *
 */
/*@{*/
#define PHHCINFC_DEVICE_MGMT_FILEREVISION "$Revision: 1.15 $" /**< \ingroup grp_file_attributes */
#define PHHCINFC_DEVICE_MGMT_FILEALIASES  "$Aliases: NFC_FRI1.1_WK1023_R35_1 $"     /**< \ingroup grp_file_attributes */
/*@}*/

/*
***************************** Header File Inclusion ****************************
*/

#include <phHciNfc_Generic.h>

/*
****************************** Macro Definitions *******************************
*/

#define DEVICE_PWR_STATUS_INDEX         0x01U
#define DEVICE_INFO_EVT_INDEX           0x02U
#define DEVICE_INFO_EEPROM_INDEX        0x03U

#define  NXP_DOWNLOAD_GPIO              0x04U

/* GPIO PIN Mask Macro */
#define NXP_NFC_GPIO_MASK(n)  ((uint8_t)(1U << (n)))

/* Address Definitions for GPIO Register Configuration */
#define NFC_ADDRESS_GPIO_PDIR           0xF821U
#define NFC_ADDRESS_GPIO_PEN            0xF829U


/* Address Definitions for SWP Configuration */
#define NFC_ADDRESS_SWP_BITRATE         0x9C01U
#define NFC_ADDRESS_SWP_PWR_REQ         0x9EB4U

/* Address Definitions for UICC Host Configuration */
#define NFC_ADDRESS_UICC_RD_A_ACCESS    0x9ED9U
#define NFC_ADDRESS_UICC_RD_B_ACCESS    0x9EDAU
#define NFC_ADDRESS_UICC_CE_A_ACCESS    0x9EDBU
#define NFC_ADDRESS_UICC_CE_B_ACCESS    0x9EDCU
#define NFC_ADDRESS_UICC_CE_BP_ACCESS   0x9EDDU
#define NFC_ADDRESS_UICC_CE_F_ACCESS    0x9EDEU

/* Address Definitions for SE Configuration */

/* Address Definitions for HW Configuration */
#define NFC_ADDRESS_CLK_REQ             0x9E71U
#define NFC_ADDRESS_CLK_INPUT           0x9809U
#define NFC_ADDRESS_HW_CONF             0x9810U
#define NFC_ADDRESS_PWR_STATUS          0x9EAAU

/* Address Definitions for RF Configuration */


/* Address Definitions for Interframe Character Timeout Configuration */
#define NFC_ADDRESS_IFC_TO_RX_H          0x9C0CU
#define NFC_ADDRESS_IFC_TO_RX_L          0x9C0DU
#define NFC_ADDRESS_IFC_TO_TX_H          0x9C12U
#define NFC_ADDRESS_IFC_TO_TX_L          0x9C13U


/* Address Definitions for LLC Configuration */
#define NFC_ADDRESS_LLC_ACK_TO_H          0x9C27U
#define NFC_ADDRESS_LLC_ACK_TO_L          0x9C28U
#define NFC_ADDRESS_LLC_GRD_TO_H          0x9C31U
#define NFC_ADDRESS_LLC_GRD_TO_L          0x9C32U

#define NFC_ADDRESS_ACT_GRD_TO          0x9916U

/* The Address Definition for the TYPE B Tuning */

#ifdef SW_TYPE_RF_TUNING_BF
#define NFC_ADDRESS_ANAIRQ_CONF         0x9801U
#define NFC_ADDRESS_PMOS_MOD            0x997AU
#endif

#define NFC_FELICA_RC_ADDR              0x9F9AU

/* The Address Definition for the Enabling the EVT_HOT_PLUG */
#define NFC_ADDRESS_HOTPLUG_EVT         0x9FF0U


/*
******************** Enumeration and Structure Definition **********************
*/



/*
*********************** Function Prototype Declaration *************************
*/

/************************ Function Prototype Declaration *************************/

/*!
 * \brief Allocates the resources required for  PN544 Device management gate.
 *
 * This function Allocates necessary resources as requiered by PN544 Device
 * gate management
 *
 * \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *
 * \retval NFCSTATUS_SUCCESS           Function execution is successful
 *
 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid
 */

extern
NFCSTATUS
phHciNfc_DevMgmt_Init_Resources(phHciNfc_sContext_t   *psHciContext);


/**
* \ingroup grp_hci_nfc
*
*   The phHciNfc_DevMgmt_Get_PipeID function gives the pipe id of the PN544 Device
*   management gate
*
*   \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
*                                       context Structure.
*   \param[in]  pHwRef                  pHwRef is the Information of
*                                       the Device Interface Link
*   \param[in]  ppipe_id                ppipe_id of the Device management Gate
*
*   \retval NFCSTATUS_SUCCESS           Function execution is successful.
*   \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
*                                       could not be interpreted properly.
*
*/

extern
NFCSTATUS
phHciNfc_DevMgmt_Get_PipeID(
                            phHciNfc_sContext_t     *psHciContext,
                            uint8_t                 *ppipe_id
                            );

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_DevMgmt_Initialise function creates and the opens the pipe 
 *  PN544 Device Management Gate in the NFC Device
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *
 *  \retval NFCSTATUS_PENDING           Device Mgmt Gate Initialisation is pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
phHciNfc_DevMgmt_Initialise(
                                phHciNfc_sContext_t     *psHciContext,
                                void                    *pHwRef
                         );

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_DevMgmt_Test function performs the System Management Tests 
 * provided by the NFC Peripheral device.
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *  \param[in]  test_type               test_type is the type of the Self Test
 *                                      that needs to be performed on the device.
 *  \param[in]  test_param              test_param is the parameter for the Self Test
 *                                      that needs to be performed on the device.
 *
 *
 *  \retval NFCSTATUS_PENDING           Self Test on the Device Management gate 
 *                                      is pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */

extern
NFCSTATUS
phHciNfc_DevMgmt_Test(
                    void                            *psContext,
                    void                            *pHwRef,
                    uint8_t                         test_type,
                    phNfc_sData_t                   *test_param
                 );

extern
NFCSTATUS
phHciNfc_DevMgmt_Get_Info (
                            phHciNfc_sContext_t *psHciContext,
                            void                *pHwRef,
                            uint16_t            address,
                            uint8_t             *p_val
                );

extern
NFCSTATUS
phHciNfc_DevMgmt_Configure (
                            phHciNfc_sContext_t *psHciContext,
                            void                *pHwRef,
                            uint16_t            address,
                            uint8_t             value
                );

extern
NFCSTATUS
phHciNfc_DevMgmt_Get_Test_Result(
                            phHciNfc_sContext_t        *psHciContext,
                            phNfc_sData_t              *test_result
                            );


/**
* \ingroup grp_hci_nfc
*
* \brief Allocates the resources required for  PN544 Device 
* management gate 
* This function Allocates necessary resources as requiered by PN544 
* Device management gate 
*
* \param[in]  psHciContext          psHciContext is the pointer to HCI Layer
* \param[in]  pipeID                pipeID of the Device management Gate
* \param[in]  pPipeInfo             Update the pipe Information of the Device
*                                   Management Gate.
*
* \retval NFCSTATUS_SUCCESS           Function execution is successful
*
* \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid
*/
extern
NFCSTATUS
phHciNfc_DevMgmt_Update_PipeInfo(
                                  phHciNfc_sContext_t     *psHciContext,
                                  uint8_t                 pipeID,
                                  phHciNfc_Pipe_Info_t    *pPipeInfo
                                  );

/**
 * \ingroup grp_hci_nfc
 *
 *  The phHciNfc_DevMgmt_Release function closes the opened pipes between 
 *  the Device Management Gate in the Host Controller Device 
 *  and the NFC Device.
 *
 *  \param[in]  psHciContext            psHciContext is the pointer to HCI Layer
 *                                      context Structure.
 *  \param[in]  pHwRef                  pHwRef is the Information of
 *                                      the Device Interface Link .
 *
 *  \retval NFCSTATUS_PENDING           Release of the Device Management gate 
 *                                      resources are pending.
 *  \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters
 *                                      could not be interpreted properly.
 *  \retval Other errors                Errors related to the other layers
 *
 */
extern
NFCSTATUS
phHciNfc_DevMgmt_Release(
                                phHciNfc_sContext_t     *psHciContext,
                                void                    *pHwRef
                     );

extern
NFCSTATUS
phHciNfc_DevMgmt_Update_Sequence(
                                phHciNfc_sContext_t     *psHciContext,
                                phHciNfc_eSeqType_t     DevMgmt_seq
                             );

extern
NFCSTATUS
phHciNfc_DevMgmt_Set_Test_Result(
                                phHciNfc_sContext_t        *psHciContext,
                                uint8_t                    test_status
                            )
;

#endif