Fork of the GitHub
rfal_nfcf.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_nfcf.h |
DiegoOstuni | 0:75fc82583a41 | 30 | * |
DiegoOstuni | 0:75fc82583a41 | 31 | * \author Gustavo Patricio |
DiegoOstuni | 0:75fc82583a41 | 32 | * |
DiegoOstuni | 0:75fc82583a41 | 33 | * \brief Implementation of NFC-F Poller (FeliCa PCD) device |
DiegoOstuni | 0:75fc82583a41 | 34 | * |
DiegoOstuni | 0:75fc82583a41 | 35 | * The definitions and helpers methods provided by this module are |
DiegoOstuni | 0:75fc82583a41 | 36 | * aligned with NFC-F (FeliCa - JIS X6319-4) |
DiegoOstuni | 0:75fc82583a41 | 37 | * |
DiegoOstuni | 0:75fc82583a41 | 38 | * |
DiegoOstuni | 0:75fc82583a41 | 39 | * @addtogroup RFAL |
DiegoOstuni | 0:75fc82583a41 | 40 | * @{ |
DiegoOstuni | 0:75fc82583a41 | 41 | * |
DiegoOstuni | 0:75fc82583a41 | 42 | * @addtogroup RFAL-AL |
DiegoOstuni | 0:75fc82583a41 | 43 | * @brief RFAL Abstraction Layer |
DiegoOstuni | 0:75fc82583a41 | 44 | * @{ |
DiegoOstuni | 0:75fc82583a41 | 45 | * |
DiegoOstuni | 0:75fc82583a41 | 46 | * @addtogroup NFC-F |
DiegoOstuni | 0:75fc82583a41 | 47 | * @brief RFAL NFC-F Module |
DiegoOstuni | 0:75fc82583a41 | 48 | * @{ |
DiegoOstuni | 0:75fc82583a41 | 49 | * |
DiegoOstuni | 0:75fc82583a41 | 50 | */ |
DiegoOstuni | 0:75fc82583a41 | 51 | |
DiegoOstuni | 0:75fc82583a41 | 52 | |
DiegoOstuni | 0:75fc82583a41 | 53 | #ifndef RFAL_NFCF_H |
DiegoOstuni | 0:75fc82583a41 | 54 | #define RFAL_NFCF_H |
DiegoOstuni | 0:75fc82583a41 | 55 | |
DiegoOstuni | 0:75fc82583a41 | 56 | /* |
DiegoOstuni | 0:75fc82583a41 | 57 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 58 | * INCLUDES |
DiegoOstuni | 0:75fc82583a41 | 59 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 60 | */ |
DiegoOstuni | 0:75fc82583a41 | 61 | #include "platform1.h" |
DiegoOstuni | 0:75fc82583a41 | 62 | #include "st_errno.h" |
DiegoOstuni | 0:75fc82583a41 | 63 | #include "rfal_rf.h" |
DiegoOstuni | 0:75fc82583a41 | 64 | |
DiegoOstuni | 0:75fc82583a41 | 65 | /* |
DiegoOstuni | 0:75fc82583a41 | 66 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 67 | * GLOBAL DEFINES |
DiegoOstuni | 0:75fc82583a41 | 68 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 69 | */ |
DiegoOstuni | 0:75fc82583a41 | 70 | |
DiegoOstuni | 0:75fc82583a41 | 71 | #define RFAL_NFCF_NFCID2_LEN 8 /*!< NFCID2 (FeliCa IDm) length */ |
DiegoOstuni | 0:75fc82583a41 | 72 | #define RFAL_NFCF_SENSF_RES_LEN_MIN 16 /*!< SENSF_RES minimum length */ |
DiegoOstuni | 0:75fc82583a41 | 73 | #define RFAL_NFCF_SENSF_RES_LEN_MAX 18 /*!< SENSF_RES maximum length */ |
DiegoOstuni | 0:75fc82583a41 | 74 | #define RFAL_NFCF_SENSF_RES_PAD0_LEN 2 /*!< SENSF_RES PAD0 length */ |
DiegoOstuni | 0:75fc82583a41 | 75 | #define RFAL_NFCF_SENSF_RES_PAD1_LEN 2 /*!< SENSF_RES PAD1 length */ |
DiegoOstuni | 0:75fc82583a41 | 76 | #define RFAL_NFCF_SENSF_RES_RD_LEN 2 /*!< SENSF_RES Request Data length */ |
DiegoOstuni | 0:75fc82583a41 | 77 | #define RFAL_NFCF_SENSF_RES_BYTE1 1 /*!< SENSF_RES first byte value */ |
DiegoOstuni | 0:75fc82583a41 | 78 | #define RFAL_NFCF_SENSF_SC_LEN 2 /*!< Felica SENSF_REQ System Code length */ |
DiegoOstuni | 0:75fc82583a41 | 79 | #define RFAL_NFCF_SENSF_PARAMS_SC1_POS 0 /*!< System Code byte1 position in the SENSF_REQ */ |
DiegoOstuni | 0:75fc82583a41 | 80 | #define RFAL_NFCF_SENSF_PARAMS_SC2_POS 1 /*!< System Code byte2 position in the SENSF_REQ */ |
DiegoOstuni | 0:75fc82583a41 | 81 | #define RFAL_NFCF_SENSF_PARAMS_RC_POS 2 /*!< Request Code position in the SENSF_REQ */ |
DiegoOstuni | 0:75fc82583a41 | 82 | #define RFAL_NFCF_SENSF_PARAMS_TSN_POS 3 /*!< Time Slot Number position in the SENSF_REQ */ |
DiegoOstuni | 0:75fc82583a41 | 83 | #define RFAL_NFCF_POLL_MAXCARDS 16 /*!< Max number slots/cards 16 */ |
DiegoOstuni | 0:75fc82583a41 | 84 | |
DiegoOstuni | 0:75fc82583a41 | 85 | |
DiegoOstuni | 0:75fc82583a41 | 86 | #define RFAL_NFCF_CMD_LEN 1 /*!< Command/Responce code length */ |
DiegoOstuni | 0:75fc82583a41 | 87 | #define RFAL_NFCF_LENGTH_LEN 1 /*!< LEN field length */ |
DiegoOstuni | 0:75fc82583a41 | 88 | #define RFAL_NFCF_HEADER_LEN (RFAL_NFCF_LENGTH_LEN + RFAL_NFCF_CMD_LEN) /*!< Header length*/ |
DiegoOstuni | 0:75fc82583a41 | 89 | |
DiegoOstuni | 0:75fc82583a41 | 90 | |
DiegoOstuni | 0:75fc82583a41 | 91 | #define RFAL_NFCF_SENSF_NFCID2_BYTE1_POS 0 /*!< NFCID2 byte1 position */ |
DiegoOstuni | 0:75fc82583a41 | 92 | #define RFAL_NFCF_SENSF_NFCID2_BYTE2_POS 1 /*!< NFCID2 byte2 position */ |
DiegoOstuni | 0:75fc82583a41 | 93 | |
DiegoOstuni | 0:75fc82583a41 | 94 | #define RFAL_NFCF_SENSF_NFCID2_PROT_TYPE_LEN 2 /*!< NFCID2 length for byte 1 and byte 2 indicating NFC-DEP or T3T support */ |
DiegoOstuni | 0:75fc82583a41 | 95 | #define RFAL_NFCF_SENSF_NFCID2_BYTE1_NFCDEP 0x01 /*!< NFCID2 byte1 NFC-DEP support Digital 1.0 Table 44*/ |
DiegoOstuni | 0:75fc82583a41 | 96 | #define RFAL_NFCF_SENSF_NFCID2_BYTE2_NFCDEP 0xFE /*!< NFCID2 byte2 NFC-DEP support Digital 1.0 Table 44*/ |
DiegoOstuni | 0:75fc82583a41 | 97 | |
DiegoOstuni | 0:75fc82583a41 | 98 | #define RFAL_NFCF_SYSTEMCODE 0xFFFF /*!< SENSF_RES Default System Code Digital 1.0 6.6.1.1 */ |
DiegoOstuni | 0:75fc82583a41 | 99 | |
DiegoOstuni | 0:75fc82583a41 | 100 | |
DiegoOstuni | 0:75fc82583a41 | 101 | /*! NFC-F Felica command set JIS X6319-4 9.1 */ |
DiegoOstuni | 0:75fc82583a41 | 102 | enum |
DiegoOstuni | 0:75fc82583a41 | 103 | { |
DiegoOstuni | 0:75fc82583a41 | 104 | RFAL_NFCF_CMD_POLLING = 0x00, /*!< SENSF_REQ (Felica Poll/REQC command to identify a card ) */ |
DiegoOstuni | 0:75fc82583a41 | 105 | RFAL_NFCF_CMD_POLLING_RES = 0x01, /*!< SENSF_RES (Felica Poll/REQC command response ) */ |
DiegoOstuni | 0:75fc82583a41 | 106 | RFAL_NFCF_CMD_REQUEST_SERVICE = 0x02, /*!< verify the existence of Area and Service */ |
DiegoOstuni | 0:75fc82583a41 | 107 | RFAL_NFCF_CMD_REQUEST_RESPONSE = 0x04, /*!< verify the existence of a card */ |
DiegoOstuni | 0:75fc82583a41 | 108 | RFAL_NFCF_CMD_READ_WITHOUT_ENCRYPTION = 0x06, /*!< read Block Data from a Service that requires no authentication */ |
DiegoOstuni | 0:75fc82583a41 | 109 | RFAL_NFCF_CMD_WRITE_WITHOUT_ENCRYPTION = 0x08, /*!< write Block Data to a Service that requires no authentication */ |
DiegoOstuni | 0:75fc82583a41 | 110 | RFAL_NFCF_CMD_REQUEST_SYSTEM_CODE = 0x0c, /*!< acquire the System Code registered to a card */ |
DiegoOstuni | 0:75fc82583a41 | 111 | RFAL_NFCF_CMD_AUTHENTICATION1 = 0x10, /*!< authenticate a card */ |
DiegoOstuni | 0:75fc82583a41 | 112 | RFAL_NFCF_CMD_AUTHENTICATION2 = 0x12, /*!< allow a card to authenticate a Reader/Writer */ |
DiegoOstuni | 0:75fc82583a41 | 113 | RFAL_NFCF_CMD_READ = 0x14, /*!< read Block Data from a Service that requires authentication */ |
DiegoOstuni | 0:75fc82583a41 | 114 | RFAL_NFCF_CMD_WRITE = 0x16, /*!< write Block Data to a Service that requires authentication */ |
DiegoOstuni | 0:75fc82583a41 | 115 | }; |
DiegoOstuni | 0:75fc82583a41 | 116 | |
DiegoOstuni | 0:75fc82583a41 | 117 | /* |
DiegoOstuni | 0:75fc82583a41 | 118 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 119 | * GLOBAL MACROS |
DiegoOstuni | 0:75fc82583a41 | 120 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 121 | */ |
DiegoOstuni | 0:75fc82583a41 | 122 | |
DiegoOstuni | 0:75fc82583a41 | 123 | /*! Checks if the given NFC-F device indicates NFC-DEP support */ |
DiegoOstuni | 0:75fc82583a41 | 124 | #define rfalNfcfIsNfcDepSupported( dev ) ( (((rfalNfcfListenDevice*)(dev))->sensfRes.NFCID2[RFAL_NFCF_SENSF_NFCID2_BYTE1_POS] == RFAL_NFCF_SENSF_NFCID2_BYTE1_NFCDEP) && \ |
DiegoOstuni | 0:75fc82583a41 | 125 | (((rfalNfcfListenDevice*)(dev))->sensfRes.NFCID2[RFAL_NFCF_SENSF_NFCID2_BYTE2_POS] == RFAL_NFCF_SENSF_NFCID2_BYTE2_NFCDEP) ) |
DiegoOstuni | 0:75fc82583a41 | 126 | |
DiegoOstuni | 0:75fc82583a41 | 127 | |
DiegoOstuni | 0:75fc82583a41 | 128 | /* |
DiegoOstuni | 0:75fc82583a41 | 129 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 130 | * GLOBAL TYPES |
DiegoOstuni | 0:75fc82583a41 | 131 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 132 | */ |
DiegoOstuni | 0:75fc82583a41 | 133 | |
DiegoOstuni | 0:75fc82583a41 | 134 | |
DiegoOstuni | 0:75fc82583a41 | 135 | /*! NFC-F SENSF_RES format Digital 1.1 8.6.2 */ |
DiegoOstuni | 0:75fc82583a41 | 136 | typedef struct |
DiegoOstuni | 0:75fc82583a41 | 137 | { |
DiegoOstuni | 0:75fc82583a41 | 138 | uint8_t CMD; /*!< Command Code: 01h */ |
DiegoOstuni | 0:75fc82583a41 | 139 | uint8_t NFCID2[RFAL_NFCF_NFCID2_LEN]; /*!< NFCID2 */ |
DiegoOstuni | 0:75fc82583a41 | 140 | uint8_t PAD0[RFAL_NFCF_SENSF_RES_PAD0_LEN]; /*!< PAD0 */ |
DiegoOstuni | 0:75fc82583a41 | 141 | uint8_t PAD1[RFAL_NFCF_SENSF_RES_PAD1_LEN]; /*!< PAD1 */ |
DiegoOstuni | 0:75fc82583a41 | 142 | uint8_t MRTIcheck; /*!< MRTIcheck */ |
DiegoOstuni | 0:75fc82583a41 | 143 | uint8_t MRTIupdate; /*!< MRTIupdate */ |
DiegoOstuni | 0:75fc82583a41 | 144 | uint8_t PAD2; /*!< PAD2 */ |
DiegoOstuni | 0:75fc82583a41 | 145 | uint8_t RD[RFAL_NFCF_SENSF_RES_RD_LEN]; /*!< Request Data */ |
DiegoOstuni | 0:75fc82583a41 | 146 | } rfalNfcfSensfRes; |
DiegoOstuni | 0:75fc82583a41 | 147 | |
DiegoOstuni | 0:75fc82583a41 | 148 | |
DiegoOstuni | 0:75fc82583a41 | 149 | /*! NFC-F poller device (PCD) struct */ |
DiegoOstuni | 0:75fc82583a41 | 150 | typedef struct |
DiegoOstuni | 0:75fc82583a41 | 151 | { |
DiegoOstuni | 0:75fc82583a41 | 152 | uint8_t NFCID2[RFAL_NFCF_NFCID2_LEN]; /*!< NFCID2 */ |
DiegoOstuni | 0:75fc82583a41 | 153 | } rfalNfcfPollDevice; |
DiegoOstuni | 0:75fc82583a41 | 154 | |
DiegoOstuni | 0:75fc82583a41 | 155 | /*! NFC-F listener device (PICC) struct */ |
DiegoOstuni | 0:75fc82583a41 | 156 | typedef struct |
DiegoOstuni | 0:75fc82583a41 | 157 | { |
DiegoOstuni | 0:75fc82583a41 | 158 | uint8_t sensfResLen; /*!< SENF_RES length */ |
DiegoOstuni | 0:75fc82583a41 | 159 | rfalNfcfSensfRes sensfRes; /*!< SENF_RES */ |
DiegoOstuni | 0:75fc82583a41 | 160 | } rfalNfcfListenDevice; |
DiegoOstuni | 0:75fc82583a41 | 161 | |
DiegoOstuni | 0:75fc82583a41 | 162 | |
DiegoOstuni | 0:75fc82583a41 | 163 | /* |
DiegoOstuni | 0:75fc82583a41 | 164 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 165 | * GLOBAL FUNCTION PROTOTYPES |
DiegoOstuni | 0:75fc82583a41 | 166 | ****************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 167 | */ |
DiegoOstuni | 0:75fc82583a41 | 168 | |
DiegoOstuni | 0:75fc82583a41 | 169 | /*! |
DiegoOstuni | 0:75fc82583a41 | 170 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 171 | * \brief Initialize NFC-F Poller mode |
DiegoOstuni | 0:75fc82583a41 | 172 | * |
DiegoOstuni | 0:75fc82583a41 | 173 | * This methods configures RFAL RF layer to perform as a |
DiegoOstuni | 0:75fc82583a41 | 174 | * NFC-F Poller/RW (FeliCa PCD) including all default timings |
DiegoOstuni | 0:75fc82583a41 | 175 | * |
DiegoOstuni | 0:75fc82583a41 | 176 | * \param[in] bitRate : NFC-F bitrate to be initialize (212 or 424) |
DiegoOstuni | 0:75fc82583a41 | 177 | * |
DiegoOstuni | 0:75fc82583a41 | 178 | * \return ERR_WRONG_STATE : RFAL not initialized or mode not set |
DiegoOstuni | 0:75fc82583a41 | 179 | * \return ERR_PARAM : Incorrect bitrate |
DiegoOstuni | 0:75fc82583a41 | 180 | * \return ERR_NONE : No error |
DiegoOstuni | 0:75fc82583a41 | 181 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 182 | */ |
DiegoOstuni | 0:75fc82583a41 | 183 | ReturnCode rfalNfcfPollerInitialize( rfalBitRate bitRate, 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 | 184 | |
DiegoOstuni | 0:75fc82583a41 | 185 | |
DiegoOstuni | 0:75fc82583a41 | 186 | /*! |
DiegoOstuni | 0:75fc82583a41 | 187 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 188 | * \brief NFC-F Poller Check Presence |
DiegoOstuni | 0:75fc82583a41 | 189 | * |
DiegoOstuni | 0:75fc82583a41 | 190 | * This function sends a Poll/SENSF command according to NFC Activity spec |
DiegoOstuni | 0:75fc82583a41 | 191 | * It detects if a NCF-F device is within range |
DiegoOstuni | 0:75fc82583a41 | 192 | * |
DiegoOstuni | 0:75fc82583a41 | 193 | * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode |
DiegoOstuni | 0:75fc82583a41 | 194 | * \return ERR_PARAM : Invalid parameters |
DiegoOstuni | 0:75fc82583a41 | 195 | * \return ERR_IO : Generic internal error |
DiegoOstuni | 0:75fc82583a41 | 196 | * \return ERR_CRC : CRC error detected |
DiegoOstuni | 0:75fc82583a41 | 197 | * \return ERR_FRAMING : Framing error detected |
DiegoOstuni | 0:75fc82583a41 | 198 | * \return ERR_PROTO : Protocol error detected |
DiegoOstuni | 0:75fc82583a41 | 199 | * \return ERR_TIMEOUT : Timeout error, no listener device detected |
DiegoOstuni | 0:75fc82583a41 | 200 | * \return ERR_NONE : No error and some NFC-F device was detected |
DiegoOstuni | 0:75fc82583a41 | 201 | * |
DiegoOstuni | 0:75fc82583a41 | 202 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 203 | */ |
DiegoOstuni | 0:75fc82583a41 | 204 | ReturnCode rfalNfcfPollerCheckPresence( 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 | 205 | |
DiegoOstuni | 0:75fc82583a41 | 206 | |
DiegoOstuni | 0:75fc82583a41 | 207 | /*! |
DiegoOstuni | 0:75fc82583a41 | 208 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 209 | * \brief NFC-F Poller Poll |
DiegoOstuni | 0:75fc82583a41 | 210 | * |
DiegoOstuni | 0:75fc82583a41 | 211 | * This function sends to all PICCs in field the POLL command with the given |
DiegoOstuni | 0:75fc82583a41 | 212 | * number of slots. |
DiegoOstuni | 0:75fc82583a41 | 213 | * |
DiegoOstuni | 0:75fc82583a41 | 214 | * \param[in] slots : the number of slots to be performed |
DiegoOstuni | 0:75fc82583a41 | 215 | * \param[in] sysCode : as given in FeliCa poll command |
DiegoOstuni | 0:75fc82583a41 | 216 | * \param[in] reqCode : FeliCa communication parameters |
DiegoOstuni | 0:75fc82583a41 | 217 | * \param[out] cardList : Parameter of type rfalFeliCaPollRes which will hold the cards found |
DiegoOstuni | 0:75fc82583a41 | 218 | * \param[out] devCnt : actual number of cards found |
DiegoOstuni | 0:75fc82583a41 | 219 | * \param[out] collisions : number of collisions encountered |
DiegoOstuni | 0:75fc82583a41 | 220 | * |
DiegoOstuni | 0:75fc82583a41 | 221 | * \warning the list cardList has to be as big as the number of slots for the Poll |
DiegoOstuni | 0:75fc82583a41 | 222 | * |
DiegoOstuni | 0:75fc82583a41 | 223 | * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode |
DiegoOstuni | 0:75fc82583a41 | 224 | * \return ERR_PARAM : Invalid parameters |
DiegoOstuni | 0:75fc82583a41 | 225 | * \return ERR_IO : Generic internal error |
DiegoOstuni | 0:75fc82583a41 | 226 | * \return ERR_CRC : CRC error detected |
DiegoOstuni | 0:75fc82583a41 | 227 | * \return ERR_FRAMING : Framing error detected |
DiegoOstuni | 0:75fc82583a41 | 228 | * \return ERR_PROTO : Protocol error detected |
DiegoOstuni | 0:75fc82583a41 | 229 | * \return ERR_TIMEOUT : Timeout error, no listener device detected |
DiegoOstuni | 0:75fc82583a41 | 230 | * \return ERR_NONE : No error and some NFC-F device was detected |
DiegoOstuni | 0:75fc82583a41 | 231 | * |
DiegoOstuni | 0:75fc82583a41 | 232 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 233 | */ |
DiegoOstuni | 0:75fc82583a41 | 234 | ReturnCode rfalNfcfPollerPoll( rfalFeliCaPollSlots slots, uint16_t sysCode, uint8_t reqCode, rfalFeliCaPollRes *cardList, uint8_t *devCnt, uint8_t *collisions, 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 | 235 | |
DiegoOstuni | 0:75fc82583a41 | 236 | |
DiegoOstuni | 0:75fc82583a41 | 237 | /*! |
DiegoOstuni | 0:75fc82583a41 | 238 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 239 | * \brief NFC-F Poller Full Collision Resolution |
DiegoOstuni | 0:75fc82583a41 | 240 | * |
DiegoOstuni | 0:75fc82583a41 | 241 | * Performs a full Collision resolution as defined in Activity 1.1 9.3.4 |
DiegoOstuni | 0:75fc82583a41 | 242 | * |
DiegoOstuni | 0:75fc82583a41 | 243 | * \param[in] compMode : compliance mode to be performed |
DiegoOstuni | 0:75fc82583a41 | 244 | * \param[in] devLimit : device limit value, and size nfcaDevList |
DiegoOstuni | 0:75fc82583a41 | 245 | * \param[out] nfcfDevList : NFC-F listener devices list |
DiegoOstuni | 0:75fc82583a41 | 246 | * \param[out] devCnt : Devices found counter |
DiegoOstuni | 0:75fc82583a41 | 247 | * |
DiegoOstuni | 0:75fc82583a41 | 248 | * \return ERR_WRONG_STATE : RFAL not initialized or mode not set |
DiegoOstuni | 0:75fc82583a41 | 249 | * \return ERR_PARAM : Invalid parameters |
DiegoOstuni | 0:75fc82583a41 | 250 | * \return ERR_IO : Generic internal error |
DiegoOstuni | 0:75fc82583a41 | 251 | * \return ERR_NONE : No error |
DiegoOstuni | 0:75fc82583a41 | 252 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 253 | */ |
DiegoOstuni | 0:75fc82583a41 | 254 | ReturnCode rfalNfcfPollerCollisionResolution( rfalComplianceMode compMode, uint8_t devLimit, rfalNfcfListenDevice *nfcfDevList, 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 | 255 | |
DiegoOstuni | 0:75fc82583a41 | 256 | |
DiegoOstuni | 0:75fc82583a41 | 257 | /*! |
DiegoOstuni | 0:75fc82583a41 | 258 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 259 | * \brief NFC-F Listener is T3T Request |
DiegoOstuni | 0:75fc82583a41 | 260 | * |
DiegoOstuni | 0:75fc82583a41 | 261 | * This method checks if the given data is a valid T3T command (Read or Write) |
DiegoOstuni | 0:75fc82583a41 | 262 | * and in case a valid request has been received it may output the request's NFCID2 |
DiegoOstuni | 0:75fc82583a41 | 263 | * |
DiegoOstuni | 0:75fc82583a41 | 264 | * \param[in] buf : buffer holding Initiator's received command |
DiegoOstuni | 0:75fc82583a41 | 265 | * \param[in] bufLen : length of received command in bytes |
DiegoOstuni | 0:75fc82583a41 | 266 | * \param[out] nfcid2 : pointer to where the NFCID2 may be outputed, |
DiegoOstuni | 0:75fc82583a41 | 267 | * nfcid2 has NFCF_SENSF_NFCID2_LEN as length |
DiegoOstuni | 0:75fc82583a41 | 268 | * Pass NULL if output parameter not desired |
DiegoOstuni | 0:75fc82583a41 | 269 | * |
DiegoOstuni | 0:75fc82583a41 | 270 | * \return true : Valid T3T command (Read or Write) received |
DiegoOstuni | 0:75fc82583a41 | 271 | * \return false : Invalid protocol request |
DiegoOstuni | 0:75fc82583a41 | 272 | * |
DiegoOstuni | 0:75fc82583a41 | 273 | ***************************************************************************** |
DiegoOstuni | 0:75fc82583a41 | 274 | */ |
DiegoOstuni | 0:75fc82583a41 | 275 | bool rfalNfcfListenerIsT3TReq( uint8_t* buf, uint16_t bufLen, uint8_t* nfcid2 ); |
DiegoOstuni | 0:75fc82583a41 | 276 | |
DiegoOstuni | 0:75fc82583a41 | 277 | |
DiegoOstuni | 0:75fc82583a41 | 278 | #endif /* RFAL_NFCF_H */ |
DiegoOstuni | 0:75fc82583a41 | 279 | |
DiegoOstuni | 0:75fc82583a41 | 280 | /** |
DiegoOstuni | 0:75fc82583a41 | 281 | * @} |
DiegoOstuni | 0:75fc82583a41 | 282 | * |
DiegoOstuni | 0:75fc82583a41 | 283 | * @} |
DiegoOstuni | 0:75fc82583a41 | 284 | * |
DiegoOstuni | 0:75fc82583a41 | 285 | * @} |
DiegoOstuni | 0:75fc82583a41 | 286 | */ |
DiegoOstuni | 0:75fc82583a41 | 287 |