hw_mcspi.h 116 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745
  1. //*****************************************************************************
  2. //
  3. // Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
  4. //
  5. //
  6. // Redistribution and use in source and binary forms, with or without
  7. // modification, are permitted provided that the following conditions
  8. // are met:
  9. //
  10. // Redistributions of source code must retain the above copyright
  11. // notice, this list of conditions and the following disclaimer.
  12. //
  13. // Redistributions in binary form must reproduce the above copyright
  14. // notice, this list of conditions and the following disclaimer in the
  15. // documentation and/or other materials provided with the
  16. // distribution.
  17. //
  18. // Neither the name of Texas Instruments Incorporated nor the names of
  19. // its contributors may be used to endorse or promote products derived
  20. // from this software without specific prior written permission.
  21. //
  22. // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  23. // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  24. // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  25. // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  26. // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  27. // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  28. // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  29. // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  30. // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  31. // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  32. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  33. //
  34. //*****************************************************************************
  35. #ifndef __HW_MCSPI_H__
  36. #define __HW_MCSPI_H__
  37. //*****************************************************************************
  38. //
  39. // The following are defines for the MCSPI register offsets.
  40. //
  41. //*****************************************************************************
  42. #define MCSPI_O_HL_REV 0x00000000 // IP Revision Identifier (X.Y.R)
  43. // Used by software to track
  44. // features bugs and compatibility
  45. #define MCSPI_O_HL_HWINFO 0x00000004 // Information about the IP
  46. // module's hardware configuration
  47. // i.e. typically the module's HDL
  48. // generics (if any). Actual field
  49. // format and encoding is up to the
  50. // module's designer to decide.
  51. #define MCSPI_O_HL_SYSCONFIG 0x00000010 // 0x4402 1010 0x4402 2010 Clock
  52. // management configuration
  53. #define MCSPI_O_REVISION 0x00000100 // 0x4402 1100 0x4402 2100 This
  54. // register contains the hard coded
  55. // RTL revision number.
  56. #define MCSPI_O_SYSCONFIG 0x00000110 // 0x4402 1110 0x4402 2110 This
  57. // register allows controlling
  58. // various parameters of the OCP
  59. // interface.
  60. #define MCSPI_O_SYSSTATUS 0x00000114 // 0x4402 1114 0x4402 2114 This
  61. // register provides status
  62. // information about the module
  63. // excluding the interrupt status
  64. // information
  65. #define MCSPI_O_IRQSTATUS 0x00000118 // 0x4402 1118 0x4402 2118 The
  66. // interrupt status regroups all the
  67. // status of the module internal
  68. // events that can generate an
  69. // interrupt
  70. #define MCSPI_O_IRQENABLE 0x0000011C // 0x4402 111C 0x4402 211C This
  71. // register allows to enable/disable
  72. // the module internal sources of
  73. // interrupt on an event-by-event
  74. // basis.
  75. #define MCSPI_O_WAKEUPENABLE 0x00000120 // 0x4402 1120 0x4402 2120 The
  76. // wakeup enable register allows to
  77. // enable/disable the module
  78. // internal sources of wakeup on
  79. // event-by-event basis.
  80. #define MCSPI_O_SYST 0x00000124 // 0x4402 1124 0x4402 2124 This
  81. // register is used to check the
  82. // correctness of the system
  83. // interconnect either internally to
  84. // peripheral bus or externally to
  85. // device IO pads when the module is
  86. // configured in system test
  87. // (SYSTEST) mode.
  88. #define MCSPI_O_MODULCTRL 0x00000128 // 0x4402 1128 0x4402 2128 This
  89. // register is dedicated to the
  90. // configuration of the serial port
  91. // interface.
  92. #define MCSPI_O_CH0CONF 0x0000012C // 0x4402 112C 0x4402 212C This
  93. // register is dedicated to the
  94. // configuration of the channel 0
  95. #define MCSPI_O_CH0STAT 0x00000130 // 0x4402 1130 0x4402 2130 This
  96. // register provides status
  97. // information about transmitter and
  98. // receiver registers of channel 0
  99. #define MCSPI_O_CH0CTRL 0x00000134 // 0x4402 1134 0x4402 2134 This
  100. // register is dedicated to enable
  101. // the channel 0
  102. #define MCSPI_O_TX0 0x00000138 // 0x4402 1138 0x4402 2138 This
  103. // register contains a single SPI
  104. // word to transmit on the serial
  105. // link what ever SPI word length
  106. // is.
  107. #define MCSPI_O_RX0 0x0000013C // 0x4402 113C 0x4402 213C This
  108. // register contains a single SPI
  109. // word received through the serial
  110. // link what ever SPI word length
  111. // is.
  112. #define MCSPI_O_CH1CONF 0x00000140 // 0x4402 1140 0x4402 2140 This
  113. // register is dedicated to the
  114. // configuration of the channel.
  115. #define MCSPI_O_CH1STAT 0x00000144 // 0x4402 1144 0x4402 2144 This
  116. // register provides status
  117. // information about transmitter and
  118. // receiver registers of channel 1
  119. #define MCSPI_O_CH1CTRL 0x00000148 // 0x4402 1148 0x4402 2148 This
  120. // register is dedicated to enable
  121. // the channel 1
  122. #define MCSPI_O_TX1 0x0000014C // 0x4402 114C 0x4402 214C This
  123. // register contains a single SPI
  124. // word to transmit on the serial
  125. // link what ever SPI word length
  126. // is.
  127. #define MCSPI_O_RX1 0x00000150 // 0x4402 1150 0x4402 2150 This
  128. // register contains a single SPI
  129. // word received through the serial
  130. // link what ever SPI word length
  131. // is.
  132. #define MCSPI_O_CH2CONF 0x00000154 // 0x4402 1154 0x4402 2154 This
  133. // register is dedicated to the
  134. // configuration of the channel 2
  135. #define MCSPI_O_CH2STAT 0x00000158 // 0x4402 1158 0x4402 2158 This
  136. // register provides status
  137. // information about transmitter and
  138. // receiver registers of channel 2
  139. #define MCSPI_O_CH2CTRL 0x0000015C // 0x4402 115C 0x4402 215C This
  140. // register is dedicated to enable
  141. // the channel 2
  142. #define MCSPI_O_TX2 0x00000160 // 0x4402 1160 0x4402 2160 This
  143. // register contains a single SPI
  144. // word to transmit on the serial
  145. // link what ever SPI word length
  146. // is.
  147. #define MCSPI_O_RX2 0x00000164 // 0x4402 1164 0x4402 2164 This
  148. // register contains a single SPI
  149. // word received through the serial
  150. // link what ever SPI word length
  151. // is.
  152. #define MCSPI_O_CH3CONF 0x00000168 // 0x4402 1168 0x4402 2168 This
  153. // register is dedicated to the
  154. // configuration of the channel 3
  155. #define MCSPI_O_CH3STAT 0x0000016C // 0x4402 116C 0x4402 216C This
  156. // register provides status
  157. // information about transmitter and
  158. // receiver registers of channel 3
  159. #define MCSPI_O_CH3CTRL 0x00000170 // 0x4402 1170 0x4402 2170 This
  160. // register is dedicated to enable
  161. // the channel 3
  162. #define MCSPI_O_TX3 0x00000174 // 0x4402 1174 0x4402 2174 This
  163. // register contains a single SPI
  164. // word to transmit on the serial
  165. // link what ever SPI word length
  166. // is.
  167. #define MCSPI_O_RX3 0x00000178 // 0x4402 1178 0x4402 2178 This
  168. // register contains a single SPI
  169. // word received through the serial
  170. // link what ever SPI word length
  171. // is.
  172. #define MCSPI_O_XFERLEVEL 0x0000017C // 0x4402 117C 0x4402 217C This
  173. // register provides transfer levels
  174. // needed while using FIFO buffer
  175. // during transfer.
  176. #define MCSPI_O_DAFTX 0x00000180 // 0x4402 1180 0x4402 2180 This
  177. // register contains the SPI words
  178. // to transmit on the serial link
  179. // when FIFO used and DMA address is
  180. // aligned on 256 bit.This register
  181. // is an image of one of MCSPI_TX(i)
  182. // register corresponding to the
  183. // channel which have its FIFO
  184. // enabled.
  185. #define MCSPI_O_DAFRX 0x000001A0 // 0x4402 11A0 0x4402 21A0 This
  186. // register contains the SPI words
  187. // to received on the serial link
  188. // when FIFO used and DMA address is
  189. // aligned on 256 bit.This register
  190. // is an image of one of MCSPI_RX(i)
  191. // register corresponding to the
  192. // channel which have its FIFO
  193. // enabled.
  194. //******************************************************************************
  195. //
  196. // The following are defines for the bit fields in the MCSPI_O_HL_REV register.
  197. //
  198. //******************************************************************************
  199. #define MCSPI_HL_REV_SCHEME_M 0xC0000000
  200. #define MCSPI_HL_REV_SCHEME_S 30
  201. #define MCSPI_HL_REV_RSVD_M 0x30000000 // Reserved These bits are
  202. // initialized to zero and writes to
  203. // them are ignored.
  204. #define MCSPI_HL_REV_RSVD_S 28
  205. #define MCSPI_HL_REV_FUNC_M 0x0FFF0000 // Function indicates a software
  206. // compatible module family. If
  207. // there is no level of software
  208. // compatibility a new Func number
  209. // (and hence REVISION) should be
  210. // assigned.
  211. #define MCSPI_HL_REV_FUNC_S 16
  212. #define MCSPI_HL_REV_R_RTL_M 0x0000F800 // RTL Version (R) maintained by IP
  213. // design owner. RTL follows a
  214. // numbering such as X.Y.R.Z which
  215. // are explained in this table. R
  216. // changes ONLY when: (1) PDS
  217. // uploads occur which may have been
  218. // due to spec changes (2) Bug fixes
  219. // occur (3) Resets to '0' when X or
  220. // Y changes. Design team has an
  221. // internal 'Z' (customer invisible)
  222. // number which increments on every
  223. // drop that happens due to DV and
  224. // RTL updates. Z resets to 0 when R
  225. // increments.
  226. #define MCSPI_HL_REV_R_RTL_S 11
  227. #define MCSPI_HL_REV_X_MAJOR_M 0x00000700 // Major Revision (X) maintained by
  228. // IP specification owner. X changes
  229. // ONLY when: (1) There is a major
  230. // feature addition. An example
  231. // would be adding Master Mode to
  232. // Utopia Level2. The Func field (or
  233. // Class/Type in old PID format)
  234. // will remain the same. X does NOT
  235. // change due to: (1) Bug fixes (2)
  236. // Change in feature parameters.
  237. #define MCSPI_HL_REV_X_MAJOR_S 8
  238. #define MCSPI_HL_REV_CUSTOM_M 0x000000C0
  239. #define MCSPI_HL_REV_CUSTOM_S 6
  240. #define MCSPI_HL_REV_Y_MINOR_M 0x0000003F // Minor Revision (Y) maintained by
  241. // IP specification owner. Y changes
  242. // ONLY when: (1) Features are
  243. // scaled (up or down). Flexibility
  244. // exists in that this feature
  245. // scalability may either be
  246. // represented in the Y change or a
  247. // specific register in the IP that
  248. // indicates which features are
  249. // exactly available. (2) When
  250. // feature creeps from Is-Not list
  251. // to Is list. But this may not be
  252. // the case once it sees silicon; in
  253. // which case X will change. Y does
  254. // NOT change due to: (1) Bug fixes
  255. // (2) Typos or clarifications (3)
  256. // major functional/feature
  257. // change/addition/deletion. Instead
  258. // these changes may be reflected
  259. // via R S X as applicable. Spec
  260. // owner maintains a
  261. // customer-invisible number 'S'
  262. // which changes due to: (1)
  263. // Typos/clarifications (2) Bug
  264. // documentation. Note that this bug
  265. // is not due to a spec change but
  266. // due to implementation.
  267. // Nevertheless the spec tracks the
  268. // IP bugs. An RTL release (say for
  269. // silicon PG1.1) that occurs due to
  270. // bug fix should document the
  271. // corresponding spec number (X.Y.S)
  272. // in its release notes.
  273. #define MCSPI_HL_REV_Y_MINOR_S 0
  274. //******************************************************************************
  275. //
  276. // The following are defines for the bit fields in the MCSPI_O_HL_HWINFO register.
  277. //
  278. //******************************************************************************
  279. #define MCSPI_HL_HWINFO_RETMODE 0x00000040
  280. #define MCSPI_HL_HWINFO_FFNBYTE_M \
  281. 0x0000003E
  282. #define MCSPI_HL_HWINFO_FFNBYTE_S 1
  283. #define MCSPI_HL_HWINFO_USEFIFO 0x00000001
  284. //******************************************************************************
  285. //
  286. // The following are defines for the bit fields in the
  287. // MCSPI_O_HL_SYSCONFIG register.
  288. //
  289. //******************************************************************************
  290. #define MCSPI_HL_SYSCONFIG_IDLEMODE_M \
  291. 0x0000000C // Configuration of the local
  292. // target state management mode. By
  293. // definition target can handle
  294. // read/write transaction as long as
  295. // it is out of IDLE state. 0x0
  296. // Force-idle mode: local target's
  297. // idle state follows (acknowledges)
  298. // the system's idle requests
  299. // unconditionally i.e. regardless
  300. // of the IP module's internal
  301. // requirements.Backup mode for
  302. // debug only. 0x1 No-idle mode:
  303. // local target never enters idle
  304. // state.Backup mode for debug only.
  305. // 0x2 Smart-idle mode: local
  306. // target's idle state eventually
  307. // follows (acknowledges) the
  308. // system's idle requests depending
  309. // on the IP module's internal
  310. // requirements.IP module shall not
  311. // generate (IRQ- or
  312. // DMA-request-related) wakeup
  313. // events. 0x3 "Smart-idle
  314. // wakeup-capable mode: local
  315. // target's idle state eventually
  316. // follows (acknowledges) the
  317. // system's idle requests depending
  318. // on the IP module's internal
  319. // requirements.IP module may
  320. // generate (IRQ- or
  321. // DMA-request-related) wakeup
  322. // events when in idle state.Mode is
  323. // only relevant if the appropriate
  324. // IP module ""swakeup"" output(s)
  325. // is (are) implemented."
  326. #define MCSPI_HL_SYSCONFIG_IDLEMODE_S 2
  327. #define MCSPI_HL_SYSCONFIG_FREEEMU \
  328. 0x00000002 // Sensitivity to emulation (debug)
  329. // suspend input signal. 0 IP module
  330. // is sensitive to emulation suspend
  331. // 1 IP module is not sensitive to
  332. // emulation suspend
  333. #define MCSPI_HL_SYSCONFIG_SOFTRESET \
  334. 0x00000001
  335. //******************************************************************************
  336. //
  337. // The following are defines for the bit fields in the MCSPI_O_REVISION register.
  338. //
  339. //******************************************************************************
  340. #define MCSPI_REVISION_REV_M 0x000000FF // IP revision [7:4] Major revision
  341. // [3:0] Minor revision Examples:
  342. // 0x10 for 1.0 0x21 for 2.1
  343. #define MCSPI_REVISION_REV_S 0
  344. //******************************************************************************
  345. //
  346. // The following are defines for the bit fields in the MCSPI_O_SYSCONFIG register.
  347. //
  348. //******************************************************************************
  349. #define MCSPI_SYSCONFIG_CLOCKACTIVITY_M \
  350. 0x00000300 // Clocks activity during wake up
  351. // mode period 0x0 OCP and
  352. // Functional clocks may be switched
  353. // off. 0x1 OCP clock is maintained.
  354. // Functional clock may be
  355. // switched-off. 0x2 Functional
  356. // clock is maintained. OCP clock
  357. // may be switched-off. 0x3 OCP and
  358. // Functional clocks are maintained.
  359. #define MCSPI_SYSCONFIG_CLOCKACTIVITY_S 8
  360. #define MCSPI_SYSCONFIG_SIDLEMODE_M \
  361. 0x00000018 // Power management 0x0 If an idle
  362. // request is detected the McSPI
  363. // acknowledges it unconditionally
  364. // and goes in Inactive mode.
  365. // Interrupt DMA requests and wake
  366. // up lines are unconditionally
  367. // de-asserted and the module wakeup
  368. // capability is deactivated even if
  369. // the bit
  370. // MCSPI_SYSCONFIG[EnaWakeUp] is
  371. // set. 0x1 If an idle request is
  372. // detected the request is ignored
  373. // and the module does not switch to
  374. // wake up mode and keeps on
  375. // behaving normally. 0x2 If an idle
  376. // request is detected the module
  377. // will switch to idle mode based on
  378. // its internal activity. The wake
  379. // up capability cannot be used. 0x3
  380. // If an idle request is detected
  381. // the module will switch to idle
  382. // mode based on its internal
  383. // activity and the wake up
  384. // capability can be used if the bit
  385. // MCSPI_SYSCONFIG[EnaWakeUp] is
  386. // set.
  387. #define MCSPI_SYSCONFIG_SIDLEMODE_S 3
  388. #define MCSPI_SYSCONFIG_ENAWAKEUP \
  389. 0x00000004 // WakeUp feature control 0 WakeUp
  390. // capability is disabled 1 WakeUp
  391. // capability is enabled
  392. #define MCSPI_SYSCONFIG_SOFTRESET \
  393. 0x00000002 // Software reset. During reads it
  394. // always returns 0. 0 (write)
  395. // Normal mode 1 (write) Set this
  396. // bit to 1 to trigger a module
  397. // reset.The bit is automatically
  398. // reset by the hardware.
  399. #define MCSPI_SYSCONFIG_AUTOIDLE \
  400. 0x00000001 // Internal OCP Clock gating
  401. // strategy 0 OCP clock is
  402. // free-running 1 Automatic OCP
  403. // clock gating strategy is applied
  404. // based on the OCP interface
  405. // activity
  406. //******************************************************************************
  407. //
  408. // The following are defines for the bit fields in the MCSPI_O_SYSSTATUS register.
  409. //
  410. //******************************************************************************
  411. #define MCSPI_SYSSTATUS_RESETDONE \
  412. 0x00000001
  413. //******************************************************************************
  414. //
  415. // The following are defines for the bit fields in the MCSPI_O_IRQSTATUS register.
  416. //
  417. //******************************************************************************
  418. #define MCSPI_IRQSTATUS_EOW 0x00020000
  419. #define MCSPI_IRQSTATUS_WKS 0x00010000
  420. #define MCSPI_IRQSTATUS_RX3_FULL \
  421. 0x00004000
  422. #define MCSPI_IRQSTATUS_TX3_UNDERFLOW \
  423. 0x00002000
  424. #define MCSPI_IRQSTATUS_TX3_EMPTY \
  425. 0x00001000
  426. #define MCSPI_IRQSTATUS_RX2_FULL \
  427. 0x00000400
  428. #define MCSPI_IRQSTATUS_TX2_UNDERFLOW \
  429. 0x00000200
  430. #define MCSPI_IRQSTATUS_TX2_EMPTY \
  431. 0x00000100
  432. #define MCSPI_IRQSTATUS_RX1_FULL \
  433. 0x00000040
  434. #define MCSPI_IRQSTATUS_TX1_UNDERFLOW \
  435. 0x00000020
  436. #define MCSPI_IRQSTATUS_TX1_EMPTY \
  437. 0x00000010
  438. #define MCSPI_IRQSTATUS_RX0_OVERFLOW \
  439. 0x00000008
  440. #define MCSPI_IRQSTATUS_RX0_FULL \
  441. 0x00000004
  442. #define MCSPI_IRQSTATUS_TX0_UNDERFLOW \
  443. 0x00000002
  444. #define MCSPI_IRQSTATUS_TX0_EMPTY \
  445. 0x00000001
  446. //******************************************************************************
  447. //
  448. // The following are defines for the bit fields in the MCSPI_O_IRQENABLE register.
  449. //
  450. //******************************************************************************
  451. #define MCSPI_IRQENABLE_EOW_ENABLE \
  452. 0x00020000 // End of Word count Interrupt
  453. // Enable. 0 Interrupt disabled 1
  454. // Interrupt enabled
  455. #define MCSPI_IRQENABLE_WKE 0x00010000 // Wake Up event interrupt Enable
  456. // in slave mode when an active
  457. // control signal is detected on the
  458. // SPIEN line programmed in the
  459. // field MCSPI_CH0CONF[SPIENSLV] 0
  460. // Interrupt disabled 1 Interrupt
  461. // enabled
  462. #define MCSPI_IRQENABLE_RX3_FULL_ENABLE \
  463. 0x00004000 // Receiver register Full Interrupt
  464. // Enable. Ch 3 0 Interrupt disabled
  465. // 1 Interrupt enabled
  466. #define MCSPI_IRQENABLE_TX3_UNDERFLOW_ENABLE \
  467. 0x00002000 // Transmitter register Underflow
  468. // Interrupt Enable. Ch 3 0
  469. // Interrupt disabled 1 Interrupt
  470. // enabled
  471. #define MCSPI_IRQENABLE_TX3_EMPTY_ENABLE \
  472. 0x00001000 // Transmitter register Empty
  473. // Interrupt Enable. Ch3 0 Interrupt
  474. // disabled 1 Interrupt enabled
  475. #define MCSPI_IRQENABLE_RX2_FULL_ENABLE \
  476. 0x00000400 // Receiver register Full Interrupt
  477. // Enable. Ch 2 0 Interrupt disabled
  478. // 1 Interrupt enabled
  479. #define MCSPI_IRQENABLE_TX2_UNDERFLOW_ENABLE \
  480. 0x00000200 // Transmitter register Underflow
  481. // Interrupt Enable. Ch 2 0
  482. // Interrupt disabled 1 Interrupt
  483. // enabled
  484. #define MCSPI_IRQENABLE_TX2_EMPTY_ENABLE \
  485. 0x00000100 // Transmitter register Empty
  486. // Interrupt Enable. Ch 2 0
  487. // Interrupt disabled 1 Interrupt
  488. // enabled
  489. #define MCSPI_IRQENABLE_RX1_FULL_ENABLE \
  490. 0x00000040 // Receiver register Full Interrupt
  491. // Enable. Ch 1 0 Interrupt disabled
  492. // 1 Interrupt enabled
  493. #define MCSPI_IRQENABLE_TX1_UNDERFLOW_ENABLE \
  494. 0x00000020 // Transmitter register Underflow
  495. // Interrupt Enable. Ch 1 0
  496. // Interrupt disabled 1 Interrupt
  497. // enabled
  498. #define MCSPI_IRQENABLE_TX1_EMPTY_ENABLE \
  499. 0x00000010 // Transmitter register Empty
  500. // Interrupt Enable. Ch 1 0
  501. // Interrupt disabled 1 Interrupt
  502. // enabled
  503. #define MCSPI_IRQENABLE_RX0_OVERFLOW_ENABLE \
  504. 0x00000008 // Receiver register Overflow
  505. // Interrupt Enable. Ch 0 0
  506. // Interrupt disabled 1 Interrupt
  507. // enabled
  508. #define MCSPI_IRQENABLE_RX0_FULL_ENABLE \
  509. 0x00000004 // Receiver register Full Interrupt
  510. // Enable. Ch 0 0 Interrupt disabled
  511. // 1 Interrupt enabled
  512. #define MCSPI_IRQENABLE_TX0_UNDERFLOW_ENABLE \
  513. 0x00000002 // Transmitter register Underflow
  514. // Interrupt Enable. Ch 0 0
  515. // Interrupt disabled 1 Interrupt
  516. // enabled
  517. #define MCSPI_IRQENABLE_TX0_EMPTY_ENABLE \
  518. 0x00000001 // Transmitter register Empty
  519. // Interrupt Enable. Ch 0 0
  520. // Interrupt disabled 1 Interrupt
  521. // enabled
  522. //******************************************************************************
  523. //
  524. // The following are defines for the bit fields in the
  525. // MCSPI_O_WAKEUPENABLE register.
  526. //
  527. //******************************************************************************
  528. #define MCSPI_WAKEUPENABLE_WKEN 0x00000001 // WakeUp functionality in slave
  529. // mode when an active control
  530. // signal is detected on the SPIEN
  531. // line programmed in the field
  532. // MCSPI_CH0CONF[SPIENSLV] 0 The
  533. // event is not allowed to wakeup
  534. // the system even if the global
  535. // control bit
  536. // MCSPI_SYSCONF[EnaWakeUp] is set.
  537. // 1 The event is allowed to wakeup
  538. // the system if the global control
  539. // bit MCSPI_SYSCONF[EnaWakeUp] is
  540. // set.
  541. //******************************************************************************
  542. //
  543. // The following are defines for the bit fields in the MCSPI_O_SYST register.
  544. //
  545. //******************************************************************************
  546. #define MCSPI_SYST_SSB 0x00000800 // Set status bit 0 No action.
  547. // Writing 0 does not clear already
  548. // set status bits; This bit must be
  549. // cleared prior attempting to clear
  550. // a status bit of the
  551. // <MCSPI_IRQSTATUS> register. 1
  552. // Force to 1 all status bits of
  553. // MCSPI_IRQSTATUS register. Writing
  554. // 1 into this bit sets to 1 all
  555. // status bits contained in the
  556. // <MCSPI_IRQSTATUS> register.
  557. #define MCSPI_SYST_SPIENDIR 0x00000400 // Set the direction of the
  558. // SPIEN[3:0] lines and SPICLK line
  559. // 0 output (as in master mode) 1
  560. // input (as in slave mode)
  561. #define MCSPI_SYST_SPIDATDIR1 0x00000200 // Set the direction of the
  562. // SPIDAT[1] 0 output 1 input
  563. #define MCSPI_SYST_SPIDATDIR0 0x00000100 // Set the direction of the
  564. // SPIDAT[0] 0 output 1 input
  565. #define MCSPI_SYST_WAKD 0x00000080 // SWAKEUP output (signal data
  566. // value of internal signal to
  567. // system). The signal is driven
  568. // high or low according to the
  569. // value written into this register
  570. // bit. 0 The pin is driven low. 1
  571. // The pin is driven high.
  572. #define MCSPI_SYST_SPICLK 0x00000040 // SPICLK line (signal data value)
  573. // If MCSPI_SYST[SPIENDIR] = 1
  574. // (input mode direction) this bit
  575. // returns the value on the CLKSPI
  576. // line (high or low) and a write
  577. // into this bit has no effect. If
  578. // MCSPI_SYST[SPIENDIR] = 0 (output
  579. // mode direction) the CLKSPI line
  580. // is driven high or low according
  581. // to the value written into this
  582. // register.
  583. #define MCSPI_SYST_SPIDAT_1 0x00000020 // SPIDAT[1] line (signal data
  584. // value) If MCSPI_SYST[SPIDATDIR1]
  585. // = 0 (output mode direction) the
  586. // SPIDAT[1] line is driven high or
  587. // low according to the value
  588. // written into this register. If
  589. // MCSPI_SYST[SPIDATDIR1] = 1 (input
  590. // mode direction) this bit returns
  591. // the value on the SPIDAT[1] line
  592. // (high or low) and a write into
  593. // this bit has no effect.
  594. #define MCSPI_SYST_SPIDAT_0 0x00000010 // SPIDAT[0] line (signal data
  595. // value) If MCSPI_SYST[SPIDATDIR0]
  596. // = 0 (output mode direction) the
  597. // SPIDAT[0] line is driven high or
  598. // low according to the value
  599. // written into this register. If
  600. // MCSPI_SYST[SPIDATDIR0] = 1 (input
  601. // mode direction) this bit returns
  602. // the value on the SPIDAT[0] line
  603. // (high or low) and a write into
  604. // this bit has no effect.
  605. #define MCSPI_SYST_SPIEN_3 0x00000008 // SPIEN[3] line (signal data
  606. // value) If MCSPI_SYST[SPIENDIR] =
  607. // 0 (output mode direction) the
  608. // SPIENT[3] line is driven high or
  609. // low according to the value
  610. // written into this register. If
  611. // MCSPI_SYST[SPIENDIR] = 1 (input
  612. // mode direction) this bit returns
  613. // the value on the SPIEN[3] line
  614. // (high or low) and a write into
  615. // this bit has no effect.
  616. #define MCSPI_SYST_SPIEN_2 0x00000004 // SPIEN[2] line (signal data
  617. // value) If MCSPI_SYST[SPIENDIR] =
  618. // 0 (output mode direction) the
  619. // SPIENT[2] line is driven high or
  620. // low according to the value
  621. // written into this register. If
  622. // MCSPI_SYST[SPIENDIR] = 1 (input
  623. // mode direction) this bit returns
  624. // the value on the SPIEN[2] line
  625. // (high or low) and a write into
  626. // this bit has no effect.
  627. #define MCSPI_SYST_SPIEN_1 0x00000002 // SPIEN[1] line (signal data
  628. // value) If MCSPI_SYST[SPIENDIR] =
  629. // 0 (output mode direction) the
  630. // SPIENT[1] line is driven high or
  631. // low according to the value
  632. // written into this register. If
  633. // MCSPI_SYST[SPIENDIR] = 1 (input
  634. // mode direction) this bit returns
  635. // the value on the SPIEN[1] line
  636. // (high or low) and a write into
  637. // this bit has no effect.
  638. #define MCSPI_SYST_SPIEN_0 0x00000001 // SPIEN[0] line (signal data
  639. // value) If MCSPI_SYST[SPIENDIR] =
  640. // 0 (output mode direction) the
  641. // SPIENT[0] line is driven high or
  642. // low according to the value
  643. // written into this register. If
  644. // MCSPI_SYST[SPIENDIR] = 1 (input
  645. // mode direction) this bit returns
  646. // the value on the SPIEN[0] line
  647. // (high or low) and a write into
  648. // this bit has no effect.
  649. //******************************************************************************
  650. //
  651. // The following are defines for the bit fields in the MCSPI_O_MODULCTRL register.
  652. //
  653. //******************************************************************************
  654. #define MCSPI_MODULCTRL_FDAA 0x00000100 // FIFO DMA Address 256-bit aligned
  655. // This register is used when a FIFO
  656. // is managed by the module and DMA
  657. // connected to the controller
  658. // provides only 256 bit aligned
  659. // address. If this bit is set the
  660. // enabled channel which uses the
  661. // FIFO has its datas managed
  662. // through MCSPI_DAFTX and
  663. // MCSPI_DAFRX registers instead of
  664. // MCSPI_TX(i) and MCSPI_RX(i)
  665. // registers. 0 FIFO data managed by
  666. // MCSPI_TX(i) and MCSPI_RX(i)
  667. // registers. 1 FIFO data managed by
  668. // MCSPI_DAFTX and MCSPI_DAFRX
  669. // registers.
  670. #define MCSPI_MODULCTRL_MOA 0x00000080 // Multiple word ocp access: This
  671. // register can only be used when a
  672. // channel is enabled using a FIFO.
  673. // It allows the system to perform
  674. // multiple SPI word access for a
  675. // single 32-bit OCP word access.
  676. // This is possible for WL < 16. 0
  677. // Multiple word access disabled 1
  678. // Multiple word access enabled with
  679. // FIFO
  680. #define MCSPI_MODULCTRL_INITDLY_M \
  681. 0x00000070 // Initial spi delay for first
  682. // transfer: This register is an
  683. // option only available in SINGLE
  684. // master mode The controller waits
  685. // for a delay to transmit the first
  686. // spi word after channel enabled
  687. // and corresponding TX register
  688. // filled. This Delay is based on
  689. // SPI output frequency clock No
  690. // clock output provided to the
  691. // boundary and chip select is not
  692. // active in 4 pin mode within this
  693. // period. 0x0 No delay for first
  694. // spi transfer. 0x1 The controller
  695. // wait 4 spi bus clock 0x2 The
  696. // controller wait 8 spi bus clock
  697. // 0x3 The controller wait 16 spi
  698. // bus clock 0x4 The controller wait
  699. // 32 spi bus clock
  700. #define MCSPI_MODULCTRL_INITDLY_S 4
  701. #define MCSPI_MODULCTRL_SYSTEM_TEST \
  702. 0x00000008 // Enables the system test mode 0
  703. // Functional mode 1 System test
  704. // mode (SYSTEST)
  705. #define MCSPI_MODULCTRL_MS 0x00000004 // Master/ Slave 0 Master - The
  706. // module generates the SPICLK and
  707. // SPIEN[3:0] 1 Slave - The module
  708. // receives the SPICLK and
  709. // SPIEN[3:0]
  710. #define MCSPI_MODULCTRL_PIN34 0x00000002 // Pin mode selection: This
  711. // register is used to configure the
  712. // SPI pin mode in master or slave
  713. // mode. If asserted the controller
  714. // only use SIMOSOMI and SPICLK
  715. // clock pin for spi transfers. 0
  716. // SPIEN is used as a chip select. 1
  717. // SPIEN is not used.In this mode
  718. // all related option to chip select
  719. // have no meaning.
  720. #define MCSPI_MODULCTRL_SINGLE 0x00000001 // Single channel / Multi Channel
  721. // (master mode only) 0 More than
  722. // one channel will be used in
  723. // master mode. 1 Only one channel
  724. // will be used in master mode. This
  725. // bit must be set in Force SPIEN
  726. // mode.
  727. //******************************************************************************
  728. //
  729. // The following are defines for the bit fields in the MCSPI_O_CH0CONF register.
  730. //
  731. //******************************************************************************
  732. #define MCSPI_CH0CONF_CLKG 0x20000000 // Clock divider granularity This
  733. // register defines the granularity
  734. // of channel clock divider: power
  735. // of two or one clock cycle
  736. // granularity. When this bit is set
  737. // the register MCSPI_CHCTRL[EXTCLK]
  738. // must be configured to reach a
  739. // maximum of 4096 clock divider
  740. // ratio. Then The clock divider
  741. // ratio is a concatenation of
  742. // MCSPI_CHCONF[CLKD] and
  743. // MCSPI_CHCTRL[EXTCLK] values 0
  744. // Clock granularity of power of two
  745. // 1 One clock cycle ganularity
  746. #define MCSPI_CH0CONF_FFER 0x10000000 // FIFO enabled for receive:Only
  747. // one channel can have this bit
  748. // field set. 0 The buffer is not
  749. // used to receive data. 1 The
  750. // buffer is used to receive data.
  751. #define MCSPI_CH0CONF_FFEW 0x08000000 // FIFO enabled for Transmit:Only
  752. // one channel can have this bit
  753. // field set. 0 The buffer is not
  754. // used to transmit data. 1 The
  755. // buffer is used to transmit data.
  756. #define MCSPI_CH0CONF_TCS0_M 0x06000000 // Chip Select Time Control This
  757. // 2-bits field defines the number
  758. // of interface clock cycles between
  759. // CS toggling and first or last
  760. // edge of SPI clock. 0x0 0.5 clock
  761. // cycle 0x1 1.5 clock cycle 0x2 2.5
  762. // clock cycle 0x3 3.5 clock cycle
  763. #define MCSPI_CH0CONF_TCS0_S 25
  764. #define MCSPI_CH0CONF_SBPOL 0x01000000 // Start bit polarity 0 Start bit
  765. // polarity is held to 0 during SPI
  766. // transfer. 1 Start bit polarity is
  767. // held to 1 during SPI transfer.
  768. #define MCSPI_CH0CONF_SBE 0x00800000 // Start bit enable for SPI
  769. // transfer 0 Default SPI transfer
  770. // length as specified by WL bit
  771. // field 1 Start bit D/CX added
  772. // before SPI transfer polarity is
  773. // defined by MCSPI_CH0CONF[SBPOL]
  774. #define MCSPI_CH0CONF_SPIENSLV_M \
  775. 0x00600000 // Channel 0 only and slave mode
  776. // only: SPI slave select signal
  777. // detection. Reserved bits for
  778. // other cases. 0x0 Detection
  779. // enabled only on SPIEN[0] 0x1
  780. // Detection enabled only on
  781. // SPIEN[1] 0x2 Detection enabled
  782. // only on SPIEN[2] 0x3 Detection
  783. // enabled only on SPIEN[3]
  784. #define MCSPI_CH0CONF_SPIENSLV_S 21
  785. #define MCSPI_CH0CONF_FORCE 0x00100000 // Manual SPIEN assertion to keep
  786. // SPIEN active between SPI words.
  787. // (single channel master mode only)
  788. // 0 Writing 0 into this bit drives
  789. // low the SPIEN line when
  790. // MCSPI_CHCONF(i)[EPOL]=0 and
  791. // drives it high when
  792. // MCSPI_CHCONF(i)[EPOL]=1. 1
  793. // Writing 1 into this bit drives
  794. // high the SPIEN line when
  795. // MCSPI_CHCONF(i)[EPOL]=0 and
  796. // drives it low when
  797. // MCSPI_CHCONF(i)[EPOL]=1
  798. #define MCSPI_CH0CONF_TURBO 0x00080000 // Turbo mode 0 Turbo is
  799. // deactivated (recommended for
  800. // single SPI word transfer) 1 Turbo
  801. // is activated to maximize the
  802. // throughput for multi SPI words
  803. // transfer.
  804. #define MCSPI_CH0CONF_IS 0x00040000 // Input Select 0 Data Line0
  805. // (SPIDAT[0]) selected for
  806. // reception. 1 Data Line1
  807. // (SPIDAT[1]) selected for
  808. // reception
  809. #define MCSPI_CH0CONF_DPE1 0x00020000 // Transmission Enable for data
  810. // line 1 (SPIDATAGZEN[1]) 0 Data
  811. // Line1 (SPIDAT[1]) selected for
  812. // transmission 1 No transmission on
  813. // Data Line1 (SPIDAT[1])
  814. #define MCSPI_CH0CONF_DPE0 0x00010000 // Transmission Enable for data
  815. // line 0 (SPIDATAGZEN[0]) 0 Data
  816. // Line0 (SPIDAT[0]) selected for
  817. // transmission 1 No transmission on
  818. // Data Line0 (SPIDAT[0])
  819. #define MCSPI_CH0CONF_DMAR 0x00008000 // DMA Read request The DMA Read
  820. // request line is asserted when the
  821. // channel is enabled and a new data
  822. // is available in the receive
  823. // register of the channel. The DMA
  824. // Read request line is deasserted
  825. // on read completion of the receive
  826. // register of the channel. 0 DMA
  827. // Read Request disabled 1 DMA Read
  828. // Request enabled
  829. #define MCSPI_CH0CONF_DMAW 0x00004000 // DMA Write request. The DMA Write
  830. // request line is asserted when The
  831. // channel is enabled and the
  832. // transmitter register of the
  833. // channel is empty. The DMA Write
  834. // request line is deasserted on
  835. // load completion of the
  836. // transmitter register of the
  837. // channel. 0 DMA Write Request
  838. // disabled 1 DMA Write Request
  839. // enabled
  840. #define MCSPI_CH0CONF_TRM_M 0x00003000 // Transmit/Receive modes 0x0
  841. // Transmit and Receive mode 0x1
  842. // Receive only mode 0x2 Transmit
  843. // only mode 0x3 Reserved
  844. #define MCSPI_CH0CONF_TRM_S 12
  845. #define MCSPI_CH0CONF_WL_M 0x00000F80 // SPI word length 0x00 Reserved
  846. // 0x01 Reserved 0x02 Reserved 0x03
  847. // The SPI word is 4-bits long 0x04
  848. // The SPI word is 5-bits long 0x05
  849. // The SPI word is 6-bits long 0x06
  850. // The SPI word is 7-bits long 0x07
  851. // The SPI word is 8-bits long 0x08
  852. // The SPI word is 9-bits long 0x09
  853. // The SPI word is 10-bits long 0x0A
  854. // The SPI word is 11-bits long 0x0B
  855. // The SPI word is 12-bits long 0x0C
  856. // The SPI word is 13-bits long 0x0D
  857. // The SPI word is 14-bits long 0x0E
  858. // The SPI word is 15-bits long 0x0F
  859. // The SPI word is 16-bits long 0x10
  860. // The SPI word is 17-bits long 0x11
  861. // The SPI word is 18-bits long 0x12
  862. // The SPI word is 19-bits long 0x13
  863. // The SPI word is 20-bits long 0x14
  864. // The SPI word is 21-bits long 0x15
  865. // The SPI word is 22-bits long 0x16
  866. // The SPI word is 23-bits long 0x17
  867. // The SPI word is 24-bits long 0x18
  868. // The SPI word is 25-bits long 0x19
  869. // The SPI word is 26-bits long 0x1A
  870. // The SPI word is 27-bits long 0x1B
  871. // The SPI word is 28-bits long 0x1C
  872. // The SPI word is 29-bits long 0x1D
  873. // The SPI word is 30-bits long 0x1E
  874. // The SPI word is 31-bits long 0x1F
  875. // The SPI word is 32-bits long
  876. #define MCSPI_CH0CONF_WL_S 7
  877. #define MCSPI_CH0CONF_EPOL 0x00000040 // SPIEN polarity 0 SPIEN is held
  878. // high during the active state. 1
  879. // SPIEN is held low during the
  880. // active state.
  881. #define MCSPI_CH0CONF_CLKD_M 0x0000003C // Frequency divider for SPICLK.
  882. // (only when the module is a Master
  883. // SPI device). A programmable clock
  884. // divider divides the SPI reference
  885. // clock (CLKSPIREF) with a 4-bit
  886. // value and results in a new clock
  887. // SPICLK available to shift-in and
  888. // shift-out data. By default the
  889. // clock divider ratio has a power
  890. // of two granularity when
  891. // MCSPI_CHCONF[CLKG] is cleared
  892. // Otherwise this register is the 4
  893. // LSB bit of a 12-bit register
  894. // concatenated with clock divider
  895. // extension MCSPI_CHCTRL[EXTCLK]
  896. // register.The value description
  897. // below defines the clock ratio
  898. // when MCSPI_CHCONF[CLKG] is set to
  899. // 0. 0x0 1 0x1 2 0x2 4 0x3 8 0x4 16
  900. // 0x5 32 0x6 64 0x7 128 0x8 256 0x9
  901. // 512 0xA 1024 0xB 2048 0xC 4096
  902. // 0xD 8192 0xE 16384 0xF 32768
  903. #define MCSPI_CH0CONF_CLKD_S 2
  904. #define MCSPI_CH0CONF_POL 0x00000002 // SPICLK polarity 0 SPICLK is held
  905. // high during the active state 1
  906. // SPICLK is held low during the
  907. // active state
  908. #define MCSPI_CH0CONF_PHA 0x00000001 // SPICLK phase 0 Data are latched
  909. // on odd numbered edges of SPICLK.
  910. // 1 Data are latched on even
  911. // numbered edges of SPICLK.
  912. //******************************************************************************
  913. //
  914. // The following are defines for the bit fields in the MCSPI_O_CH0STAT register.
  915. //
  916. //******************************************************************************
  917. #define MCSPI_CH0STAT_RXFFF 0x00000040
  918. #define MCSPI_CH0STAT_RXFFE 0x00000020
  919. #define MCSPI_CH0STAT_TXFFF 0x00000010
  920. #define MCSPI_CH0STAT_TXFFE 0x00000008
  921. #define MCSPI_CH0STAT_EOT 0x00000004
  922. #define MCSPI_CH0STAT_TXS 0x00000002
  923. #define MCSPI_CH0STAT_RXS 0x00000001
  924. //******************************************************************************
  925. //
  926. // The following are defines for the bit fields in the MCSPI_O_CH0CTRL register.
  927. //
  928. //******************************************************************************
  929. #define MCSPI_CH0CTRL_EXTCLK_M 0x0000FF00 // Clock ratio extension: This
  930. // register is used to concatenate
  931. // with MCSPI_CHCONF[CLKD] register
  932. // for clock ratio only when
  933. // granularity is one clock cycle
  934. // (MCSPI_CHCONF[CLKG] set to 1).
  935. // Then the max value reached is
  936. // 4096 clock divider ratio. 0x00
  937. // Clock ratio is CLKD + 1 0x01
  938. // Clock ratio is CLKD + 1 + 16 0xFF
  939. // Clock ratio is CLKD + 1 + 4080
  940. #define MCSPI_CH0CTRL_EXTCLK_S 8
  941. #define MCSPI_CH0CTRL_EN 0x00000001 // Channel Enable 0 "Channel ""i""
  942. // is not active" 1 "Channel ""i""
  943. // is active"
  944. //******************************************************************************
  945. //
  946. // The following are defines for the bit fields in the MCSPI_O_TX0 register.
  947. //
  948. //******************************************************************************
  949. #define MCSPI_TX0_TDATA_M 0xFFFFFFFF // Channel 0 Data to transmit
  950. #define MCSPI_TX0_TDATA_S 0
  951. //******************************************************************************
  952. //
  953. // The following are defines for the bit fields in the MCSPI_O_RX0 register.
  954. //
  955. //******************************************************************************
  956. #define MCSPI_RX0_RDATA_M 0xFFFFFFFF // Channel 0 Received Data
  957. #define MCSPI_RX0_RDATA_S 0
  958. //******************************************************************************
  959. //
  960. // The following are defines for the bit fields in the MCSPI_O_CH1CONF register.
  961. //
  962. //******************************************************************************
  963. #define MCSPI_CH1CONF_CLKG 0x20000000 // Clock divider granularity This
  964. // register defines the granularity
  965. // of channel clock divider: power
  966. // of two or one clock cycle
  967. // granularity. When this bit is set
  968. // the register MCSPI_CHCTRL[EXTCLK]
  969. // must be configured to reach a
  970. // maximum of 4096 clock divider
  971. // ratio. Then The clock divider
  972. // ratio is a concatenation of
  973. // MCSPI_CHCONF[CLKD] and
  974. // MCSPI_CHCTRL[EXTCLK] values 0
  975. // Clock granularity of power of two
  976. // 1 One clock cycle ganularity
  977. #define MCSPI_CH1CONF_FFER 0x10000000 // FIFO enabled for receive:Only
  978. // one channel can have this bit
  979. // field set. 0 The buffer is not
  980. // used to receive data. 1 The
  981. // buffer is used to receive data.
  982. #define MCSPI_CH1CONF_FFEW 0x08000000 // FIFO enabled for Transmit:Only
  983. // one channel can have this bit
  984. // field set. 0 The buffer is not
  985. // used to transmit data. 1 The
  986. // buffer is used to transmit data.
  987. #define MCSPI_CH1CONF_TCS1_M 0x06000000 // Chip Select Time Control This
  988. // 2-bits field defines the number
  989. // of interface clock cycles between
  990. // CS toggling and first or last
  991. // edge of SPI clock. 0x0 0.5 clock
  992. // cycle 0x1 1.5 clock cycle 0x2 2.5
  993. // clock cycle 0x3 3.5 clock cycle
  994. #define MCSPI_CH1CONF_TCS1_S 25
  995. #define MCSPI_CH1CONF_SBPOL 0x01000000 // Start bit polarity 0 Start bit
  996. // polarity is held to 0 during SPI
  997. // transfer. 1 Start bit polarity is
  998. // held to 1 during SPI transfer.
  999. #define MCSPI_CH1CONF_SBE 0x00800000 // Start bit enable for SPI
  1000. // transfer 0 Default SPI transfer
  1001. // length as specified by WL bit
  1002. // field 1 Start bit D/CX added
  1003. // before SPI transfer polarity is
  1004. // defined by MCSPI_CH1CONF[SBPOL]
  1005. #define MCSPI_CH1CONF_FORCE 0x00100000 // Manual SPIEN assertion to keep
  1006. // SPIEN active between SPI words.
  1007. // (single channel master mode only)
  1008. // 0 Writing 0 into this bit drives
  1009. // low the SPIEN line when
  1010. // MCSPI_CHCONF(i)[EPOL]=0 and
  1011. // drives it high when
  1012. // MCSPI_CHCONF(i)[EPOL]=1. 1
  1013. // Writing 1 into this bit drives
  1014. // high the SPIEN line when
  1015. // MCSPI_CHCONF(i)[EPOL]=0 and
  1016. // drives it low when
  1017. // MCSPI_CHCONF(i)[EPOL]=1
  1018. #define MCSPI_CH1CONF_TURBO 0x00080000 // Turbo mode 0 Turbo is
  1019. // deactivated (recommended for
  1020. // single SPI word transfer) 1 Turbo
  1021. // is activated to maximize the
  1022. // throughput for multi SPI words
  1023. // transfer.
  1024. #define MCSPI_CH1CONF_IS 0x00040000 // Input Select 0 Data Line0
  1025. // (SPIDAT[0]) selected for
  1026. // reception. 1 Data Line1
  1027. // (SPIDAT[1]) selected for
  1028. // reception
  1029. #define MCSPI_CH1CONF_DPE1 0x00020000 // Transmission Enable for data
  1030. // line 1 (SPIDATAGZEN[1]) 0 Data
  1031. // Line1 (SPIDAT[1]) selected for
  1032. // transmission 1 No transmission on
  1033. // Data Line1 (SPIDAT[1])
  1034. #define MCSPI_CH1CONF_DPE0 0x00010000 // Transmission Enable for data
  1035. // line 0 (SPIDATAGZEN[0]) 0 Data
  1036. // Line0 (SPIDAT[0]) selected for
  1037. // transmission 1 No transmission on
  1038. // Data Line0 (SPIDAT[0])
  1039. #define MCSPI_CH1CONF_DMAR 0x00008000 // DMA Read request The DMA Read
  1040. // request line is asserted when the
  1041. // channel is enabled and a new data
  1042. // is available in the receive
  1043. // register of the channel. The DMA
  1044. // Read request line is deasserted
  1045. // on read completion of the receive
  1046. // register of the channel. 0 DMA
  1047. // Read Request disabled 1 DMA Read
  1048. // Request enabled
  1049. #define MCSPI_CH1CONF_DMAW 0x00004000 // DMA Write request. The DMA Write
  1050. // request line is asserted when The
  1051. // channel is enabled and the
  1052. // transmitter register of the
  1053. // channel is empty. The DMA Write
  1054. // request line is deasserted on
  1055. // load completion of the
  1056. // transmitter register of the
  1057. // channel. 0 DMA Write Request
  1058. // disabled 1 DMA Write Request
  1059. // enabled
  1060. #define MCSPI_CH1CONF_TRM_M 0x00003000 // Transmit/Receive modes 0x0
  1061. // Transmit and Receive mode 0x1
  1062. // Receive only mode 0x2 Transmit
  1063. // only mode 0x3 Reserved
  1064. #define MCSPI_CH1CONF_TRM_S 12
  1065. #define MCSPI_CH1CONF_WL_M 0x00000F80 // SPI word length 0x00 Reserved
  1066. // 0x01 Reserved 0x02 Reserved 0x03
  1067. // The SPI word is 4-bits long 0x04
  1068. // The SPI word is 5-bits long 0x05
  1069. // The SPI word is 6-bits long 0x06
  1070. // The SPI word is 7-bits long 0x07
  1071. // The SPI word is 8-bits long 0x08
  1072. // The SPI word is 9-bits long 0x09
  1073. // The SPI word is 10-bits long 0x0A
  1074. // The SPI word is 11-bits long 0x0B
  1075. // The SPI word is 12-bits long 0x0C
  1076. // The SPI word is 13-bits long 0x0D
  1077. // The SPI word is 14-bits long 0x0E
  1078. // The SPI word is 15-bits long 0x0F
  1079. // The SPI word is 16-bits long 0x10
  1080. // The SPI word is 17-bits long 0x11
  1081. // The SPI word is 18-bits long 0x12
  1082. // The SPI word is 19-bits long 0x13
  1083. // The SPI word is 20-bits long 0x14
  1084. // The SPI word is 21-bits long 0x15
  1085. // The SPI word is 22-bits long 0x16
  1086. // The SPI word is 23-bits long 0x17
  1087. // The SPI word is 24-bits long 0x18
  1088. // The SPI word is 25-bits long 0x19
  1089. // The SPI word is 26-bits long 0x1A
  1090. // The SPI word is 27-bits long 0x1B
  1091. // The SPI word is 28-bits long 0x1C
  1092. // The SPI word is 29-bits long 0x1D
  1093. // The SPI word is 30-bits long 0x1E
  1094. // The SPI word is 31-bits long 0x1F
  1095. // The SPI word is 32-bits long
  1096. #define MCSPI_CH1CONF_WL_S 7
  1097. #define MCSPI_CH1CONF_EPOL 0x00000040 // SPIEN polarity 0 SPIEN is held
  1098. // high during the active state. 1
  1099. // SPIEN is held low during the
  1100. // active state.
  1101. #define MCSPI_CH1CONF_CLKD_M 0x0000003C // Frequency divider for SPICLK.
  1102. // (only when the module is a Master
  1103. // SPI device). A programmable clock
  1104. // divider divides the SPI reference
  1105. // clock (CLKSPIREF) with a 4-bit
  1106. // value and results in a new clock
  1107. // SPICLK available to shift-in and
  1108. // shift-out data. By default the
  1109. // clock divider ratio has a power
  1110. // of two granularity when
  1111. // MCSPI_CHCONF[CLKG] is cleared
  1112. // Otherwise this register is the 4
  1113. // LSB bit of a 12-bit register
  1114. // concatenated with clock divider
  1115. // extension MCSPI_CHCTRL[EXTCLK]
  1116. // register.The value description
  1117. // below defines the clock ratio
  1118. // when MCSPI_CHCONF[CLKG] is set to
  1119. // 0. 0x0 1 0x1 2 0x2 4 0x3 8 0x4 16
  1120. // 0x5 32 0x6 64 0x7 128 0x8 256 0x9
  1121. // 512 0xA 1024 0xB 2048 0xC 4096
  1122. // 0xD 8192 0xE 16384 0xF 32768
  1123. #define MCSPI_CH1CONF_CLKD_S 2
  1124. #define MCSPI_CH1CONF_POL 0x00000002 // SPICLK polarity 0 SPICLK is held
  1125. // high during the active state 1
  1126. // SPICLK is held low during the
  1127. // active state
  1128. #define MCSPI_CH1CONF_PHA 0x00000001 // SPICLK phase 0 Data are latched
  1129. // on odd numbered edges of SPICLK.
  1130. // 1 Data are latched on even
  1131. // numbered edges of SPICLK.
  1132. //******************************************************************************
  1133. //
  1134. // The following are defines for the bit fields in the MCSPI_O_CH1STAT register.
  1135. //
  1136. //******************************************************************************
  1137. #define MCSPI_CH1STAT_RXFFF 0x00000040
  1138. #define MCSPI_CH1STAT_RXFFE 0x00000020
  1139. #define MCSPI_CH1STAT_TXFFF 0x00000010
  1140. #define MCSPI_CH1STAT_TXFFE 0x00000008
  1141. #define MCSPI_CH1STAT_EOT 0x00000004
  1142. #define MCSPI_CH1STAT_TXS 0x00000002
  1143. #define MCSPI_CH1STAT_RXS 0x00000001
  1144. //******************************************************************************
  1145. //
  1146. // The following are defines for the bit fields in the MCSPI_O_CH1CTRL register.
  1147. //
  1148. //******************************************************************************
  1149. #define MCSPI_CH1CTRL_EXTCLK_M 0x0000FF00 // Clock ratio extension: This
  1150. // register is used to concatenate
  1151. // with MCSPI_CHCONF[CLKD] register
  1152. // for clock ratio only when
  1153. // granularity is one clock cycle
  1154. // (MCSPI_CHCONF[CLKG] set to 1).
  1155. // Then the max value reached is
  1156. // 4096 clock divider ratio. 0x00
  1157. // Clock ratio is CLKD + 1 0x01
  1158. // Clock ratio is CLKD + 1 + 16 0xFF
  1159. // Clock ratio is CLKD + 1 + 4080
  1160. #define MCSPI_CH1CTRL_EXTCLK_S 8
  1161. #define MCSPI_CH1CTRL_EN 0x00000001 // Channel Enable 0 "Channel ""i""
  1162. // is not active" 1 "Channel ""i""
  1163. // is active"
  1164. //******************************************************************************
  1165. //
  1166. // The following are defines for the bit fields in the MCSPI_O_TX1 register.
  1167. //
  1168. //******************************************************************************
  1169. #define MCSPI_TX1_TDATA_M 0xFFFFFFFF // Channel 1 Data to transmit
  1170. #define MCSPI_TX1_TDATA_S 0
  1171. //******************************************************************************
  1172. //
  1173. // The following are defines for the bit fields in the MCSPI_O_RX1 register.
  1174. //
  1175. //******************************************************************************
  1176. #define MCSPI_RX1_RDATA_M 0xFFFFFFFF // Channel 1 Received Data
  1177. #define MCSPI_RX1_RDATA_S 0
  1178. //******************************************************************************
  1179. //
  1180. // The following are defines for the bit fields in the MCSPI_O_CH2CONF register.
  1181. //
  1182. //******************************************************************************
  1183. #define MCSPI_CH2CONF_CLKG 0x20000000 // Clock divider granularity This
  1184. // register defines the granularity
  1185. // of channel clock divider: power
  1186. // of two or one clock cycle
  1187. // granularity. When this bit is set
  1188. // the register MCSPI_CHCTRL[EXTCLK]
  1189. // must be configured to reach a
  1190. // maximum of 4096 clock divider
  1191. // ratio. Then The clock divider
  1192. // ratio is a concatenation of
  1193. // MCSPI_CHCONF[CLKD] and
  1194. // MCSPI_CHCTRL[EXTCLK] values 0
  1195. // Clock granularity of power of two
  1196. // 1 One clock cycle ganularity
  1197. #define MCSPI_CH2CONF_FFER 0x10000000 // FIFO enabled for receive:Only
  1198. // one channel can have this bit
  1199. // field set. 0 The buffer is not
  1200. // used to receive data. 1 The
  1201. // buffer is used to receive data.
  1202. #define MCSPI_CH2CONF_FFEW 0x08000000 // FIFO enabled for Transmit:Only
  1203. // one channel can have this bit
  1204. // field set. 0 The buffer is not
  1205. // used to transmit data. 1 The
  1206. // buffer is used to transmit data.
  1207. #define MCSPI_CH2CONF_TCS2_M 0x06000000 // Chip Select Time Control This
  1208. // 2-bits field defines the number
  1209. // of interface clock cycles between
  1210. // CS toggling and first or last
  1211. // edge of SPI clock. 0x0 0.5 clock
  1212. // cycle 0x1 1.5 clock cycle 0x2 2.5
  1213. // clock cycle 0x3 3.5 clock cycle
  1214. #define MCSPI_CH2CONF_TCS2_S 25
  1215. #define MCSPI_CH2CONF_SBPOL 0x01000000 // Start bit polarity 0 Start bit
  1216. // polarity is held to 0 during SPI
  1217. // transfer. 1 Start bit polarity is
  1218. // held to 1 during SPI transfer.
  1219. #define MCSPI_CH2CONF_SBE 0x00800000 // Start bit enable for SPI
  1220. // transfer 0 Default SPI transfer
  1221. // length as specified by WL bit
  1222. // field 1 Start bit D/CX added
  1223. // before SPI transfer polarity is
  1224. // defined by MCSPI_CH2CONF[SBPOL]
  1225. #define MCSPI_CH2CONF_FORCE 0x00100000 // Manual SPIEN assertion to keep
  1226. // SPIEN active between SPI words.
  1227. // (single channel master mode only)
  1228. // 0 Writing 0 into this bit drives
  1229. // low the SPIEN line when
  1230. // MCSPI_CHCONF(i)[EPOL]=0 and
  1231. // drives it high when
  1232. // MCSPI_CHCONF(i)[EPOL]=1. 1
  1233. // Writing 1 into this bit drives
  1234. // high the SPIEN line when
  1235. // MCSPI_CHCONF(i)[EPOL]=0 and
  1236. // drives it low when
  1237. // MCSPI_CHCONF(i)[EPOL]=1
  1238. #define MCSPI_CH2CONF_TURBO 0x00080000 // Turbo mode 0 Turbo is
  1239. // deactivated (recommended for
  1240. // single SPI word transfer) 1 Turbo
  1241. // is activated to maximize the
  1242. // throughput for multi SPI words
  1243. // transfer.
  1244. #define MCSPI_CH2CONF_IS 0x00040000 // Input Select 0 Data Line0
  1245. // (SPIDAT[0]) selected for
  1246. // reception. 1 Data Line1
  1247. // (SPIDAT[1]) selected for
  1248. // reception
  1249. #define MCSPI_CH2CONF_DPE1 0x00020000 // Transmission Enable for data
  1250. // line 1 (SPIDATAGZEN[1]) 0 Data
  1251. // Line1 (SPIDAT[1]) selected for
  1252. // transmission 1 No transmission on
  1253. // Data Line1 (SPIDAT[1])
  1254. #define MCSPI_CH2CONF_DPE0 0x00010000 // Transmission Enable for data
  1255. // line 0 (SPIDATAGZEN[0]) 0 Data
  1256. // Line0 (SPIDAT[0]) selected for
  1257. // transmission 1 No transmission on
  1258. // Data Line0 (SPIDAT[0])
  1259. #define MCSPI_CH2CONF_DMAR 0x00008000 // DMA Read request The DMA Read
  1260. // request line is asserted when the
  1261. // channel is enabled and a new data
  1262. // is available in the receive
  1263. // register of the channel. The DMA
  1264. // Read request line is deasserted
  1265. // on read completion of the receive
  1266. // register of the channel. 0 DMA
  1267. // Read Request disabled 1 DMA Read
  1268. // Request enabled
  1269. #define MCSPI_CH2CONF_DMAW 0x00004000 // DMA Write request. The DMA Write
  1270. // request line is asserted when The
  1271. // channel is enabled and the
  1272. // transmitter register of the
  1273. // channel is empty. The DMA Write
  1274. // request line is deasserted on
  1275. // load completion of the
  1276. // transmitter register of the
  1277. // channel. 0 DMA Write Request
  1278. // disabled 1 DMA Write Request
  1279. // enabled
  1280. #define MCSPI_CH2CONF_TRM_M 0x00003000 // Transmit/Receive modes 0x0
  1281. // Transmit and Receive mode 0x1
  1282. // Receive only mode 0x2 Transmit
  1283. // only mode 0x3 Reserved
  1284. #define MCSPI_CH2CONF_TRM_S 12
  1285. #define MCSPI_CH2CONF_WL_M 0x00000F80 // SPI word length 0x00 Reserved
  1286. // 0x01 Reserved 0x02 Reserved 0x03
  1287. // The SPI word is 4-bits long 0x04
  1288. // The SPI word is 5-bits long 0x05
  1289. // The SPI word is 6-bits long 0x06
  1290. // The SPI word is 7-bits long 0x07
  1291. // The SPI word is 8-bits long 0x08
  1292. // The SPI word is 9-bits long 0x09
  1293. // The SPI word is 10-bits long 0x0A
  1294. // The SPI word is 11-bits long 0x0B
  1295. // The SPI word is 12-bits long 0x0C
  1296. // The SPI word is 13-bits long 0x0D
  1297. // The SPI word is 14-bits long 0x0E
  1298. // The SPI word is 15-bits long 0x0F
  1299. // The SPI word is 16-bits long 0x10
  1300. // The SPI word is 17-bits long 0x11
  1301. // The SPI word is 18-bits long 0x12
  1302. // The SPI word is 19-bits long 0x13
  1303. // The SPI word is 20-bits long 0x14
  1304. // The SPI word is 21-bits long 0x15
  1305. // The SPI word is 22-bits long 0x16
  1306. // The SPI word is 23-bits long 0x17
  1307. // The SPI word is 24-bits long 0x18
  1308. // The SPI word is 25-bits long 0x19
  1309. // The SPI word is 26-bits long 0x1A
  1310. // The SPI word is 27-bits long 0x1B
  1311. // The SPI word is 28-bits long 0x1C
  1312. // The SPI word is 29-bits long 0x1D
  1313. // The SPI word is 30-bits long 0x1E
  1314. // The SPI word is 31-bits long 0x1F
  1315. // The SPI word is 32-bits long
  1316. #define MCSPI_CH2CONF_WL_S 7
  1317. #define MCSPI_CH2CONF_EPOL 0x00000040 // SPIEN polarity 0 SPIEN is held
  1318. // high during the active state. 1
  1319. // SPIEN is held low during the
  1320. // active state.
  1321. #define MCSPI_CH2CONF_CLKD_M 0x0000003C // Frequency divider for SPICLK.
  1322. // (only when the module is a Master
  1323. // SPI device). A programmable clock
  1324. // divider divides the SPI reference
  1325. // clock (CLKSPIREF) with a 4-bit
  1326. // value and results in a new clock
  1327. // SPICLK available to shift-in and
  1328. // shift-out data. By default the
  1329. // clock divider ratio has a power
  1330. // of two granularity when
  1331. // MCSPI_CHCONF[CLKG] is cleared
  1332. // Otherwise this register is the 4
  1333. // LSB bit of a 12-bit register
  1334. // concatenated with clock divider
  1335. // extension MCSPI_CHCTRL[EXTCLK]
  1336. // register.The value description
  1337. // below defines the clock ratio
  1338. // when MCSPI_CHCONF[CLKG] is set to
  1339. // 0. 0x0 1 0x1 2 0x2 4 0x3 8 0x4 16
  1340. // 0x5 32 0x6 64 0x7 128 0x8 256 0x9
  1341. // 512 0xA 1024 0xB 2048 0xC 4096
  1342. // 0xD 8192 0xE 16384 0xF 32768
  1343. #define MCSPI_CH2CONF_CLKD_S 2
  1344. #define MCSPI_CH2CONF_POL 0x00000002 // SPICLK polarity 0 SPICLK is held
  1345. // high during the active state 1
  1346. // SPICLK is held low during the
  1347. // active state
  1348. #define MCSPI_CH2CONF_PHA 0x00000001 // SPICLK phase 0 Data are latched
  1349. // on odd numbered edges of SPICLK.
  1350. // 1 Data are latched on even
  1351. // numbered edges of SPICLK.
  1352. //******************************************************************************
  1353. //
  1354. // The following are defines for the bit fields in the MCSPI_O_CH2STAT register.
  1355. //
  1356. //******************************************************************************
  1357. #define MCSPI_CH2STAT_RXFFF 0x00000040
  1358. #define MCSPI_CH2STAT_RXFFE 0x00000020
  1359. #define MCSPI_CH2STAT_TXFFF 0x00000010
  1360. #define MCSPI_CH2STAT_TXFFE 0x00000008
  1361. #define MCSPI_CH2STAT_EOT 0x00000004
  1362. #define MCSPI_CH2STAT_TXS 0x00000002
  1363. #define MCSPI_CH2STAT_RXS 0x00000001
  1364. //******************************************************************************
  1365. //
  1366. // The following are defines for the bit fields in the MCSPI_O_CH2CTRL register.
  1367. //
  1368. //******************************************************************************
  1369. #define MCSPI_CH2CTRL_EXTCLK_M 0x0000FF00 // Clock ratio extension: This
  1370. // register is used to concatenate
  1371. // with MCSPI_CHCONF[CLKD] register
  1372. // for clock ratio only when
  1373. // granularity is one clock cycle
  1374. // (MCSPI_CHCONF[CLKG] set to 1).
  1375. // Then the max value reached is
  1376. // 4096 clock divider ratio. 0x00
  1377. // Clock ratio is CLKD + 1 0x01
  1378. // Clock ratio is CLKD + 1 + 16 0xFF
  1379. // Clock ratio is CLKD + 1 + 4080
  1380. #define MCSPI_CH2CTRL_EXTCLK_S 8
  1381. #define MCSPI_CH2CTRL_EN 0x00000001 // Channel Enable 0 "Channel ""i""
  1382. // is not active" 1 "Channel ""i""
  1383. // is active"
  1384. //******************************************************************************
  1385. //
  1386. // The following are defines for the bit fields in the MCSPI_O_TX2 register.
  1387. //
  1388. //******************************************************************************
  1389. #define MCSPI_TX2_TDATA_M 0xFFFFFFFF // Channel 2 Data to transmit
  1390. #define MCSPI_TX2_TDATA_S 0
  1391. //******************************************************************************
  1392. //
  1393. // The following are defines for the bit fields in the MCSPI_O_RX2 register.
  1394. //
  1395. //******************************************************************************
  1396. #define MCSPI_RX2_RDATA_M 0xFFFFFFFF // Channel 2 Received Data
  1397. #define MCSPI_RX2_RDATA_S 0
  1398. //******************************************************************************
  1399. //
  1400. // The following are defines for the bit fields in the MCSPI_O_CH3CONF register.
  1401. //
  1402. //******************************************************************************
  1403. #define MCSPI_CH3CONF_CLKG 0x20000000 // Clock divider granularity This
  1404. // register defines the granularity
  1405. // of channel clock divider: power
  1406. // of two or one clock cycle
  1407. // granularity. When this bit is set
  1408. // the register MCSPI_CHCTRL[EXTCLK]
  1409. // must be configured to reach a
  1410. // maximum of 4096 clock divider
  1411. // ratio. Then The clock divider
  1412. // ratio is a concatenation of
  1413. // MCSPI_CHCONF[CLKD] and
  1414. // MCSPI_CHCTRL[EXTCLK] values 0
  1415. // Clock granularity of power of two
  1416. // 1 One clock cycle ganularity
  1417. #define MCSPI_CH3CONF_FFER 0x10000000 // FIFO enabled for receive:Only
  1418. // one channel can have this bit
  1419. // field set. 0 The buffer is not
  1420. // used to receive data. 1 The
  1421. // buffer is used to receive data.
  1422. #define MCSPI_CH3CONF_FFEW 0x08000000 // FIFO enabled for Transmit:Only
  1423. // one channel can have this bit
  1424. // field set. 0 The buffer is not
  1425. // used to transmit data. 1 The
  1426. // buffer is used to transmit data.
  1427. #define MCSPI_CH3CONF_TCS3_M 0x06000000 // Chip Select Time Control This
  1428. // 2-bits field defines the number
  1429. // of interface clock cycles between
  1430. // CS toggling and first or last
  1431. // edge of SPI clock. 0x0 0.5 clock
  1432. // cycle 0x1 1.5 clock cycle 0x2 2.5
  1433. // clock cycle 0x3 3.5 clock cycle
  1434. #define MCSPI_CH3CONF_TCS3_S 25
  1435. #define MCSPI_CH3CONF_SBPOL 0x01000000 // Start bit polarity 0 Start bit
  1436. // polarity is held to 0 during SPI
  1437. // transfer. 1 Start bit polarity is
  1438. // held to 1 during SPI transfer.
  1439. #define MCSPI_CH3CONF_SBE 0x00800000 // Start bit enable for SPI
  1440. // transfer 0 Default SPI transfer
  1441. // length as specified by WL bit
  1442. // field 1 Start bit D/CX added
  1443. // before SPI transfer polarity is
  1444. // defined by MCSPI_CH3CONF[SBPOL]
  1445. #define MCSPI_CH3CONF_FORCE 0x00100000 // Manual SPIEN assertion to keep
  1446. // SPIEN active between SPI words.
  1447. // (single channel master mode only)
  1448. // 0 Writing 0 into this bit drives
  1449. // low the SPIEN line when
  1450. // MCSPI_CHCONF(i)[EPOL]=0 and
  1451. // drives it high when
  1452. // MCSPI_CHCONF(i)[EPOL]=1. 1
  1453. // Writing 1 into this bit drives
  1454. // high the SPIEN line when
  1455. // MCSPI_CHCONF(i)[EPOL]=0 and
  1456. // drives it low when
  1457. // MCSPI_CHCONF(i)[EPOL]=1
  1458. #define MCSPI_CH3CONF_TURBO 0x00080000 // Turbo mode 0 Turbo is
  1459. // deactivated (recommended for
  1460. // single SPI word transfer) 1 Turbo
  1461. // is activated to maximize the
  1462. // throughput for multi SPI words
  1463. // transfer.
  1464. #define MCSPI_CH3CONF_IS 0x00040000 // Input Select 0 Data Line0
  1465. // (SPIDAT[0]) selected for
  1466. // reception. 1 Data Line1
  1467. // (SPIDAT[1]) selected for
  1468. // reception
  1469. #define MCSPI_CH3CONF_DPE1 0x00020000 // Transmission Enable for data
  1470. // line 1 (SPIDATAGZEN[1]) 0 Data
  1471. // Line1 (SPIDAT[1]) selected for
  1472. // transmission 1 No transmission on
  1473. // Data Line1 (SPIDAT[1])
  1474. #define MCSPI_CH3CONF_DPE0 0x00010000 // Transmission Enable for data
  1475. // line 0 (SPIDATAGZEN[0]) 0 Data
  1476. // Line0 (SPIDAT[0]) selected for
  1477. // transmission 1 No transmission on
  1478. // Data Line0 (SPIDAT[0])
  1479. #define MCSPI_CH3CONF_DMAR 0x00008000 // DMA Read request The DMA Read
  1480. // request line is asserted when the
  1481. // channel is enabled and a new data
  1482. // is available in the receive
  1483. // register of the channel. The DMA
  1484. // Read request line is deasserted
  1485. // on read completion of the receive
  1486. // register of the channel. 0 DMA
  1487. // Read Request disabled 1 DMA Read
  1488. // Request enabled
  1489. #define MCSPI_CH3CONF_DMAW 0x00004000 // DMA Write request. The DMA Write
  1490. // request line is asserted when The
  1491. // channel is enabled and the
  1492. // transmitter register of the
  1493. // channel is empty. The DMA Write
  1494. // request line is deasserted on
  1495. // load completion of the
  1496. // transmitter register of the
  1497. // channel. 0 DMA Write Request
  1498. // disabled 1 DMA Write Request
  1499. // enabled
  1500. #define MCSPI_CH3CONF_TRM_M 0x00003000 // Transmit/Receive modes 0x0
  1501. // Transmit and Receive mode 0x1
  1502. // Receive only mode 0x2 Transmit
  1503. // only mode 0x3 Reserved
  1504. #define MCSPI_CH3CONF_TRM_S 12
  1505. #define MCSPI_CH3CONF_WL_M 0x00000F80 // SPI word length 0x00 Reserved
  1506. // 0x01 Reserved 0x02 Reserved 0x03
  1507. // The SPI word is 4-bits long 0x04
  1508. // The SPI word is 5-bits long 0x05
  1509. // The SPI word is 6-bits long 0x06
  1510. // The SPI word is 7-bits long 0x07
  1511. // The SPI word is 8-bits long 0x08
  1512. // The SPI word is 9-bits long 0x09
  1513. // The SPI word is 10-bits long 0x0A
  1514. // The SPI word is 11-bits long 0x0B
  1515. // The SPI word is 12-bits long 0x0C
  1516. // The SPI word is 13-bits long 0x0D
  1517. // The SPI word is 14-bits long 0x0E
  1518. // The SPI word is 15-bits long 0x0F
  1519. // The SPI word is 16-bits long 0x10
  1520. // The SPI word is 17-bits long 0x11
  1521. // The SPI word is 18-bits long 0x12
  1522. // The SPI word is 19-bits long 0x13
  1523. // The SPI word is 20-bits long 0x14
  1524. // The SPI word is 21-bits long 0x15
  1525. // The SPI word is 22-bits long 0x16
  1526. // The SPI word is 23-bits long 0x17
  1527. // The SPI word is 24-bits long 0x18
  1528. // The SPI word is 25-bits long 0x19
  1529. // The SPI word is 26-bits long 0x1A
  1530. // The SPI word is 27-bits long 0x1B
  1531. // The SPI word is 28-bits long 0x1C
  1532. // The SPI word is 29-bits long 0x1D
  1533. // The SPI word is 30-bits long 0x1E
  1534. // The SPI word is 31-bits long 0x1F
  1535. // The SPI word is 32-bits long
  1536. #define MCSPI_CH3CONF_WL_S 7
  1537. #define MCSPI_CH3CONF_EPOL 0x00000040 // SPIEN polarity 0 SPIEN is held
  1538. // high during the active state. 1
  1539. // SPIEN is held low during the
  1540. // active state.
  1541. #define MCSPI_CH3CONF_CLKD_M 0x0000003C // Frequency divider for SPICLK.
  1542. // (only when the module is a Master
  1543. // SPI device). A programmable clock
  1544. // divider divides the SPI reference
  1545. // clock (CLKSPIREF) with a 4-bit
  1546. // value and results in a new clock
  1547. // SPICLK available to shift-in and
  1548. // shift-out data. By default the
  1549. // clock divider ratio has a power
  1550. // of two granularity when
  1551. // MCSPI_CHCONF[CLKG] is cleared
  1552. // Otherwise this register is the 4
  1553. // LSB bit of a 12-bit register
  1554. // concatenated with clock divider
  1555. // extension MCSPI_CHCTRL[EXTCLK]
  1556. // register.The value description
  1557. // below defines the clock ratio
  1558. // when MCSPI_CHCONF[CLKG] is set to
  1559. // 0. 0x0 1 0x1 2 0x2 4 0x3 8 0x4 16
  1560. // 0x5 32 0x6 64 0x7 128 0x8 256 0x9
  1561. // 512 0xA 1024 0xB 2048 0xC 4096
  1562. // 0xD 8192 0xE 16384 0xF 32768
  1563. #define MCSPI_CH3CONF_CLKD_S 2
  1564. #define MCSPI_CH3CONF_POL 0x00000002 // SPICLK polarity 0 SPICLK is held
  1565. // high during the active state 1
  1566. // SPICLK is held low during the
  1567. // active state
  1568. #define MCSPI_CH3CONF_PHA 0x00000001 // SPICLK phase 0 Data are latched
  1569. // on odd numbered edges of SPICLK.
  1570. // 1 Data are latched on even
  1571. // numbered edges of SPICLK.
  1572. //******************************************************************************
  1573. //
  1574. // The following are defines for the bit fields in the MCSPI_O_CH3STAT register.
  1575. //
  1576. //******************************************************************************
  1577. #define MCSPI_CH3STAT_RXFFF 0x00000040
  1578. #define MCSPI_CH3STAT_RXFFE 0x00000020
  1579. #define MCSPI_CH3STAT_TXFFF 0x00000010
  1580. #define MCSPI_CH3STAT_TXFFE 0x00000008
  1581. #define MCSPI_CH3STAT_EOT 0x00000004
  1582. #define MCSPI_CH3STAT_TXS 0x00000002
  1583. #define MCSPI_CH3STAT_RXS 0x00000001
  1584. //******************************************************************************
  1585. //
  1586. // The following are defines for the bit fields in the MCSPI_O_CH3CTRL register.
  1587. //
  1588. //******************************************************************************
  1589. #define MCSPI_CH3CTRL_EXTCLK_M 0x0000FF00 // Clock ratio extension: This
  1590. // register is used to concatenate
  1591. // with MCSPI_CHCONF[CLKD] register
  1592. // for clock ratio only when
  1593. // granularity is one clock cycle
  1594. // (MCSPI_CHCONF[CLKG] set to 1).
  1595. // Then the max value reached is
  1596. // 4096 clock divider ratio. 0x00
  1597. // Clock ratio is CLKD + 1 0x01
  1598. // Clock ratio is CLKD + 1 + 16 0xFF
  1599. // Clock ratio is CLKD + 1 + 4080
  1600. #define MCSPI_CH3CTRL_EXTCLK_S 8
  1601. #define MCSPI_CH3CTRL_EN 0x00000001 // Channel Enable 0 "Channel ""i""
  1602. // is not active" 1 "Channel ""i""
  1603. // is active"
  1604. //******************************************************************************
  1605. //
  1606. // The following are defines for the bit fields in the MCSPI_O_TX3 register.
  1607. //
  1608. //******************************************************************************
  1609. #define MCSPI_TX3_TDATA_M 0xFFFFFFFF // Channel 3 Data to transmit
  1610. #define MCSPI_TX3_TDATA_S 0
  1611. //******************************************************************************
  1612. //
  1613. // The following are defines for the bit fields in the MCSPI_O_RX3 register.
  1614. //
  1615. //******************************************************************************
  1616. #define MCSPI_RX3_RDATA_M 0xFFFFFFFF // Channel 3 Received Data
  1617. #define MCSPI_RX3_RDATA_S 0
  1618. //******************************************************************************
  1619. //
  1620. // The following are defines for the bit fields in the MCSPI_O_XFERLEVEL register.
  1621. //
  1622. //******************************************************************************
  1623. #define MCSPI_XFERLEVEL_WCNT_M 0xFFFF0000 // Spi word counterThis register
  1624. // holds the programmable value of
  1625. // number of SPI word to be
  1626. // transferred on channel which is
  1627. // using the FIFO buffer.When
  1628. // transfer had started a read back
  1629. // in this register returns the
  1630. // current SPI word transfer index.
  1631. // 0x0000 Counter not used 0x0001
  1632. // one word 0xFFFE 65534 spi word
  1633. // 0xFFFF 65535 spi word
  1634. #define MCSPI_XFERLEVEL_WCNT_S 16
  1635. #define MCSPI_XFERLEVEL_AFL_M 0x0000FF00 // Buffer Almost Full This register
  1636. // holds the programmable almost
  1637. // full level value used to
  1638. // determine almost full buffer
  1639. // condition. If the user wants an
  1640. // interrupt or a DMA read request
  1641. // to be issued during a receive
  1642. // operation when the data buffer
  1643. // holds at least n bytes then the
  1644. // buffer MCSPI_MODULCTRL[AFL] must
  1645. // be set with n-1.The size of this
  1646. // register is defined by the
  1647. // generic parameter FFNBYTE. 0x00
  1648. // one byte 0x01 2 bytes 0xFE
  1649. // 255bytes 0xFF 256bytes
  1650. #define MCSPI_XFERLEVEL_AFL_S 8
  1651. #define MCSPI_XFERLEVEL_AEL_M 0x000000FF // Buffer Almost EmptyThis register
  1652. // holds the programmable almost
  1653. // empty level value used to
  1654. // determine almost empty buffer
  1655. // condition. If the user wants an
  1656. // interrupt or a DMA write request
  1657. // to be issued during a transmit
  1658. // operation when the data buffer is
  1659. // able to receive n bytes then the
  1660. // buffer MCSPI_MODULCTRL[AEL] must
  1661. // be set with n-1. 0x00 one byte
  1662. // 0x01 2 bytes 0xFE 255 bytes 0xFF
  1663. // 256bytes
  1664. #define MCSPI_XFERLEVEL_AEL_S 0
  1665. //******************************************************************************
  1666. //
  1667. // The following are defines for the bit fields in the MCSPI_O_DAFTX register.
  1668. //
  1669. //******************************************************************************
  1670. #define MCSPI_DAFTX_DAFTDATA_M 0xFFFFFFFF // FIFO Data to transmit with DMA
  1671. // 256 bit aligned address. "This
  1672. // Register is only is used when
  1673. // MCSPI_MODULCTRL[FDAA] is set to
  1674. // ""1"" and only one of the
  1675. // MCSPI_CH(i)CONF[FFEW] of enabled
  1676. // channels is set. If these
  1677. // conditions are not respected any
  1678. // access to this register return a
  1679. // null value."
  1680. #define MCSPI_DAFTX_DAFTDATA_S 0
  1681. //******************************************************************************
  1682. //
  1683. // The following are defines for the bit fields in the MCSPI_O_DAFRX register.
  1684. //
  1685. //******************************************************************************
  1686. #define MCSPI_DAFRX_DAFRDATA_M 0xFFFFFFFF // FIFO Data to transmit with DMA
  1687. // 256 bit aligned address. "This
  1688. // Register is only is used when
  1689. // MCSPI_MODULCTRL[FDAA] is set to
  1690. // ""1"" and only one of the
  1691. // MCSPI_CH(i)CONF[FFEW] of enabled
  1692. // channels is set. If these
  1693. // conditions are not respected any
  1694. // access to this register return a
  1695. // null value."
  1696. #define MCSPI_DAFRX_DAFRDATA_S 0
  1697. #endif // __HW_MCSPI_H__