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* * 22* \file phHciNfc_Sequence.h * 23* \brief State Machine Management for the HCI and the Function Sequence * 24* for a particular State. * 25* * 26* * 27* Project: NFC-FRI-1.1 * 28* * 29* $Date: Fri Aug 14 17:01:28 2009 $ * 30* $Author: ing04880 $ * 31* $Revision: 1.12 $ * 32* $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 $ 33* * 34* =========================================================================== * 35*/ 36 37/*@{*/ 38#ifndef PHHCINFC_SEQUENCE_H 39#define PHHCINFC_SEQUENCE_H 40 41/*@}*/ 42 43 44/** 45 * \name HCI 46 * 47 * File: \ref phHciNfc_Sequence.h 48 * 49 */ 50 51/*@{*/ 52#define PHHCINFC_SEQUENCE_FILEREVISION "$Revision: 1.12 $" /**< \ingroup grp_file_attributes */ 53#define PHHCINFC_SEQUENCE_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 */ 54/*@}*/ 55 56 57/* 58################################################################################ 59***************************** Header File Inclusion **************************** 60################################################################################ 61*/ 62 63#include <phHciNfc_Generic.h> 64 65/* 66################################################################################ 67****************************** Macro Definitions ******************************* 68################################################################################ 69*/ 70 71/* 72################################################################################ 73************************* Function Prototype Declaration *********************** 74################################################################################ 75*/ 76 77 78/** 79 * \ingroup grp_hci_nfc 80 * 81 * The phHciNfc_FSM_Update function Validates the HCI State to 82 * the next operation ongoing. 83 * 84 * \param[in] psHciContext psHciContext is the context of 85 * the HCI Layer. 86 * \param[in] state state is the state to which the 87 * current HCI Layer state is validated. 88 * \param[in] validate_type validate the state by the type of the 89 * validation required. 90 * 91 * \retval NFCSTATUS_SUCCESS FSM Validated successfully . 92 * \retval NFCSTATUS_INVALID_STATE The supplied state parameter is invalid. 93 * 94 */ 95 96extern 97NFCSTATUS 98phHciNfc_FSM_Validate( 99 phHciNfc_sContext_t *psHciContext, 100 phHciNfc_eState_t state, 101 uint8_t validate_type 102 ); 103 104/** 105 * \ingroup grp_hci_nfc 106 * 107 * The phHciNfc_FSM_Update function Checks and Updates the HCI State to 108 * the next valid State. 109 * 110 * \param[in] psHciContext psHciContext is the context of 111 * the HCI Layer. 112 * \param[in] next_state next_state is the state to which 113 * we the HCI Layer. 114 * \param[in] transition transiton of the state whether 115 * ongoing or complete . 116 * 117 * \retval NFCSTATUS_SUCCESS FSM Updated successfully . 118 * \retval NFCSTATUS_INVALID_STATE The supplied state parameter is invalid. 119 * 120 */ 121 122extern 123NFCSTATUS 124phHciNfc_FSM_Update( 125 phHciNfc_sContext_t *psHciContext, 126 phHciNfc_eState_t next_state 127 ); 128 129/** 130 * \ingroup grp_hci_nfc 131 * 132 * The phHciNfc_FSM_Complete function completes the ongoing state transition 133 * from the current state to the next state. 134 * 135 * \param[in] psHciContext psHciContext is the context of 136 * the HCI Layer. 137 * 138 * \retval NFCSTATUS_SUCCESS FSM Updated successfully . 139 * \retval NFCSTATUS_INVALID_STATE The supplied state parameter is invalid. 140 * 141 */ 142 143extern 144NFCSTATUS 145phHciNfc_FSM_Complete( 146 phHciNfc_sContext_t *psHciContext 147 ); 148 149 150/** 151 * \ingroup grp_hci_nfc 152 * 153 * The phHciNfc_FSM_Rollback function rolls back to previous valid state 154 * and abort the ongoing state transition. 155 * 156 * \param[in] psHciContext psHciContext is the context of 157 * the HCI Layer. 158 * 159 * \retval NONE. 160 * 161 */ 162 163extern 164void 165phHciNfc_FSM_Rollback( 166 phHciNfc_sContext_t *psHciContext 167 ); 168 169 170 171/** 172 * \ingroup grp_hci_nfc 173 * 174 * The phHciNfc_Initialise_Sequence function sequence initialises the 175 * HCI layer and the remote device by performing the operations required 176 * setup the reader and discovery functionality. 177 * 178 * \param[in] psHciContext psHciContext is the context of 179 * the HCI Layer. 180 * \param[in] pHwRef pHwRef is the Information of 181 * the Device Interface Link . 182 * 183 * \retval NFCSTATUS_SUCCESS HCI current initialise sequence successful. 184 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 185 * could not be interpreted properly. 186 * \retval Other errors Other related errors 187 * 188 */ 189 190 191extern 192NFCSTATUS 193phHciNfc_Initialise_Sequence( 194 phHciNfc_sContext_t *psHciContext, 195 void *pHwRef 196 ); 197 198/** 199 * \ingroup grp_hci_nfc 200 * 201 * The phHciNfc_PollLoop_Sequence function sequence starts the 202 * discovery sequence of device. 203 * 204 * \param[in] psHciContext psHciContext is the context of 205 * the HCI Layer. 206 * \param[in] pHwRef pHwRef is the Information of 207 * the Device Interface Link . 208 * 209 * \retval NFCSTATUS_SUCCESS HCI Discovery Configuration sequence successful. 210 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 211 * could not be interpreted properly. 212 * \retval Other errors Other related errors 213 * 214 */ 215 216extern 217NFCSTATUS 218phHciNfc_PollLoop_Sequence( 219 phHciNfc_sContext_t *psHciContext, 220 void *pHwRef 221 ); 222 223 224/** 225 * \ingroup grp_hci_nfc 226 * 227 * The phHciNfc_EmulationCfg_Sequence function sequence configures the 228 * device for different types of emulation supported. 229 * 230 * \param[in] psHciContext psHciContext is the context of 231 * the HCI Layer. 232 * \param[in] pHwRef pHwRef is the Information of 233 * the Device Interface Link . 234 * 235 * \retval NFCSTATUS_SUCCESS HCI Emulation Configuration 236 * sequence successful. 237 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 238 * could not be interpreted properly. 239 * \retval Other errors Other related errors 240 * 241 */ 242 243extern 244NFCSTATUS 245phHciNfc_EmulationCfg_Sequence( 246 phHciNfc_sContext_t *psHciContext, 247 void *pHwRef 248 ); 249 250 251/** 252 * \ingroup grp_hci_nfc 253 * 254 * The phHciNfc_SmartMx_Mode_Sequence function sequence configures the 255 * SmartMx device for different modes by enabling and disabling polling. 256 * 257 * \param[in] psHciContext psHciContext is the context of 258 * the HCI Layer. 259 * \param[in] pHwRef pHwRef is the Information of 260 * the Device Interface Link . 261 * 262 * \retval NFCSTATUS_SUCCESS HCI SmartMX Mode Configuration 263 * sequence successful. 264 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 265 * could not be interpreted properly. 266 * \retval Other errors Other related errors 267 * 268 */ 269 270extern 271NFCSTATUS 272phHciNfc_SmartMx_Mode_Sequence( 273 phHciNfc_sContext_t *psHciContext, 274 void *pHwRef 275 ); 276 277 278/** 279 * \ingroup grp_hci_nfc 280 * 281 * The phHciNfc_Connect_Sequence function sequence selects the 282 * discovered target for performing the transaction. 283 * 284 * \param[in] psHciContext psHciContext is the context of 285 * the HCI Layer. 286 * \param[in] pHwRef pHwRef is the Information of 287 * the Device Interface Link . 288 * 289 * \retval NFCSTATUS_SUCCESS HCI target selection sequence successful. 290 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 291 * could not be interpreted properly. 292 * \retval Other errors Other related errors 293 * 294 */ 295 296extern 297NFCSTATUS 298phHciNfc_Connect_Sequence( 299 phHciNfc_sContext_t *psHciContext, 300 void *pHwRef 301 ); 302 303 304/** 305 * \ingroup grp_hci_nfc 306 * 307 * The phHciNfc_Disconnect_Sequence function sequence de-selects the 308 * selected target . 309 * 310 * \param[in] psHciContext psHciContext is the context of 311 * the HCI Layer. 312 * \param[in] pHwRef pHwRef is the Information of 313 * the Device Interface Link . 314 * 315 * \retval NFCSTATUS_SUCCESS HCI target de-selection sequence successful. 316 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 317 * could not be interpreted properly. 318 * \retval Other errors Other related errors 319 * 320 */ 321 322extern 323NFCSTATUS 324phHciNfc_Disconnect_Sequence( 325 phHciNfc_sContext_t *psHciContext, 326 void *pHwRef 327 ); 328 329/** 330 * \ingroup grp_hci_nfc 331 * 332 * The phHciNfc_Error_Sequence function sequence notifies the 333 * error in the HCI sequence to the upper layer . 334 * 335 * \param[in] psHciContext psHciContext is the context of 336 * the HCI Layer. 337 * \param[in] pHwRef pHwRef is the Information of 338 * the Device Interface Link . 339 * \param[in] status Notify status information from the 340 * HCI layer to the Upper Layer. 341 * 342 * 343 * \retval NFCSTATUS_SUCCESS HCI Error sequence Notification successful. 344 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 345 * could not be interpreted properly. 346 * \retval Other errors Other related errors 347 * 348 */ 349extern 350void 351phHciNfc_Error_Sequence( 352 void *psContext, 353 void *pHwRef, 354 NFCSTATUS error_status, 355 void *pdata, 356 uint8_t length 357 ); 358 359 360/** 361 * \ingroup grp_hci_nfc 362 * 363 * The phHciNfc_Resume_Sequence function sequence resumes the 364 * previous pending sequence of HCI . 365 * 366 * \param[in] psHciContext psHciContext is the context of 367 * the HCI Layer. 368 * \param[in] pHwRef pHwRef is the Information of 369 * the Device Interface Link . 370 * 371 * \retval NFCSTATUS_SUCCESS HCI sequence resume successful. 372 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 373 * could not be interpreted properly. 374 * \retval Other errors Other related errors 375 * 376 */ 377 378extern 379NFCSTATUS 380phHciNfc_Resume_Sequence( 381 phHciNfc_sContext_t *psHciContext, 382 void *pHwRef 383 ); 384 385 386/** 387 * \ingroup grp_hci_nfc 388 * 389 * The phHciNfc_Release_Sequence function sequence releases the 390 * HCI layer and the remote device by performing the operations required 391 * release the reader and discovery functionality. 392 * 393 * \param[in] psHciContext psHciContext is the context of 394 * the HCI Layer. 395 * \param[in] pHwRef pHwRef is the Information of 396 * the Device Interface Link . 397 * 398 * \retval NFCSTATUS_SUCCESS HCI current release sequence successful. 399 * \retval NFCSTATUS_INVALID_PARAMETER One or more of the supplied parameters 400 * could not be interpreted properly. 401 * \retval Other errors Other related errors 402 * 403 */ 404 405 406extern 407NFCSTATUS 408phHciNfc_Release_Sequence( 409 phHciNfc_sContext_t *psHciContext, 410 void *pHwRef 411 ); 412 413 414/* 415################################################################################ 416***************************** Function Definitions ***************************** 417################################################################################ 418*/ 419 420#endif 421 422