rfal_st25xv.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844
  1. /******************************************************************************
  2. * \attention
  3. *
  4. * <h2><center>&copy; COPYRIGHT 2020 STMicroelectronics</center></h2>
  5. *
  6. * Licensed under ST MYLIBERTY SOFTWARE LICENSE AGREEMENT (the "License");
  7. * You may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at:
  9. *
  10. * www.st.com/myliberty
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
  15. * AND SPECIFICALLY DISCLAIMING THE IMPLIED WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. *
  20. ******************************************************************************/
  21. /*
  22. * PROJECT: ST25R391x firmware
  23. * Revision:
  24. * LANGUAGE: ISO C99
  25. */
  26. /*! \file rfal_st25xv.h
  27. *
  28. * \author Gustavo Patricio
  29. *
  30. * \brief NFC-V ST25 NFC-V Tag specific features
  31. *
  32. * This module provides support for ST's specific features available on
  33. * NFC-V (ISO15693) tag families: ST25D, ST25TV, M24LR
  34. *
  35. *
  36. * \addtogroup RFAL
  37. * @{
  38. *
  39. * \addtogroup RFAL-AL
  40. * \brief RFAL Abstraction Layer
  41. * @{
  42. *
  43. * \addtogroup ST25xV
  44. * \brief RFAL ST25xV Module
  45. * @{
  46. *
  47. */
  48. #ifndef RFAL_ST25xV_H
  49. #define RFAL_ST25xV_H
  50. /*
  51. ******************************************************************************
  52. * INCLUDES
  53. ******************************************************************************
  54. */
  55. #include "../platform.h"
  56. #include "../st_errno.h"
  57. #include "rfal_nfc.h"
  58. #include "rfal_rf.h"
  59. /*
  60. ******************************************************************************
  61. * GLOBAL DEFINES
  62. ******************************************************************************
  63. */
  64. #define RFAL_NFCV_BLOCKNUM_M24LR_LEN \
  65. 2U /*!< Block Number length of MR24LR tags: 16 bits */
  66. #define RFAL_NFCV_ST_IC_MFG_CODE \
  67. 0x02 /*!< ST IC Mfg code (used for custom commands) */
  68. /*!
  69. *****************************************************************************
  70. * \brief NFC-V Poller Read Single Block (M24LR)
  71. *
  72. * Reads a Single Block from a M24LR tag which has the number of blocks
  73. * bigger than 256 (M24LR16 ; M24LR64)
  74. *
  75. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  76. * default: RFAL_NFCV_REQ_FLAG_DEFAULT
  77. * \param[in] uid : UID of the device to be put to be read
  78. * if not provided Select mode will be used
  79. * \param[in] blockNum : Number of the block to read (16 bits)
  80. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  81. * \param[in] rxBufLen : length of rxBuf
  82. * \param[out] rcvLen : number of bytes received
  83. *
  84. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  85. * \return ERR_PARAM : Invalid parameters
  86. * \return ERR_IO : Generic internal error
  87. * \return ERR_CRC : CRC error detected
  88. * \return ERR_FRAMING : Framing error detected
  89. * \return ERR_PROTO : Protocol error detected
  90. * \return ERR_TIMEOUT : Timeout error
  91. * \return ERR_NONE : No error
  92. *****************************************************************************
  93. */
  94. ReturnCode rfalST25xVPollerM24LRReadSingleBlock(
  95. uint8_t flags,
  96. const uint8_t* uid,
  97. uint16_t blockNum,
  98. uint8_t* rxBuf,
  99. uint16_t rxBufLen,
  100. uint16_t* rcvLen);
  101. /*!
  102. *****************************************************************************
  103. * \brief NFC-V Poller Fast Read Single Block (M24LR)
  104. *
  105. * Reads a Single Block from a M24LR tag which has the number of blocks
  106. * bigger than 256 (M24LR16 ; M24LR64) using ST Fast mode
  107. *
  108. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  109. * default: RFAL_NFCV_REQ_FLAG_DEFAULT
  110. * \param[in] uid : UID of the device to be put to be read
  111. * if not provided Select mode will be used
  112. * \param[in] blockNum : Number of the block to read (16 bits)
  113. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  114. * \param[in] rxBufLen : length of rxBuf
  115. * \param[out] rcvLen : number of bytes received
  116. *
  117. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  118. * \return ERR_PARAM : Invalid parameters
  119. * \return ERR_IO : Generic internal error
  120. * \return ERR_CRC : CRC error detected
  121. * \return ERR_FRAMING : Framing error detected
  122. * \return ERR_PROTO : Protocol error detected
  123. * \return ERR_TIMEOUT : Timeout error
  124. * \return ERR_NONE : No error
  125. *****************************************************************************
  126. */
  127. ReturnCode rfalST25xVPollerM24LRFastReadSingleBlock(
  128. uint8_t flags,
  129. const uint8_t* uid,
  130. uint16_t blockNum,
  131. uint8_t* rxBuf,
  132. uint16_t rxBufLen,
  133. uint16_t* rcvLen);
  134. /*!
  135. *****************************************************************************
  136. * \brief NFC-V Poller Write Single Block (M24LR)
  137. *
  138. * Writes a Single Block from a M24LR tag which has the number of blocks
  139. * bigger than 256 (M24LR16 ; M24LR64)
  140. *
  141. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  142. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  143. * \param[in] uid : UID of the device to be put to be written
  144. * if not provided Select mode will be used
  145. * \param[in] blockNum : Number of the block to write (16 bits)
  146. * \param[in] wrData : data to be written on the given block
  147. * \param[in] blockLen : number of bytes of a block
  148. *
  149. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  150. * \return ERR_PARAM : Invalid parameters
  151. * \return ERR_IO : Generic internal error
  152. * \return ERR_CRC : CRC error detected
  153. * \return ERR_FRAMING : Framing error detected
  154. * \return ERR_PROTO : Protocol error detected
  155. * \return ERR_TIMEOUT : Timeout error
  156. * \return ERR_NONE : No error
  157. *****************************************************************************
  158. */
  159. ReturnCode rfalST25xVPollerM24LRWriteSingleBlock(
  160. uint8_t flags,
  161. const uint8_t* uid,
  162. uint16_t blockNum,
  163. const uint8_t* wrData,
  164. uint8_t blockLen);
  165. /*!
  166. *****************************************************************************
  167. * \brief NFC-V Poller Read Multiple Blocks (M24LR)
  168. *
  169. * Reads Multiple Blocks from a device from a M24LR tag which has the number of blocks
  170. * bigger than 256 (M24LR16 ; M24LR64)
  171. *
  172. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  173. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  174. * \param[in] uid : UID of the device to be put to be read
  175. * if not provided Select mode will be used
  176. * \param[in] firstBlockNum : first block to be read (16 bits)
  177. * \param[in] numOfBlocks : number of block to read
  178. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  179. * \param[in] rxBufLen : length of rxBuf
  180. * \param[out] rcvLen : number of bytes received
  181. *
  182. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  183. * \return ERR_PARAM : Invalid parameters
  184. * \return ERR_IO : Generic internal error
  185. * \return ERR_CRC : CRC error detected
  186. * \return ERR_FRAMING : Framing error detected
  187. * \return ERR_PROTO : Protocol error detected
  188. * \return ERR_TIMEOUT : Timeout error
  189. * \return ERR_NONE : No error
  190. *****************************************************************************
  191. */
  192. ReturnCode rfalST25xVPollerM24LRReadMultipleBlocks(
  193. uint8_t flags,
  194. const uint8_t* uid,
  195. uint16_t firstBlockNum,
  196. uint8_t numOfBlocks,
  197. uint8_t* rxBuf,
  198. uint16_t rxBufLen,
  199. uint16_t* rcvLen);
  200. /*!
  201. *****************************************************************************
  202. * \brief NFC-V Poller Fast Read Multiple Blocks (M24LR)
  203. *
  204. * Reads Multiple Blocks from a device from a M24LR tag which has the number of blocks
  205. * bigger than 256 (M24LR16 ; M24LR64) using ST Fast mode
  206. *
  207. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  208. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  209. * \param[in] uid : UID of the device to be put to be read
  210. * if not provided Select mode will be used
  211. * \param[in] firstBlockNum : first block to be read (16 bits)
  212. * \param[in] numOfBlocks : number of block to read
  213. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  214. * \param[in] rxBufLen : length of rxBuf
  215. * \param[out] rcvLen : number of bytes received
  216. *
  217. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  218. * \return ERR_PARAM : Invalid parameters
  219. * \return ERR_IO : Generic internal error
  220. * \return ERR_CRC : CRC error detected
  221. * \return ERR_FRAMING : Framing error detected
  222. * \return ERR_PROTO : Protocol error detected
  223. * \return ERR_TIMEOUT : Timeout error
  224. * \return ERR_NONE : No error
  225. *****************************************************************************
  226. */
  227. ReturnCode rfalST25xVPollerM24LRFastReadMultipleBlocks(
  228. uint8_t flags,
  229. const uint8_t* uid,
  230. uint16_t firstBlockNum,
  231. uint8_t numOfBlocks,
  232. uint8_t* rxBuf,
  233. uint16_t rxBufLen,
  234. uint16_t* rcvLen);
  235. /*!
  236. *****************************************************************************
  237. * \brief NFC-V Poller Fast Read Single Block
  238. *
  239. * Reads a Single Block from a device (VICC) using ST Fast mode
  240. *
  241. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  242. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  243. * \param[in] uid : UID of the device to be put to be read
  244. * if not provided Select mode will be used
  245. * \param[in] blockNum : Number of the block to read
  246. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  247. * \param[in] rxBufLen : length of rxBuf
  248. * \param[out] rcvLen : number of bytes received
  249. *
  250. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  251. * \return ERR_PARAM : Invalid parameters
  252. * \return ERR_IO : Generic internal error
  253. * \return ERR_CRC : CRC error detected
  254. * \return ERR_FRAMING : Framing error detected
  255. * \return ERR_PROTO : Protocol error detected
  256. * \return ERR_TIMEOUT : Timeout error
  257. * \return ERR_NONE : No error
  258. *****************************************************************************
  259. */
  260. ReturnCode rfalST25xVPollerFastReadSingleBlock(
  261. uint8_t flags,
  262. const uint8_t* uid,
  263. uint8_t blockNum,
  264. uint8_t* rxBuf,
  265. uint16_t rxBufLen,
  266. uint16_t* rcvLen);
  267. /*!
  268. *****************************************************************************
  269. * \brief NFC-V Poller Fast Read Multiple Blocks
  270. *
  271. * Reads Multiple Blocks from a device (VICC) using ST Fast mode
  272. *
  273. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  274. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  275. * \param[in] uid : UID of the device to be put to be read
  276. * if not provided Select mode will be used
  277. * \param[in] firstBlockNum : first block to be read
  278. * \param[in] numOfBlocks : number of block to read
  279. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  280. * \param[in] rxBufLen : length of rxBuf
  281. * \param[out] rcvLen : number of bytes received
  282. *
  283. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  284. * \return ERR_PARAM : Invalid parameters
  285. * \return ERR_IO : Generic internal error
  286. * \return ERR_CRC : CRC error detected
  287. * \return ERR_FRAMING : Framing error detected
  288. * \return ERR_PROTO : Protocol error detected
  289. * \return ERR_TIMEOUT : Timeout error
  290. * \return ERR_NONE : No error
  291. *****************************************************************************
  292. */
  293. ReturnCode rfalST25xVPollerFastReadMultipleBlocks(
  294. uint8_t flags,
  295. const uint8_t* uid,
  296. uint8_t firstBlockNum,
  297. uint8_t numOfBlocks,
  298. uint8_t* rxBuf,
  299. uint16_t rxBufLen,
  300. uint16_t* rcvLen);
  301. /*!
  302. *****************************************************************************
  303. * \brief NFC-V Poller Fast Extended Read Single Block
  304. *
  305. * Reads a Single Block from a device (VICC) supporting extended commands using ST Fast mode
  306. *
  307. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  308. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  309. * \param[in] uid : UID of the device to be put to be read
  310. * if not provided Select mode will be used
  311. * \param[in] blockNum : Number of the block to read (16 bits)
  312. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  313. * \param[in] rxBufLen : length of rxBuf
  314. * \param[out] rcvLen : number of bytes received
  315. *
  316. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  317. * \return ERR_PARAM : Invalid parameters
  318. * \return ERR_IO : Generic internal error
  319. * \return ERR_CRC : CRC error detected
  320. * \return ERR_FRAMING : Framing error detected
  321. * \return ERR_PROTO : Protocol error detected
  322. * \return ERR_TIMEOUT : Timeout error
  323. * \return ERR_NONE : No error
  324. *****************************************************************************
  325. */
  326. ReturnCode rfalST25xVPollerFastExtendedReadSingleBlock(
  327. uint8_t flags,
  328. const uint8_t* uid,
  329. uint16_t blockNum,
  330. uint8_t* rxBuf,
  331. uint16_t rxBufLen,
  332. uint16_t* rcvLen);
  333. /*!
  334. *****************************************************************************
  335. * \brief NFC-V Poller Fast Extended Read Multiple Blocks
  336. *
  337. * Reads Multiple Blocks from a device (VICC) supporting extended commands using ST Fast mode
  338. *
  339. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  340. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  341. * \param[in] uid : UID of the device to be put to be read
  342. * if not provided Select mode will be used
  343. * \param[in] firstBlockNum : first block to be read (16 bits)
  344. * \param[in] numOfBlocks : number of consecutive blocks to read (16 bits)
  345. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  346. * \param[in] rxBufLen : length of rxBuf
  347. * \param[out] rcvLen : number of bytes received
  348. *
  349. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  350. * \return ERR_PARAM : Invalid parameters
  351. * \return ERR_IO : Generic internal error
  352. * \return ERR_CRC : CRC error detected
  353. * \return ERR_FRAMING : Framing error detected
  354. * \return ERR_PROTO : Protocol error detected
  355. * \return ERR_TIMEOUT : Timeout error
  356. * \return ERR_NONE : No error
  357. *****************************************************************************
  358. */
  359. ReturnCode rfalST25xVPollerFastExtReadMultipleBlocks(
  360. uint8_t flags,
  361. const uint8_t* uid,
  362. uint16_t firstBlockNum,
  363. uint16_t numOfBlocks,
  364. uint8_t* rxBuf,
  365. uint16_t rxBufLen,
  366. uint16_t* rcvLen);
  367. /*!
  368. *****************************************************************************
  369. * \brief NFC-V Poller Read Configuration
  370. *
  371. * Reads static configuration registers at the Pointer address
  372. *
  373. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  374. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  375. * \param[in] uid : UID of the device to be put to be read
  376. * if not provided Select mode will be used
  377. * \param[in] pointer : Pointer address
  378. * \param[out] regValue : Register value
  379. *
  380. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  381. * \return ERR_PARAM : Invalid parameters
  382. * \return ERR_IO : Generic internal error
  383. * \return ERR_CRC : CRC error detected
  384. * \return ERR_FRAMING : Framing error detected
  385. * \return ERR_PROTO : Protocol error detected
  386. * \return ERR_TIMEOUT : Timeout error
  387. * \return ERR_NONE : No error
  388. *****************************************************************************
  389. */
  390. ReturnCode rfalST25xVPollerReadConfiguration(
  391. uint8_t flags,
  392. const uint8_t* uid,
  393. uint8_t pointer,
  394. uint8_t* regValue);
  395. /*!
  396. *****************************************************************************
  397. * \brief NFC-V Poller Write Configuration
  398. *
  399. * Writes static configuration registers at the Pointer address
  400. *
  401. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  402. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  403. * \param[in] uid : UID of the device to be put to be read
  404. * if not provided Select mode will be used
  405. * \param[in] pointer : Pointer address
  406. * \param[in] regValue : Register value
  407. *
  408. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  409. * \return ERR_PARAM : Invalid parameters
  410. * \return ERR_IO : Generic internal error
  411. * \return ERR_CRC : CRC error detected
  412. * \return ERR_FRAMING : Framing error detected
  413. * \return ERR_PROTO : Protocol error detected
  414. * \return ERR_TIMEOUT : Timeout error
  415. * \return ERR_NONE : No error
  416. *****************************************************************************
  417. */
  418. ReturnCode rfalST25xVPollerWriteConfiguration(
  419. uint8_t flags,
  420. const uint8_t* uid,
  421. uint8_t pointer,
  422. uint8_t regValue);
  423. /*!
  424. *****************************************************************************
  425. * \brief NFC-V Poller Read Dynamic Configuration
  426. *
  427. * Reads dynamic registers at the Pointer address
  428. *
  429. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  430. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  431. * \param[in] uid : UID of the device to be put to be read
  432. * if not provided Select mode will be used
  433. * \param[in] pointer : Pointer address
  434. * \param[out] regValue : Register value
  435. *
  436. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  437. * \return ERR_PARAM : Invalid parameters
  438. * \return ERR_IO : Generic internal error
  439. * \return ERR_CRC : CRC error detected
  440. * \return ERR_FRAMING : Framing error detected
  441. * \return ERR_PROTO : Protocol error detected
  442. * \return ERR_TIMEOUT : Timeout error
  443. * \return ERR_NONE : No error
  444. *****************************************************************************
  445. */
  446. ReturnCode rfalST25xVPollerReadDynamicConfiguration(
  447. uint8_t flags,
  448. const uint8_t* uid,
  449. uint8_t pointer,
  450. uint8_t* regValue);
  451. /*!
  452. *****************************************************************************
  453. * \brief NFC-V Poller Write Dynamic Configuration
  454. *
  455. * Writes dynamic registers at the Pointer address
  456. *
  457. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  458. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  459. * \param[in] uid : UID of the device to be put to be read
  460. * if not provided Select mode will be used
  461. * \param[in] pointer : Pointer address
  462. * \param[in] regValue : Register value
  463. *
  464. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  465. * \return ERR_PARAM : Invalid parameters
  466. * \return ERR_IO : Generic internal error
  467. * \return ERR_CRC : CRC error detected
  468. * \return ERR_FRAMING : Framing error detected
  469. * \return ERR_PROTO : Protocol error detected
  470. * \return ERR_TIMEOUT : Timeout error
  471. * \return ERR_NONE : No error
  472. *****************************************************************************
  473. */
  474. ReturnCode rfalST25xVPollerWriteDynamicConfiguration(
  475. uint8_t flags,
  476. const uint8_t* uid,
  477. uint8_t pointer,
  478. uint8_t regValue);
  479. /*!
  480. *****************************************************************************
  481. * \brief NFC-V Poller Fast Read Dynamic Configuration
  482. *
  483. * Reads dynamic registers at the Pointer address using ST Fast mode
  484. *
  485. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  486. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  487. * \param[in] uid : UID of the device to be put to be read
  488. * if not provided Select mode will be used
  489. * \param[in] pointer : Pointer address
  490. * \param[out] regValue : Register value
  491. *
  492. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  493. * \return ERR_PARAM : Invalid parameters
  494. * \return ERR_IO : Generic internal error
  495. * \return ERR_CRC : CRC error detected
  496. * \return ERR_FRAMING : Framing error detected
  497. * \return ERR_PROTO : Protocol error detected
  498. * \return ERR_TIMEOUT : Timeout error
  499. * \return ERR_NONE : No error
  500. *****************************************************************************
  501. */
  502. ReturnCode rfalST25xVPollerFastReadDynamicConfiguration(
  503. uint8_t flags,
  504. const uint8_t* uid,
  505. uint8_t pointer,
  506. uint8_t* regValue);
  507. /*!
  508. *****************************************************************************
  509. * \brief NFC-V Poller Fast Write Dynamic Configuration
  510. *
  511. * Writes dynamic registers at the Pointer address using ST Fast mode
  512. *
  513. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  514. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  515. * \param[in] uid : UID of the device to be put to be read
  516. * if not provided Select mode will be used
  517. * \param[in] pointer : Pointer address
  518. * \param[in] regValue : Register value
  519. *
  520. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  521. * \return ERR_PARAM : Invalid parameters
  522. * \return ERR_IO : Generic internal error
  523. * \return ERR_CRC : CRC error detected
  524. * \return ERR_FRAMING : Framing error detected
  525. * \return ERR_PROTO : Protocol error detected
  526. * \return ERR_TIMEOUT : Timeout error
  527. * \return ERR_NONE : No error
  528. *****************************************************************************
  529. */
  530. ReturnCode rfalST25xVPollerFastWriteDynamicConfiguration(
  531. uint8_t flags,
  532. const uint8_t* uid,
  533. uint8_t pointer,
  534. uint8_t regValue);
  535. /*!
  536. *****************************************************************************
  537. * \brief NFC-V Poller Present Password
  538. *
  539. * Sends the Present Password command
  540. *
  541. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  542. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  543. * \param[in] uid : UID of the device to be put to be read
  544. * if not provided Select mode will be used
  545. * \param[in] pwdNum : Password number
  546. * \param[in] pwd : Password
  547. * \param[in] pwdLen : Password length
  548. *
  549. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  550. * \return ERR_PARAM : Invalid parameters
  551. * \return ERR_IO : Generic internal error
  552. * \return ERR_CRC : CRC error detected
  553. * \return ERR_FRAMING : Framing error detected
  554. * \return ERR_PROTO : Protocol error detected
  555. * \return ERR_TIMEOUT : Timeout error
  556. * \return ERR_NONE : No error
  557. *****************************************************************************
  558. */
  559. ReturnCode rfalST25xVPollerPresentPassword(
  560. uint8_t flags,
  561. const uint8_t* uid,
  562. uint8_t pwdNum,
  563. const uint8_t* pwd,
  564. uint8_t pwdLen);
  565. /*!
  566. *****************************************************************************
  567. * \brief NFC-V Poller Get Random Number
  568. *
  569. * Returns a 16 bit random number
  570. *
  571. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  572. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  573. * \param[in] uid : UID of the device to be put to be read
  574. * if not provided Select mode will be used
  575. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  576. * \param[in] rxBufLen : length of rxBuf
  577. * \param[out] rcvLen : number of bytes received
  578. *
  579. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  580. * \return ERR_PARAM : Invalid parameters
  581. * \return ERR_IO : Generic internal error
  582. * \return ERR_CRC : CRC error detected
  583. * \return ERR_FRAMING : Framing error detected
  584. * \return ERR_PROTO : Protocol error detected
  585. * \return ERR_TIMEOUT : Timeout error
  586. * \return ERR_NONE : No error
  587. *****************************************************************************
  588. */
  589. ReturnCode rfalST25xVPollerGetRandomNumber(
  590. uint8_t flags,
  591. const uint8_t* uid,
  592. uint8_t* rxBuf,
  593. uint16_t rxBufLen,
  594. uint16_t* rcvLen);
  595. /*!
  596. *****************************************************************************
  597. * \brief NFC-V Poller Read Message length
  598. *
  599. * Sends a Read Message Length message to retrieve the value of MB_LEN_Dyn
  600. *
  601. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  602. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  603. * \param[in] uid : UID of the device to be put to be read
  604. * if not provided Select mode will be used
  605. * \param[out] msgLen : Message Length
  606. *
  607. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  608. * \return ERR_PARAM : Invalid parameters
  609. * \return ERR_IO : Generic internal error
  610. * \return ERR_CRC : CRC error detected
  611. * \return ERR_FRAMING : Framing error detected
  612. * \return ERR_PROTO : Protocol error detected
  613. * \return ERR_TIMEOUT : Timeout error
  614. * \return ERR_NONE : No error
  615. *****************************************************************************
  616. */
  617. ReturnCode rfalST25xVPollerReadMessageLength(uint8_t flags, const uint8_t* uid, uint8_t* msgLen);
  618. /*!
  619. *****************************************************************************
  620. * \brief NFC-V Poller Fast Read Message length
  621. *
  622. * Sends a Fast Read Message Length message to retrieve the value of MB_LEN_Dyn using ST Fast mode.
  623. *
  624. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  625. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  626. * \param[in] uid : UID of the device to be put to be read
  627. * if not provided Select mode will be used
  628. * \param[out] msgLen : Message Length
  629. *
  630. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  631. * \return ERR_PARAM : Invalid parameters
  632. * \return ERR_IO : Generic internal error
  633. * \return ERR_CRC : CRC error detected
  634. * \return ERR_FRAMING : Framing error detected
  635. * \return ERR_PROTO : Protocol error detected
  636. * \return ERR_TIMEOUT : Timeout error
  637. * \return ERR_NONE : No error
  638. *****************************************************************************
  639. */
  640. ReturnCode rfalST25xVPollerFastReadMsgLength(uint8_t flags, const uint8_t* uid, uint8_t* msgLen);
  641. /*!
  642. *****************************************************************************
  643. * \brief NFC-V Poller Read Message
  644. *
  645. * Reads up to 256 bytes in the Mailbox from the location
  646. * specified by MBpointer and sends back their value in the rxBuf response.
  647. * First MailBox location is '00'. When Number of bytes is set to 00h
  648. * and MBPointer is equals to 00h, the MB_LEN bytes of the full message
  649. * are returned. Otherwise, Read Message command returns (Number of Bytes + 1) bytes
  650. * (i.e. 01h returns 2 bytes, FFh returns 256 bytes).
  651. * An error is reported if (Pointer + Nb of bytes + 1) is greater than the message length.
  652. * RF Reading of the last byte of the mailbox message automatically clears b1
  653. * of MB_CTRL_Dyn HOST_PUT_MSG, and allows RF to put a new message.
  654. *
  655. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  656. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  657. * \param[in] uid : UID of the device to be put to be read
  658. * if not provided Select mode will be used
  659. * \param[in] mbPointer : MPpointer
  660. * \param[in] numBytes : number of bytes
  661. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  662. * \param[in] rxBufLen : length of rxBuf
  663. * \param[out] rcvLen : number of bytes received
  664. *
  665. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  666. * \return ERR_PARAM : Invalid parameters
  667. * \return ERR_IO : Generic internal error
  668. * \return ERR_CRC : CRC error detected
  669. * \return ERR_FRAMING : Framing error detected
  670. * \return ERR_PROTO : Protocol error detected
  671. * \return ERR_TIMEOUT : Timeout error
  672. * \return ERR_NONE : No error
  673. *****************************************************************************
  674. */
  675. ReturnCode rfalST25xVPollerReadMessage(
  676. uint8_t flags,
  677. const uint8_t* uid,
  678. uint8_t mbPointer,
  679. uint8_t numBytes,
  680. uint8_t* rxBuf,
  681. uint16_t rxBufLen,
  682. uint16_t* rcvLen);
  683. /*!
  684. *****************************************************************************
  685. * \brief NFC-V Poller Fast Read Message
  686. *
  687. * Reads up to 256 bytes in the Mailbox from the location
  688. * specified by MBpointer and sends back their value in the rxBuf response using ST Fast mode.
  689. * First MailBox location is '00'. When Number of bytes is set to 00h
  690. * and MBPointer is equals to 00h, the MB_LEN bytes of the full message
  691. * are returned. Otherwise, Read Message command returns (Number of Bytes + 1) bytes
  692. * (i.e. 01h returns 2 bytes, FFh returns 256 bytes).
  693. * An error is reported if (Pointer + Nb of bytes + 1) is greater than the message length.
  694. * RF Reading of the last byte of the mailbox message automatically clears b1
  695. * of MB_CTRL_Dyn HOST_PUT_MSG, and allows RF to put a new message.
  696. *
  697. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  698. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  699. * \param[in] uid : UID of the device to be put to be read
  700. * if not provided Select mode will be used
  701. * \param[in] mbPointer : MPpointer
  702. * \param[in] numBytes : number of bytes
  703. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  704. * \param[in] rxBufLen : length of rxBuf
  705. * \param[out] rcvLen : number of bytes received
  706. *
  707. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  708. * \return ERR_PARAM : Invalid parameters
  709. * \return ERR_IO : Generic internal error
  710. * \return ERR_CRC : CRC error detected
  711. * \return ERR_FRAMING : Framing error detected
  712. * \return ERR_PROTO : Protocol error detected
  713. * \return ERR_TIMEOUT : Timeout error
  714. * \return ERR_NONE : No error
  715. *****************************************************************************
  716. */
  717. ReturnCode rfalST25xVPollerFastReadMessage(
  718. uint8_t flags,
  719. const uint8_t* uid,
  720. uint8_t mbPointer,
  721. uint8_t numBytes,
  722. uint8_t* rxBuf,
  723. uint16_t rxBufLen,
  724. uint16_t* rcvLen);
  725. /*!
  726. *****************************************************************************
  727. * \brief NFC-V Poller Write Message
  728. *
  729. * Sends Write message Command
  730. *
  731. * On receiving the Write Message command, the ST25DVxxx puts the data contained
  732. * in the request into the Mailbox buffer, update the MB_LEN_Dyn register, and
  733. * set bit RF_PUT_MSG in MB_CTRL_Dyn register. It then reports if the write operation was successful
  734. * in the response. The ST25DVxxx Mailbox contains up to 256 data bytes which are filled from the
  735. * first location '00'. MSGlength parameter of the command is the number of
  736. * Data bytes minus 1 (00 for 1 byte of data, FFh for 256 bytes of data).
  737. * Write Message could be executed only when Mailbox is accessible by RF.
  738. *
  739. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  740. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  741. * \param[in] uid : UID of the device to be put to be read
  742. * if not provided Select mode will be used
  743. * \param[in] msgLen : MSGLen number of Data bytes minus 1
  744. * \param[in] msgData : Message Data
  745. * \param[out] txBuf : buffer to used to build the Write Message command
  746. * \param[in] txBufLen : length of txBuf
  747. *
  748. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  749. * \return ERR_PARAM : Invalid parameters
  750. * \return ERR_IO : Generic internal error
  751. * \return ERR_CRC : CRC error detected
  752. * \return ERR_FRAMING : Framing error detected
  753. * \return ERR_PROTO : Protocol error detected
  754. * \return ERR_TIMEOUT : Timeout error
  755. * \return ERR_NONE : No error
  756. *****************************************************************************
  757. */
  758. ReturnCode rfalST25xVPollerWriteMessage(
  759. uint8_t flags,
  760. const uint8_t* uid,
  761. uint8_t msgLen,
  762. const uint8_t* msgData,
  763. uint8_t* txBuf,
  764. uint16_t txBufLen);
  765. /*!
  766. *****************************************************************************
  767. * \brief NFC-V Poller Fast Write Message
  768. *
  769. * Sends Fast Write message Command using ST Fast mode
  770. *
  771. * On receiving the Write Message command, the ST25DVxxx puts the data contained
  772. * in the request into the Mailbox buffer, update the MB_LEN_Dyn register, and
  773. * set bit RF_PUT_MSG in MB_CTRL_Dyn register. It then reports if the write operation was successful
  774. * in the response. The ST25DVxxx Mailbox contains up to 256 data bytes which are filled from the
  775. * first location '00'. MSGlength parameter of the command is the number of
  776. * Data bytes minus 1 (00 for 1 byte of data, FFh for 256 bytes of data).
  777. * Write Message could be executed only when Mailbox is accessible by RF.
  778. *
  779. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  780. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  781. * \param[in] uid : UID of the device to be put to be read
  782. * if not provided Select mode will be used
  783. * \param[in] msgLen : MSGLen number of Data bytes minus 1
  784. * \param[in] msgData : Message Data
  785. * \param[out] txBuf : buffer to used to build the Write Message command
  786. * \param[in] txBufLen : length of txBuf
  787. *
  788. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  789. * \return ERR_PARAM : Invalid parameters
  790. * \return ERR_IO : Generic internal error
  791. * \return ERR_CRC : CRC error detected
  792. * \return ERR_FRAMING : Framing error detected
  793. * \return ERR_PROTO : Protocol error detected
  794. * \return ERR_TIMEOUT : Timeout error
  795. * \return ERR_NONE : No error
  796. *****************************************************************************
  797. */
  798. ReturnCode rfalST25xVPollerFastWriteMessage(
  799. uint8_t flags,
  800. const uint8_t* uid,
  801. uint8_t msgLen,
  802. const uint8_t* msgData,
  803. uint8_t* txBuf,
  804. uint16_t txBufLen);
  805. #endif /* RFAL_ST25xV_H */
  806. /**
  807. * @}
  808. *
  809. * @}
  810. *
  811. * @}
  812. */