m8260.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. typedef struct BD BD;
  2. struct BD {
  3. ushort status;
  4. ushort length;
  5. ulong addr;
  6. };
  7. enum{
  8. BDEmpty= SBIT(0),
  9. BDReady= SBIT(0),
  10. BDWrap= SBIT(2),
  11. BDInt= SBIT(3),
  12. BDLast= SBIT(4),
  13. BDFirst= SBIT(5),
  14. };
  15. typedef struct Ring Ring;
  16. struct Ring {
  17. BD* rdr; /* receive descriptor ring */
  18. void* rrb; /* receive ring buffers */
  19. int rdrx; /* index into rdr */
  20. int nrdre; /* length of rdr */
  21. BD* tdr; /* transmit descriptor ring */
  22. void** txb; /* corresponding transmit ring buffers */
  23. int tdrh; /* host index into tdr */
  24. int tdri; /* interface index into tdr */
  25. int ntdre; /* length of tdr */
  26. int ntq; /* pending transmit requests */
  27. };
  28. int ioringinit(Ring*, int, int, int);
  29. /*
  30. * MCC parameters
  31. */
  32. typedef struct MCCparam MCCparam;
  33. struct MCCparam {
  34. /*0x00*/ ulong mccbase;
  35. /*0x04*/ ushort mccstate;
  36. /*0x06*/ ushort mrblr;
  37. /*0x08*/ ushort grfthr;
  38. /*0x0a*/ ushort grfcnt;
  39. /*0x0c*/ ulong rinttmp;
  40. /*0x10*/ ulong data0;
  41. /*0x14*/ ulong data1;
  42. /*0x18*/ ulong tintbase;
  43. /*0x1c*/ ulong tintptr;
  44. /*0x20*/ ulong tinttmp;
  45. /*0x24*/ ushort sctpbase;
  46. /*0x26*/ ushort Rsvd26;
  47. /*0x28*/ ulong cmask32;
  48. /*0x2c*/ ushort xtrabase;
  49. /*0x2e*/ ushort cmask16;
  50. /*0x30*/ ulong rinttmp[4];
  51. /*0x40*/ struct {
  52. ulong base;
  53. ulong ptr;
  54. } rint[4];
  55. /*0x60*/ ulong tstmp;
  56. /*0x64*/
  57. };
  58. /*
  59. * IO controller parameters
  60. */
  61. typedef struct IOCparam IOCparam;
  62. struct IOCparam {
  63. /*0x00*/ ushort rbase;
  64. /*0x02*/ ushort tbase;
  65. /*0x04*/ uchar rfcr;
  66. /*0x05*/ uchar tfcr;
  67. /*0x06*/ ushort mrblr;
  68. /*0x08*/ ulong rstate;
  69. /*0x0c*/ ulong rxidp;
  70. /*0x10*/ ushort rbptr;
  71. /*0x12*/ ushort rxibc;
  72. /*0x14*/ ulong rxtemp;
  73. /*0x18*/ ulong tstate;
  74. /*0x1c*/ ulong txidp;
  75. /*0x20*/ ushort tbptr;
  76. /*0x22*/ ushort txibc;
  77. /*0x24*/ ulong txtemp;
  78. /*0x28*/
  79. };
  80. typedef struct SCCparam SCCparam;
  81. struct SCCparam {
  82. IOCparam;
  83. ulong rcrc;
  84. ulong tcrc;
  85. };
  86. typedef struct FCCparam FCCparam;
  87. struct FCCparam {
  88. /*0x00*/ ushort riptr;
  89. /*0x02*/ ushort tiptr;
  90. /*0x04*/ ushort Rsvd04;
  91. /*0x06*/ ushort mrblr;
  92. /*0x08*/ ulong rstate;
  93. /*0x0c*/ ulong rbase;
  94. /*0x10*/ ushort rbdstat;
  95. /*0x12*/ ushort rbdlen;
  96. /*0x14*/ char* rdptr;
  97. /*0x18*/ ulong tstate;
  98. /*0x1c*/ ulong tbase;
  99. /*0x20*/ ushort tbdstat;
  100. /*0x22*/ ushort tbdlen;
  101. /*0x24*/ ulong tdptr;
  102. /*0x28*/ ulong rbptr;
  103. /*0x2c*/ ulong tbptr;
  104. /*0x30*/ ulong rcrc;
  105. /*0x34*/ ulong Rsvd34;
  106. /*0x38*/ ulong tcrc;
  107. /*0x3c*/
  108. };
  109. typedef struct SCC SCC;
  110. struct SCC {
  111. ulong gsmrl;
  112. ulong gsmrh;
  113. ushort psmr;
  114. uchar rsvscc0[2];
  115. ushort todr;
  116. ushort dsr;
  117. ushort scce;
  118. uchar rsvscc1[2];
  119. ushort sccm;
  120. uchar rsvscc2;
  121. uchar sccs;
  122. ushort irmode;
  123. ushort irsip;
  124. uchar rsvscc3[4]; /* BUG */
  125. };
  126. typedef struct FCC FCC;
  127. struct FCC {
  128. /*0x00*/ ulong gfmr; /* general mode register 28.2/28-3 */
  129. /*0x04*/ ulong fpsmr; /* protocol-specific mode reg. 29.13.2(ATM) 30.18.1(Ether) */
  130. /*0x08*/ ushort ftodr; /* transmit on demand register 28.5/28-7 */
  131. /*0x0A*/ ushort Rsvd0A;
  132. /*0x0C*/ ushort fdsr; /* data synchronization register 28.4/28-7 */
  133. /*0x0E*/ ushort Rsvd0E;
  134. /*0x10*/ ushort fcce; /* event register 29.13.3 (ATM), 30.18.2 (Ethernet) */
  135. /*0x12*/ ushort Rsvd12;
  136. /*0x14*/ ushort fccm; /* mask register */
  137. /*0x16*/ ushort Rsvd16;
  138. /*0x18*/ uchar fccs; /* status register 8 bits 31.10 (HDLC) */
  139. /*0x19*/ uchar Rsvd19[3];
  140. /*0x1C*/ uchar ftirrphy[4]; /* transmit internal rate registers for PHY0DH3 29.13.4/29-88 (ATM) */
  141. /*0x20*/
  142. };
  143. typedef struct SMC SMC;
  144. struct SMC {
  145. /*0x0*/ ushort pad1;
  146. /*0x2*/ ushort smcmr;
  147. /*0x4*/ ushort pad2;
  148. /*0x6*/ uchar smce;
  149. /*0x7*/ uchar pad3[3];
  150. /*0xa*/ uchar smcm;
  151. /*0xb*/ uchar pad4[5];
  152. /*0x10*/
  153. };
  154. typedef struct SPI SPI;
  155. struct SPI {
  156. ushort spmode;
  157. uchar res1[4];
  158. uchar spie;
  159. uchar res2[3];
  160. uchar spim;
  161. uchar res3[2];
  162. uchar spcom;
  163. uchar res4[2];
  164. };
  165. typedef struct Bankmap Bankmap;
  166. struct Bankmap {
  167. /*0*/ ulong br; /* Base register bank 32 bits 10.3.1/10-14 */
  168. /*4*/ ulong or; /* Option register bank 32 bits 10.3.2/10-16 */
  169. /*8*/
  170. };
  171. typedef struct Port Port;
  172. struct Port {
  173. /*0x00*/ ulong pdir; /* Port A data direction register 32 bits 35.2.3/35-3 */
  174. /*0x04*/ ulong ppar; /* Port Apin assignment register 32 bits 35.2.4/35-4 */
  175. /*0x08*/ ulong psor; /* Port A special options register 32 bits 35.2.5/35-4 */
  176. /*0x0C*/ ulong podr; /* Port Aopen drain register 32 bits 35.2.1/35-2 */
  177. /*0x10*/ ulong pdat; /* Port A data register 32 bits 35.2.2/35-2 */
  178. /*0x14*/ uchar Rsvd14[12];
  179. /*0x20*/
  180. };
  181. typedef struct IDMA IDMA;
  182. struct IDMA {
  183. /*0x0*/ uchar idsr; /* IDMA event register 8 bits 18.8.4/18-22 */
  184. /*0x1*/ uchar Rsvd1[3];
  185. /*0x4*/ uchar idmr; /* IDMA mask register 8 bits 18.8.4/18-22 */
  186. /*0x5*/ uchar Rsvd5[3];
  187. /*0x8*/
  188. };
  189. typedef struct PrmSCC PrmSCC;
  190. struct PrmSCC {
  191. uchar sccbytes[0x100];
  192. };
  193. typedef struct PrmFCC PrmFCC;
  194. struct PrmFCC {
  195. uchar fccbytes[0x100];
  196. };
  197. typedef struct Bases Bases;
  198. struct Bases {
  199. /*0x00*/ uchar mcc[0x80];
  200. /*0x80*/ uchar Rsvd80[0x60];
  201. /*0xe0*/ uchar risctimers[0x10];
  202. /*0xf0*/ ushort revnum;
  203. /*0xf2*/ uchar Rsvdf2[6];
  204. /*0xf8*/ ulong rand;
  205. /*0xfc*/ ushort smcbase;
  206. #define i2cbase smcbase
  207. /*0xfe*/ ushort idmabase;
  208. /*0x100*/
  209. };
  210. typedef struct Uartsmc Uartsmc;
  211. struct Uartsmc {
  212. /*0x00*/ IOCparam;
  213. /*0x28*/ ushort maxidl;
  214. /*0x2a*/ ushort idlc;
  215. /*0x2c*/ ushort brkln;
  216. /*0x2e*/ ushort brkec;
  217. /*0x30*/ ushort brkcr;
  218. /*0x32*/ ushort r_mask;
  219. /*0x34*/ ulong sdminternal;
  220. /*0x38*/ uchar Rsvd38[8];
  221. /*0x40*/
  222. };
  223. typedef struct SI SI;
  224. struct SI {
  225. /*0x11B20*/ ushort siamr; /* SI TDMA1 mode register 16 bits 14.5.2/14-17 */
  226. /*0x11B22*/ ushort sibmr; /* SI TDMB1 mode register 16 bits */
  227. /*0x11B24*/ ushort sicmr; /* SI TDMC1 mode register 16 bits */
  228. /*0x11B26*/ ushort sidmr; /* SI TDMD1 mode register 16 bits */
  229. /*0x11B28*/ uchar sigmr; /* SI global mode register 8 bits 14.5.1/14-17 */
  230. /*0x11B29*/ uchar Rsvd11B29;
  231. /*0x11B2A*/ ushort sicmdr; /* SI command register 8 bits 14.5.4/14-24 */
  232. /*0x11B2C*/ ushort sistr; /* SI status register 8 bits 14.5.5/14-25 */
  233. /*0x11B2E*/ ushort sirsr; /* SI RAM shadow address register 16 bits 14.5.3/14-23 */
  234. };
  235. typedef struct IMM IMM;
  236. struct IMM {
  237. /* General SIU */
  238. /*0x10000*/ ulong siumcr; /* SIU module configuration register 32 bits 4.3.2.6/4-31 */
  239. /*0x10004*/ ulong sypcr; /* System protection control register 32 bits 4.3.2.8/4-35 */
  240. /*0x10008*/ uchar Rsvd10008[0xe-0x8];
  241. /*0x1000E*/ ushort swsr; /* Softwareservice register 16 bits 4.3.2.9/4-36 */
  242. /*0x10010*/ uchar Rsvd10010[0x14];
  243. /*0x10024*/ ulong bcr; /* Bus configuration register 32 bits 4.3.2.1/4-25 */
  244. /*0x10028*/ ulong PPC_ACR; /* 60x bus arbiter configuration register 8 bits 4.3.2.2/4-28 */
  245. /*0x1002C*/ ulong PPCALRH; /* 60x bus arbitration-level register high (first 8 clients) 32 bits 4.3.2.3/4-28 */
  246. /*0x10030*/ ulong PPC_ALRL; /* 60x bus arbitration-level register low (next 8 clients) 32 bits 4.3.2.3/4-28 */
  247. /*0x10034*/ ulong LCL_ACR; /* Local arbiter configuration register 8 bits 4.3.2.4/4-29 */
  248. /*0x10038*/ ulong LCL_ALRH; /* Local arbitration-level register (first 8 clients) 32 bits 4.3.2.5/4-30 */
  249. /*0x1003C*/ ulong LCL_ALRL; /* Local arbitration-level register (next 8 clients) 32 bits 4.3.2.3/4-28 */
  250. /*0x10040*/ ulong TESCR1; /* 60x bus transfer error status control register1 32 bits 4.3.2.10/4-36 */
  251. /*0x10044*/ ulong TESCR2; /* 60x bus transfer error status control register2 32 bits 4.3.2.11/4-37 */
  252. /*0x10048*/ ulong L_TESCR1; /* Local bus transfer error status control register1 32 bits 4.3.2.12/4-38 */
  253. /*0x1004C*/ ulong L_TESCR2; /* Local bus transfer error status control register2 32 bits 4.3.2.13/4-39 */
  254. /*0x10050*/ ulong pdtea; /* 60x bus DMAtransfer error address 32 bits 18.2.3/18-4 */
  255. /*0x10054*/ uchar pdtem; /* 60x bus DMAtransfer error MSNUM 8 bits 18.2.4/18-4 */
  256. /*0x10055*/ uchar Rsvd10055[3];
  257. /*0x10058*/ void* ldtea; /* Local bus DMA transfer error address 32 bits 18.2.3/18-4 */
  258. /*0x1005C*/ uchar ldtem; /* Local bus DMA transfer error MSNUM 8 bits 18.2.4/18-4 */
  259. /*0x1005D*/ uchar Rsvd1005D[163];
  260. /* Memory Controller */
  261. /*0x10100*/ Bankmap bank[12];
  262. /*0x10160*/ uchar Rsvd10160[8];
  263. /*0x10168*/ void* MAR; /* Memory address register 32 bits 10.3.7/10-29 */
  264. /*0x1016C*/ ulong Rsvd1016C;
  265. /*0x10170*/ ulong MAMR; /* Machine A mode register 32 bits 10.3.5/10-26 */
  266. /*0x10174*/ ulong MBMR; /* Machine B mode register 32 bits */
  267. /*0x10178*/ ulong MCMR; /* Machine C mode register 32 bits */
  268. /*0x1017C*/ uchar Rsvd1017C[6];
  269. /*0x10184*/ ulong mptpr; /* Memory periodic timer prescaler 16 bits 10.3.12/10-32 */
  270. /*0x10188*/ ulong mdr; /* Memorydata register 32 bits 10.3.6/10-28 */
  271. /*0x1018C*/ ulong Rsvd1018C;
  272. /*0x10190*/ ulong psdmr; /* 60x bus SDRAM mode register 32 bits 10.3.3/10-21 */
  273. /*0x10194*/ ulong lsdmr; /* Local bus SDRAM mode register 32 bits 10.3.4/10-24 */
  274. /*0x10198*/ ulong PURT; /* 60x bus-assigned UPM refresh timer 8 bits 10.3.8/10-30 */
  275. /*0x1019C*/ ulong PSRT; /* 60x bus-assigned SDRAM refresh timer 8 bits 10.3.10/10-31 */
  276. /*0x101A0*/ ulong LURT; /* Local bus-assigned UPM refresh timer8 bits 10.3.9/10-30 */
  277. /*0x101A4*/ ulong LSRT; /* Local bus-assigned SDRAM refresh timer 8 bits 10.3.11/10-32 */
  278. /*0x101A8*/ ulong immr; /* Internal memory map register 32 bits 4.3.2.7/4-34 */
  279. /*0x101AC*/ uchar Rsvd101AC[84];
  280. /* System Integration Timers */
  281. /*0x10200*/ uchar Rsvd10200[32];
  282. /*0x10220*/ ulong TMCNTSC; /* Time counter statusand control register 16 bits 4.3.2.14/4-40 */
  283. /*0x10224*/ ulong TMCNT; /* Time counter register 32 bits 4.3.2.15/4-41 */
  284. /*0x10228*/ ulong Rsvd10228;
  285. /*0x1022C*/ ulong TMCNTAL; /* Time counter alarm register 32 bits 4.3.2.16/4-41 */
  286. /*0x10230*/ uchar Rsvd10230[0x10];
  287. /*0x10240*/ ulong PISCR; /* Periodic interrupt statusand control register 16 bits 4.3.3.1/4-42 */
  288. /*0x10244*/ ulong PITC; /* Periodic interrupt count register 32 bits 4.3.3.2/4-43 */
  289. /*0x10248*/ ulong PITR; /* Periodic interrupt timer register 32 bits 4.3.3.3/4-44 */
  290. /*0x1024C*/ uchar Rsvd1024C[94];
  291. /*0x102AA*/ uchar Rsvd102AA[2390];
  292. /* Interrupt Controller */
  293. /*0x10C00*/ ushort sicr; /* SIU interrupt configuration register 16 bits 4.3.1.1/4-17 */
  294. /*0x10C02*/ ushort Rsvd10C02;
  295. /*0x10C04*/ ulong sivec; /* SIU interrupt vector register 32 bits 4.3.1.6/4-23 */
  296. /*0x10C08*/ ulong sipnr_h; /* SIU interrupt pending register(high) 32 bits 4.3.1.4/4-21 */
  297. /*0x10C0C*/ ulong sipnr_l; /* SIU interrupt pending register(low) 32 bits 4.3.1.4/4-21 */
  298. /*0x10C10*/ ulong siprr; /* SIU interrupt priority register 32 bits 4.3.1.2/4-18 */
  299. /*0x10C14*/ ulong scprr_h; /* CPM interrupt priority register(high) 32 bits 4.3.1.3/4-19 */
  300. /*0x10C18*/ ulong scprr_l; /* CPM interrupt priority register(low) 32 bits 4.3.1.3/4-19 */
  301. /*0x10C1C*/ ulong simr_h; /* SIU interrupt mask register(high) 32 bits 4.3.1.5/4-22 */
  302. /*0x10C20*/ ulong simr_l; /* SIU interrupt mask register(low) 32 bits 4.3.1.5/4-22 */
  303. /*0x10C24*/ ulong siexr; /* SIUexternal interrupt control register 32 bits 4.3.1.7/4-24 */
  304. /*0x10C28*/ uchar Rsvd10C28[88];
  305. /* Clocksand Reset */
  306. /*0x10C80*/ ulong sccr; /* Systemclock control register 32 bits 9.8/9-8 */
  307. /*0x10C84*/ uchar Rsvd10C84[4];
  308. /*0x10C88*/ ulong scmr; /* Systemclock mode register 32 bits 9.9/9-9 */
  309. /*0x10C8C*/ uchar Rsvd10C8C[4];
  310. /*0x10C90*/ ulong rsr; /* Reset status register 32 bits 5.2/5-4 */
  311. /*0x10C94*/ ulong rmr; /* Reset mode register 32 bits 5.3/5-5 */
  312. /*0x10C98*/ uchar Rsvd10C98[104];
  313. /* Part I.Overview Input/Output Port */
  314. /*0x10D00*/ Port port[4];
  315. /* CPMTimers */
  316. /*0x10D80*/ uchar tgcr1; /* Timer1 and timer2 global configuration register 8 bits 17.2.2/17-4 */
  317. /*0x10D81*/ uchar Rsvd10D81[3];
  318. /*0x10D84*/ uchar tgcr2; /* Timer3 and timer4 global configuration register 8 bits 17.2.2/17-4 */
  319. /*0x10D85*/ uchar Rsvd10D85[3];
  320. /*0x10D88*/ uchar Rsvd10D88[8];
  321. /*0x10D90*/ ushort tmr1; /* Timer1 mode register 16 bits 17.2.3/17-6 */
  322. /*0x10D92*/ ushort tmr2; /* Timer2 mode register 16 bits 17.2.3/17-6 */
  323. union{
  324. struct {
  325. /*0x10D94*/ ushort trr1; /* Timer1 reference register 16 bits 17.2.4/17-7 */
  326. /*0x10D96*/ ushort trr2; /* Timer2 reference register 16 bits 17.2.4/17-7 */
  327. };
  328. /*0x10D94*/ ulong trrl1; /* Combined Timer 1/2 trr register */
  329. };
  330. union{
  331. struct {
  332. /*0x10D98*/ ushort tcr1; /* Timer1 capture register 16 bits 17.2.5/17-8 */
  333. /*0x10D9A*/ ushort tcr2; /* Timer2 capture register 16 bits 17.2.5/17-8 */
  334. };
  335. /*0x10D98*/ ulong tcrl1; /* Combined timer1/2 capture register */
  336. };
  337. union{
  338. struct {
  339. /*0x10D9C*/ ushort tcn1; /* Timer1 counter 16 bits 17.2.6/17-8 */
  340. /*0x10D9E*/ ushort tcn2; /* Timer2 counter 16 bits 17.2.6/17-8 */
  341. };
  342. /*0x10D9C*/ ulong tcnl1; /* Combined timer1/2 counter */
  343. };
  344. /*0x10DA0*/ ushort tmr3; /* Timer3 mode register 16 bits 17.2.3/17-6 */
  345. /*0x10DA2*/ ushort tmr4; /* Timer4 mode register 16 bits 17.2.3/17-6 */
  346. union{
  347. struct {
  348. /*0x10DA4*/ ushort trr3; /* Timer3 reference register 16 bits 17.2.4/17-7 */
  349. /*0x10DA6*/ ushort trr4; /* Timer4 reference register 16 bits 17.2.4/17-7 */
  350. };
  351. /*0x10DA4*/ ulong trrl3;
  352. };
  353. union{
  354. struct {
  355. /*0x10DA8*/ ushort tcr3; /* Timer3 capture register 16 bits 17.2.5/17-8 */
  356. /*0x10DAA*/ ushort tcr4; /* Timer4 capture register 16 bits 17.2.5/17-8 */
  357. };
  358. /*0x10DA8*/ ulong tcrl3;
  359. };
  360. union{
  361. struct {
  362. /*0x10DAC*/ ushort tcn3; /* Timer3 counter 16 bits 17.2.6/17-8 */
  363. /*0x10DAE*/ ushort tcn4; /* Timer4 counter 16 bits 17.2.6/17-8 */
  364. };
  365. /*0x10DAC*/ ulong tcnl3;
  366. };
  367. /*0x10DB0*/ ushort ter1; /* Timer1 event register 16 bits 17.2.7/17-8 */
  368. /*0x10DB2*/ ushort ter2; /* Timer2 event register 16 bits 17.2.7/17-8 */
  369. /*0x10DB4*/ ushort ter3; /* Timer3 event register 16 bits 17.2.7/17-8 */
  370. /*0x10DB6*/ ushort ter4; /* Timer4 event register 16 bits 17.2.7/17-8 */
  371. /*0x10DB8*/ uchar Rsvd10DB8[608];
  372. /* SDMADHGeneral */
  373. /*0x11018*/ uchar sdsr; /* SDMA status register 8 bits 18.2.1/18-3 */
  374. /*0x11019*/ uchar Rsvd11019[3];
  375. /*0x1101C*/ uchar sdmr; /* SDMA mask register 8 bits 18.2.2/18-4 */
  376. /*0x1101D*/ uchar Rsvd1101D[3];
  377. /* IDMA */
  378. /*0x11020*/ IDMA idma[4];
  379. /*0x11040*/ uchar Rsvd11040[704];
  380. /*0x11300*/ FCC fcc[3];
  381. /*0x11360*/ uchar Rsvd11360[0x290];
  382. /* BRGs5DH8 */
  383. /*0x115F0*/ ulong BRGC5; /* BRG5 configuration register 32 bits 16.1/16-2 */
  384. /*0x115F4*/ ulong BRGC6; /* BRG6configuration register 32 bits */
  385. /*0x115F8*/ ulong BRGC7; /* BRG7configuration register 32 bits */
  386. /*0x115FC*/ ulong BRGC8; /* BRG8configuration register 32 bits */
  387. /*0x11600*/ uchar Rsvd11600[0x260];
  388. /*0x11860*/ uchar I2MOD; /* I2C mode register 8 bits 34.4.1/34-6 */
  389. /*0x11861*/ uchar Rsvd11861[3];
  390. /*0x11864*/ uchar I2ADD; /* I2C address register 8 bits 34.4.2/34-7 */
  391. /*0x11865*/ uchar Rsvd11865[3];
  392. /*0x11868*/ uchar I2BRG; /* I2C BRG register 8 bits 34.4.3/34-7 */
  393. /*0x11869*/ uchar Rsvd11869[3];
  394. /*0x1186C*/ uchar I2COM; /* I2C command register 8 bits 34.4.5/34-8 */
  395. /*0x1186D*/ uchar Rsvd1186D[3];
  396. /*0x11870*/ uchar I2CER; /* I2C event register 8 bits 34.4.4/34-8 */
  397. /*0x11871*/ uchar Rsvd11871[3];
  398. /*0x11874*/ uchar I2CMR; /* I2C mask register 8 bits 34.4.4/34-8 */
  399. /*0x11875*/ uchar Rsvd11875[331];
  400. /* Communications Processor */
  401. /*0x119C0*/ ulong cpcr; /* Communications processor command register 32 bits 13.4.1/13-11 */
  402. /*0x119C4*/ ulong rccr; /* CP configuration register 32 bits 13.3.6/13-7 */
  403. /*0x119C8*/ uchar Rsvd119C8[14];
  404. /*0x119D6*/ ushort rter; /* CP timers event register 16 bits 13.6.4/13-21 */
  405. /*0x119D8*/ ushort Rsvd119D8;
  406. /*0x119DA*/ ushort rtmr; /* CP timers mask register 16 bits */
  407. /*0x119DC*/ ushort rtscr; /* CPtime-stamp timer control register 16 bits 13.3.7/13-9 */
  408. /*0x119DE*/ ushort Rsvd119DE;
  409. /*0x119E0*/ ulong rtsr; /* CPtime-stamp register 32 bits 13.3.8/13-10 */
  410. /*0x119E4*/ uchar Rsvd119E4[12];
  411. /*0x119F0*/ ulong brgc[4]; /* BRG configuration registers 32 bits 16.1/16-2 */
  412. /*0x11A00*/ SCC scc[4];
  413. /*0x11A80*/ SMC smc[2];
  414. SPI spi;
  415. /*0x11AB0*/ uchar Rsvd11AB0[80];
  416. /* CPMMux */
  417. /*0x11B00*/ uchar cmxsi1cr; /* CPM mux SI1clock route register 8 bits 15.4.2/15-10 */
  418. /*0x11B01*/ uchar Rsvd11B01;
  419. /*0x11B02*/ uchar cmxsi2cr; /* CPM mux SI2clock route register 8 bits 15.4.3/15-11 */
  420. /*0x11B03*/ uchar Rsvd11B03;
  421. /*0x11B04*/ ulong cmxfcr; /* CPM mux FCC clock route register 32 bits 15.4.4/15-12 */
  422. /*0x11B08*/ ulong cmxscr; /* CPM mux SCC clock route register 32 bits 15.4.5/15-14 */
  423. /*0x11B0C*/ uchar cmxsmr; /* CPM mux SMC clock route register 8 bits 15.4.6/15-17 */
  424. /*0x11B0D*/ uchar Rsvd11B0D;
  425. /*0x11B0E*/ ushort cmxuar; /* CPM mux UTOPIA address register 16 bits 15.4.1/15-7 */
  426. /*0x11B10*/ uchar Rsvd11B10[16];
  427. SI si1; /* SI 1 Registers */
  428. /* MCC1Registers */
  429. /*0x11B30*/ ushort MCCE1; /* MCC1 event register 16 bits 27.10.1/27-18 */
  430. /*0x11B32*/ ushort Rsvd11B32;
  431. /*0x11B34*/ ushort MCCM1; /* MCC1 mask register 16 bits */
  432. /*0x11B36*/ ushort Rsvd11B36;
  433. /*0x11B38*/ uchar MCCF1; /* MCC1 configuration register 8 bits 27.8/27-15 */
  434. /*0x11B39*/ uchar Rsvd11B39[7];
  435. SI si2; /* SI 2 Registers */
  436. /* MCC2Registers */
  437. /*0x11B50*/ ushort MCCE2; /* MCC2 event register 16 bits 27.10.1/27-18 */
  438. /*0x11B52*/ ushort Rsvd11B52;
  439. /*0x11B54*/ ushort MCCM2; /* MCC2 mask register 16 bits */
  440. /*0x11B56*/ ushort Rsvd11B56;
  441. /*0x11B58*/ uchar MCCF2; /* MCC2 configuration register 8 bits 27.8/27-15 */
  442. /*0x11B59*/ uchar Rsvd11B59[1191];
  443. /* SI1RAM */
  444. /*0x12000*/ uchar SI1TxRAM[0x200];/* SI1 transmit routing RAM 512 14.4.3/14-10 */
  445. /*0x12200*/ uchar Rsvd12200[0x200];
  446. /*0x12400*/ uchar SI1RxRAM[0x200];/* SI1 receive routing RAM 512 14.4.3/14-10 */
  447. /*0x12600*/ uchar Rsvd12600[0x200];
  448. /* SI2RAM */
  449. /*0x12800*/ uchar SI2TxRAM[0x200];/* SI2 transmit routing RAM 512 14.4.3/14-10 */
  450. /*0x12A00*/ uchar Rsvd12A00[0x200];
  451. /*0x12C00*/ uchar SI2RxRAM[0x200];/* SI2 receive routing RAM 512 14.4.3/14-10 */
  452. /*0x12E00*/ uchar Rsvd12E00[0x200];
  453. /*0x13000*/ uchar Rsvd13000[0x800];
  454. /*0x13800*/ uchar Rsvd13800[0x800];
  455. };
  456. typedef struct FCCextra FCCextra;
  457. struct FCCextra {
  458. /*0x00*/ uchar ri[0x20];
  459. /*0x20*/ uchar ti[0x20];
  460. /*0x40*/ uchar pad[0x20];
  461. };
  462. typedef struct Imap Imap;
  463. struct Imap {
  464. /* CPMDual-Port RAM */
  465. /*0x00000*/ uchar dpram1[0x3800]; /* Dual-port RAM 16Kbytes 13.5/13-15 */
  466. /*0x03800*/ FCCextra fccextra[4];
  467. /*0x03980*/ Uartsmc uartsmc[2];
  468. /*0x03a00*/ uchar dsp1p[0x40];
  469. /*0x03a40*/ uchar dsp2p[0x40];
  470. /*0x03a80*/ BD bd[(0x04000-0x03a80)/sizeof(BD)]; /* Buffer descriptors */
  471. /*0x04000*/ uchar Rsvd4000[0x04000];
  472. /* Dual port RAM bank 2 -- Parameter Ram, Section 13.5 */
  473. /*0x08000*/ PrmSCC prmscc[4];
  474. /*0x08400*/ PrmFCC prmfcc[3];
  475. /*0x08700*/ Bases param[4];
  476. /*0x08b00*/ uchar dpram2[0x500];
  477. /*0x09000*/ uchar Rsvd9000[0x2000];
  478. /* Dual port RAM bank 3 -- Section 13.5 */
  479. /*0x0B000*/ uchar dpram3[0x1000]; /* Dual-port RAM 4Kbytes 13.5/13-15 */
  480. /*0x0C000*/ uchar Rsvdc000[0x4000];
  481. /*0x10000*/ IMM;
  482. };
  483. enum {
  484. /* CPM Command register. */
  485. cpm_rst = 0x80000000,
  486. cpm_page = 0x7c000000,
  487. cpm_sblock = 0x03e00000,
  488. cpm_flg = 0x00010000,
  489. cpm_mcn = 0x00003fc0,
  490. cpm_opcode = 0x0000000f,
  491. /* Device sub-block and page codes. */
  492. cpm_fcc1_sblock = 0x10,
  493. cpm_fcc2_sblock = 0x11,
  494. cpm_fcc3_sblock = 0x12,
  495. cpm_scc1_sblock = 0x04,
  496. cpm_scc2_sblock = 0x05,
  497. cpm_scc3_sblock = 0x06,
  498. cpm_scc4_sblock = 0x07,
  499. cpm_smc1_sblock = 0x08,
  500. cpm_smc2_sblock = 0x09,
  501. cpm_rand_sblock = 0x0e,
  502. cpm_spi_sblock = 0x0a,
  503. cpm_i2c_sblock = 0x0b,
  504. cpm_timer_sblock = 0x0f,
  505. cpm_mcc1_sblock = 0x1c,
  506. cpm_mcc2_sblock = 0x1d,
  507. cpm_idma1_sblock = 0x14,
  508. cpm_idma2_sblock = 0x15,
  509. cpm_idma3_sblock = 0x16,
  510. cpm_idma4_sblock = 0x17,
  511. cpm_scc1_page = 0x00,
  512. cpm_scc2_page = 0x01,
  513. cpm_scc3_page = 0x02,
  514. cpm_scc4_page = 0x03,
  515. cpm_smc1_page = 0x07,
  516. cpm_smc2_page = 0x08,
  517. cpm_spi_page = 0x09,
  518. cpm_i2c_page = 0x0a,
  519. cpm_timer_page = 0x0a,
  520. cpm_rand_page = 0x0a,
  521. cpm_fcc1_page = 0x04,
  522. cpm_fcc2_page = 0x05,
  523. cpm_fcc3_page = 0x06,
  524. cpm_idma1_page = 0x07,
  525. cpm_idma2_page = 0x08,
  526. cpm_idma3_page = 0x09,
  527. cpm_idma4_page = 0x0a,
  528. cpm_mcc1_page = 0x07,
  529. cpm_mcc2_page = 0x08,
  530. };
  531. /*
  532. * CPM
  533. */
  534. enum {
  535. /* commands */
  536. InitRxTx = 0,
  537. InitRx = 1,
  538. InitTx = 2,
  539. EnterHunt= 3,
  540. StopTx= 4,
  541. GracefulStopTx = 5,
  542. InitIDMA = 5,
  543. RestartTx = 6,
  544. CloseRxBD = 7,
  545. SetGroupAddr = 8,
  546. SetTimer = 8,
  547. GCITimeout = 9,
  548. GCIAbort = 10,
  549. StopIDMA = 11,
  550. StartDSP = 12,
  551. ArmIDMA = 13,
  552. InitDSP = 13,
  553. USBCmd = 15,
  554. /* channel IDs */
  555. SCC1ID= cpm_scc1_page << 5 | cpm_scc1_sblock,
  556. SCC2ID= cpm_scc2_page << 5 | cpm_scc2_sblock,
  557. SCC3ID= cpm_scc3_page << 5 | cpm_scc3_sblock,
  558. SMC1ID= cpm_smc1_page << 5 | cpm_smc1_sblock,
  559. SMC2ID= cpm_smc2_page << 5 | cpm_smc2_sblock,
  560. FCC1ID= cpm_fcc1_page << 5 | cpm_fcc1_sblock,
  561. FCC2ID= cpm_fcc2_page << 5 | cpm_fcc2_sblock,
  562. FCC3ID= cpm_fcc3_page << 5 | cpm_fcc3_sblock,
  563. // USBID= 0, These are wrong
  564. // I2CID= 1,
  565. // IDMA1ID= 1,
  566. // SPIID= 5,
  567. // IDMA2ID= 5,
  568. // TIMERID= 5,
  569. // DSP1ID=9,
  570. // SCC4ID= 10,
  571. // DSP2ID= 13,
  572. /* sicr */
  573. BRG1 = 0,
  574. BRG2 = 1,
  575. BRG3 = 2,
  576. BRG4 = 4,
  577. CLK1 = 4,
  578. CLK2 = 5,
  579. CLK3 = 6,
  580. CLK4 = 7,
  581. };
  582. extern IMM* iomem;
  583. BD* bdalloc(int);
  584. void cpmop(int, int, int);
  585. void ioplock(void);
  586. void iopunlock(void);
  587. void kreboot(ulong);