st25r3916_com.h 79 KB

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