Fork of the GitHub
rfal_nfcb.h@0:75fc82583a41, 2019-11-14 (annotated)
- Committer:
- DiegoOstuni
- Date:
- Thu Nov 14 14:34:50 2019 +0000
- Revision:
- 0:75fc82583a41
Add files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DiegoOstuni | 0:75fc82583a41 | 1 | |
DiegoOstuni | 0:75fc82583a41 | 2 | /****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 3 | * @attention |
DiegoOstuni | 0:75fc82583a41 | 4 | * |
DiegoOstuni | 0:75fc82583a41 | 5 | * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> |
DiegoOstuni | 0:75fc82583a41 | 6 | * |
DiegoOstuni | 0:75fc82583a41 | 7 | * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License"); |
DiegoOstuni | 0:75fc82583a41 | 8 | * You may not use this file except in compliance with the License. |
DiegoOstuni | 0:75fc82583a41 | 9 | * You may obtain a copy of the License at: |
DiegoOstuni | 0:75fc82583a41 | 10 | * |
DiegoOstuni | 0:75fc82583a41 | 11 | * http://www.st.com/myliberty |
DiegoOstuni | 0:75fc82583a41 | 12 | * |
DiegoOstuni | 0:75fc82583a41 | 13 | * Unless required by applicable law or agreed to in writing, software |
DiegoOstuni | 0:75fc82583a41 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
DiegoOstuni | 0:75fc82583a41 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, |
DiegoOstuni | 0:75fc82583a41 | 16 | * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY, |
DiegoOstuni | 0:75fc82583a41 | 17 | * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. |
DiegoOstuni | 0:75fc82583a41 | 18 | * See the License for the specific language governing permissions and |
DiegoOstuni | 0:75fc82583a41 | 19 | * limitations under the License. |
DiegoOstuni | 0:75fc82583a41 | 20 | * |
DiegoOstuni | 0:75fc82583a41 | 21 | ******************************************************************************/ |
DiegoOstuni | 0:75fc82583a41 | 22 | |
DiegoOstuni | 0:75fc82583a41 | 23 | /* |
DiegoOstuni | 0:75fc82583a41 | 24 | * PROJECT: ST25R391x firmware |
DiegoOstuni | 0:75fc82583a41 | 25 | * $Revision: $ |
DiegoOstuni | 0:75fc82583a41 | 26 | * LANGUAGE: ISO C99 |
DiegoOstuni | 0:75fc82583a41 | 27 | */ |
DiegoOstuni | 0:75fc82583a41 | 28 | |
DiegoOstuni | 0:75fc82583a41 | 29 | /*! \file rfal_nfcb.h |
DiegoOstuni | 0:75fc82583a41 | 30 | * |
DiegoOstuni | 0:75fc82583a41 | 31 | * \author Gustavo Patricio |
DiegoOstuni | 0:75fc82583a41 | 32 | * |
DiegoOstuni | 0:75fc82583a41 | 33 | * \brief Implementation of NFC-B (ISO14443B) helpers |
DiegoOstuni | 0:75fc82583a41 | 34 | * |
DiegoOstuni | 0:75fc82583a41 | 35 | * It provides a NFC-B Poller (ISO14443B PCD) interface and |
DiegoOstuni | 0:75fc82583a41 | 36 | * also provides some NFC-B Listener (ISO14443B PICC) helpers |
DiegoOstuni | 0:75fc82583a41 | 37 | * |
DiegoOstuni | 0:75fc82583a41 | 38 | * The definitions and helpers methods provided by this module are only |
DiegoOstuni | 0:75fc82583a41 | 39 | * up to ISO14443-3 layer (excluding ATTRIB) |
DiegoOstuni | 0:75fc82583a41 | 40 | * |
DiegoOstuni | 0:75fc82583a41 | 41 | * |
DiegoOstuni | 0:75fc82583a41 | 42 | * @addtogroup RFAL |
DiegoOstuni | 0:75fc82583a41 | 43 | * @{ |
DiegoOstuni | 0:75fc82583a41 | 44 | * |
DiegoOstuni | 0:75fc82583a41 | 45 | * @addtogroup RFAL-AL |
DiegoOstuni | 0:75fc82583a41 | 46 | * @brief RFAL Abstraction Layer |
DiegoOstuni | 0:75fc82583a41 | 47 | * @{ |
DiegoOstuni | 0:75fc82583a41 | 48 | * |
DiegoOstuni | 0:75fc82583a41 | 49 | * @addtogroup NFC-B |
DiegoOstuni | 0:75fc82583a41 | 50 | * @brief RFAL NFC-B Module |
DiegoOstuni | 0:75fc82583a41 | 51 | * @{ |
DiegoOstuni | 0:75fc82583a41 | 52 | * |
DiegoOstuni | 0:75fc82583a41 | 53 | */ |
DiegoOstuni | 0:75fc82583a41 | 54 | |
DiegoOstuni | 0:75fc82583a41 | 55 | |
DiegoOstuni | 0:75fc82583a41 | 56 | #ifndef RFAL_NFCB_H |
DiegoOstuni | 0:75fc82583a41 | 57 | #define RFAL_NFCB_H |
DiegoOstuni | 0:75fc82583a41 | 58 | |
DiegoOstuni | 0:75fc82583a41 | 59 | /* |
DiegoOstuni | 0:75fc82583a41 | 60 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 61 | * INCLUDES |
DiegoOstuni | 0:75fc82583a41 | 62 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 63 | */ |
DiegoOstuni | 0:75fc82583a41 | 64 | #include "platform1.h" |
DiegoOstuni | 0:75fc82583a41 | 65 | #include "st_errno.h" |
DiegoOstuni | 0:75fc82583a41 | 66 | #include "rfal_rf.h" |
DiegoOstuni | 0:75fc82583a41 | 67 | |
DiegoOstuni | 0:75fc82583a41 | 68 | /* |
DiegoOstuni | 0:75fc82583a41 | 69 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 70 | * GLOBAL DEFINES |
DiegoOstuni | 0:75fc82583a41 | 71 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 72 | */ |
DiegoOstuni | 0:75fc82583a41 | 73 | |
DiegoOstuni | 0:75fc82583a41 | 74 | #define RFAL_NFCB_FWTSENSB 7680 /*!< NFC-B FWT(SENSB) Digital 1.1 A.3 */ |
DiegoOstuni | 0:75fc82583a41 | 75 | #define RFAL_NFCB_DTPOLL 49152 /*!< NFC-B Delta Tb Poll Digital 1.1 A.3 */ |
DiegoOstuni | 0:75fc82583a41 | 76 | #define RFAL_NFCB_DFWT_11 rfalConvMsTo1fc(17) /*!< NFC-B dFWT (16.4ms) Digital 1.1 A.3 */ |
DiegoOstuni | 0:75fc82583a41 | 77 | #define RFAL_NFCB_DFWT_10 rfalConvMsTo1fc(20) /*!< NFC-B dFWT (20ms) Digital 1.0 A.2 */ |
DiegoOstuni | 0:75fc82583a41 | 78 | |
DiegoOstuni | 0:75fc82583a41 | 79 | #define RFAL_NFCB_AFI 0x00 /*!< NFC-B default Application Family Digital 1.1 7.6.1.1 */ |
DiegoOstuni | 0:75fc82583a41 | 80 | #define RFAL_NFCB_PARAM 0x00 /*!< NFC-B default SENSB_REQ PARAM */ |
DiegoOstuni | 0:75fc82583a41 | 81 | #define RFAL_NFCB_CRC_LEN 2 /*!< NFC-B CRC length and CRC_B(AID) Digital 1.1 Table 28 */ |
DiegoOstuni | 0:75fc82583a41 | 82 | #define RFAL_NFCB_NFCID0_LEN 4 /*!< Length of NFC-B NFCID0 */ |
DiegoOstuni | 0:75fc82583a41 | 83 | #define RFAL_NFCB_CMD_LEN 1 /*!< Length of NFC-B Command */ |
DiegoOstuni | 0:75fc82583a41 | 84 | |
DiegoOstuni | 0:75fc82583a41 | 85 | #define RFAL_NFCB_SENSB_RES_LEN 12 /*!< Standard length of SENSB_RES without SFGI byte */ |
DiegoOstuni | 0:75fc82583a41 | 86 | #define RFAL_NFCB_SENSB_RES_EXT_LEN 13 /*!< Extended length of SENSB_RES with SFGI byte */ |
DiegoOstuni | 0:75fc82583a41 | 87 | |
DiegoOstuni | 0:75fc82583a41 | 88 | #define RFAL_NFCB_SENSB_REQ_ADV_FEATURE 0x20 /*!< Bit mask for Advance Feature in SENSB_REQ */ |
DiegoOstuni | 0:75fc82583a41 | 89 | #define RFAL_NFCB_SENSB_RES_FSCI_MASK 0x0F /*!< Bit mask for FSCI value in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 90 | #define RFAL_NFCB_SENSB_RES_FSCI_SHIFT 4 /*!< Shift for FSCI value in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 91 | #define RFAL_NFCB_SENSB_RES_PROTO_RFU_MASK 0x08 /*!< Bit mask for Protocol Type RFU in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 92 | #define RFAL_NFCB_SENSB_RES_PROTO_TR2_MASK 0x03 /*!< Bit mask for Protocol Type TR2 in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 93 | #define RFAL_NFCB_SENSB_RES_PROTO_TR2_SHIFT 1 /*!< Shift for Protocol Type TR2 in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 94 | #define RFAL_NFCB_SENSB_RES_PROTO_ISO_MASK 0x01 /*!< Bit mask Protocol Type ISO14443 Compliant in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 95 | #define RFAL_NFCB_SENSB_RES_FWI_MASK 0x0F /*!< Bit mask for FWI value in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 96 | #define RFAL_NFCB_SENSB_RES_FWI_SHIFT 4 /*!< Bit mask for FWI value in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 97 | #define RFAL_NFCB_SENSB_RES_ADC_MASK 0x0C /*!< Bit mask for ADC value in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 98 | #define RFAL_NFCB_SENSB_RES_ADC_ADV_FEATURE_MASK 0x08 /*!< Bit mask for ADC.Advanced Proto Features in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 99 | #define RFAL_NFCB_SENSB_RES_ADC_PROPRIETARY_MASK 0x04 /*!< Bit mask for ADC.Proprietary Application in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 100 | #define RFAL_NFCB_SENSB_RES_FO_DID_MASK 0x01 /*!< Bit mask for DID in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 101 | #define RFAL_NFCB_SENSB_RES_FO_NAD_MASK 0x02 /*!< Bit mask for DID in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 102 | #define RFAL_NFCB_SENSB_RES_FO_MASK 0x03 /*!< Bit mask for FO value in SENSB_RES (NAD and DID) */ |
DiegoOstuni | 0:75fc82583a41 | 103 | #define RFAL_NFCB_SENSB_RES_SFGI_MASK 0x0F /*!< Bit mask for SFGI in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 104 | #define RFAL_NFCB_SENSB_RES_SFGI_SHIFT 4 /*!< Shift for SFGI in SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 105 | |
DiegoOstuni | 0:75fc82583a41 | 106 | /* |
DiegoOstuni | 0:75fc82583a41 | 107 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 108 | * GLOBAL MACROS |
DiegoOstuni | 0:75fc82583a41 | 109 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 110 | */ |
DiegoOstuni | 0:75fc82583a41 | 111 | |
DiegoOstuni | 0:75fc82583a41 | 112 | /*! Get device's FSCI given its SENSB_RES Digital 1.1 7.6.2 */ |
DiegoOstuni | 0:75fc82583a41 | 113 | #define rfalNfcbGetFSCI( sensbRes ) ((((rfalNfcbSensbRes*)sensbRes)->protInfo.FsciProType >> RFAL_NFCB_SENSB_RES_FSCI_SHIFT) & RFAL_NFCB_SENSB_RES_FSCI_MASK ) |
DiegoOstuni | 0:75fc82583a41 | 114 | |
DiegoOstuni | 0:75fc82583a41 | 115 | /* |
DiegoOstuni | 0:75fc82583a41 | 116 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 117 | * GLOBAL TYPES |
DiegoOstuni | 0:75fc82583a41 | 118 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 119 | */ |
DiegoOstuni | 0:75fc82583a41 | 120 | |
DiegoOstuni | 0:75fc82583a41 | 121 | /*! SENSB_REQ and ALLB_REQ param Digital 1.1 7.6.1 */ |
DiegoOstuni | 0:75fc82583a41 | 122 | typedef enum |
DiegoOstuni | 0:75fc82583a41 | 123 | { |
DiegoOstuni | 0:75fc82583a41 | 124 | RFAL_NFCB_SENS_CMD_ALLB_REQ = 0x08, /*!< ALLB_REQ (WUPB) */ |
DiegoOstuni | 0:75fc82583a41 | 125 | RFAL_NFCB_SENS_CMD_SENSB_REQ = 0x00 /*!< SENSB_REQ (REQB) */ |
DiegoOstuni | 0:75fc82583a41 | 126 | } rfalNfcbSensCmd; |
DiegoOstuni | 0:75fc82583a41 | 127 | |
DiegoOstuni | 0:75fc82583a41 | 128 | |
DiegoOstuni | 0:75fc82583a41 | 129 | /*! Number of Slots (NI) codes used for NFC-B anti collision Digital 1.1 Table 26 */ |
DiegoOstuni | 0:75fc82583a41 | 130 | typedef enum |
DiegoOstuni | 0:75fc82583a41 | 131 | { |
DiegoOstuni | 0:75fc82583a41 | 132 | RFAL_NFCB_SLOT_NUM_1 = 0, /*!< N=0 : 1 slot */ |
DiegoOstuni | 0:75fc82583a41 | 133 | RFAL_NFCB_SLOT_NUM_2 = 1, /*!< N=1 : 2 slots */ |
DiegoOstuni | 0:75fc82583a41 | 134 | RFAL_NFCB_SLOT_NUM_4 = 2, /*!< N=2 : 4 slots */ |
DiegoOstuni | 0:75fc82583a41 | 135 | RFAL_NFCB_SLOT_NUM_8 = 3, /*!< N=3 : 8 slots */ |
DiegoOstuni | 0:75fc82583a41 | 136 | RFAL_NFCB_SLOT_NUM_16 = 4 /*!< N=4 : 16 slots */ |
DiegoOstuni | 0:75fc82583a41 | 137 | }rfalNfcbSlots; |
DiegoOstuni | 0:75fc82583a41 | 138 | |
DiegoOstuni | 0:75fc82583a41 | 139 | |
DiegoOstuni | 0:75fc82583a41 | 140 | /*! SENSB_RES (ATQB) Application Data Format Digital 1.1 Table 28 */ |
DiegoOstuni | 0:75fc82583a41 | 141 | typedef struct |
DiegoOstuni | 0:75fc82583a41 | 142 | { |
DiegoOstuni | 0:75fc82583a41 | 143 | uint8_t AFI; /*!< Application Family Identifier */ |
DiegoOstuni | 0:75fc82583a41 | 144 | uint8_t CRC_B[RFAL_NFCB_CRC_LEN]; /*!< CRC_B of AID */ |
DiegoOstuni | 0:75fc82583a41 | 145 | uint8_t numApps; /*!< Number of Applications */ |
DiegoOstuni | 0:75fc82583a41 | 146 | } rfalNfcbSensbResAppData; |
DiegoOstuni | 0:75fc82583a41 | 147 | |
DiegoOstuni | 0:75fc82583a41 | 148 | |
DiegoOstuni | 0:75fc82583a41 | 149 | /*! SENSB_RES Protocol Info format Digital 1.1 Table 29 */ |
DiegoOstuni | 0:75fc82583a41 | 150 | typedef struct |
DiegoOstuni | 0:75fc82583a41 | 151 | { |
DiegoOstuni | 0:75fc82583a41 | 152 | uint8_t BRC; /*!< Bit Rate Capability */ |
DiegoOstuni | 0:75fc82583a41 | 153 | uint8_t FsciProType; /*!< Frame Size Card Integer [4b] | Protocol Type[4 bits] */ |
DiegoOstuni | 0:75fc82583a41 | 154 | uint8_t FwiAdcFo; /*!< Frame Waiting Integer [4b] | Application Data Coding [2b] | Frame Options [2b] */ |
DiegoOstuni | 0:75fc82583a41 | 155 | uint8_t SFGI; /*!< Optional: Start-Up Frame Guard Time Integer[4b] | RFU [4b] */ |
DiegoOstuni | 0:75fc82583a41 | 156 | } rfalNfcbSensbResProtocolInfo; |
DiegoOstuni | 0:75fc82583a41 | 157 | |
DiegoOstuni | 0:75fc82583a41 | 158 | |
DiegoOstuni | 0:75fc82583a41 | 159 | /*! SENSB_RES format Digital 1.1 7.6.2 */ |
DiegoOstuni | 0:75fc82583a41 | 160 | typedef struct |
DiegoOstuni | 0:75fc82583a41 | 161 | { |
DiegoOstuni | 0:75fc82583a41 | 162 | uint8_t cmd; /*!< SENSB_RES: 50h */ |
DiegoOstuni | 0:75fc82583a41 | 163 | uint8_t nfcid0[RFAL_NFCB_NFCID0_LEN]; /*!< NFC Identifier (PUPI)*/ |
DiegoOstuni | 0:75fc82583a41 | 164 | rfalNfcbSensbResAppData appData; /*!< Application Data */ |
DiegoOstuni | 0:75fc82583a41 | 165 | rfalNfcbSensbResProtocolInfo protInfo; /*!< Protocol Information */ |
DiegoOstuni | 0:75fc82583a41 | 166 | } rfalNfcbSensbRes; |
DiegoOstuni | 0:75fc82583a41 | 167 | |
DiegoOstuni | 0:75fc82583a41 | 168 | |
DiegoOstuni | 0:75fc82583a41 | 169 | /*! NFC-B listener device (PICC) struct */ |
DiegoOstuni | 0:75fc82583a41 | 170 | typedef struct |
DiegoOstuni | 0:75fc82583a41 | 171 | { |
DiegoOstuni | 0:75fc82583a41 | 172 | uint8_t sensbResLen; /*!< SENSB_RES length */ |
DiegoOstuni | 0:75fc82583a41 | 173 | rfalNfcbSensbRes sensbRes; /*!< SENSB_RES */ |
DiegoOstuni | 0:75fc82583a41 | 174 | bool isSleep; /*!< Device sleeping flag */ |
DiegoOstuni | 0:75fc82583a41 | 175 | }rfalNfcbListenDevice; |
DiegoOstuni | 0:75fc82583a41 | 176 | |
DiegoOstuni | 0:75fc82583a41 | 177 | /* |
DiegoOstuni | 0:75fc82583a41 | 178 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 179 | * GLOBAL FUNCTION PROTOTYPES |
DiegoOstuni | 0:75fc82583a41 | 180 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 181 | */ |
DiegoOstuni | 0:75fc82583a41 | 182 | |
DiegoOstuni | 0:75fc82583a41 | 183 | /*! |
DiegoOstuni | 0:75fc82583a41 | 184 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 185 | * \brief Initialize NFC-B Poller mode |
DiegoOstuni | 0:75fc82583a41 | 186 | * |
DiegoOstuni | 0:75fc82583a41 | 187 | * This methods configures RFAL RF layer to perform as a |
DiegoOstuni | 0:75fc82583a41 | 188 | * NFC-B Poller/RW (ISO14443B PCD) including all default timings |
DiegoOstuni | 0:75fc82583a41 | 189 | * |
DiegoOstuni | 0:75fc82583a41 | 190 | * It sets NFC-B parameters (AFI, PARAM) to default values |
DiegoOstuni | 0:75fc82583a41 | 191 | * |
DiegoOstuni | 0:75fc82583a41 | 192 | * \return ERR_WRONG_STATE : RFAL not initialized or mode not set |
DiegoOstuni | 0:75fc82583a41 | 193 | * \return ERR_NONE : No error |
DiegoOstuni | 0:75fc82583a41 | 194 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 195 | */ |
DiegoOstuni | 0:75fc82583a41 | 196 | ReturnCode rfalNfcbPollerInitialize( SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 ); |
DiegoOstuni | 0:75fc82583a41 | 197 | |
DiegoOstuni | 0:75fc82583a41 | 198 | |
DiegoOstuni | 0:75fc82583a41 | 199 | /*! |
DiegoOstuni | 0:75fc82583a41 | 200 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 201 | * \brief Set NFC-B Poller parameters |
DiegoOstuni | 0:75fc82583a41 | 202 | * |
DiegoOstuni | 0:75fc82583a41 | 203 | * This methods configures RFAL RF layer to perform as a |
DiegoOstuni | 0:75fc82583a41 | 204 | * NFCA Poller/RW (ISO14443A PCD) including all default timings |
DiegoOstuni | 0:75fc82583a41 | 205 | * |
DiegoOstuni | 0:75fc82583a41 | 206 | * Additionally configures NFC-B specific parameters to be used on the |
DiegoOstuni | 0:75fc82583a41 | 207 | * following communications |
DiegoOstuni | 0:75fc82583a41 | 208 | * |
DiegoOstuni | 0:75fc82583a41 | 209 | * \param[in] AFI : Application Family Identifier to be used |
DiegoOstuni | 0:75fc82583a41 | 210 | * \param[in] PARAM : PARAM to be used, it announces whether Advanced |
DiegoOstuni | 0:75fc82583a41 | 211 | * Features or Extended SENSB_RES is supported |
DiegoOstuni | 0:75fc82583a41 | 212 | * |
DiegoOstuni | 0:75fc82583a41 | 213 | * \return ERR_WRONG_STATE : RFAL not initialized or mode not set |
DiegoOstuni | 0:75fc82583a41 | 214 | * \return ERR_NONE : No error |
DiegoOstuni | 0:75fc82583a41 | 215 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 216 | */ |
DiegoOstuni | 0:75fc82583a41 | 217 | ReturnCode rfalNfcbPollerInitializeWithParams( uint8_t AFI, uint8_t PARAM, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 ); |
DiegoOstuni | 0:75fc82583a41 | 218 | |
DiegoOstuni | 0:75fc82583a41 | 219 | |
DiegoOstuni | 0:75fc82583a41 | 220 | /*! |
DiegoOstuni | 0:75fc82583a41 | 221 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 222 | * \brief NFC-B Poller Check Presence |
DiegoOstuni | 0:75fc82583a41 | 223 | * |
DiegoOstuni | 0:75fc82583a41 | 224 | * This method checks if a NFC-B Listen device (PICC) is present on the field |
DiegoOstuni | 0:75fc82583a41 | 225 | * by sending an ALLB_REQ (WUPB) or SENSB_REQ (REQB) |
DiegoOstuni | 0:75fc82583a41 | 226 | * |
DiegoOstuni | 0:75fc82583a41 | 227 | * \param[in] cmd : Indicate if to send an ALL_REQ or a SENS_REQ |
DiegoOstuni | 0:75fc82583a41 | 228 | * \param[in] slots : The number of slots to be announced |
DiegoOstuni | 0:75fc82583a41 | 229 | * \param[out] sensbRes : If received, the SENSB_RES |
DiegoOstuni | 0:75fc82583a41 | 230 | * \param[out] sensbResLen : If received, the SENSB_RES length |
DiegoOstuni | 0:75fc82583a41 | 231 | * |
DiegoOstuni | 0:75fc82583a41 | 232 | * |
DiegoOstuni | 0:75fc82583a41 | 233 | * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode |
DiegoOstuni | 0:75fc82583a41 | 234 | * \return ERR_PARAM : Invalid parameters |
DiegoOstuni | 0:75fc82583a41 | 235 | * \return ERR_IO : Generic internal error |
DiegoOstuni | 0:75fc82583a41 | 236 | * \return ERR_TIMEOUT : Timeout error, no listener device detected |
DiegoOstuni | 0:75fc82583a41 | 237 | * \return ERR_RF_COLLISION : Collision detected one or more device in the field |
DiegoOstuni | 0:75fc82583a41 | 238 | * \return ERR_PAR : Parity error detected, one or more device in the field |
DiegoOstuni | 0:75fc82583a41 | 239 | * \return ERR_CRC : CRC error detected, one or more device in the field |
DiegoOstuni | 0:75fc82583a41 | 240 | * \return ERR_FRAMING : Framing error detected, one or more device in the field |
DiegoOstuni | 0:75fc82583a41 | 241 | * \return ERR_PROTO : Protocol error detected, invalid SENSB_RES received |
DiegoOstuni | 0:75fc82583a41 | 242 | * \return ERR_NONE : No error, SENSB_RES received |
DiegoOstuni | 0:75fc82583a41 | 243 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 244 | */ |
DiegoOstuni | 0:75fc82583a41 | 245 | ReturnCode rfalNfcbPollerCheckPresence( rfalNfcbSensCmd cmd, rfalNfcbSlots slots, rfalNfcbSensbRes *sensbRes, uint8_t *sensbResLen, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 ); |
DiegoOstuni | 0:75fc82583a41 | 246 | |
DiegoOstuni | 0:75fc82583a41 | 247 | |
DiegoOstuni | 0:75fc82583a41 | 248 | /*! |
DiegoOstuni | 0:75fc82583a41 | 249 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 250 | * \brief NFC-B Poller Sleep |
DiegoOstuni | 0:75fc82583a41 | 251 | * |
DiegoOstuni | 0:75fc82583a41 | 252 | * This function is used to send the SLPB_REQ (HLTB) command to put the PICC with |
DiegoOstuni | 0:75fc82583a41 | 253 | * the given NFCID0 to state HALT so that they do not reply to further SENSB_REQ |
DiegoOstuni | 0:75fc82583a41 | 254 | * commands (only to ALLB_REQ) |
DiegoOstuni | 0:75fc82583a41 | 255 | * |
DiegoOstuni | 0:75fc82583a41 | 256 | * \param[in] nfcid0 : NFCID of the device to be put to Sleep |
DiegoOstuni | 0:75fc82583a41 | 257 | * |
DiegoOstuni | 0:75fc82583a41 | 258 | * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode |
DiegoOstuni | 0:75fc82583a41 | 259 | * \return ERR_PARAM : Invalid parameters |
DiegoOstuni | 0:75fc82583a41 | 260 | * \return ERR_IO : Generic internal error |
DiegoOstuni | 0:75fc82583a41 | 261 | * \return ERR_NONE : No error |
DiegoOstuni | 0:75fc82583a41 | 262 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 263 | */ |
DiegoOstuni | 0:75fc82583a41 | 264 | ReturnCode rfalNfcbPollerSleep( uint8_t* nfcid0, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 ); |
DiegoOstuni | 0:75fc82583a41 | 265 | |
DiegoOstuni | 0:75fc82583a41 | 266 | |
DiegoOstuni | 0:75fc82583a41 | 267 | /*! |
DiegoOstuni | 0:75fc82583a41 | 268 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 269 | * \brief NFC-B Poller Slot Marker |
DiegoOstuni | 0:75fc82583a41 | 270 | * |
DiegoOstuni | 0:75fc82583a41 | 271 | * This method selects a NFC-B Slot marker frame |
DiegoOstuni | 0:75fc82583a41 | 272 | * |
DiegoOstuni | 0:75fc82583a41 | 273 | * \param[in] slotCode : Slot Code [1-15] |
DiegoOstuni | 0:75fc82583a41 | 274 | * \param[out] sensbRes : If received, the SENSB_RES |
DiegoOstuni | 0:75fc82583a41 | 275 | * \param[out] sensbResLen : If received, the SENSB_RES length |
DiegoOstuni | 0:75fc82583a41 | 276 | * |
DiegoOstuni | 0:75fc82583a41 | 277 | * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode |
DiegoOstuni | 0:75fc82583a41 | 278 | * \return ERR_PARAM : Invalid parameters |
DiegoOstuni | 0:75fc82583a41 | 279 | * \return ERR_IO : Generic internal error |
DiegoOstuni | 0:75fc82583a41 | 280 | * \return ERR_TIMEOUT : Timeout error |
DiegoOstuni | 0:75fc82583a41 | 281 | * \return ERR_PAR : Parity error detected |
DiegoOstuni | 0:75fc82583a41 | 282 | * \return ERR_CRC : CRC error detected |
DiegoOstuni | 0:75fc82583a41 | 283 | * \return ERR_FRAMING : Framing error detected |
DiegoOstuni | 0:75fc82583a41 | 284 | * \return ERR_PROTO : Protocol error detected |
DiegoOstuni | 0:75fc82583a41 | 285 | * \return ERR_NONE : No error, SEL_RES received |
DiegoOstuni | 0:75fc82583a41 | 286 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 287 | */ |
DiegoOstuni | 0:75fc82583a41 | 288 | ReturnCode rfalNfcbPollerSlotMarker( uint8_t slotCode, rfalNfcbSensbRes *sensbRes, uint8_t *sensbResLen, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 ); |
DiegoOstuni | 0:75fc82583a41 | 289 | |
DiegoOstuni | 0:75fc82583a41 | 290 | /*! |
DiegoOstuni | 0:75fc82583a41 | 291 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 292 | * \brief NFC-B Technology Detection |
DiegoOstuni | 0:75fc82583a41 | 293 | * |
DiegoOstuni | 0:75fc82583a41 | 294 | * This method performs NFC-B Technology Detection as defined in the spec |
DiegoOstuni | 0:75fc82583a41 | 295 | * given in the compliance mode |
DiegoOstuni | 0:75fc82583a41 | 296 | * |
DiegoOstuni | 0:75fc82583a41 | 297 | * \param[in] compMode : compliance mode to be performed |
DiegoOstuni | 0:75fc82583a41 | 298 | * \param[out] sensbRes : location to store the SENSB_RES, if received |
DiegoOstuni | 0:75fc82583a41 | 299 | * \param[out] sensbResLen : length of the SENSB_RES, if received |
DiegoOstuni | 0:75fc82583a41 | 300 | * |
DiegoOstuni | 0:75fc82583a41 | 301 | * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode |
DiegoOstuni | 0:75fc82583a41 | 302 | * \return ERR_PARAM : Invalid parameters |
DiegoOstuni | 0:75fc82583a41 | 303 | * \return ERR_IO : Generic internal error |
DiegoOstuni | 0:75fc82583a41 | 304 | * \return ERR_NONE : No error, one or more device in the field |
DiegoOstuni | 0:75fc82583a41 | 305 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 306 | */ |
DiegoOstuni | 0:75fc82583a41 | 307 | ReturnCode rfalNfcbPollerTechnologyDetection( rfalComplianceMode compMode, rfalNfcbSensbRes *sensbRes, uint8_t *sensbResLen, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 ); |
DiegoOstuni | 0:75fc82583a41 | 308 | |
DiegoOstuni | 0:75fc82583a41 | 309 | /*! |
DiegoOstuni | 0:75fc82583a41 | 310 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 311 | * \brief NFC-B Poller Collision Resolution |
DiegoOstuni | 0:75fc82583a41 | 312 | * |
DiegoOstuni | 0:75fc82583a41 | 313 | * NFC-B Collision resolution Listener device/card (PICC) as |
DiegoOstuni | 0:75fc82583a41 | 314 | * defined in Activity 1.1 9.3.5 |
DiegoOstuni | 0:75fc82583a41 | 315 | * |
DiegoOstuni | 0:75fc82583a41 | 316 | * This function is used to perform collision resolution for detection in case |
DiegoOstuni | 0:75fc82583a41 | 317 | * of multiple NFC Forum Devices with Technology B detected. |
DiegoOstuni | 0:75fc82583a41 | 318 | * Target with valid SENSB_RES will be stored in devInfo and nfcbDevCount incremented. |
DiegoOstuni | 0:75fc82583a41 | 319 | * |
DiegoOstuni | 0:75fc82583a41 | 320 | * \param[in] compMode : compliance mode to be performed |
DiegoOstuni | 0:75fc82583a41 | 321 | * \param[in] devLimit : device limit value, and size nfcbDevList |
DiegoOstuni | 0:75fc82583a41 | 322 | * \param[out] nfcbDevList : NFC-B listener device info |
DiegoOstuni | 0:75fc82583a41 | 323 | * \param[out] devCnt : devices found counter |
DiegoOstuni | 0:75fc82583a41 | 324 | * |
DiegoOstuni | 0:75fc82583a41 | 325 | * \return ERR_WRONG_STATE : RFAL not initialized or mode not set |
DiegoOstuni | 0:75fc82583a41 | 326 | * \return ERR_PARAM : Invalid parameters |
DiegoOstuni | 0:75fc82583a41 | 327 | * \return ERR_IO : Generic internal error |
DiegoOstuni | 0:75fc82583a41 | 328 | * \return ERR_PROTO : Protocol error detected |
DiegoOstuni | 0:75fc82583a41 | 329 | * \return ERR_NONE : No error |
DiegoOstuni | 0:75fc82583a41 | 330 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 331 | */ |
DiegoOstuni | 0:75fc82583a41 | 332 | ReturnCode rfalNfcbPollerCollisionResolution( rfalComplianceMode compMode, uint8_t devLimit, rfalNfcbListenDevice *nfcbDevList, uint8_t *devCnt, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 ); |
DiegoOstuni | 0:75fc82583a41 | 333 | |
DiegoOstuni | 0:75fc82583a41 | 334 | /*! |
DiegoOstuni | 0:75fc82583a41 | 335 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 336 | * \brief NFC-B Poller Collision Resolution Slotted |
DiegoOstuni | 0:75fc82583a41 | 337 | * |
DiegoOstuni | 0:75fc82583a41 | 338 | * NFC-B Collision resolution Listener device/card (PICC). The sequence can |
DiegoOstuni | 0:75fc82583a41 | 339 | * be configured to be according to NFC Forum Activity 1.1 9.3.5, ISO10373 |
DiegoOstuni | 0:75fc82583a41 | 340 | * or EMVCo |
DiegoOstuni | 0:75fc82583a41 | 341 | * |
DiegoOstuni | 0:75fc82583a41 | 342 | * This function is used to perform collision resolution for detection in case |
DiegoOstuni | 0:75fc82583a41 | 343 | * of multiple NFC Forum Devices with Technology B are detected. |
DiegoOstuni | 0:75fc82583a41 | 344 | * Target with valid SENSB_RES will be stored in devInfo and nfcbDevCount incremented. |
DiegoOstuni | 0:75fc82583a41 | 345 | * |
DiegoOstuni | 0:75fc82583a41 | 346 | * This method provides the means to perform a collision resolution loop with specific |
DiegoOstuni | 0:75fc82583a41 | 347 | * initial and end number of slots. This allows to user to start the loop already with |
DiegoOstuni | 0:75fc82583a41 | 348 | * greater number of slots, and or limit the end number of slots. At the end a flag |
DiegoOstuni | 0:75fc82583a41 | 349 | * indicating whether there were collisions pending is returned. |
DiegoOstuni | 0:75fc82583a41 | 350 | * |
DiegoOstuni | 0:75fc82583a41 | 351 | * If RFAL_COMPLIANCE_MODE_ISO is used \a initSlots must be set to RFAL_NFCB_SLOT_NUM_1 |
DiegoOstuni | 0:75fc82583a41 | 352 | * |
DiegoOstuni | 0:75fc82583a41 | 353 | * |
DiegoOstuni | 0:75fc82583a41 | 354 | * \param[in] compMode : compliance mode to be performed |
DiegoOstuni | 0:75fc82583a41 | 355 | * \param[in] devLimit : device limit value, and size nfcbDevList |
DiegoOstuni | 0:75fc82583a41 | 356 | * \param[in] initSlots : number of slots to open initially |
DiegoOstuni | 0:75fc82583a41 | 357 | * \param[in] endSlots : number of slots when to stop collision resolution |
DiegoOstuni | 0:75fc82583a41 | 358 | * \param[out] nfcbDevList : NFC-B listener device info |
DiegoOstuni | 0:75fc82583a41 | 359 | * \param[out] devCnt : devices found counter |
DiegoOstuni | 0:75fc82583a41 | 360 | * \param[out] colPending : flag indicating whether collision are still pending |
DiegoOstuni | 0:75fc82583a41 | 361 | * |
DiegoOstuni | 0:75fc82583a41 | 362 | * \return ERR_WRONG_STATE : RFAL not initialized or mode not set |
DiegoOstuni | 0:75fc82583a41 | 363 | * \return ERR_PARAM : Invalid parameters |
DiegoOstuni | 0:75fc82583a41 | 364 | * \return ERR_IO : Generic internal error |
DiegoOstuni | 0:75fc82583a41 | 365 | * \return ERR_PROTO : Protocol error detected |
DiegoOstuni | 0:75fc82583a41 | 366 | * \return ERR_NONE : No error |
DiegoOstuni | 0:75fc82583a41 | 367 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 368 | */ |
DiegoOstuni | 0:75fc82583a41 | 369 | ReturnCode rfalNfcbPollerCollisionResolutionSlotted( rfalComplianceMode compMode, uint8_t devLimit, rfalNfcbSlots initSlots, rfalNfcbSlots endSlots, rfalNfcbListenDevice *nfcbDevList, uint8_t *devCnt, bool *colPending, SPI* mspiChannel, ST25R3911* mST25, DigitalOut* gpio_cs, InterruptIn* IRQ, DigitalOut* fieldLED_01, DigitalOut* fieldLED_02, DigitalOut* fieldLED_03, DigitalOut* fieldLED_04, DigitalOut* fieldLED_05, DigitalOut* fieldLED_06 ); |
DiegoOstuni | 0:75fc82583a41 | 370 | |
DiegoOstuni | 0:75fc82583a41 | 371 | |
DiegoOstuni | 0:75fc82583a41 | 372 | /*! |
DiegoOstuni | 0:75fc82583a41 | 373 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 374 | * \brief NFC-B TR2 code to FDT |
DiegoOstuni | 0:75fc82583a41 | 375 | * |
DiegoOstuni | 0:75fc82583a41 | 376 | * Converts the TR2 code as defined in Digital 1.1 Table 33 Minimum |
DiegoOstuni | 0:75fc82583a41 | 377 | * TR2 Coding to Frame Delay Time (FDT) in 1/Fc |
DiegoOstuni | 0:75fc82583a41 | 378 | * |
DiegoOstuni | 0:75fc82583a41 | 379 | * \param[in] tr2Code : TR2 code as defined in Digital 1.1 Table 33 |
DiegoOstuni | 0:75fc82583a41 | 380 | * |
DiegoOstuni | 0:75fc82583a41 | 381 | * \return FDT in 1/Fc |
DiegoOstuni | 0:75fc82583a41 | 382 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 383 | */ |
DiegoOstuni | 0:75fc82583a41 | 384 | uint32_t rfalNfcbTR2ToFDT( uint8_t tr2Code ); |
DiegoOstuni | 0:75fc82583a41 | 385 | |
DiegoOstuni | 0:75fc82583a41 | 386 | |
DiegoOstuni | 0:75fc82583a41 | 387 | #endif /* RFAL_NFCB_H */ |
DiegoOstuni | 0:75fc82583a41 | 388 | |
DiegoOstuni | 0:75fc82583a41 | 389 | /** |
DiegoOstuni | 0:75fc82583a41 | 390 | * @} |
DiegoOstuni | 0:75fc82583a41 | 391 | * |
DiegoOstuni | 0:75fc82583a41 | 392 | * @} |
DiegoOstuni | 0:75fc82583a41 | 393 | * |
DiegoOstuni | 0:75fc82583a41 | 394 | * @} |
DiegoOstuni | 0:75fc82583a41 | 395 | */ |