RFAL library for the STMicroelectronics X-NUCLEO-NFC05A1

Dependents:   mbed-os-nfc05a1

Committer:
DiegoOstuni
Date:
Thu Nov 14 14:34:50 2019 +0000
Revision:
0:75fc82583a41
Add files

Who changed what in which revision?

UserRevisionLine numberNew 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>&copy; 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 /*
DiegoOstuni 0:75fc82583a41 25 * PROJECT: ST25R391x firmware
DiegoOstuni 0:75fc82583a41 26 * $Revision: $
DiegoOstuni 0:75fc82583a41 27 * LANGUAGE: ISO C99
DiegoOstuni 0:75fc82583a41 28 */
DiegoOstuni 0:75fc82583a41 29
DiegoOstuni 0:75fc82583a41 30 /*! \file rfal_isoDep.h
DiegoOstuni 0:75fc82583a41 31 *
DiegoOstuni 0:75fc82583a41 32 * \author Gustavo Patricio
DiegoOstuni 0:75fc82583a41 33 *
DiegoOstuni 0:75fc82583a41 34 * \brief Implementation of ISO-DEP protocol
DiegoOstuni 0:75fc82583a41 35 *
DiegoOstuni 0:75fc82583a41 36 * This implementation was based on the following specs:
DiegoOstuni 0:75fc82583a41 37 * - ISO/IEC 14443-4 2nd Edition 2008-07-15
DiegoOstuni 0:75fc82583a41 38 * - NFC Forum Digital Protocol 1.1 2014-01-14
DiegoOstuni 0:75fc82583a41 39 *
DiegoOstuni 0:75fc82583a41 40 *
DiegoOstuni 0:75fc82583a41 41 * @addtogroup RFAL
DiegoOstuni 0:75fc82583a41 42 * @{
DiegoOstuni 0:75fc82583a41 43 *
DiegoOstuni 0:75fc82583a41 44 * @addtogroup RFAL-AL
DiegoOstuni 0:75fc82583a41 45 * @brief RFAL Abstraction Layer
DiegoOstuni 0:75fc82583a41 46 * @{
DiegoOstuni 0:75fc82583a41 47 *
DiegoOstuni 0:75fc82583a41 48 * @addtogroup ISO-DEP
DiegoOstuni 0:75fc82583a41 49 * @brief RFAL ISO-DEP Module
DiegoOstuni 0:75fc82583a41 50 * @{
DiegoOstuni 0:75fc82583a41 51 *
DiegoOstuni 0:75fc82583a41 52 */
DiegoOstuni 0:75fc82583a41 53
DiegoOstuni 0:75fc82583a41 54 #ifndef RFAL_ISODEP_H_
DiegoOstuni 0:75fc82583a41 55 #define RFAL_ISODEP_H_
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 "rfal_nfcb.h"
DiegoOstuni 0:75fc82583a41 63
DiegoOstuni 0:75fc82583a41 64 /*
DiegoOstuni 0:75fc82583a41 65 ******************************************************************************
DiegoOstuni 0:75fc82583a41 66 * DEFINES
DiegoOstuni 0:75fc82583a41 67 ******************************************************************************
DiegoOstuni 0:75fc82583a41 68 */
DiegoOstuni 0:75fc82583a41 69
DiegoOstuni 0:75fc82583a41 70 #define RFAL_ISODEP_PROLOGUE_SIZE (3) /*!< Length of Prologue Field for I-Block Format */
DiegoOstuni 0:75fc82583a41 71
DiegoOstuni 0:75fc82583a41 72 #define RFAL_ISODEP_PCB_LEN (1) /*!< PCB length */
DiegoOstuni 0:75fc82583a41 73 #define RFAL_ISODEP_DID_LEN (1) /*!< DID length */
DiegoOstuni 0:75fc82583a41 74 #define RFAL_ISODEP_NAD_LEN (1) /*!< NAD length */
DiegoOstuni 0:75fc82583a41 75 #define RFAL_ISODEP_NO_DID (0x00) /*!< DID value indicating the ISO-DEP layer not to use DID */
DiegoOstuni 0:75fc82583a41 76 #define RFAL_ISODEP_NO_NAD (0xFF) /*!< NAD value indicating the ISO-DEP layer not to use NAD */
DiegoOstuni 0:75fc82583a41 77
DiegoOstuni 0:75fc82583a41 78 #define RFAL_ISODEP_FSDI_DEFAULT (8) /*!< Default Frame Size Integer supported by NFCC as Initiator */
DiegoOstuni 0:75fc82583a41 79 #define RFAL_ISODEP_FWI_MASK (0xF0) /*!< Mask bits of FWI */
DiegoOstuni 0:75fc82583a41 80 #define RFAL_ISODEP_FWI_SHIFT (4) /*!< Shift val of FWI */
DiegoOstuni 0:75fc82583a41 81 #define RFAL_ISODEP_FWI_DEFAULT (4) /*!< Default value for FWI Digital 1.0 11.6.2.17 */
DiegoOstuni 0:75fc82583a41 82 #define RFAL_ISODEP_ADV_FEATURE (0x0F) /*!< Indicate 256 Bytes FSD and Advanc Proto Feature support:NAD & DID */
DiegoOstuni 0:75fc82583a41 83
DiegoOstuni 0:75fc82583a41 84 #define RFAL_ISODEP_DID_MAX (14) /*!< Maximum DID value */
DiegoOstuni 0:75fc82583a41 85
DiegoOstuni 0:75fc82583a41 86 #define RFAL_ISODEP_BRI_MASK (0x07) /*!< Mask bits for Poll to Listen Send bitrate */
DiegoOstuni 0:75fc82583a41 87 #define RFAL_ISODEP_BSI_MASK (0x70) /*!< Mask bits for Listen to Poll Send bitrate */
DiegoOstuni 0:75fc82583a41 88 #define RFAL_ISODEP_SAME_BITRATE_MASK (0x80) /*!< Mask bit indicate only same bit rate D for both direction support */
DiegoOstuni 0:75fc82583a41 89 #define RFAL_ISODEP_BITRATE_RFU_MASK (0x08) /*!< Mask bit for RFU */
DiegoOstuni 0:75fc82583a41 90
DiegoOstuni 0:75fc82583a41 91 /*! Maximum Frame Waiting Time = ((256 * 16/fc) * 2^FWImax) = ((256*16/fc)*2^14) = (67108864)/fc = 2^26 (1/fc) */
DiegoOstuni 0:75fc82583a41 92 #define RFAL_ISODEP_MAX_FWT (1<<26)
DiegoOstuni 0:75fc82583a41 93
DiegoOstuni 0:75fc82583a41 94
DiegoOstuni 0:75fc82583a41 95
DiegoOstuni 0:75fc82583a41 96 #define RFAL_ISODEP_FSX_KEEP (0xFF) /*!< Flag to keep FSX from activation */
DiegoOstuni 0:75fc82583a41 97 #define RFAL_ISODEP_DEFAULT_FSCI RFAL_ISODEP_FSXI_256 /*!< FSCI default value to be used in Listen Mode */
DiegoOstuni 0:75fc82583a41 98 #define RFAL_ISODEP_DEFAULT_FSC RFAL_ISODEP_FSX_256 /*!< FSC default value (aligned RFAL_ISODEP_DEFAULT_FSCI) */
DiegoOstuni 0:75fc82583a41 99 #define RFAL_ISODEP_DEFAULT_SFGI (0) /*!< SFGI Default value to be used in Listen Mode */
DiegoOstuni 0:75fc82583a41 100
DiegoOstuni 0:75fc82583a41 101 #define RFAL_ISODEP_APDU_MAX_LEN RFAL_ISODEP_FSX_1024 /*!< Max APDU length */
DiegoOstuni 0:75fc82583a41 102
DiegoOstuni 0:75fc82583a41 103 #define RFAL_ISODEP_ATTRIB_RES_MBLI_NO_INFO (0x00) /*!< MBLI indicating no information on its internal input buffer size */
DiegoOstuni 0:75fc82583a41 104 #define RFAL_ISODEP_ATTRIB_REQ_PARAM1_DEFAULT (0x00) /*!< Default values of Param 1 of ATTRIB_REQ Digital 1.0 12.6.1.3-5 */
DiegoOstuni 0:75fc82583a41 105 #define RFAL_ISODEP_ATTRIB_HLINFO_LEN (32) /*!< Maximum Size of Higher Layer Information */
DiegoOstuni 0:75fc82583a41 106 #define RFAL_ISODEP_ATS_HB_MAX_LEN (15) /*!< Maximum length of Historical Bytes Digital 1.1 13.6.2.23 */
DiegoOstuni 0:75fc82583a41 107 #define RFAL_ISODEP_ATTRIB_REQ_MIN_LEN (9) /*!< Minimum Length of ATTRIB_REQ command */
DiegoOstuni 0:75fc82583a41 108 #define RFAL_ISODEP_ATTRIB_RES_MIN_LEN (1) /*!< Minimum Length of ATTRIB_RES response */
DiegoOstuni 0:75fc82583a41 109
DiegoOstuni 0:75fc82583a41 110 #define RFAL_ISODEP_ATS_TA_DPL_212 (0x01) /*!< ATS TA DSI 212 kbps support bit mask */
DiegoOstuni 0:75fc82583a41 111 #define RFAL_ISODEP_ATS_TA_DPL_424 (0x02) /*!< ATS TA DSI 424 kbps support bit mask */
DiegoOstuni 0:75fc82583a41 112 #define RFAL_ISODEP_ATS_TA_DPL_848 (0x04) /*!< ATS TA DSI 848 kbps support bit mask */
DiegoOstuni 0:75fc82583a41 113 #define RFAL_ISODEP_ATS_TA_DLP_212 (0x10) /*!< ATS TA DSI 212 kbps support bit mask */
DiegoOstuni 0:75fc82583a41 114 #define RFAL_ISODEP_ATS_TA_DLP_424 (0x20) /*!< ATS TA DRI 424 kbps support bit mask */
DiegoOstuni 0:75fc82583a41 115 #define RFAL_ISODEP_ATS_TA_DLP_848 (0x40) /*!< ATS TA DRI 848 kbps support bit mask */
DiegoOstuni 0:75fc82583a41 116 #define RFAL_ISODEP_ATS_TA_SAME_D (0x80) /*!< ATS TA same bit both directions bit mask */
DiegoOstuni 0:75fc82583a41 117 #define RFAL_ISODEP_ATS_TB_FWI_MASK (0xF0) /*!< Mask bits for FWI (Frame Waiting Integer) in TB byte */
DiegoOstuni 0:75fc82583a41 118 #define RFAL_ISODEP_ATS_TB_SFGI_MASK (0x0F) /*!< Mask bits for SFGI (Start-Up Frame Guard Integer) in TB byte */
DiegoOstuni 0:75fc82583a41 119
DiegoOstuni 0:75fc82583a41 120 #define RFAL_ISODEP_ATS_T0_TA_PRESENCE_MASK (0x10) /*!< Mask bit for TA presence */
DiegoOstuni 0:75fc82583a41 121 #define RFAL_ISODEP_ATS_T0_TB_PRESENCE_MASK (0x20) /*!< Mask bit for TB presence */
DiegoOstuni 0:75fc82583a41 122 #define RFAL_ISODEP_ATS_T0_TC_PRESENCE_MASK (0x40) /*!< Mask bit for TC presence */
DiegoOstuni 0:75fc82583a41 123 #define RFAL_ISODEP_ATS_T0_FSCI_MASK (0x0F) /*!< Mask bit for FSCI presence */
DiegoOstuni 0:75fc82583a41 124 #define RFAL_ISODEP_ATS_T0_OFFSET (0x01) /*!< Offset of T0 in ATS Response */
DiegoOstuni 0:75fc82583a41 125
DiegoOstuni 0:75fc82583a41 126
DiegoOstuni 0:75fc82583a41 127 #define RFAL_ISODEP_MAX_I_RETRYS (2) /*!< Number of retries for a I-Block Digital 1.1 15.2.5.4 */
DiegoOstuni 0:75fc82583a41 128 #define RFAL_ISODEP_MAX_R_RETRYS (3) /*!< Number of retries for a R-Block Digital 1.1 A8 - nRETRY ACK/NAK: [2,5] */
DiegoOstuni 0:75fc82583a41 129 #define RFAL_ISODEP_MAX_S_RETRYS (3) /*!< Number of retries for a S-Block Digital 1.1 A8 - nRETRY DESELECT: [0,5] WTX[2,5] */
DiegoOstuni 0:75fc82583a41 130 #define RFAL_ISODEP_RATS_RETRIES (1) /*!< RATS retries upon fail Digital 1.1 A.6 - [0,1] */
DiegoOstuni 0:75fc82583a41 131
DiegoOstuni 0:75fc82583a41 132
DiegoOstuni 0:75fc82583a41 133 /*! Frame Size for Proximity Card Integer definitions */
DiegoOstuni 0:75fc82583a41 134 typedef enum
DiegoOstuni 0:75fc82583a41 135 {
DiegoOstuni 0:75fc82583a41 136 RFAL_ISODEP_FSXI_16 = 0, /*!< Frame Size for Proximity Card Integer with 16 bytes */
DiegoOstuni 0:75fc82583a41 137 RFAL_ISODEP_FSXI_24 = 1, /*!< Frame Size for Proximity Card Integer with 24 bytes */
DiegoOstuni 0:75fc82583a41 138 RFAL_ISODEP_FSXI_32 = 2, /*!< Frame Size for Proximity Card Integer with 32 bytes */
DiegoOstuni 0:75fc82583a41 139 RFAL_ISODEP_FSXI_40 = 3, /*!< Frame Size for Proximity Card Integer with 40 bytes */
DiegoOstuni 0:75fc82583a41 140 RFAL_ISODEP_FSXI_48 = 4, /*!< Frame Size for Proximity Card Integer with 48 bytes */
DiegoOstuni 0:75fc82583a41 141 RFAL_ISODEP_FSXI_64 = 5, /*!< Frame Size for Proximity Card Integer with 64 bytes */
DiegoOstuni 0:75fc82583a41 142 RFAL_ISODEP_FSXI_96 = 6, /*!< Frame Size for Proximity Card Integer with 96 bytes */
DiegoOstuni 0:75fc82583a41 143 RFAL_ISODEP_FSXI_128 = 7, /*!< Frame Size for Proximity Card Integer with 128 bytes */
DiegoOstuni 0:75fc82583a41 144 RFAL_ISODEP_FSXI_256 = 8, /*!< Frame Size for Proximity Card Integer with 256 bytes */
DiegoOstuni 0:75fc82583a41 145 RFAL_ISODEP_FSXI_512 = 9, /*!< Frame Size for Proximity Card Integer with 512 bytes ISO14443-3 Amd2 2012 */
DiegoOstuni 0:75fc82583a41 146 RFAL_ISODEP_FSXI_1024 = 10, /*!< Frame Size for Proximity Card Integer with 1024 bytes ISO14443-3 Amd2 2012 */
DiegoOstuni 0:75fc82583a41 147 RFAL_ISODEP_FSXI_2048 = 11, /*!< Frame Size for Proximity Card Integer with 2048 bytes ISO14443-3 Amd2 2012 */
DiegoOstuni 0:75fc82583a41 148 RFAL_ISODEP_FSXI_4096 = 12 /*!< Frame Size for Proximity Card Integer with 4096 bytes ISO14443-3 Amd2 2012 */
DiegoOstuni 0:75fc82583a41 149 } rfalIsoDepFSxI;
DiegoOstuni 0:75fc82583a41 150
DiegoOstuni 0:75fc82583a41 151 /*! Frame Size for Proximity Card definitions */
DiegoOstuni 0:75fc82583a41 152 typedef enum
DiegoOstuni 0:75fc82583a41 153 {
DiegoOstuni 0:75fc82583a41 154 RFAL_ISODEP_FSX_16 = 16, /*!< Frame Size for Proximity Card with 16 bytes */
DiegoOstuni 0:75fc82583a41 155 RFAL_ISODEP_FSX_24 = 24, /*!< Frame Size for Proximity Card with 16 bytes */
DiegoOstuni 0:75fc82583a41 156 RFAL_ISODEP_FSX_32 = 32, /*!< Frame Size for Proximity Card with 32 bytes */
DiegoOstuni 0:75fc82583a41 157 RFAL_ISODEP_FSX_40 = 40, /*!< Frame Size for Proximity Card with 40 bytes */
DiegoOstuni 0:75fc82583a41 158 RFAL_ISODEP_FSX_48 = 48, /*!< Frame Size for Proximity Card with 48 bytes */
DiegoOstuni 0:75fc82583a41 159 RFAL_ISODEP_FSX_64 = 64, /*!< Frame Size for Proximity Card with 64 bytes */
DiegoOstuni 0:75fc82583a41 160 RFAL_ISODEP_FSX_96 = 96, /*!< Frame Size for Proximity Card with 96 bytes */
DiegoOstuni 0:75fc82583a41 161 RFAL_ISODEP_FSX_128 = 128, /*!< Frame Size for Proximity Card with 128 bytes */
DiegoOstuni 0:75fc82583a41 162 RFAL_ISODEP_FSX_256 = 256, /*!< Frame Size for Proximity Card with 256 bytes */
DiegoOstuni 0:75fc82583a41 163 RFAL_ISODEP_FSX_512 = 512, /*!< Frame Size for Proximity Card with 512 bytes ISO14443-3 Amd2 2012 */
DiegoOstuni 0:75fc82583a41 164 RFAL_ISODEP_FSX_1024 = 1024, /*!< Frame Size for Proximity Card with 1024 bytes ISO14443-3 Amd2 2012 */
DiegoOstuni 0:75fc82583a41 165 RFAL_ISODEP_FSX_2048 = 2048, /*!< Frame Size for Proximity Card with 2048 bytes ISO14443-3 Amd2 2012 */
DiegoOstuni 0:75fc82583a41 166 RFAL_ISODEP_FSX_4096 = 4096, /*!< Frame Size for Proximity Card with 4096 bytes ISO14443-3 Amd2 2012 */
DiegoOstuni 0:75fc82583a41 167 } rfalIsoDepFSx;
DiegoOstuni 0:75fc82583a41 168
DiegoOstuni 0:75fc82583a41 169 /*
DiegoOstuni 0:75fc82583a41 170 ******************************************************************************
DiegoOstuni 0:75fc82583a41 171 * GLOBAL MACROS
DiegoOstuni 0:75fc82583a41 172 ******************************************************************************
DiegoOstuni 0:75fc82583a41 173 */
DiegoOstuni 0:75fc82583a41 174
DiegoOstuni 0:75fc82583a41 175 /*
DiegoOstuni 0:75fc82583a41 176 ******************************************************************************
DiegoOstuni 0:75fc82583a41 177 * GLOBAL DATA TYPES
DiegoOstuni 0:75fc82583a41 178 ******************************************************************************
DiegoOstuni 0:75fc82583a41 179 */
DiegoOstuni 0:75fc82583a41 180
DiegoOstuni 0:75fc82583a41 181 /*! RATS format Digital 1.1 13.6.1 */
DiegoOstuni 0:75fc82583a41 182 typedef struct
DiegoOstuni 0:75fc82583a41 183 {
DiegoOstuni 0:75fc82583a41 184 uint8_t CMD; /*!< RATS command byte: 0xE0 */
DiegoOstuni 0:75fc82583a41 185 uint8_t PARAM; /*!< Param indicating FSDI and DID */
DiegoOstuni 0:75fc82583a41 186 } rfalIsoDepRats;
DiegoOstuni 0:75fc82583a41 187
DiegoOstuni 0:75fc82583a41 188
DiegoOstuni 0:75fc82583a41 189 /*! ATS response format Digital 1.1 13.6.2 */
DiegoOstuni 0:75fc82583a41 190 typedef struct
DiegoOstuni 0:75fc82583a41 191 {
DiegoOstuni 0:75fc82583a41 192 uint8_t TL; /*!< Length Byte, including TL byte itself */
DiegoOstuni 0:75fc82583a41 193 uint8_t T0; /*!< Format Byte T0 indicating if TA, TB, TC */
DiegoOstuni 0:75fc82583a41 194 uint8_t TA; /*!< Interface Byte TA(1) */
DiegoOstuni 0:75fc82583a41 195 uint8_t TB; /*!< Interface Byte TB(1) */
DiegoOstuni 0:75fc82583a41 196 uint8_t TC; /*!< Interface Byte TC(1) */
DiegoOstuni 0:75fc82583a41 197 uint8_t HB[RFAL_ISODEP_ATS_HB_MAX_LEN]; /*!< Historical Bytes */
DiegoOstuni 0:75fc82583a41 198 } rfalIsoDepAts;
DiegoOstuni 0:75fc82583a41 199
DiegoOstuni 0:75fc82583a41 200
DiegoOstuni 0:75fc82583a41 201 /*! PPS Request format (Protocol and Parameter Selection) ISO14443-4 5.3 */
DiegoOstuni 0:75fc82583a41 202 typedef struct
DiegoOstuni 0:75fc82583a41 203 {
DiegoOstuni 0:75fc82583a41 204 uint8_t PPSS; /*!< Start Byte: [ 1101b | CID[4b] ] */
DiegoOstuni 0:75fc82583a41 205 uint8_t PPS0; /*!< Parameter 0:[ 000b | PPS1[1n] | 0001b ] */
DiegoOstuni 0:75fc82583a41 206 uint8_t PPS1; /*!< Parameter 1:[ 0000b | DSI[2b] | DRI[2b] ]*/
DiegoOstuni 0:75fc82583a41 207 } rfalIsoDepPpsReq;
DiegoOstuni 0:75fc82583a41 208
DiegoOstuni 0:75fc82583a41 209
DiegoOstuni 0:75fc82583a41 210 /*! PPS Response format (Protocol and Parameter Selection) ISO14443-4 5.4 */
DiegoOstuni 0:75fc82583a41 211 typedef struct
DiegoOstuni 0:75fc82583a41 212 {
DiegoOstuni 0:75fc82583a41 213 uint8_t PPSS; /*!< Start Byte: [ 1101b | CID[4b] ] */
DiegoOstuni 0:75fc82583a41 214 } rfalIsoDepPpsRes;
DiegoOstuni 0:75fc82583a41 215
DiegoOstuni 0:75fc82583a41 216
DiegoOstuni 0:75fc82583a41 217 /*! ATTRIB Command Format Digital 1.1 15.6.1 */
DiegoOstuni 0:75fc82583a41 218 typedef struct
DiegoOstuni 0:75fc82583a41 219 {
DiegoOstuni 0:75fc82583a41 220 uint8_t cmd; /*!< ATTRIB_REQ command byte */
DiegoOstuni 0:75fc82583a41 221 uint8_t nfcid0[RFAL_NFCB_NFCID0_LEN]; /*!< NFCID0 of the card to be selected */
DiegoOstuni 0:75fc82583a41 222 struct{
DiegoOstuni 0:75fc82583a41 223 uint8_t PARAM1; /*!< PARAM1 of ATTRIB command */
DiegoOstuni 0:75fc82583a41 224 uint8_t PARAM2; /*!< PARAM2 of ATTRIB command */
DiegoOstuni 0:75fc82583a41 225 uint8_t PARAM3; /*!< PARAM3 of ATTRIB command */
DiegoOstuni 0:75fc82583a41 226 uint8_t PARAM4; /*!< PARAM4 of ATTRIB command */
DiegoOstuni 0:75fc82583a41 227 }Param; /*!< Parameter of ATTRIB command */
DiegoOstuni 0:75fc82583a41 228 uint8_t HLInfo[RFAL_ISODEP_ATTRIB_HLINFO_LEN]; /*!< Higher Layer Information */
DiegoOstuni 0:75fc82583a41 229 } rfalIsoDepAttribCmd;
DiegoOstuni 0:75fc82583a41 230
DiegoOstuni 0:75fc82583a41 231
DiegoOstuni 0:75fc82583a41 232 /*! ATTRIB Response Format Digital 1.1 15.6.2 */
DiegoOstuni 0:75fc82583a41 233 typedef struct
DiegoOstuni 0:75fc82583a41 234 {
DiegoOstuni 0:75fc82583a41 235 uint8_t mbliDid; /*!< Contains MBLI and DID */
DiegoOstuni 0:75fc82583a41 236 uint8_t HLInfo[RFAL_ISODEP_ATTRIB_HLINFO_LEN]; /*!< Higher Layer Information */
DiegoOstuni 0:75fc82583a41 237 } rfalIsoDepAttribRes;
DiegoOstuni 0:75fc82583a41 238
DiegoOstuni 0:75fc82583a41 239
DiegoOstuni 0:75fc82583a41 240 /*! Activation info as Poller and Listener for NFC-A and NFC-B */
DiegoOstuni 0:75fc82583a41 241 typedef union {
DiegoOstuni 0:75fc82583a41 242
DiegoOstuni 0:75fc82583a41 243 /*! NFC-A information */
DiegoOstuni 0:75fc82583a41 244 union {
DiegoOstuni 0:75fc82583a41 245 struct {
DiegoOstuni 0:75fc82583a41 246 rfalIsoDepAts ATS; /*!< ATS response (Poller mode) */
DiegoOstuni 0:75fc82583a41 247 uint8_t ATSLen; /*!< ATS response length (Poller mode) */
DiegoOstuni 0:75fc82583a41 248 }Listener;
DiegoOstuni 0:75fc82583a41 249 struct {
DiegoOstuni 0:75fc82583a41 250 rfalIsoDepRats RATS; /*!< RATS request (Listener mode) */
DiegoOstuni 0:75fc82583a41 251 }Poller;
DiegoOstuni 0:75fc82583a41 252 }A;
DiegoOstuni 0:75fc82583a41 253
DiegoOstuni 0:75fc82583a41 254 /*! NFC-B information */
DiegoOstuni 0:75fc82583a41 255 union {
DiegoOstuni 0:75fc82583a41 256 struct{
DiegoOstuni 0:75fc82583a41 257 rfalIsoDepAttribRes ATTRIB_RES; /*!< ATTRIB_RES (Poller mode) */
DiegoOstuni 0:75fc82583a41 258 uint8_t ATTRIB_RESLen; /*!< ATTRIB_RES length (Poller mode) */
DiegoOstuni 0:75fc82583a41 259 }Listener;
DiegoOstuni 0:75fc82583a41 260 struct{
DiegoOstuni 0:75fc82583a41 261 rfalIsoDepAttribCmd ATTRIB; /*!< ATTRIB request (Listener mode) */
DiegoOstuni 0:75fc82583a41 262 uint8_t ATTRIBLen; /*!< ATTRIB request length (Listener mode) */
DiegoOstuni 0:75fc82583a41 263 }Poller;
DiegoOstuni 0:75fc82583a41 264 }B;
DiegoOstuni 0:75fc82583a41 265 }rfalIsoDepActivation;
DiegoOstuni 0:75fc82583a41 266
DiegoOstuni 0:75fc82583a41 267
DiegoOstuni 0:75fc82583a41 268 /*! ISO-DEP device Info */
DiegoOstuni 0:75fc82583a41 269 typedef struct {
DiegoOstuni 0:75fc82583a41 270 uint8_t FWI; /*!< Frame Waiting Integer */
DiegoOstuni 0:75fc82583a41 271 uint32_t FWT; /*!< Frame Waiting Time (1/fc) */
DiegoOstuni 0:75fc82583a41 272 uint32_t dFWT; /*!< Delta Frame Waiting Time (1/fc) */
DiegoOstuni 0:75fc82583a41 273 uint32_t SFGI; /*!< Start-up Frame Guard time Integer */
DiegoOstuni 0:75fc82583a41 274 uint32_t SFGT; /*!< Start-up Frame Guard Time (ms) */
DiegoOstuni 0:75fc82583a41 275 uint8_t FSxI; /*!< Frame Size Device/Card Integer (FSDI or FSCI) */
DiegoOstuni 0:75fc82583a41 276 uint16_t FSx; /*!< Frame Size Device/Card (FSD or FSC) */
DiegoOstuni 0:75fc82583a41 277 uint32_t MBL; /*!< Maximum Buffer Length (optional for NFC-B) */
DiegoOstuni 0:75fc82583a41 278 rfalBitRate DSI; /*!< Bit Rate coding from Listener (PICC) to Poller (PCD) */
DiegoOstuni 0:75fc82583a41 279 rfalBitRate DRI; /*!< Bit Rate coding from Poller (PCD) to Listener (PICC) */
DiegoOstuni 0:75fc82583a41 280 uint8_t DID; /*!< Device ID */
DiegoOstuni 0:75fc82583a41 281 uint8_t NAD; /*!< Node ADdress */
DiegoOstuni 0:75fc82583a41 282 bool supDID; /*!< DID supported flag */
DiegoOstuni 0:75fc82583a41 283 bool supNAD; /*!< NAD supported flag */
DiegoOstuni 0:75fc82583a41 284 bool supAdFt; /*!< Advanced Features supported flag */
DiegoOstuni 0:75fc82583a41 285 } rfalIsoDepInfo;
DiegoOstuni 0:75fc82583a41 286
DiegoOstuni 0:75fc82583a41 287
DiegoOstuni 0:75fc82583a41 288 /*! ISO-DEP Device structure */
DiegoOstuni 0:75fc82583a41 289 typedef struct {
DiegoOstuni 0:75fc82583a41 290 rfalIsoDepActivation activation; /*!< Activation Info */
DiegoOstuni 0:75fc82583a41 291 rfalIsoDepInfo info; /*!< ISO-DEP (ISO14443-4) device Info */
DiegoOstuni 0:75fc82583a41 292 } rfalIsoDepDevice;
DiegoOstuni 0:75fc82583a41 293
DiegoOstuni 0:75fc82583a41 294
DiegoOstuni 0:75fc82583a41 295 /*! ATTRIB Response parameters */
DiegoOstuni 0:75fc82583a41 296 typedef struct
DiegoOstuni 0:75fc82583a41 297 {
DiegoOstuni 0:75fc82583a41 298 uint8_t mbli; /*!< MBLI */
DiegoOstuni 0:75fc82583a41 299 uint8_t HLInfo[RFAL_ISODEP_ATTRIB_HLINFO_LEN]; /*!< Hi Layer Information */
DiegoOstuni 0:75fc82583a41 300 uint8_t HLInfoLen; /*!< Hi Layer Information Length */
DiegoOstuni 0:75fc82583a41 301 } rfalIsoDepAttribResParam;
DiegoOstuni 0:75fc82583a41 302
DiegoOstuni 0:75fc82583a41 303
DiegoOstuni 0:75fc82583a41 304 /*! ATS Response parameter */
DiegoOstuni 0:75fc82583a41 305 typedef struct
DiegoOstuni 0:75fc82583a41 306 {
DiegoOstuni 0:75fc82583a41 307 uint8_t fsci; /*!< Frame Size of Proximity Card Integer */
DiegoOstuni 0:75fc82583a41 308 uint8_t fwi; /*!< Frame Waiting Time Integer */
DiegoOstuni 0:75fc82583a41 309 uint8_t sfgi; /*!< Start-Up Frame Guard Time Integer */
DiegoOstuni 0:75fc82583a41 310 bool didSupport; /*!< DID Supported */
DiegoOstuni 0:75fc82583a41 311 uint8_t ta; /*!< Max supported bitrate both direction */
DiegoOstuni 0:75fc82583a41 312 uint8_t *hb; /*!< Historical Bytes data */
DiegoOstuni 0:75fc82583a41 313 uint8_t hbLen; /*!< Historical Bytes Length */
DiegoOstuni 0:75fc82583a41 314 } rfalIsoDepAtsParam;
DiegoOstuni 0:75fc82583a41 315
DiegoOstuni 0:75fc82583a41 316
DiegoOstuni 0:75fc82583a41 317 /*! Structure of I-Block Buffer format from caller */
DiegoOstuni 0:75fc82583a41 318 typedef struct
DiegoOstuni 0:75fc82583a41 319 {
DiegoOstuni 0:75fc82583a41 320 uint8_t prologue[RFAL_ISODEP_PROLOGUE_SIZE]; /*!< Prologue/SoD buffer */
DiegoOstuni 0:75fc82583a41 321 uint8_t inf[RFAL_ISODEP_DEFAULT_FSC]; /*!< INF/Payload buffer */
DiegoOstuni 0:75fc82583a41 322 } rfalIsoDepBufFormat;
DiegoOstuni 0:75fc82583a41 323
DiegoOstuni 0:75fc82583a41 324
DiegoOstuni 0:75fc82583a41 325 /*! Structure of APDU Buffer format from caller */
DiegoOstuni 0:75fc82583a41 326 typedef struct
DiegoOstuni 0:75fc82583a41 327 {
DiegoOstuni 0:75fc82583a41 328 uint8_t prologue[RFAL_ISODEP_PROLOGUE_SIZE]; /*!< Prologue/SoD buffer */
DiegoOstuni 0:75fc82583a41 329 uint8_t apdu[RFAL_ISODEP_APDU_MAX_LEN]; /*!< APDU/Payload buffer */
DiegoOstuni 0:75fc82583a41 330 } rfalIsoDepApduBufFormat;
DiegoOstuni 0:75fc82583a41 331
DiegoOstuni 0:75fc82583a41 332
DiegoOstuni 0:75fc82583a41 333 /*! Listen Activation Parameters Structure */
DiegoOstuni 0:75fc82583a41 334 typedef struct
DiegoOstuni 0:75fc82583a41 335 {
DiegoOstuni 0:75fc82583a41 336 rfalIsoDepBufFormat *rxBuf; /*!< Receive Buffer struct reference */
DiegoOstuni 0:75fc82583a41 337 uint16_t *rxLen; /*!< Received INF data length in Bytes */
DiegoOstuni 0:75fc82583a41 338 bool *isRxChaining; /*!< Received data is not complete */
DiegoOstuni 0:75fc82583a41 339 rfalIsoDepDevice *isoDepDev; /*!< ISO-DEP device info */
DiegoOstuni 0:75fc82583a41 340 } rfalIsoDepListenActvParam;
DiegoOstuni 0:75fc82583a41 341
DiegoOstuni 0:75fc82583a41 342
DiegoOstuni 0:75fc82583a41 343 /*! Structure of parameters used on ISO DEP Transceive */
DiegoOstuni 0:75fc82583a41 344 typedef struct
DiegoOstuni 0:75fc82583a41 345 {
DiegoOstuni 0:75fc82583a41 346 rfalIsoDepBufFormat *txBuf; /*!< Transmit Buffer struct reference */
DiegoOstuni 0:75fc82583a41 347 uint16_t txBufLen; /*!< Transmit Buffer INF field length in Bytes*/
DiegoOstuni 0:75fc82583a41 348 bool isTxChaining; /*!< Transmit data is not complete */
DiegoOstuni 0:75fc82583a41 349 rfalIsoDepBufFormat *rxBuf; /*!< Receive Buffer struct reference in Bytes */
DiegoOstuni 0:75fc82583a41 350 uint16_t *rxLen; /*!< Received INF data length in Bytes */
DiegoOstuni 0:75fc82583a41 351 bool *isRxChaining; /*!< Received data is not complete */
DiegoOstuni 0:75fc82583a41 352 uint32_t FWT; /*!< FWT to be used (ignored in Listen Mode) */
DiegoOstuni 0:75fc82583a41 353 uint32_t dFWT; /*!< Delta FWT to be used */
DiegoOstuni 0:75fc82583a41 354 uint16_t ourFSx; /*!< Our device Frame Size (FSD or FSC) */
DiegoOstuni 0:75fc82583a41 355 uint16_t FSx; /*!< Other device Frame Size (FSD or FSC) */
DiegoOstuni 0:75fc82583a41 356 uint8_t DID; /*!< Device ID (RFAL_ISODEP_NO_DID if no DID) */
DiegoOstuni 0:75fc82583a41 357 } rfalIsoDepTxRxParam;
DiegoOstuni 0:75fc82583a41 358
DiegoOstuni 0:75fc82583a41 359
DiegoOstuni 0:75fc82583a41 360 /*! Structure of parameters used on ISO DEP APDU Transceive */
DiegoOstuni 0:75fc82583a41 361 typedef struct
DiegoOstuni 0:75fc82583a41 362 {
DiegoOstuni 0:75fc82583a41 363 rfalIsoDepApduBufFormat *txBuf; /*!< Transmit Buffer struct reference */
DiegoOstuni 0:75fc82583a41 364 uint16_t txBufLen; /*!< Transmit Buffer INF field length in Bytes*/
DiegoOstuni 0:75fc82583a41 365 rfalIsoDepApduBufFormat *rxBuf; /*!< Receive Buffer struct reference in Bytes */
DiegoOstuni 0:75fc82583a41 366 uint16_t *rxLen; /*!< Received INF data length in Bytes */
DiegoOstuni 0:75fc82583a41 367 rfalIsoDepBufFormat *tmpBuf; /*!< Temp buffer for Rx I-Blocks (internal) */
DiegoOstuni 0:75fc82583a41 368 uint32_t FWT; /*!< FWT to be used (ignored in Listen Mode) */
DiegoOstuni 0:75fc82583a41 369 uint32_t dFWT; /*!< Delta FWT to be used */
DiegoOstuni 0:75fc82583a41 370 uint16_t FSx; /*!< Other device Frame Size (FSD or FSC) */
DiegoOstuni 0:75fc82583a41 371 uint16_t ourFSx; /*!< Our device Frame Size (FSD or FSC) */
DiegoOstuni 0:75fc82583a41 372 uint8_t DID; /*!< Device ID (RFAL_ISODEP_NO_DID if no DID) */
DiegoOstuni 0:75fc82583a41 373 } rfalIsoDepApduTxRxParam;
DiegoOstuni 0:75fc82583a41 374
DiegoOstuni 0:75fc82583a41 375 /*
DiegoOstuni 0:75fc82583a41 376 ******************************************************************************
DiegoOstuni 0:75fc82583a41 377 * GLOBAL FUNCTION PROTOTYPES
DiegoOstuni 0:75fc82583a41 378 ******************************************************************************
DiegoOstuni 0:75fc82583a41 379 */
DiegoOstuni 0:75fc82583a41 380
DiegoOstuni 0:75fc82583a41 381
DiegoOstuni 0:75fc82583a41 382 /*!
DiegoOstuni 0:75fc82583a41 383 ******************************************************************************
DiegoOstuni 0:75fc82583a41 384 * \brief Initialize the ISO-DEP protocol
DiegoOstuni 0:75fc82583a41 385 *
DiegoOstuni 0:75fc82583a41 386 * Initialize the ISO-DEP protocol layer with default config
DiegoOstuni 0:75fc82583a41 387 ******************************************************************************
DiegoOstuni 0:75fc82583a41 388 */
DiegoOstuni 0:75fc82583a41 389 void rfalIsoDepInitialize( void );
DiegoOstuni 0:75fc82583a41 390
DiegoOstuni 0:75fc82583a41 391
DiegoOstuni 0:75fc82583a41 392 /*!
DiegoOstuni 0:75fc82583a41 393 ******************************************************************************
DiegoOstuni 0:75fc82583a41 394 * \brief Initialize the ISO-DEP protocol
DiegoOstuni 0:75fc82583a41 395 *
DiegoOstuni 0:75fc82583a41 396 * Initialize the ISO-DEP protocol layer with additional parameters allowing
DiegoOstuni 0:75fc82583a41 397 * to customise the protocol layer for specific behaviours
DiegoOstuni 0:75fc82583a41 398 *
DiegoOstuni 0:75fc82583a41 399 * \param[in] compMode : compliance mode to be performed
DiegoOstuni 0:75fc82583a41 400 * \param[in] maxRetriesR : Number of retries for a R-Block
DiegoOstuni 0:75fc82583a41 401 * \param[in] maxRetriesS : Number of retries for a S-Block
DiegoOstuni 0:75fc82583a41 402 * \param[in] maxRetriesI : Number of retries for a I-Block
DiegoOstuni 0:75fc82583a41 403 * \param[in] maxRetriesRATS : Number of retries for RATS
DiegoOstuni 0:75fc82583a41 404 *
DiegoOstuni 0:75fc82583a41 405 ******************************************************************************
DiegoOstuni 0:75fc82583a41 406 */
DiegoOstuni 0:75fc82583a41 407 void rfalIsoDepInitializeWithParams( rfalComplianceMode compMode, uint8_t maxRetriesR, uint8_t maxRetriesS, uint8_t maxRetriesI, uint8_t maxRetriesRATS );
DiegoOstuni 0:75fc82583a41 408
DiegoOstuni 0:75fc82583a41 409
DiegoOstuni 0:75fc82583a41 410 /*!
DiegoOstuni 0:75fc82583a41 411 *****************************************************************************
DiegoOstuni 0:75fc82583a41 412 * \brief FSxI to FSx
DiegoOstuni 0:75fc82583a41 413 *
DiegoOstuni 0:75fc82583a41 414 * Convert Frame Size for proximity coupling Device Integer (FSxI) to
DiegoOstuni 0:75fc82583a41 415 * Frame Size for proximity coupling Device (FSx)
DiegoOstuni 0:75fc82583a41 416 *
DiegoOstuni 0:75fc82583a41 417 * FSD - maximum frame size for NFC Forum Device in Poll Mode
DiegoOstuni 0:75fc82583a41 418 * FSC - maximum frame size for NFC Forum Device in Listen Mode
DiegoOstuni 0:75fc82583a41 419 *
DiegoOstuni 0:75fc82583a41 420 * FSxI = FSDI or FSCI
DiegoOstuni 0:75fc82583a41 421 * FSx = FSD or FSC
DiegoOstuni 0:75fc82583a41 422 *
DiegoOstuni 0:75fc82583a41 423 * The FSD/FSC value includes the header and CRC
DiegoOstuni 0:75fc82583a41 424 *
DiegoOstuni 0:75fc82583a41 425 * \param[in] fsxi : Frame Size for proximity coupling Device Integer
DiegoOstuni 0:75fc82583a41 426 *
DiegoOstuni 0:75fc82583a41 427 * \return fsx : Frame Size for proximity coupling Device (FSD or FSC)
DiegoOstuni 0:75fc82583a41 428 *
DiegoOstuni 0:75fc82583a41 429 *****************************************************************************
DiegoOstuni 0:75fc82583a41 430 */
DiegoOstuni 0:75fc82583a41 431 uint16_t rfalIsoDepFSxI2FSx( uint8_t fsxi );
DiegoOstuni 0:75fc82583a41 432
DiegoOstuni 0:75fc82583a41 433
DiegoOstuni 0:75fc82583a41 434 /*!
DiegoOstuni 0:75fc82583a41 435 *****************************************************************************
DiegoOstuni 0:75fc82583a41 436 * \brief FWI to FWT
DiegoOstuni 0:75fc82583a41 437 *
DiegoOstuni 0:75fc82583a41 438 * Convert Frame Waiting time Integer (FWI) to Frame Waiting Time (FWT) in
DiegoOstuni 0:75fc82583a41 439 * 1/fc units
DiegoOstuni 0:75fc82583a41 440 *
DiegoOstuni 0:75fc82583a41 441 * \param[in] fwi : Frame Waiting time Integer
DiegoOstuni 0:75fc82583a41 442 *
DiegoOstuni 0:75fc82583a41 443 * \return fwt : Frame Waiting Time in 1/fc units
DiegoOstuni 0:75fc82583a41 444 *
DiegoOstuni 0:75fc82583a41 445 *****************************************************************************
DiegoOstuni 0:75fc82583a41 446 */
DiegoOstuni 0:75fc82583a41 447 uint32_t rfalIsoDepFWI2FWT( uint8_t fwi );
DiegoOstuni 0:75fc82583a41 448
DiegoOstuni 0:75fc82583a41 449
DiegoOstuni 0:75fc82583a41 450 /*!
DiegoOstuni 0:75fc82583a41 451 *****************************************************************************
DiegoOstuni 0:75fc82583a41 452 * \brief Check if the buffer data contains a valid RATS command
DiegoOstuni 0:75fc82583a41 453 *
DiegoOstuni 0:75fc82583a41 454 * Check if it is a well formed RATS command with 2 bytes
DiegoOstuni 0:75fc82583a41 455 * This function does not check the validity of FSDI and DID
DiegoOstuni 0:75fc82583a41 456 *
DiegoOstuni 0:75fc82583a41 457 * \param[in] buf : reference to buffer containing the data to be checked
DiegoOstuni 0:75fc82583a41 458 * \param[in] bufLen : length of data in the buffer in bytes
DiegoOstuni 0:75fc82583a41 459 *
DiegoOstuni 0:75fc82583a41 460 * \return true if the data indicates a RATS command; false otherwise
DiegoOstuni 0:75fc82583a41 461 *****************************************************************************
DiegoOstuni 0:75fc82583a41 462 */
DiegoOstuni 0:75fc82583a41 463 bool rfalIsoDepIsRats( uint8_t *buf, uint8_t bufLen );
DiegoOstuni 0:75fc82583a41 464
DiegoOstuni 0:75fc82583a41 465
DiegoOstuni 0:75fc82583a41 466 /*!
DiegoOstuni 0:75fc82583a41 467 *****************************************************************************
DiegoOstuni 0:75fc82583a41 468 * \brief Check if the buffer data contains a valid ATTRIB command
DiegoOstuni 0:75fc82583a41 469 *
DiegoOstuni 0:75fc82583a41 470 * Check if it is a well formed ATTRIB command, but does not check the
DiegoOstuni 0:75fc82583a41 471 * validity of the information inside
DiegoOstuni 0:75fc82583a41 472 *
DiegoOstuni 0:75fc82583a41 473 * \param[in] buf : reference to buffer containing the data to be checked
DiegoOstuni 0:75fc82583a41 474 * \param[in] bufLen : length of data in the buffer in bytes
DiegoOstuni 0:75fc82583a41 475 *
DiegoOstuni 0:75fc82583a41 476 * \return true if the data indicates a ATTRIB command; false otherwise
DiegoOstuni 0:75fc82583a41 477 *****************************************************************************
DiegoOstuni 0:75fc82583a41 478 */
DiegoOstuni 0:75fc82583a41 479 bool rfalIsoDepIsAttrib( uint8_t *buf, uint8_t bufLen );
DiegoOstuni 0:75fc82583a41 480
DiegoOstuni 0:75fc82583a41 481
DiegoOstuni 0:75fc82583a41 482 /*!
DiegoOstuni 0:75fc82583a41 483 *****************************************************************************
DiegoOstuni 0:75fc82583a41 484 * \brief Start Listen Activation Handling
DiegoOstuni 0:75fc82583a41 485 *
DiegoOstuni 0:75fc82583a41 486 * Start Listen Activation Handling and setup to receive first I-block which may
DiegoOstuni 0:75fc82583a41 487 * contain complete or partial APDU after activation is completed
DiegoOstuni 0:75fc82583a41 488 *
DiegoOstuni 0:75fc82583a41 489 * Pass in RATS for T4AT, or ATTRIB for T4BT, to handle ATS or ATTRIB Response respectively
DiegoOstuni 0:75fc82583a41 490 * The Activation Handling handles ATS and ATTRIB Response; and additionally PPS Response
DiegoOstuni 0:75fc82583a41 491 * if a PPS is received for T4AT.
DiegoOstuni 0:75fc82583a41 492 * The method uses the current RFAL state machine to determine if it is expecting RATS or ATTRIB
DiegoOstuni 0:75fc82583a41 493 *
DiegoOstuni 0:75fc82583a41 494 * Activation is completed if PPS Response is sent or if first PDU is received in T4T-A
DiegoOstuni 0:75fc82583a41 495 * Activation is completed if ATTRIB Response is sent in T4T-B
DiegoOstuni 0:75fc82583a41 496 *
DiegoOstuni 0:75fc82583a41 497 * \ref rfalIsoDepListenGetActivationStatus provide status if activation is completed.
DiegoOstuni 0:75fc82583a41 498 * \ref rfalIsoDepStartTransceive shall be called right after activation is completed
DiegoOstuni 0:75fc82583a41 499 *
DiegoOstuni 0:75fc82583a41 500 * \param[in] atsParam : reference to ATS parameters
DiegoOstuni 0:75fc82583a41 501 * \param[in] attribResParam : reference to ATTRIB_RES parameters
DiegoOstuni 0:75fc82583a41 502 * \param[in] buf : reference to buffer containing RATS or ATTRIB
DiegoOstuni 0:75fc82583a41 503 * \param[in] bufLen : length in bytes of the given bufffer
DiegoOstuni 0:75fc82583a41 504 * \param[in] rxParam : reference to incoming reception information will be placed
DiegoOstuni 0:75fc82583a41 505 *
DiegoOstuni 0:75fc82583a41 506 *
DiegoOstuni 0:75fc82583a41 507 * \warning Once the Activation has been completed the method
DiegoOstuni 0:75fc82583a41 508 * rfalIsoDepGetTransceiveStatus() must be called.
DiegoOstuni 0:75fc82583a41 509 * If activation has completed due to reception of a data block (not PPS) the
DiegoOstuni 0:75fc82583a41 510 * buffer owned by the caller and passed on rxParam must still contain this data.
DiegoOstuni 0:75fc82583a41 511 * The first data will be processed (I-Block or S-DSL) by rfalIsoDepGetTransceiveStatus()
DiegoOstuni 0:75fc82583a41 512 * inform the caller and then for the next transaction use rfalIsoDepStartTransceive()
DiegoOstuni 0:75fc82583a41 513 *
DiegoOstuni 0:75fc82583a41 514 * \return ERR_NONE : RATS/ATTRIB is valid and activation has started
DiegoOstuni 0:75fc82583a41 515 * \return ERR_PARAM : Invalid parameters
DiegoOstuni 0:75fc82583a41 516 * \return ERR_PROTO : Invalid request
DiegoOstuni 0:75fc82583a41 517 * \return ERR_NOTSUPP : Feature not supported
DiegoOstuni 0:75fc82583a41 518 *****************************************************************************
DiegoOstuni 0:75fc82583a41 519 */
DiegoOstuni 0:75fc82583a41 520 ReturnCode rfalIsoDepListenStartActivation( rfalIsoDepAtsParam *atsParam, rfalIsoDepAttribResParam *attribResParam, uint8_t *buf, uint16_t bufLen, rfalIsoDepListenActvParam rxParam, 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 521
DiegoOstuni 0:75fc82583a41 522
DiegoOstuni 0:75fc82583a41 523 /*!
DiegoOstuni 0:75fc82583a41 524 *****************************************************************************
DiegoOstuni 0:75fc82583a41 525 * \brief Get the current Activation Status
DiegoOstuni 0:75fc82583a41 526 *
DiegoOstuni 0:75fc82583a41 527 * \return ERR_NONE if Activation is already completed
DiegoOstuni 0:75fc82583a41 528 * \return ERR_BUSY if Activation is ongoing
DiegoOstuni 0:75fc82583a41 529 * \return ERR_LINK_LOSS if Remote Field is turned off
DiegoOstuni 0:75fc82583a41 530 *****************************************************************************
DiegoOstuni 0:75fc82583a41 531 */
DiegoOstuni 0:75fc82583a41 532 ReturnCode rfalIsoDepListenGetActivationStatus( 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 533
DiegoOstuni 0:75fc82583a41 534
DiegoOstuni 0:75fc82583a41 535 /*!
DiegoOstuni 0:75fc82583a41 536 *****************************************************************************
DiegoOstuni 0:75fc82583a41 537 * \brief Get the ISO-DEP Communication Information
DiegoOstuni 0:75fc82583a41 538 *
DiegoOstuni 0:75fc82583a41 539 * Gets the maximum INF length in bytes based on current Frame Size
DiegoOstuni 0:75fc82583a41 540 * for proximity coupling Device (FSD or FSC) excluding the header and CRC
DiegoOstuni 0:75fc82583a41 541 *
DiegoOstuni 0:75fc82583a41 542 * \return maximum INF length in bytes
DiegoOstuni 0:75fc82583a41 543 *****************************************************************************
DiegoOstuni 0:75fc82583a41 544 */
DiegoOstuni 0:75fc82583a41 545 uint16_t rfalIsoDepGetMaxInfLen( void );
DiegoOstuni 0:75fc82583a41 546
DiegoOstuni 0:75fc82583a41 547
DiegoOstuni 0:75fc82583a41 548 /*!
DiegoOstuni 0:75fc82583a41 549 *****************************************************************************
DiegoOstuni 0:75fc82583a41 550 * \brief ISO-DEP Start Transceive
DiegoOstuni 0:75fc82583a41 551 *
DiegoOstuni 0:75fc82583a41 552 * This method triggers a ISO-DEP Transceive containing a complete or
DiegoOstuni 0:75fc82583a41 553 * partial APDU
DiegoOstuni 0:75fc82583a41 554 * It transmits the given message and handles all protocol retransmitions,
DiegoOstuni 0:75fc82583a41 555 * error handling and control messages
DiegoOstuni 0:75fc82583a41 556 *
DiegoOstuni 0:75fc82583a41 557 * The txBuf contains a complete or partial APDU (INF) to be transmitted
DiegoOstuni 0:75fc82583a41 558 * The Prologue field will be manipulated by the Transceive
DiegoOstuni 0:75fc82583a41 559 *
DiegoOstuni 0:75fc82583a41 560 * If the buffer contains a partial APDU and is not the last block,
DiegoOstuni 0:75fc82583a41 561 * then isTxChaining must be set to true
DiegoOstuni 0:75fc82583a41 562 *
DiegoOstuni 0:75fc82583a41 563 * \param[in] param: reference parameters to be used for the Transceive
DiegoOstuni 0:75fc82583a41 564 *
DiegoOstuni 0:75fc82583a41 565 * \return ERR_PARAM : Bad request
DiegoOstuni 0:75fc82583a41 566 * \return ERR_WRONG_STATE : The module is not in a proper state
DiegoOstuni 0:75fc82583a41 567 * \return ERR_NONE : The Transceive request has been started
DiegoOstuni 0:75fc82583a41 568 *****************************************************************************
DiegoOstuni 0:75fc82583a41 569 */
DiegoOstuni 0:75fc82583a41 570 ReturnCode rfalIsoDepStartTransceive( rfalIsoDepTxRxParam param );
DiegoOstuni 0:75fc82583a41 571
DiegoOstuni 0:75fc82583a41 572
DiegoOstuni 0:75fc82583a41 573 /*!
DiegoOstuni 0:75fc82583a41 574 *****************************************************************************
DiegoOstuni 0:75fc82583a41 575 * \brief Get the Transceive status
DiegoOstuni 0:75fc82583a41 576 *
DiegoOstuni 0:75fc82583a41 577 * Returns the status of the ISO-DEP Transceive
DiegoOstuni 0:75fc82583a41 578 *
DiegoOstuni 0:75fc82583a41 579 * \warning When the other device is performing chaining once a chained
DiegoOstuni 0:75fc82583a41 580 * block is received the error ERR_AGAIN is sent. At this point
DiegoOstuni 0:75fc82583a41 581 * caller must handle the received data immediately.
DiegoOstuni 0:75fc82583a41 582 * When ERR_AGAIN is returned an ACK has already been sent to
DiegoOstuni 0:75fc82583a41 583 * the other device and the next block might be incoming.
DiegoOstuni 0:75fc82583a41 584 * If rfalWorker() is called frequently it will place the next
DiegoOstuni 0:75fc82583a41 585 * block on the given buffer
DiegoOstuni 0:75fc82583a41 586 *
DiegoOstuni 0:75fc82583a41 587 *
DiegoOstuni 0:75fc82583a41 588 * \return ERR_NONE : Transceive has been completed successfully
DiegoOstuni 0:75fc82583a41 589 * \return ERR_BUSY : Transceive is ongoing
DiegoOstuni 0:75fc82583a41 590 * \return ERR_PROTO : Protocol error occurred
DiegoOstuni 0:75fc82583a41 591 * \return ERR_TIMEOUT : Timeout error occurred
DiegoOstuni 0:75fc82583a41 592 * \return ERR_SLEEP_REQ : Deselect has been received and responded
DiegoOstuni 0:75fc82583a41 593 * \return ERR_NOMEM : The received INF does not fit into the
DiegoOstuni 0:75fc82583a41 594 * receive buffer
DiegoOstuni 0:75fc82583a41 595 * \return ERR_LINK_LOSS : Communication is lost because Reader/Writer
DiegoOstuni 0:75fc82583a41 596 * has turned off its field
DiegoOstuni 0:75fc82583a41 597 * \return ERR_AGAIN : received one chaining block, continue to call
DiegoOstuni 0:75fc82583a41 598 * this method to retrieve the remaining blocks
DiegoOstuni 0:75fc82583a41 599 *****************************************************************************
DiegoOstuni 0:75fc82583a41 600 */
DiegoOstuni 0:75fc82583a41 601 ReturnCode rfalIsoDepGetTransceiveStatus( 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 602
DiegoOstuni 0:75fc82583a41 603
DiegoOstuni 0:75fc82583a41 604 /*!
DiegoOstuni 0:75fc82583a41 605 *****************************************************************************
DiegoOstuni 0:75fc82583a41 606 * \brief ISO-DEP Start APDU Transceive
DiegoOstuni 0:75fc82583a41 607 *
DiegoOstuni 0:75fc82583a41 608 * This method triggers a ISO-DEP Transceive containing a complete APDU
DiegoOstuni 0:75fc82583a41 609 * It transmits the given message and handles all protocol retransmitions,
DiegoOstuni 0:75fc82583a41 610 * error handling and control messages
DiegoOstuni 0:75fc82583a41 611 *
DiegoOstuni 0:75fc82583a41 612 * The txBuf contains a complete APDU to be transmitted
DiegoOstuni 0:75fc82583a41 613 * The Prologue field will be manipulated by the Transceive
DiegoOstuni 0:75fc82583a41 614 *
DiegoOstuni 0:75fc82583a41 615 * \warning the txBuf will be modified during the transmission
DiegoOstuni 0:75fc82583a41 616 * \warning the maximum RF frame which can be received is limited by param.tmpBuf
DiegoOstuni 0:75fc82583a41 617 *
DiegoOstuni 0:75fc82583a41 618 * \param[in] param: reference parameters to be used for the Transceive
DiegoOstuni 0:75fc82583a41 619 *
DiegoOstuni 0:75fc82583a41 620 * \return ERR_PARAM : Bad request
DiegoOstuni 0:75fc82583a41 621 * \return ERR_WRONG_STATE : The module is not in a proper state
DiegoOstuni 0:75fc82583a41 622 * \return ERR_NONE : The Transceive request has been started
DiegoOstuni 0:75fc82583a41 623 *****************************************************************************
DiegoOstuni 0:75fc82583a41 624 */
DiegoOstuni 0:75fc82583a41 625 ReturnCode rfalIsoDepStartApduTransceive( rfalIsoDepApduTxRxParam param );
DiegoOstuni 0:75fc82583a41 626
DiegoOstuni 0:75fc82583a41 627
DiegoOstuni 0:75fc82583a41 628 /*!
DiegoOstuni 0:75fc82583a41 629 *****************************************************************************
DiegoOstuni 0:75fc82583a41 630 * \brief Get the APDU Transceive status
DiegoOstuni 0:75fc82583a41 631 *
DiegoOstuni 0:75fc82583a41 632 * \return ERR_NONE : if Transceive has been completed successfully
DiegoOstuni 0:75fc82583a41 633 * \return ERR_BUSY : if Transceive is ongoing
DiegoOstuni 0:75fc82583a41 634 * \return ERR_PROTO : if a protocol error occurred
DiegoOstuni 0:75fc82583a41 635 * \return ERR_TIMEOUT : if a timeout error occurred
DiegoOstuni 0:75fc82583a41 636 * \return ERR_SLEEP_REQ : if Deselect is received and responded
DiegoOstuni 0:75fc82583a41 637 * \return ERR_NOMEM : if the received INF does not fit into the
DiegoOstuni 0:75fc82583a41 638 * receive buffer
DiegoOstuni 0:75fc82583a41 639 * \return ERR_LINK_LOSS : if communication is lost because Reader/Writer
DiegoOstuni 0:75fc82583a41 640 * has turned off its field
DiegoOstuni 0:75fc82583a41 641 *****************************************************************************
DiegoOstuni 0:75fc82583a41 642 */
DiegoOstuni 0:75fc82583a41 643 ReturnCode rfalIsoDepGetApduTransceiveStatus( 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 644
DiegoOstuni 0:75fc82583a41 645 /*!
DiegoOstuni 0:75fc82583a41 646 *****************************************************************************
DiegoOstuni 0:75fc82583a41 647 * \brief ISO-DEP Send RATS
DiegoOstuni 0:75fc82583a41 648 *
DiegoOstuni 0:75fc82583a41 649 * This sends a RATS to make a NFC-A Listen Device to enter
DiegoOstuni 0:75fc82583a41 650 * ISO-DEP layer (ISO14443-4) and checks if the received ATS is valid
DiegoOstuni 0:75fc82583a41 651 *
DiegoOstuni 0:75fc82583a41 652 * \param[in] FSDI : Frame Size Device Integer to be used
DiegoOstuni 0:75fc82583a41 653 * \param[in] DID : Device ID to be used or RFAL_ISODEP_NO_DID for not use DID
DiegoOstuni 0:75fc82583a41 654 * \param[out] ats : pointer to place the ATS Response
DiegoOstuni 0:75fc82583a41 655 * \param[out] atsLen : pointer to place the ATS length
DiegoOstuni 0:75fc82583a41 656 *
DiegoOstuni 0:75fc82583a41 657 * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
DiegoOstuni 0:75fc82583a41 658 * \return ERR_PARAM : Invalid parameters
DiegoOstuni 0:75fc82583a41 659 * \return ERR_IO : Generic internal error
DiegoOstuni 0:75fc82583a41 660 * \return ERR_TIMEOUT : Timeout error
DiegoOstuni 0:75fc82583a41 661 * \return ERR_PAR : Parity error detected
DiegoOstuni 0:75fc82583a41 662 * \return ERR_CRC : CRC error detected
DiegoOstuni 0:75fc82583a41 663 * \return ERR_FRAMING : Framing error detected
DiegoOstuni 0:75fc82583a41 664 * \return ERR_PROTO : Protocol error detected
DiegoOstuni 0:75fc82583a41 665 * \return ERR_NONE : No error, ATS received
DiegoOstuni 0:75fc82583a41 666 *****************************************************************************
DiegoOstuni 0:75fc82583a41 667 */
DiegoOstuni 0:75fc82583a41 668 ReturnCode rfalIsoDepRATS( rfalIsoDepFSxI FSDI, uint8_t DID, rfalIsoDepAts *ats , uint8_t *atsLen, 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 669
DiegoOstuni 0:75fc82583a41 670
DiegoOstuni 0:75fc82583a41 671 /*!
DiegoOstuni 0:75fc82583a41 672 *****************************************************************************
DiegoOstuni 0:75fc82583a41 673 * \brief ISO-DEP Send PPS
DiegoOstuni 0:75fc82583a41 674 *
DiegoOstuni 0:75fc82583a41 675 * This sends a PPS to make a NFC-A Listen Device change the communications
DiegoOstuni 0:75fc82583a41 676 * bit rate from 106kbps to one of the supported bit rates
DiegoOstuni 0:75fc82583a41 677 * Additionally checks if the received PPS response is valid
DiegoOstuni 0:75fc82583a41 678 *
DiegoOstuni 0:75fc82583a41 679 * \param[in] DID : Device ID
DiegoOstuni 0:75fc82583a41 680 * \param[in] DSI : DSI code the divisor from Listener (PICC) to Poller (PCD)
DiegoOstuni 0:75fc82583a41 681 * \param[in] DRI : DRI code the divisor from Poller (PCD) to Listener (PICC)
DiegoOstuni 0:75fc82583a41 682 * \param[out] ppsRes : pointer to place the PPS Response
DiegoOstuni 0:75fc82583a41 683 *
DiegoOstuni 0:75fc82583a41 684 * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
DiegoOstuni 0:75fc82583a41 685 * \return ERR_PARAM : Invalid parameters
DiegoOstuni 0:75fc82583a41 686 * \return ERR_IO : Generic internal error
DiegoOstuni 0:75fc82583a41 687 * \return ERR_TIMEOUT : Timeout error
DiegoOstuni 0:75fc82583a41 688 * \return ERR_PAR : Parity error detected
DiegoOstuni 0:75fc82583a41 689 * \return ERR_CRC : CRC error detected
DiegoOstuni 0:75fc82583a41 690 * \return ERR_FRAMING : Framing error detected
DiegoOstuni 0:75fc82583a41 691 * \return ERR_PROTO : Protocol error detected
DiegoOstuni 0:75fc82583a41 692 * \return ERR_NONE : No error, PPS Response received
DiegoOstuni 0:75fc82583a41 693 *****************************************************************************
DiegoOstuni 0:75fc82583a41 694 */
DiegoOstuni 0:75fc82583a41 695 ReturnCode rfalIsoDepPPS( uint8_t DID, rfalBitRate DSI, rfalBitRate DRI, rfalIsoDepPpsRes *ppsRes, 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 696
DiegoOstuni 0:75fc82583a41 697
DiegoOstuni 0:75fc82583a41 698 /*!
DiegoOstuni 0:75fc82583a41 699 *****************************************************************************
DiegoOstuni 0:75fc82583a41 700 * \brief ISO-DEP Send ATTRIB
DiegoOstuni 0:75fc82583a41 701 *
DiegoOstuni 0:75fc82583a41 702 * This sends a ATTRIB to make a NFC-B Listen Device to enter
DiegoOstuni 0:75fc82583a41 703 * ISO-DEP layer (ISO14443-4) and checks if the received ATTRIB Response is valid
DiegoOstuni 0:75fc82583a41 704 *
DiegoOstuni 0:75fc82583a41 705 * \param[in] nfcid0 : NFCID0 to be used for the ATTRIB
DiegoOstuni 0:75fc82583a41 706 * \param[in] PARAM1 : ATTRIB PARAM1 byte (communication parameters)
DiegoOstuni 0:75fc82583a41 707 * \param[in] DSI : DSI code the divisor from Listener (PICC) to Poller (PCD)
DiegoOstuni 0:75fc82583a41 708 * \param[in] DRI : DRI code the divisor from Poller (PCD) to Listener (PICC)
DiegoOstuni 0:75fc82583a41 709 * \param[in] FSDI : PCD's Frame Size to be announced on the ATTRIB
DiegoOstuni 0:75fc82583a41 710 * \param[in] PARAM3 : ATTRIB PARAM1 byte (protocol type)
DiegoOstuni 0:75fc82583a41 711 * \param[in] DID : Device ID to be used or RFAL_ISODEP_NO_DID for not use DID
DiegoOstuni 0:75fc82583a41 712 * \param[in] HLInfo : pointer to Higher layer INF (NULL if none)
DiegoOstuni 0:75fc82583a41 713 * \param[in] HLInfoLen : Length HLInfo
DiegoOstuni 0:75fc82583a41 714 * \param[in] fwt : Frame Waiting Time to be used (from SENSB_RES)
DiegoOstuni 0:75fc82583a41 715 * \param[out] attribRes : pointer to place the ATTRIB Response
DiegoOstuni 0:75fc82583a41 716 * \param[out] attribResLen : pointer to place the ATTRIB Response length
DiegoOstuni 0:75fc82583a41 717 *
DiegoOstuni 0:75fc82583a41 718 * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
DiegoOstuni 0:75fc82583a41 719 * \return ERR_PARAM : Invalid parameters
DiegoOstuni 0:75fc82583a41 720 * \return ERR_IO : Generic internal error
DiegoOstuni 0:75fc82583a41 721 * \return ERR_TIMEOUT : Timeout error
DiegoOstuni 0:75fc82583a41 722 * \return ERR_CRC : CRC error detected
DiegoOstuni 0:75fc82583a41 723 * \return ERR_FRAMING : Framing error detected
DiegoOstuni 0:75fc82583a41 724 * \return ERR_PROTO : Protocol error detected
DiegoOstuni 0:75fc82583a41 725 * \return ERR_NONE : No error, ATTRIB Response received
DiegoOstuni 0:75fc82583a41 726 *****************************************************************************
DiegoOstuni 0:75fc82583a41 727 */
DiegoOstuni 0:75fc82583a41 728 ReturnCode rfalIsoDepATTRIB( uint8_t* nfcid0, uint8_t PARAM1, rfalBitRate DSI, rfalBitRate DRI, rfalIsoDepFSxI FSDI, uint8_t PARAM3, uint8_t DID, uint8_t* HLInfo, uint8_t HLInfoLen, uint32_t fwt, rfalIsoDepAttribRes *attribRes, uint8_t *attribResLen, 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 729
DiegoOstuni 0:75fc82583a41 730
DiegoOstuni 0:75fc82583a41 731 /*!
DiegoOstuni 0:75fc82583a41 732 *****************************************************************************
DiegoOstuni 0:75fc82583a41 733 * \brief Deselects PICC
DiegoOstuni 0:75fc82583a41 734 *
DiegoOstuni 0:75fc82583a41 735 * This function sends a deselect command to PICC and waits for it`s
DiegoOstuni 0:75fc82583a41 736 * responce in a blocking way
DiegoOstuni 0:75fc82583a41 737 *
DiegoOstuni 0:75fc82583a41 738 * \return ERR_NONE : Deselect successfully sent and acknowledged by PICC
DiegoOstuni 0:75fc82583a41 739 * \return ERR_TIMEOUT: No response rcvd from PICC
DiegoOstuni 0:75fc82583a41 740 *
DiegoOstuni 0:75fc82583a41 741 *****************************************************************************
DiegoOstuni 0:75fc82583a41 742 */
DiegoOstuni 0:75fc82583a41 743 ReturnCode rfalIsoDepDeselect( 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 744
DiegoOstuni 0:75fc82583a41 745 /*!
DiegoOstuni 0:75fc82583a41 746 *****************************************************************************
DiegoOstuni 0:75fc82583a41 747 * \brief ISO-DEP Poller Handle NFC-A Activation
DiegoOstuni 0:75fc82583a41 748 *
DiegoOstuni 0:75fc82583a41 749 * This performs a NFC-A Activation into ISO-DEP layer (ISO14443-4) with the given
DiegoOstuni 0:75fc82583a41 750 * parameters. It sends RATS and if the higher bit rates are supported by
DiegoOstuni 0:75fc82583a41 751 * both devices it additionally sends PPS
DiegoOstuni 0:75fc82583a41 752 * Once Activated all details of the device are provided on isoDepDev
DiegoOstuni 0:75fc82583a41 753 *
DiegoOstuni 0:75fc82583a41 754 * \param[in] FSDI : Frame Size Device Integer to be used
DiegoOstuni 0:75fc82583a41 755 * \param[in] DID : Device ID to be used or RFAL_ISODEP_NO_DID for not use DID
DiegoOstuni 0:75fc82583a41 756 * \param[in] maxBR : Max bit rate supported by the Poller
DiegoOstuni 0:75fc82583a41 757 * \param[out] isoDepDev : ISO-DEP information of the activated Listen device
DiegoOstuni 0:75fc82583a41 758 *
DiegoOstuni 0:75fc82583a41 759 * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
DiegoOstuni 0:75fc82583a41 760 * \return ERR_PARAM : Invalid parameters
DiegoOstuni 0:75fc82583a41 761 * \return ERR_IO : Generic internal error
DiegoOstuni 0:75fc82583a41 762 * \return ERR_TIMEOUT : Timeout error
DiegoOstuni 0:75fc82583a41 763 * \return ERR_PAR : Parity error detected
DiegoOstuni 0:75fc82583a41 764 * \return ERR_CRC : CRC error detected
DiegoOstuni 0:75fc82583a41 765 * \return ERR_FRAMING : Framing error detected
DiegoOstuni 0:75fc82583a41 766 * \return ERR_PROTO : Protocol error detected
DiegoOstuni 0:75fc82583a41 767 * \return ERR_NONE : No error, activation successful
DiegoOstuni 0:75fc82583a41 768 *****************************************************************************
DiegoOstuni 0:75fc82583a41 769 */
DiegoOstuni 0:75fc82583a41 770 ReturnCode rfalIsoDepPollAHandleActivation( rfalIsoDepFSxI FSDI, uint8_t DID, rfalBitRate maxBR, rfalIsoDepDevice *isoDepDev, 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 771
DiegoOstuni 0:75fc82583a41 772
DiegoOstuni 0:75fc82583a41 773 /*!
DiegoOstuni 0:75fc82583a41 774 *****************************************************************************
DiegoOstuni 0:75fc82583a41 775 * \brief ISO-DEP Poller Handle NFC-B Activation
DiegoOstuni 0:75fc82583a41 776 *
DiegoOstuni 0:75fc82583a41 777 * This performs a NFC-B Activation into ISO-DEP layer (ISO14443-4) with the given
DiegoOstuni 0:75fc82583a41 778 * parameters. It sends ATTRIB and calculates supported higher bit rates of both
DiegoOstuni 0:75fc82583a41 779 * devices and performs activation.
DiegoOstuni 0:75fc82583a41 780 * Once Activated all details of the device are provided on isoDepDev
DiegoOstuni 0:75fc82583a41 781 *
DiegoOstuni 0:75fc82583a41 782 * \param[in] FSDI : Frame Size Device Integer to be used
DiegoOstuni 0:75fc82583a41 783 * \param[in] DID : Device ID to be used or RFAL_ISODEP_NO_DID for not use DID
DiegoOstuni 0:75fc82583a41 784 * \param[in] maxBR : Max bit rate supported by the Poller
DiegoOstuni 0:75fc82583a41 785 * \param[in] PARAM1 : ATTRIB PARAM1 byte (communication parameters)
DiegoOstuni 0:75fc82583a41 786 * \param[in] nfcbDev : pointer to the NFC-B Device containing the SENSB_RES
DiegoOstuni 0:75fc82583a41 787 * \param[in] HLInfo : pointer to Higher layer INF (NULL if none)
DiegoOstuni 0:75fc82583a41 788 * \param[in] HLInfoLen : Length HLInfo
DiegoOstuni 0:75fc82583a41 789 * \param[out] isoDepDev : ISO-DEP information of the activated Listen device
DiegoOstuni 0:75fc82583a41 790 *
DiegoOstuni 0:75fc82583a41 791 * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
DiegoOstuni 0:75fc82583a41 792 * \return ERR_PARAM : Invalid parameters
DiegoOstuni 0:75fc82583a41 793 * \return ERR_IO : Generic internal error
DiegoOstuni 0:75fc82583a41 794 * \return ERR_TIMEOUT : Timeout error
DiegoOstuni 0:75fc82583a41 795 * \return ERR_PAR : Parity error detected
DiegoOstuni 0:75fc82583a41 796 * \return ERR_CRC : CRC error detected
DiegoOstuni 0:75fc82583a41 797 * \return ERR_FRAMING : Framing error detected
DiegoOstuni 0:75fc82583a41 798 * \return ERR_PROTO : Protocol error detected
DiegoOstuni 0:75fc82583a41 799 * \return ERR_NONE : No error, activation successful
DiegoOstuni 0:75fc82583a41 800 *****************************************************************************
DiegoOstuni 0:75fc82583a41 801 */
DiegoOstuni 0:75fc82583a41 802 ReturnCode rfalIsoDepPollBHandleActivation( rfalIsoDepFSxI FSDI, uint8_t DID, rfalBitRate maxBR, uint8_t PARAM1, rfalNfcbListenDevice *nfcbDev, uint8_t* HLInfo, uint8_t HLInfoLen, rfalIsoDepDevice *isoDepDev, 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 803
DiegoOstuni 0:75fc82583a41 804
DiegoOstuni 0:75fc82583a41 805 #endif /* RFAL_ISODEP_H_ */
DiegoOstuni 0:75fc82583a41 806
DiegoOstuni 0:75fc82583a41 807 /**
DiegoOstuni 0:75fc82583a41 808 * @}
DiegoOstuni 0:75fc82583a41 809 *
DiegoOstuni 0:75fc82583a41 810 * @}
DiegoOstuni 0:75fc82583a41 811 *
DiegoOstuni 0:75fc82583a41 812 * @}
DiegoOstuni 0:75fc82583a41 813 */