MC68328.h 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  1. /* include/asm-m68knommu/MC68328.h: '328 control registers
  2. *
  3. * Copyright (C) 1999 Vladimir Gurevich <vgurevic@cisco.com>
  4. * Bear & Hare Software, Inc.
  5. *
  6. * Based on include/asm-m68knommu/MC68332.h
  7. * Copyright (C) 1998 Kenneth Albanowski <kjahds@kjahds.com>,
  8. *
  9. */
  10. #ifndef _MC68328_H_
  11. #define _MC68328_H_
  12. #define BYTE_REF(addr) (*((volatile unsigned char*)addr))
  13. #define WORD_REF(addr) (*((volatile unsigned short*)addr))
  14. #define LONG_REF(addr) (*((volatile unsigned long*)addr))
  15. #define PUT_FIELD(field, val) (((val) << field##_SHIFT) & field##_MASK)
  16. #define GET_FIELD(reg, field) (((reg) & field##_MASK) >> field##_SHIFT)
  17. /**********
  18. *
  19. * 0xFFFFF0xx -- System Control
  20. *
  21. **********/
  22. /*
  23. * System Control Register (SCR)
  24. */
  25. #define SCR_ADDR 0xfffff000
  26. #define SCR BYTE_REF(SCR_ADDR)
  27. #define SCR_WDTH8 0x01 /* 8-Bit Width Select */
  28. #define SCR_DMAP 0x04 /* Double Map */
  29. #define SCR_SO 0x08 /* Supervisor Only */
  30. #define SCR_BETEN 0x10 /* Bus-Error Time-Out Enable */
  31. #define SCR_PRV 0x20 /* Privilege Violation */
  32. #define SCR_WPV 0x40 /* Write Protect Violation */
  33. #define SCR_BETO 0x80 /* Bus-Error TimeOut */
  34. /*
  35. * Mask Revision Register
  36. */
  37. #define MRR_ADDR 0xfffff004
  38. #define MRR LONG_REF(MRR_ADDR)
  39. /**********
  40. *
  41. * 0xFFFFF1xx -- Chip-Select logic
  42. *
  43. **********/
  44. /**********
  45. *
  46. * 0xFFFFF2xx -- Phase Locked Loop (PLL) & Power Control
  47. *
  48. **********/
  49. /*
  50. * Group Base Address Registers
  51. */
  52. #define GRPBASEA_ADDR 0xfffff100
  53. #define GRPBASEB_ADDR 0xfffff102
  54. #define GRPBASEC_ADDR 0xfffff104
  55. #define GRPBASED_ADDR 0xfffff106
  56. #define GRPBASEA WORD_REF(GRPBASEA_ADDR)
  57. #define GRPBASEB WORD_REF(GRPBASEB_ADDR)
  58. #define GRPBASEC WORD_REF(GRPBASEC_ADDR)
  59. #define GRPBASED WORD_REF(GRPBASED_ADDR)
  60. #define GRPBASE_V 0x0001 /* Valid */
  61. #define GRPBASE_GBA_MASK 0xfff0 /* Group Base Address (bits 31-20) */
  62. /*
  63. * Group Base Address Mask Registers
  64. */
  65. #define GRPMASKA_ADDR 0xfffff108
  66. #define GRPMASKB_ADDR 0xfffff10a
  67. #define GRPMASKC_ADDR 0xfffff10c
  68. #define GRPMASKD_ADDR 0xfffff10e
  69. #define GRPMASKA WORD_REF(GRPMASKA_ADDR)
  70. #define GRPMASKB WORD_REF(GRPMASKB_ADDR)
  71. #define GRPMASKC WORD_REF(GRPMASKC_ADDR)
  72. #define GRPMASKD WORD_REF(GRPMASKD_ADDR)
  73. #define GRMMASK_GMA_MASK 0xfffff0 /* Group Base Mask (bits 31-20) */
  74. /*
  75. * Chip-Select Option Registers (group A)
  76. */
  77. #define CSA0_ADDR 0xfffff110
  78. #define CSA1_ADDR 0xfffff114
  79. #define CSA2_ADDR 0xfffff118
  80. #define CSA3_ADDR 0xfffff11c
  81. #define CSA0 LONG_REF(CSA0_ADDR)
  82. #define CSA1 LONG_REF(CSA1_ADDR)
  83. #define CSA2 LONG_REF(CSA2_ADDR)
  84. #define CSA3 LONG_REF(CSA3_ADDR)
  85. #define CSA_WAIT_MASK 0x00000007 /* Wait State Selection */
  86. #define CSA_WAIT_SHIFT 0
  87. #define CSA_RO 0x00000008 /* Read-Only */
  88. #define CSA_AM_MASK 0x0000ff00 /* Address Mask (bits 23-16) */
  89. #define CSA_AM_SHIFT 8
  90. #define CSA_BUSW 0x00010000 /* Bus Width Select */
  91. #define CSA_AC_MASK 0xff000000 /* Address Compare (bits 23-16) */
  92. #define CSA_AC_SHIFT 24
  93. /*
  94. * Chip-Select Option Registers (group B)
  95. */
  96. #define CSB0_ADDR 0xfffff120
  97. #define CSB1_ADDR 0xfffff124
  98. #define CSB2_ADDR 0xfffff128
  99. #define CSB3_ADDR 0xfffff12c
  100. #define CSB0 LONG_REF(CSB0_ADDR)
  101. #define CSB1 LONG_REF(CSB1_ADDR)
  102. #define CSB2 LONG_REF(CSB2_ADDR)
  103. #define CSB3 LONG_REF(CSB3_ADDR)
  104. #define CSB_WAIT_MASK 0x00000007 /* Wait State Selection */
  105. #define CSB_WAIT_SHIFT 0
  106. #define CSB_RO 0x00000008 /* Read-Only */
  107. #define CSB_AM_MASK 0x0000ff00 /* Address Mask (bits 23-16) */
  108. #define CSB_AM_SHIFT 8
  109. #define CSB_BUSW 0x00010000 /* Bus Width Select */
  110. #define CSB_AC_MASK 0xff000000 /* Address Compare (bits 23-16) */
  111. #define CSB_AC_SHIFT 24
  112. /*
  113. * Chip-Select Option Registers (group C)
  114. */
  115. #define CSC0_ADDR 0xfffff130
  116. #define CSC1_ADDR 0xfffff134
  117. #define CSC2_ADDR 0xfffff138
  118. #define CSC3_ADDR 0xfffff13c
  119. #define CSC0 LONG_REF(CSC0_ADDR)
  120. #define CSC1 LONG_REF(CSC1_ADDR)
  121. #define CSC2 LONG_REF(CSC2_ADDR)
  122. #define CSC3 LONG_REF(CSC3_ADDR)
  123. #define CSC_WAIT_MASK 0x00000007 /* Wait State Selection */
  124. #define CSC_WAIT_SHIFT 0
  125. #define CSC_RO 0x00000008 /* Read-Only */
  126. #define CSC_AM_MASK 0x0000fff0 /* Address Mask (bits 23-12) */
  127. #define CSC_AM_SHIFT 4
  128. #define CSC_BUSW 0x00010000 /* Bus Width Select */
  129. #define CSC_AC_MASK 0xfff00000 /* Address Compare (bits 23-12) */
  130. #define CSC_AC_SHIFT 20
  131. /*
  132. * Chip-Select Option Registers (group D)
  133. */
  134. #define CSD0_ADDR 0xfffff140
  135. #define CSD1_ADDR 0xfffff144
  136. #define CSD2_ADDR 0xfffff148
  137. #define CSD3_ADDR 0xfffff14c
  138. #define CSD0 LONG_REF(CSD0_ADDR)
  139. #define CSD1 LONG_REF(CSD1_ADDR)
  140. #define CSD2 LONG_REF(CSD2_ADDR)
  141. #define CSD3 LONG_REF(CSD3_ADDR)
  142. #define CSD_WAIT_MASK 0x00000007 /* Wait State Selection */
  143. #define CSD_WAIT_SHIFT 0
  144. #define CSD_RO 0x00000008 /* Read-Only */
  145. #define CSD_AM_MASK 0x0000fff0 /* Address Mask (bits 23-12) */
  146. #define CSD_AM_SHIFT 4
  147. #define CSD_BUSW 0x00010000 /* Bus Width Select */
  148. #define CSD_AC_MASK 0xfff00000 /* Address Compare (bits 23-12) */
  149. #define CSD_AC_SHIFT 20
  150. /**********
  151. *
  152. * 0xFFFFF2xx -- Phase Locked Loop (PLL) & Power Control
  153. *
  154. **********/
  155. /*
  156. * PLL Control Register
  157. */
  158. #define PLLCR_ADDR 0xfffff200
  159. #define PLLCR WORD_REF(PLLCR_ADDR)
  160. #define PLLCR_DISPLL 0x0008 /* Disable PLL */
  161. #define PLLCR_CLKEN 0x0010 /* Clock (CLKO pin) enable */
  162. #define PLLCR_SYSCLK_SEL_MASK 0x0700 /* System Clock Selection */
  163. #define PLLCR_SYSCLK_SEL_SHIFT 8
  164. #define PLLCR_PIXCLK_SEL_MASK 0x3800 /* LCD Clock Selection */
  165. #define PLLCR_PIXCLK_SEL_SHIFT 11
  166. /* 'EZ328-compatible definitions */
  167. #define PLLCR_LCDCLK_SEL_MASK PLLCR_PIXCLK_SEL_MASK
  168. #define PLLCR_LCDCLK_SEL_SHIFT PLLCR_PIXCLK_SEL_SHIFT
  169. /*
  170. * PLL Frequency Select Register
  171. */
  172. #define PLLFSR_ADDR 0xfffff202
  173. #define PLLFSR WORD_REF(PLLFSR_ADDR)
  174. #define PLLFSR_PC_MASK 0x00ff /* P Count */
  175. #define PLLFSR_PC_SHIFT 0
  176. #define PLLFSR_QC_MASK 0x0f00 /* Q Count */
  177. #define PLLFSR_QC_SHIFT 8
  178. #define PLLFSR_PROT 0x4000 /* Protect P & Q */
  179. #define PLLFSR_CLK32 0x8000 /* Clock 32 (kHz) */
  180. /*
  181. * Power Control Register
  182. */
  183. #define PCTRL_ADDR 0xfffff207
  184. #define PCTRL BYTE_REF(PCTRL_ADDR)
  185. #define PCTRL_WIDTH_MASK 0x1f /* CPU Clock bursts width */
  186. #define PCTRL_WIDTH_SHIFT 0
  187. #define PCTRL_STOP 0x40 /* Enter power-save mode immediately */
  188. #define PCTRL_PCEN 0x80 /* Power Control Enable */
  189. /**********
  190. *
  191. * 0xFFFFF3xx -- Interrupt Controller
  192. *
  193. **********/
  194. /*
  195. * Interrupt Vector Register
  196. */
  197. #define IVR_ADDR 0xfffff300
  198. #define IVR BYTE_REF(IVR_ADDR)
  199. #define IVR_VECTOR_MASK 0xF8
  200. /*
  201. * Interrupt control Register
  202. */
  203. #define ICR_ADRR 0xfffff302
  204. #define ICR WORD_REF(ICR_ADDR)
  205. #define ICR_ET6 0x0100 /* Edge Trigger Select for IRQ6 */
  206. #define ICR_ET3 0x0200 /* Edge Trigger Select for IRQ3 */
  207. #define ICR_ET2 0x0400 /* Edge Trigger Select for IRQ2 */
  208. #define ICR_ET1 0x0800 /* Edge Trigger Select for IRQ1 */
  209. #define ICR_POL6 0x1000 /* Polarity Control for IRQ6 */
  210. #define ICR_POL3 0x2000 /* Polarity Control for IRQ3 */
  211. #define ICR_POL2 0x4000 /* Polarity Control for IRQ2 */
  212. #define ICR_POL1 0x8000 /* Polarity Control for IRQ1 */
  213. /*
  214. * Interrupt Mask Register
  215. */
  216. #define IMR_ADDR 0xfffff304
  217. #define IMR LONG_REF(IMR_ADDR)
  218. /*
  219. * Define the names for bit positions first. This is useful for
  220. * request_irq
  221. */
  222. #define SPIM_IRQ_NUM 0 /* SPI Master interrupt */
  223. #define TMR2_IRQ_NUM 1 /* Timer 2 interrupt */
  224. #define UART_IRQ_NUM 2 /* UART interrupt */
  225. #define WDT_IRQ_NUM 3 /* Watchdog Timer interrupt */
  226. #define RTC_IRQ_NUM 4 /* RTC interrupt */
  227. #define KB_IRQ_NUM 6 /* Keyboard Interrupt */
  228. #define PWM_IRQ_NUM 7 /* Pulse-Width Modulator int. */
  229. #define INT0_IRQ_NUM 8 /* External INT0 */
  230. #define INT1_IRQ_NUM 9 /* External INT1 */
  231. #define INT2_IRQ_NUM 10 /* External INT2 */
  232. #define INT3_IRQ_NUM 11 /* External INT3 */
  233. #define INT4_IRQ_NUM 12 /* External INT4 */
  234. #define INT5_IRQ_NUM 13 /* External INT5 */
  235. #define INT6_IRQ_NUM 14 /* External INT6 */
  236. #define INT7_IRQ_NUM 15 /* External INT7 */
  237. #define IRQ1_IRQ_NUM 16 /* IRQ1 */
  238. #define IRQ2_IRQ_NUM 17 /* IRQ2 */
  239. #define IRQ3_IRQ_NUM 18 /* IRQ3 */
  240. #define IRQ6_IRQ_NUM 19 /* IRQ6 */
  241. #define PEN_IRQ_NUM 20 /* Pen Interrupt */
  242. #define SPIS_IRQ_NUM 21 /* SPI Slave Interrupt */
  243. #define TMR1_IRQ_NUM 22 /* Timer 1 interrupt */
  244. #define IRQ7_IRQ_NUM 23 /* IRQ7 */
  245. /* '328-compatible definitions */
  246. #define SPI_IRQ_NUM SPIM_IRQ_NUM
  247. #define TMR_IRQ_NUM TMR1_IRQ_NUM
  248. /*
  249. * Here go the bitmasks themselves
  250. */
  251. #define IMR_MSPIM (1 << SPIM_IRQ_NUM) /* Mask SPI Master interrupt */
  252. #define IMR_MTMR2 (1 << TMR2_IRQ_NUM) /* Mask Timer 2 interrupt */
  253. #define IMR_MUART (1 << UART_IRQ_NUM) /* Mask UART interrupt */
  254. #define IMR_MWDT (1 << WDT_IRQ_NUM) /* Mask Watchdog Timer interrupt */
  255. #define IMR_MRTC (1 << RTC_IRQ_NUM) /* Mask RTC interrupt */
  256. #define IMR_MKB (1 << KB_IRQ_NUM) /* Mask Keyboard Interrupt */
  257. #define IMR_MPWM (1 << PWM_IRQ_NUM) /* Mask Pulse-Width Modulator int. */
  258. #define IMR_MINT0 (1 << INT0_IRQ_NUM) /* Mask External INT0 */
  259. #define IMR_MINT1 (1 << INT1_IRQ_NUM) /* Mask External INT1 */
  260. #define IMR_MINT2 (1 << INT2_IRQ_NUM) /* Mask External INT2 */
  261. #define IMR_MINT3 (1 << INT3_IRQ_NUM) /* Mask External INT3 */
  262. #define IMR_MINT4 (1 << INT4_IRQ_NUM) /* Mask External INT4 */
  263. #define IMR_MINT5 (1 << INT5_IRQ_NUM) /* Mask External INT5 */
  264. #define IMR_MINT6 (1 << INT6_IRQ_NUM) /* Mask External INT6 */
  265. #define IMR_MINT7 (1 << INT7_IRQ_NUM) /* Mask External INT7 */
  266. #define IMR_MIRQ1 (1 << IRQ1_IRQ_NUM) /* Mask IRQ1 */
  267. #define IMR_MIRQ2 (1 << IRQ2_IRQ_NUM) /* Mask IRQ2 */
  268. #define IMR_MIRQ3 (1 << IRQ3_IRQ_NUM) /* Mask IRQ3 */
  269. #define IMR_MIRQ6 (1 << IRQ6_IRQ_NUM) /* Mask IRQ6 */
  270. #define IMR_MPEN (1 << PEN_IRQ_NUM) /* Mask Pen Interrupt */
  271. #define IMR_MSPIS (1 << SPIS_IRQ_NUM) /* Mask SPI Slave Interrupt */
  272. #define IMR_MTMR1 (1 << TMR1_IRQ_NUM) /* Mask Timer 1 interrupt */
  273. #define IMR_MIRQ7 (1 << IRQ7_IRQ_NUM) /* Mask IRQ7 */
  274. /* 'EZ328-compatible definitions */
  275. #define IMR_MSPI IMR_MSPIM
  276. #define IMR_MTMR IMR_MTMR1
  277. /*
  278. * Interrupt Wake-Up Enable Register
  279. */
  280. #define IWR_ADDR 0xfffff308
  281. #define IWR LONG_REF(IWR_ADDR)
  282. #define IWR_SPIM (1 << SPIM_IRQ_NUM) /* SPI Master interrupt */
  283. #define IWR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */
  284. #define IWR_UART (1 << UART_IRQ_NUM) /* UART interrupt */
  285. #define IWR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */
  286. #define IWR_RTC (1 << RTC_IRQ_NUM) /* RTC interrupt */
  287. #define IWR_KB (1 << KB_IRQ_NUM) /* Keyboard Interrupt */
  288. #define IWR_PWM (1 << PWM_IRQ_NUM) /* Pulse-Width Modulator int. */
  289. #define IWR_INT0 (1 << INT0_IRQ_NUM) /* External INT0 */
  290. #define IWR_INT1 (1 << INT1_IRQ_NUM) /* External INT1 */
  291. #define IWR_INT2 (1 << INT2_IRQ_NUM) /* External INT2 */
  292. #define IWR_INT3 (1 << INT3_IRQ_NUM) /* External INT3 */
  293. #define IWR_INT4 (1 << INT4_IRQ_NUM) /* External INT4 */
  294. #define IWR_INT5 (1 << INT5_IRQ_NUM) /* External INT5 */
  295. #define IWR_INT6 (1 << INT6_IRQ_NUM) /* External INT6 */
  296. #define IWR_INT7 (1 << INT7_IRQ_NUM) /* External INT7 */
  297. #define IWR_IRQ1 (1 << IRQ1_IRQ_NUM) /* IRQ1 */
  298. #define IWR_IRQ2 (1 << IRQ2_IRQ_NUM) /* IRQ2 */
  299. #define IWR_IRQ3 (1 << IRQ3_IRQ_NUM) /* IRQ3 */
  300. #define IWR_IRQ6 (1 << IRQ6_IRQ_NUM) /* IRQ6 */
  301. #define IWR_PEN (1 << PEN_IRQ_NUM) /* Pen Interrupt */
  302. #define IWR_SPIS (1 << SPIS_IRQ_NUM) /* SPI Slave Interrupt */
  303. #define IWR_TMR1 (1 << TMR1_IRQ_NUM) /* Timer 1 interrupt */
  304. #define IWR_IRQ7 (1 << IRQ7_IRQ_NUM) /* IRQ7 */
  305. /*
  306. * Interrupt Status Register
  307. */
  308. #define ISR_ADDR 0xfffff30c
  309. #define ISR LONG_REF(ISR_ADDR)
  310. #define ISR_SPIM (1 << SPIM_IRQ_NUM) /* SPI Master interrupt */
  311. #define ISR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */
  312. #define ISR_UART (1 << UART_IRQ_NUM) /* UART interrupt */
  313. #define ISR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */
  314. #define ISR_RTC (1 << RTC_IRQ_NUM) /* RTC interrupt */
  315. #define ISR_KB (1 << KB_IRQ_NUM) /* Keyboard Interrupt */
  316. #define ISR_PWM (1 << PWM_IRQ_NUM) /* Pulse-Width Modulator int. */
  317. #define ISR_INT0 (1 << INT0_IRQ_NUM) /* External INT0 */
  318. #define ISR_INT1 (1 << INT1_IRQ_NUM) /* External INT1 */
  319. #define ISR_INT2 (1 << INT2_IRQ_NUM) /* External INT2 */
  320. #define ISR_INT3 (1 << INT3_IRQ_NUM) /* External INT3 */
  321. #define ISR_INT4 (1 << INT4_IRQ_NUM) /* External INT4 */
  322. #define ISR_INT5 (1 << INT5_IRQ_NUM) /* External INT5 */
  323. #define ISR_INT6 (1 << INT6_IRQ_NUM) /* External INT6 */
  324. #define ISR_INT7 (1 << INT7_IRQ_NUM) /* External INT7 */
  325. #define ISR_IRQ1 (1 << IRQ1_IRQ_NUM) /* IRQ1 */
  326. #define ISR_IRQ2 (1 << IRQ2_IRQ_NUM) /* IRQ2 */
  327. #define ISR_IRQ3 (1 << IRQ3_IRQ_NUM) /* IRQ3 */
  328. #define ISR_IRQ6 (1 << IRQ6_IRQ_NUM) /* IRQ6 */
  329. #define ISR_PEN (1 << PEN_IRQ_NUM) /* Pen Interrupt */
  330. #define ISR_SPIS (1 << SPIS_IRQ_NUM) /* SPI Slave Interrupt */
  331. #define ISR_TMR1 (1 << TMR1_IRQ_NUM) /* Timer 1 interrupt */
  332. #define ISR_IRQ7 (1 << IRQ7_IRQ_NUM) /* IRQ7 */
  333. /* 'EZ328-compatible definitions */
  334. #define ISR_SPI ISR_SPIM
  335. #define ISR_TMR ISR_TMR1
  336. /*
  337. * Interrupt Pending Register
  338. */
  339. #define IPR_ADDR 0xfffff310
  340. #define IPR LONG_REF(IPR_ADDR)
  341. #define IPR_SPIM (1 << SPIM_IRQ_NUM) /* SPI Master interrupt */
  342. #define IPR_TMR2 (1 << TMR2_IRQ_NUM) /* Timer 2 interrupt */
  343. #define IPR_UART (1 << UART_IRQ_NUM) /* UART interrupt */
  344. #define IPR_WDT (1 << WDT_IRQ_NUM) /* Watchdog Timer interrupt */
  345. #define IPR_RTC (1 << RTC_IRQ_NUM) /* RTC interrupt */
  346. #define IPR_KB (1 << KB_IRQ_NUM) /* Keyboard Interrupt */
  347. #define IPR_PWM (1 << PWM_IRQ_NUM) /* Pulse-Width Modulator int. */
  348. #define IPR_INT0 (1 << INT0_IRQ_NUM) /* External INT0 */
  349. #define IPR_INT1 (1 << INT1_IRQ_NUM) /* External INT1 */
  350. #define IPR_INT2 (1 << INT2_IRQ_NUM) /* External INT2 */
  351. #define IPR_INT3 (1 << INT3_IRQ_NUM) /* External INT3 */
  352. #define IPR_INT4 (1 << INT4_IRQ_NUM) /* External INT4 */
  353. #define IPR_INT5 (1 << INT5_IRQ_NUM) /* External INT5 */
  354. #define IPR_INT6 (1 << INT6_IRQ_NUM) /* External INT6 */
  355. #define IPR_INT7 (1 << INT7_IRQ_NUM) /* External INT7 */
  356. #define IPR_IRQ1 (1 << IRQ1_IRQ_NUM) /* IRQ1 */
  357. #define IPR_IRQ2 (1 << IRQ2_IRQ_NUM) /* IRQ2 */
  358. #define IPR_IRQ3 (1 << IRQ3_IRQ_NUM) /* IRQ3 */
  359. #define IPR_IRQ6 (1 << IRQ6_IRQ_NUM) /* IRQ6 */
  360. #define IPR_PEN (1 << PEN_IRQ_NUM) /* Pen Interrupt */
  361. #define IPR_SPIS (1 << SPIS_IRQ_NUM) /* SPI Slave Interrupt */
  362. #define IPR_TMR1 (1 << TMR1_IRQ_NUM) /* Timer 1 interrupt */
  363. #define IPR_IRQ7 (1 << IRQ7_IRQ_NUM) /* IRQ7 */
  364. /* 'EZ328-compatible definitions */
  365. #define IPR_SPI IPR_SPIM
  366. #define IPR_TMR IPR_TMR1
  367. /**********
  368. *
  369. * 0xFFFFF4xx -- Parallel Ports
  370. *
  371. **********/
  372. /*
  373. * Port A
  374. */
  375. #define PADIR_ADDR 0xfffff400 /* Port A direction reg */
  376. #define PADATA_ADDR 0xfffff401 /* Port A data register */
  377. #define PASEL_ADDR 0xfffff403 /* Port A Select register */
  378. #define PADIR BYTE_REF(PADIR_ADDR)
  379. #define PADATA BYTE_REF(PADATA_ADDR)
  380. #define PASEL BYTE_REF(PASEL_ADDR)
  381. #define PA(x) (1 << (x))
  382. #define PA_A(x) PA((x) - 16) /* This is specific to PA only! */
  383. #define PA_A16 PA(0) /* Use A16 as PA(0) */
  384. #define PA_A17 PA(1) /* Use A17 as PA(1) */
  385. #define PA_A18 PA(2) /* Use A18 as PA(2) */
  386. #define PA_A19 PA(3) /* Use A19 as PA(3) */
  387. #define PA_A20 PA(4) /* Use A20 as PA(4) */
  388. #define PA_A21 PA(5) /* Use A21 as PA(5) */
  389. #define PA_A22 PA(6) /* Use A22 as PA(6) */
  390. #define PA_A23 PA(7) /* Use A23 as PA(7) */
  391. /*
  392. * Port B
  393. */
  394. #define PBDIR_ADDR 0xfffff408 /* Port B direction reg */
  395. #define PBDATA_ADDR 0xfffff409 /* Port B data register */
  396. #define PBSEL_ADDR 0xfffff40b /* Port B Select Register */
  397. #define PBDIR BYTE_REF(PBDIR_ADDR)
  398. #define PBDATA BYTE_REF(PBDATA_ADDR)
  399. #define PBSEL BYTE_REF(PBSEL_ADDR)
  400. #define PB(x) (1 << (x))
  401. #define PB_D(x) PB(x) /* This is specific to port B only */
  402. #define PB_D0 PB(0) /* Use D0 as PB(0) */
  403. #define PB_D1 PB(1) /* Use D1 as PB(1) */
  404. #define PB_D2 PB(2) /* Use D2 as PB(2) */
  405. #define PB_D3 PB(3) /* Use D3 as PB(3) */
  406. #define PB_D4 PB(4) /* Use D4 as PB(4) */
  407. #define PB_D5 PB(5) /* Use D5 as PB(5) */
  408. #define PB_D6 PB(6) /* Use D6 as PB(6) */
  409. #define PB_D7 PB(7) /* Use D7 as PB(7) */
  410. /*
  411. * Port C
  412. */
  413. #define PCDIR_ADDR 0xfffff410 /* Port C direction reg */
  414. #define PCDATA_ADDR 0xfffff411 /* Port C data register */
  415. #define PCSEL_ADDR 0xfffff413 /* Port C Select Register */
  416. #define PCDIR BYTE_REF(PCDIR_ADDR)
  417. #define PCDATA BYTE_REF(PCDATA_ADDR)
  418. #define PCSEL BYTE_REF(PCSEL_ADDR)
  419. #define PC(x) (1 << (x))
  420. #define PC_WE PC(6) /* Use WE as PC(6) */
  421. #define PC_DTACK PC(5) /* Use DTACK as PC(5) */
  422. #define PC_IRQ7 PC(4) /* Use IRQ7 as PC(4) */
  423. #define PC_LDS PC(2) /* Use LDS as PC(2) */
  424. #define PC_UDS PC(1) /* Use UDS as PC(1) */
  425. #define PC_MOCLK PC(0) /* Use MOCLK as PC(0) */
  426. /*
  427. * Port D
  428. */
  429. #define PDDIR_ADDR 0xfffff418 /* Port D direction reg */
  430. #define PDDATA_ADDR 0xfffff419 /* Port D data register */
  431. #define PDPUEN_ADDR 0xfffff41a /* Port D Pull-Up enable reg */
  432. #define PDPOL_ADDR 0xfffff41c /* Port D Polarity Register */
  433. #define PDIRQEN_ADDR 0xfffff41d /* Port D IRQ enable register */
  434. #define PDIQEG_ADDR 0xfffff41f /* Port D IRQ Edge Register */
  435. #define PDDIR BYTE_REF(PDDIR_ADDR)
  436. #define PDDATA BYTE_REF(PDDATA_ADDR)
  437. #define PDPUEN BYTE_REF(PDPUEN_ADDR)
  438. #define PDPOL BYTE_REF(PDPOL_ADDR)
  439. #define PDIRQEN BYTE_REF(PDIRQEN_ADDR)
  440. #define PDIQEG BYTE_REF(PDIQEG_ADDR)
  441. #define PD(x) (1 << (x))
  442. #define PD_KB(x) PD(x) /* This is specific for Port D only */
  443. #define PD_KB0 PD(0) /* Use KB0 as PD(0) */
  444. #define PD_KB1 PD(1) /* Use KB1 as PD(1) */
  445. #define PD_KB2 PD(2) /* Use KB2 as PD(2) */
  446. #define PD_KB3 PD(3) /* Use KB3 as PD(3) */
  447. #define PD_KB4 PD(4) /* Use KB4 as PD(4) */
  448. #define PD_KB5 PD(5) /* Use KB5 as PD(5) */
  449. #define PD_KB6 PD(6) /* Use KB6 as PD(6) */
  450. #define PD_KB7 PD(7) /* Use KB7 as PD(7) */
  451. /*
  452. * Port E
  453. */
  454. #define PEDIR_ADDR 0xfffff420 /* Port E direction reg */
  455. #define PEDATA_ADDR 0xfffff421 /* Port E data register */
  456. #define PEPUEN_ADDR 0xfffff422 /* Port E Pull-Up enable reg */
  457. #define PESEL_ADDR 0xfffff423 /* Port E Select Register */
  458. #define PEDIR BYTE_REF(PEDIR_ADDR)
  459. #define PEDATA BYTE_REF(PEDATA_ADDR)
  460. #define PEPUEN BYTE_REF(PEPUEN_ADDR)
  461. #define PESEL BYTE_REF(PESEL_ADDR)
  462. #define PE(x) (1 << (x))
  463. #define PE_CSA1 PE(1) /* Use CSA1 as PE(1) */
  464. #define PE_CSA2 PE(2) /* Use CSA2 as PE(2) */
  465. #define PE_CSA3 PE(3) /* Use CSA3 as PE(3) */
  466. #define PE_CSB0 PE(4) /* Use CSB0 as PE(4) */
  467. #define PE_CSB1 PE(5) /* Use CSB1 as PE(5) */
  468. #define PE_CSB2 PE(6) /* Use CSB2 as PE(6) */
  469. #define PE_CSB3 PE(7) /* Use CSB3 as PE(7) */
  470. /*
  471. * Port F
  472. */
  473. #define PFDIR_ADDR 0xfffff428 /* Port F direction reg */
  474. #define PFDATA_ADDR 0xfffff429 /* Port F data register */
  475. #define PFPUEN_ADDR 0xfffff42a /* Port F Pull-Up enable reg */
  476. #define PFSEL_ADDR 0xfffff42b /* Port F Select Register */
  477. #define PFDIR BYTE_REF(PFDIR_ADDR)
  478. #define PFDATA BYTE_REF(PFDATA_ADDR)
  479. #define PFPUEN BYTE_REF(PFPUEN_ADDR)
  480. #define PFSEL BYTE_REF(PFSEL_ADDR)
  481. #define PF(x) (1 << (x))
  482. #define PF_A(x) PF((x) - 24) /* This is Port F specific only */
  483. #define PF_A24 PF(0) /* Use A24 as PF(0) */
  484. #define PF_A25 PF(1) /* Use A25 as PF(1) */
  485. #define PF_A26 PF(2) /* Use A26 as PF(2) */
  486. #define PF_A27 PF(3) /* Use A27 as PF(3) */
  487. #define PF_A28 PF(4) /* Use A28 as PF(4) */
  488. #define PF_A29 PF(5) /* Use A29 as PF(5) */
  489. #define PF_A30 PF(6) /* Use A30 as PF(6) */
  490. #define PF_A31 PF(7) /* Use A31 as PF(7) */
  491. /*
  492. * Port G
  493. */
  494. #define PGDIR_ADDR 0xfffff430 /* Port G direction reg */
  495. #define PGDATA_ADDR 0xfffff431 /* Port G data register */
  496. #define PGPUEN_ADDR 0xfffff432 /* Port G Pull-Up enable reg */
  497. #define PGSEL_ADDR 0xfffff433 /* Port G Select Register */
  498. #define PGDIR BYTE_REF(PGDIR_ADDR)
  499. #define PGDATA BYTE_REF(PGDATA_ADDR)
  500. #define PGPUEN BYTE_REF(PGPUEN_ADDR)
  501. #define PGSEL BYTE_REF(PGSEL_ADDR)
  502. #define PG(x) (1 << (x))
  503. #define PG_UART_TXD PG(0) /* Use UART_TXD as PG(0) */
  504. #define PG_UART_RXD PG(1) /* Use UART_RXD as PG(1) */
  505. #define PG_PWMOUT PG(2) /* Use PWMOUT as PG(2) */
  506. #define PG_TOUT2 PG(3) /* Use TOUT2 as PG(3) */
  507. #define PG_TIN2 PG(4) /* Use TIN2 as PG(4) */
  508. #define PG_TOUT1 PG(5) /* Use TOUT1 as PG(5) */
  509. #define PG_TIN1 PG(6) /* Use TIN1 as PG(6) */
  510. #define PG_RTCOUT PG(7) /* Use RTCOUT as PG(7) */
  511. /*
  512. * Port J
  513. */
  514. #define PJDIR_ADDR 0xfffff438 /* Port J direction reg */
  515. #define PJDATA_ADDR 0xfffff439 /* Port J data register */
  516. #define PJSEL_ADDR 0xfffff43b /* Port J Select Register */
  517. #define PJDIR BYTE_REF(PJDIR_ADDR)
  518. #define PJDATA BYTE_REF(PJDATA_ADDR)
  519. #define PJSEL BYTE_REF(PJSEL_ADDR)
  520. #define PJ(x) (1 << (x))
  521. #define PJ_CSD3 PJ(7) /* Use CSD3 as PJ(7) */
  522. /*
  523. * Port K
  524. */
  525. #define PKDIR_ADDR 0xfffff440 /* Port K direction reg */
  526. #define PKDATA_ADDR 0xfffff441 /* Port K data register */
  527. #define PKPUEN_ADDR 0xfffff442 /* Port K Pull-Up enable reg */
  528. #define PKSEL_ADDR 0xfffff443 /* Port K Select Register */
  529. #define PKDIR BYTE_REF(PKDIR_ADDR)
  530. #define PKDATA BYTE_REF(PKDATA_ADDR)
  531. #define PKPUEN BYTE_REF(PKPUEN_ADDR)
  532. #define PKSEL BYTE_REF(PKSEL_ADDR)
  533. #define PK(x) (1 << (x))
  534. /*
  535. * Port M
  536. */
  537. #define PMDIR_ADDR 0xfffff438 /* Port M direction reg */
  538. #define PMDATA_ADDR 0xfffff439 /* Port M data register */
  539. #define PMPUEN_ADDR 0xfffff43a /* Port M Pull-Up enable reg */
  540. #define PMSEL_ADDR 0xfffff43b /* Port M Select Register */
  541. #define PMDIR BYTE_REF(PMDIR_ADDR)
  542. #define PMDATA BYTE_REF(PMDATA_ADDR)
  543. #define PMPUEN BYTE_REF(PMPUEN_ADDR)
  544. #define PMSEL BYTE_REF(PMSEL_ADDR)
  545. #define PM(x) (1 << (x))
  546. /**********
  547. *
  548. * 0xFFFFF5xx -- Pulse-Width Modulator (PWM)
  549. *
  550. **********/
  551. /*
  552. * PWM Control Register
  553. */
  554. #define PWMC_ADDR 0xfffff500
  555. #define PWMC WORD_REF(PWMC_ADDR)
  556. #define PWMC_CLKSEL_MASK 0x0007 /* Clock Selection */
  557. #define PWMC_CLKSEL_SHIFT 0
  558. #define PWMC_PWMEN 0x0010 /* Enable PWM */
  559. #define PMNC_POL 0x0020 /* PWM Output Bit Polarity */
  560. #define PWMC_PIN 0x0080 /* Current PWM output pin status */
  561. #define PWMC_LOAD 0x0100 /* Force a new period */
  562. #define PWMC_IRQEN 0x4000 /* Interrupt Request Enable */
  563. #define PWMC_CLKSRC 0x8000 /* Clock Source Select */
  564. /* 'EZ328-compatible definitions */
  565. #define PWMC_EN PWMC_PWMEN
  566. /*
  567. * PWM Period Register
  568. */
  569. #define PWMP_ADDR 0xfffff502
  570. #define PWMP WORD_REF(PWMP_ADDR)
  571. /*
  572. * PWM Width Register
  573. */
  574. #define PWMW_ADDR 0xfffff504
  575. #define PWMW WORD_REF(PWMW_ADDR)
  576. /*
  577. * PWM Counter Register
  578. */
  579. #define PWMCNT_ADDR 0xfffff506
  580. #define PWMCNT WORD_REF(PWMCNT_ADDR)
  581. /**********
  582. *
  583. * 0xFFFFF6xx -- General-Purpose Timers
  584. *
  585. **********/
  586. /*
  587. * Timer Unit 1 and 2 Control Registers
  588. */
  589. #define TCTL1_ADDR 0xfffff600
  590. #define TCTL1 WORD_REF(TCTL1_ADDR)
  591. #define TCTL2_ADDR 0xfffff60c
  592. #define TCTL2 WORD_REF(TCTL2_ADDR)
  593. #define TCTL_TEN 0x0001 /* Timer Enable */
  594. #define TCTL_CLKSOURCE_MASK 0x000e /* Clock Source: */
  595. #define TCTL_CLKSOURCE_STOP 0x0000 /* Stop count (disabled) */
  596. #define TCTL_CLKSOURCE_SYSCLK 0x0002 /* SYSCLK to prescaler */
  597. #define TCTL_CLKSOURCE_SYSCLK_16 0x0004 /* SYSCLK/16 to prescaler */
  598. #define TCTL_CLKSOURCE_TIN 0x0006 /* TIN to prescaler */
  599. #define TCTL_CLKSOURCE_32KHZ 0x0008 /* 32kHz clock to prescaler */
  600. #define TCTL_IRQEN 0x0010 /* IRQ Enable */
  601. #define TCTL_OM 0x0020 /* Output Mode */
  602. #define TCTL_CAP_MASK 0x00c0 /* Capture Edge: */
  603. #define TCTL_CAP_RE 0x0040 /* Capture on rizing edge */
  604. #define TCTL_CAP_FE 0x0080 /* Capture on falling edge */
  605. #define TCTL_FRR 0x0010 /* Free-Run Mode */
  606. /* 'EZ328-compatible definitions */
  607. #define TCTL_ADDR TCTL1_ADDR
  608. #define TCTL TCTL1
  609. /*
  610. * Timer Unit 1 and 2 Prescaler Registers
  611. */
  612. #define TPRER1_ADDR 0xfffff602
  613. #define TPRER1 WORD_REF(TPRER1_ADDR)
  614. #define TPRER2_ADDR 0xfffff60e
  615. #define TPRER2 WORD_REF(TPRER2_ADDR)
  616. /* 'EZ328-compatible definitions */
  617. #define TPRER_ADDR TPRER1_ADDR
  618. #define TPRER TPRER1
  619. /*
  620. * Timer Unit 1 and 2 Compare Registers
  621. */
  622. #define TCMP1_ADDR 0xfffff604
  623. #define TCMP1 WORD_REF(TCMP1_ADDR)
  624. #define TCMP2_ADDR 0xfffff610
  625. #define TCMP2 WORD_REF(TCMP2_ADDR)
  626. /* 'EZ328-compatible definitions */
  627. #define TCMP_ADDR TCMP1_ADDR
  628. #define TCMP TCMP1
  629. /*
  630. * Timer Unit 1 and 2 Capture Registers
  631. */
  632. #define TCR1_ADDR 0xfffff606
  633. #define TCR1 WORD_REF(TCR1_ADDR)
  634. #define TCR2_ADDR 0xfffff612
  635. #define TCR2 WORD_REF(TCR2_ADDR)
  636. /* 'EZ328-compatible definitions */
  637. #define TCR_ADDR TCR1_ADDR
  638. #define TCR TCR1
  639. /*
  640. * Timer Unit 1 and 2 Counter Registers
  641. */
  642. #define TCN1_ADDR 0xfffff608
  643. #define TCN1 WORD_REF(TCN1_ADDR)
  644. #define TCN2_ADDR 0xfffff614
  645. #define TCN2 WORD_REF(TCN2_ADDR)
  646. /* 'EZ328-compatible definitions */
  647. #define TCN_ADDR TCN1_ADDR
  648. #define TCN TCN1
  649. /*
  650. * Timer Unit 1 and 2 Status Registers
  651. */
  652. #define TSTAT1_ADDR 0xfffff60a
  653. #define TSTAT1 WORD_REF(TSTAT1_ADDR)
  654. #define TSTAT2_ADDR 0xfffff616
  655. #define TSTAT2 WORD_REF(TSTAT2_ADDR)
  656. #define TSTAT_COMP 0x0001 /* Compare Event occurred */
  657. #define TSTAT_CAPT 0x0001 /* Capture Event occurred */
  658. /* 'EZ328-compatible definitions */
  659. #define TSTAT_ADDR TSTAT1_ADDR
  660. #define TSTAT TSTAT1
  661. /*
  662. * Watchdog Compare Register
  663. */
  664. #define WRR_ADDR 0xfffff61a
  665. #define WRR WORD_REF(WRR_ADDR)
  666. /*
  667. * Watchdog Counter Register
  668. */
  669. #define WCN_ADDR 0xfffff61c
  670. #define WCN WORD_REF(WCN_ADDR)
  671. /*
  672. * Watchdog Control and Status Register
  673. */
  674. #define WCSR_ADDR 0xfffff618
  675. #define WCSR WORD_REF(WCSR_ADDR)
  676. #define WCSR_WDEN 0x0001 /* Watchdog Enable */
  677. #define WCSR_FI 0x0002 /* Forced Interrupt (instead of SW reset)*/
  678. #define WCSR_WRST 0x0004 /* Watchdog Reset */
  679. /**********
  680. *
  681. * 0xFFFFF7xx -- Serial Periferial Interface Slave (SPIS)
  682. *
  683. **********/
  684. /*
  685. * SPI Slave Register
  686. */
  687. #define SPISR_ADDR 0xfffff700
  688. #define SPISR WORD_REF(SPISR_ADDR)
  689. #define SPISR_DATA_ADDR 0xfffff701
  690. #define SPISR_DATA BYTE_REF(SPISR_DATA_ADDR)
  691. #define SPISR_DATA_MASK 0x00ff /* Shifted data from the external device */
  692. #define SPISR_DATA_SHIFT 0
  693. #define SPISR_SPISEN 0x0100 /* SPIS module enable */
  694. #define SPISR_POL 0x0200 /* SPSCLK polarity control */
  695. #define SPISR_PHA 0x0400 /* Phase relationship between SPSCLK & SPSRxD */
  696. #define SPISR_OVWR 0x0800 /* Data buffer has been overwritten */
  697. #define SPISR_DATARDY 0x1000 /* Data ready */
  698. #define SPISR_ENPOL 0x2000 /* Enable Polarity */
  699. #define SPISR_IRQEN 0x4000 /* SPIS IRQ Enable */
  700. #define SPISR_SPISIRQ 0x8000 /* SPIS IRQ posted */
  701. /**********
  702. *
  703. * 0xFFFFF8xx -- Serial Periferial Interface Master (SPIM)
  704. *
  705. **********/
  706. /*
  707. * SPIM Data Register
  708. */
  709. #define SPIMDATA_ADDR 0xfffff800
  710. #define SPIMDATA WORD_REF(SPIMDATA_ADDR)
  711. /*
  712. * SPIM Control/Status Register
  713. */
  714. #define SPIMCONT_ADDR 0xfffff802
  715. #define SPIMCONT WORD_REF(SPIMCONT_ADDR)
  716. #define SPIMCONT_BIT_COUNT_MASK 0x000f /* Transfer Length in Bytes */
  717. #define SPIMCONT_BIT_COUNT_SHIFT 0
  718. #define SPIMCONT_POL 0x0010 /* SPMCLK Signel Polarity */
  719. #define SPIMCONT_PHA 0x0020 /* Clock/Data phase relationship */
  720. #define SPIMCONT_IRQEN 0x0040 /* IRQ Enable */
  721. #define SPIMCONT_SPIMIRQ 0x0080 /* Interrupt Request */
  722. #define SPIMCONT_XCH 0x0100 /* Exchange */
  723. #define SPIMCONT_RSPIMEN 0x0200 /* Enable SPIM */
  724. #define SPIMCONT_DATA_RATE_MASK 0xe000 /* SPIM Data Rate */
  725. #define SPIMCONT_DATA_RATE_SHIFT 13
  726. /* 'EZ328-compatible definitions */
  727. #define SPIMCONT_IRQ SPIMCONT_SPIMIRQ
  728. #define SPIMCONT_ENABLE SPIMCONT_SPIMEN
  729. /**********
  730. *
  731. * 0xFFFFF9xx -- UART
  732. *
  733. **********/
  734. /*
  735. * UART Status/Control Register
  736. */
  737. #define USTCNT_ADDR 0xfffff900
  738. #define USTCNT WORD_REF(USTCNT_ADDR)
  739. #define USTCNT_TXAVAILEN 0x0001 /* Transmitter Available Int Enable */
  740. #define USTCNT_TXHALFEN 0x0002 /* Transmitter Half Empty Int Enable */
  741. #define USTCNT_TXEMPTYEN 0x0004 /* Transmitter Empty Int Enable */
  742. #define USTCNT_RXREADYEN 0x0008 /* Receiver Ready Interrupt Enable */
  743. #define USTCNT_RXHALFEN 0x0010 /* Receiver Half-Full Int Enable */
  744. #define USTCNT_RXFULLEN 0x0020 /* Receiver Full Interrupt Enable */
  745. #define USTCNT_CTSDELTAEN 0x0040 /* CTS Delta Interrupt Enable */
  746. #define USTCNT_GPIODELTAEN 0x0080 /* Old Data Interrupt Enable */
  747. #define USTCNT_8_7 0x0100 /* Eight or seven-bit transmission */
  748. #define USTCNT_STOP 0x0200 /* Stop bit transmission */
  749. #define USTCNT_ODD_EVEN 0x0400 /* Odd Parity */
  750. #define USTCNT_PARITYEN 0x0800 /* Parity Enable */
  751. #define USTCNT_CLKMODE 0x1000 /* Clock Mode Select */
  752. #define USTCNT_TXEN 0x2000 /* Transmitter Enable */
  753. #define USTCNT_RXEN 0x4000 /* Receiver Enable */
  754. #define USTCNT_UARTEN 0x8000 /* UART Enable */
  755. /* 'EZ328-compatible definitions */
  756. #define USTCNT_TXAE USTCNT_TXAVAILEN
  757. #define USTCNT_TXHE USTCNT_TXHALFEN
  758. #define USTCNT_TXEE USTCNT_TXEMPTYEN
  759. #define USTCNT_RXRE USTCNT_RXREADYEN
  760. #define USTCNT_RXHE USTCNT_RXHALFEN
  761. #define USTCNT_RXFE USTCNT_RXFULLEN
  762. #define USTCNT_CTSD USTCNT_CTSDELTAEN
  763. #define USTCNT_ODD USTCNT_ODD_EVEN
  764. #define USTCNT_PEN USTCNT_PARITYEN
  765. #define USTCNT_CLKM USTCNT_CLKMODE
  766. #define USTCNT_UEN USTCNT_UARTEN
  767. /*
  768. * UART Baud Control Register
  769. */
  770. #define UBAUD_ADDR 0xfffff902
  771. #define UBAUD WORD_REF(UBAUD_ADDR)
  772. #define UBAUD_PRESCALER_MASK 0x003f /* Actual divisor is 65 - PRESCALER */
  773. #define UBAUD_PRESCALER_SHIFT 0
  774. #define UBAUD_DIVIDE_MASK 0x0700 /* Baud Rate freq. divizor */
  775. #define UBAUD_DIVIDE_SHIFT 8
  776. #define UBAUD_BAUD_SRC 0x0800 /* Baud Rate Source */
  777. #define UBAUD_GPIOSRC 0x1000 /* GPIO source */
  778. #define UBAUD_GPIODIR 0x2000 /* GPIO Direction */
  779. #define UBAUD_GPIO 0x4000 /* Current GPIO pin status */
  780. #define UBAUD_GPIODELTA 0x8000 /* GPIO pin value changed */
  781. /*
  782. * UART Receiver Register
  783. */
  784. #define URX_ADDR 0xfffff904
  785. #define URX WORD_REF(URX_ADDR)
  786. #define URX_RXDATA_ADDR 0xfffff905
  787. #define URX_RXDATA BYTE_REF(URX_RXDATA_ADDR)
  788. #define URX_RXDATA_MASK 0x00ff /* Received data */
  789. #define URX_RXDATA_SHIFT 0
  790. #define URX_PARITY_ERROR 0x0100 /* Parity Error */
  791. #define URX_BREAK 0x0200 /* Break Detected */
  792. #define URX_FRAME_ERROR 0x0400 /* Framing Error */
  793. #define URX_OVRUN 0x0800 /* Serial Overrun */
  794. #define URX_DATA_READY 0x2000 /* Data Ready (FIFO not empty) */
  795. #define URX_FIFO_HALF 0x4000 /* FIFO is Half-Full */
  796. #define URX_FIFO_FULL 0x8000 /* FIFO is Full */
  797. /*
  798. * UART Transmitter Register
  799. */
  800. #define UTX_ADDR 0xfffff906
  801. #define UTX WORD_REF(UTX_ADDR)
  802. #define UTX_TXDATA_ADDR 0xfffff907
  803. #define UTX_TXDATA BYTE_REF(UTX_TXDATA_ADDR)
  804. #define UTX_TXDATA_MASK 0x00ff /* Data to be transmitted */
  805. #define UTX_TXDATA_SHIFT 0
  806. #define UTX_CTS_DELTA 0x0100 /* CTS changed */
  807. #define UTX_CTS_STATUS 0x0200 /* CTS State */
  808. #define UTX_IGNORE_CTS 0x0800 /* Ignore CTS */
  809. #define UTX_SEND_BREAK 0x1000 /* Send a BREAK */
  810. #define UTX_TX_AVAIL 0x2000 /* Transmit FIFO has a slot available */
  811. #define UTX_FIFO_HALF 0x4000 /* Transmit FIFO is half empty */
  812. #define UTX_FIFO_EMPTY 0x8000 /* Transmit FIFO is empty */
  813. /* 'EZ328-compatible definitions */
  814. #define UTX_CTS_STAT UTX_CTS_STATUS
  815. #define UTX_NOCTS UTX_IGNORE_CTS
  816. /*
  817. * UART Miscellaneous Register
  818. */
  819. #define UMISC_ADDR 0xfffff908
  820. #define UMISC WORD_REF(UMISC_ADDR)
  821. #define UMISC_TX_POL 0x0004 /* Transmit Polarity */
  822. #define UMISC_RX_POL 0x0008 /* Receive Polarity */
  823. #define UMISC_IRDA_LOOP 0x0010 /* IrDA Loopback Enable */
  824. #define UMISC_IRDA_EN 0x0020 /* Infra-Red Enable */
  825. #define UMISC_RTS 0x0040 /* Set RTS status */
  826. #define UMISC_RTSCONT 0x0080 /* Choose RTS control */
  827. #define UMISC_LOOP 0x1000 /* Serial Loopback Enable */
  828. #define UMISC_FORCE_PERR 0x2000 /* Force Parity Error */
  829. #define UMISC_CLKSRC 0x4000 /* Clock Source */
  830. /* generalization of uart control registers to support multiple ports: */
  831. typedef volatile struct {
  832. volatile unsigned short int ustcnt;
  833. volatile unsigned short int ubaud;
  834. union {
  835. volatile unsigned short int w;
  836. struct {
  837. volatile unsigned char status;
  838. volatile unsigned char rxdata;
  839. } b;
  840. } urx;
  841. union {
  842. volatile unsigned short int w;
  843. struct {
  844. volatile unsigned char status;
  845. volatile unsigned char txdata;
  846. } b;
  847. } utx;
  848. volatile unsigned short int umisc;
  849. volatile unsigned short int pad1;
  850. volatile unsigned short int pad2;
  851. volatile unsigned short int pad3;
  852. } __attribute__((packed)) m68328_uart;
  853. /**********
  854. *
  855. * 0xFFFFFAxx -- LCD Controller
  856. *
  857. **********/
  858. /*
  859. * LCD Screen Starting Address Register
  860. */
  861. #define LSSA_ADDR 0xfffffa00
  862. #define LSSA LONG_REF(LSSA_ADDR)
  863. #define LSSA_SSA_MASK 0xfffffffe /* Bit 0 is reserved */
  864. /*
  865. * LCD Virtual Page Width Register
  866. */
  867. #define LVPW_ADDR 0xfffffa05
  868. #define LVPW BYTE_REF(LVPW_ADDR)
  869. /*
  870. * LCD Screen Width Register (not compatible with 'EZ328 !!!)
  871. */
  872. #define LXMAX_ADDR 0xfffffa08
  873. #define LXMAX WORD_REF(LXMAX_ADDR)
  874. #define LXMAX_XM_MASK 0x02ff /* Bits 0-3 are reserved */
  875. /*
  876. * LCD Screen Height Register
  877. */
  878. #define LYMAX_ADDR 0xfffffa0a
  879. #define LYMAX WORD_REF(LYMAX_ADDR)
  880. #define LYMAX_YM_MASK 0x02ff /* Bits 10-15 are reserved */
  881. /*
  882. * LCD Cursor X Position Register
  883. */
  884. #define LCXP_ADDR 0xfffffa18
  885. #define LCXP WORD_REF(LCXP_ADDR)
  886. #define LCXP_CC_MASK 0xc000 /* Cursor Control */
  887. #define LCXP_CC_TRAMSPARENT 0x0000
  888. #define LCXP_CC_BLACK 0x4000
  889. #define LCXP_CC_REVERSED 0x8000
  890. #define LCXP_CC_WHITE 0xc000
  891. #define LCXP_CXP_MASK 0x02ff /* Cursor X position */
  892. /*
  893. * LCD Cursor Y Position Register
  894. */
  895. #define LCYP_ADDR 0xfffffa1a
  896. #define LCYP WORD_REF(LCYP_ADDR)
  897. #define LCYP_CYP_MASK 0x01ff /* Cursor Y Position */
  898. /*
  899. * LCD Cursor Width and Heigth Register
  900. */
  901. #define LCWCH_ADDR 0xfffffa1c
  902. #define LCWCH WORD_REF(LCWCH_ADDR)
  903. #define LCWCH_CH_MASK 0x001f /* Cursor Height */
  904. #define LCWCH_CH_SHIFT 0
  905. #define LCWCH_CW_MASK 0x1f00 /* Cursor Width */
  906. #define LCWCH_CW_SHIFT 8
  907. /*
  908. * LCD Blink Control Register
  909. */
  910. #define LBLKC_ADDR 0xfffffa1f
  911. #define LBLKC BYTE_REF(LBLKC_ADDR)
  912. #define LBLKC_BD_MASK 0x7f /* Blink Divisor */
  913. #define LBLKC_BD_SHIFT 0
  914. #define LBLKC_BKEN 0x80 /* Blink Enabled */
  915. /*
  916. * LCD Panel Interface Configuration Register
  917. */
  918. #define LPICF_ADDR 0xfffffa20
  919. #define LPICF BYTE_REF(LPICF_ADDR)
  920. #define LPICF_GS_MASK 0x01 /* Gray-Scale Mode */
  921. #define LPICF_GS_BW 0x00
  922. #define LPICF_GS_GRAY_4 0x01
  923. #define LPICF_PBSIZ_MASK 0x06 /* Panel Bus Width */
  924. #define LPICF_PBSIZ_1 0x00
  925. #define LPICF_PBSIZ_2 0x02
  926. #define LPICF_PBSIZ_4 0x04
  927. /*
  928. * LCD Polarity Configuration Register
  929. */
  930. #define LPOLCF_ADDR 0xfffffa21
  931. #define LPOLCF BYTE_REF(LPOLCF_ADDR)
  932. #define LPOLCF_PIXPOL 0x01 /* Pixel Polarity */
  933. #define LPOLCF_LPPOL 0x02 /* Line Pulse Polarity */
  934. #define LPOLCF_FLMPOL 0x04 /* Frame Marker Polarity */
  935. #define LPOLCF_LCKPOL 0x08 /* LCD Shift Lock Polarity */
  936. /*
  937. * LACD (LCD Alternate Crystal Direction) Rate Control Register
  938. */
  939. #define LACDRC_ADDR 0xfffffa23
  940. #define LACDRC BYTE_REF(LACDRC_ADDR)
  941. #define LACDRC_ACD_MASK 0x0f /* Alternate Crystal Direction Control */
  942. #define LACDRC_ACD_SHIFT 0
  943. /*
  944. * LCD Pixel Clock Divider Register
  945. */
  946. #define LPXCD_ADDR 0xfffffa25
  947. #define LPXCD BYTE_REF(LPXCD_ADDR)
  948. #define LPXCD_PCD_MASK 0x3f /* Pixel Clock Divider */
  949. #define LPXCD_PCD_SHIFT 0
  950. /*
  951. * LCD Clocking Control Register
  952. */
  953. #define LCKCON_ADDR 0xfffffa27
  954. #define LCKCON BYTE_REF(LCKCON_ADDR)
  955. #define LCKCON_PCDS 0x01 /* Pixel Clock Divider Source Select */
  956. #define LCKCON_DWIDTH 0x02 /* Display Memory Width */
  957. #define LCKCON_DWS_MASK 0x3c /* Display Wait-State */
  958. #define LCKCON_DWS_SHIFT 2
  959. #define LCKCON_DMA16 0x40 /* DMA burst length */
  960. #define LCKCON_LCDON 0x80 /* Enable LCD Controller */
  961. /* 'EZ328-compatible definitions */
  962. #define LCKCON_DW_MASK LCKCON_DWS_MASK
  963. #define LCKCON_DW_SHIFT LCKCON_DWS_SHIFT
  964. /*
  965. * LCD Last Buffer Address Register
  966. */
  967. #define LLBAR_ADDR 0xfffffa29
  968. #define LLBAR BYTE_REF(LLBAR_ADDR)
  969. #define LLBAR_LBAR_MASK 0x7f /* Number of memory words to fill 1 line */
  970. #define LLBAR_LBAR_SHIFT 0
  971. /*
  972. * LCD Octet Terminal Count Register
  973. */
  974. #define LOTCR_ADDR 0xfffffa2b
  975. #define LOTCR BYTE_REF(LOTCR_ADDR)
  976. /*
  977. * LCD Panning Offset Register
  978. */
  979. #define LPOSR_ADDR 0xfffffa2d
  980. #define LPOSR BYTE_REF(LPOSR_ADDR)
  981. #define LPOSR_BOS 0x08 /* Byte offset (for B/W mode only */
  982. #define LPOSR_POS_MASK 0x07 /* Pixel Offset Code */
  983. #define LPOSR_POS_SHIFT 0
  984. /*
  985. * LCD Frame Rate Control Modulation Register
  986. */
  987. #define LFRCM_ADDR 0xfffffa31
  988. #define LFRCM BYTE_REF(LFRCM_ADDR)
  989. #define LFRCM_YMOD_MASK 0x0f /* Vertical Modulation */
  990. #define LFRCM_YMOD_SHIFT 0
  991. #define LFRCM_XMOD_MASK 0xf0 /* Horizontal Modulation */
  992. #define LFRCM_XMOD_SHIFT 4
  993. /*
  994. * LCD Gray Palette Mapping Register
  995. */
  996. #define LGPMR_ADDR 0xfffffa32
  997. #define LGPMR WORD_REF(LGPMR_ADDR)
  998. #define LGPMR_GLEVEL3_MASK 0x000f
  999. #define LGPMR_GLEVEL3_SHIFT 0
  1000. #define LGPMR_GLEVEL2_MASK 0x00f0
  1001. #define LGPMR_GLEVEL2_SHIFT 4
  1002. #define LGPMR_GLEVEL0_MASK 0x0f00
  1003. #define LGPMR_GLEVEL0_SHIFT 8
  1004. #define LGPMR_GLEVEL1_MASK 0xf000
  1005. #define LGPMR_GLEVEL1_SHIFT 12
  1006. /**********
  1007. *
  1008. * 0xFFFFFBxx -- Real-Time Clock (RTC)
  1009. *
  1010. **********/
  1011. /*
  1012. * RTC Hours Minutes and Seconds Register
  1013. */
  1014. #define RTCTIME_ADDR 0xfffffb00
  1015. #define RTCTIME LONG_REF(RTCTIME_ADDR)
  1016. #define RTCTIME_SECONDS_MASK 0x0000003f /* Seconds */
  1017. #define RTCTIME_SECONDS_SHIFT 0
  1018. #define RTCTIME_MINUTES_MASK 0x003f0000 /* Minutes */
  1019. #define RTCTIME_MINUTES_SHIFT 16
  1020. #define RTCTIME_HOURS_MASK 0x1f000000 /* Hours */
  1021. #define RTCTIME_HOURS_SHIFT 24
  1022. /*
  1023. * RTC Alarm Register
  1024. */
  1025. #define RTCALRM_ADDR 0xfffffb04
  1026. #define RTCALRM LONG_REF(RTCALRM_ADDR)
  1027. #define RTCALRM_SECONDS_MASK 0x0000003f /* Seconds */
  1028. #define RTCALRM_SECONDS_SHIFT 0
  1029. #define RTCALRM_MINUTES_MASK 0x003f0000 /* Minutes */
  1030. #define RTCALRM_MINUTES_SHIFT 16
  1031. #define RTCALRM_HOURS_MASK 0x1f000000 /* Hours */
  1032. #define RTCALRM_HOURS_SHIFT 24
  1033. /*
  1034. * RTC Control Register
  1035. */
  1036. #define RTCCTL_ADDR 0xfffffb0c
  1037. #define RTCCTL WORD_REF(RTCCTL_ADDR)
  1038. #define RTCCTL_384 0x0020 /* Crystal Selection */
  1039. #define RTCCTL_ENABLE 0x0080 /* RTC Enable */
  1040. /* 'EZ328-compatible definitions */
  1041. #define RTCCTL_XTL RTCCTL_384
  1042. #define RTCCTL_EN RTCCTL_ENABLE
  1043. /*
  1044. * RTC Interrupt Status Register
  1045. */
  1046. #define RTCISR_ADDR 0xfffffb0e
  1047. #define RTCISR WORD_REF(RTCISR_ADDR)
  1048. #define RTCISR_SW 0x0001 /* Stopwatch timed out */
  1049. #define RTCISR_MIN 0x0002 /* 1-minute interrupt has occurred */
  1050. #define RTCISR_ALM 0x0004 /* Alarm interrupt has occurred */
  1051. #define RTCISR_DAY 0x0008 /* 24-hour rollover interrupt has occurred */
  1052. #define RTCISR_1HZ 0x0010 /* 1Hz interrupt has occurred */
  1053. /*
  1054. * RTC Interrupt Enable Register
  1055. */
  1056. #define RTCIENR_ADDR 0xfffffb10
  1057. #define RTCIENR WORD_REF(RTCIENR_ADDR)
  1058. #define RTCIENR_SW 0x0001 /* Stopwatch interrupt enable */
  1059. #define RTCIENR_MIN 0x0002 /* 1-minute interrupt enable */
  1060. #define RTCIENR_ALM 0x0004 /* Alarm interrupt enable */
  1061. #define RTCIENR_DAY 0x0008 /* 24-hour rollover interrupt enable */
  1062. #define RTCIENR_1HZ 0x0010 /* 1Hz interrupt enable */
  1063. /*
  1064. * Stopwatch Minutes Register
  1065. */
  1066. #define STPWCH_ADDR 0xfffffb12
  1067. #define STPWCH WORD_REF(STPWCH)
  1068. #define STPWCH_CNT_MASK 0x00ff /* Stopwatch countdown value */
  1069. #define SPTWCH_CNT_SHIFT 0
  1070. #endif /* _MC68328_H_ */