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 123 /* The Address Definition for the Enabling the EVT_HOT_PLUG */ 124 #define NFC_ADDRESS_HOTPLUG_EVT 0x9FF0U 125 126 127 /* 128 ******************** Enumeration and Structure Definition ********************** 129 */ 130 131 132 133 /* 134 *********************** Function Prototype Declaration ************************* 135 */ 136 137 /************************ Function Prototype Declaration *************************/ 138 139 /*! 140 * \brief Allocates the resources required for PN544 Device management gate. 141 * 142 * This function Allocates necessary resources as requiered by PN544 Device 143 * gate management 144 * 145 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 146 * 147 * \retval NFCSTATUS_SUCCESS Function execution is successful 148 * 149 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid 150 */ 151 152 extern 153 NFCSTATUS 154 phHciNfc_DevMgmt_Init_Resources(phHciNfc_sContext_t *psHciContext); 155 156 157 /** 158 * \ingroup grp_hci_nfc 159 * 160 * The phHciNfc_DevMgmt_Get_PipeID function gives the pipe id of the PN544 Device 161 * management gate 162 * 163 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 164 * context Structure. 165 * \param[in] pHwRef pHwRef is the Information of 166 * the Device Interface Link 167 * \param[in] ppipe_id ppipe_id of the Device management Gate 168 * 169 * \retval NFCSTATUS_SUCCESS Function execution is successful. 170 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 171 * could not be interpreted properly. 172 * 173 */ 174 175 extern 176 NFCSTATUS 177 phHciNfc_DevMgmt_Get_PipeID( 178 phHciNfc_sContext_t *psHciContext, 179 uint8_t *ppipe_id 180 ); 181 182 /** 183 * \ingroup grp_hci_nfc 184 * 185 * The phHciNfc_DevMgmt_Initialise function creates and the opens the pipe 186 * PN544 Device Management Gate in the NFC Device 187 * 188 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 189 * context Structure. 190 * \param[in] pHwRef pHwRef is the Information of 191 * the Device Interface Link . 192 * 193 * \retval NFCSTATUS_PENDING Device Mgmt Gate Initialisation is pending. 194 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 195 * could not be interpreted properly. 196 * \retval Other errors Errors related to the other layers 197 * 198 */ 199 200 extern 201 NFCSTATUS 202 phHciNfc_DevMgmt_Initialise( 203 phHciNfc_sContext_t *psHciContext, 204 void *pHwRef 205 ); 206 207 /** 208 * \ingroup grp_hci_nfc 209 * 210 * The phHciNfc_DevMgmt_Test function performs the System Management Tests 211 * provided by the NFC Peripheral device. 212 * 213 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 214 * context Structure. 215 * \param[in] pHwRef pHwRef is the Information of 216 * the Device Interface Link . 217 * \param[in] test_type test_type is the type of the Self Test 218 * that needs to be performed on the device. 219 * \param[in] test_param test_param is the parameter for the Self Test 220 * that needs to be performed on the device. 221 * 222 * 223 * \retval NFCSTATUS_PENDING Self Test on the Device Management gate 224 * is pending. 225 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 226 * could not be interpreted properly. 227 * \retval Other errors Errors related to the other layers 228 * 229 */ 230 231 extern 232 NFCSTATUS 233 phHciNfc_DevMgmt_Test( 234 void *psContext, 235 void *pHwRef, 236 uint8_t test_type, 237 phNfc_sData_t *test_param 238 ); 239 240 extern 241 NFCSTATUS 242 phHciNfc_DevMgmt_Get_Info ( 243 phHciNfc_sContext_t *psHciContext, 244 void *pHwRef, 245 uint16_t address, 246 uint8_t *p_val 247 ); 248 249 extern 250 NFCSTATUS 251 phHciNfc_DevMgmt_Configure ( 252 phHciNfc_sContext_t *psHciContext, 253 void *pHwRef, 254 uint16_t address, 255 uint8_t value 256 ); 257 258 extern 259 NFCSTATUS 260 phHciNfc_DevMgmt_Get_Test_Result( 261 phHciNfc_sContext_t *psHciContext, 262 phNfc_sData_t *test_result 263 ); 264 265 266 /** 267 * \ingroup grp_hci_nfc 268 * 269 * \brief Allocates the resources required for PN544 Device 270 * management gate 271 * This function Allocates necessary resources as requiered by PN544 272 * Device management gate 273 * 274 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 275 * \param[in] pipeID pipeID of the Device management Gate 276 * \param[in] pPipeInfo Update the pipe Information of the Device 277 * Management Gate. 278 * 279 * \retval NFCSTATUS_SUCCESS Function execution is successful 280 * 281 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid 282 */ 283 extern 284 NFCSTATUS 285 phHciNfc_DevMgmt_Update_PipeInfo( 286 phHciNfc_sContext_t *psHciContext, 287 uint8_t pipeID, 288 phHciNfc_Pipe_Info_t *pPipeInfo 289 ); 290 291 /** 292 * \ingroup grp_hci_nfc 293 * 294 * The phHciNfc_DevMgmt_Release function closes the opened pipes between 295 * the Device Management Gate in the Host Controller Device 296 * and the NFC Device. 297 * 298 * \param[in] psHciContext psHciContext is the pointer to HCI Layer 299 * context Structure. 300 * \param[in] pHwRef pHwRef is the Information of 301 * the Device Interface Link . 302 * 303 * \retval NFCSTATUS_PENDING Release of the Device Management gate 304 * resources are pending. 305 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 306 * could not be interpreted properly. 307 * \retval Other errors Errors related to the other layers 308 * 309 */ 310 extern 311 NFCSTATUS 312 phHciNfc_DevMgmt_Release( 313 phHciNfc_sContext_t *psHciContext, 314 void *pHwRef 315 ); 316 317 extern 318 NFCSTATUS 319 phHciNfc_DevMgmt_Update_Sequence( 320 phHciNfc_sContext_t *psHciContext, 321 phHciNfc_eSeqType_t DevMgmt_seq 322 ); 323 324 extern 325 NFCSTATUS 326 phHciNfc_DevMgmt_Set_Test_Result( 327 phHciNfc_sContext_t *psHciContext, 328 uint8_t test_status 329 ) 330 ; 331 332 #endif 333 334