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_DevMgmt.h * 22 * \brief HCI Header for the PN544 Device Management Gate. * 23 * * 24 * * 25 * Project: NFC-FRI-1.1 * 26 * * 27 * $Date: Tue Jun 8 09:30:49 2010 $ * 28 * $Author: ing04880 $ * 29 * $Revision: 1.15 $ * 30 * $Aliases: NFC_FRI1.1_WK1023_R35_1 $ 31 * * 32 * =========================================================================== * 33 */ 34 35 36 #ifndef PHHCINFC_DEVMGMT_H 37 #define PHHCINFC_DEVMGMT_H 38 39 /*@}*/ 40 41 42 /** 43 * \name HCI 44 * 45 * File: \ref phHciNfc_DevMgmt.h 46 * 47 */ 48 /*@{*/ 49 #define PHHCINFC_DEVICE_MGMT_FILEREVISION "$Revision: 1.15 $" /**< \ingroup grp_file_attributes */ 50 #define PHHCINFC_DEVICE_MGMT_FILEALIASES "$Aliases: NFC_FRI1.1_WK1023_R35_1 $" /**< \ingroup grp_file_attributes */ 51 /*@}*/ 52 53 /* 54 ***************************** Header File Inclusion **************************** 55 */ 56 57 #include <phHciNfc_Generic.h> 58 59 /* 60 ****************************** Macro Definitions ******************************* 61 */ 62 63 #define DEVICE_PWR_STATUS_INDEX 0x01U 64 #define DEVICE_INFO_EVT_INDEX 0x02U 65 #define DEVICE_INFO_EEPROM_INDEX 0x03U 66 67 #define NXP_DOWNLOAD_GPIO 0x04U 68 69 /* GPIO PIN Mask Macro */ 70 #define NXP_NFC_GPIO_MASK(n) ((uint8_t)(1U << (n))) 71 72 /* Address Definitions for GPIO Register Configuration */ 73 #define NFC_ADDRESS_GPIO_PDIR 0xF821U 74 #define NFC_ADDRESS_GPIO_PEN 0xF829U 75 76 77 /* Address Definitions for SWP Configuration */ 78 #define NFC_ADDRESS_SWP_BITRATE 0x9C01U 79 #define NFC_ADDRESS_SWP_PWR_REQ 0x9EB4U 80 81 /* Address Definitions for UICC Host Configuration */ 82 #define NFC_ADDRESS_UICC_RD_A_ACCESS 0x9ED9U 83 #define NFC_ADDRESS_UICC_RD_B_ACCESS 0x9EDAU 84 #define NFC_ADDRESS_UICC_CE_A_ACCESS 0x9EDBU 85 #define NFC_ADDRESS_UICC_CE_B_ACCESS 0x9EDCU 86 #define NFC_ADDRESS_UICC_CE_BP_ACCESS 0x9EDDU 87 #define NFC_ADDRESS_UICC_CE_F_ACCESS 0x9EDEU 88 89 /* Address Definitions for SE Configuration */ 90 91 /* Address Definitions for HW Configuration */ 92 #define NFC_ADDRESS_CLK_REQ 0x9E71U 93 #define NFC_ADDRESS_CLK_INPUT 0x9809U 94 #define NFC_ADDRESS_HW_CONF 0x9810U 95 #define NFC_ADDRESS_PWR_STATUS 0x9EAAU 96 97 /* Address Definitions for RF Configuration */ 98 99 100 /* Address Definitions for Interframe Character Timeout Configuration */ 101 #define NFC_ADDRESS_IFC_TO_RX_H 0x9C0CU 102 #define NFC_ADDRESS_IFC_TO_RX_L 0x9C0DU 103 #define NFC_ADDRESS_IFC_TO_TX_H 0x9C12U 104 #define NFC_ADDRESS_IFC_TO_TX_L 0x9C13U 105 106 107 /* Address Definitions for LLC Configuration */ 108 #define NFC_ADDRESS_LLC_ACK_TO_H 0x9C27U 109 #define NFC_ADDRESS_LLC_ACK_TO_L 0x9C28U 110 #define NFC_ADDRESS_LLC_GRD_TO_H 0x9C31U 111 #define NFC_ADDRESS_LLC_GRD_TO_L 0x9C32U 112 113 #define NFC_ADDRESS_ACT_GRD_TO 0x9916U 114 115 /* The Address Definition for the TYPE B Tuning */ 116 117 #ifdef SW_TYPE_RF_TUNING_BF 118 #define NFC_ADDRESS_ANAIRQ_CONF 0x9801U 119 #define NFC_ADDRESS_PMOS_MOD 0x997AU 120 #endif 121 122 #define NFC_FELICA_RC_ADDR 0x9F9AU 123 124 /* The Address Definition for the Enabling the EVT_HOT_PLUG */ 125 #define NFC_ADDRESS_HOTPLUG_EVT 0x9FF0U 126 127 128 /* 129 ******************** Enumeration and Structure Definition ********************** 130 */ 131 132 133 134 /* 135 *********************** Function Prototype Declaration ************************* 136 */ 137 138 /************************ Function Prototype Declaration *************************/ 139 140 /*! 141 * \brief Allocates the resources required for PN544 Device management gate. 142 * 143 * This function Allocates necessary resources as requiered by PN544 Device 144 * gate management 145 * 146 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 147 * 148 * \retval NFCSTATUS_SUCCESS Function execution is successful 149 * 150 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid 151 */ 152 153 extern 154 NFCSTATUS 155 phHciNfc_DevMgmt_Init_Resources(phHciNfc_sContext_t *psHciContext); 156 157 158 /** 159 * \ingroup grp_hci_nfc 160 * 161 * The phHciNfc_DevMgmt_Get_PipeID function gives the pipe id of the PN544 Device 162 * management gate 163 * 164 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 165 * context Structure. 166 * \param[in] pHwRef pHwRef is the Information of 167 * the Device Interface Link 168 * \param[in] ppipe_id ppipe_id of the Device management Gate 169 * 170 * \retval NFCSTATUS_SUCCESS Function execution is successful. 171 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 172 * could not be interpreted properly. 173 * 174 */ 175 176 extern 177 NFCSTATUS 178 phHciNfc_DevMgmt_Get_PipeID( 179 phHciNfc_sContext_t *psHciContext, 180 uint8_t *ppipe_id 181 ); 182 183 /** 184 * \ingroup grp_hci_nfc 185 * 186 * The phHciNfc_DevMgmt_Initialise function creates and the opens the pipe 187 * PN544 Device Management Gate in the NFC Device 188 * 189 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 190 * context Structure. 191 * \param[in] pHwRef pHwRef is the Information of 192 * the Device Interface Link . 193 * 194 * \retval NFCSTATUS_PENDING Device Mgmt Gate Initialisation is pending. 195 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 196 * could not be interpreted properly. 197 * \retval Other errors Errors related to the other layers 198 * 199 */ 200 201 extern 202 NFCSTATUS 203 phHciNfc_DevMgmt_Initialise( 204 phHciNfc_sContext_t *psHciContext, 205 void *pHwRef 206 ); 207 208 /** 209 * \ingroup grp_hci_nfc 210 * 211 * The phHciNfc_DevMgmt_Test function performs the System Management Tests 212 * provided by the NFC Peripheral device. 213 * 214 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 215 * context Structure. 216 * \param[in] pHwRef pHwRef is the Information of 217 * the Device Interface Link . 218 * \param[in] test_type test_type is the type of the Self Test 219 * that needs to be performed on the device. 220 * \param[in] test_param test_param is the parameter for the Self Test 221 * that needs to be performed on the device. 222 * 223 * 224 * \retval NFCSTATUS_PENDING Self Test on the Device Management gate 225 * is pending. 226 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 227 * could not be interpreted properly. 228 * \retval Other errors Errors related to the other layers 229 * 230 */ 231 232 extern 233 NFCSTATUS 234 phHciNfc_DevMgmt_Test( 235 void *psContext, 236 void *pHwRef, 237 uint8_t test_type, 238 phNfc_sData_t *test_param 239 ); 240 241 extern 242 NFCSTATUS 243 phHciNfc_DevMgmt_Get_Info ( 244 phHciNfc_sContext_t *psHciContext, 245 void *pHwRef, 246 uint16_t address, 247 uint8_t *p_val 248 ); 249 250 extern 251 NFCSTATUS 252 phHciNfc_DevMgmt_Configure ( 253 phHciNfc_sContext_t *psHciContext, 254 void *pHwRef, 255 uint16_t address, 256 uint8_t value 257 ); 258 259 extern 260 NFCSTATUS 261 phHciNfc_DevMgmt_Get_Test_Result( 262 phHciNfc_sContext_t *psHciContext, 263 phNfc_sData_t *test_result 264 ); 265 266 267 /** 268 * \ingroup grp_hci_nfc 269 * 270 * \brief Allocates the resources required for PN544 Device 271 * management gate 272 * This function Allocates necessary resources as requiered by PN544 273 * Device management gate 274 * 275 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 276 * \param[in] pipeID pipeID of the Device management Gate 277 * \param[in] pPipeInfo Update the pipe Information of the Device 278 * Management Gate. 279 * 280 * \retval NFCSTATUS_SUCCESS Function execution is successful 281 * 282 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid 283 */ 284 extern 285 NFCSTATUS 286 phHciNfc_DevMgmt_Update_PipeInfo( 287 phHciNfc_sContext_t *psHciContext, 288 uint8_t pipeID, 289 phHciNfc_Pipe_Info_t *pPipeInfo 290 ); 291 292 /** 293 * \ingroup grp_hci_nfc 294 * 295 * The phHciNfc_DevMgmt_Release function closes the opened pipes between 296 * the Device Management Gate in the Host Controller Device 297 * and the NFC Device. 298 * 299 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 300 * context Structure. 301 * \param[in] pHwRef pHwRef is the Information of 302 * the Device Interface Link . 303 * 304 * \retval NFCSTATUS_PENDING Release of the Device Management gate 305 * resources are pending. 306 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 307 * could not be interpreted properly. 308 * \retval Other errors Errors related to the other layers 309 * 310 */ 311 extern 312 NFCSTATUS 313 phHciNfc_DevMgmt_Release( 314 phHciNfc_sContext_t *psHciContext, 315 void *pHwRef 316 ); 317 318 extern 319 NFCSTATUS 320 phHciNfc_DevMgmt_Update_Sequence( 321 phHciNfc_sContext_t *psHciContext, 322 phHciNfc_eSeqType_t DevMgmt_seq 323 ); 324 325 extern 326 NFCSTATUS 327 phHciNfc_DevMgmt_Set_Test_Result( 328 phHciNfc_sContext_t *psHciContext, 329 uint8_t test_status 330 ) 331 ; 332 333 #endif 334 335