st25r3916_com.h 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384
  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: ST25R3916 firmware
  23. * Revision:
  24. * LANGUAGE: ISO C99
  25. */
  26. /*! \file
  27. *
  28. * \author Gustavo Patricio
  29. *
  30. * \brief ST25R3916 communication declaration file
  31. *
  32. * This driver provides basic abstraction for communication with the ST25R3916
  33. *
  34. *
  35. * \addtogroup RFAL
  36. * @{
  37. *
  38. * \addtogroup RFAL-HAL
  39. * \brief RFAL Hardware Abstraction Layer
  40. * @{
  41. *
  42. * \addtogroup ST25R3916
  43. * \brief RFAL ST25R3916 Driver
  44. * @{
  45. *
  46. * \addtogroup ST25R3916_COM
  47. * \brief RFAL ST25R3916 Communications
  48. * @{
  49. *
  50. */
  51. #ifndef ST25R3916_COM_H
  52. #define ST25R3916_COM_H
  53. /*
  54. ******************************************************************************
  55. * INCLUDES
  56. ******************************************************************************
  57. */
  58. #include "platform.h"
  59. #include "st_errno.h"
  60. /*
  61. ******************************************************************************
  62. * GLOBAL DEFINES
  63. ******************************************************************************
  64. */
  65. #define ST25R3916_SPACE_B 0x40U /*!< ST25R3916 Space-B indicator */
  66. #define ST25R3916_SPACE_B_REG_LEN 16U /*!< Number of register in the space B */
  67. #define ST25R3916_FIFO_STATUS_LEN 2 /*!< Number of FIFO Status Register */
  68. #define ST25R3916_PTM_A_LEN 15U /*!< Passive target memory A config length */
  69. #define ST25R3916_PTM_B_LEN 0U /*!< Passive target memory B config length */
  70. #define ST25R3916_PTM_F_LEN 21U /*!< Passive target memory F config length */
  71. #define ST25R3916_PTM_TSN_LEN 12U /*!< Passive target memory TSN data length */
  72. /*! Full Passive target memory length */
  73. #define ST25R3916_PTM_LEN \
  74. (ST25R3916_PTM_A_LEN + ST25R3916_PTM_B_LEN + ST25R3916_PTM_F_LEN + ST25R3916_PTM_TSN_LEN)
  75. /* IO configuration registers */
  76. #define ST25R3916_REG_IO_CONF1 0x00U /*!< RW IO Configuration Register 1 */
  77. #define ST25R3916_REG_IO_CONF2 0x01U /*!< RW IO Configuration Register 2 */
  78. /* Operation control and mode definition registers */
  79. #define ST25R3916_REG_OP_CONTROL 0x02U /*!< RW Operation Control Register */
  80. #define ST25R3916_REG_MODE 0x03U /*!< RW Mode Definition Register */
  81. #define ST25R3916_REG_BIT_RATE 0x04U /*!< RW Bit Rate Definition Register */
  82. /* Protocol Configuration registers */
  83. #define ST25R3916_REG_ISO14443A_NFC \
  84. 0x05U /*!< RW ISO14443A and NFC 106 kBit/s Settings Register */
  85. #define ST25R3916_REG_EMD_SUP_CONF \
  86. (ST25R3916_SPACE_B | 0x05U) /*!< RW EMD Suppression Configuration Register */
  87. #define ST25R3916_REG_ISO14443B_1 \
  88. 0x06U /*!< RW ISO14443B Settings Register 1 */
  89. #define ST25R3916_REG_SUBC_START_TIME \
  90. (ST25R3916_SPACE_B | 0x06U) /*!< RW Subcarrier Start Time Register */
  91. #define ST25R3916_REG_ISO14443B_2 \
  92. 0x07U /*!< RW ISO14443B Settings Register 2 */
  93. #define ST25R3916_REG_PASSIVE_TARGET \
  94. 0x08U /*!< RW Passive Target Definition Register */
  95. #define ST25R3916_REG_STREAM_MODE \
  96. 0x09U /*!< RW Stream Mode Definition Register */
  97. #define ST25R3916_REG_AUX 0x0AU /*!< RW Auxiliary Definition Register */
  98. /* Receiver Configuration registers */
  99. #define ST25R3916_REG_RX_CONF1 0x0BU /*!< RW Receiver Configuration Register 1 */
  100. #define ST25R3916_REG_RX_CONF2 0x0CU /*!< RW Receiver Configuration Register 2 */
  101. #define ST25R3916_REG_RX_CONF3 0x0DU /*!< RW Receiver Configuration Register 3 */
  102. #define ST25R3916_REG_RX_CONF4 0x0EU /*!< RW Receiver Configuration Register 4 */
  103. #define ST25R3916_REG_P2P_RX_CONF \
  104. (ST25R3916_SPACE_B | 0x0BU) /*!< RW P2P Receiver Configuration Register 1 */
  105. #define ST25R3916_REG_CORR_CONF1 \
  106. (ST25R3916_SPACE_B | 0x0CU) /*!< RW Correlator configuration register 1 */
  107. #define ST25R3916_REG_CORR_CONF2 \
  108. (ST25R3916_SPACE_B | 0x0DU) /*!< RW Correlator configuration register 2 */
  109. /* Timer definition registers */
  110. #define ST25R3916_REG_MASK_RX_TIMER \
  111. 0x0FU /*!< RW Mask Receive Timer Register */
  112. #define ST25R3916_REG_NO_RESPONSE_TIMER1 \
  113. 0x10U /*!< RW No-response Timer Register 1 */
  114. #define ST25R3916_REG_NO_RESPONSE_TIMER2 \
  115. 0x11U /*!< RW No-response Timer Register 2 */
  116. #define ST25R3916_REG_TIMER_EMV_CONTROL \
  117. 0x12U /*!< RW Timer and EMV Control */
  118. #define ST25R3916_REG_GPT1 0x13U /*!< RW General Purpose Timer Register 1 */
  119. #define ST25R3916_REG_GPT2 0x14U /*!< RW General Purpose Timer Register 2 */
  120. #define ST25R3916_REG_PPON2 0x15U /*!< RW PPON2 Field waiting Timer Register */
  121. #define ST25R3916_REG_SQUELCH_TIMER \
  122. (ST25R3916_SPACE_B | 0x0FU) /*!< RW Squelch timeout Register */
  123. #define ST25R3916_REG_FIELD_ON_GT \
  124. (ST25R3916_SPACE_B | 0x15U) /*!< RW NFC Field on guard time */
  125. /* Interrupt and associated reporting registers */
  126. #define ST25R3916_REG_IRQ_MASK_MAIN \
  127. 0x16U /*!< RW Mask Main Interrupt Register */
  128. #define ST25R3916_REG_IRQ_MASK_TIMER_NFC \
  129. 0x17U /*!< RW Mask Timer and NFC Interrupt Register */
  130. #define ST25R3916_REG_IRQ_MASK_ERROR_WUP \
  131. 0x18U /*!< RW Mask Error and Wake-up Interrupt Register */
  132. #define ST25R3916_REG_IRQ_MASK_TARGET \
  133. 0x19U /*!< RW Mask 3916 Target Interrupt Register */
  134. #define ST25R3916_REG_IRQ_MAIN 0x1AU /*!< R Main Interrupt Register */
  135. #define ST25R3916_REG_IRQ_TIMER_NFC \
  136. 0x1BU /*!< R Timer and NFC Interrupt Register */
  137. #define ST25R3916_REG_IRQ_ERROR_WUP \
  138. 0x1CU /*!< R Error and Wake-up Interrupt Register */
  139. #define ST25R3916_REG_IRQ_TARGET 0x1DU /*!< R ST25R3916 Target Interrupt Register */
  140. #define ST25R3916_REG_FIFO_STATUS1 \
  141. 0x1EU /*!< R FIFO Status Register 1 */
  142. #define ST25R3916_REG_FIFO_STATUS2 \
  143. 0x1FU /*!< R FIFO Status Register 2 */
  144. #define ST25R3916_REG_COLLISION_STATUS \
  145. 0x20U /*!< R Collision Display Register */
  146. #define ST25R3916_REG_PASSIVE_TARGET_STATUS \
  147. 0x21U /*!< R Passive target state status */
  148. /* Definition of number of transmitted bytes */
  149. #define ST25R3916_REG_NUM_TX_BYTES1 \
  150. 0x22U /*!< RW Number of Transmitted Bytes Register 1 */
  151. #define ST25R3916_REG_NUM_TX_BYTES2 \
  152. 0x23U /*!< RW Number of Transmitted Bytes Register 2 */
  153. /* NFCIP Bit Rate Display Register */
  154. #define ST25R3916_REG_NFCIP1_BIT_RATE \
  155. 0x24U /*!< R NFCIP Bit Rate Detection Display Register */
  156. /* A/D Converter Output Register */
  157. #define ST25R3916_REG_AD_RESULT 0x25U /*!< R A/D Converter Output Register */
  158. /* Antenna tuning registers */
  159. #define ST25R3916_REG_ANT_TUNE_A 0x26U /*!< RW Antenna Tuning Control (AAT-A) Register 1 */
  160. #define ST25R3916_REG_ANT_TUNE_B 0x27U /*!< RW Antenna Tuning Control (AAT-B) Register 2 */
  161. /* Antenna Driver and Modulation registers */
  162. #define ST25R3916_REG_TX_DRIVER 0x28U /*!< RW TX driver register */
  163. #define ST25R3916_REG_PT_MOD 0x29U /*!< RW PT modulation Register */
  164. #define ST25R3916_REG_AUX_MOD \
  165. (ST25R3916_SPACE_B | 0x28U) /*!< RW Aux Modulation setting Register */
  166. #define ST25R3916_REG_TX_DRIVER_TIMING \
  167. (ST25R3916_SPACE_B | 0x29U) /*!< RW TX driver timing Register */
  168. #define ST25R3916_REG_RES_AM_MOD \
  169. (ST25R3916_SPACE_B | 0x2AU) /*!< RW Resistive AM modulation register */
  170. #define ST25R3916_REG_TX_DRIVER_STATUS \
  171. (ST25R3916_SPACE_B | 0x2BU) /*!< R TX driver timing readout Register */
  172. /* External Field Detector Threshold Registers */
  173. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV \
  174. 0x2AU /*!< RW External Field Detector Activation Threshold Reg */
  175. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV \
  176. 0x2BU /*!< RW External Field Detector Deactivation Threshold Reg*/
  177. /* Regulator registers */
  178. #define ST25R3916_REG_REGULATOR_CONTROL \
  179. 0x2CU /*!< RW Regulated Voltage Control Register */
  180. #define ST25R3916_REG_REGULATOR_RESULT \
  181. (ST25R3916_SPACE_B | 0x2CU) /*!< R Regulator Display Register */
  182. /* Receiver State Display Register */
  183. #define ST25R3916_REG_RSSI_RESULT \
  184. 0x2DU /*!< R RSSI Display Register */
  185. #define ST25R3916_REG_GAIN_RED_STATE \
  186. 0x2EU /*!< R Gain Reduction State Register */
  187. #define ST25R3916_REG_CAP_SENSOR_CONTROL \
  188. 0x2FU /*!< RW Capacitive Sensor Control Register */
  189. #define ST25R3916_REG_CAP_SENSOR_RESULT \
  190. 0x30U /*!< R Capacitive Sensor Display Register */
  191. #define ST25R3916_REG_AUX_DISPLAY \
  192. 0x31U /*!< R Auxiliary Display Register */
  193. /* Over/Undershoot Protection Configuration Registers */
  194. #define ST25R3916_REG_OVERSHOOT_CONF1 \
  195. (ST25R3916_SPACE_B | 0x30U) /*!< RW Overshoot Protection Configuration Register 1 */
  196. #define ST25R3916_REG_OVERSHOOT_CONF2 \
  197. (ST25R3916_SPACE_B | 0x31U) /*!< RW Overshoot Protection Configuration Register 2 */
  198. #define ST25R3916_REG_UNDERSHOOT_CONF1 \
  199. (ST25R3916_SPACE_B | 0x32U) /*!< RW Undershoot Protection Configuration Register 1 */
  200. #define ST25R3916_REG_UNDERSHOOT_CONF2 \
  201. (ST25R3916_SPACE_B | 0x33U) /*!< RW Undershoot Protection Configuration Register 2 */
  202. /* Detection of card presence */
  203. #define ST25R3916_REG_WUP_TIMER_CONTROL \
  204. 0x32U /*!< RW Wake-up Timer Control Register */
  205. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF \
  206. 0x33U /*!< RW Amplitude Measurement Configuration Register */
  207. #define ST25R3916_REG_AMPLITUDE_MEASURE_REF \
  208. 0x34U /*!< RW Amplitude Measurement Reference Register */
  209. #define ST25R3916_REG_AMPLITUDE_MEASURE_AA_RESULT \
  210. 0x35U /*!< R Amplitude Measurement Auto Averaging Display Reg */
  211. #define ST25R3916_REG_AMPLITUDE_MEASURE_RESULT \
  212. 0x36U /*!< R Amplitude Measurement Display Register */
  213. #define ST25R3916_REG_PHASE_MEASURE_CONF \
  214. 0x37U /*!< RW Phase Measurement Configuration Register */
  215. #define ST25R3916_REG_PHASE_MEASURE_REF \
  216. 0x38U /*!< RW Phase Measurement Reference Register */
  217. #define ST25R3916_REG_PHASE_MEASURE_AA_RESULT \
  218. 0x39U /*!< R Phase Measurement Auto Averaging Display Register */
  219. #define ST25R3916_REG_PHASE_MEASURE_RESULT \
  220. 0x3AU /*!< R Phase Measurement Display Register */
  221. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF \
  222. 0x3BU /*!< RW Capacitance Measurement Configuration Register */
  223. #define ST25R3916_REG_CAPACITANCE_MEASURE_REF \
  224. 0x3CU /*!< RW Capacitance Measurement Reference Register */
  225. #define ST25R3916_REG_CAPACITANCE_MEASURE_AA_RESULT \
  226. 0x3DU /*!< R Capacitance Measurement Auto Averaging Display Reg*/
  227. #define ST25R3916_REG_CAPACITANCE_MEASURE_RESULT \
  228. 0x3EU /*!< R Capacitance Measurement Display Register */
  229. /* IC identity */
  230. #define ST25R3916_REG_IC_IDENTITY \
  231. 0x3FU /*!< R Chip Id: 0 for old silicon, v2 silicon: 0x09 */
  232. /*! Register bit definitions \cond DOXYGEN_SUPRESS */
  233. #define ST25R3916_REG_IO_CONF1_single (1U << 7)
  234. #define ST25R3916_REG_IO_CONF1_rfo2 (1U << 6)
  235. #define ST25R3916_REG_IO_CONF1_i2c_thd1 (1U << 5)
  236. #define ST25R3916_REG_IO_CONF1_i2c_thd0 (1U << 4)
  237. #define ST25R3916_REG_IO_CONF1_i2c_thd_mask (3U << 4)
  238. #define ST25R3916_REG_IO_CONF1_i2c_thd_shift (4U)
  239. #define ST25R3916_REG_IO_CONF1_rfu (1U << 3)
  240. #define ST25R3916_REG_IO_CONF1_out_cl1 (1U << 2)
  241. #define ST25R3916_REG_IO_CONF1_out_cl0 (1U << 1)
  242. #define ST25R3916_REG_IO_CONF1_out_cl_disabled (3U << 1)
  243. #define ST25R3916_REG_IO_CONF1_out_cl_13_56MHZ (2U << 1)
  244. #define ST25R3916_REG_IO_CONF1_out_cl_4_78MHZ (1U << 1)
  245. #define ST25R3916_REG_IO_CONF1_out_cl_3_39MHZ (0U << 1)
  246. #define ST25R3916_REG_IO_CONF1_out_cl_mask (3U << 1)
  247. #define ST25R3916_REG_IO_CONF1_out_cl_shift (1U)
  248. #define ST25R3916_REG_IO_CONF1_lf_clk_off (1U << 0)
  249. #define ST25R3916_REG_IO_CONF1_lf_clk_off_on (1U << 0)
  250. #define ST25R3916_REG_IO_CONF1_lf_clk_off_off (0U << 0)
  251. #define ST25R3916_REG_IO_CONF2_sup3V (1U << 7)
  252. #define ST25R3916_REG_IO_CONF2_sup3V_3V (1U << 7)
  253. #define ST25R3916_REG_IO_CONF2_sup3V_5V (0U << 7)
  254. #define ST25R3916_REG_IO_CONF2_vspd_off (1U << 6)
  255. #define ST25R3916_REG_IO_CONF2_aat_en (1U << 5)
  256. #define ST25R3916_REG_IO_CONF2_miso_pd2 (1U << 4)
  257. #define ST25R3916_REG_IO_CONF2_miso_pd1 (1U << 3)
  258. #define ST25R3916_REG_IO_CONF2_io_drv_lvl (1U << 2)
  259. #define ST25R3916_REG_IO_CONF2_slow_up (1U << 0)
  260. #define ST25R3916_REG_OP_CONTROL_en (1U << 7)
  261. #define ST25R3916_REG_OP_CONTROL_rx_en (1U << 6)
  262. #define ST25R3916_REG_OP_CONTROL_rx_chn (1U << 5)
  263. #define ST25R3916_REG_OP_CONTROL_rx_man (1U << 4)
  264. #define ST25R3916_REG_OP_CONTROL_tx_en (1U << 3)
  265. #define ST25R3916_REG_OP_CONTROL_wu (1U << 2)
  266. #define ST25R3916_REG_OP_CONTROL_en_fd_c1 (1U << 1)
  267. #define ST25R3916_REG_OP_CONTROL_en_fd_c0 (1U << 0)
  268. #define ST25R3916_REG_OP_CONTROL_en_fd_efd_off (0U << 0)
  269. #define ST25R3916_REG_OP_CONTROL_en_fd_manual_efd_ca (1U << 0)
  270. #define ST25R3916_REG_OP_CONTROL_en_fd_manual_efd_pdt (2U << 0)
  271. #define ST25R3916_REG_OP_CONTROL_en_fd_auto_efd (3U << 0)
  272. #define ST25R3916_REG_OP_CONTROL_en_fd_shift (0U)
  273. #define ST25R3916_REG_OP_CONTROL_en_fd_mask (3U << 0)
  274. #define ST25R3916_REG_MODE_targ (1U << 7)
  275. #define ST25R3916_REG_MODE_targ_targ (1U << 7)
  276. #define ST25R3916_REG_MODE_targ_init (0U << 7)
  277. #define ST25R3916_REG_MODE_om3 (1U << 6)
  278. #define ST25R3916_REG_MODE_om2 (1U << 5)
  279. #define ST25R3916_REG_MODE_om1 (1U << 4)
  280. #define ST25R3916_REG_MODE_om0 (1U << 3)
  281. #define ST25R3916_REG_MODE_om_bpsk_stream (0xfU << 3)
  282. #define ST25R3916_REG_MODE_om_subcarrier_stream (0xeU << 3)
  283. #define ST25R3916_REG_MODE_om_topaz (0x4U << 3)
  284. #define ST25R3916_REG_MODE_om_felica (0x3U << 3)
  285. #define ST25R3916_REG_MODE_om_iso14443b (0x2U << 3)
  286. #define ST25R3916_REG_MODE_om_iso14443a (0x1U << 3)
  287. #define ST25R3916_REG_MODE_om_targ_nfca (0x1U << 3)
  288. #define ST25R3916_REG_MODE_om_targ_nfcb (0x2U << 3)
  289. #define ST25R3916_REG_MODE_om_targ_nfcf (0x4U << 3)
  290. #define ST25R3916_REG_MODE_om_targ_nfcip (0x7U << 3)
  291. #define ST25R3916_REG_MODE_om_nfc (0x0U << 3)
  292. #define ST25R3916_REG_MODE_om_mask (0xfU << 3)
  293. #define ST25R3916_REG_MODE_om_shift (3U)
  294. #define ST25R3916_REG_MODE_tr_am (1U << 2)
  295. #define ST25R3916_REG_MODE_tr_am_ook (0U << 2)
  296. #define ST25R3916_REG_MODE_tr_am_am (1U << 2)
  297. #define ST25R3916_REG_MODE_nfc_ar1 (1U << 1)
  298. #define ST25R3916_REG_MODE_nfc_ar0 (1U << 0)
  299. #define ST25R3916_REG_MODE_nfc_ar_off (0U << 0)
  300. #define ST25R3916_REG_MODE_nfc_ar_auto_rx (1U << 0)
  301. #define ST25R3916_REG_MODE_nfc_ar_eof (2U << 0)
  302. #define ST25R3916_REG_MODE_nfc_ar_rfu (3U << 0)
  303. #define ST25R3916_REG_MODE_nfc_ar_mask (3U << 0)
  304. #define ST25R3916_REG_MODE_nfc_ar_shift (0U)
  305. #define ST25R3916_REG_BIT_RATE_txrate_106 (0x0U << 4)
  306. #define ST25R3916_REG_BIT_RATE_txrate_212 (0x1U << 4)
  307. #define ST25R3916_REG_BIT_RATE_txrate_424 (0x2U << 4)
  308. #define ST25R3916_REG_BIT_RATE_txrate_848 (0x3U << 4)
  309. #define ST25R3916_REG_BIT_RATE_txrate_mask (0x3U << 4)
  310. #define ST25R3916_REG_BIT_RATE_txrate_shift (4U)
  311. #define ST25R3916_REG_BIT_RATE_rxrate_106 (0x0U << 0)
  312. #define ST25R3916_REG_BIT_RATE_rxrate_212 (0x1U << 0)
  313. #define ST25R3916_REG_BIT_RATE_rxrate_424 (0x2U << 0)
  314. #define ST25R3916_REG_BIT_RATE_rxrate_848 (0x3U << 0)
  315. #define ST25R3916_REG_BIT_RATE_rxrate_mask (0x3U << 0)
  316. #define ST25R3916_REG_BIT_RATE_rxrate_shift (0U)
  317. #define ST25R3916_REG_ISO14443A_NFC_no_tx_par (1U << 7)
  318. #define ST25R3916_REG_ISO14443A_NFC_no_tx_par_off (0U << 7)
  319. #define ST25R3916_REG_ISO14443A_NFC_no_rx_par (1U << 6)
  320. #define ST25R3916_REG_ISO14443A_NFC_no_rx_par_off (0U << 6)
  321. #define ST25R3916_REG_ISO14443A_NFC_nfc_f0 (1U << 5)
  322. #define ST25R3916_REG_ISO14443A_NFC_nfc_f0_off (0U << 5)
  323. #define ST25R3916_REG_ISO14443A_NFC_p_len3 (1U << 4)
  324. #define ST25R3916_REG_ISO14443A_NFC_p_len2 (1U << 3)
  325. #define ST25R3916_REG_ISO14443A_NFC_p_len1 (1U << 2)
  326. #define ST25R3916_REG_ISO14443A_NFC_p_len0 (1U << 1)
  327. #define ST25R3916_REG_ISO14443A_NFC_p_len_mask (0xfU << 1)
  328. #define ST25R3916_REG_ISO14443A_NFC_p_len_shift (1U)
  329. #define ST25R3916_REG_ISO14443A_NFC_antcl (1U << 0)
  330. #define ST25R3916_REG_EMD_SUP_CONF_emd_emv (1U << 7)
  331. #define ST25R3916_REG_EMD_SUP_CONF_emd_emv_on (1U << 7)
  332. #define ST25R3916_REG_EMD_SUP_CONF_emd_emv_off (0U << 7)
  333. #define ST25R3916_REG_EMD_SUP_CONF_rx_start_emv (1U << 6)
  334. #define ST25R3916_REG_EMD_SUP_CONF_rx_start_emv_on (1U << 6)
  335. #define ST25R3916_REG_EMD_SUP_CONF_rx_start_emv_off (0U << 6)
  336. #define ST25R3916_REG_EMD_SUP_CONF_rfu1 (1U << 5)
  337. #define ST25R3916_REG_EMD_SUP_CONF_rfu0 (1U << 4)
  338. #define ST25R3916_REG_EMD_SUP_CONF_emd_thld3 (1U << 3)
  339. #define ST25R3916_REG_EMD_SUP_CONF_emd_thld2 (1U << 2)
  340. #define ST25R3916_REG_EMD_SUP_CONF_emd_thld1 (1U << 1)
  341. #define ST25R3916_REG_EMD_SUP_CONF_emd_thld0 (1U << 0)
  342. #define ST25R3916_REG_EMD_SUP_CONF_emd_thld_mask (0xfU << 0)
  343. #define ST25R3916_REG_EMD_SUP_CONF_emd_thld_shift (0U)
  344. #define ST25R3916_REG_SUBC_START_TIME_rfu2 (1U << 7)
  345. #define ST25R3916_REG_SUBC_START_TIME_rfu1 (1U << 6)
  346. #define ST25R3916_REG_SUBC_START_TIME_rfu0 (1U << 5)
  347. #define ST25R3916_REG_SUBC_START_TIME_sst4 (1U << 4)
  348. #define ST25R3916_REG_SUBC_START_TIME_sst3 (1U << 3)
  349. #define ST25R3916_REG_SUBC_START_TIME_sst2 (1U << 2)
  350. #define ST25R3916_REG_SUBC_START_TIME_sst1 (1U << 1)
  351. #define ST25R3916_REG_SUBC_START_TIME_sst0 (1U << 0)
  352. #define ST25R3916_REG_SUBC_START_TIME_sst_mask (0x1fU << 0)
  353. #define ST25R3916_REG_SUBC_START_TIME_sst_shift (0U)
  354. #define ST25R3916_REG_ISO14443B_1_egt2 (1U << 7)
  355. #define ST25R3916_REG_ISO14443B_1_egt1 (1U << 6)
  356. #define ST25R3916_REG_ISO14443B_1_egt0 (1U << 5)
  357. #define ST25R3916_REG_ISO14443B_1_egt_shift (5U)
  358. #define ST25R3916_REG_ISO14443B_1_egt_mask (7U << 5)
  359. #define ST25R3916_REG_ISO14443B_1_sof_1 (1U << 3)
  360. #define ST25R3916_REG_ISO14443B_1_sof_1_3etu (1U << 3)
  361. #define ST25R3916_REG_ISO14443B_1_sof_1_2etu (0U << 3)
  362. #define ST25R3916_REG_ISO14443B_1_sof_0 (1U << 4)
  363. #define ST25R3916_REG_ISO14443B_1_sof_0_11etu (1U << 4)
  364. #define ST25R3916_REG_ISO14443B_1_sof_0_10etu (0U << 4)
  365. #define ST25R3916_REG_ISO14443B_1_sof_mask (3U << 3)
  366. #define ST25R3916_REG_ISO14443B_1_eof (1U << 2)
  367. #define ST25R3916_REG_ISO14443B_1_eof_11etu (1U << 2)
  368. #define ST25R3916_REG_ISO14443B_1_eof_10etu (0U << 2)
  369. #define ST25R3916_REG_ISO14443B_1_half (1U << 1)
  370. #define ST25R3916_REG_ISO14443B_1_rx_st_om (1U << 0)
  371. #define ST25R3916_REG_ISO14443B_2_tr1_1 (1U << 7)
  372. #define ST25R3916_REG_ISO14443B_2_tr1_0 (1U << 6)
  373. #define ST25R3916_REG_ISO14443B_2_tr1_64fs32fs (1U << 6)
  374. #define ST25R3916_REG_ISO14443B_2_tr1_80fs80fs (0U << 6)
  375. #define ST25R3916_REG_ISO14443B_2_tr1_mask (3U << 6)
  376. #define ST25R3916_REG_ISO14443B_2_tr1_shift (6U)
  377. #define ST25R3916_REG_ISO14443B_2_no_sof (1U << 5)
  378. #define ST25R3916_REG_ISO14443B_2_no_eof (1U << 4)
  379. #define ST25R3916_REG_ISO14443B_rfu1 (1U << 3)
  380. #define ST25R3916_REG_ISO14443B_rfu0 (1U << 2)
  381. #define ST25R3916_REG_ISO14443B_2_f_p1 (1U << 1)
  382. #define ST25R3916_REG_ISO14443B_2_f_p0 (1U << 0)
  383. #define ST25R3916_REG_ISO14443B_2_f_p_96 (3U << 0)
  384. #define ST25R3916_REG_ISO14443B_2_f_p_80 (2U << 0)
  385. #define ST25R3916_REG_ISO14443B_2_f_p_64 (1U << 0)
  386. #define ST25R3916_REG_ISO14443B_2_f_p_48 (0U << 0)
  387. #define ST25R3916_REG_ISO14443B_2_f_p_mask (3U << 0)
  388. #define ST25R3916_REG_ISO14443B_2_f_p_shift (0U)
  389. #define ST25R3916_REG_PASSIVE_TARGET_fdel_3 (1U << 7)
  390. #define ST25R3916_REG_PASSIVE_TARGET_fdel_2 (1U << 6)
  391. #define ST25R3916_REG_PASSIVE_TARGET_fdel_1 (1U << 5)
  392. #define ST25R3916_REG_PASSIVE_TARGET_fdel_0 (1U << 4)
  393. #define ST25R3916_REG_PASSIVE_TARGET_fdel_mask (0xfU << 4)
  394. #define ST25R3916_REG_PASSIVE_TARGET_fdel_shift (4U)
  395. #define ST25R3916_REG_PASSIVE_TARGET_d_ac_ap2p (1U << 3)
  396. #define ST25R3916_REG_PASSIVE_TARGET_d_212_424_1r (1U << 2)
  397. #define ST25R3916_REG_PASSIVE_TARGET_rfu (1U << 1)
  398. #define ST25R3916_REG_PASSIVE_TARGET_d_106_ac_a (1U << 0)
  399. #define ST25R3916_REG_STREAM_MODE_rfu (1U << 7)
  400. #define ST25R3916_REG_STREAM_MODE_scf1 (1U << 6)
  401. #define ST25R3916_REG_STREAM_MODE_scf0 (1U << 5)
  402. #define ST25R3916_REG_STREAM_MODE_scf_sc212 (0U << 5)
  403. #define ST25R3916_REG_STREAM_MODE_scf_sc424 (1U << 5)
  404. #define ST25R3916_REG_STREAM_MODE_scf_sc848 (2U << 5)
  405. #define ST25R3916_REG_STREAM_MODE_scf_sc1695 (3U << 5)
  406. #define ST25R3916_REG_STREAM_MODE_scf_bpsk848 (0U << 5)
  407. #define ST25R3916_REG_STREAM_MODE_scf_bpsk1695 (1U << 5)
  408. #define ST25R3916_REG_STREAM_MODE_scf_bpsk3390 (2U << 5)
  409. #define ST25R3916_REG_STREAM_MODE_scf_bpsk106 (3U << 5)
  410. #define ST25R3916_REG_STREAM_MODE_scf_mask (3U << 5)
  411. #define ST25R3916_REG_STREAM_MODE_scf_shift (5U)
  412. #define ST25R3916_REG_STREAM_MODE_scp1 (1U << 4)
  413. #define ST25R3916_REG_STREAM_MODE_scp0 (1U << 3)
  414. #define ST25R3916_REG_STREAM_MODE_scp_1pulse (0U << 3)
  415. #define ST25R3916_REG_STREAM_MODE_scp_2pulses (1U << 3)
  416. #define ST25R3916_REG_STREAM_MODE_scp_4pulses (2U << 3)
  417. #define ST25R3916_REG_STREAM_MODE_scp_8pulses (3U << 3)
  418. #define ST25R3916_REG_STREAM_MODE_scp_mask (3U << 3)
  419. #define ST25R3916_REG_STREAM_MODE_scp_shift (3U)
  420. #define ST25R3916_REG_STREAM_MODE_stx2 (1U << 2)
  421. #define ST25R3916_REG_STREAM_MODE_stx1 (1U << 1)
  422. #define ST25R3916_REG_STREAM_MODE_stx0 (1U << 0)
  423. #define ST25R3916_REG_STREAM_MODE_stx_106 (0U << 0)
  424. #define ST25R3916_REG_STREAM_MODE_stx_212 (1U << 0)
  425. #define ST25R3916_REG_STREAM_MODE_stx_424 (2U << 0)
  426. #define ST25R3916_REG_STREAM_MODE_stx_848 (3U << 0)
  427. #define ST25R3916_REG_STREAM_MODE_stx_mask (7U << 0)
  428. #define ST25R3916_REG_STREAM_MODE_stx_shift (0U)
  429. #define ST25R3916_REG_AUX_no_crc_rx (1U << 7)
  430. #define ST25R3916_REG_AUX_rfu (1U << 6)
  431. #define ST25R3916_REG_AUX_nfc_id1 (1U << 5)
  432. #define ST25R3916_REG_AUX_nfc_id0 (1U << 4)
  433. #define ST25R3916_REG_AUX_nfc_id_7bytes (1U << 4)
  434. #define ST25R3916_REG_AUX_nfc_id_4bytes (0U << 4)
  435. #define ST25R3916_REG_AUX_nfc_id_mask (3U << 4)
  436. #define ST25R3916_REG_AUX_nfc_id_shift (4U)
  437. #define ST25R3916_REG_AUX_mfaz_cl90 (1U << 3)
  438. #define ST25R3916_REG_AUX_dis_corr (1U << 2)
  439. #define ST25R3916_REG_AUX_dis_corr_coherent (1U << 2)
  440. #define ST25R3916_REG_AUX_dis_corr_correlator (0U << 2)
  441. #define ST25R3916_REG_AUX_nfc_n1 (1U << 1)
  442. #define ST25R3916_REG_AUX_nfc_n0 (1U << 0)
  443. #define ST25R3916_REG_AUX_nfc_n_mask (3U << 0)
  444. #define ST25R3916_REG_AUX_nfc_n_shift (0U)
  445. #define ST25R3916_REG_RX_CONF1_ch_sel (1U << 7)
  446. #define ST25R3916_REG_RX_CONF1_ch_sel_PM (1U << 7)
  447. #define ST25R3916_REG_RX_CONF1_ch_sel_AM (0U << 7)
  448. #define ST25R3916_REG_RX_CONF1_lp2 (1U << 6)
  449. #define ST25R3916_REG_RX_CONF1_lp1 (1U << 5)
  450. #define ST25R3916_REG_RX_CONF1_lp0 (1U << 4)
  451. #define ST25R3916_REG_RX_CONF1_lp_1200khz (0U << 4)
  452. #define ST25R3916_REG_RX_CONF1_lp_600khz (1U << 4)
  453. #define ST25R3916_REG_RX_CONF1_lp_300khz (2U << 4)
  454. #define ST25R3916_REG_RX_CONF1_lp_2000khz (4U << 4)
  455. #define ST25R3916_REG_RX_CONF1_lp_7000khz (5U << 4)
  456. #define ST25R3916_REG_RX_CONF1_lp_mask (7U << 4)
  457. #define ST25R3916_REG_RX_CONF1_lp_shift (4U)
  458. #define ST25R3916_REG_RX_CONF1_z600k (1U << 3)
  459. #define ST25R3916_REG_RX_CONF1_h200 (1U << 2)
  460. #define ST25R3916_REG_RX_CONF1_h80 (1U << 1)
  461. #define ST25R3916_REG_RX_CONF1_z12k (1U << 0)
  462. #define ST25R3916_REG_RX_CONF1_hz_60_400khz (0U << 0)
  463. #define ST25R3916_REG_RX_CONF1_hz_60_200khz (4U << 0)
  464. #define ST25R3916_REG_RX_CONF1_hz_40_80khz (2U << 0)
  465. #define ST25R3916_REG_RX_CONF1_hz_12_200khz (1U << 0)
  466. #define ST25R3916_REG_RX_CONF1_hz_12_80khz (3U << 0)
  467. #define ST25R3916_REG_RX_CONF1_hz_12_200khz_alt (5U << 0)
  468. #define ST25R3916_REG_RX_CONF1_hz_600_400khz (8U << 0)
  469. #define ST25R3916_REG_RX_CONF1_hz_600_200khz (12U << 0)
  470. #define ST25R3916_REG_RX_CONF1_hz_mask (0xfU << 0)
  471. #define ST25R3916_REG_RX_CONF1_hz_shift (0U)
  472. #define ST25R3916_REG_RX_CONF2_demod_mode (1U << 7)
  473. #define ST25R3916_REG_RX_CONF2_amd_sel (1U << 6)
  474. #define ST25R3916_REG_RX_CONF2_amd_sel_mixer (1U << 6)
  475. #define ST25R3916_REG_RX_CONF2_amd_sel_peak (0U << 6)
  476. #define ST25R3916_REG_RX_CONF2_sqm_dyn (1U << 5)
  477. #define ST25R3916_REG_RX_CONF2_pulz_61 (1U << 4)
  478. #define ST25R3916_REG_RX_CONF2_agc_en (1U << 3)
  479. #define ST25R3916_REG_RX_CONF2_agc_m (1U << 2)
  480. #define ST25R3916_REG_RX_CONF2_agc_alg (1U << 1)
  481. #define ST25R3916_REG_RX_CONF2_agc6_3 (1U << 0)
  482. #define ST25R3916_REG_RX_CONF3_rg1_am2 (1U << 7)
  483. #define ST25R3916_REG_RX_CONF3_rg1_am1 (1U << 6)
  484. #define ST25R3916_REG_RX_CONF3_rg1_am0 (1U << 5)
  485. #define ST25R3916_REG_RX_CONF3_rg1_am_mask (0x7U << 5)
  486. #define ST25R3916_REG_RX_CONF3_rg1_am_shift (5U)
  487. #define ST25R3916_REG_RX_CONF3_rg1_pm2 (1U << 4)
  488. #define ST25R3916_REG_RX_CONF3_rg1_pm1 (1U << 3)
  489. #define ST25R3916_REG_RX_CONF3_rg1_pm0 (1U << 2)
  490. #define ST25R3916_REG_RX_CONF3_rg1_pm_mask (0x7U << 2)
  491. #define ST25R3916_REG_RX_CONF3_rg1_pm_shift (2U)
  492. #define ST25R3916_REG_RX_CONF3_lf_en (1U << 1)
  493. #define ST25R3916_REG_RX_CONF3_lf_op (1U << 0)
  494. #define ST25R3916_REG_RX_CONF4_rg2_am3 (1U << 7)
  495. #define ST25R3916_REG_RX_CONF4_rg2_am2 (1U << 6)
  496. #define ST25R3916_REG_RX_CONF4_rg2_am1 (1U << 5)
  497. #define ST25R3916_REG_RX_CONF4_rg2_am0 (1U << 4)
  498. #define ST25R3916_REG_RX_CONF4_rg2_am_mask (0xfU << 4)
  499. #define ST25R3916_REG_RX_CONF4_rg2_am_shift (4U)
  500. #define ST25R3916_REG_RX_CONF4_rg2_pm3 (1U << 3)
  501. #define ST25R3916_REG_RX_CONF4_rg2_pm2 (1U << 2)
  502. #define ST25R3916_REG_RX_CONF4_rg2_pm1 (1U << 1)
  503. #define ST25R3916_REG_RX_CONF4_rg2_pm0 (1U << 0)
  504. #define ST25R3916_REG_RX_CONF4_rg2_pm_mask (0xfU << 0)
  505. #define ST25R3916_REG_RX_CONF4_rg2_pm_shift (0U)
  506. #define ST25R3916_REG_P2P_RX_CONF_ook_fd (1U << 7)
  507. #define ST25R3916_REG_P2P_RX_CONF_ook_rc1 (1U << 6)
  508. #define ST25R3916_REG_P2P_RX_CONF_ook_rc0 (1U << 5)
  509. #define ST25R3916_REG_P2P_RX_CONF_ook_thd1 (1U << 4)
  510. #define ST25R3916_REG_P2P_RX_CONF_ook_thd0 (1U << 3)
  511. #define ST25R3916_REG_P2P_RX_CONF_ask_rc1 (1U << 2)
  512. #define ST25R3916_REG_P2P_RX_CONF_ask_rc0 (1U << 1)
  513. #define ST25R3916_REG_P2P_RX_CONF_ask_thd (1U << 0)
  514. #define ST25R3916_REG_CORR_CONF1_corr_s7 (1U << 7)
  515. #define ST25R3916_REG_CORR_CONF1_corr_s6 (1U << 6)
  516. #define ST25R3916_REG_CORR_CONF1_corr_s5 (1U << 5)
  517. #define ST25R3916_REG_CORR_CONF1_corr_s4 (1U << 4)
  518. #define ST25R3916_REG_CORR_CONF1_corr_s3 (1U << 3)
  519. #define ST25R3916_REG_CORR_CONF1_corr_s2 (1U << 2)
  520. #define ST25R3916_REG_CORR_CONF1_corr_s1 (1U << 1)
  521. #define ST25R3916_REG_CORR_CONF1_corr_s0 (1U << 0)
  522. #define ST25R3916_REG_CORR_CONF2_rfu5 (1U << 7)
  523. #define ST25R3916_REG_CORR_CONF2_rfu4 (1U << 6)
  524. #define ST25R3916_REG_CORR_CONF2_rfu3 (1U << 5)
  525. #define ST25R3916_REG_CORR_CONF2_rfu2 (1U << 4)
  526. #define ST25R3916_REG_CORR_CONF2_rfu1 (1U << 3)
  527. #define ST25R3916_REG_CORR_CONF2_rfu0 (1U << 2)
  528. #define ST25R3916_REG_CORR_CONF2_corr_s9 (1U << 1)
  529. #define ST25R3916_REG_CORR_CONF2_corr_s8 (1U << 0)
  530. #define ST25R3916_REG_TIMER_EMV_CONTROL_gptc2 (1U << 7)
  531. #define ST25R3916_REG_TIMER_EMV_CONTROL_gptc1 (1U << 6)
  532. #define ST25R3916_REG_TIMER_EMV_CONTROL_gptc0 (1U << 5)
  533. #define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_no_trigger (0U << 5)
  534. #define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_erx (1U << 5)
  535. #define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_srx (2U << 5)
  536. #define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_etx_nfc (3U << 5)
  537. #define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_mask (7U << 5)
  538. #define ST25R3916_REG_TIMER_EMV_CONTROL_gptc_shift (5U)
  539. #define ST25R3916_REG_TIMER_EMV_CONTROL_rfu (1U << 4)
  540. #define ST25R3916_REG_TIMER_EMV_CONTROL_mrt_step (1U << 3)
  541. #define ST25R3916_REG_TIMER_EMV_CONTROL_mrt_step_512 (1U << 3)
  542. #define ST25R3916_REG_TIMER_EMV_CONTROL_mrt_step_64 (0U << 3)
  543. #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_nfc (1U << 2)
  544. #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_nfc_on (1U << 2)
  545. #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_nfc_off (0U << 2)
  546. #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_emv (1U << 1)
  547. #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_emv_on (1U << 1)
  548. #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_emv_off (0U << 1)
  549. #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_step (1U << 0)
  550. #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_step_64fc (0U << 0)
  551. #define ST25R3916_REG_TIMER_EMV_CONTROL_nrt_step_4096_fc (1U << 0)
  552. #define ST25R3916_REG_FIFO_STATUS2_fifo_b9 (1U << 7)
  553. #define ST25R3916_REG_FIFO_STATUS2_fifo_b8 (1U << 6)
  554. #define ST25R3916_REG_FIFO_STATUS2_fifo_b_mask (3U << 6)
  555. #define ST25R3916_REG_FIFO_STATUS2_fifo_b_shift (6U)
  556. #define ST25R3916_REG_FIFO_STATUS2_fifo_unf (1U << 5)
  557. #define ST25R3916_REG_FIFO_STATUS2_fifo_ovr (1U << 4)
  558. #define ST25R3916_REG_FIFO_STATUS2_fifo_lb2 (1U << 3)
  559. #define ST25R3916_REG_FIFO_STATUS2_fifo_lb1 (1U << 2)
  560. #define ST25R3916_REG_FIFO_STATUS2_fifo_lb0 (1U << 1)
  561. #define ST25R3916_REG_FIFO_STATUS2_fifo_lb_mask (7U << 1)
  562. #define ST25R3916_REG_FIFO_STATUS2_fifo_lb_shift (1U)
  563. #define ST25R3916_REG_FIFO_STATUS2_np_lb (1U << 0)
  564. #define ST25R3916_REG_COLLISION_STATUS_c_byte3 (1U << 7)
  565. #define ST25R3916_REG_COLLISION_STATUS_c_byte2 (1U << 6)
  566. #define ST25R3916_REG_COLLISION_STATUS_c_byte1 (1U << 5)
  567. #define ST25R3916_REG_COLLISION_STATUS_c_byte0 (1U << 4)
  568. #define ST25R3916_REG_COLLISION_STATUS_c_byte_mask (0xfU << 4)
  569. #define ST25R3916_REG_COLLISION_STATUS_c_byte_shift (4U)
  570. #define ST25R3916_REG_COLLISION_STATUS_c_bit2 (1U << 3)
  571. #define ST25R3916_REG_COLLISION_STATUS_c_bit1 (1U << 2)
  572. #define ST25R3916_REG_COLLISION_STATUS_c_bit0 (1U << 1)
  573. #define ST25R3916_REG_COLLISION_STATUS_c_pb (1U << 0)
  574. #define ST25R3916_REG_COLLISION_STATUS_c_bit_mask (3U << 1)
  575. #define ST25R3916_REG_COLLISION_STATUS_c_bit_shift (1U)
  576. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu (1U << 7)
  577. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu1 (1U << 6)
  578. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu2 (1U << 5)
  579. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_rfu3 (1U << 4)
  580. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state3 (1U << 3)
  581. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state2 (1U << 2)
  582. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state1 (1U << 1)
  583. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state0 (1U << 0)
  584. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_power_off (0x0U << 0)
  585. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_idle (0x1U << 0)
  586. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l1 (0x2U << 0)
  587. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l2 (0x3U << 0)
  588. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu4 (0x4U << 0)
  589. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_active (0x5U << 0)
  590. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu6 (0x6U << 0)
  591. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu7 (0x7U << 0)
  592. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu8 (0x8U << 0)
  593. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_halt (0x9U << 0)
  594. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l1_x (0xaU << 0)
  595. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_ready_l2_x (0xbU << 0)
  596. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_rfu12 (0xcU << 0)
  597. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_st_active_x (0xdU << 0)
  598. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state_mask (0xfU << 0)
  599. #define ST25R3916_REG_PASSIVE_TARGET_STATUS_pta_state_shift (0U)
  600. #define ST25R3916_REG_NUM_TX_BYTES2_ntx4 (1U << 7)
  601. #define ST25R3916_REG_NUM_TX_BYTES2_ntx3 (1U << 6)
  602. #define ST25R3916_REG_NUM_TX_BYTES2_ntx2 (1U << 5)
  603. #define ST25R3916_REG_NUM_TX_BYTES2_ntx1 (1U << 4)
  604. #define ST25R3916_REG_NUM_TX_BYTES2_ntx0 (1U << 3)
  605. #define ST25R3916_REG_NUM_TX_BYTES2_ntx_mask (0x1fU << 3)
  606. #define ST25R3916_REG_NUM_TX_BYTES2_ntx_shift (3U)
  607. #define ST25R3916_REG_NUM_TX_BYTES2_nbtx2 (1U << 2)
  608. #define ST25R3916_REG_NUM_TX_BYTES2_nbtx1 (1U << 1)
  609. #define ST25R3916_REG_NUM_TX_BYTES2_nbtx0 (1U << 0)
  610. #define ST25R3916_REG_NUM_TX_BYTES2_nbtx_mask (7U << 0)
  611. #define ST25R3916_REG_NUM_TX_BYTES2_nbtx_shift (0U)
  612. #define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rfu1 (1U << 7)
  613. #define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rfu0 (1U << 6)
  614. #define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate1 (1U << 5)
  615. #define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate0 (1U << 4)
  616. #define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate_mask (0x3U << 4)
  617. #define ST25R3916_REG_NFCIP1_BIT_RATE_nfc_rate_shift (4U)
  618. #define ST25R3916_REG_NFCIP1_BIT_RATE_ppt2_on (1U << 3)
  619. #define ST25R3916_REG_NFCIP1_BIT_RATE_gpt_on (1U << 2)
  620. #define ST25R3916_REG_NFCIP1_BIT_RATE_nrt_on (1U << 1)
  621. #define ST25R3916_REG_NFCIP1_BIT_RATE_mrt_on (1U << 0)
  622. #define ST25R3916_REG_TX_DRIVER_am_mod3 (1U << 7)
  623. #define ST25R3916_REG_TX_DRIVER_am_mod2 (1U << 6)
  624. #define ST25R3916_REG_TX_DRIVER_am_mod1 (1U << 5)
  625. #define ST25R3916_REG_TX_DRIVER_am_mod0 (1U << 4)
  626. #define ST25R3916_REG_TX_DRIVER_am_mod_5percent (0x0U << 4)
  627. #define ST25R3916_REG_TX_DRIVER_am_mod_6percent (0x1U << 4)
  628. #define ST25R3916_REG_TX_DRIVER_am_mod_7percent (0x2U << 4)
  629. #define ST25R3916_REG_TX_DRIVER_am_mod_8percent (0x3U << 4)
  630. #define ST25R3916_REG_TX_DRIVER_am_mod_9percent (0x4U << 4)
  631. #define ST25R3916_REG_TX_DRIVER_am_mod_10percent (0x5U << 4)
  632. #define ST25R3916_REG_TX_DRIVER_am_mod_11percent (0x6U << 4)
  633. #define ST25R3916_REG_TX_DRIVER_am_mod_12percent (0x7U << 4)
  634. #define ST25R3916_REG_TX_DRIVER_am_mod_13percent (0x8U << 4)
  635. #define ST25R3916_REG_TX_DRIVER_am_mod_14percent (0x9U << 4)
  636. #define ST25R3916_REG_TX_DRIVER_am_mod_15percent (0xaU << 4)
  637. #define ST25R3916_REG_TX_DRIVER_am_mod_17percent (0xbU << 4)
  638. #define ST25R3916_REG_TX_DRIVER_am_mod_19percent (0xcU << 4)
  639. #define ST25R3916_REG_TX_DRIVER_am_mod_22percent (0xdU << 4)
  640. #define ST25R3916_REG_TX_DRIVER_am_mod_26percent (0xeU << 4)
  641. #define ST25R3916_REG_TX_DRIVER_am_mod_40percent (0xfU << 4)
  642. #define ST25R3916_REG_TX_DRIVER_am_mod_mask (0xfU << 4)
  643. #define ST25R3916_REG_TX_DRIVER_am_mod_shift (4U)
  644. #define ST25R3916_REG_TX_DRIVER_d_res3 (1U << 3)
  645. #define ST25R3916_REG_TX_DRIVER_d_res2 (1U << 2)
  646. #define ST25R3916_REG_TX_DRIVER_d_res1 (1U << 1)
  647. #define ST25R3916_REG_TX_DRIVER_d_res0 (1U << 0)
  648. #define ST25R3916_REG_TX_DRIVER_d_res_mask (0xfU << 0)
  649. #define ST25R3916_REG_TX_DRIVER_d_res_shift (0U)
  650. #define ST25R3916_REG_PT_MOD_ptm_res3 (1U << 7)
  651. #define ST25R3916_REG_PT_MOD_ptm_res2 (1U << 6)
  652. #define ST25R3916_REG_PT_MOD_ptm_res1 (1U << 5)
  653. #define ST25R3916_REG_PT_MOD_ptm_res0 (1U << 4)
  654. #define ST25R3916_REG_PT_MOD_ptm_res_mask (0xfU << 4)
  655. #define ST25R3916_REG_PT_MOD_ptm_res_shift (4U)
  656. #define ST25R3916_REG_PT_MOD_pt_res3 (1U << 3)
  657. #define ST25R3916_REG_PT_MOD_pt_res2 (1U << 2)
  658. #define ST25R3916_REG_PT_MOD_pt_res1 (1U << 1)
  659. #define ST25R3916_REG_PT_MOD_pt_res0 (1U << 0)
  660. #define ST25R3916_REG_PT_MOD_pt_res_mask (0xfU << 0)
  661. #define ST25R3916_REG_PT_MOD_pt_res_shift (0U)
  662. #define ST25R3916_REG_AUX_MOD_dis_reg_am (1U << 7)
  663. #define ST25R3916_REG_AUX_MOD_lm_ext_pol (1U << 6)
  664. #define ST25R3916_REG_AUX_MOD_lm_ext (1U << 5)
  665. #define ST25R3916_REG_AUX_MOD_lm_dri (1U << 4)
  666. #define ST25R3916_REG_AUX_MOD_res_am (1U << 3)
  667. #define ST25R3916_REG_AUX_MOD_rfu2 (1U << 2)
  668. #define ST25R3916_REG_AUX_MOD_rfu1 (1U << 1)
  669. #define ST25R3916_REG_AUX_MOD_rfu0 (1U << 0)
  670. #define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t3 (1U << 7)
  671. #define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t2 (1U << 6)
  672. #define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t1 (1U << 5)
  673. #define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_t0 (1U << 4)
  674. #define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_mask (0xfU << 4)
  675. #define ST25R3916_REG_TX_DRIVER_TIMING_d_rat_shift (4U)
  676. #define ST25R3916_REG_TX_DRIVER_TIMING_rfu (1U << 3)
  677. #define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m2 (1U << 2)
  678. #define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m1 (1U << 1)
  679. #define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m0 (1U << 0)
  680. #define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m_mask (0x7U << 0)
  681. #define ST25R3916_REG_TX_DRIVER_TIMING_d_tim_m_shift (0U)
  682. #define ST25R3916_REG_RES_AM_MOD_fa3_f (1U << 7)
  683. #define ST25R3916_REG_RES_AM_MOD_md_res6 (1U << 6)
  684. #define ST25R3916_REG_RES_AM_MOD_md_res5 (1U << 5)
  685. #define ST25R3916_REG_RES_AM_MOD_md_res4 (1U << 4)
  686. #define ST25R3916_REG_RES_AM_MOD_md_res3 (1U << 3)
  687. #define ST25R3916_REG_RES_AM_MOD_md_res2 (1U << 2)
  688. #define ST25R3916_REG_RES_AM_MOD_md_res1 (1U << 1)
  689. #define ST25R3916_REG_RES_AM_MOD_md_res0 (1U << 0)
  690. #define ST25R3916_REG_RES_AM_MOD_md_res_mask (0x7FU << 0)
  691. #define ST25R3916_REG_RES_AM_MOD_md_res_shift (0U)
  692. #define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r3 (1U << 7)
  693. #define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r2 (1U << 6)
  694. #define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r1 (1U << 5)
  695. #define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_r0 (1U << 4)
  696. #define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_mask (0xfU << 4)
  697. #define ST25R3916_REG_TX_DRIVER_STATUS_d_rat_shift (4U)
  698. #define ST25R3916_REG_TX_DRIVER_STATUS_rfu (1U << 3)
  699. #define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_r2 (1U << 2)
  700. #define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_r1 (1U << 1)
  701. #define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_r0 (1U << 0)
  702. #define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_mask (0x7U << 0)
  703. #define ST25R3916_REG_TX_DRIVER_STATUS_d_tim_shift (0U)
  704. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_l2a (1U << 6)
  705. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_l1a (1U << 5)
  706. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_l0a (1U << 4)
  707. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_75mV (0x0U << 4)
  708. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_105mV (0x1U << 4)
  709. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_150mV (0x2U << 4)
  710. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_205mV (0x3U << 4)
  711. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_290mV (0x4U << 4)
  712. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_400mV (0x5U << 4)
  713. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_560mV (0x6U << 4)
  714. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_800mV (0x7U << 4)
  715. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_mask (7U << 4)
  716. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_trg_shift (4U)
  717. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t3a (1U << 3)
  718. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t2a (1U << 2)
  719. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t1a (1U << 1)
  720. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_t0a (1U << 0)
  721. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_75mV (0x0U << 0)
  722. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_105mV (0x1U << 0)
  723. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_150mV (0x2U << 0)
  724. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_205mV (0x3U << 0)
  725. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_290mV (0x4U << 0)
  726. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_400mV (0x5U << 0)
  727. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_560mV (0x6U << 0)
  728. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_800mV (0x7U << 0)
  729. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_25mV (0x8U << 0)
  730. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_33mV (0x9U << 0)
  731. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_47mV (0xAU << 0)
  732. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_64mV (0xBU << 0)
  733. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_90mV (0xCU << 0)
  734. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_125mV (0xDU << 0)
  735. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_175mV (0xEU << 0)
  736. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_250mV (0xFU << 0)
  737. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_mask (0xfU << 0)
  738. #define ST25R3916_REG_FIELD_THRESHOLD_ACTV_rfe_shift (0U)
  739. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_l2d (1U << 6)
  740. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_l1d (1U << 5)
  741. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_l0d (1U << 4)
  742. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_75mV (0x0U << 4)
  743. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_105mV (0x1U << 4)
  744. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_150mV (0x2U << 4)
  745. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_205mV (0x3U << 4)
  746. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_290mV (0x4U << 4)
  747. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_400mV (0x5U << 4)
  748. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_560mV (0x6U << 4)
  749. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_800mV (0x7U << 4)
  750. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_mask (7U << 4)
  751. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_trg_shift (4U)
  752. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t3d (1U << 3)
  753. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t2d (1U << 2)
  754. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t1d (1U << 1)
  755. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_t0d (1U << 0)
  756. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_75mV (0x0U << 0)
  757. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_105mV (0x1U << 0)
  758. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_150mV (0x2U << 0)
  759. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_205mV (0x3U << 0)
  760. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_290mV (0x4U << 0)
  761. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_400mV (0x5U << 0)
  762. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_560mV (0x6U << 0)
  763. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_800mV (0x7U << 0)
  764. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_25mV (0x8U << 0)
  765. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_33mV (0x9U << 0)
  766. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_47mV (0xAU << 0)
  767. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_64mV (0xBU << 0)
  768. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_90mV (0xCU << 0)
  769. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_125mV (0xDU << 0)
  770. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_175mV (0xEU << 0)
  771. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_250mV (0xFU << 0)
  772. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_mask (0xfU << 0)
  773. #define ST25R3916_REG_FIELD_THRESHOLD_DEACTV_rfe_shift (0U)
  774. #define ST25R3916_REG_REGULATOR_CONTROL_reg_s (1U << 7)
  775. #define ST25R3916_REG_REGULATOR_CONTROL_rege_3 (1U << 6)
  776. #define ST25R3916_REG_REGULATOR_CONTROL_rege_2 (1U << 5)
  777. #define ST25R3916_REG_REGULATOR_CONTROL_rege_1 (1U << 4)
  778. #define ST25R3916_REG_REGULATOR_CONTROL_rege_0 (1U << 3)
  779. #define ST25R3916_REG_REGULATOR_CONTROL_rege_mask (0xfU << 3)
  780. #define ST25R3916_REG_REGULATOR_CONTROL_rege_shift (3U)
  781. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv2 (2U << 2)
  782. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv1 (1U << 1)
  783. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv0 (1U << 0)
  784. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd (0U)
  785. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_a (1U)
  786. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_d (2U)
  787. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_rf (3U)
  788. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv_vdd_am (4U)
  789. #define ST25R3916_REG_REGULATOR_CONTROL_rfu (5U)
  790. #define ST25R3916_REG_REGULATOR_CONTROL_rfu1 (6U)
  791. #define ST25R3916_REG_REGULATOR_CONTROL_rfu2 (7U)
  792. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv_mask (7U)
  793. #define ST25R3916_REG_REGULATOR_CONTROL_mpsv_shift (0U)
  794. #define ST25R3916_REG_REGULATOR_RESULT_reg_3 (1U << 7)
  795. #define ST25R3916_REG_REGULATOR_RESULT_reg_2 (1U << 6)
  796. #define ST25R3916_REG_REGULATOR_RESULT_reg_1 (1U << 5)
  797. #define ST25R3916_REG_REGULATOR_RESULT_reg_0 (1U << 4)
  798. #define ST25R3916_REG_REGULATOR_RESULT_reg_mask (0xfU << 4)
  799. #define ST25R3916_REG_REGULATOR_RESULT_reg_shift (4U)
  800. #define ST25R3916_REG_REGULATOR_RESULT_i_lim (1U << 0)
  801. #define ST25R3916_REG_RSSI_RESULT_rssi_am_3 (1U << 7)
  802. #define ST25R3916_REG_RSSI_RESULT_rssi_am_2 (1U << 6)
  803. #define ST25R3916_REG_RSSI_RESULT_rssi_am_1 (1U << 5)
  804. #define ST25R3916_REG_RSSI_RESULT_rssi_am_0 (1U << 4)
  805. #define ST25R3916_REG_RSSI_RESULT_rssi_am_mask (0xfU << 4)
  806. #define ST25R3916_REG_RSSI_RESULT_rssi_am_shift (4U)
  807. #define ST25R3916_REG_RSSI_RESULT_rssi_pm3 (1U << 3)
  808. #define ST25R3916_REG_RSSI_RESULT_rssi_pm2 (1U << 2)
  809. #define ST25R3916_REG_RSSI_RESULT_rssi_pm1 (1U << 1)
  810. #define ST25R3916_REG_RSSI_RESULT_rssi_pm0 (1U << 0)
  811. #define ST25R3916_REG_RSSI_RESULT_rssi_pm_mask (0xfU << 0)
  812. #define ST25R3916_REG_RSSI_RESULT_rssi_pm_shift (0U)
  813. #define ST25R3916_REG_GAIN_RED_STATE_gs_am_3 (1U << 7)
  814. #define ST25R3916_REG_GAIN_RED_STATE_gs_am_2 (1U << 6)
  815. #define ST25R3916_REG_GAIN_RED_STATE_gs_am_1 (1U << 5)
  816. #define ST25R3916_REG_GAIN_RED_STATE_gs_am_0 (1U << 4)
  817. #define ST25R3916_REG_GAIN_RED_STATE_gs_am_mask (0xfU << 4)
  818. #define ST25R3916_REG_GAIN_RED_STATE_gs_am_shift (4U)
  819. #define ST25R3916_REG_GAIN_RED_STATE_gs_pm_3 (1U << 3)
  820. #define ST25R3916_REG_GAIN_RED_STATE_gs_pm_2 (1U << 2)
  821. #define ST25R3916_REG_GAIN_RED_STATE_gs_pm_1 (1U << 1)
  822. #define ST25R3916_REG_GAIN_RED_STATE_gs_pm_0 (1U << 0)
  823. #define ST25R3916_REG_GAIN_RED_STATE_gs_pm_mask (0xfU << 0)
  824. #define ST25R3916_REG_GAIN_RED_STATE_gs_pm_shift (0U)
  825. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal4 (1U << 7)
  826. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal3 (1U << 6)
  827. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal2 (1U << 5)
  828. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal1 (1U << 4)
  829. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal0 (1U << 3)
  830. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal_mask (0x1fU << 3)
  831. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_mcal_shift (3U)
  832. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g2 (1U << 2)
  833. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g1 (1U << 1)
  834. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g0 (1U << 0)
  835. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g_mask (7U << 0)
  836. #define ST25R3916_REG_CAP_SENSOR_CONTROL_cs_g_shift (0U)
  837. #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal4 (1U << 7)
  838. #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal3 (1U << 6)
  839. #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal2 (1U << 5)
  840. #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal1 (1U << 4)
  841. #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal0 (1U << 3)
  842. #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_mask (0x1fU << 3)
  843. #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_shift (3U)
  844. #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_end (1U << 2)
  845. #define ST25R3916_REG_CAP_SENSOR_RESULT_cs_cal_err (1U << 1)
  846. #define ST25R3916_REG_AUX_DISPLAY_a_cha (1U << 7)
  847. #define ST25R3916_REG_AUX_DISPLAY_efd_o (1U << 6)
  848. #define ST25R3916_REG_AUX_DISPLAY_tx_on (1U << 5)
  849. #define ST25R3916_REG_AUX_DISPLAY_osc_ok (1U << 4)
  850. #define ST25R3916_REG_AUX_DISPLAY_rx_on (1U << 3)
  851. #define ST25R3916_REG_AUX_DISPLAY_rx_act (1U << 2)
  852. #define ST25R3916_REG_AUX_DISPLAY_en_peer (1U << 1)
  853. #define ST25R3916_REG_AUX_DISPLAY_en_ac (1U << 0)
  854. #define ST25R3916_REG_OVERSHOOT_CONF1_ov_tx_mode1 (1U << 7)
  855. #define ST25R3916_REG_OVERSHOOT_CONF1_ov_tx_mode0 (1U << 6)
  856. #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern13 (1U << 5)
  857. #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern12 (1U << 4)
  858. #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern11 (1U << 3)
  859. #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern10 (1U << 2)
  860. #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern9 (1U << 1)
  861. #define ST25R3916_REG_OVERSHOOT_CONF1_ov_pattern8 (1U << 0)
  862. #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern7 (1U << 7)
  863. #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern6 (1U << 6)
  864. #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern5 (1U << 5)
  865. #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern4 (1U << 4)
  866. #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern3 (1U << 3)
  867. #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern2 (1U << 2)
  868. #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern1 (1U << 1)
  869. #define ST25R3916_REG_OVERSHOOT_CONF2_ov_pattern0 (1U << 0)
  870. #define ST25R3916_REG_UNDERSHOOT_CONF1_un_tx_mode1 (1U << 7)
  871. #define ST25R3916_REG_UNDERSHOOT_CONF1_un_tx_mode0 (1U << 6)
  872. #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern13 (1U << 5)
  873. #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern12 (1U << 4)
  874. #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern11 (1U << 3)
  875. #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern10 (1U << 2)
  876. #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern9 (1U << 1)
  877. #define ST25R3916_REG_UNDERSHOOT_CONF1_un_pattern8 (1U << 0)
  878. #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern7 (1U << 7)
  879. #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern6 (1U << 6)
  880. #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern5 (1U << 5)
  881. #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern4 (1U << 4)
  882. #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern3 (1U << 3)
  883. #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern2 (1U << 2)
  884. #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern1 (1U << 1)
  885. #define ST25R3916_REG_UNDERSHOOT_CONF2_un_pattern0 (1U << 0)
  886. #define ST25R3916_REG_WUP_TIMER_CONTROL_wur (1U << 7)
  887. #define ST25R3916_REG_WUP_TIMER_CONTROL_wut2 (1U << 6)
  888. #define ST25R3916_REG_WUP_TIMER_CONTROL_wut1 (1U << 5)
  889. #define ST25R3916_REG_WUP_TIMER_CONTROL_wut0 (1U << 4)
  890. #define ST25R3916_REG_WUP_TIMER_CONTROL_wut_mask (7U << 4)
  891. #define ST25R3916_REG_WUP_TIMER_CONTROL_wut_shift (4U)
  892. #define ST25R3916_REG_WUP_TIMER_CONTROL_wto (1U << 3)
  893. #define ST25R3916_REG_WUP_TIMER_CONTROL_wam (1U << 2)
  894. #define ST25R3916_REG_WUP_TIMER_CONTROL_wph (1U << 1)
  895. #define ST25R3916_REG_WUP_TIMER_CONTROL_wcap (1U << 0)
  896. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d3 (1U << 7)
  897. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d2 (1U << 6)
  898. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d1 (1U << 5)
  899. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d0 (1U << 4)
  900. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d_mask (0xfU << 4)
  901. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_d_shift (4U)
  902. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aam (1U << 3)
  903. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew1 (1U << 2)
  904. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew0 (1U << 1)
  905. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew_mask (0x3U << 1)
  906. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_aew_shift (1U)
  907. #define ST25R3916_REG_AMPLITUDE_MEASURE_CONF_am_ae (1U << 0)
  908. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d3 (1U << 7)
  909. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d2 (1U << 6)
  910. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d1 (1U << 5)
  911. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d0 (1U << 4)
  912. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d_mask (0xfU << 4)
  913. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_d_shift (4U)
  914. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aam (1U << 3)
  915. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew1 (1U << 2)
  916. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew0 (1U << 1)
  917. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew_mask (0x3U << 1)
  918. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_aew_shift (1U)
  919. #define ST25R3916_REG_PHASE_MEASURE_CONF_pm_ae (1U << 0)
  920. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d3 (1U << 7)
  921. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d2 (1U << 6)
  922. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d1 (1U << 5)
  923. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d0 (1U << 4)
  924. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d_mask (0xfU << 4)
  925. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_d_shift (4U)
  926. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aam (1U << 3)
  927. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew1 (1U << 2)
  928. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew0 (1U << 1)
  929. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew_mask (0x3U << 1)
  930. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_aew_shift (1U)
  931. #define ST25R3916_REG_CAPACITANCE_MEASURE_CONF_cm_ae (1U << 0)
  932. #define ST25R3916_REG_IC_IDENTITY_ic_type4 (1U << 7)
  933. #define ST25R3916_REG_IC_IDENTITY_ic_type3 (1U << 6)
  934. #define ST25R3916_REG_IC_IDENTITY_ic_type2 (1U << 5)
  935. #define ST25R3916_REG_IC_IDENTITY_ic_type1 (1U << 4)
  936. #define ST25R3916_REG_IC_IDENTITY_ic_type0 (1U << 3)
  937. #define ST25R3916_REG_IC_IDENTITY_ic_type_st25r3916 (5U << 3)
  938. #define ST25R3916_REG_IC_IDENTITY_ic_type_mask (0x1fU << 3)
  939. #define ST25R3916_REG_IC_IDENTITY_ic_type_shift (3U)
  940. #define ST25R3916_REG_IC_IDENTITY_ic_rev2 (1U << 2)
  941. #define ST25R3916_REG_IC_IDENTITY_ic_rev1 (1U << 1)
  942. #define ST25R3916_REG_IC_IDENTITY_ic_rev0 (1U << 0)
  943. #define ST25R3916_REG_IC_IDENTITY_ic_rev_v0 (0U << 0)
  944. #define ST25R3916_REG_IC_IDENTITY_ic_rev_mask (7U << 0)
  945. #define ST25R3916_REG_IC_IDENTITY_ic_rev_shift (0U)
  946. /*! \endcond DOXYGEN_SUPRESS */
  947. /*
  948. ******************************************************************************
  949. * GLOBAL FUNCTION PROTOTYPES
  950. ******************************************************************************
  951. */
  952. /*!
  953. *****************************************************************************
  954. * \brief Returns the content of a register within the ST25R3916
  955. *
  956. * This function is used to read out the content of ST25R3916 registers.
  957. *
  958. * \param[in] reg: Address of register to read.
  959. * \param[out] val: Returned value.
  960. *
  961. * \return ERR_NONE : Operation successful
  962. * \return ERR_PARAM : Invalid parameter
  963. * \return ERR_SEND : Transmission error or acknowledge not received
  964. *****************************************************************************
  965. */
  966. ReturnCode st25r3916ReadRegister(uint8_t reg, uint8_t* val);
  967. /*!
  968. *****************************************************************************
  969. * \brief Reads from multiple ST25R3916 registers
  970. *
  971. * This function is used to read from multiple registers using the
  972. * auto-increment feature. That is, after each read the address pointer
  973. * inside the ST25R3916 gets incremented automatically.
  974. *
  975. * \param[in] reg: Address of the frist register to read from.
  976. * \param[in] values: pointer to a buffer where the result shall be written to.
  977. * \param[in] length: Number of registers to be read out.
  978. *
  979. * \return ERR_NONE : Operation successful
  980. * \return ERR_PARAM : Invalid parameter
  981. * \return ERR_SEND : Transmission error or acknowledge not received
  982. *****************************************************************************
  983. */
  984. ReturnCode st25r3916ReadMultipleRegisters(uint8_t reg, uint8_t* values, uint8_t length);
  985. /*!
  986. *****************************************************************************
  987. * \brief Writes a given value to a register within the ST25R3916
  988. *
  989. * This function is used to write \a val to address \a reg within the ST25R3916.
  990. *
  991. * \param[in] reg: Address of the register to write.
  992. * \param[in] val: Value to be written.
  993. *
  994. * \return ERR_NONE : Operation successful
  995. * \return ERR_PARAM : Invalid parameter
  996. * \return ERR_SEND : Transmission error or acknowledge not received
  997. *****************************************************************************
  998. */
  999. ReturnCode st25r3916WriteRegister(uint8_t reg, uint8_t val);
  1000. /*!
  1001. *****************************************************************************
  1002. * \brief Writes multiple values to ST25R3916 registers
  1003. *
  1004. * This function is used to write multiple values to the ST25R3916 using the
  1005. * auto-increment feature. That is, after each write the address pointer
  1006. * inside the ST25R3916 gets incremented automatically.
  1007. *
  1008. * \param[in] reg: Address of the frist register to write.
  1009. * \param[in] values: pointer to a buffer containing the values to be written.
  1010. * \param[in] length: Number of values to be written.
  1011. *
  1012. * \return ERR_NONE : Operation successful
  1013. * \return ERR_PARAM : Invalid parameter
  1014. * \return ERR_SEND : Transmission error or acknowledge not received
  1015. *****************************************************************************
  1016. */
  1017. ReturnCode st25r3916WriteMultipleRegisters(uint8_t reg, const uint8_t* values, uint8_t length);
  1018. /*!
  1019. *****************************************************************************
  1020. * \brief Writes values to ST25R3916 FIFO
  1021. *
  1022. * This function needs to be called in order to write to the ST25R3916 FIFO.
  1023. *
  1024. * \param[in] values: pointer to a buffer containing the values to be written
  1025. * to the FIFO.
  1026. * \param[in] length: Number of values to be written.
  1027. *
  1028. * \return ERR_NONE : Operation successful
  1029. * \return ERR_PARAM : Invalid parameter
  1030. * \return ERR_SEND : Transmission error or acknowledge not received
  1031. *****************************************************************************
  1032. */
  1033. ReturnCode st25r3916WriteFifo(const uint8_t* values, uint16_t length);
  1034. /*!
  1035. *****************************************************************************
  1036. * \brief Read values from ST25R3916 FIFO
  1037. *
  1038. * This function needs to be called in order to read from ST25R3916 FIFO.
  1039. *
  1040. * \param[out] buf: pointer to a buffer where the FIFO content shall be
  1041. * written to.
  1042. * \param[in] length: Number of bytes to read.
  1043. *
  1044. * \note: This function doesn't check whether \a length is really the
  1045. * number of available bytes in FIFO
  1046. *
  1047. * \return ERR_NONE : Operation successful
  1048. * \return ERR_PARAM : Invalid parameter
  1049. * \return ERR_SEND : Transmission error or acknowledge not received
  1050. *****************************************************************************
  1051. */
  1052. ReturnCode st25r3916ReadFifo(uint8_t* buf, uint16_t length);
  1053. /*!
  1054. *****************************************************************************
  1055. * \brief Writes values to ST25R3916 PTM
  1056. *
  1057. * Accesses to the begging of ST25R3916 Passive Target Memory (PTM A Config)
  1058. * and writes the given values
  1059. *
  1060. * \param[in] values: pointer to a buffer containing the values to be written
  1061. * to the Passive Target Memory.
  1062. * \param[in] length: Number of values to be written.
  1063. *
  1064. * \return ERR_NONE : Operation successful
  1065. * \return ERR_PARAM : Invalid parameter
  1066. * \return ERR_SEND : Transmission error or acknowledge not received
  1067. *****************************************************************************
  1068. */
  1069. ReturnCode st25r3916WritePTMem(const uint8_t* values, uint16_t length);
  1070. /*!
  1071. *****************************************************************************
  1072. * \brief Reads the ST25R3916 PTM
  1073. *
  1074. * Accesses to the begging of ST25R3916 Passive Target Memory (PTM A Config)
  1075. * and reads the memory for the given length
  1076. *
  1077. * \param[out] values: pointer to a buffer where the PTM content shall be
  1078. * written to.
  1079. * \param[in] length: Number of bytes to read.
  1080. *
  1081. * \return ERR_NONE : Operation successful
  1082. * \return ERR_PARAM : Invalid parameter
  1083. * \return ERR_SEND : Transmission error or acknowledge not received
  1084. *****************************************************************************
  1085. */
  1086. ReturnCode st25r3916ReadPTMem(uint8_t* values, uint16_t length);
  1087. /*!
  1088. *****************************************************************************
  1089. * \brief Writes values to ST25R3916 PTM F config
  1090. *
  1091. * Accesses ST25R3916 Passive Target Memory F config and writes the given values
  1092. *
  1093. * \param[in] values: pointer to a buffer containing the values to be written
  1094. * to the Passive Target Memory
  1095. * \param[in] length: Number of values to be written.
  1096. *
  1097. * \return ERR_NONE : Operation successful
  1098. * \return ERR_PARAM : Invalid parameter
  1099. * \return ERR_SEND : Transmission error or acknowledge not received
  1100. *****************************************************************************
  1101. */
  1102. ReturnCode st25r3916WritePTMemF(const uint8_t* values, uint16_t length);
  1103. /*!
  1104. *****************************************************************************
  1105. * \brief Writes values to ST25R3916 PTM TSN Data
  1106. *
  1107. * Accesses ST25R3916 Passive Target Memory TSN data and writes the given values
  1108. *
  1109. * \param[in] values: pointer to a buffer containing the values to be written
  1110. * to the Passive Target Memory.
  1111. * \param[in] length: Number of values to be written.
  1112. *
  1113. * \return ERR_NONE : Operation successful
  1114. * \return ERR_PARAM : Invalid parameter
  1115. * \return ERR_SEND : Transmission error or acknowledge not received
  1116. *****************************************************************************
  1117. */
  1118. ReturnCode st25r3916WritePTMemTSN(const uint8_t* values, uint16_t length);
  1119. /*!
  1120. *****************************************************************************
  1121. * \brief Execute a direct command
  1122. *
  1123. * This function is used to start so-called direct command. These commands
  1124. * are implemented inside the chip and each command has unique code (see
  1125. * datasheet).
  1126. *
  1127. * \param[in] cmd : code of the direct command to be executed.
  1128. *
  1129. * \return ERR_NONE : Operation successful
  1130. * \return ERR_PARAM : Invalid parameter
  1131. * \return ERR_SEND : Transmission error or acknowledge not received
  1132. *****************************************************************************
  1133. */
  1134. ReturnCode st25r3916ExecuteCommand(uint8_t cmd);
  1135. /*!
  1136. *****************************************************************************
  1137. * \brief Read a test register within the ST25R3916
  1138. *
  1139. * This function is used to read the content of test address \a reg within the ST25R3916
  1140. *
  1141. * \param[in] reg: Address of the register to read
  1142. * \param[out] val: Returned read value
  1143. *
  1144. * \return ERR_NONE : Operation successful
  1145. * \return ERR_PARAM : Invalid parameter
  1146. * \return ERR_SEND : Transmission error or acknowledge not received
  1147. *****************************************************************************
  1148. */
  1149. ReturnCode st25r3916ReadTestRegister(uint8_t reg, uint8_t* val);
  1150. /*!
  1151. *****************************************************************************
  1152. * \brief Writes a given value to a test register within the ST25R3916
  1153. *
  1154. * This function is used to write \a val to test address \a reg within the ST25R3916
  1155. *
  1156. * \param[in] reg: Address of the register to write
  1157. * \param[in] val: Value to be written
  1158. *
  1159. * \return ERR_NONE : Operation successful
  1160. * \return ERR_PARAM : Invalid parameter
  1161. * \return ERR_SEND : Transmission error or acknowledge not received
  1162. *****************************************************************************
  1163. */
  1164. ReturnCode st25r3916WriteTestRegister(uint8_t reg, uint8_t val);
  1165. /*!
  1166. *****************************************************************************
  1167. * \brief Cleart bits on Register
  1168. *
  1169. * This function clears the given bitmask on the register
  1170. *
  1171. * \param[in] reg: Address of the register clear
  1172. * \param[in] clr_mask: Bitmask of bit to be cleared
  1173. *
  1174. * \return ERR_NONE : Operation successful
  1175. * \return ERR_PARAM : Invalid parameter
  1176. * \return ERR_SEND : Transmission error or acknowledge not received
  1177. *****************************************************************************
  1178. */
  1179. ReturnCode st25r3916ClrRegisterBits(uint8_t reg, uint8_t clr_mask);
  1180. /*!
  1181. *****************************************************************************
  1182. * \brief Set bits on Register
  1183. *
  1184. * This function sets the given bitmask on the register
  1185. *
  1186. * \param[in] reg: Address of the register clear
  1187. * \param[in] set_mask: Bitmask of bit to be cleared
  1188. *
  1189. * \return ERR_NONE : Operation successful
  1190. * \return ERR_PARAM : Invalid parameter
  1191. * \return ERR_SEND : Transmission error or acknowledge not received
  1192. *****************************************************************************
  1193. */
  1194. ReturnCode st25r3916SetRegisterBits(uint8_t reg, uint8_t set_mask);
  1195. /*!
  1196. *****************************************************************************
  1197. * \brief Changes the given bits on a ST25R3916 register
  1198. *
  1199. * This function is used if only a particular bits should be changed within
  1200. * an ST25R3916 register.
  1201. *
  1202. * \param[in] reg: Address of the register to change.
  1203. * \param[in] valueMask: bitmask of bits to be changed
  1204. * \param[in] value: the bits to be written on the enabled valueMask bits
  1205. *
  1206. * \return ERR_NONE : Operation successful
  1207. * \return ERR_PARAM : Invalid parameter
  1208. * \return ERR_SEND : Transmission error or acknowledge not received
  1209. *****************************************************************************
  1210. */
  1211. ReturnCode st25r3916ChangeRegisterBits(uint8_t reg, uint8_t valueMask, uint8_t value);
  1212. /*!
  1213. *****************************************************************************
  1214. * \brief Modifies a value within a ST25R3916 register
  1215. *
  1216. * This function is used if only a particular bits should be changed within
  1217. * an ST25R3916 register.
  1218. *
  1219. * \param[in] reg: Address of the register to write.
  1220. * \param[in] clr_mask: bitmask of bits to be cleared to 0.
  1221. * \param[in] set_mask: bitmask of bits to be set to 1.
  1222. *
  1223. * \return ERR_NONE : Operation successful
  1224. * \return ERR_PARAM : Invalid parameter
  1225. * \return ERR_SEND : Transmission error or acknowledge not received
  1226. *****************************************************************************
  1227. */
  1228. ReturnCode st25r3916ModifyRegister(uint8_t reg, uint8_t clr_mask, uint8_t set_mask);
  1229. /*!
  1230. *****************************************************************************
  1231. * \brief Changes the given bits on a ST25R3916 Test register
  1232. *
  1233. * This function is used if only a particular bits should be changed within
  1234. * an ST25R3916 register.
  1235. *
  1236. * \param[in] reg: Address of the Test register to change.
  1237. * \param[in] valueMask: bitmask of bits to be changed
  1238. * \param[in] value: the bits to be written on the enabled valueMask bits
  1239. *
  1240. * \return ERR_NONE : Operation successful
  1241. * \return ERR_PARAM : Invalid parameter
  1242. * \return ERR_SEND : Transmission error or acknowledge not received
  1243. *****************************************************************************
  1244. */
  1245. ReturnCode st25r3916ChangeTestRegisterBits(uint8_t reg, uint8_t valueMask, uint8_t value);
  1246. /*!
  1247. *****************************************************************************
  1248. * \brief Checks if register contains a expected value
  1249. *
  1250. * This function checks if the given reg contains a value that once masked
  1251. * equals the expected value
  1252. *
  1253. * \param reg : the register to check the value
  1254. * \param mask : the mask apply on register value
  1255. * \param val : expected value to be compared to
  1256. *
  1257. * \return true when reg contains the expected value | false otherwise
  1258. */
  1259. bool st25r3916CheckReg(uint8_t reg, uint8_t mask, uint8_t val);
  1260. /*!
  1261. *****************************************************************************
  1262. * \brief Check if register ID is valid
  1263. *
  1264. * Checks if the given register ID a valid ST25R3916 register
  1265. *
  1266. * \param[in] reg: Address of register to check
  1267. *
  1268. * \return true if is a valid register ID
  1269. * \return false otherwise
  1270. *
  1271. *****************************************************************************
  1272. */
  1273. bool st25r3916IsRegValid(uint8_t reg);
  1274. #endif /* ST25R3916_COM_H */
  1275. /**
  1276. * @}
  1277. *
  1278. * @}
  1279. *
  1280. * @}
  1281. *
  1282. * @}
  1283. */