Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-os-example-nfc-EEPROM
st25dv.h
00001 /** 00002 ****************************************************************************** 00003 * @file st25dv.h 00004 * @author MMY Application Team 00005 * @version $Revision: 3308 $ 00006 * @date $Date: 2017-01-13 11:19:33 +0100 (Fri, 13 Jan 2017) $ 00007 * @brief This file provides set of driver functions to manage communication 00008 * @brief between MCU and ST25DV chip 00009 ****************************************************************************** 00010 * @attention 00011 * 00012 * <h2><center>© COPYRIGHT 2016 STMicroelectronics</center></h2> 00013 * 00014 * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License"); 00015 * You may not use this file except in compliance with the License. 00016 * You may obtain a copy of the License at: 00017 * 00018 * http://www.st.com/myliberty 00019 * 00020 * Unless required by applicable law or agreed to in writing, software 00021 * distributed under the License is distributed on an "AS IS" BASIS, 00022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, 00023 * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY, 00024 * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. 00025 * See the License for the specific language governing permissions and 00026 * limitations under the License. 00027 * 00028 ****************************************************************************** 00029 */ 00030 00031 /* Define to prevent recursive inclusion -------------------------------------*/ 00032 #ifndef __ST25DV_H 00033 #define __ST25DV_H 00034 00035 00036 /* Includes ------------------------------------------------------------------*/ 00037 #include <stdint.h> 00038 #include <stddef.h> 00039 #include "mbed.h" 00040 00041 00042 00043 /** @addtogroup BSP 00044 * @{ 00045 */ 00046 00047 00048 /** @addtogroup ST25DV 00049 * @{ 00050 */ 00051 00052 /* Exported types ------------------------------------------------------------*/ 00053 /** 00054 * @brief NFCTAG status enumerator definition. 00055 */ 00056 typedef enum 00057 { 00058 NFCTAG_OK = 0, 00059 NFCTAG_ERROR = 1, 00060 NFCTAG_BUSY = 2, 00061 NFCTAG_TIMEOUT = 3, 00062 NFCTAG_NACK = 4 00063 } NFCTAG_StatusTypeDef; 00064 00065 /** 00066 * @brief ST25DV Enable Disable enumerator definition. 00067 */ 00068 typedef enum 00069 { 00070 ST25DV_DISABLE = 0, 00071 ST25DV_ENABLE 00072 } ST25DV_EN_STATUS; 00073 00074 /** 00075 * @brief ST25DV Energy Harvesting mode enumerator definition. 00076 */ 00077 typedef enum 00078 { 00079 ST25DV_EH_ACTIVE_AFTER_BOOT = 0, 00080 ST25DV_EH_ON_DEMAND 00081 } ST25DV_EH_MODE_STATUS; 00082 00083 /** 00084 * @brief ST25DV FIELD status enumerator definition. 00085 */ 00086 typedef enum 00087 { 00088 ST25DV_FIELD_OFF = 0, 00089 ST25DV_FIELD_ON 00090 } ST25DV_FIELD_STATUS; 00091 00092 /** 00093 * @brief ST25DV VCC status enumerator definition 00094 */ 00095 typedef enum 00096 { 00097 ST25DV_VCC_OFF = 0, 00098 ST25DV_VCC_ON 00099 } ST25DV_VCC_STATUS; 00100 00101 /** 00102 * @brief ST25DV protection status enumerator definition 00103 */ 00104 typedef enum 00105 { 00106 ST25DV_NO_PROT = 0, 00107 ST25DV_WRITE_PROT, 00108 ST25DV_READ_PROT, 00109 ST25DV_READWRITE_PROT 00110 } ST25DV_PROTECTION_CONF; 00111 00112 /** 00113 * @brief ST25DV area protection enumerator definition. 00114 */ 00115 typedef enum 00116 { 00117 ST25DV_PROT_ZONE1 = 0, 00118 ST25DV_PROT_ZONE2, 00119 ST25DV_PROT_ZONE3, 00120 ST25DV_PROT_ZONE4 00121 } ST25DV_PROTECTION_ZONE; 00122 00123 /** 00124 * @brief ST25DV password protection status enumerator definition. 00125 */ 00126 typedef enum 00127 { 00128 ST25DV_NOT_PROTECTED = 0, 00129 ST25DV_PROT_PASSWD1, 00130 ST25DV_PROT_PASSWD2, 00131 ST25DV_PROT_PASSWD3 00132 } ST25DV_PASSWD_PROT_STATUS; 00133 00134 /** 00135 * @brief ST25DV lock status enumerator definition. 00136 */ 00137 typedef enum 00138 { 00139 ST25DV_UNLOCKED = 0, 00140 ST25DV_LOCKED 00141 } ST25DV_LOCK_STATUS; 00142 00143 /** 00144 * @brief ST25DV Number of Blocks for the CCFile enumerator definition. 00145 */ 00146 typedef enum 00147 { 00148 ST25DV_CCFILE_1BLCK = 0, 00149 ST25DV_CCFILE_2BLCK 00150 } ST25DV_CCFILE_BLOCK; 00151 00152 /** 00153 * @brief ST25DV session status enumerator definition. 00154 */ 00155 typedef enum 00156 { 00157 ST25DV_SESSION_CLOSED = 0, 00158 ST25DV_SESSION_OPEN 00159 } ST25DV_I2CSSO_STATUS; 00160 00161 /** 00162 * @brief ST25DV area end address enumerator definition. 00163 */ 00164 typedef enum 00165 { 00166 ST25DV_ZONE_END1 = 0, 00167 ST25DV_ZONE_END2, 00168 ST25DV_ZONE_END3 00169 } ST25DV_END_ZONE; 00170 00171 /** 00172 * @brief ST25DV IT pulse duration enumerator definition. 00173 */ 00174 typedef enum 00175 { 00176 ST25DV_302_US = 0, 00177 ST25DV_264_US, 00178 ST25DV_226_US, 00179 ST25DV_188_US, 00180 ST25DV_151_US, 00181 ST25DV_113_US, 00182 ST25DV_75_US, 00183 ST25DV_37_US 00184 } ST25DV_PULSE_DURATION; 00185 00186 /** 00187 * @brief ST25DV Mailbox Current Message enumerator definition 00188 */ 00189 typedef enum 00190 { 00191 ST25DV_NO_MSG = 0, 00192 ST25DV_HOST_MSG, 00193 ST25DV_RF_MSG 00194 } ST25DV_CURRENT_MSG; 00195 00196 /** 00197 * @brief ST25DV EH Ctrl structure definition 00198 */ 00199 typedef struct 00200 { 00201 ST25DV_EN_STATUS EH_EN_Mode; 00202 ST25DV_EN_STATUS EH_on; 00203 ST25DV_EN_STATUS Field_on; 00204 ST25DV_EN_STATUS VCC_on; 00205 } ST25DV_EH_CTRL; 00206 00207 /** 00208 * @brief ST25DV GPO structure definition 00209 */ 00210 typedef struct 00211 { 00212 ST25DV_EN_STATUS GPO_RFUser_en; 00213 ST25DV_EN_STATUS GPO_RFActivity_en; 00214 ST25DV_EN_STATUS GPO_RFInterrupt_en; 00215 ST25DV_EN_STATUS GPO_FieldChange_en; 00216 ST25DV_EN_STATUS GPO_RFPutMsg_en; 00217 ST25DV_EN_STATUS GPO_RFGetMsg_en; 00218 ST25DV_EN_STATUS GPO_RFWrite_en; 00219 ST25DV_EN_STATUS GPO_Enable; 00220 } ST25DV_GPO; 00221 00222 /** 00223 * @brief ST25DV RF Management structure definition. 00224 */ 00225 typedef struct 00226 { 00227 ST25DV_EN_STATUS RfDisable; 00228 ST25DV_EN_STATUS RfSleep; 00229 } ST25DV_RF_MNGT; 00230 00231 /** 00232 * @brief ST25DV RF Area protection structure definition. 00233 */ 00234 typedef struct 00235 { 00236 ST25DV_PASSWD_PROT_STATUS PasswdCtrl; 00237 ST25DV_PROTECTION_CONF RWprotection; 00238 } ST25DV_RF_PROT_ZONE; 00239 00240 /** 00241 * @brief ST25DV I2C Area protection structure definition. 00242 */ 00243 typedef struct 00244 { 00245 ST25DV_PROTECTION_CONF ProtectZone1; 00246 ST25DV_PROTECTION_CONF ProtectZone2; 00247 ST25DV_PROTECTION_CONF ProtectZone3; 00248 ST25DV_PROTECTION_CONF ProtectZone4; 00249 } ST25DV_I2C_PROT_ZONE; 00250 00251 /** 00252 * @brief ST25DV MB_CTRL_DYN register structure definition. 00253 */ 00254 typedef struct 00255 { 00256 uint8_t MbEnable; 00257 uint8_t HostPutMsg; 00258 uint8_t RfPutMsg; 00259 uint8_t HostMissMsg; 00260 uint8_t RFMissMsg; 00261 ST25DV_CURRENT_MSG CurrentMsg; 00262 } ST25DV_MB_CTRL_DYN_STATUS; 00263 00264 /** 00265 * @brief ST25DV Lock CCFile structure definition. 00266 */ 00267 typedef struct 00268 { 00269 ST25DV_LOCK_STATUS LckBck0; 00270 ST25DV_LOCK_STATUS LckBck1; 00271 } ST25DV_LOCK_CCFILE; 00272 00273 /** 00274 * @brief ST25DV Memory size structure definition. 00275 */ 00276 typedef struct 00277 { 00278 uint8_t BlockSize; 00279 uint16_t Mem_Size; 00280 } ST25DV_MEM_SIZE; 00281 00282 /** 00283 * @brief ST25DV UID information structure definition. 00284 */ 00285 typedef struct 00286 { 00287 uint32_t MsbUid; 00288 uint32_t LsbUid; 00289 } ST25DV_UID; 00290 00291 /** 00292 * @brief ST25DV Password structure definition. 00293 */ 00294 typedef struct 00295 { 00296 uint32_t MsbPasswd; 00297 uint32_t LsbPasswd; 00298 } ST25DV_PASSWD; 00299 00300 #ifndef DOXYGEN_SHOULD_SKIP_THIS 00301 /** 00302 * @brief NFCTAG standard driver API structure definition. 00303 */ 00304 typedef struct 00305 { 00306 NFCTAG_StatusTypeDef (*Init)( I2C * , DigitalOut* ); 00307 NFCTAG_StatusTypeDef (*ReadID)( uint8_t * const , I2C * ); 00308 NFCTAG_StatusTypeDef (*IsReady)( const uint32_t , I2C *); 00309 NFCTAG_StatusTypeDef (*GetITStatus)( uint16_t * const , I2C * ); 00310 NFCTAG_StatusTypeDef (*ConfigIT)( const uint16_t, I2C * ); 00311 NFCTAG_StatusTypeDef (*ReadData)( uint8_t * const, const uint16_t, const uint16_t, I2C* ); 00312 NFCTAG_StatusTypeDef (*WriteData)( const uint8_t * const, const uint16_t, const uint16_t, I2C* ); 00313 NFCTAG_StatusTypeDef (*ReadRegister)( uint8_t * const, const uint16_t, const uint16_t, I2C* ); 00314 NFCTAG_StatusTypeDef (*WriteRegister)( const uint8_t * const, const uint16_t, const uint16_t, I2C* ); 00315 void *pData; 00316 } NFCTAG_DrvTypeDef; 00317 00318 /** 00319 * @brief NFCTAG extended driver API structure definition. 00320 */ 00321 typedef struct 00322 { 00323 NFCTAG_StatusTypeDef (*ReadICRev)( uint8_t * const, I2C * ); 00324 NFCTAG_StatusTypeDef (*WriteITPulse)( const ST25DV_PULSE_DURATION, I2C * ); 00325 NFCTAG_StatusTypeDef (*ReadITPulse)( ST25DV_PULSE_DURATION * const, I2C * ); 00326 NFCTAG_StatusTypeDef (*ReadDataCurrentAddr)( uint8_t * const, const uint16_t, I2C * ); 00327 NFCTAG_StatusTypeDef (*ReadUID)( ST25DV_UID * const, I2C * ); 00328 NFCTAG_StatusTypeDef (*ReadDSFID)( uint8_t * const, I2C * ); 00329 NFCTAG_StatusTypeDef (*ReadDsfidRFProtection)( ST25DV_LOCK_STATUS * const, I2C * ); 00330 NFCTAG_StatusTypeDef (*ReadAFI)( uint8_t * const, I2C * ); 00331 NFCTAG_StatusTypeDef (*ReadAfiRFProtection)( ST25DV_LOCK_STATUS * const, I2C * ); 00332 NFCTAG_StatusTypeDef (*ReadI2CProtectZone)( ST25DV_I2C_PROT_ZONE * const, I2C * ); 00333 NFCTAG_StatusTypeDef (*WriteI2CProtectZonex)( const ST25DV_PROTECTION_ZONE, const ST25DV_PROTECTION_CONF, I2C * ); 00334 NFCTAG_StatusTypeDef (*ReadLockCCFile)( ST25DV_LOCK_CCFILE * const, I2C * ); 00335 NFCTAG_StatusTypeDef (*WriteLockCCFile)( const ST25DV_CCFILE_BLOCK, const ST25DV_LOCK_STATUS, I2C * ); 00336 NFCTAG_StatusTypeDef (*ReadLockCFG)( ST25DV_LOCK_STATUS * const, I2C * ); 00337 NFCTAG_StatusTypeDef (*WriteLockCFG)( const ST25DV_LOCK_STATUS, I2C * ); 00338 NFCTAG_StatusTypeDef (*PresentI2CPassword)( const ST25DV_PASSWD, I2C * ); 00339 NFCTAG_StatusTypeDef (*WriteI2CPassword)( const ST25DV_PASSWD, I2C * ); 00340 NFCTAG_StatusTypeDef (*ReadRFZxSS)( const ST25DV_PROTECTION_ZONE, ST25DV_RF_PROT_ZONE * const, I2C * ); 00341 NFCTAG_StatusTypeDef (*WriteRFZxSS)( const ST25DV_PROTECTION_ZONE, const ST25DV_RF_PROT_ZONE, I2C * ); 00342 NFCTAG_StatusTypeDef (*ReadEndZonex)( const ST25DV_END_ZONE, uint8_t * const, I2C * ); 00343 NFCTAG_StatusTypeDef (*WriteEndZonex)( const ST25DV_END_ZONE, const uint8_t, I2C * ); 00344 NFCTAG_StatusTypeDef (*InitEndZone)( I2C * ); 00345 NFCTAG_StatusTypeDef (*CreateUserZone)( uint16_t, uint16_t, uint16_t, uint16_t, I2C * ); 00346 NFCTAG_StatusTypeDef (*ReadMemSize)( ST25DV_MEM_SIZE * const, I2C * ); 00347 NFCTAG_StatusTypeDef (*ReadEHMode)( ST25DV_EH_MODE_STATUS * const, I2C * ); 00348 NFCTAG_StatusTypeDef (*WriteEHMode)( const ST25DV_EH_MODE_STATUS, I2C * ); 00349 NFCTAG_StatusTypeDef (*ReadRFMngt)( ST25DV_RF_MNGT * const, I2C * ); 00350 NFCTAG_StatusTypeDef (*WriteRFMngt)( const uint8_t, I2C * ); 00351 NFCTAG_StatusTypeDef (*GetRFDisable)( ST25DV_EN_STATUS * const, I2C * ); 00352 NFCTAG_StatusTypeDef (*SetRFDisable)( I2C * ); 00353 NFCTAG_StatusTypeDef (*ResetRFDisable)( I2C * ); 00354 NFCTAG_StatusTypeDef (*GetRFSleep)( ST25DV_EN_STATUS * const, I2C * ); 00355 NFCTAG_StatusTypeDef (*SetRFSleep)( I2C * ); 00356 NFCTAG_StatusTypeDef (*ResetRFSleep)( I2C * ); 00357 NFCTAG_StatusTypeDef (*ReadMBMode)( ST25DV_EN_STATUS * const, I2C * ); 00358 NFCTAG_StatusTypeDef (*WriteMBMode)( const ST25DV_EN_STATUS, I2C * ); 00359 NFCTAG_StatusTypeDef (*ReadMBWDG)( uint8_t * const, I2C * ); 00360 NFCTAG_StatusTypeDef (*WriteMBWDG)( const uint8_t, I2C * ); 00361 NFCTAG_StatusTypeDef (*ReadMailboxData)( uint8_t * const, const uint16_t, const uint16_t, I2C * ); 00362 NFCTAG_StatusTypeDef (*WriteMailboxData)( const uint8_t * const, const uint16_t, I2C * ); 00363 NFCTAG_StatusTypeDef (*ReadMailboxRegister)( uint8_t * const, const uint16_t, const uint16_t, I2C * ); 00364 NFCTAG_StatusTypeDef (*WriteMailboxRegister)( const uint8_t * const, const uint16_t, const uint16_t, I2C * ); 00365 NFCTAG_StatusTypeDef (*ReadI2CSecuritySession_Dyn)( ST25DV_I2CSSO_STATUS * const, I2C * ); 00366 NFCTAG_StatusTypeDef (*ReadITSTStatus_Dyn)( uint8_t * const, I2C * ); 00367 NFCTAG_StatusTypeDef (*ReadGPO_Dyn)( uint8_t *, I2C * ); 00368 NFCTAG_StatusTypeDef (*GetGPO_en_Dyn)( ST25DV_EN_STATUS * const, I2C * ); 00369 NFCTAG_StatusTypeDef (*SetGPO_en_Dyn)( I2C * ); 00370 NFCTAG_StatusTypeDef (*ResetGPO_en_Dyn)( I2C * ); 00371 NFCTAG_StatusTypeDef (*ReadEHCtrl_Dyn)( ST25DV_EH_CTRL * const, I2C * ); 00372 NFCTAG_StatusTypeDef (*GetEHENMode_Dyn)( ST25DV_EN_STATUS * const, I2C * ); 00373 NFCTAG_StatusTypeDef (*SetEHENMode_Dyn)( I2C *); 00374 NFCTAG_StatusTypeDef (*ResetEHENMode_Dyn)( I2C * ); 00375 NFCTAG_StatusTypeDef (*GetEHON_Dyn)( ST25DV_EN_STATUS * const, I2C * ); 00376 NFCTAG_StatusTypeDef (*GetRFField_Dyn)( ST25DV_FIELD_STATUS * const, I2C * ); 00377 NFCTAG_StatusTypeDef (*GetVCC_Dyn)( ST25DV_VCC_STATUS * const, I2C * ); 00378 NFCTAG_StatusTypeDef (*ReadRFMngt_Dyn)( ST25DV_RF_MNGT * const, I2C * ); 00379 NFCTAG_StatusTypeDef (*WriteRFMngt_Dyn)( const uint8_t, I2C * ); 00380 NFCTAG_StatusTypeDef (*GetRFDisable_Dyn)( ST25DV_EN_STATUS * const, I2C * ); 00381 NFCTAG_StatusTypeDef (*SetRFDisable_Dyn)( I2C * ); 00382 NFCTAG_StatusTypeDef (*ResetRFDisable_Dyn)( I2C * ); 00383 NFCTAG_StatusTypeDef (*GetRFSleep_Dyn)( ST25DV_EN_STATUS * const , I2C *); 00384 NFCTAG_StatusTypeDef (*SetRFSleep_Dyn)( I2C * ); 00385 NFCTAG_StatusTypeDef (*ResetRFSleep_Dyn)( I2C * ); 00386 NFCTAG_StatusTypeDef (*ReadMBctrl_Dyn)( ST25DV_MB_CTRL_DYN_STATUS * const, I2C * ); 00387 NFCTAG_StatusTypeDef (*GetMBEN_Dyn)( ST25DV_EN_STATUS * const, I2C * ); 00388 NFCTAG_StatusTypeDef (*SetMBEN_Dyn)( I2C * ); 00389 NFCTAG_StatusTypeDef (*ResetMBEN_Dyn)( I2C * ); 00390 NFCTAG_StatusTypeDef (*ReadMBLength_Dyn)( uint8_t * const, I2C * ); 00391 } NFCTAG_ExtDrvTypeDef; 00392 #endif 00393 00394 /* Exported constants --------------------------------------------------------*/ 00395 /** @brief ST25DV 4Kbits */ 00396 #define I_AM_ST25DV04 0x24 00397 /** @brief ST25DV 64Kbits */ 00398 #define I_AM_ST25DV64 0x26 00399 00400 /*#ifndef NULL 00401 #define NULL (void *) 0 00402 #endif 00403 */ 00404 /** @brief I2C address to be used for ST25DV Data accesses. */ 00405 #define ST25DV_ADDR_DATA_I2C 0xA6 00406 /** @brief I2C address to be used for ST25DV System accesses. */ 00407 #define ST25DV_ADDR_SYST_I2C 0xAE 00408 00409 /** @brief I2C Time out (ms), min value : (Max write bytes) / (Internal page write) * tw (256/4)*5. */ 00410 #define ST25DV_I2C_TIMEOUT 320 00411 00412 /** @brief Size of the ST25DV write buffer. */ 00413 #define ST25DV_MAX_WRITE_BYTE 256 00414 /** @brief Size of the ST25DVMailbox memory. */ 00415 #define ST25DV_MAX_MAILBOX_LENGTH 256 00416 00417 /* Registers i2c address */ 00418 /** @brief ST25DV GPO register address. */ 00419 #define ST25DV_GPO_REG 0x0000 00420 /** @brief ST25DV IT duration register address. */ 00421 #define ST25DV_ITTIME_REG 0x0001 00422 /** @brief ST25DV Energy Harvesting register address. */ 00423 #define ST25DV_EH_MODE_REG 0x0002 00424 /** @brief ST25DV RF management register address. */ 00425 #define ST25DV_RF_MNGT_REG 0x0003 00426 /** @brief ST25DV Area 1 security register address. */ 00427 #define ST25DV_RFZ1SS_REG 0x0004 00428 /** @brief ST25DV Area 1 end address register address. */ 00429 #define ST25DV_END1_REG 0x0005 00430 /** @brief ST25DV Area 2 security register address. */ 00431 #define ST25DV_RFZ2SS_REG 0x0006 00432 /** @brief ST25DV Area 2 end address register address. */ 00433 #define ST25DV_END2_REG 0x0007 00434 /** @brief ST25DV Area 3 security register address. */ 00435 #define ST25DV_RFZ3SS_REG 0x0008 00436 /** @brief ST25DV Area 3 end address register address. */ 00437 #define ST25DV_END3_REG 0x0009 00438 /** @brief ST25DV Area 4 security register address. */ 00439 #define ST25DV_RFZ4SS_REG 0x000A 00440 /** @brief ST25DV I2C security register address. */ 00441 #define ST25DV_I2CZSS_REG 0x000B 00442 /** @brief ST25DV Capability Container lock register address. */ 00443 #define ST25DV_LOCKCCFILE_REG 0x000C 00444 /** @brief ST25DV Mailbox mode register address. */ 00445 #define ST25DV_MB_MODE_REG 0x000D 00446 /** @brief ST25DV Mailbox Watchdog register address. */ 00447 #define ST25DV_MB_WDG_REG 0x000E 00448 /** @brief ST25DV Configuration lock register address. */ 00449 #define ST25DV_LOCKCFG_REG 0x000F 00450 /** @brief ST25DV DSFID lock register address. */ 00451 #define ST25DV_LOCKDSFID_REG 0x0010 00452 /** @brief ST25DV AFI lock register address. */ 00453 #define ST25DV_LOCKAFI_REG 0x0011 00454 /** @brief ST25DV DSFID register address. */ 00455 #define ST25DV_DSFID_REG 0x0012 00456 /** @brief ST25DV AFI register address. */ 00457 #define ST25DV_AFI_REG 0x0013 00458 /** @brief ST25DV Memory size register address. */ 00459 #define ST25DV_MEM_SIZE_REG 0x0014 00460 /** @brief ST25DV ICref register address. */ 00461 #define ST25DV_ICREF_REG 0x0017 00462 /** @brief ST25DV UID register address. */ 00463 #define ST25DV_UID_REG 0x0018 00464 /** @brief ST25DV IC revision register address. */ 00465 #define ST25DV_ICREV_REG 0x0020 00466 /** @brief ST25DV I2C password register address. */ 00467 #define ST25DV_I2CPASSWD_REG 0x0900 00468 00469 /* Dynamic Registers i2c address */ 00470 /** @brief ST25DV GPO dynamic register address. */ 00471 #define ST25DV_GPO_DYN_REG 0x2000 00472 /** @brief ST25DV Energy Harvesting control dynamic register address. */ 00473 #define ST25DV_EH_CTRL_DYN_REG 0x2002 00474 /** @brief ST25DV RF management dynamic register address. */ 00475 #define ST25DV_RF_MNGT_DYN_REG 0x2003 00476 /** @brief ST25DV I2C secure session opened dynamic register address. */ 00477 #define ST25DV_I2C_SSO_DYN_REG 0x2004 00478 /** @brief ST25DV Interrupt status dynamic register address. */ 00479 #define ST25DV_ITSTS_DYN_REG 0x2005 00480 /** @brief ST25DV Mailbox control dynamic register address. */ 00481 #define ST25DV_MB_CTRL_DYN_REG 0x2006 00482 /** @brief ST25DV Mailbox message length dynamic register address. */ 00483 #define ST25DV_MBLEN_DYN_REG 0x2007 00484 /** @brief ST25DV Mailbox buffer address. */ 00485 #define ST25DV_MAILBOX_RAM_REG 0x2008 00486 00487 /* Registers fields definitions */ 00488 /* MB_MODE */ 00489 #define ST25DV_MB_MODE_RW_SHIFT (0) 00490 #define ST25DV_MB_MODE_RW_FIELD 0xFE 00491 #define ST25DV_MB_MODE_RW_MASK 0x01 00492 00493 /* MB_LEN_Dyn */ 00494 #define ST25DV_MBLEN_DYN_MBLEN_SHIFT (0) 00495 #define ST25DV_MBLEN_DYN_MBLEN_FIELD 0x00 00496 #define ST25DV_MBLEN_DYN_MBLEN_MASK 0xFF 00497 00498 /* MB_CTRL_Dyn */ 00499 #define ST25DV_MB_CTRL_DYN_MBEN_SHIFT (0) 00500 #define ST25DV_MB_CTRL_DYN_MBEN_FIELD 0xFE 00501 #define ST25DV_MB_CTRL_DYN_MBEN_MASK 0x01 00502 #define ST25DV_MB_CTRL_DYN_HOSTPUTMSG_SHIFT (1) 00503 #define ST25DV_MB_CTRL_DYN_HOSTPUTMSG_FIELD 0xFD 00504 #define ST25DV_MB_CTRL_DYN_HOSTPUTMSG_MASK 0x02 00505 #define ST25DV_MB_CTRL_DYN_RFPUTMSG_SHIFT (2) 00506 #define ST25DV_MB_CTRL_DYN_RFPUTMSG_FIELD 0xFB 00507 #define ST25DV_MB_CTRL_DYN_RFPUTMSG_MASK 0x04 00508 #define ST25DV_MB_CTRL_DYN_STRESERVED_SHIFT (3) 00509 #define ST25DV_MB_CTRL_DYN_STRESERVED_FIELD 0xF7 00510 #define ST25DV_MB_CTRL_DYN_STRESERVED_MASK 0x08 00511 #define ST25DV_MB_CTRL_DYN_HOSTMISSMSG_SHIFT (4) 00512 #define ST25DV_MB_CTRL_DYN_HOSTMISSMSG_FIELD 0xEF 00513 #define ST25DV_MB_CTRL_DYN_HOSTMISSMSG_MASK 0x10 00514 #define ST25DV_MB_CTRL_DYN_RFMISSMSG_SHIFT (5) 00515 #define ST25DV_MB_CTRL_DYN_RFMISSMSG_FIELD 0xDF 00516 #define ST25DV_MB_CTRL_DYN_RFMISSMSG_MASK 0x20 00517 #define ST25DV_MB_CTRL_DYN_CURRENTMSG_SHIFT (6) 00518 #define ST25DV_MB_CTRL_DYN_CURRENTMSG_FIELD 0x3F 00519 #define ST25DV_MB_CTRL_DYN_CURRENTMSG_MASK 0xC0 00520 00521 /* MB_WDG */ 00522 #define ST25DV_MB_WDG_DELAY_SHIFT (0) 00523 #define ST25DV_MB_WDG_DELAY_FIELD 0xF8 00524 #define ST25DV_MB_WDG_DELAY_MASK 0x07 00525 00526 /* GPO */ 00527 #define ST25DV_GPO_RFUSERSTATE_SHIFT (0) 00528 #define ST25DV_GPO_RFUSERSTATE_FIELD 0xFE 00529 #define ST25DV_GPO_RFUSERSTATE_MASK 0x01 00530 #define ST25DV_GPO_RFACTIVITY_SHIFT (1) 00531 #define ST25DV_GPO_RFACTIVITY_FIELD 0xFD 00532 #define ST25DV_GPO_RFACTIVITY_MASK 0x02 00533 #define ST25DV_GPO_RFINTERRUPT_SHIFT (2) 00534 #define ST25DV_GPO_RFINTERRUPT_FIELD 0xFB 00535 #define ST25DV_GPO_RFINTERRUPT_MASK 0x04 00536 #define ST25DV_GPO_FIELDCHANGE_SHIFT (3) 00537 #define ST25DV_GPO_FIELDCHANGE_FIELD 0xF7 00538 #define ST25DV_GPO_FIELDCHANGE_MASK 0x08 00539 #define ST25DV_GPO_RFPUTMSG_SHIFT (4) 00540 #define ST25DV_GPO_RFPUTMSG_FIELD 0xEF 00541 #define ST25DV_GPO_RFPUTMSG_MASK 0x10 00542 #define ST25DV_GPO_RFGETMSG_SHIFT (5) 00543 #define ST25DV_GPO_RFGETMSG_FIELD 0xDF 00544 #define ST25DV_GPO_RFGETMSG_MASK 0x20 00545 #define ST25DV_GPO_RFWRITE_SHIFT (6) 00546 #define ST25DV_GPO_RFWRITE_FIELD 0xBF 00547 #define ST25DV_GPO_RFWRITE_MASK 0x40 00548 #define ST25DV_GPO_ENABLE_SHIFT (7) 00549 #define ST25DV_GPO_ENABLE_FIELD 0x7F 00550 #define ST25DV_GPO_ENABLE_MASK 0x80 00551 #define ST25DV_GPO_ALL_MASK 0xFF 00552 00553 /* GPO_Dyn */ 00554 #define ST25DV_GPO_DYN_RFUSERSTATE_SHIFT (0) 00555 #define ST25DV_GPO_DYN_RFUSERSTATE_FIELD 0xFE 00556 #define ST25DV_GPO_DYN_RFUSERSTATE_MASK 0x01 00557 #define ST25DV_GPO_DYN_RFACTIVITY_SHIFT (1) 00558 #define ST25DV_GPO_DYN_RFACTIVITY_FIELD 0xFD 00559 #define ST25DV_GPO_DYN_RFACTIVITY_MASK 0x02 00560 #define ST25DV_GPO_DYN_RFINTERRUPT_SHIFT (2) 00561 #define ST25DV_GPO_DYN_RFINTERRUPT_FIELD 0xFB 00562 #define ST25DV_GPO_DYN_RFINTERRUPT_MASK 0x04 00563 #define ST25DV_GPO_DYN_FIELDCHANGE_SHIFT (3) 00564 #define ST25DV_GPO_DYN_FIELDCHANGE_FIELD 0xF7 00565 #define ST25DV_GPO_DYN_FIELDCHANGE_MASK 0x08 00566 #define ST25DV_GPO_DYN_RFPUTMSG_SHIFT (4) 00567 #define ST25DV_GPO_DYN_RFPUTMSG_FIELD 0xEF 00568 #define ST25DV_GPO_DYN_RFPUTMSG_MASK 0x10 00569 #define ST25DV_GPO_DYN_RFGETMSG_SHIFT (5) 00570 #define ST25DV_GPO_DYN_RFGETMSG_FIELD 0xDF 00571 #define ST25DV_GPO_DYN_RFGETMSG_MASK 0x20 00572 #define ST25DV_GPO_DYN_RFWRITE_SHIFT (6) 00573 #define ST25DV_GPO_DYN_RFWRITE_FIELD 0xBF 00574 #define ST25DV_GPO_DYN_RFWRITE_MASK 0x40 00575 #define ST25DV_GPO_DYN_ENABLE_SHIFT (7) 00576 #define ST25DV_GPO_DYN_ENABLE_FIELD 0x7F 00577 #define ST25DV_GPO_DYN_ENABLE_MASK 0x80 00578 #define ST25DV_GPO_DYN_ALL_MASK 0xFF 00579 00580 /* ITTIME */ 00581 #define ST25DV_ITTIME_DELAY_SHIFT (0) 00582 #define ST25DV_ITTIME_DELAY_FIELD 0xFC 00583 #define ST25DV_ITTIME_DELAY_MASK 0x03 00584 00585 /* ITSTS_Dyn */ 00586 #define ST25DV_ITSTS_RFUSERSTATE_SHIFT (0) 00587 #define ST25DV_ITSTS_RFUSERSTATE_FIELD 0xFE 00588 #define ST25DV_ITSTS_RFUSERSTATE_MASK 0x01 00589 #define ST25DV_ITSTS_RFACTIVITY_SHIFT (1) 00590 #define ST25DV_ITSTS_RFACTIVITY_FIELD 0xFD 00591 #define ST25DV_ITSTS_RFACTIVITY_MASK 0x02 00592 #define ST25DV_ITSTS_RFINTERRUPT_SHIFT (2) 00593 #define ST25DV_ITSTS_RFINTERRUPT_FIELD 0xFB 00594 #define ST25DV_ITSTS_RFINTERRUPT_MASK 0x04 00595 #define ST25DV_ITSTS_FIELDFALLING_SHIFT (3) 00596 #define ST25DV_ITSTS_FIELDFALLING_FIELD 0xF7 00597 #define ST25DV_ITSTS_FIELDFALLING_MASK 0x08 00598 #define ST25DV_ITSTS_FIELDRISING_SHIFT (4) 00599 #define ST25DV_ITSTS_FIELDRISING_FIELD 0xEF 00600 #define ST25DV_ITSTS_FIELDRISING_MASK 0x10 00601 #define ST25DV_ITSTS_RFPUTMSG_SHIFT (5) 00602 #define ST25DV_ITSTS_RFPUTMSG_FIELD 0xDF 00603 #define ST25DV_ITSTS_RFPUTMSG_MASK 0x20 00604 #define ST25DV_ITSTS_RFGETMSG_SHIFT (6) 00605 #define ST25DV_ITSTS_RFGETMSG_FIELD 0xBF 00606 #define ST25DV_ITSTS_RFGETMSG_MASK 0x40 00607 #define ST25DV_ITSTS_RFWRITE_SHIFT (7) 00608 #define ST25DV_ITSTS_RFWRITE_FIELD 0x7F 00609 #define ST25DV_ITSTS_RFWRITE_MASK 0x80 00610 00611 /* EH_MODE */ 00612 #define ST25DV_EH_MODE_SHIFT (0) 00613 #define ST25DV_EH_MODE_FIELD 0xFE 00614 #define ST25DV_EH_MODE_MASK 0x01 00615 00616 /* EH_CTRL_Dyn */ 00617 #define ST25DV_EH_CTRL_DYN_EH_EN_SHIFT (0) 00618 #define ST25DV_EH_CTRL_DYN_EH_EN_FIELD 0xFE 00619 #define ST25DV_EH_CTRL_DYN_EH_EN_MASK 0x01 00620 #define ST25DV_EH_CTRL_DYN_EH_ON_SHIFT (1) 00621 #define ST25DV_EH_CTRL_DYN_EH_ON_FIELD 0xFD 00622 #define ST25DV_EH_CTRL_DYN_EH_ON_MASK 0x02 00623 #define ST25DV_EH_CTRL_DYN_FIELD_ON_SHIFT (2) 00624 #define ST25DV_EH_CTRL_DYN_FIELD_ON_FIELD 0xFB 00625 #define ST25DV_EH_CTRL_DYN_FIELD_ON_MASK 0x04 00626 #define ST25DV_EH_CTRL_DYN_VCC_ON_SHIFT (3) 00627 #define ST25DV_EH_CTRL_DYN_VCC_ON_FIELD 0xF7 00628 #define ST25DV_EH_CTRL_DYN_VCC_ON_MASK 0x08 00629 00630 /* RF_MNGT */ 00631 #define ST25DV_RF_MNGT_RFDIS_SHIFT (0) 00632 #define ST25DV_RF_MNGT_RFDIS_FIELD 0xFE 00633 #define ST25DV_RF_MNGT_RFDIS_MASK 0x01 00634 #define ST25DV_RF_MNGT_RFSLEEP_SHIFT (1) 00635 #define ST25DV_RF_MNGT_RFSLEEP_FIELD 0xFD 00636 #define ST25DV_RF_MNGT_RFSLEEP_MASK 0x02 00637 00638 /* RF_MNGT_Dyn */ 00639 #define ST25DV_RF_MNGT_DYN_RFDIS_SHIFT (0) 00640 #define ST25DV_RF_MNGT_DYN_RFDIS_FIELD 0xFE 00641 #define ST25DV_RF_MNGT_DYN_RFDIS_MASK 0x01 00642 #define ST25DV_RF_MNGT_DYN_RFSLEEP_SHIFT (1) 00643 #define ST25DV_RF_MNGT_DYN_RFSLEEP_FIELD 0xFD 00644 #define ST25DV_RF_MNGT_DYN_RFSLEEP_MASK 0x02 00645 00646 /* RFZSS */ 00647 #define ST25DV_RFZSS_PWDCTRL_SHIFT (0) 00648 #define ST25DV_RFZSS_PWDCTRL_FIELD 0xFC 00649 #define ST25DV_RFZSS_PWDCTRL_MASK 0x03 00650 #define ST25DV_RFZSS_RWPROT_SHIFT (2) 00651 #define ST25DV_RFZSS_RWPROT_FIELD 0xF3 00652 #define ST25DV_RFZSS_RWPROT_MASK 0x0C 00653 00654 /* I2CZSS */ 00655 #define ST25DV_I2CZSS_PZ1_SHIFT (0) 00656 #define ST25DV_I2CZSS_PZ1_FIELD 0xFC 00657 #define ST25DV_I2CZSS_PZ1_MASK 0x03 00658 #define ST25DV_I2CZSS_PZ2_SHIFT (2) 00659 #define ST25DV_I2CZSS_PZ2_FIELD 0xF3 00660 #define ST25DV_I2CZSS_PZ2_MASK 0x0C 00661 #define ST25DV_I2CZSS_PZ3_SHIFT (4) 00662 #define ST25DV_I2CZSS_PZ3_FIELD 0xCF 00663 #define ST25DV_I2CZSS_PZ3_MASK 0x30 00664 #define ST25DV_I2CZSS_PZ4_SHIFT (6) 00665 #define ST25DV_I2CZSS_PZ4_FIELD 0x3F 00666 #define ST25DV_I2CZSS_PZ4_MASK 0xC0 00667 00668 /* LOCKCCFILE */ 00669 #define ST25DV_LOCKCCFILE_BLCK0_SHIFT (0) 00670 #define ST25DV_LOCKCCFILE_BLCK0_FIELD 0xFE 00671 #define ST25DV_LOCKCCFILE_BLCK0_MASK 0x01 00672 #define ST25DV_LOCKCCFILE_BLCK1_SHIFT (1) 00673 #define ST25DV_LOCKCCFILE_BLCK1_FIELD 0xFD 00674 #define ST25DV_LOCKCCFILE_BLCK1_MASK 0x02 00675 00676 /* LOCKCFG */ 00677 #define ST25DV_LOCKCFG_B0_SHIFT (0) 00678 #define ST25DV_LOCKCFG_B0_FIELD 0xFE 00679 #define ST25DV_LOCKCFG_B0_MASK 0x01 00680 00681 /* I2C_SSO_Dyn */ 00682 #define ST25DV_I2C_SSO_DYN_I2CSSO_SHIFT (0) 00683 #define ST25DV_I2C_SSO_DYN_I2CSSO_FIELD 0xFE 00684 #define ST25DV_I2C_SSO_DYN_I2CSSO_MASK 0x01 00685 00686 00687 00688 /* External variables --------------------------------------------------------*/ 00689 /* NFCTAG driver structure */ 00690 extern NFCTAG_DrvTypeDef St25Dv_i2c_Drv; 00691 extern NFCTAG_ExtDrvTypeDef St25Dv_i2c_ExtDrv; 00692 00693 /* Exported macro ------------------------------------------------------------*/ 00694 /* Imported functions ------------------------------------------------------- */ 00695 extern NFCTAG_StatusTypeDef ST25DV_IO_Init( I2C* mi2cChannel, DigitalOut *mLPD ); 00696 extern NFCTAG_StatusTypeDef ST25DV_IO_MemWrite( const uint8_t * const pData, const uint8_t DevAddr, const uint16_t TarAddr, const uint16_t Size, I2C* mi2cChannel ); 00697 extern NFCTAG_StatusTypeDef ST25DV_IO_Write( const uint8_t * const pData, const uint8_t DevAddr, const uint16_t Size, I2C* mi2cChannel ); 00698 extern NFCTAG_StatusTypeDef ST25DV_IO_MemRead( uint8_t * const pData, const uint8_t DevAddr, const uint16_t TarAddr, const uint16_t Size, I2C* mi2cChannel ); 00699 extern NFCTAG_StatusTypeDef ST25DV_IO_Read( uint8_t * const pData, const uint8_t DevAddr, const uint16_t Size, I2C* mi2cChannel ); 00700 extern uint8_t ST25DV_IO_IsNacked( void ); 00701 extern NFCTAG_StatusTypeDef ST25DV_IO_IsDeviceReady( const uint8_t DevAddr, const uint32_t Trials, I2C* mi2cChannel); 00702 00703 /* Exported functions ------------------------------------------------------- */ 00704 00705 /** 00706 * @} 00707 */ 00708 00709 /** 00710 * @} 00711 */ 00712 00713 00714 #endif /* __ST25DV_H */ 00715 00716 /******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
Generated on Fri Jul 15 2022 06:26:51 by
1.7.2
X-NUCLEO-NFC04A1