rfal_st25xv.h 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  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 2U /*!< Block Number length of MR24LR tags: 16 bits */
  65. #define RFAL_NFCV_ST_IC_MFG_CODE 0x02 /*!< ST IC Mfg code (used for custom commands) */
  66. /*!
  67. *****************************************************************************
  68. * \brief NFC-V Poller Read Single Block (M24LR)
  69. *
  70. * Reads a Single Block from a M24LR tag which has the number of blocks
  71. * bigger than 256 (M24LR16 ; M24LR64)
  72. *
  73. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  74. * default: RFAL_NFCV_REQ_FLAG_DEFAULT
  75. * \param[in] uid : UID of the device to be put to be read
  76. * if not provided Select mode will be used
  77. * \param[in] blockNum : Number of the block to read (16 bits)
  78. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  79. * \param[in] rxBufLen : length of rxBuf
  80. * \param[out] rcvLen : number of bytes received
  81. *
  82. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  83. * \return ERR_PARAM : Invalid parameters
  84. * \return ERR_IO : Generic internal error
  85. * \return ERR_CRC : CRC error detected
  86. * \return ERR_FRAMING : Framing error detected
  87. * \return ERR_PROTO : Protocol error detected
  88. * \return ERR_TIMEOUT : Timeout error
  89. * \return ERR_NONE : No error
  90. *****************************************************************************
  91. */
  92. ReturnCode rfalST25xVPollerM24LRReadSingleBlock( uint8_t flags, const uint8_t* uid, uint16_t blockNum, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  93. /*!
  94. *****************************************************************************
  95. * \brief NFC-V Poller Fast Read Single Block (M24LR)
  96. *
  97. * Reads a Single Block from a M24LR tag which has the number of blocks
  98. * bigger than 256 (M24LR16 ; M24LR64) using ST Fast mode
  99. *
  100. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  101. * default: RFAL_NFCV_REQ_FLAG_DEFAULT
  102. * \param[in] uid : UID of the device to be put to be read
  103. * if not provided Select mode will be used
  104. * \param[in] blockNum : Number of the block to read (16 bits)
  105. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  106. * \param[in] rxBufLen : length of rxBuf
  107. * \param[out] rcvLen : number of bytes received
  108. *
  109. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  110. * \return ERR_PARAM : Invalid parameters
  111. * \return ERR_IO : Generic internal error
  112. * \return ERR_CRC : CRC error detected
  113. * \return ERR_FRAMING : Framing error detected
  114. * \return ERR_PROTO : Protocol error detected
  115. * \return ERR_TIMEOUT : Timeout error
  116. * \return ERR_NONE : No error
  117. *****************************************************************************
  118. */
  119. ReturnCode rfalST25xVPollerM24LRFastReadSingleBlock( uint8_t flags, const uint8_t* uid, uint16_t blockNum, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  120. /*!
  121. *****************************************************************************
  122. * \brief NFC-V Poller Write Single Block (M24LR)
  123. *
  124. * Writes a Single Block from a M24LR tag which has the number of blocks
  125. * bigger than 256 (M24LR16 ; M24LR64)
  126. *
  127. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  128. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  129. * \param[in] uid : UID of the device to be put to be written
  130. * if not provided Select mode will be used
  131. * \param[in] blockNum : Number of the block to write (16 bits)
  132. * \param[in] wrData : data to be written on the given block
  133. * \param[in] blockLen : number of bytes of a block
  134. *
  135. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  136. * \return ERR_PARAM : Invalid parameters
  137. * \return ERR_IO : Generic internal error
  138. * \return ERR_CRC : CRC error detected
  139. * \return ERR_FRAMING : Framing error detected
  140. * \return ERR_PROTO : Protocol error detected
  141. * \return ERR_TIMEOUT : Timeout error
  142. * \return ERR_NONE : No error
  143. *****************************************************************************
  144. */
  145. ReturnCode rfalST25xVPollerM24LRWriteSingleBlock( uint8_t flags, const uint8_t* uid, uint16_t blockNum, const uint8_t* wrData, uint8_t blockLen );
  146. /*!
  147. *****************************************************************************
  148. * \brief NFC-V Poller Read Multiple Blocks (M24LR)
  149. *
  150. * Reads Multiple Blocks from a device from a M24LR tag which has the number of blocks
  151. * bigger than 256 (M24LR16 ; M24LR64)
  152. *
  153. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  154. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  155. * \param[in] uid : UID of the device to be put to be read
  156. * if not provided Select mode will be used
  157. * \param[in] firstBlockNum : first block to be read (16 bits)
  158. * \param[in] numOfBlocks : number of block to read
  159. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  160. * \param[in] rxBufLen : length of rxBuf
  161. * \param[out] rcvLen : number of bytes received
  162. *
  163. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  164. * \return ERR_PARAM : Invalid parameters
  165. * \return ERR_IO : Generic internal error
  166. * \return ERR_CRC : CRC error detected
  167. * \return ERR_FRAMING : Framing error detected
  168. * \return ERR_PROTO : Protocol error detected
  169. * \return ERR_TIMEOUT : Timeout error
  170. * \return ERR_NONE : No error
  171. *****************************************************************************
  172. */
  173. ReturnCode rfalST25xVPollerM24LRReadMultipleBlocks( uint8_t flags, const uint8_t* uid, uint16_t firstBlockNum, uint8_t numOfBlocks, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  174. /*!
  175. *****************************************************************************
  176. * \brief NFC-V Poller Fast Read Multiple Blocks (M24LR)
  177. *
  178. * Reads Multiple Blocks from a device from a M24LR tag which has the number of blocks
  179. * bigger than 256 (M24LR16 ; M24LR64) using ST Fast mode
  180. *
  181. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  182. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  183. * \param[in] uid : UID of the device to be put to be read
  184. * if not provided Select mode will be used
  185. * \param[in] firstBlockNum : first block to be read (16 bits)
  186. * \param[in] numOfBlocks : number of block to read
  187. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  188. * \param[in] rxBufLen : length of rxBuf
  189. * \param[out] rcvLen : number of bytes received
  190. *
  191. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  192. * \return ERR_PARAM : Invalid parameters
  193. * \return ERR_IO : Generic internal error
  194. * \return ERR_CRC : CRC error detected
  195. * \return ERR_FRAMING : Framing error detected
  196. * \return ERR_PROTO : Protocol error detected
  197. * \return ERR_TIMEOUT : Timeout error
  198. * \return ERR_NONE : No error
  199. *****************************************************************************
  200. */
  201. ReturnCode rfalST25xVPollerM24LRFastReadMultipleBlocks( uint8_t flags, const uint8_t* uid, uint16_t firstBlockNum, uint8_t numOfBlocks, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  202. /*!
  203. *****************************************************************************
  204. * \brief NFC-V Poller Fast Read Single Block
  205. *
  206. * Reads a Single Block from a device (VICC) using ST Fast mode
  207. *
  208. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  209. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  210. * \param[in] uid : UID of the device to be put to be read
  211. * if not provided Select mode will be used
  212. * \param[in] blockNum : Number of the 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 rfalST25xVPollerFastReadSingleBlock( uint8_t flags, const uint8_t* uid, uint8_t blockNum, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  228. /*!
  229. *****************************************************************************
  230. * \brief NFC-V Poller Fast Read Multiple Blocks
  231. *
  232. * Reads Multiple Blocks from a device (VICC) using ST Fast mode
  233. *
  234. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  235. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  236. * \param[in] uid : UID of the device to be put to be read
  237. * if not provided Select mode will be used
  238. * \param[in] firstBlockNum : first block to be read
  239. * \param[in] numOfBlocks : number of block to read
  240. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  241. * \param[in] rxBufLen : length of rxBuf
  242. * \param[out] rcvLen : number of bytes received
  243. *
  244. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  245. * \return ERR_PARAM : Invalid parameters
  246. * \return ERR_IO : Generic internal error
  247. * \return ERR_CRC : CRC error detected
  248. * \return ERR_FRAMING : Framing error detected
  249. * \return ERR_PROTO : Protocol error detected
  250. * \return ERR_TIMEOUT : Timeout error
  251. * \return ERR_NONE : No error
  252. *****************************************************************************
  253. */
  254. ReturnCode rfalST25xVPollerFastReadMultipleBlocks( uint8_t flags, const uint8_t* uid, uint8_t firstBlockNum, uint8_t numOfBlocks, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  255. /*!
  256. *****************************************************************************
  257. * \brief NFC-V Poller Fast Extended Read Single Block
  258. *
  259. * Reads a Single Block from a device (VICC) supporting extended commands using ST Fast mode
  260. *
  261. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  262. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  263. * \param[in] uid : UID of the device to be put to be read
  264. * if not provided Select mode will be used
  265. * \param[in] blockNum : Number of the block to read (16 bits)
  266. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  267. * \param[in] rxBufLen : length of rxBuf
  268. * \param[out] rcvLen : number of bytes received
  269. *
  270. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  271. * \return ERR_PARAM : Invalid parameters
  272. * \return ERR_IO : Generic internal error
  273. * \return ERR_CRC : CRC error detected
  274. * \return ERR_FRAMING : Framing error detected
  275. * \return ERR_PROTO : Protocol error detected
  276. * \return ERR_TIMEOUT : Timeout error
  277. * \return ERR_NONE : No error
  278. *****************************************************************************
  279. */
  280. ReturnCode rfalST25xVPollerFastExtendedReadSingleBlock( uint8_t flags, const uint8_t* uid, uint16_t blockNum, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  281. /*!
  282. *****************************************************************************
  283. * \brief NFC-V Poller Fast Extended Read Multiple Blocks
  284. *
  285. * Reads Multiple Blocks from a device (VICC) supporting extended commands using ST Fast mode
  286. *
  287. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  288. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  289. * \param[in] uid : UID of the device to be put to be read
  290. * if not provided Select mode will be used
  291. * \param[in] firstBlockNum : first block to be read (16 bits)
  292. * \param[in] numOfBlocks : number of consecutive blocks to read (16 bits)
  293. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  294. * \param[in] rxBufLen : length of rxBuf
  295. * \param[out] rcvLen : number of bytes received
  296. *
  297. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  298. * \return ERR_PARAM : Invalid parameters
  299. * \return ERR_IO : Generic internal error
  300. * \return ERR_CRC : CRC error detected
  301. * \return ERR_FRAMING : Framing error detected
  302. * \return ERR_PROTO : Protocol error detected
  303. * \return ERR_TIMEOUT : Timeout error
  304. * \return ERR_NONE : No error
  305. *****************************************************************************
  306. */
  307. ReturnCode rfalST25xVPollerFastExtReadMultipleBlocks( uint8_t flags, const uint8_t* uid, uint16_t firstBlockNum, uint16_t numOfBlocks, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  308. /*!
  309. *****************************************************************************
  310. * \brief NFC-V Poller Read Configuration
  311. *
  312. * Reads static configuration registers at the Pointer address
  313. *
  314. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  315. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  316. * \param[in] uid : UID of the device to be put to be read
  317. * if not provided Select mode will be used
  318. * \param[in] pointer : Pointer address
  319. * \param[out] regValue : Register value
  320. *
  321. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  322. * \return ERR_PARAM : Invalid parameters
  323. * \return ERR_IO : Generic internal error
  324. * \return ERR_CRC : CRC error detected
  325. * \return ERR_FRAMING : Framing error detected
  326. * \return ERR_PROTO : Protocol error detected
  327. * \return ERR_TIMEOUT : Timeout error
  328. * \return ERR_NONE : No error
  329. *****************************************************************************
  330. */
  331. ReturnCode rfalST25xVPollerReadConfiguration( uint8_t flags, const uint8_t* uid, uint8_t pointer, uint8_t* regValue );
  332. /*!
  333. *****************************************************************************
  334. * \brief NFC-V Poller Write Configuration
  335. *
  336. * Writes static configuration registers at the Pointer address
  337. *
  338. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  339. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  340. * \param[in] uid : UID of the device to be put to be read
  341. * if not provided Select mode will be used
  342. * \param[in] pointer : Pointer address
  343. * \param[in] regValue : Register value
  344. *
  345. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  346. * \return ERR_PARAM : Invalid parameters
  347. * \return ERR_IO : Generic internal error
  348. * \return ERR_CRC : CRC error detected
  349. * \return ERR_FRAMING : Framing error detected
  350. * \return ERR_PROTO : Protocol error detected
  351. * \return ERR_TIMEOUT : Timeout error
  352. * \return ERR_NONE : No error
  353. *****************************************************************************
  354. */
  355. ReturnCode rfalST25xVPollerWriteConfiguration( uint8_t flags, const uint8_t* uid, uint8_t pointer, uint8_t regValue );
  356. /*!
  357. *****************************************************************************
  358. * \brief NFC-V Poller Read Dynamic Configuration
  359. *
  360. * Reads dynamic registers at the Pointer address
  361. *
  362. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  363. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  364. * \param[in] uid : UID of the device to be put to be read
  365. * if not provided Select mode will be used
  366. * \param[in] pointer : Pointer address
  367. * \param[out] regValue : Register value
  368. *
  369. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  370. * \return ERR_PARAM : Invalid parameters
  371. * \return ERR_IO : Generic internal error
  372. * \return ERR_CRC : CRC error detected
  373. * \return ERR_FRAMING : Framing error detected
  374. * \return ERR_PROTO : Protocol error detected
  375. * \return ERR_TIMEOUT : Timeout error
  376. * \return ERR_NONE : No error
  377. *****************************************************************************
  378. */
  379. ReturnCode rfalST25xVPollerReadDynamicConfiguration( uint8_t flags, const uint8_t* uid, uint8_t pointer, uint8_t* regValue );
  380. /*!
  381. *****************************************************************************
  382. * \brief NFC-V Poller Write Dynamic Configuration
  383. *
  384. * Writes dynamic registers at the Pointer address
  385. *
  386. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  387. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  388. * \param[in] uid : UID of the device to be put to be read
  389. * if not provided Select mode will be used
  390. * \param[in] pointer : Pointer address
  391. * \param[in] regValue : Register value
  392. *
  393. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  394. * \return ERR_PARAM : Invalid parameters
  395. * \return ERR_IO : Generic internal error
  396. * \return ERR_CRC : CRC error detected
  397. * \return ERR_FRAMING : Framing error detected
  398. * \return ERR_PROTO : Protocol error detected
  399. * \return ERR_TIMEOUT : Timeout error
  400. * \return ERR_NONE : No error
  401. *****************************************************************************
  402. */
  403. ReturnCode rfalST25xVPollerWriteDynamicConfiguration( uint8_t flags, const uint8_t* uid, uint8_t pointer, uint8_t regValue );
  404. /*!
  405. *****************************************************************************
  406. * \brief NFC-V Poller Fast Read Dynamic Configuration
  407. *
  408. * Reads dynamic registers at the Pointer address using ST Fast mode
  409. *
  410. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  411. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  412. * \param[in] uid : UID of the device to be put to be read
  413. * if not provided Select mode will be used
  414. * \param[in] pointer : Pointer address
  415. * \param[out] regValue : Register value
  416. *
  417. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  418. * \return ERR_PARAM : Invalid parameters
  419. * \return ERR_IO : Generic internal error
  420. * \return ERR_CRC : CRC error detected
  421. * \return ERR_FRAMING : Framing error detected
  422. * \return ERR_PROTO : Protocol error detected
  423. * \return ERR_TIMEOUT : Timeout error
  424. * \return ERR_NONE : No error
  425. *****************************************************************************
  426. */
  427. ReturnCode rfalST25xVPollerFastReadDynamicConfiguration( uint8_t flags, const uint8_t* uid, uint8_t pointer, uint8_t* regValue );
  428. /*!
  429. *****************************************************************************
  430. * \brief NFC-V Poller Fast Write Dynamic Configuration
  431. *
  432. * Writes dynamic registers at the Pointer address using ST Fast mode
  433. *
  434. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  435. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  436. * \param[in] uid : UID of the device to be put to be read
  437. * if not provided Select mode will be used
  438. * \param[in] pointer : Pointer address
  439. * \param[in] regValue : Register value
  440. *
  441. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  442. * \return ERR_PARAM : Invalid parameters
  443. * \return ERR_IO : Generic internal error
  444. * \return ERR_CRC : CRC error detected
  445. * \return ERR_FRAMING : Framing error detected
  446. * \return ERR_PROTO : Protocol error detected
  447. * \return ERR_TIMEOUT : Timeout error
  448. * \return ERR_NONE : No error
  449. *****************************************************************************
  450. */
  451. ReturnCode rfalST25xVPollerFastWriteDynamicConfiguration( uint8_t flags, const uint8_t* uid, uint8_t pointer, uint8_t regValue );
  452. /*!
  453. *****************************************************************************
  454. * \brief NFC-V Poller Present Password
  455. *
  456. * Sends the Present Password command
  457. *
  458. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  459. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  460. * \param[in] uid : UID of the device to be put to be read
  461. * if not provided Select mode will be used
  462. * \param[in] pwdNum : Password number
  463. * \param[in] pwd : Password
  464. * \param[in] pwdLen : Password length
  465. *
  466. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  467. * \return ERR_PARAM : Invalid parameters
  468. * \return ERR_IO : Generic internal error
  469. * \return ERR_CRC : CRC error detected
  470. * \return ERR_FRAMING : Framing error detected
  471. * \return ERR_PROTO : Protocol error detected
  472. * \return ERR_TIMEOUT : Timeout error
  473. * \return ERR_NONE : No error
  474. *****************************************************************************
  475. */
  476. ReturnCode rfalST25xVPollerPresentPassword( uint8_t flags, const uint8_t* uid, uint8_t pwdNum, const uint8_t* pwd, uint8_t pwdLen );
  477. /*!
  478. *****************************************************************************
  479. * \brief NFC-V Poller Get Random Number
  480. *
  481. * Returns a 16 bit random number
  482. *
  483. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  484. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  485. * \param[in] uid : UID of the device to be put to be read
  486. * if not provided Select mode will be used
  487. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  488. * \param[in] rxBufLen : length of rxBuf
  489. * \param[out] rcvLen : number of bytes received
  490. *
  491. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  492. * \return ERR_PARAM : Invalid parameters
  493. * \return ERR_IO : Generic internal error
  494. * \return ERR_CRC : CRC error detected
  495. * \return ERR_FRAMING : Framing error detected
  496. * \return ERR_PROTO : Protocol error detected
  497. * \return ERR_TIMEOUT : Timeout error
  498. * \return ERR_NONE : No error
  499. *****************************************************************************
  500. */
  501. ReturnCode rfalST25xVPollerGetRandomNumber( uint8_t flags, const uint8_t* uid, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  502. /*!
  503. *****************************************************************************
  504. * \brief NFC-V Poller Read Message length
  505. *
  506. * Sends a Read Message Length message to retrieve the value of MB_LEN_Dyn
  507. *
  508. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  509. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  510. * \param[in] uid : UID of the device to be put to be read
  511. * if not provided Select mode will be used
  512. * \param[out] msgLen : Message Length
  513. *
  514. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  515. * \return ERR_PARAM : Invalid parameters
  516. * \return ERR_IO : Generic internal error
  517. * \return ERR_CRC : CRC error detected
  518. * \return ERR_FRAMING : Framing error detected
  519. * \return ERR_PROTO : Protocol error detected
  520. * \return ERR_TIMEOUT : Timeout error
  521. * \return ERR_NONE : No error
  522. *****************************************************************************
  523. */
  524. ReturnCode rfalST25xVPollerReadMessageLength( uint8_t flags, const uint8_t* uid, uint8_t* msgLen );
  525. /*!
  526. *****************************************************************************
  527. * \brief NFC-V Poller Fast Read Message length
  528. *
  529. * Sends a Fast Read Message Length message to retrieve the value of MB_LEN_Dyn using ST Fast mode.
  530. *
  531. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  532. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  533. * \param[in] uid : UID of the device to be put to be read
  534. * if not provided Select mode will be used
  535. * \param[out] msgLen : Message Length
  536. *
  537. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  538. * \return ERR_PARAM : Invalid parameters
  539. * \return ERR_IO : Generic internal error
  540. * \return ERR_CRC : CRC error detected
  541. * \return ERR_FRAMING : Framing error detected
  542. * \return ERR_PROTO : Protocol error detected
  543. * \return ERR_TIMEOUT : Timeout error
  544. * \return ERR_NONE : No error
  545. *****************************************************************************
  546. */
  547. ReturnCode rfalST25xVPollerFastReadMsgLength( uint8_t flags, const uint8_t* uid, uint8_t* msgLen );
  548. /*!
  549. *****************************************************************************
  550. * \brief NFC-V Poller Read Message
  551. *
  552. * Reads up to 256 bytes in the Mailbox from the location
  553. * specified by MBpointer and sends back their value in the rxBuf response.
  554. * First MailBox location is '00'. When Number of bytes is set to 00h
  555. * and MBPointer is equals to 00h, the MB_LEN bytes of the full message
  556. * are returned. Otherwise, Read Message command returns (Number of Bytes + 1) bytes
  557. * (i.e. 01h returns 2 bytes, FFh returns 256 bytes).
  558. * An error is reported if (Pointer + Nb of bytes + 1) is greater than the message length.
  559. * RF Reading of the last byte of the mailbox message automatically clears b1
  560. * of MB_CTRL_Dyn HOST_PUT_MSG, and allows RF to put a new message.
  561. *
  562. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  563. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  564. * \param[in] uid : UID of the device to be put to be read
  565. * if not provided Select mode will be used
  566. * \param[in] mbPointer : MPpointer
  567. * \param[in] numBytes : number of bytes
  568. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  569. * \param[in] rxBufLen : length of rxBuf
  570. * \param[out] rcvLen : number of bytes received
  571. *
  572. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  573. * \return ERR_PARAM : Invalid parameters
  574. * \return ERR_IO : Generic internal error
  575. * \return ERR_CRC : CRC error detected
  576. * \return ERR_FRAMING : Framing error detected
  577. * \return ERR_PROTO : Protocol error detected
  578. * \return ERR_TIMEOUT : Timeout error
  579. * \return ERR_NONE : No error
  580. *****************************************************************************
  581. */
  582. ReturnCode rfalST25xVPollerReadMessage( uint8_t flags, const uint8_t* uid, uint8_t mbPointer, uint8_t numBytes, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  583. /*!
  584. *****************************************************************************
  585. * \brief NFC-V Poller Fast Read Message
  586. *
  587. * Reads up to 256 bytes in the Mailbox from the location
  588. * specified by MBpointer and sends back their value in the rxBuf response using ST Fast mode.
  589. * First MailBox location is '00'. When Number of bytes is set to 00h
  590. * and MBPointer is equals to 00h, the MB_LEN bytes of the full message
  591. * are returned. Otherwise, Read Message command returns (Number of Bytes + 1) bytes
  592. * (i.e. 01h returns 2 bytes, FFh returns 256 bytes).
  593. * An error is reported if (Pointer + Nb of bytes + 1) is greater than the message length.
  594. * RF Reading of the last byte of the mailbox message automatically clears b1
  595. * of MB_CTRL_Dyn HOST_PUT_MSG, and allows RF to put a new message.
  596. *
  597. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  598. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  599. * \param[in] uid : UID of the device to be put to be read
  600. * if not provided Select mode will be used
  601. * \param[in] mbPointer : MPpointer
  602. * \param[in] numBytes : number of bytes
  603. * \param[out] rxBuf : buffer to store response (also with RES_FLAGS)
  604. * \param[in] rxBufLen : length of rxBuf
  605. * \param[out] rcvLen : number of bytes received
  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 rfalST25xVPollerFastReadMessage( uint8_t flags, const uint8_t* uid, uint8_t mbPointer, uint8_t numBytes, uint8_t* rxBuf, uint16_t rxBufLen, uint16_t *rcvLen );
  618. /*!
  619. *****************************************************************************
  620. * \brief NFC-V Poller Write Message
  621. *
  622. * Sends Write message Command
  623. *
  624. * On receiving the Write Message command, the ST25DVxxx puts the data contained
  625. * in the request into the Mailbox buffer, update the MB_LEN_Dyn register, and
  626. * set bit RF_PUT_MSG in MB_CTRL_Dyn register. It then reports if the write operation was successful
  627. * in the response. The ST25DVxxx Mailbox contains up to 256 data bytes which are filled from the
  628. * first location '00'. MSGlength parameter of the command is the number of
  629. * Data bytes minus 1 (00 for 1 byte of data, FFh for 256 bytes of data).
  630. * Write Message could be executed only when Mailbox is accessible by RF.
  631. *
  632. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  633. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  634. * \param[in] uid : UID of the device to be put to be read
  635. * if not provided Select mode will be used
  636. * \param[in] msgLen : MSGLen number of Data bytes minus 1
  637. * \param[in] msgData : Message Data
  638. * \param[out] txBuf : buffer to used to build the Write Message command
  639. * \param[in] txBufLen : length of txBuf
  640. *
  641. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  642. * \return ERR_PARAM : Invalid parameters
  643. * \return ERR_IO : Generic internal error
  644. * \return ERR_CRC : CRC error detected
  645. * \return ERR_FRAMING : Framing error detected
  646. * \return ERR_PROTO : Protocol error detected
  647. * \return ERR_TIMEOUT : Timeout error
  648. * \return ERR_NONE : No error
  649. *****************************************************************************
  650. */
  651. ReturnCode rfalST25xVPollerWriteMessage( uint8_t flags, const uint8_t* uid, uint8_t msgLen, const uint8_t* msgData, uint8_t* txBuf, uint16_t txBufLen );
  652. /*!
  653. *****************************************************************************
  654. * \brief NFC-V Poller Fast Write Message
  655. *
  656. * Sends Fast Write message Command using ST Fast mode
  657. *
  658. * On receiving the Write Message command, the ST25DVxxx puts the data contained
  659. * in the request into the Mailbox buffer, update the MB_LEN_Dyn register, and
  660. * set bit RF_PUT_MSG in MB_CTRL_Dyn register. It then reports if the write operation was successful
  661. * in the response. The ST25DVxxx Mailbox contains up to 256 data bytes which are filled from the
  662. * first location '00'. MSGlength parameter of the command is the number of
  663. * Data bytes minus 1 (00 for 1 byte of data, FFh for 256 bytes of data).
  664. * Write Message could be executed only when Mailbox is accessible by RF.
  665. *
  666. * \param[in] flags : Flags to be used: Sub-carrier; Data_rate; Option
  667. * for NFC-Forum use: RFAL_NFCV_REQ_FLAG_DEFAULT
  668. * \param[in] uid : UID of the device to be put to be read
  669. * if not provided Select mode will be used
  670. * \param[in] msgLen : MSGLen number of Data bytes minus 1
  671. * \param[in] msgData : Message Data
  672. * \param[out] txBuf : buffer to used to build the Write Message command
  673. * \param[in] txBufLen : length of txBuf
  674. *
  675. * \return ERR_WRONG_STATE : RFAL not initialized or incorrect mode
  676. * \return ERR_PARAM : Invalid parameters
  677. * \return ERR_IO : Generic internal error
  678. * \return ERR_CRC : CRC error detected
  679. * \return ERR_FRAMING : Framing error detected
  680. * \return ERR_PROTO : Protocol error detected
  681. * \return ERR_TIMEOUT : Timeout error
  682. * \return ERR_NONE : No error
  683. *****************************************************************************
  684. */
  685. ReturnCode rfalST25xVPollerFastWriteMessage( uint8_t flags, const uint8_t* uid, uint8_t msgLen, const uint8_t* msgData, uint8_t* txBuf, uint16_t txBufLen );
  686. #endif /* RFAL_ST25xV_H */
  687. /**
  688. * @}
  689. *
  690. * @}
  691. *
  692. * @}
  693. */