regsecspi.h 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735
  1. /*
  2. * Copyright (c) 2012, Freescale Semiconductor, Inc.
  3. * All rights reserved.
  4. *
  5. * THIS SOFTWARE IS PROVIDED BY FREESCALE "AS IS" AND ANY EXPRESS OR IMPLIED
  6. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  7. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
  8. * SHALL FREESCALE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  9. * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
  10. * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  11. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  12. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  13. * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  14. * OF SUCH DAMAGE.
  15. */
  16. /*
  17. * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
  18. *
  19. * This file was generated automatically and any changes may be lost.
  20. */
  21. #ifndef __HW_ECSPI_REGISTERS_H__
  22. #define __HW_ECSPI_REGISTERS_H__
  23. #include "regs.h"
  24. /*
  25. * i.MX6UL ECSPI
  26. *
  27. * ECSPI
  28. *
  29. * Registers defined in this header file:
  30. * - HW_ECSPI_RXDATA - Receive Data Register
  31. * - HW_ECSPI_TXDATA - Transmit Data Register
  32. * - HW_ECSPI_CONREG - Control Register
  33. * - HW_ECSPI_CONFIGREG - Config Register
  34. * - HW_ECSPI_INTREG - Interrupt Control Register
  35. * - HW_ECSPI_DMAREG - DMA Control Register
  36. * - HW_ECSPI_STATREG - Status Register
  37. * - HW_ECSPI_PERIODREG - Sample Period Control Register
  38. * - HW_ECSPI_TESTREG - Test Control Register
  39. * - HW_ECSPI_MSGDATA - Message Data Register
  40. *
  41. * - hw_ecspi_t - Struct containing all module registers.
  42. */
  43. //! @name Module base addresses
  44. //@{
  45. #ifndef REGS_ECSPI_BASE
  46. #define HW_ECSPI_INSTANCE_COUNT (4) //!< Number of instances of the ECSPI module.
  47. #define HW_ECSPI1 (1) //!< Instance number for ECSPI1.
  48. #define HW_ECSPI2 (2) //!< Instance number for ECSPI2.
  49. #define HW_ECSPI3 (3) //!< Instance number for ECSPI3.
  50. #define HW_ECSPI4 (4) //!< Instance number for ECSPI4.
  51. #define REGS_ECSPI1_BASE (0x02008000) //!< Base address for ECSPI instance number 1.
  52. #define REGS_ECSPI2_BASE (0x0200c000) //!< Base address for ECSPI instance number 2.
  53. #define REGS_ECSPI3_BASE (0x02010000) //!< Base address for ECSPI instance number 3.
  54. #define REGS_ECSPI4_BASE (0x02014000) //!< Base address for ECSPI instance number 4.
  55. //! @brief Get the base address of ECSPI by instance number.
  56. //! @param x ECSPI instance number, from 1 through 4.
  57. #define REGS_ECSPI_BASE(x) ( (x) == HW_ECSPI1 ? REGS_ECSPI1_BASE : (x) == HW_ECSPI2 ? REGS_ECSPI2_BASE : (x) == HW_ECSPI3 ? REGS_ECSPI3_BASE : (x) == HW_ECSPI4 ? REGS_ECSPI4_BASE : 0x00d00000)
  58. //! @brief Get the instance number given a base address.
  59. //! @param b Base address for an instance of ECSPI.
  60. #define REGS_ECSPI_INSTANCE(b) ( (b) == REGS_ECSPI1_BASE ? HW_ECSPI1 : (b) == REGS_ECSPI2_BASE ? HW_ECSPI2 : (b) == REGS_ECSPI3_BASE ? HW_ECSPI3 : (b) == REGS_ECSPI4_BASE ? HW_ECSPI4 : 0)
  61. #endif
  62. //@}
  63. //-------------------------------------------------------------------------------------------
  64. // HW_ECSPI_RXDATA - Receive Data Register
  65. //-------------------------------------------------------------------------------------------
  66. #ifndef __LANGUAGE_ASM__
  67. /*!
  68. * @brief HW_ECSPI_RXDATA - Receive Data Register (RO)
  69. *
  70. * Reset value: 0x00000000
  71. *
  72. * The Receive Data register (ECSPI_RXDATA) is a read-only register that forms the top word of the
  73. * 64 x 32 receive FIFO. This register holds the data received from an external SPI device during a
  74. * data transaction. Only word-sized read operations are allowed.
  75. */
  76. typedef union _hw_ecspi_rxdata
  77. {
  78. reg32_t U;
  79. struct _hw_ecspi_rxdata_bitfields
  80. {
  81. unsigned ECSPI_RXDATA : 32; //!< [31:0] Receive Data.
  82. } B;
  83. } hw_ecspi_rxdata_t;
  84. #endif
  85. /*!
  86. * @name Constants and macros for entire ECSPI_RXDATA register
  87. */
  88. //@{
  89. #define HW_ECSPI_RXDATA_ADDR(x) (REGS_ECSPI_BASE(x) + 0x0)
  90. #ifndef __LANGUAGE_ASM__
  91. #define HW_ECSPI_RXDATA(x) (*(volatile hw_ecspi_rxdata_t *) HW_ECSPI_RXDATA_ADDR(x))
  92. #define HW_ECSPI_RXDATA_RD(x) (HW_ECSPI_RXDATA(x).U)
  93. #endif
  94. //@}
  95. /*
  96. * constants & macros for individual ECSPI_RXDATA bitfields
  97. */
  98. /*! @name Register ECSPI_RXDATA, field ECSPI_RXDATA[31:0] (RO)
  99. *
  100. * Receive Data. This register holds the top word of the receive data FIFO. The FIFO is advanced for
  101. * each read of this register. The data read is undefined when the Receive Data Ready (RR) bit in
  102. * the Interrupt Control/Status register is cleared. Zeros are read when ECSPI is disabled.
  103. */
  104. //@{
  105. #define BP_ECSPI_RXDATA_ECSPI_RXDATA (0) //!< Bit position for ECSPI_RXDATA_ECSPI_RXDATA.
  106. #define BM_ECSPI_RXDATA_ECSPI_RXDATA (0xffffffff) //!< Bit mask for ECSPI_RXDATA_ECSPI_RXDATA.
  107. //! @brief Get value of ECSPI_RXDATA_ECSPI_RXDATA from a register value.
  108. #define BG_ECSPI_RXDATA_ECSPI_RXDATA(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_RXDATA_ECSPI_RXDATA) >> BP_ECSPI_RXDATA_ECSPI_RXDATA)
  109. //@}
  110. //-------------------------------------------------------------------------------------------
  111. // HW_ECSPI_TXDATA - Transmit Data Register
  112. //-------------------------------------------------------------------------------------------
  113. #ifndef __LANGUAGE_ASM__
  114. /*!
  115. * @brief HW_ECSPI_TXDATA - Transmit Data Register (WO)
  116. *
  117. * Reset value: 0x00000000
  118. *
  119. * The Transmit Data (ECSPI_TXDATA) register is a write-only data register that forms the bottom
  120. * word of the 64 x 32 TXFIFO. The TXFIFO can be written to as long as it is not full, even when the
  121. * SPI Exchange bit (XCH) in ECSPI_CONREG is set. This allows software to write to the TXFIFO during
  122. * a SPI data exchange process. Writes to this register are ignored when the ECSPI is disabled
  123. * (ECSPI_CONREG[EN] bit is cleared).
  124. */
  125. typedef union _hw_ecspi_txdata
  126. {
  127. reg32_t U;
  128. struct _hw_ecspi_txdata_bitfields
  129. {
  130. unsigned ECSPI_TXDATA : 32; //!< [31:0] Transmit Data.
  131. } B;
  132. } hw_ecspi_txdata_t;
  133. #endif
  134. /*!
  135. * @name Constants and macros for entire ECSPI_TXDATA register
  136. */
  137. //@{
  138. #define HW_ECSPI_TXDATA_ADDR(x) (REGS_ECSPI_BASE(x) + 0x4)
  139. #ifndef __LANGUAGE_ASM__
  140. #define HW_ECSPI_TXDATA(x) (*(volatile hw_ecspi_txdata_t *) HW_ECSPI_TXDATA_ADDR(x))
  141. #define HW_ECSPI_TXDATA_WR(x, v) (HW_ECSPI_TXDATA(x).U = (v))
  142. #endif
  143. //@}
  144. /*
  145. * constants & macros for individual ECSPI_TXDATA bitfields
  146. */
  147. /*! @name Register ECSPI_TXDATA, field ECSPI_TXDATA[31:0] (WO)
  148. *
  149. * Transmit Data. This register holds the top word of data loaded into the FIFO. Data written to
  150. * this register must be a word operation. The number of bits actually transmitted is determined by
  151. * the BIT_COUNT field of the corresponding SPI Control register. If this field contains more bits
  152. * than the number specified by BIT_COUNT, the extra bits are ignored. For example, to transfer 10
  153. * bits of data, a 32-bit word must be written to this register. Bits 9-0 are shifted out and bits
  154. * 31-10 are ignored. When the ECSPI is operating in Slave mode, zeros are shifted out when the FIFO
  155. * is empty. Zeros are read when ECSPI is disabled.
  156. */
  157. //@{
  158. #define BP_ECSPI_TXDATA_ECSPI_TXDATA (0) //!< Bit position for ECSPI_TXDATA_ECSPI_TXDATA.
  159. #define BM_ECSPI_TXDATA_ECSPI_TXDATA (0xffffffff) //!< Bit mask for ECSPI_TXDATA_ECSPI_TXDATA.
  160. //! @brief Get value of ECSPI_TXDATA_ECSPI_TXDATA from a register value.
  161. #define BG_ECSPI_TXDATA_ECSPI_TXDATA(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_TXDATA_ECSPI_TXDATA) >> BP_ECSPI_TXDATA_ECSPI_TXDATA)
  162. //! @brief Format value for bitfield ECSPI_TXDATA_ECSPI_TXDATA.
  163. #define BF_ECSPI_TXDATA_ECSPI_TXDATA(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_TXDATA_ECSPI_TXDATA) & BM_ECSPI_TXDATA_ECSPI_TXDATA)
  164. //@}
  165. //-------------------------------------------------------------------------------------------
  166. // HW_ECSPI_CONREG - Control Register
  167. //-------------------------------------------------------------------------------------------
  168. #ifndef __LANGUAGE_ASM__
  169. /*!
  170. * @brief HW_ECSPI_CONREG - Control Register (RW)
  171. *
  172. * Reset value: 0x00000000
  173. *
  174. * The Control Register (ECSPI_CONREG) allows software to enable the ECSPI , configure its operating
  175. * modes, specify the divider value, and SPI_RDY control signal, and define the transfer length.
  176. */
  177. typedef union _hw_ecspi_conreg
  178. {
  179. reg32_t U;
  180. struct _hw_ecspi_conreg_bitfields
  181. {
  182. unsigned EN : 1; //!< [0] SPI Block Enable Control.
  183. unsigned HT : 1; //!< [1] Hardware Trigger Enable.
  184. unsigned XCH : 1; //!< [2] SPI Exchange Bit.
  185. unsigned SMC : 1; //!< [3] Start Mode Control.
  186. unsigned CHANNEL_MODE : 4; //!< [7:4] SPI CHANNEL MODE selects the mode for each SPI channel.
  187. unsigned POST_DIVIDER : 4; //!< [11:8] SPI Post Divider.
  188. unsigned PRE_DIVIDER : 4; //!< [15:12] SPI Pre Divider.
  189. unsigned DRCTL : 2; //!< [17:16] SPI Data Ready Control.
  190. unsigned CHANNEL_SELECT : 2; //!< [19:18] SPI CHANNEL SELECT bits.
  191. unsigned BURST_LENGTH : 12; //!< [31:20] Burst Length.
  192. } B;
  193. } hw_ecspi_conreg_t;
  194. #endif
  195. /*!
  196. * @name Constants and macros for entire ECSPI_CONREG register
  197. */
  198. //@{
  199. #define HW_ECSPI_CONREG_ADDR(x) (REGS_ECSPI_BASE(x) + 0x8)
  200. #ifndef __LANGUAGE_ASM__
  201. #define HW_ECSPI_CONREG(x) (*(volatile hw_ecspi_conreg_t *) HW_ECSPI_CONREG_ADDR(x))
  202. #define HW_ECSPI_CONREG_RD(x) (HW_ECSPI_CONREG(x).U)
  203. #define HW_ECSPI_CONREG_WR(x, v) (HW_ECSPI_CONREG(x).U = (v))
  204. #define HW_ECSPI_CONREG_SET(x, v) (HW_ECSPI_CONREG_WR(x, HW_ECSPI_CONREG_RD(x) | (v)))
  205. #define HW_ECSPI_CONREG_CLR(x, v) (HW_ECSPI_CONREG_WR(x, HW_ECSPI_CONREG_RD(x) & ~(v)))
  206. #define HW_ECSPI_CONREG_TOG(x, v) (HW_ECSPI_CONREG_WR(x, HW_ECSPI_CONREG_RD(x) ^ (v)))
  207. #endif
  208. //@}
  209. /*
  210. * constants & macros for individual ECSPI_CONREG bitfields
  211. */
  212. /*! @name Register ECSPI_CONREG, field EN[0] (RW)
  213. *
  214. * SPI Block Enable Control. This bit enables the ECSPI. This bit must be set before writing to
  215. * other registers or initiating an exchange. Writing zero to this bit disables the block and resets
  216. * the internal logic with the exception of the ECSPI_CONREG. The block's internal clocks are gated
  217. * off whenever the block is disabled.
  218. *
  219. * Values:
  220. * - 0 - Disable the block.
  221. * - 1 - Enable the block.
  222. */
  223. //@{
  224. #define BP_ECSPI_CONREG_EN (0) //!< Bit position for ECSPI_CONREG_EN.
  225. #define BM_ECSPI_CONREG_EN (0x00000001) //!< Bit mask for ECSPI_CONREG_EN.
  226. //! @brief Get value of ECSPI_CONREG_EN from a register value.
  227. #define BG_ECSPI_CONREG_EN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_EN) >> BP_ECSPI_CONREG_EN)
  228. //! @brief Format value for bitfield ECSPI_CONREG_EN.
  229. #define BF_ECSPI_CONREG_EN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_EN) & BM_ECSPI_CONREG_EN)
  230. #ifndef __LANGUAGE_ASM__
  231. //! @brief Set the EN field to a new value.
  232. #define BW_ECSPI_CONREG_EN(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_EN) | BF_ECSPI_CONREG_EN(v)))
  233. #endif
  234. //@}
  235. /*! @name Register ECSPI_CONREG, field HT[1] (RW)
  236. *
  237. * Hardware Trigger Enable. This bit is used in master mode only. It enables hardware trigger (HT)
  238. * mode. Note, HT mode is not supported by this product.
  239. *
  240. * Values:
  241. * - 0 - Disable HT mode.
  242. * - 1 - Enable HT mode.
  243. */
  244. //@{
  245. #define BP_ECSPI_CONREG_HT (1) //!< Bit position for ECSPI_CONREG_HT.
  246. #define BM_ECSPI_CONREG_HT (0x00000002) //!< Bit mask for ECSPI_CONREG_HT.
  247. //! @brief Get value of ECSPI_CONREG_HT from a register value.
  248. #define BG_ECSPI_CONREG_HT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_HT) >> BP_ECSPI_CONREG_HT)
  249. //! @brief Format value for bitfield ECSPI_CONREG_HT.
  250. #define BF_ECSPI_CONREG_HT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_HT) & BM_ECSPI_CONREG_HT)
  251. #ifndef __LANGUAGE_ASM__
  252. //! @brief Set the HT field to a new value.
  253. #define BW_ECSPI_CONREG_HT(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_HT) | BF_ECSPI_CONREG_HT(v)))
  254. #endif
  255. //@}
  256. /*! @name Register ECSPI_CONREG, field XCH[2] (RW)
  257. *
  258. * SPI Exchange Bit. This bit applies only to channels configured in Master mode (CHANNEL MODE = 1).
  259. * If the Start Mode Control (SMC) bit is cleared, writing a 1 to this bit starts one SPI burst or
  260. * multiple SPI bursts according to the SPI SS Wave Form Select (SS_CTL). The XCH bit remains set
  261. * while either the data exchange is in progress, or when the ECSPI is waiting for an active input
  262. * if SPIRDY is enabled through DRCTL. This bit is cleared automatically when all data in the TXFIFO
  263. * and the shift register has been shifted out.
  264. *
  265. * Values:
  266. * - 0 - Idle.
  267. * - 1 - Initiates exchange (write) or busy (read).
  268. */
  269. //@{
  270. #define BP_ECSPI_CONREG_XCH (2) //!< Bit position for ECSPI_CONREG_XCH.
  271. #define BM_ECSPI_CONREG_XCH (0x00000004) //!< Bit mask for ECSPI_CONREG_XCH.
  272. //! @brief Get value of ECSPI_CONREG_XCH from a register value.
  273. #define BG_ECSPI_CONREG_XCH(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_XCH) >> BP_ECSPI_CONREG_XCH)
  274. //! @brief Format value for bitfield ECSPI_CONREG_XCH.
  275. #define BF_ECSPI_CONREG_XCH(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_XCH) & BM_ECSPI_CONREG_XCH)
  276. #ifndef __LANGUAGE_ASM__
  277. //! @brief Set the XCH field to a new value.
  278. #define BW_ECSPI_CONREG_XCH(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_XCH) | BF_ECSPI_CONREG_XCH(v)))
  279. #endif
  280. //@}
  281. /*! @name Register ECSPI_CONREG, field SMC[3] (RW)
  282. *
  283. * Start Mode Control. This bit applies only to channels configured in Master mode (CHANNEL MODE =
  284. * 1). It controls how the ECSPI starts a SPI burst, either through the SPI exchange bit, or
  285. * immediately when the TXFIFO is written to.
  286. *
  287. * Values:
  288. * - 0 - SPI Exchange Bit (XCH) controls when a SPI burst can start. Setting the XCH bit will start a SPI
  289. * burst or multiple bursts. This is controlled by the SPI SS Wave Form Select (SS_CTL). Refer
  290. * to XCH and SS_CTL descriptions.
  291. * - 1 - Immediately starts a SPI burst when data is written in TXFIFO.
  292. */
  293. //@{
  294. #define BP_ECSPI_CONREG_SMC (3) //!< Bit position for ECSPI_CONREG_SMC.
  295. #define BM_ECSPI_CONREG_SMC (0x00000008) //!< Bit mask for ECSPI_CONREG_SMC.
  296. //! @brief Get value of ECSPI_CONREG_SMC from a register value.
  297. #define BG_ECSPI_CONREG_SMC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_SMC) >> BP_ECSPI_CONREG_SMC)
  298. //! @brief Format value for bitfield ECSPI_CONREG_SMC.
  299. #define BF_ECSPI_CONREG_SMC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_SMC) & BM_ECSPI_CONREG_SMC)
  300. #ifndef __LANGUAGE_ASM__
  301. //! @brief Set the SMC field to a new value.
  302. #define BW_ECSPI_CONREG_SMC(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_SMC) | BF_ECSPI_CONREG_SMC(v)))
  303. #endif
  304. //@}
  305. /*! @name Register ECSPI_CONREG, field CHANNEL_MODE[7:4] (RW)
  306. *
  307. * SPI CHANNEL MODE selects the mode for each SPI channel. CHANNEL MODE[3] is for SPI channel 3.
  308. * CHANNEL MODE[2] is for SPI channel 2. CHANNEL MODE[1] is for SPI channel 1. CHANNEL MODE[0] is
  309. * for SPI channel 0.
  310. *
  311. * Values:
  312. * - 0 - Slave mode.
  313. * - 1 - Master mode.
  314. */
  315. //@{
  316. #define BP_ECSPI_CONREG_CHANNEL_MODE (4) //!< Bit position for ECSPI_CONREG_CHANNEL_MODE.
  317. #define BM_ECSPI_CONREG_CHANNEL_MODE (0x000000f0) //!< Bit mask for ECSPI_CONREG_CHANNEL_MODE.
  318. //! @brief Get value of ECSPI_CONREG_CHANNEL_MODE from a register value.
  319. #define BG_ECSPI_CONREG_CHANNEL_MODE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_CHANNEL_MODE) >> BP_ECSPI_CONREG_CHANNEL_MODE)
  320. //! @brief Format value for bitfield ECSPI_CONREG_CHANNEL_MODE.
  321. #define BF_ECSPI_CONREG_CHANNEL_MODE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_CHANNEL_MODE) & BM_ECSPI_CONREG_CHANNEL_MODE)
  322. #ifndef __LANGUAGE_ASM__
  323. //! @brief Set the CHANNEL_MODE field to a new value.
  324. #define BW_ECSPI_CONREG_CHANNEL_MODE(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_CHANNEL_MODE) | BF_ECSPI_CONREG_CHANNEL_MODE(v)))
  325. #endif
  326. //@}
  327. /*! @name Register ECSPI_CONREG, field POST_DIVIDER[11:8] (RW)
  328. *
  329. * SPI Post Divider. ECSPI uses a two-stage divider to generate the SPI clock. This field defines
  330. * the post-divider of the reference clock using the equation: 2 n .
  331. *
  332. * Values:
  333. * - 0000 - Divide by 1.
  334. * - ... -
  335. * - 0001 - Divide by 2.
  336. * - 0010 - Divide by 4.
  337. * - 1110 - Divide by 2 14 .
  338. * - 1111 - Divide by 2 15 .
  339. */
  340. //@{
  341. #define BP_ECSPI_CONREG_POST_DIVIDER (8) //!< Bit position for ECSPI_CONREG_POST_DIVIDER.
  342. #define BM_ECSPI_CONREG_POST_DIVIDER (0x00000f00) //!< Bit mask for ECSPI_CONREG_POST_DIVIDER.
  343. //! @brief Get value of ECSPI_CONREG_POST_DIVIDER from a register value.
  344. #define BG_ECSPI_CONREG_POST_DIVIDER(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_POST_DIVIDER) >> BP_ECSPI_CONREG_POST_DIVIDER)
  345. //! @brief Format value for bitfield ECSPI_CONREG_POST_DIVIDER.
  346. #define BF_ECSPI_CONREG_POST_DIVIDER(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_POST_DIVIDER) & BM_ECSPI_CONREG_POST_DIVIDER)
  347. #ifndef __LANGUAGE_ASM__
  348. //! @brief Set the POST_DIVIDER field to a new value.
  349. #define BW_ECSPI_CONREG_POST_DIVIDER(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_POST_DIVIDER) | BF_ECSPI_CONREG_POST_DIVIDER(v)))
  350. #endif
  351. //@}
  352. /*! @name Register ECSPI_CONREG, field PRE_DIVIDER[15:12] (RW)
  353. *
  354. * SPI Pre Divider. ECSPI uses a two-stage divider to generate the SPI clock. This field defines the
  355. * pre-divider of the reference clock.
  356. *
  357. * Values:
  358. * - 0000 - Divide by 1.
  359. * - ... -
  360. * - 0001 - Divide by 2.
  361. * - 0010 - Divide by 3.
  362. * - 1101 - Divide by 14.
  363. * - 1110 - Divide by 15.
  364. * - 1111 - Divide by 16.
  365. */
  366. //@{
  367. #define BP_ECSPI_CONREG_PRE_DIVIDER (12) //!< Bit position for ECSPI_CONREG_PRE_DIVIDER.
  368. #define BM_ECSPI_CONREG_PRE_DIVIDER (0x0000f000) //!< Bit mask for ECSPI_CONREG_PRE_DIVIDER.
  369. //! @brief Get value of ECSPI_CONREG_PRE_DIVIDER from a register value.
  370. #define BG_ECSPI_CONREG_PRE_DIVIDER(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_PRE_DIVIDER) >> BP_ECSPI_CONREG_PRE_DIVIDER)
  371. //! @brief Format value for bitfield ECSPI_CONREG_PRE_DIVIDER.
  372. #define BF_ECSPI_CONREG_PRE_DIVIDER(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_PRE_DIVIDER) & BM_ECSPI_CONREG_PRE_DIVIDER)
  373. #ifndef __LANGUAGE_ASM__
  374. //! @brief Set the PRE_DIVIDER field to a new value.
  375. #define BW_ECSPI_CONREG_PRE_DIVIDER(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_PRE_DIVIDER) | BF_ECSPI_CONREG_PRE_DIVIDER(v)))
  376. #endif
  377. //@}
  378. /*! @name Register ECSPI_CONREG, field DRCTL[17:16] (RW)
  379. *
  380. * SPI Data Ready Control. This field selects the utilization of the SPI_RDY signal in master mode.
  381. * ECSPI checks this field before it starts an SPI burst.
  382. *
  383. * Values:
  384. * - 00 - The SPI_RDY signal is a don't care.
  385. * - 01 - Burst will be triggered by the falling edge of the SPI_RDY signal (edge-triggered).
  386. * - 10 - Burst will be triggered by a low level of the SPI_RDY signal (level-triggered).
  387. * - 11 - Reserved.
  388. */
  389. //@{
  390. #define BP_ECSPI_CONREG_DRCTL (16) //!< Bit position for ECSPI_CONREG_DRCTL.
  391. #define BM_ECSPI_CONREG_DRCTL (0x00030000) //!< Bit mask for ECSPI_CONREG_DRCTL.
  392. //! @brief Get value of ECSPI_CONREG_DRCTL from a register value.
  393. #define BG_ECSPI_CONREG_DRCTL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_DRCTL) >> BP_ECSPI_CONREG_DRCTL)
  394. //! @brief Format value for bitfield ECSPI_CONREG_DRCTL.
  395. #define BF_ECSPI_CONREG_DRCTL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_DRCTL) & BM_ECSPI_CONREG_DRCTL)
  396. #ifndef __LANGUAGE_ASM__
  397. //! @brief Set the DRCTL field to a new value.
  398. #define BW_ECSPI_CONREG_DRCTL(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_DRCTL) | BF_ECSPI_CONREG_DRCTL(v)))
  399. #endif
  400. //@}
  401. /*! @name Register ECSPI_CONREG, field CHANNEL_SELECT[19:18] (RW)
  402. *
  403. * SPI CHANNEL SELECT bits. Select one of four external SPI Master/Slave Devices. In master mode,
  404. * these two bits select the external slave devices by asserting the Chip Select (SSn) outputs. Only
  405. * the selected Chip Select (SSn) signal can be active at a given time; the remaining three signals
  406. * will be negated.
  407. *
  408. * Values:
  409. * - 00 - Channel 0 is selected. Chip Select 0 (SS0) will be asserted.
  410. * - 01 - Channel 1 is selected. Chip Select 1 (SS1) will be asserted.
  411. * - 10 - Channel 2 is selected. Chip Select 2 (SS2) will be asserted.
  412. * - 11 - Channel 3 is selected. Chip Select 3 (SS3) will be asserted.
  413. */
  414. //@{
  415. #define BP_ECSPI_CONREG_CHANNEL_SELECT (18) //!< Bit position for ECSPI_CONREG_CHANNEL_SELECT.
  416. #define BM_ECSPI_CONREG_CHANNEL_SELECT (0x000c0000) //!< Bit mask for ECSPI_CONREG_CHANNEL_SELECT.
  417. //! @brief Get value of ECSPI_CONREG_CHANNEL_SELECT from a register value.
  418. #define BG_ECSPI_CONREG_CHANNEL_SELECT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_CHANNEL_SELECT) >> BP_ECSPI_CONREG_CHANNEL_SELECT)
  419. //! @brief Format value for bitfield ECSPI_CONREG_CHANNEL_SELECT.
  420. #define BF_ECSPI_CONREG_CHANNEL_SELECT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_CHANNEL_SELECT) & BM_ECSPI_CONREG_CHANNEL_SELECT)
  421. #ifndef __LANGUAGE_ASM__
  422. //! @brief Set the CHANNEL_SELECT field to a new value.
  423. #define BW_ECSPI_CONREG_CHANNEL_SELECT(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_CHANNEL_SELECT) | BF_ECSPI_CONREG_CHANNEL_SELECT(v)))
  424. #endif
  425. //@}
  426. /*! @name Register ECSPI_CONREG, field BURST_LENGTH[31:20] (RW)
  427. *
  428. * Burst Length. This field defines the length of a SPI burst to be transferred. The Chip Select
  429. * (SS) will remain asserted until all bits in a SPI burst are shifted out. A maximum of 2^12 bits
  430. * can be transferred in a single SPI burst. In master mode, it controls the number of bits per SPI
  431. * burst. Since the shift register always loads 32-bit data from transmit FIFO, only the n least-
  432. * significant (n = BURST LENGTH + 1) will be shifted out. The remaining bits will be ignored. In
  433. * slave mode, only when SS_CTL is cleared, this field will take effect in the transfer. Number of
  434. * Valid Bits in a SPI burst.
  435. *
  436. * Values:
  437. * - 0x000 - A SPI burst contains the 1 LSB in a word.
  438. * - ... -
  439. * - ... -
  440. * - 0x001 - A SPI burst contains the 2 LSB in a word.
  441. * - 0x002 - A SPI burst contains the 3 LSB in a word.
  442. * - 0x01F - A SPI burst contains all 32 bits in a word.
  443. * - 0x020 - A SPI burst contains the 1 LSB in first word and all 32 bits in second word.
  444. * - 0x021 - A SPI burst contains the 2 LSB in first word and all 32 bits in second word.
  445. * - 0xFFE - A SPI burst contains the 31 LSB in first word and 2^7 -1 words.
  446. * - 0xFFF - A SPI burst contains 2^7 words.
  447. */
  448. //@{
  449. #define BP_ECSPI_CONREG_BURST_LENGTH (20) //!< Bit position for ECSPI_CONREG_BURST_LENGTH.
  450. #define BM_ECSPI_CONREG_BURST_LENGTH (0xfff00000) //!< Bit mask for ECSPI_CONREG_BURST_LENGTH.
  451. //! @brief Get value of ECSPI_CONREG_BURST_LENGTH from a register value.
  452. #define BG_ECSPI_CONREG_BURST_LENGTH(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONREG_BURST_LENGTH) >> BP_ECSPI_CONREG_BURST_LENGTH)
  453. //! @brief Format value for bitfield ECSPI_CONREG_BURST_LENGTH.
  454. #define BF_ECSPI_CONREG_BURST_LENGTH(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONREG_BURST_LENGTH) & BM_ECSPI_CONREG_BURST_LENGTH)
  455. #ifndef __LANGUAGE_ASM__
  456. //! @brief Set the BURST_LENGTH field to a new value.
  457. #define BW_ECSPI_CONREG_BURST_LENGTH(x, v) (HW_ECSPI_CONREG_WR(x, (HW_ECSPI_CONREG_RD(x) & ~BM_ECSPI_CONREG_BURST_LENGTH) | BF_ECSPI_CONREG_BURST_LENGTH(v)))
  458. #endif
  459. //@}
  460. //-------------------------------------------------------------------------------------------
  461. // HW_ECSPI_CONFIGREG - Config Register
  462. //-------------------------------------------------------------------------------------------
  463. #ifndef __LANGUAGE_ASM__
  464. /*!
  465. * @brief HW_ECSPI_CONFIGREG - Config Register (RW)
  466. *
  467. * Reset value: 0x00000000
  468. *
  469. * The Config Register (ECSPI_CONFIGREG) allows software to configure each SPI channel, configure
  470. * its operating modes, specify the phase and polarity of the clock, configure the Chip Select (SS),
  471. * and define the HT transfer length. Note, HT mode is not supported by this product.
  472. */
  473. typedef union _hw_ecspi_configreg
  474. {
  475. reg32_t U;
  476. struct _hw_ecspi_configreg_bitfields
  477. {
  478. unsigned SCLK_PHA : 4; //!< [3:0] SPI Clock/Data Phase Control.
  479. unsigned SCLK_POL : 4; //!< [7:4] SPI Clock Polarity Control.
  480. unsigned SS_CTL : 4; //!< [11:8] SPI SS Wave Form Select.
  481. unsigned SS_POL : 4; //!< [15:12] SPI SS Polarity Select.
  482. unsigned DATA_CTL : 4; //!< [19:16] DATA CTL.
  483. unsigned SCLK_CTL : 4; //!< [23:20] SCLK CTL.
  484. unsigned HT_LENGTH : 5; //!< [28:24] HT LENGTH.
  485. unsigned RESERVED0 : 3; //!< [31:29] Reserved
  486. } B;
  487. } hw_ecspi_configreg_t;
  488. #endif
  489. /*!
  490. * @name Constants and macros for entire ECSPI_CONFIGREG register
  491. */
  492. //@{
  493. #define HW_ECSPI_CONFIGREG_ADDR(x) (REGS_ECSPI_BASE(x) + 0xc)
  494. #ifndef __LANGUAGE_ASM__
  495. #define HW_ECSPI_CONFIGREG(x) (*(volatile hw_ecspi_configreg_t *) HW_ECSPI_CONFIGREG_ADDR(x))
  496. #define HW_ECSPI_CONFIGREG_RD(x) (HW_ECSPI_CONFIGREG(x).U)
  497. #define HW_ECSPI_CONFIGREG_WR(x, v) (HW_ECSPI_CONFIGREG(x).U = (v))
  498. #define HW_ECSPI_CONFIGREG_SET(x, v) (HW_ECSPI_CONFIGREG_WR(x, HW_ECSPI_CONFIGREG_RD(x) | (v)))
  499. #define HW_ECSPI_CONFIGREG_CLR(x, v) (HW_ECSPI_CONFIGREG_WR(x, HW_ECSPI_CONFIGREG_RD(x) & ~(v)))
  500. #define HW_ECSPI_CONFIGREG_TOG(x, v) (HW_ECSPI_CONFIGREG_WR(x, HW_ECSPI_CONFIGREG_RD(x) ^ (v)))
  501. #endif
  502. //@}
  503. /*
  504. * constants & macros for individual ECSPI_CONFIGREG bitfields
  505. */
  506. /*! @name Register ECSPI_CONFIGREG, field SCLK_PHA[3:0] (RW)
  507. *
  508. * SPI Clock/Data Phase Control. This field controls the clock/data phase relationship. See for more
  509. * information. SCLK PHA[3] is for SPI channel 3. SCLK PHA[2] is for SPI channel 2. SCLK PHA[1] is
  510. * for SPI channel 1. SCLK PHA[0] is for SPI channel 0.
  511. *
  512. * Values:
  513. * - 0 - Phase 0 operation.
  514. * - 1 - Phase 1 operation.
  515. */
  516. //@{
  517. #define BP_ECSPI_CONFIGREG_SCLK_PHA (0) //!< Bit position for ECSPI_CONFIGREG_SCLK_PHA.
  518. #define BM_ECSPI_CONFIGREG_SCLK_PHA (0x0000000f) //!< Bit mask for ECSPI_CONFIGREG_SCLK_PHA.
  519. //! @brief Get value of ECSPI_CONFIGREG_SCLK_PHA from a register value.
  520. #define BG_ECSPI_CONFIGREG_SCLK_PHA(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SCLK_PHA) >> BP_ECSPI_CONFIGREG_SCLK_PHA)
  521. //! @brief Format value for bitfield ECSPI_CONFIGREG_SCLK_PHA.
  522. #define BF_ECSPI_CONFIGREG_SCLK_PHA(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SCLK_PHA) & BM_ECSPI_CONFIGREG_SCLK_PHA)
  523. #ifndef __LANGUAGE_ASM__
  524. //! @brief Set the SCLK_PHA field to a new value.
  525. #define BW_ECSPI_CONFIGREG_SCLK_PHA(x, v) (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SCLK_PHA) | BF_ECSPI_CONFIGREG_SCLK_PHA(v)))
  526. #endif
  527. //@}
  528. /*! @name Register ECSPI_CONFIGREG, field SCLK_POL[7:4] (RW)
  529. *
  530. * SPI Clock Polarity Control. This field controls the polarity of the SCLK signal. See for more
  531. * information. SCLK_POL[3] is for SPI channel 3. SCLK_POL[2] is for SPI channel 2. SCLK_POL[1] is
  532. * for SPI channel 1. SCLK_POL[0] is for SPI channel 0.
  533. *
  534. * Values:
  535. * - 0 - Active high polarity (0 = Idle).
  536. * - 1 - Active low polarity (1 = Idle).
  537. */
  538. //@{
  539. #define BP_ECSPI_CONFIGREG_SCLK_POL (4) //!< Bit position for ECSPI_CONFIGREG_SCLK_POL.
  540. #define BM_ECSPI_CONFIGREG_SCLK_POL (0x000000f0) //!< Bit mask for ECSPI_CONFIGREG_SCLK_POL.
  541. //! @brief Get value of ECSPI_CONFIGREG_SCLK_POL from a register value.
  542. #define BG_ECSPI_CONFIGREG_SCLK_POL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SCLK_POL) >> BP_ECSPI_CONFIGREG_SCLK_POL)
  543. //! @brief Format value for bitfield ECSPI_CONFIGREG_SCLK_POL.
  544. #define BF_ECSPI_CONFIGREG_SCLK_POL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SCLK_POL) & BM_ECSPI_CONFIGREG_SCLK_POL)
  545. #ifndef __LANGUAGE_ASM__
  546. //! @brief Set the SCLK_POL field to a new value.
  547. #define BW_ECSPI_CONFIGREG_SCLK_POL(x, v) (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SCLK_POL) | BF_ECSPI_CONFIGREG_SCLK_POL(v)))
  548. #endif
  549. //@}
  550. /*! @name Register ECSPI_CONFIGREG, field SS_CTL[11:8] (RW)
  551. *
  552. * SPI SS Wave Form Select. In master mode, this field controls the output wave form of the Chip
  553. * Select (SS) signal when the SMC (Start Mode Control) bit is cleared. The SS_CTL are ignored if
  554. * the SMC bit is set. SS CTL[3] is for SPI channel 3. SS CTL[2] is for SPI channel 2. SS CTL[1] is
  555. * for SPI channel 1. SS CTL[0] is for SPI channel 0. In slave mode, this bit controls when the SPI
  556. * burst is completed. An SPI burst is completed by the Chip Select (SS) signal edges. (SSPOL = 0:
  557. * rising edge; SSPOL = 1: falling edge) The RXFIFO is advanced whenever a Chip Select (SS) signal
  558. * edge is detected or the shift register contains 32-bits of valid data.
  559. *
  560. * Values:
  561. * - 0 - In master mode - only one SPI burst will be transmitted.
  562. * - 0 - In slave mode - an SPI burst is completed when the number of bits received in the shift register is
  563. * equal to (BURST LENGTH + 1). Only the n least-significant bits (n = BURST LENGTH[4:0] + 1) of
  564. * the first received word are valid. All bits subsequent to the first received word in RXFIFO
  565. * are valid.
  566. * - 1 - In master mode - Negate Chip Select (SS) signal between SPI bursts. Multiple SPI bursts will be
  567. * transmitted. The SPI transfer will automatically stop when the TXFIFO is empty.
  568. * - 1 - In slave mode - an SPI burst is completed by the Chip Select (SS) signal edges. (SSPOL = 0: rising
  569. * edge; SSPOL = 1: falling edge) The RXFIFO is advanced whenever a Chip Select (SS) signal edge
  570. * is detected or the shift register contains 32-bits of valid data.
  571. */
  572. //@{
  573. #define BP_ECSPI_CONFIGREG_SS_CTL (8) //!< Bit position for ECSPI_CONFIGREG_SS_CTL.
  574. #define BM_ECSPI_CONFIGREG_SS_CTL (0x00000f00) //!< Bit mask for ECSPI_CONFIGREG_SS_CTL.
  575. //! @brief Get value of ECSPI_CONFIGREG_SS_CTL from a register value.
  576. #define BG_ECSPI_CONFIGREG_SS_CTL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SS_CTL) >> BP_ECSPI_CONFIGREG_SS_CTL)
  577. //! @brief Format value for bitfield ECSPI_CONFIGREG_SS_CTL.
  578. #define BF_ECSPI_CONFIGREG_SS_CTL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SS_CTL) & BM_ECSPI_CONFIGREG_SS_CTL)
  579. #ifndef __LANGUAGE_ASM__
  580. //! @brief Set the SS_CTL field to a new value.
  581. #define BW_ECSPI_CONFIGREG_SS_CTL(x, v) (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SS_CTL) | BF_ECSPI_CONFIGREG_SS_CTL(v)))
  582. #endif
  583. //@}
  584. /*! @name Register ECSPI_CONFIGREG, field SS_POL[15:12] (RW)
  585. *
  586. * SPI SS Polarity Select. In both Master and Slave modes, this field selects the polarity of the
  587. * Chip Select (SS) signal. SS POL[3] is for SPI channel 3. SS POL[2] is for SPI channel 2. SS
  588. * POL[1] is for SPI channel 1. SS POL[0] is for SPI channel 0.
  589. *
  590. * Values:
  591. * - 0 - Active low.
  592. * - 1 - Active high.
  593. */
  594. //@{
  595. #define BP_ECSPI_CONFIGREG_SS_POL (12) //!< Bit position for ECSPI_CONFIGREG_SS_POL.
  596. #define BM_ECSPI_CONFIGREG_SS_POL (0x0000f000) //!< Bit mask for ECSPI_CONFIGREG_SS_POL.
  597. //! @brief Get value of ECSPI_CONFIGREG_SS_POL from a register value.
  598. #define BG_ECSPI_CONFIGREG_SS_POL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SS_POL) >> BP_ECSPI_CONFIGREG_SS_POL)
  599. //! @brief Format value for bitfield ECSPI_CONFIGREG_SS_POL.
  600. #define BF_ECSPI_CONFIGREG_SS_POL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SS_POL) & BM_ECSPI_CONFIGREG_SS_POL)
  601. #ifndef __LANGUAGE_ASM__
  602. //! @brief Set the SS_POL field to a new value.
  603. #define BW_ECSPI_CONFIGREG_SS_POL(x, v) (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SS_POL) | BF_ECSPI_CONFIGREG_SS_POL(v)))
  604. #endif
  605. //@}
  606. /*! @name Register ECSPI_CONFIGREG, field DATA_CTL[19:16] (RW)
  607. *
  608. * DATA CTL. This field controls inactive state of the data line for each SPI channel. DATA CTL[3]
  609. * is for SPI channel 3. DATA CTL[2] is for SPI channel 2. DATA CTL[1] is for SPI channel 1. DATA
  610. * CTL[0] is for SPI channel 0.
  611. *
  612. * Values:
  613. * - 0 - Stay high.
  614. * - 1 - Stay low.
  615. */
  616. //@{
  617. #define BP_ECSPI_CONFIGREG_DATA_CTL (16) //!< Bit position for ECSPI_CONFIGREG_DATA_CTL.
  618. #define BM_ECSPI_CONFIGREG_DATA_CTL (0x000f0000) //!< Bit mask for ECSPI_CONFIGREG_DATA_CTL.
  619. //! @brief Get value of ECSPI_CONFIGREG_DATA_CTL from a register value.
  620. #define BG_ECSPI_CONFIGREG_DATA_CTL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_DATA_CTL) >> BP_ECSPI_CONFIGREG_DATA_CTL)
  621. //! @brief Format value for bitfield ECSPI_CONFIGREG_DATA_CTL.
  622. #define BF_ECSPI_CONFIGREG_DATA_CTL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_DATA_CTL) & BM_ECSPI_CONFIGREG_DATA_CTL)
  623. #ifndef __LANGUAGE_ASM__
  624. //! @brief Set the DATA_CTL field to a new value.
  625. #define BW_ECSPI_CONFIGREG_DATA_CTL(x, v) (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_DATA_CTL) | BF_ECSPI_CONFIGREG_DATA_CTL(v)))
  626. #endif
  627. //@}
  628. /*! @name Register ECSPI_CONFIGREG, field SCLK_CTL[23:20] (RW)
  629. *
  630. * SCLK CTL. This field controls the inactive state of SCLK for each SPI channel. SCLK CTL[3] is for
  631. * SPI channel 3. SCLK CTL[2] is for SPI channel 2. SCLK CTL[1] is for SPI channel 1. SCLK CTL[0] is
  632. * for SPI channel 0.
  633. *
  634. * Values:
  635. * - 0 - Stay low.
  636. * - 1 - Stay high.
  637. */
  638. //@{
  639. #define BP_ECSPI_CONFIGREG_SCLK_CTL (20) //!< Bit position for ECSPI_CONFIGREG_SCLK_CTL.
  640. #define BM_ECSPI_CONFIGREG_SCLK_CTL (0x00f00000) //!< Bit mask for ECSPI_CONFIGREG_SCLK_CTL.
  641. //! @brief Get value of ECSPI_CONFIGREG_SCLK_CTL from a register value.
  642. #define BG_ECSPI_CONFIGREG_SCLK_CTL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_SCLK_CTL) >> BP_ECSPI_CONFIGREG_SCLK_CTL)
  643. //! @brief Format value for bitfield ECSPI_CONFIGREG_SCLK_CTL.
  644. #define BF_ECSPI_CONFIGREG_SCLK_CTL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_SCLK_CTL) & BM_ECSPI_CONFIGREG_SCLK_CTL)
  645. #ifndef __LANGUAGE_ASM__
  646. //! @brief Set the SCLK_CTL field to a new value.
  647. #define BW_ECSPI_CONFIGREG_SCLK_CTL(x, v) (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_SCLK_CTL) | BF_ECSPI_CONFIGREG_SCLK_CTL(v)))
  648. #endif
  649. //@}
  650. /*! @name Register ECSPI_CONFIGREG, field HT_LENGTH[28:24] (RW)
  651. *
  652. * HT LENGTH. This field defines the message length in HT Mode. Note, HT mode is not supported by
  653. * this product. The length in bits of one message is (HT LENGTH + 1).
  654. */
  655. //@{
  656. #define BP_ECSPI_CONFIGREG_HT_LENGTH (24) //!< Bit position for ECSPI_CONFIGREG_HT_LENGTH.
  657. #define BM_ECSPI_CONFIGREG_HT_LENGTH (0x1f000000) //!< Bit mask for ECSPI_CONFIGREG_HT_LENGTH.
  658. //! @brief Get value of ECSPI_CONFIGREG_HT_LENGTH from a register value.
  659. #define BG_ECSPI_CONFIGREG_HT_LENGTH(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_CONFIGREG_HT_LENGTH) >> BP_ECSPI_CONFIGREG_HT_LENGTH)
  660. //! @brief Format value for bitfield ECSPI_CONFIGREG_HT_LENGTH.
  661. #define BF_ECSPI_CONFIGREG_HT_LENGTH(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_CONFIGREG_HT_LENGTH) & BM_ECSPI_CONFIGREG_HT_LENGTH)
  662. #ifndef __LANGUAGE_ASM__
  663. //! @brief Set the HT_LENGTH field to a new value.
  664. #define BW_ECSPI_CONFIGREG_HT_LENGTH(x, v) (HW_ECSPI_CONFIGREG_WR(x, (HW_ECSPI_CONFIGREG_RD(x) & ~BM_ECSPI_CONFIGREG_HT_LENGTH) | BF_ECSPI_CONFIGREG_HT_LENGTH(v)))
  665. #endif
  666. //@}
  667. //-------------------------------------------------------------------------------------------
  668. // HW_ECSPI_INTREG - Interrupt Control Register
  669. //-------------------------------------------------------------------------------------------
  670. #ifndef __LANGUAGE_ASM__
  671. /*!
  672. * @brief HW_ECSPI_INTREG - Interrupt Control Register (RW)
  673. *
  674. * Reset value: 0x00000000
  675. *
  676. * The Interrupt Control Register (ECSPI_INTREG) enables the generation of interrupts to the host
  677. * processor. If the ECSPI is disabled, this register reads zero.
  678. */
  679. typedef union _hw_ecspi_intreg
  680. {
  681. reg32_t U;
  682. struct _hw_ecspi_intreg_bitfields
  683. {
  684. unsigned TEEN : 1; //!< [0] TXFIFO Empty Interrupt enable.
  685. unsigned TDREN : 1; //!< [1] TXFIFO Data Request Interrupt enable.
  686. unsigned TFEN : 1; //!< [2] TXFIFO Full Interrupt enable.
  687. unsigned RREN : 1; //!< [3] RXFIFO Ready Interrupt enable.
  688. unsigned RDREN : 1; //!< [4] RXFIFO Data Request Interrupt enable.
  689. unsigned RFEN : 1; //!< [5] RXFIFO Full Interrupt enable.
  690. unsigned ROEN : 1; //!< [6] RXFIFO Overflow Interrupt enable.
  691. unsigned TCEN : 1; //!< [7] Transfer Completed Interrupt enable.
  692. unsigned RESERVED0 : 24; //!< [31:8] Reserved
  693. } B;
  694. } hw_ecspi_intreg_t;
  695. #endif
  696. /*!
  697. * @name Constants and macros for entire ECSPI_INTREG register
  698. */
  699. //@{
  700. #define HW_ECSPI_INTREG_ADDR(x) (REGS_ECSPI_BASE(x) + 0x10)
  701. #ifndef __LANGUAGE_ASM__
  702. #define HW_ECSPI_INTREG(x) (*(volatile hw_ecspi_intreg_t *) HW_ECSPI_INTREG_ADDR(x))
  703. #define HW_ECSPI_INTREG_RD(x) (HW_ECSPI_INTREG(x).U)
  704. #define HW_ECSPI_INTREG_WR(x, v) (HW_ECSPI_INTREG(x).U = (v))
  705. #define HW_ECSPI_INTREG_SET(x, v) (HW_ECSPI_INTREG_WR(x, HW_ECSPI_INTREG_RD(x) | (v)))
  706. #define HW_ECSPI_INTREG_CLR(x, v) (HW_ECSPI_INTREG_WR(x, HW_ECSPI_INTREG_RD(x) & ~(v)))
  707. #define HW_ECSPI_INTREG_TOG(x, v) (HW_ECSPI_INTREG_WR(x, HW_ECSPI_INTREG_RD(x) ^ (v)))
  708. #endif
  709. //@}
  710. /*
  711. * constants & macros for individual ECSPI_INTREG bitfields
  712. */
  713. /*! @name Register ECSPI_INTREG, field TEEN[0] (RW)
  714. *
  715. * TXFIFO Empty Interrupt enable. This bit enables the TXFIFO Empty Interrupt.
  716. *
  717. * Values:
  718. * - 0 - Disable
  719. * - 1 - Enable
  720. */
  721. //@{
  722. #define BP_ECSPI_INTREG_TEEN (0) //!< Bit position for ECSPI_INTREG_TEEN.
  723. #define BM_ECSPI_INTREG_TEEN (0x00000001) //!< Bit mask for ECSPI_INTREG_TEEN.
  724. //! @brief Get value of ECSPI_INTREG_TEEN from a register value.
  725. #define BG_ECSPI_INTREG_TEEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_TEEN) >> BP_ECSPI_INTREG_TEEN)
  726. //! @brief Format value for bitfield ECSPI_INTREG_TEEN.
  727. #define BF_ECSPI_INTREG_TEEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_TEEN) & BM_ECSPI_INTREG_TEEN)
  728. #ifndef __LANGUAGE_ASM__
  729. //! @brief Set the TEEN field to a new value.
  730. #define BW_ECSPI_INTREG_TEEN(x, v) (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_TEEN) | BF_ECSPI_INTREG_TEEN(v)))
  731. #endif
  732. //@}
  733. /*! @name Register ECSPI_INTREG, field TDREN[1] (RW)
  734. *
  735. * TXFIFO Data Request Interrupt enable. This bit enables the TXFIFO Data Request Interrupt when the
  736. * number of data entries in the TXFIFO is less than or equal to TX_THRESHOLD.
  737. *
  738. * Values:
  739. * - 0 - Disable
  740. * - 1 - Enable
  741. */
  742. //@{
  743. #define BP_ECSPI_INTREG_TDREN (1) //!< Bit position for ECSPI_INTREG_TDREN.
  744. #define BM_ECSPI_INTREG_TDREN (0x00000002) //!< Bit mask for ECSPI_INTREG_TDREN.
  745. //! @brief Get value of ECSPI_INTREG_TDREN from a register value.
  746. #define BG_ECSPI_INTREG_TDREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_TDREN) >> BP_ECSPI_INTREG_TDREN)
  747. //! @brief Format value for bitfield ECSPI_INTREG_TDREN.
  748. #define BF_ECSPI_INTREG_TDREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_TDREN) & BM_ECSPI_INTREG_TDREN)
  749. #ifndef __LANGUAGE_ASM__
  750. //! @brief Set the TDREN field to a new value.
  751. #define BW_ECSPI_INTREG_TDREN(x, v) (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_TDREN) | BF_ECSPI_INTREG_TDREN(v)))
  752. #endif
  753. //@}
  754. /*! @name Register ECSPI_INTREG, field TFEN[2] (RW)
  755. *
  756. * TXFIFO Full Interrupt enable. This bit enables the TXFIFO Full Interrupt.
  757. *
  758. * Values:
  759. * - 0 - Disable
  760. * - 1 - Enable
  761. */
  762. //@{
  763. #define BP_ECSPI_INTREG_TFEN (2) //!< Bit position for ECSPI_INTREG_TFEN.
  764. #define BM_ECSPI_INTREG_TFEN (0x00000004) //!< Bit mask for ECSPI_INTREG_TFEN.
  765. //! @brief Get value of ECSPI_INTREG_TFEN from a register value.
  766. #define BG_ECSPI_INTREG_TFEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_TFEN) >> BP_ECSPI_INTREG_TFEN)
  767. //! @brief Format value for bitfield ECSPI_INTREG_TFEN.
  768. #define BF_ECSPI_INTREG_TFEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_TFEN) & BM_ECSPI_INTREG_TFEN)
  769. #ifndef __LANGUAGE_ASM__
  770. //! @brief Set the TFEN field to a new value.
  771. #define BW_ECSPI_INTREG_TFEN(x, v) (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_TFEN) | BF_ECSPI_INTREG_TFEN(v)))
  772. #endif
  773. //@}
  774. /*! @name Register ECSPI_INTREG, field RREN[3] (RW)
  775. *
  776. * RXFIFO Ready Interrupt enable. This bit enables the RXFIFO Ready Interrupt.
  777. *
  778. * Values:
  779. * - 0 - Disable
  780. * - 1 - Enable
  781. */
  782. //@{
  783. #define BP_ECSPI_INTREG_RREN (3) //!< Bit position for ECSPI_INTREG_RREN.
  784. #define BM_ECSPI_INTREG_RREN (0x00000008) //!< Bit mask for ECSPI_INTREG_RREN.
  785. //! @brief Get value of ECSPI_INTREG_RREN from a register value.
  786. #define BG_ECSPI_INTREG_RREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_RREN) >> BP_ECSPI_INTREG_RREN)
  787. //! @brief Format value for bitfield ECSPI_INTREG_RREN.
  788. #define BF_ECSPI_INTREG_RREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_RREN) & BM_ECSPI_INTREG_RREN)
  789. #ifndef __LANGUAGE_ASM__
  790. //! @brief Set the RREN field to a new value.
  791. #define BW_ECSPI_INTREG_RREN(x, v) (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_RREN) | BF_ECSPI_INTREG_RREN(v)))
  792. #endif
  793. //@}
  794. /*! @name Register ECSPI_INTREG, field RDREN[4] (RW)
  795. *
  796. * RXFIFO Data Request Interrupt enable. This bit enables the RXFIFO Data Request Interrupt when the
  797. * number of data entries in the RXFIFO is greater than RX_THRESHOLD.
  798. *
  799. * Values:
  800. * - 0 - Disable
  801. * - 1 - Enable
  802. */
  803. //@{
  804. #define BP_ECSPI_INTREG_RDREN (4) //!< Bit position for ECSPI_INTREG_RDREN.
  805. #define BM_ECSPI_INTREG_RDREN (0x00000010) //!< Bit mask for ECSPI_INTREG_RDREN.
  806. //! @brief Get value of ECSPI_INTREG_RDREN from a register value.
  807. #define BG_ECSPI_INTREG_RDREN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_RDREN) >> BP_ECSPI_INTREG_RDREN)
  808. //! @brief Format value for bitfield ECSPI_INTREG_RDREN.
  809. #define BF_ECSPI_INTREG_RDREN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_RDREN) & BM_ECSPI_INTREG_RDREN)
  810. #ifndef __LANGUAGE_ASM__
  811. //! @brief Set the RDREN field to a new value.
  812. #define BW_ECSPI_INTREG_RDREN(x, v) (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_RDREN) | BF_ECSPI_INTREG_RDREN(v)))
  813. #endif
  814. //@}
  815. /*! @name Register ECSPI_INTREG, field RFEN[5] (RW)
  816. *
  817. * RXFIFO Full Interrupt enable. This bit enables the RXFIFO Full Interrupt.
  818. *
  819. * Values:
  820. * - 0 - Disable
  821. * - 1 - Enable
  822. */
  823. //@{
  824. #define BP_ECSPI_INTREG_RFEN (5) //!< Bit position for ECSPI_INTREG_RFEN.
  825. #define BM_ECSPI_INTREG_RFEN (0x00000020) //!< Bit mask for ECSPI_INTREG_RFEN.
  826. //! @brief Get value of ECSPI_INTREG_RFEN from a register value.
  827. #define BG_ECSPI_INTREG_RFEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_RFEN) >> BP_ECSPI_INTREG_RFEN)
  828. //! @brief Format value for bitfield ECSPI_INTREG_RFEN.
  829. #define BF_ECSPI_INTREG_RFEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_RFEN) & BM_ECSPI_INTREG_RFEN)
  830. #ifndef __LANGUAGE_ASM__
  831. //! @brief Set the RFEN field to a new value.
  832. #define BW_ECSPI_INTREG_RFEN(x, v) (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_RFEN) | BF_ECSPI_INTREG_RFEN(v)))
  833. #endif
  834. //@}
  835. /*! @name Register ECSPI_INTREG, field ROEN[6] (RW)
  836. *
  837. * RXFIFO Overflow Interrupt enable. This bit enables the RXFIFO Overflow Interrupt.
  838. *
  839. * Values:
  840. * - 0 - Disable
  841. * - 1 - Enable
  842. */
  843. //@{
  844. #define BP_ECSPI_INTREG_ROEN (6) //!< Bit position for ECSPI_INTREG_ROEN.
  845. #define BM_ECSPI_INTREG_ROEN (0x00000040) //!< Bit mask for ECSPI_INTREG_ROEN.
  846. //! @brief Get value of ECSPI_INTREG_ROEN from a register value.
  847. #define BG_ECSPI_INTREG_ROEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_ROEN) >> BP_ECSPI_INTREG_ROEN)
  848. //! @brief Format value for bitfield ECSPI_INTREG_ROEN.
  849. #define BF_ECSPI_INTREG_ROEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_ROEN) & BM_ECSPI_INTREG_ROEN)
  850. #ifndef __LANGUAGE_ASM__
  851. //! @brief Set the ROEN field to a new value.
  852. #define BW_ECSPI_INTREG_ROEN(x, v) (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_ROEN) | BF_ECSPI_INTREG_ROEN(v)))
  853. #endif
  854. //@}
  855. /*! @name Register ECSPI_INTREG, field TCEN[7] (RW)
  856. *
  857. * Transfer Completed Interrupt enable. This bit enables the Transfer Completed Interrupt.
  858. *
  859. * Values:
  860. * - 0 - Disable
  861. * - 1 - Enable
  862. */
  863. //@{
  864. #define BP_ECSPI_INTREG_TCEN (7) //!< Bit position for ECSPI_INTREG_TCEN.
  865. #define BM_ECSPI_INTREG_TCEN (0x00000080) //!< Bit mask for ECSPI_INTREG_TCEN.
  866. //! @brief Get value of ECSPI_INTREG_TCEN from a register value.
  867. #define BG_ECSPI_INTREG_TCEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_INTREG_TCEN) >> BP_ECSPI_INTREG_TCEN)
  868. //! @brief Format value for bitfield ECSPI_INTREG_TCEN.
  869. #define BF_ECSPI_INTREG_TCEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_INTREG_TCEN) & BM_ECSPI_INTREG_TCEN)
  870. #ifndef __LANGUAGE_ASM__
  871. //! @brief Set the TCEN field to a new value.
  872. #define BW_ECSPI_INTREG_TCEN(x, v) (HW_ECSPI_INTREG_WR(x, (HW_ECSPI_INTREG_RD(x) & ~BM_ECSPI_INTREG_TCEN) | BF_ECSPI_INTREG_TCEN(v)))
  873. #endif
  874. //@}
  875. //-------------------------------------------------------------------------------------------
  876. // HW_ECSPI_DMAREG - DMA Control Register
  877. //-------------------------------------------------------------------------------------------
  878. #ifndef __LANGUAGE_ASM__
  879. /*!
  880. * @brief HW_ECSPI_DMAREG - DMA Control Register (RW)
  881. *
  882. * Reset value: 0x00000000
  883. *
  884. * The Direct Memory Access Control Register (ECSPI_DMAREG) provides software a way to use an on-
  885. * chip DMA controller for ECSPI data. Internal DMA request signals enable direct data transfers
  886. * between the ECSPI FIFOs and system memory. The ECSPI sends out DMA requests when the appropriate
  887. * FIFO conditions are matched. If the ECSPI is disabled, this register is read as 0.
  888. */
  889. typedef union _hw_ecspi_dmareg
  890. {
  891. reg32_t U;
  892. struct _hw_ecspi_dmareg_bitfields
  893. {
  894. unsigned TX_THRESHOLD : 6; //!< [5:0] TX THRESHOLD.
  895. unsigned RESERVED0 : 1; //!< [6] Reserved
  896. unsigned TEDEN : 1; //!< [7] TXFIFO Empty DMA Request Enable.
  897. unsigned RESERVED1 : 8; //!< [15:8] Reserved
  898. unsigned RX_THRESHOLD : 6; //!< [21:16] RX THRESHOLD.
  899. unsigned RESERVED2 : 1; //!< [22] Reserved
  900. unsigned RXDEN : 1; //!< [23] RXFIFO DMA Request Enable.
  901. unsigned RX_DMA_LENGTH : 6; //!< [29:24] RX DMA LENGTH.
  902. unsigned RESERVED3 : 1; //!< [30] Reserved
  903. unsigned RXTDEN : 1; //!< [31] RXFIFO TAIL DMA Request Enable.
  904. } B;
  905. } hw_ecspi_dmareg_t;
  906. #endif
  907. /*!
  908. * @name Constants and macros for entire ECSPI_DMAREG register
  909. */
  910. //@{
  911. #define HW_ECSPI_DMAREG_ADDR(x) (REGS_ECSPI_BASE(x) + 0x14)
  912. #ifndef __LANGUAGE_ASM__
  913. #define HW_ECSPI_DMAREG(x) (*(volatile hw_ecspi_dmareg_t *) HW_ECSPI_DMAREG_ADDR(x))
  914. #define HW_ECSPI_DMAREG_RD(x) (HW_ECSPI_DMAREG(x).U)
  915. #define HW_ECSPI_DMAREG_WR(x, v) (HW_ECSPI_DMAREG(x).U = (v))
  916. #define HW_ECSPI_DMAREG_SET(x, v) (HW_ECSPI_DMAREG_WR(x, HW_ECSPI_DMAREG_RD(x) | (v)))
  917. #define HW_ECSPI_DMAREG_CLR(x, v) (HW_ECSPI_DMAREG_WR(x, HW_ECSPI_DMAREG_RD(x) & ~(v)))
  918. #define HW_ECSPI_DMAREG_TOG(x, v) (HW_ECSPI_DMAREG_WR(x, HW_ECSPI_DMAREG_RD(x) ^ (v)))
  919. #endif
  920. //@}
  921. /*
  922. * constants & macros for individual ECSPI_DMAREG bitfields
  923. */
  924. /*! @name Register ECSPI_DMAREG, field TX_THRESHOLD[5:0] (RW)
  925. *
  926. * TX THRESHOLD. This field defines the FIFO threshold that triggers a TX DMA/INT request. A TX
  927. * DMA/INT request is issued when the number of data entries in the TXFIFO is greater than
  928. * TX_THRESHOLD.
  929. */
  930. //@{
  931. #define BP_ECSPI_DMAREG_TX_THRESHOLD (0) //!< Bit position for ECSPI_DMAREG_TX_THRESHOLD.
  932. #define BM_ECSPI_DMAREG_TX_THRESHOLD (0x0000003f) //!< Bit mask for ECSPI_DMAREG_TX_THRESHOLD.
  933. //! @brief Get value of ECSPI_DMAREG_TX_THRESHOLD from a register value.
  934. #define BG_ECSPI_DMAREG_TX_THRESHOLD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_TX_THRESHOLD) >> BP_ECSPI_DMAREG_TX_THRESHOLD)
  935. //! @brief Format value for bitfield ECSPI_DMAREG_TX_THRESHOLD.
  936. #define BF_ECSPI_DMAREG_TX_THRESHOLD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_TX_THRESHOLD) & BM_ECSPI_DMAREG_TX_THRESHOLD)
  937. #ifndef __LANGUAGE_ASM__
  938. //! @brief Set the TX_THRESHOLD field to a new value.
  939. #define BW_ECSPI_DMAREG_TX_THRESHOLD(x, v) (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_TX_THRESHOLD) | BF_ECSPI_DMAREG_TX_THRESHOLD(v)))
  940. #endif
  941. //@}
  942. /*! @name Register ECSPI_DMAREG, field TEDEN[7] (RW)
  943. *
  944. * TXFIFO Empty DMA Request Enable. This bit enables/disables the TXFIFO Empty DMA Request.
  945. *
  946. * Values:
  947. * - 0 - Disable
  948. * - 1 - Enable
  949. */
  950. //@{
  951. #define BP_ECSPI_DMAREG_TEDEN (7) //!< Bit position for ECSPI_DMAREG_TEDEN.
  952. #define BM_ECSPI_DMAREG_TEDEN (0x00000080) //!< Bit mask for ECSPI_DMAREG_TEDEN.
  953. //! @brief Get value of ECSPI_DMAREG_TEDEN from a register value.
  954. #define BG_ECSPI_DMAREG_TEDEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_TEDEN) >> BP_ECSPI_DMAREG_TEDEN)
  955. //! @brief Format value for bitfield ECSPI_DMAREG_TEDEN.
  956. #define BF_ECSPI_DMAREG_TEDEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_TEDEN) & BM_ECSPI_DMAREG_TEDEN)
  957. #ifndef __LANGUAGE_ASM__
  958. //! @brief Set the TEDEN field to a new value.
  959. #define BW_ECSPI_DMAREG_TEDEN(x, v) (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_TEDEN) | BF_ECSPI_DMAREG_TEDEN(v)))
  960. #endif
  961. //@}
  962. /*! @name Register ECSPI_DMAREG, field RX_THRESHOLD[21:16] (RW)
  963. *
  964. * RX THRESHOLD. This field defines the FIFO threshold that triggers a RX DMA/INT request. A RX
  965. * DMA/INT request is issued when the number of data entries in the RXFIFO is greater than
  966. * RX_THRESHOLD.
  967. */
  968. //@{
  969. #define BP_ECSPI_DMAREG_RX_THRESHOLD (16) //!< Bit position for ECSPI_DMAREG_RX_THRESHOLD.
  970. #define BM_ECSPI_DMAREG_RX_THRESHOLD (0x003f0000) //!< Bit mask for ECSPI_DMAREG_RX_THRESHOLD.
  971. //! @brief Get value of ECSPI_DMAREG_RX_THRESHOLD from a register value.
  972. #define BG_ECSPI_DMAREG_RX_THRESHOLD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_RX_THRESHOLD) >> BP_ECSPI_DMAREG_RX_THRESHOLD)
  973. //! @brief Format value for bitfield ECSPI_DMAREG_RX_THRESHOLD.
  974. #define BF_ECSPI_DMAREG_RX_THRESHOLD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_RX_THRESHOLD) & BM_ECSPI_DMAREG_RX_THRESHOLD)
  975. #ifndef __LANGUAGE_ASM__
  976. //! @brief Set the RX_THRESHOLD field to a new value.
  977. #define BW_ECSPI_DMAREG_RX_THRESHOLD(x, v) (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_RX_THRESHOLD) | BF_ECSPI_DMAREG_RX_THRESHOLD(v)))
  978. #endif
  979. //@}
  980. /*! @name Register ECSPI_DMAREG, field RXDEN[23] (RW)
  981. *
  982. * RXFIFO DMA Request Enable. This bit enables/disables the RXFIFO DMA Request.
  983. *
  984. * Values:
  985. * - 0 - Disable
  986. * - 1 - Enable
  987. */
  988. //@{
  989. #define BP_ECSPI_DMAREG_RXDEN (23) //!< Bit position for ECSPI_DMAREG_RXDEN.
  990. #define BM_ECSPI_DMAREG_RXDEN (0x00800000) //!< Bit mask for ECSPI_DMAREG_RXDEN.
  991. //! @brief Get value of ECSPI_DMAREG_RXDEN from a register value.
  992. #define BG_ECSPI_DMAREG_RXDEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_RXDEN) >> BP_ECSPI_DMAREG_RXDEN)
  993. //! @brief Format value for bitfield ECSPI_DMAREG_RXDEN.
  994. #define BF_ECSPI_DMAREG_RXDEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_RXDEN) & BM_ECSPI_DMAREG_RXDEN)
  995. #ifndef __LANGUAGE_ASM__
  996. //! @brief Set the RXDEN field to a new value.
  997. #define BW_ECSPI_DMAREG_RXDEN(x, v) (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_RXDEN) | BF_ECSPI_DMAREG_RXDEN(v)))
  998. #endif
  999. //@}
  1000. /*! @name Register ECSPI_DMAREG, field RX_DMA_LENGTH[29:24] (RW)
  1001. *
  1002. * RX DMA LENGTH. This field defines the burst length of a DMA operation. Applies only when RXTDEN
  1003. * is set.
  1004. */
  1005. //@{
  1006. #define BP_ECSPI_DMAREG_RX_DMA_LENGTH (24) //!< Bit position for ECSPI_DMAREG_RX_DMA_LENGTH.
  1007. #define BM_ECSPI_DMAREG_RX_DMA_LENGTH (0x3f000000) //!< Bit mask for ECSPI_DMAREG_RX_DMA_LENGTH.
  1008. //! @brief Get value of ECSPI_DMAREG_RX_DMA_LENGTH from a register value.
  1009. #define BG_ECSPI_DMAREG_RX_DMA_LENGTH(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_RX_DMA_LENGTH) >> BP_ECSPI_DMAREG_RX_DMA_LENGTH)
  1010. //! @brief Format value for bitfield ECSPI_DMAREG_RX_DMA_LENGTH.
  1011. #define BF_ECSPI_DMAREG_RX_DMA_LENGTH(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_RX_DMA_LENGTH) & BM_ECSPI_DMAREG_RX_DMA_LENGTH)
  1012. #ifndef __LANGUAGE_ASM__
  1013. //! @brief Set the RX_DMA_LENGTH field to a new value.
  1014. #define BW_ECSPI_DMAREG_RX_DMA_LENGTH(x, v) (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_RX_DMA_LENGTH) | BF_ECSPI_DMAREG_RX_DMA_LENGTH(v)))
  1015. #endif
  1016. //@}
  1017. /*! @name Register ECSPI_DMAREG, field RXTDEN[31] (RW)
  1018. *
  1019. * RXFIFO TAIL DMA Request Enable. This bit enables an internal counter that is increased at each
  1020. * read of the RXFIFO. This counter is cleared automatically when it reaches RX DMA LENGTH. If the
  1021. * number of words remaining in the RXFIFO is greater than or equal to RX DMA LENGTH, a DMA request
  1022. * is generated even if it is less than or equal to RX_THRESHOLD.
  1023. *
  1024. * Values:
  1025. * - 0 - Disable
  1026. * - 1 - Enable
  1027. */
  1028. //@{
  1029. #define BP_ECSPI_DMAREG_RXTDEN (31) //!< Bit position for ECSPI_DMAREG_RXTDEN.
  1030. #define BM_ECSPI_DMAREG_RXTDEN (0x80000000) //!< Bit mask for ECSPI_DMAREG_RXTDEN.
  1031. //! @brief Get value of ECSPI_DMAREG_RXTDEN from a register value.
  1032. #define BG_ECSPI_DMAREG_RXTDEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_DMAREG_RXTDEN) >> BP_ECSPI_DMAREG_RXTDEN)
  1033. //! @brief Format value for bitfield ECSPI_DMAREG_RXTDEN.
  1034. #define BF_ECSPI_DMAREG_RXTDEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_DMAREG_RXTDEN) & BM_ECSPI_DMAREG_RXTDEN)
  1035. #ifndef __LANGUAGE_ASM__
  1036. //! @brief Set the RXTDEN field to a new value.
  1037. #define BW_ECSPI_DMAREG_RXTDEN(x, v) (HW_ECSPI_DMAREG_WR(x, (HW_ECSPI_DMAREG_RD(x) & ~BM_ECSPI_DMAREG_RXTDEN) | BF_ECSPI_DMAREG_RXTDEN(v)))
  1038. #endif
  1039. //@}
  1040. //-------------------------------------------------------------------------------------------
  1041. // HW_ECSPI_STATREG - Status Register
  1042. //-------------------------------------------------------------------------------------------
  1043. #ifndef __LANGUAGE_ASM__
  1044. /*!
  1045. * @brief HW_ECSPI_STATREG - Status Register (RW)
  1046. *
  1047. * Reset value: 0x00000003
  1048. *
  1049. * The ECSPI Status Register (ECSPI_STATREG) reflects the status of the ECSPI's operating condition.
  1050. * If the ECSPI is disabled, this register reads 0x0000_0003.
  1051. */
  1052. typedef union _hw_ecspi_statreg
  1053. {
  1054. reg32_t U;
  1055. struct _hw_ecspi_statreg_bitfields
  1056. {
  1057. unsigned TE : 1; //!< [0] TXFIFO Empty.
  1058. unsigned TDR : 1; //!< [1] TXFIFO Data Request.
  1059. unsigned TF : 1; //!< [2] TXFIFO Full.
  1060. unsigned RR : 1; //!< [3] RXFIFO Ready.
  1061. unsigned RDR : 1; //!< [4] RXFIFO Data Request.
  1062. unsigned RF : 1; //!< [5] RXFIFO Full.
  1063. unsigned RO : 1; //!< [6] RXFIFO Overflow.
  1064. unsigned TC : 1; //!< [7] Transfer Completed Status bit.
  1065. unsigned RESERVED0 : 24; //!< [31:8] Reserved
  1066. } B;
  1067. } hw_ecspi_statreg_t;
  1068. #endif
  1069. /*!
  1070. * @name Constants and macros for entire ECSPI_STATREG register
  1071. */
  1072. //@{
  1073. #define HW_ECSPI_STATREG_ADDR(x) (REGS_ECSPI_BASE(x) + 0x18)
  1074. #ifndef __LANGUAGE_ASM__
  1075. #define HW_ECSPI_STATREG(x) (*(volatile hw_ecspi_statreg_t *) HW_ECSPI_STATREG_ADDR(x))
  1076. #define HW_ECSPI_STATREG_RD(x) (HW_ECSPI_STATREG(x).U)
  1077. #define HW_ECSPI_STATREG_WR(x, v) (HW_ECSPI_STATREG(x).U = (v))
  1078. #define HW_ECSPI_STATREG_SET(x, v) (HW_ECSPI_STATREG_WR(x, HW_ECSPI_STATREG_RD(x) | (v)))
  1079. #define HW_ECSPI_STATREG_CLR(x, v) (HW_ECSPI_STATREG_WR(x, HW_ECSPI_STATREG_RD(x) & ~(v)))
  1080. #define HW_ECSPI_STATREG_TOG(x, v) (HW_ECSPI_STATREG_WR(x, HW_ECSPI_STATREG_RD(x) ^ (v)))
  1081. #endif
  1082. //@}
  1083. /*
  1084. * constants & macros for individual ECSPI_STATREG bitfields
  1085. */
  1086. /*! @name Register ECSPI_STATREG, field TE[0] (RO)
  1087. *
  1088. * TXFIFO Empty. This bit is set if the TXFIFO is empty.
  1089. *
  1090. * Values:
  1091. * - 0 - TXFIFO contains one or more words.
  1092. * - 1 - TXFIFO is empty.
  1093. */
  1094. //@{
  1095. #define BP_ECSPI_STATREG_TE (0) //!< Bit position for ECSPI_STATREG_TE.
  1096. #define BM_ECSPI_STATREG_TE (0x00000001) //!< Bit mask for ECSPI_STATREG_TE.
  1097. //! @brief Get value of ECSPI_STATREG_TE from a register value.
  1098. #define BG_ECSPI_STATREG_TE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_TE) >> BP_ECSPI_STATREG_TE)
  1099. //@}
  1100. /*! @name Register ECSPI_STATREG, field TDR[1] (RO)
  1101. *
  1102. * TXFIFO Data Request.
  1103. *
  1104. * Values:
  1105. * - 0 - Number of empty slots in TXFIFO is greater than TX_THRESHOLD.
  1106. * - 1 - Number of empty slots in TXFIFO is not greater than TX_THRESHOLD.
  1107. */
  1108. //@{
  1109. #define BP_ECSPI_STATREG_TDR (1) //!< Bit position for ECSPI_STATREG_TDR.
  1110. #define BM_ECSPI_STATREG_TDR (0x00000002) //!< Bit mask for ECSPI_STATREG_TDR.
  1111. //! @brief Get value of ECSPI_STATREG_TDR from a register value.
  1112. #define BG_ECSPI_STATREG_TDR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_TDR) >> BP_ECSPI_STATREG_TDR)
  1113. //@}
  1114. /*! @name Register ECSPI_STATREG, field TF[2] (RO)
  1115. *
  1116. * TXFIFO Full. This bit is set when if the TXFIFO is full.
  1117. *
  1118. * Values:
  1119. * - 0 - TXFIFO is not Full.
  1120. * - 1 - TXFIFO is Full.
  1121. */
  1122. //@{
  1123. #define BP_ECSPI_STATREG_TF (2) //!< Bit position for ECSPI_STATREG_TF.
  1124. #define BM_ECSPI_STATREG_TF (0x00000004) //!< Bit mask for ECSPI_STATREG_TF.
  1125. //! @brief Get value of ECSPI_STATREG_TF from a register value.
  1126. #define BG_ECSPI_STATREG_TF(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_TF) >> BP_ECSPI_STATREG_TF)
  1127. //@}
  1128. /*! @name Register ECSPI_STATREG, field RR[3] (RO)
  1129. *
  1130. * RXFIFO Ready. This bit is set when one or more words are stored in the RXFIFO.
  1131. *
  1132. * Values:
  1133. * - 0 - No valid data in RXFIFO.
  1134. * - 1 - More than 1 word in RXFIFO.
  1135. */
  1136. //@{
  1137. #define BP_ECSPI_STATREG_RR (3) //!< Bit position for ECSPI_STATREG_RR.
  1138. #define BM_ECSPI_STATREG_RR (0x00000008) //!< Bit mask for ECSPI_STATREG_RR.
  1139. //! @brief Get value of ECSPI_STATREG_RR from a register value.
  1140. #define BG_ECSPI_STATREG_RR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_RR) >> BP_ECSPI_STATREG_RR)
  1141. //@}
  1142. /*! @name Register ECSPI_STATREG, field RDR[4] (RO)
  1143. *
  1144. * RXFIFO Data Request.
  1145. *
  1146. * Values:
  1147. * - 0 - When RXTDE is set - Number of data entries in the RXFIFO is not greater than RX_THRESHOLD.
  1148. * - 0 - When RXTDE is clear - Number of data entries in the RXFIFO is not greater than RX_THRESHOLD.
  1149. * - 1 - When RXTDE is set - Number of data entries in the RXFIFO is greater than RX_THRESHOLD or a DMA TAIL
  1150. * DMA condition exists.
  1151. * - 1 - When RXTDE is clear - Number of data entries in the RXFIFO is greater than RX_THRESHOLD.
  1152. */
  1153. //@{
  1154. #define BP_ECSPI_STATREG_RDR (4) //!< Bit position for ECSPI_STATREG_RDR.
  1155. #define BM_ECSPI_STATREG_RDR (0x00000010) //!< Bit mask for ECSPI_STATREG_RDR.
  1156. //! @brief Get value of ECSPI_STATREG_RDR from a register value.
  1157. #define BG_ECSPI_STATREG_RDR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_RDR) >> BP_ECSPI_STATREG_RDR)
  1158. //@}
  1159. /*! @name Register ECSPI_STATREG, field RF[5] (RO)
  1160. *
  1161. * RXFIFO Full. This bit is set when the RXFIFO is full.
  1162. *
  1163. * Values:
  1164. * - 0 - Not Full.
  1165. * - 1 - Full.
  1166. */
  1167. //@{
  1168. #define BP_ECSPI_STATREG_RF (5) //!< Bit position for ECSPI_STATREG_RF.
  1169. #define BM_ECSPI_STATREG_RF (0x00000020) //!< Bit mask for ECSPI_STATREG_RF.
  1170. //! @brief Get value of ECSPI_STATREG_RF from a register value.
  1171. #define BG_ECSPI_STATREG_RF(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_RF) >> BP_ECSPI_STATREG_RF)
  1172. //@}
  1173. /*! @name Register ECSPI_STATREG, field RO[6] (W1C)
  1174. *
  1175. * RXFIFO Overflow. When set, this bit indicates that RXFIFO has overflowed. Writing 1 to this bit
  1176. * clears it.
  1177. *
  1178. * Values:
  1179. * - 0 - RXFIFO has no overflow.
  1180. * - 1 - RXFIFO has overflowed.
  1181. */
  1182. //@{
  1183. #define BP_ECSPI_STATREG_RO (6) //!< Bit position for ECSPI_STATREG_RO.
  1184. #define BM_ECSPI_STATREG_RO (0x00000040) //!< Bit mask for ECSPI_STATREG_RO.
  1185. //! @brief Get value of ECSPI_STATREG_RO from a register value.
  1186. #define BG_ECSPI_STATREG_RO(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_RO) >> BP_ECSPI_STATREG_RO)
  1187. //! @brief Format value for bitfield ECSPI_STATREG_RO.
  1188. #define BF_ECSPI_STATREG_RO(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_STATREG_RO) & BM_ECSPI_STATREG_RO)
  1189. #ifndef __LANGUAGE_ASM__
  1190. //! @brief Set the RO field to a new value.
  1191. #define BW_ECSPI_STATREG_RO(x, v) (HW_ECSPI_STATREG_WR(x, (HW_ECSPI_STATREG_RD(x) & ~BM_ECSPI_STATREG_RO) | BF_ECSPI_STATREG_RO(v)))
  1192. #endif
  1193. //@}
  1194. /*! @name Register ECSPI_STATREG, field TC[7] (W1C)
  1195. *
  1196. * Transfer Completed Status bit. Writing 1 to this bit clears it.
  1197. *
  1198. * Values:
  1199. * - 0 - Transfer in progress.
  1200. * - 1 - Transfer completed.
  1201. */
  1202. //@{
  1203. #define BP_ECSPI_STATREG_TC (7) //!< Bit position for ECSPI_STATREG_TC.
  1204. #define BM_ECSPI_STATREG_TC (0x00000080) //!< Bit mask for ECSPI_STATREG_TC.
  1205. //! @brief Get value of ECSPI_STATREG_TC from a register value.
  1206. #define BG_ECSPI_STATREG_TC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_STATREG_TC) >> BP_ECSPI_STATREG_TC)
  1207. //! @brief Format value for bitfield ECSPI_STATREG_TC.
  1208. #define BF_ECSPI_STATREG_TC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_STATREG_TC) & BM_ECSPI_STATREG_TC)
  1209. #ifndef __LANGUAGE_ASM__
  1210. //! @brief Set the TC field to a new value.
  1211. #define BW_ECSPI_STATREG_TC(x, v) (HW_ECSPI_STATREG_WR(x, (HW_ECSPI_STATREG_RD(x) & ~BM_ECSPI_STATREG_TC) | BF_ECSPI_STATREG_TC(v)))
  1212. #endif
  1213. //@}
  1214. //-------------------------------------------------------------------------------------------
  1215. // HW_ECSPI_PERIODREG - Sample Period Control Register
  1216. //-------------------------------------------------------------------------------------------
  1217. #ifndef __LANGUAGE_ASM__
  1218. /*!
  1219. * @brief HW_ECSPI_PERIODREG - Sample Period Control Register (RW)
  1220. *
  1221. * Reset value: 0x00000000
  1222. *
  1223. * The Sample Period Control Register (ECSPI_PERIODREG) provides software a way to insert delays
  1224. * (wait states) between consecutive SPI transfers. Control bits in this register select the clock
  1225. * source for the sample period counter and the delay count indicating the number of wait states to
  1226. * be inserted between data transfers. The delay counts apply only when the current channel is
  1227. * operating in Master mode (ECSPI_CONREG[CHANNEL MODE] = 1).ECSPI_PERIODREG also contains the CSD
  1228. * CTRL field used to insert a delay between the Chip Select's active edge and the first SPI Clock
  1229. * edge.
  1230. */
  1231. typedef union _hw_ecspi_periodreg
  1232. {
  1233. reg32_t U;
  1234. struct _hw_ecspi_periodreg_bitfields
  1235. {
  1236. unsigned SAMPLE_PERIOD : 15; //!< [14:0] Sample Period Control.
  1237. unsigned CSRC : 1; //!< [15] Clock Source Control.
  1238. unsigned CSD_CTL : 6; //!< [21:16] Chip Select Delay Control bits.
  1239. unsigned RESERVED0 : 10; //!< [31:22] Reserved
  1240. } B;
  1241. } hw_ecspi_periodreg_t;
  1242. #endif
  1243. /*!
  1244. * @name Constants and macros for entire ECSPI_PERIODREG register
  1245. */
  1246. //@{
  1247. #define HW_ECSPI_PERIODREG_ADDR(x) (REGS_ECSPI_BASE(x) + 0x1c)
  1248. #ifndef __LANGUAGE_ASM__
  1249. #define HW_ECSPI_PERIODREG(x) (*(volatile hw_ecspi_periodreg_t *) HW_ECSPI_PERIODREG_ADDR(x))
  1250. #define HW_ECSPI_PERIODREG_RD(x) (HW_ECSPI_PERIODREG(x).U)
  1251. #define HW_ECSPI_PERIODREG_WR(x, v) (HW_ECSPI_PERIODREG(x).U = (v))
  1252. #define HW_ECSPI_PERIODREG_SET(x, v) (HW_ECSPI_PERIODREG_WR(x, HW_ECSPI_PERIODREG_RD(x) | (v)))
  1253. #define HW_ECSPI_PERIODREG_CLR(x, v) (HW_ECSPI_PERIODREG_WR(x, HW_ECSPI_PERIODREG_RD(x) & ~(v)))
  1254. #define HW_ECSPI_PERIODREG_TOG(x, v) (HW_ECSPI_PERIODREG_WR(x, HW_ECSPI_PERIODREG_RD(x) ^ (v)))
  1255. #endif
  1256. //@}
  1257. /*
  1258. * constants & macros for individual ECSPI_PERIODREG bitfields
  1259. */
  1260. /*! @name Register ECSPI_PERIODREG, field SAMPLE_PERIOD[14:0] (RW)
  1261. *
  1262. * Sample Period Control. These bits control the number of wait states to be inserted in data
  1263. * transfers. During the idle clocks, the state of the SS output will operate according to the
  1264. * SS_CTL control field in the ECSPI_CONREG register.
  1265. *
  1266. * Values:
  1267. * - 0x0000 - 0 wait states inserted
  1268. * - ... - ...
  1269. * - 0x0001 - 1 wait state inserted
  1270. * - 0x7FFE - 32766 wait states inserted
  1271. * - 0x7FFF - 32767 wait states inserted
  1272. */
  1273. //@{
  1274. #define BP_ECSPI_PERIODREG_SAMPLE_PERIOD (0) //!< Bit position for ECSPI_PERIODREG_SAMPLE_PERIOD.
  1275. #define BM_ECSPI_PERIODREG_SAMPLE_PERIOD (0x00007fff) //!< Bit mask for ECSPI_PERIODREG_SAMPLE_PERIOD.
  1276. //! @brief Get value of ECSPI_PERIODREG_SAMPLE_PERIOD from a register value.
  1277. #define BG_ECSPI_PERIODREG_SAMPLE_PERIOD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_PERIODREG_SAMPLE_PERIOD) >> BP_ECSPI_PERIODREG_SAMPLE_PERIOD)
  1278. //! @brief Format value for bitfield ECSPI_PERIODREG_SAMPLE_PERIOD.
  1279. #define BF_ECSPI_PERIODREG_SAMPLE_PERIOD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_PERIODREG_SAMPLE_PERIOD) & BM_ECSPI_PERIODREG_SAMPLE_PERIOD)
  1280. #ifndef __LANGUAGE_ASM__
  1281. //! @brief Set the SAMPLE_PERIOD field to a new value.
  1282. #define BW_ECSPI_PERIODREG_SAMPLE_PERIOD(x, v) (HW_ECSPI_PERIODREG_WR(x, (HW_ECSPI_PERIODREG_RD(x) & ~BM_ECSPI_PERIODREG_SAMPLE_PERIOD) | BF_ECSPI_PERIODREG_SAMPLE_PERIOD(v)))
  1283. #endif
  1284. //@}
  1285. /*! @name Register ECSPI_PERIODREG, field CSRC[15] (RW)
  1286. *
  1287. * Clock Source Control. This bit selects the clock source for the sample period counter.
  1288. *
  1289. * Values:
  1290. * - 0 - SPI Clock (SCLK)
  1291. * - 1 - Low-Frequency Reference Clock (32.768 KHz)
  1292. */
  1293. //@{
  1294. #define BP_ECSPI_PERIODREG_CSRC (15) //!< Bit position for ECSPI_PERIODREG_CSRC.
  1295. #define BM_ECSPI_PERIODREG_CSRC (0x00008000) //!< Bit mask for ECSPI_PERIODREG_CSRC.
  1296. //! @brief Get value of ECSPI_PERIODREG_CSRC from a register value.
  1297. #define BG_ECSPI_PERIODREG_CSRC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_PERIODREG_CSRC) >> BP_ECSPI_PERIODREG_CSRC)
  1298. //! @brief Format value for bitfield ECSPI_PERIODREG_CSRC.
  1299. #define BF_ECSPI_PERIODREG_CSRC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_PERIODREG_CSRC) & BM_ECSPI_PERIODREG_CSRC)
  1300. #ifndef __LANGUAGE_ASM__
  1301. //! @brief Set the CSRC field to a new value.
  1302. #define BW_ECSPI_PERIODREG_CSRC(x, v) (HW_ECSPI_PERIODREG_WR(x, (HW_ECSPI_PERIODREG_RD(x) & ~BM_ECSPI_PERIODREG_CSRC) | BF_ECSPI_PERIODREG_CSRC(v)))
  1303. #endif
  1304. //@}
  1305. /*! @name Register ECSPI_PERIODREG, field CSD_CTL[21:16] (RW)
  1306. *
  1307. * Chip Select Delay Control bits. This field defines how many SPI clocks will be inserted between
  1308. * the chip select's active edge and the first SPI clock edge. The range is from 0 to 63.
  1309. */
  1310. //@{
  1311. #define BP_ECSPI_PERIODREG_CSD_CTL (16) //!< Bit position for ECSPI_PERIODREG_CSD_CTL.
  1312. #define BM_ECSPI_PERIODREG_CSD_CTL (0x003f0000) //!< Bit mask for ECSPI_PERIODREG_CSD_CTL.
  1313. //! @brief Get value of ECSPI_PERIODREG_CSD_CTL from a register value.
  1314. #define BG_ECSPI_PERIODREG_CSD_CTL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_PERIODREG_CSD_CTL) >> BP_ECSPI_PERIODREG_CSD_CTL)
  1315. //! @brief Format value for bitfield ECSPI_PERIODREG_CSD_CTL.
  1316. #define BF_ECSPI_PERIODREG_CSD_CTL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_PERIODREG_CSD_CTL) & BM_ECSPI_PERIODREG_CSD_CTL)
  1317. #ifndef __LANGUAGE_ASM__
  1318. //! @brief Set the CSD_CTL field to a new value.
  1319. #define BW_ECSPI_PERIODREG_CSD_CTL(x, v) (HW_ECSPI_PERIODREG_WR(x, (HW_ECSPI_PERIODREG_RD(x) & ~BM_ECSPI_PERIODREG_CSD_CTL) | BF_ECSPI_PERIODREG_CSD_CTL(v)))
  1320. #endif
  1321. //@}
  1322. //-------------------------------------------------------------------------------------------
  1323. // HW_ECSPI_TESTREG - Test Control Register
  1324. //-------------------------------------------------------------------------------------------
  1325. #ifndef __LANGUAGE_ASM__
  1326. /*!
  1327. * @brief HW_ECSPI_TESTREG - Test Control Register (RW)
  1328. *
  1329. * Reset value: 0x00000000
  1330. *
  1331. * The Test Control Register (ECSPI_TESTREG) provides software a mechanism to internally connect the
  1332. * receive and transmit devices of the ECSPI , and monitor the contents of the receive and transmit
  1333. * FIFOs.
  1334. */
  1335. typedef union _hw_ecspi_testreg
  1336. {
  1337. reg32_t U;
  1338. struct _hw_ecspi_testreg_bitfields
  1339. {
  1340. unsigned TXCNT : 7; //!< [6:0] TXFIFO Counter.
  1341. unsigned RESERVED0 : 1; //!< [7] Reserved
  1342. unsigned RXCNT : 7; //!< [14:8] RXFIFO Counter.
  1343. unsigned RESERVED1 : 16; //!< [30:15] Reserved.
  1344. unsigned LBC : 1; //!< [31] Loop Back Control.
  1345. } B;
  1346. } hw_ecspi_testreg_t;
  1347. #endif
  1348. /*!
  1349. * @name Constants and macros for entire ECSPI_TESTREG register
  1350. */
  1351. //@{
  1352. #define HW_ECSPI_TESTREG_ADDR(x) (REGS_ECSPI_BASE(x) + 0x20)
  1353. #ifndef __LANGUAGE_ASM__
  1354. #define HW_ECSPI_TESTREG(x) (*(volatile hw_ecspi_testreg_t *) HW_ECSPI_TESTREG_ADDR(x))
  1355. #define HW_ECSPI_TESTREG_RD(x) (HW_ECSPI_TESTREG(x).U)
  1356. #define HW_ECSPI_TESTREG_WR(x, v) (HW_ECSPI_TESTREG(x).U = (v))
  1357. #define HW_ECSPI_TESTREG_SET(x, v) (HW_ECSPI_TESTREG_WR(x, HW_ECSPI_TESTREG_RD(x) | (v)))
  1358. #define HW_ECSPI_TESTREG_CLR(x, v) (HW_ECSPI_TESTREG_WR(x, HW_ECSPI_TESTREG_RD(x) & ~(v)))
  1359. #define HW_ECSPI_TESTREG_TOG(x, v) (HW_ECSPI_TESTREG_WR(x, HW_ECSPI_TESTREG_RD(x) ^ (v)))
  1360. #endif
  1361. //@}
  1362. /*
  1363. * constants & macros for individual ECSPI_TESTREG bitfields
  1364. */
  1365. /*! @name Register ECSPI_TESTREG, field TXCNT[6:0] (RW)
  1366. *
  1367. * TXFIFO Counter. This field indicates the number of words in the TXFIFO.
  1368. */
  1369. //@{
  1370. #define BP_ECSPI_TESTREG_TXCNT (0) //!< Bit position for ECSPI_TESTREG_TXCNT.
  1371. #define BM_ECSPI_TESTREG_TXCNT (0x0000007f) //!< Bit mask for ECSPI_TESTREG_TXCNT.
  1372. //! @brief Get value of ECSPI_TESTREG_TXCNT from a register value.
  1373. #define BG_ECSPI_TESTREG_TXCNT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_TESTREG_TXCNT) >> BP_ECSPI_TESTREG_TXCNT)
  1374. //! @brief Format value for bitfield ECSPI_TESTREG_TXCNT.
  1375. #define BF_ECSPI_TESTREG_TXCNT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_TESTREG_TXCNT) & BM_ECSPI_TESTREG_TXCNT)
  1376. #ifndef __LANGUAGE_ASM__
  1377. //! @brief Set the TXCNT field to a new value.
  1378. #define BW_ECSPI_TESTREG_TXCNT(x, v) (HW_ECSPI_TESTREG_WR(x, (HW_ECSPI_TESTREG_RD(x) & ~BM_ECSPI_TESTREG_TXCNT) | BF_ECSPI_TESTREG_TXCNT(v)))
  1379. #endif
  1380. //@}
  1381. /*! @name Register ECSPI_TESTREG, field RXCNT[14:8] (RW)
  1382. *
  1383. * RXFIFO Counter. This field indicates the number of words in the RXFIFO.
  1384. */
  1385. //@{
  1386. #define BP_ECSPI_TESTREG_RXCNT (8) //!< Bit position for ECSPI_TESTREG_RXCNT.
  1387. #define BM_ECSPI_TESTREG_RXCNT (0x00007f00) //!< Bit mask for ECSPI_TESTREG_RXCNT.
  1388. //! @brief Get value of ECSPI_TESTREG_RXCNT from a register value.
  1389. #define BG_ECSPI_TESTREG_RXCNT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_TESTREG_RXCNT) >> BP_ECSPI_TESTREG_RXCNT)
  1390. //! @brief Format value for bitfield ECSPI_TESTREG_RXCNT.
  1391. #define BF_ECSPI_TESTREG_RXCNT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_TESTREG_RXCNT) & BM_ECSPI_TESTREG_RXCNT)
  1392. #ifndef __LANGUAGE_ASM__
  1393. //! @brief Set the RXCNT field to a new value.
  1394. #define BW_ECSPI_TESTREG_RXCNT(x, v) (HW_ECSPI_TESTREG_WR(x, (HW_ECSPI_TESTREG_RD(x) & ~BM_ECSPI_TESTREG_RXCNT) | BF_ECSPI_TESTREG_RXCNT(v)))
  1395. #endif
  1396. //@}
  1397. /*! @name Register ECSPI_TESTREG, field LBC[31] (RW)
  1398. *
  1399. * Loop Back Control. This bit is used in Master mode only. When this bit is set, the ECSPI connects
  1400. * the transmitter and receiver sections internally, and the data shifted out from the most-
  1401. * significant bit of the shift register is looped back into the least-significant bit of the Shift
  1402. * register. In this way, a self-test of the complete transmit/receive path can be made. The output
  1403. * pins are not affected, and the input pins are ignored.
  1404. *
  1405. * Values:
  1406. * - 0 - Not connected.
  1407. * - 1 - Transmitter and receiver sections internally connected for Loopback.
  1408. */
  1409. //@{
  1410. #define BP_ECSPI_TESTREG_LBC (31) //!< Bit position for ECSPI_TESTREG_LBC.
  1411. #define BM_ECSPI_TESTREG_LBC (0x80000000) //!< Bit mask for ECSPI_TESTREG_LBC.
  1412. //! @brief Get value of ECSPI_TESTREG_LBC from a register value.
  1413. #define BG_ECSPI_TESTREG_LBC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_TESTREG_LBC) >> BP_ECSPI_TESTREG_LBC)
  1414. //! @brief Format value for bitfield ECSPI_TESTREG_LBC.
  1415. #define BF_ECSPI_TESTREG_LBC(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_TESTREG_LBC) & BM_ECSPI_TESTREG_LBC)
  1416. #ifndef __LANGUAGE_ASM__
  1417. //! @brief Set the LBC field to a new value.
  1418. #define BW_ECSPI_TESTREG_LBC(x, v) (HW_ECSPI_TESTREG_WR(x, (HW_ECSPI_TESTREG_RD(x) & ~BM_ECSPI_TESTREG_LBC) | BF_ECSPI_TESTREG_LBC(v)))
  1419. #endif
  1420. //@}
  1421. //-------------------------------------------------------------------------------------------
  1422. // HW_ECSPI_MSGDATA - Message Data Register
  1423. //-------------------------------------------------------------------------------------------
  1424. #ifndef __LANGUAGE_ASM__
  1425. /*!
  1426. * @brief HW_ECSPI_MSGDATA - Message Data Register (WO)
  1427. *
  1428. * Reset value: 0x00000000
  1429. *
  1430. * The Message Data Register (ECSPI_MSGDATA) forms the top word of the 16 x 32 MSG Data FIFO. Only
  1431. * word-size accesses are allowed for this register. Reads to this register return zero, and writes
  1432. * to this register store data in the MSG Data FIFO.
  1433. */
  1434. typedef union _hw_ecspi_msgdata
  1435. {
  1436. reg32_t U;
  1437. struct _hw_ecspi_msgdata_bitfields
  1438. {
  1439. unsigned ECSPI_MSGDATA : 32; //!< [31:0] ECSPI_MSGDATA holds the top word of MSG Data FIFO.
  1440. } B;
  1441. } hw_ecspi_msgdata_t;
  1442. #endif
  1443. /*!
  1444. * @name Constants and macros for entire ECSPI_MSGDATA register
  1445. */
  1446. //@{
  1447. #define HW_ECSPI_MSGDATA_ADDR(x) (REGS_ECSPI_BASE(x) + 0x40)
  1448. #ifndef __LANGUAGE_ASM__
  1449. #define HW_ECSPI_MSGDATA(x) (*(volatile hw_ecspi_msgdata_t *) HW_ECSPI_MSGDATA_ADDR(x))
  1450. #define HW_ECSPI_MSGDATA_WR(x, v) (HW_ECSPI_MSGDATA(x).U = (v))
  1451. #endif
  1452. //@}
  1453. /*
  1454. * constants & macros for individual ECSPI_MSGDATA bitfields
  1455. */
  1456. /*! @name Register ECSPI_MSGDATA, field ECSPI_MSGDATA[31:0] (WO)
  1457. *
  1458. * ECSPI_MSGDATA holds the top word of MSG Data FIFO. The MSG Data FIFO is advanced for each write
  1459. * of this register. The data read is zero. The data written to this register is stored in the MSG
  1460. * Data FIFO.
  1461. */
  1462. //@{
  1463. #define BP_ECSPI_MSGDATA_ECSPI_MSGDATA (0) //!< Bit position for ECSPI_MSGDATA_ECSPI_MSGDATA.
  1464. #define BM_ECSPI_MSGDATA_ECSPI_MSGDATA (0xffffffff) //!< Bit mask for ECSPI_MSGDATA_ECSPI_MSGDATA.
  1465. //! @brief Get value of ECSPI_MSGDATA_ECSPI_MSGDATA from a register value.
  1466. #define BG_ECSPI_MSGDATA_ECSPI_MSGDATA(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_ECSPI_MSGDATA_ECSPI_MSGDATA) >> BP_ECSPI_MSGDATA_ECSPI_MSGDATA)
  1467. //! @brief Format value for bitfield ECSPI_MSGDATA_ECSPI_MSGDATA.
  1468. #define BF_ECSPI_MSGDATA_ECSPI_MSGDATA(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_ECSPI_MSGDATA_ECSPI_MSGDATA) & BM_ECSPI_MSGDATA_ECSPI_MSGDATA)
  1469. //@}
  1470. //-------------------------------------------------------------------------------------------
  1471. // hw_ecspi_t - module struct
  1472. //-------------------------------------------------------------------------------------------
  1473. /*!
  1474. * @brief All ECSPI module registers.
  1475. */
  1476. #ifndef __LANGUAGE_ASM__
  1477. #pragma pack(1)
  1478. typedef struct _hw_ecspi
  1479. {
  1480. volatile hw_ecspi_rxdata_t RXDATA; //!< Receive Data Register
  1481. volatile hw_ecspi_txdata_t TXDATA; //!< Transmit Data Register
  1482. volatile hw_ecspi_conreg_t CONREG; //!< Control Register
  1483. volatile hw_ecspi_configreg_t CONFIGREG; //!< Config Register
  1484. volatile hw_ecspi_intreg_t INTREG; //!< Interrupt Control Register
  1485. volatile hw_ecspi_dmareg_t DMAREG; //!< DMA Control Register
  1486. volatile hw_ecspi_statreg_t STATREG; //!< Status Register
  1487. volatile hw_ecspi_periodreg_t PERIODREG; //!< Sample Period Control Register
  1488. volatile hw_ecspi_testreg_t TESTREG; //!< Test Control Register
  1489. reg32_t _reserved0[7];
  1490. volatile hw_ecspi_msgdata_t MSGDATA; //!< Message Data Register
  1491. } hw_ecspi_t;
  1492. #pragma pack()
  1493. //! @brief Macro to access all ECSPI registers.
  1494. //! @param x ECSPI instance number.
  1495. //! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
  1496. //! use the '&' operator, like <code>&HW_ECSPI(0)</code>.
  1497. #define HW_ECSPI(x) (*(hw_ecspi_t *) REGS_ECSPI_BASE(x))
  1498. #endif
  1499. #endif // __HW_ECSPI_REGISTERS_H__
  1500. // v18/121106/1.2.2
  1501. // EOF