Nick Pelly | 5d9927b | 2010-09-23 12:47:58 -0700 | [diff] [blame] | 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_SWP .h * |
| 22 | * \brief HCI wired interface gate Management Routines. * |
| 23 | * * |
| 24 | * * |
| 25 | * Project: NFC-FRI-1.1 * |
| 26 | * * |
| 27 | * $Date: Fri Aug 14 17:01:28 2009 $ * |
| 28 | * $Author: ing04880 $ * |
| 29 | * $Revision: 1.15 $ * |
| 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 | #ifndef PHHCINFC_SWP_H |
| 35 | #define PHHCINFC_SWP_H |
| 36 | /*@}*/ |
| 37 | /** |
| 38 | * \name HCI |
| 39 | * |
| 40 | * File: \ref phHciNfc_SWP.h |
| 41 | * |
| 42 | */ |
| 43 | /*@{*/ |
| 44 | #define PHHCINFC_SWPRED_FILEREVISION "$Revision: 1.15 $" /**< \ingroup grp_file_attributes */ |
| 45 | #define PHHCINFC_SWPREDINTERFACE_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 */ |
| 46 | /*@}*/ |
| 47 | |
| 48 | /****************************** Header File Inclusion *****************************/ |
| 49 | #include <phHciNfc_Generic.h> |
| 50 | |
| 51 | /******************************* Macro Definitions ********************************/ |
| 52 | |
| 53 | /* Kb/sec */ |
| 54 | #define UICC_REF_BITRATE (106U) |
| 55 | #define UICC_MAX_CONNECT_RETRY (0x02U) |
| 56 | |
| 57 | /* SWP switch mode event parameters */ |
| 58 | #define UICC_SWITCH_MODE_OFF (0x00U) |
| 59 | #define UICC_SWITCH_MODE_DEFAULT (0x01U) |
| 60 | #define UICC_SWITCH_MODE_ON (0x02U) |
| 61 | |
| 62 | /******************** Enumeration and Structure Definition ***********************/ |
| 63 | |
| 64 | typedef enum phHciNfc_SWP_Seq{ |
| 65 | SWP_INVALID_SEQUENCE = 0x00U, |
| 66 | SWP_MODE_SEQ, |
| 67 | SWP_STATUS_SEQ, |
| 68 | SWP_END_SEQ |
| 69 | }phHciNfc_SWP_Seq_t; |
| 70 | |
| 71 | typedef enum phHciNfc_SWP_Status{ |
| 72 | UICC_NOT_CONNECTED = 0x00U, |
| 73 | UICC_CONNECTION_ONGOING, |
| 74 | UICC_CONNECTED, |
| 75 | UICC_CONNECTION_LOST, |
| 76 | UICC_DISCONNECTION_ONGOING, |
| 77 | UICC_CONNECTION_FAILED |
| 78 | }phHciNfc_SWP_Status_t; |
| 79 | |
| 80 | |
| 81 | /* Information structure for SWP Gate */ |
| 82 | typedef struct phHciNfc_SWP_Info{ |
| 83 | |
| 84 | /* Pointer to SWP gate pipe information */ |
| 85 | phHciNfc_Pipe_Info_t *p_pipe_info; |
| 86 | /* SWP gate pipe Identified */ |
| 87 | uint8_t pipe_id; |
| 88 | /*Current internal Sequence type */ |
| 89 | phHciNfc_SWP_Seq_t current_seq; |
| 90 | /*Current next Sequence ID */ |
| 91 | phHciNfc_SWP_Seq_t next_seq; |
| 92 | |
| 93 | phHciNfc_SWP_Status_t uicc_status; |
| 94 | |
| 95 | uint8_t uicc_bitrate; |
| 96 | |
| 97 | } phHciNfc_SWP_Info_t; |
| 98 | |
| 99 | /************************ Function Prototype Declaration *************************/ |
| 100 | /*! |
| 101 | * \brief Allocates the resources required for SWP gate management. |
| 102 | * |
| 103 | * This function Allocates necessary resources as requiered by SWP gate management |
| 104 | * |
| 105 | * \param[in] psHciContext psHciContext is the pointer to HCI Layer |
| 106 | * |
| 107 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 108 | * |
| 109 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 110 | */ |
| 111 | extern |
| 112 | NFCSTATUS |
| 113 | phHciNfc_SWP_Init_Resources(phHciNfc_sContext_t *psHciContext); |
| 114 | |
| 115 | /** |
| 116 | * \ingroup grp_hci_nfc |
| 117 | * |
| 118 | * \brief Allocates the resources required for SWP gate management. |
| 119 | * |
| 120 | * This function Allocates necessary resources as requiered by SWP gate management |
| 121 | * |
| 122 | * \param[in] psHciContext psHciContext is the pointer to HCI Layer |
| 123 | * |
| 124 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 125 | * |
| 126 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 127 | */ |
| 128 | |
| 129 | extern |
| 130 | NFCSTATUS |
| 131 | phHciNfc_SWPMgmt_Initialise( |
| 132 | phHciNfc_sContext_t *psHciContext, |
| 133 | void *pHwRef |
| 134 | ); |
| 135 | |
| 136 | /** |
| 137 | * \ingroup grp_hci_nfc |
| 138 | * |
| 139 | * \brief updates SWP gate specific pipe information . |
| 140 | * |
| 141 | * This function intialises gate specific informations like pipe id, |
| 142 | * event handler and response handler etc. |
| 143 | * |
| 144 | * \param[in] psHciContext psHciContext is the pointer to HCI Layer |
| 145 | * \param[in] pipeID pipeID of the SWP management Gate |
| 146 | * \param[in] pPipeInfo Update the pipe Information of the SWP |
| 147 | * Management Gate. |
| 148 | * |
| 149 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 150 | * |
| 151 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 152 | */ |
| 153 | extern |
| 154 | NFCSTATUS |
| 155 | phHciNfc_SWP_Update_PipeInfo( |
| 156 | phHciNfc_sContext_t *psHciContext, |
| 157 | uint8_t pipeID, |
| 158 | phHciNfc_Pipe_Info_t *pPipeInfo |
| 159 | ); |
| 160 | /** |
| 161 | * \ingroup grp_hci_nfc |
| 162 | * |
| 163 | * \brief updates SWP gate specific pipe information . |
| 164 | * |
| 165 | * This function intialises gate specific informations like pipe id, |
| 166 | * event handler and response handler etc. |
| 167 | * |
| 168 | * \param[in] psHciContext psHciContext is the pointer to HCI Layer |
| 169 | * |
| 170 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 171 | * |
| 172 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 173 | */ |
| 174 | |
| 175 | extern |
| 176 | NFCSTATUS |
| 177 | phHciNfc_SWP_Get_PipeID( |
| 178 | phHciNfc_sContext_t *psHciContext, |
| 179 | uint8_t *ppipe_id |
| 180 | ); |
| 181 | |
| 182 | /** |
| 183 | * \ingroup grp_hci_nfc |
| 184 | * |
| 185 | * \brief Enables /disables SWP mode . |
| 186 | * |
| 187 | * This function enables/disables SWP link associated with UICC. |
| 188 | * |
| 189 | * |
| 190 | * \param[in] psHciContext psHciContext is pointer to HCI Layer |
| 191 | * |
| 192 | * \param[in] pHwRef pHwRef is underlying Hardware context. |
| 193 | * |
| 194 | * \param[in] enable_type 0 means disable ,1 means enable SWP link. |
| 195 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 196 | * |
| 197 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 198 | */ |
| 199 | extern |
| 200 | NFCSTATUS |
| 201 | phHciNfc_SWP_Configure_Default( |
| 202 | void *psHciHandle, |
| 203 | void *pHwRef, |
| 204 | uint8_t enable_type |
| 205 | ); |
| 206 | |
| 207 | /** |
| 208 | * \ingroup grp_hci_nfc |
| 209 | * |
| 210 | * \brief Enables /disables SWP mode . |
| 211 | * |
| 212 | * This function enables/disables SWP link associated with UICC. |
| 213 | * |
| 214 | * |
| 215 | * \param[in] psHciContext psHciContext is pointer to HCI Layer |
| 216 | * |
| 217 | * \param[in] pHwRef pHwRef is underlying Hardware context. |
| 218 | * |
| 219 | * \param[in] mode TRUE Enable Protection. |
| 220 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 221 | * |
| 222 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 223 | */ |
| 224 | extern |
| 225 | NFCSTATUS |
| 226 | phHciNfc_SWP_Protection( |
| 227 | void *psHciHandle, |
| 228 | void *pHwRef, |
| 229 | uint8_t mode |
| 230 | ); |
| 231 | |
| 232 | |
| 233 | /** |
| 234 | * \ingroup grp_hci_nfc |
| 235 | * |
| 236 | * \brief To send the switch mode event |
| 237 | * |
| 238 | * This function send an event to change the switch mode. |
| 239 | * |
| 240 | * |
| 241 | * \param[in] psHciContext psHciContext is pointer to HCI Layer |
| 242 | * |
| 243 | * \param[in] pHwRef pHwRef is underlying Hardware context. |
| 244 | * |
| 245 | * \param[in] uicc_mode UICC_SWITCH_MODE_OFF |
| 246 | * UICC_SWITCH_MODE_DEFAULT |
| 247 | * UICC_SWITCH_MODE_ON |
| 248 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 249 | * |
| 250 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 251 | */ |
| 252 | extern |
| 253 | NFCSTATUS |
| 254 | phHciNfc_SWP_Configure_Mode( |
| 255 | void *psHciHandle, |
| 256 | void *pHwRef, |
| 257 | uint8_t uicc_mode |
| 258 | ); |
| 259 | |
| 260 | /** |
| 261 | * \ingroup grp_hci_nfc |
| 262 | * |
| 263 | * \brief To get the status of the UICC |
| 264 | * |
| 265 | * This function reads the status of the UICC. The status value can be any |
| 266 | * of the values present in the \ref phHciNfc_SWP_Status_t |
| 267 | * |
| 268 | * |
| 269 | * \param[in] psHciContext psHciContext is pointer to HCI Layer |
| 270 | * |
| 271 | * \param[in] pHwRef pHwRef is underlying Hardware context. |
| 272 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 273 | * |
| 274 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 275 | */ |
| 276 | extern |
| 277 | NFCSTATUS |
| 278 | phHciNfc_SWP_Get_Status( |
| 279 | void *psHciHandle, |
| 280 | void *pHwRef |
| 281 | ); |
| 282 | |
| 283 | /** |
| 284 | * \ingroup grp_hci_nfc |
| 285 | * |
| 286 | * \brief To get the bitrate |
| 287 | * |
| 288 | * This function reads the bitrate |
| 289 | * |
| 290 | * |
| 291 | * \param[in] psHciContext psHciContext is pointer to HCI Layer |
| 292 | * |
| 293 | * \param[in] pHwRef pHwRef is underlying Hardware context. |
| 294 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 295 | * |
| 296 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 297 | */ |
| 298 | extern |
| 299 | NFCSTATUS |
| 300 | phHciNfc_SWP_Get_Bitrate( |
| 301 | void *psHciHandle, |
| 302 | void *pHwRef |
| 303 | ); |
| 304 | |
| 305 | /** |
| 306 | * \ingroup grp_hci_nfc |
| 307 | * |
| 308 | * \brief To update the sequence |
| 309 | * |
| 310 | * This function reads the bitrate |
| 311 | * |
| 312 | * |
| 313 | * \param[in] psHciContext psHciContext is pointer to HCI Layer |
| 314 | * |
| 315 | * \param[in] SWP_seq SWP sequence. |
| 316 | * |
| 317 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 318 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 319 | */ |
| 320 | extern |
| 321 | NFCSTATUS |
| 322 | phHciNfc_SWP_Update_Sequence( |
| 323 | phHciNfc_sContext_t *psHciContext, |
| 324 | phHciNfc_eSeqType_t SWP_seq |
| 325 | ); |
| 326 | |
| 327 | /** |
| 328 | * \ingroup grp_hci_nfc |
| 329 | * |
| 330 | * \brief To configure default mode and the default status. |
| 331 | * |
| 332 | * This function configures default status and default mode. |
| 333 | * |
| 334 | * |
| 335 | * \param[in] psHciContext psHciContext is pointer to HCI Layer |
| 336 | * \param[in] pHwRef pHwRef is underlying Hardware context. |
| 337 | * \param[in] ps_emulation_cfg emulation configuration info. |
| 338 | * |
| 339 | * |
| 340 | * \retval NFCSTATUS_SUCCESS Function execution is successful |
| 341 | * |
| 342 | * \retval NFCSTATUS_INVALID_PARAMETER One or more of the given inputs are not valid |
| 343 | */ |
| 344 | extern |
| 345 | NFCSTATUS |
| 346 | phHciNfc_SWP_Config_Sequence( |
| 347 | phHciNfc_sContext_t *psHciContext, |
| 348 | void *pHwRef, |
| 349 | phHal_sEmulationCfg_t *ps_emulation_cfg |
| 350 | ); |
| 351 | |
| 352 | |
| 353 | #endif /* #ifndef PHHCINFC_SWP_H */ |
| 354 | |
| 355 | |