DK1C20.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  1. /*
  2. * (C) Copyright 2003, Psyent Corporation <www.psyent.com>
  3. * Scott McNutt <smcnutt@psyent.com>
  4. * Stephan Linz <linz@li-pro.net>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  22. * MA 02111-1307 USA
  23. */
  24. #ifndef __CONFIG_H
  25. #define __CONFIG_H
  26. /*
  27. * NIOS CPU configuration.
  28. *
  29. * Here we must define CPU dependencies. Any unsupported option have to
  30. * be defined with zero, example CPU without data cache / OCI:
  31. *
  32. * #define CFG_NIOS_CPU_ICACHE 4096
  33. * #define CFG_NIOS_CPU_DCACHE 0
  34. * #define CFG_NIOS_CPU_OCI_BASE 0
  35. * #define CFG_NIOS_CPU_OCI_SIZE 0
  36. */
  37. #if defined(CONFIG_NIOS_SAFE_32)
  38. /* TODO */
  39. #elif defined(CONFIG_NIOS_STANDARD_32)
  40. /* CPU core */
  41. #define CFG_NIOS_CPU_CLK 50000000 /* NIOS CPU clock */
  42. #define CFG_NIOS_CPU_ICACHE (4 * 1024) /* instruction cache */
  43. #define CFG_NIOS_CPU_DCACHE (4 * 1024) /* data cache */
  44. #define CFG_NIOS_CPU_REG_NUMS 256 /* number of register */
  45. #define CFG_NIOS_CPU_MUL 0 /* 16x16 MUL: no(0) */
  46. /* yes(1) */
  47. #define CFG_NIOS_CPU_MSTEP 1 /* 16x16 MSTEP: no(0) */
  48. /* yes(1) */
  49. #define CFG_NIOS_CPU_STACK 0x008fff00 /* stack top addr */
  50. #define CFG_NIOS_CPU_VEC_BASE 0x008fff00 /* IRQ vectors addr */
  51. #define CFG_NIOS_CPU_VEC_SIZE 256 /* size */
  52. #define CFG_NIOS_CPU_VEC_NUMS 64 /* numbers */
  53. #define CFG_NIOS_CPU_RST_VECT 0x00920000 /* RESET vector addr */
  54. #define CFG_NIOS_CPU_DBG_CORE 0 /* CPU debug: no(0) */
  55. /* yes(1) */
  56. /* on-chip extensions */
  57. #define CFG_NIOS_CPU_RAM_BASE 0 /* on chip RAM addr */
  58. #define CFG_NIOS_CPU_RAM_SIZE 0 /* size */
  59. #define CFG_NIOS_CPU_ROM_BASE 0x00920000 /* on chip ROM addr */
  60. #define CFG_NIOS_CPU_ROM_SIZE (2 * 1024) /* 2 KB size */
  61. #define CFG_NIOS_CPU_OCI_BASE 0x00920800 /* OCI core addr */
  62. #define CFG_NIOS_CPU_OCI_SIZE 256 /* size */
  63. /* timer */
  64. #define CFG_NIOS_CPU_TIMER_NUMS 2 /* number of timer */
  65. #define CFG_NIOS_CPU_TIMER0 0x00920940 /* TIMER0 addr */
  66. #define CFG_NIOS_CPU_TIMER0_IRQ 16 /* IRQ */
  67. #define CFG_NIOS_CPU_TIMER0_PER 1000 /* periode usec */
  68. #define CFG_NIOS_CPU_TIMER0_AR 0 /* always run: no(0) */
  69. /* yes(1) */
  70. #define CFG_NIOS_CPU_TIMER0_FP 0 /* fixed per: no(0) */
  71. /* yes(1) */
  72. #define CFG_NIOS_CPU_TIMER0_SS 1 /* snaphot: no(0) */
  73. /* yes(1) */
  74. #define CFG_NIOS_CPU_TIMER1 0x009209e0 /* TIMER1 addr */
  75. #define CFG_NIOS_CPU_TIMER1_IRQ 50 /* IRQ */
  76. #define CFG_NIOS_CPU_TIMER1_PER 10000 /* periode usec */
  77. #define CFG_NIOS_CPU_TIMER1_AR 1 /* always run: no(0) */
  78. /* yes(1) */
  79. #define CFG_NIOS_CPU_TIMER1_FP 1 /* fixed per: no(0) */
  80. /* yes(1) */
  81. #define CFG_NIOS_CPU_TIMER1_SS 0 /* snaphot: no(0) */
  82. /* yes(1) */
  83. /* serial i/o */
  84. #define CFG_NIOS_CPU_UART_NUMS 1 /* number of uarts */
  85. #define CFG_NIOS_CPU_UART0 0x00920900 /* UART0 addr */
  86. #define CFG_NIOS_CPU_UART0_IRQ 25 /* IRQ */
  87. #define CFG_NIOS_CPU_UART0_BR 115200 /* baudrate var(0) */
  88. #define CFG_NIOS_CPU_UART0_DB 8 /* data bit */
  89. #define CFG_NIOS_CPU_UART0_SB 1 /* stop bit */
  90. #define CFG_NIOS_CPU_UART0_PA 0 /* parity none(0) */
  91. /* odd(1) */
  92. /* even(2) */
  93. #define CFG_NIOS_CPU_UART0_HS 0 /* handshake: no(0) */
  94. /* crts(1) */
  95. #define CFG_NIOS_CPU_UART0_EOP 0 /* eop reg: no(0) */
  96. /* yes(1) */
  97. /* parallel i/o */
  98. #define CFG_NIOS_CPU_PIO_NUMS 8 /* number of parports */
  99. #define CFG_NIOS_CPU_PIO0 0x00920960 /* PIO0 addr */
  100. #define CFG_NIOS_CPU_PIO0_IRQ 40 /* IRQ */
  101. #define CFG_NIOS_CPU_PIO0_BITS 4 /* number of bits */
  102. #define CFG_NIOS_CPU_PIO0_TYPE 2 /* io type: tris(0) */
  103. /* out(1) */
  104. /* in(2) */
  105. #define CFG_NIOS_CPU_PIO0_CAP 1 /* capture: no(0) */
  106. /* yes(1) */
  107. #define CFG_NIOS_CPU_PIO0_EDGE 3 /* edge type: none(0) */
  108. /* fall(1) */
  109. /* rise(2) */
  110. /* any(3) */
  111. #define CFG_NIOS_CPU_PIO0_ITYPE 2 /* IRQ type: none(0) */
  112. /* level(1)*/
  113. /* edge(2) */
  114. #define CFG_NIOS_CPU_PIO1 0x00920970 /* PIO1 addr */
  115. #undef CFG_NIOS_CPU_PIO1_IRQ /* w/o IRQ */
  116. #define CFG_NIOS_CPU_PIO1_BITS 11 /* number of bits */
  117. #define CFG_NIOS_CPU_PIO1_TYPE 0 /* io type: tris(0) */
  118. /* out(1) */
  119. /* in(2) */
  120. #define CFG_NIOS_CPU_PIO1_CAP 0 /* capture: no(0) */
  121. /* yes(1) */
  122. #define CFG_NIOS_CPU_PIO1_EDGE 0 /* edge type: none(0) */
  123. /* fall(1) */
  124. /* rise(2) */
  125. /* any(3) */
  126. #define CFG_NIOS_CPU_PIO1_ITYPE 0 /* IRQ type: none(0) */
  127. /* level(1)*/
  128. /* edge(2) */
  129. #define CFG_NIOS_CPU_PIO2 0x00920980 /* PIO2 addr */
  130. #undef CFG_NIOS_CPU_PIO2_IRQ /* w/o IRQ */
  131. #define CFG_NIOS_CPU_PIO2_BITS 8 /* number of bits */
  132. #define CFG_NIOS_CPU_PIO2_TYPE 1 /* io type: tris(0) */
  133. /* out(1) */
  134. /* in(2) */
  135. #define CFG_NIOS_CPU_PIO2_CAP 0 /* capture: no(0) */
  136. /* yes(1) */
  137. #define CFG_NIOS_CPU_PIO2_EDGE 0 /* edge type: none(0) */
  138. /* fall(1) */
  139. /* rise(2) */
  140. /* any(3) */
  141. #define CFG_NIOS_CPU_PIO2_ITYPE 0 /* IRQ type: none(0) */
  142. /* level(1)*/
  143. /* edge(2) */
  144. #define CFG_NIOS_CPU_PIO3 0x00920990 /* PIO3 addr */
  145. #undef CFG_NIOS_CPU_PIO3_IRQ /* w/o IRQ */
  146. #define CFG_NIOS_CPU_PIO3_BITS 16 /* number of bits */
  147. #define CFG_NIOS_CPU_PIO3_TYPE 1 /* io type: tris(0) */
  148. /* out(1) */
  149. /* in(2) */
  150. #define CFG_NIOS_CPU_PIO3_CAP 0 /* capture: no(0) */
  151. /* yes(1) */
  152. #define CFG_NIOS_CPU_PIO3_EDGE 0 /* edge type: none(0) */
  153. /* fall(1) */
  154. /* rise(2) */
  155. /* any(3) */
  156. #define CFG_NIOS_CPU_PIO3_ITYPE 0 /* IRQ type: none(0) */
  157. /* level(1)*/
  158. /* edge(2) */
  159. #define CFG_NIOS_CPU_PIO4 0x009209a0 /* PIO4 addr */
  160. #undef CFG_NIOS_CPU_PIO4_IRQ /* w/o IRQ */
  161. #define CFG_NIOS_CPU_PIO4_BITS 1 /* number of bits */
  162. #define CFG_NIOS_CPU_PIO4_TYPE 0 /* io type: tris(0) */
  163. /* out(1) */
  164. /* in(2) */
  165. #define CFG_NIOS_CPU_PIO4_CAP 0 /* capture: no(0) */
  166. /* yes(1) */
  167. #define CFG_NIOS_CPU_PIO4_EDGE 0 /* edge type: none(0) */
  168. /* fall(1) */
  169. /* rise(2) */
  170. /* any(3) */
  171. #define CFG_NIOS_CPU_PIO4_ITYPE 0 /* IRQ type: none(0) */
  172. /* level(1)*/
  173. /* edge(2) */
  174. #define CFG_NIOS_CPU_PIO5 0x009209b0 /* PIO5 addr */
  175. #define CFG_NIOS_CPU_PIO5_IRQ 35 /* IRQ */
  176. #define CFG_NIOS_CPU_PIO5_BITS 1 /* number of bits */
  177. #define CFG_NIOS_CPU_PIO5_TYPE 2 /* io type: tris(0) */
  178. /* out(1) */
  179. /* in(2) */
  180. #define CFG_NIOS_CPU_PIO5_CAP 1 /* capture: no(0) */
  181. /* yes(1) */
  182. #define CFG_NIOS_CPU_PIO5_EDGE 3 /* edge type: none(0) */
  183. /* fall(1) */
  184. /* rise(2) */
  185. /* any(3) */
  186. #define CFG_NIOS_CPU_PIO5_ITYPE 2 /* IRQ type: none(0) */
  187. /* level(1)*/
  188. /* edge(2) */
  189. #define CFG_NIOS_CPU_PIO6 0x009209c0 /* PIO6 addr */
  190. #undef CFG_NIOS_CPU_PIO6_IRQ /* w/o IRQ */
  191. #define CFG_NIOS_CPU_PIO6_BITS 1 /* number of bits */
  192. #define CFG_NIOS_CPU_PIO6_TYPE 1 /* io type: tris(0) */
  193. /* out(1) */
  194. /* in(2) */
  195. #define CFG_NIOS_CPU_PIO6_CAP 0 /* capture: no(0) */
  196. /* yes(1) */
  197. #define CFG_NIOS_CPU_PIO6_EDGE 0 /* edge type: none(0) */
  198. /* fall(1) */
  199. /* rise(2) */
  200. /* any(3) */
  201. #define CFG_NIOS_CPU_PIO6_ITYPE 0 /* IRQ type: none(0) */
  202. /* level(1)*/
  203. /* edge(2) */
  204. #define CFG_NIOS_CPU_PIO7 0x009209d0 /* PIO7 addr */
  205. #undef CFG_NIOS_CPU_PIO7_IRQ /* w/o IRQ */
  206. #define CFG_NIOS_CPU_PIO7_BITS 1 /* number of bits */
  207. #define CFG_NIOS_CPU_PIO7_TYPE 1 /* io type: tris(0) */
  208. /* out(1) */
  209. /* in(2) */
  210. #define CFG_NIOS_CPU_PIO7_CAP 0 /* capture: no(0) */
  211. /* yes(1) */
  212. #define CFG_NIOS_CPU_PIO7_EDGE 0 /* edge type: none(0) */
  213. /* fall(1) */
  214. /* rise(2) */
  215. /* any(3) */
  216. #define CFG_NIOS_CPU_PIO7_ITYPE 0 /* IRQ type: none(0) */
  217. /* level(1)*/
  218. /* edge(2) */
  219. /* IDE i/f */
  220. #define CFG_NIOS_CPU_IDE_NUMS 1 /* number of IDE contr. */
  221. #define CFG_NIOS_CPU_IDE0 0x00920a00 /* IDE0 addr */
  222. /* active serial memory i/f */
  223. #define CFG_NIOS_CPU_ASMI_NUMS 1 /* number of ASMI */
  224. #define CFG_NIOS_CPU_ASMI0 0x00920b00 /* ASMI0 addr */
  225. #define CFG_NIOS_CPU_ASMI0_IRQ 45 /* IRQ */
  226. /* memory accessibility */
  227. #define CFG_NIOS_CPU_SRAM_BASE 0x00800000 /* board SRAM addr */
  228. #define CFG_NIOS_CPU_SRAM_SIZE (1024 * 1024) /* 1 MB size */
  229. #define CFG_NIOS_CPU_SDRAM_BASE 0x01000000 /* board SDRAM addr */
  230. #define CFG_NIOS_CPU_SDRAM_SIZE (16*1024*1024) /* 16 MB size */
  231. #define CFG_NIOS_CPU_FLASH_BASE 0x00000000 /* board Flash addr */
  232. #define CFG_NIOS_CPU_FLASH_SIZE (8*1024*1024) /* 8 MB size */
  233. /* LAN */
  234. #define CFG_NIOS_CPU_LAN_NUMS 1 /* number of LAN i/f */
  235. #define CFG_NIOS_CPU_LAN0_BASE 0x00910000 /* LAN0 addr */
  236. #define CFG_NIOS_CPU_LAN0_OFFS 0x0300 /* offset */
  237. #define CFG_NIOS_CPU_LAN0_IRQ 30 /* IRQ */
  238. #define CFG_NIOS_CPU_LAN0_BUSW 32 /* buswidth*/
  239. #define CFG_NIOS_CPU_LAN0_TYPE 0 /* smc91111(0) */
  240. /* cs8900(1) */
  241. /* ex: alteramac(2) */
  242. /* symbolic redefinition (undef, if not present) */
  243. #define CFG_NIOS_CPU_USER_TIMER 0 /* TIMER0: users choice */
  244. #define CFG_NIOS_CPU_TICK_TIMER 1 /* TIMER1: tick (needed)*/
  245. #define CFG_NIOS_CPU_BUTTON_PIO 0 /* PIO0: buttons */
  246. #define CFG_NIOS_CPU_LCD_PIO 1 /* PIO1: ASCII LCD */
  247. #define CFG_NIOS_CPU_LED_PIO 2 /* PIO2: LED bar */
  248. #define CFG_NIOS_CPU_SEVENSEG_PIO 3 /* PIO3: 7-seg. display */
  249. #define CFG_NIOS_CPU_RECONF_PIO 4 /* PIO4: reconf pin */
  250. #define CFG_NIOS_CPU_CFPRESENT_PIO 5 /* PIO5: CF present IRQ */
  251. #define CFG_NIOS_CPU_CFPOWER_PIO 6 /* PIO6: CF power/sw. */
  252. #define CFG_NIOS_CPU_CFATASEL_PIO 7 /* PIO7: CF ATA select */
  253. #else
  254. #error *** CFG_ERROR: you have to setup right NIOS CPU configuration
  255. #endif
  256. /*------------------------------------------------------------------------
  257. * BOARD/CPU -- TOP-LEVEL
  258. *----------------------------------------------------------------------*/
  259. #define CONFIG_NIOS 1 /* NIOS-32 core */
  260. #define CONFIG_DK1C20 1 /* Cyclone DK-1C20 board*/
  261. #define CONFIG_SYS_CLK_FREQ CFG_NIOS_CPU_CLK/* 50 MHz core clock */
  262. #define CFG_HZ 1000 /* 1 msec time tick */
  263. #undef CFG_CLKS_IN_HZ
  264. #define CONFIG_BOARD_EARLY_INIT_F 1 /* enable early board-spec. init*/
  265. /*------------------------------------------------------------------------
  266. * BASE ADDRESSES / SIZE (Flash, SRAM, SDRAM)
  267. *----------------------------------------------------------------------*/
  268. #if (CFG_NIOS_CPU_SDRAM_SIZE != 0)
  269. #define CFG_SDRAM_BASE CFG_NIOS_CPU_SDRAM_BASE
  270. #define CFG_SDRAM_SIZE CFG_NIOS_CPU_SDRAM_SIZE
  271. #else
  272. #error *** CFG_ERROR: you have to setup any SDRAM in NIOS CPU config
  273. #endif
  274. #define CFG_SRAM_BASE CFG_NIOS_CPU_SRAM_BASE
  275. #define CFG_SRAM_SIZE CFG_NIOS_CPU_SRAM_SIZE
  276. #define CFG_VECT_BASE CFG_NIOS_CPU_VEC_BASE
  277. /*------------------------------------------------------------------------
  278. * MEMORY ORGANIZATION - For the most part, you can put things pretty
  279. * much anywhere. This is pretty flexible for Nios. So here we make some
  280. * arbitrary choices & assume that the monitor is placed at the end of
  281. * a memory resource (so you must make sure TEXT_BASE is chosen
  282. * appropriately).
  283. *
  284. * -The heap is placed below the monitor.
  285. * -Global data is placed below the heap.
  286. * -The stack is placed below global data (&grows down).
  287. *----------------------------------------------------------------------*/
  288. #define CFG_MONITOR_LEN (256 * 1024) /* Reserve 256k */
  289. #define CFG_GBL_DATA_SIZE 128 /* Global data size rsvd*/
  290. #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024)
  291. #define CFG_MONITOR_BASE TEXT_BASE
  292. #define CFG_MALLOC_BASE (CFG_MONITOR_BASE - CFG_MALLOC_LEN)
  293. #define CFG_GBL_DATA_OFFSET (CFG_MALLOC_BASE - CFG_GBL_DATA_SIZE)
  294. #define CFG_INIT_SP CFG_GBL_DATA_OFFSET
  295. /*------------------------------------------------------------------------
  296. * FLASH (AM29LV065D)
  297. *----------------------------------------------------------------------*/
  298. #if (CFG_NIOS_CPU_FLASH_SIZE != 0)
  299. #define CFG_FLASH_BASE CFG_NIOS_CPU_FLASH_BASE
  300. #define CFG_FLASH_SIZE CFG_NIOS_CPU_FLASH_SIZE
  301. #define CFG_MAX_FLASH_SECT 128 /* Max # sects per bank */
  302. #define CFG_MAX_FLASH_BANKS 1 /* Max # of flash banks */
  303. #define CFG_FLASH_ERASE_TOUT 8000 /* Erase timeout (msec) */
  304. #define CFG_FLASH_WRITE_TOUT 100 /* Write timeout (msec) */
  305. #define CFG_FLASH_WORD_SIZE unsigned char /* flash word size */
  306. #else
  307. #error *** CFG_ERROR: you have to setup any Flash memory in NIOS CPU config
  308. #endif
  309. /*------------------------------------------------------------------------
  310. * ENVIRONMENT
  311. *----------------------------------------------------------------------*/
  312. #if (CFG_NIOS_CPU_FLASH_SIZE != 0)
  313. #define CFG_ENV_IS_IN_FLASH 1 /* Environment in flash */
  314. #define CFG_ENV_ADDR CFG_FLASH_BASE /* Mem addr of env */
  315. #define CFG_ENV_SIZE (64 * 1024) /* 64 KByte (1 sector) */
  316. #define CONFIG_ENV_OVERWRITE /* Serial/eth change Ok */
  317. #else
  318. #define CFG_ENV_IS_NOWHERE 1 /* NO Environment */
  319. #endif
  320. /*------------------------------------------------------------------------
  321. * CONSOLE
  322. *----------------------------------------------------------------------*/
  323. #if (CFG_NIOS_CPU_UART_NUMS != 0)
  324. #define CFG_NIOS_CONSOLE CFG_NIOS_CPU_UART0 /* 1st UART is Cons. */
  325. #if (CFG_NIOS_CPU_UART0_BR != 0)
  326. #define CFG_NIOS_FIXEDBAUD 1 /* Baudrate is fixed */
  327. #define CONFIG_BAUDRATE CFG_NIOS_CPU_UART0_BR
  328. #else
  329. #undef CFG_NIOS_FIXEDBAUD
  330. #define CONFIG_BAUDRATE 115200
  331. #endif
  332. #define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
  333. #else
  334. #error *** CFG_ERROR: you have to setup at least one UART in NIOS CPU config
  335. #endif
  336. /*------------------------------------------------------------------------
  337. * TIMER FOR TIMEBASE -- Nios doesn't have the equivalent of ppc PIT,
  338. * so an avalon bus timer is required.
  339. *----------------------------------------------------------------------*/
  340. #if (CFG_NIOS_CPU_TIMER_NUMS != 0)
  341. #if (CFG_NIOS_CPU_TICK_TIMER == 0)
  342. #error *** CFG_ERROR: tick timer at TIMER0 not supported, expand your config.h
  343. #elif (CFG_NIOS_CPU_TICK_TIMER == 1)
  344. #define CFG_NIOS_TMRBASE CFG_NIOS_CPU_TIMER1 /* TIMER1 as tick */
  345. #define CFG_NIOS_TMRIRQ CFG_NIOS_CPU_TIMER1_IRQ
  346. #if (CFG_NIOS_CPU_TIMER1_PER >= CFG_HZ)
  347. #define CFG_NIOS_TMRMS (CFG_NIOS_CPU_TIMER1_PER / CFG_HZ)
  348. #else
  349. #error *** CFG_ERROR: you have to use a timer periode of more than CFG_HZ
  350. #endif
  351. #endif /* CFG_NIOS_CPU_TICK_TIMER */
  352. #else
  353. #error *** CFG_ERROR: you have to setup at least one TIMER in NIOS CPU config
  354. #endif
  355. /*------------------------------------------------------------------------
  356. * Ethernet
  357. *----------------------------------------------------------------------*/
  358. #if (CFG_NIOS_CPU_LAN_NUMS == 1)
  359. #if (CFG_NIOS_CPU_LAN0_TYPE == 0) /* LAN91C111 */
  360. /****************************************************/
  361. /* !!! LAN91C111 works for NIOS with patch only !!! */
  362. /****************************************************/
  363. #define CONFIG_DRIVER_SMC91111 /* Using SMC91c111 */
  364. #undef CONFIG_SMC91111_EXT_PHY /* Internal PHY */
  365. #define CONFIG_SMC91111_BASE (CFG_NIOS_CPU_LAN0_BASE + CFG_NIOS_CPU_LAN0_OFFS)
  366. #if (CFG_NIOS_CPU_LAN0_BUSW == 32)
  367. #define CONFIG_SMC_USE_32_BIT 1
  368. #else /* no */
  369. #undef CONFIG_SMC_USE_32_BIT
  370. #endif
  371. #elif (CFG_NIOS_CPU_LAN0_TYPE == 1) /* CS8900A */
  372. /********************************************/
  373. /* !!! CS8900 is __not__ tested on NIOS !!! */
  374. /********************************************/
  375. #define CONFIG_DRIVER_CS8900 /* Using CS8900 */
  376. #define CS8900_BASE (CFG_NIOS_CPU_LAN0_BASE + CFG_NIOS_CPU_LAN0_OFFS)
  377. #if (CFG_NIOS_CPU_LAN0_BUSW == 32)
  378. #undef CS8900_BUS16
  379. #define CS8900_BUS32 1
  380. #else /* no */
  381. #define CS8900_BUS16 1
  382. #undef CS8900_BUS32
  383. #endif
  384. #else
  385. #error *** CFG_ERROR: invalid LAN0 chip type, check your NIOS CPU config
  386. #endif
  387. #define CONFIG_ETHADDR 08:00:3e:26:0a:5b
  388. #define CONFIG_NETMASK 255.255.255.0
  389. #define CONFIG_IPADDR 192.168.2.21
  390. #define CONFIG_SERVERIP 192.168.2.16
  391. #else
  392. #error *** CFG_ERROR: you have to setup just one LAN only or expand your config.h
  393. #endif
  394. /*------------------------------------------------------------------------
  395. * STATUS LEDs
  396. *----------------------------------------------------------------------*/
  397. #if (CFG_NIOS_CPU_PIO_NUMS != 0)
  398. #if (CFG_NIOS_CPU_LED_PIO == 0)
  399. #error *** CFG_ERROR: status LEDs at PIO0 not supported, expand your config.h
  400. #elif (CFG_NIOS_CPU_LED_PIO == 1)
  401. #error *** CFG_ERROR: status LEDs at PIO1 not supported, expand your config.h
  402. #elif (CFG_NIOS_CPU_LED_PIO == 2)
  403. #define STATUS_LED_BASE CFG_NIOS_CPU_PIO2
  404. #define STATUS_LED_BITS CFG_NIOS_CPU_PIO2_BITS
  405. #define STATUS_LED_ACTIVE 1 /* LED on for bit == 1 */
  406. #if (CFG_NIOS_CPU_PIO2_TYPE == 1)
  407. #define STATUS_LED_WRONLY 1
  408. #else
  409. #undef STATUS_LED_WRONLY
  410. #endif
  411. #elif (CFG_NIOS_CPU_LED_PIO == 3)
  412. #error *** CFG_ERROR: status LEDs at PIO3 not supported, expand your config.h
  413. #elif (CFG_NIOS_CPU_LED_PIO == 4)
  414. #error *** CFG_ERROR: status LEDs at PIO4 not supported, expand your config.h
  415. #elif (CFG_NIOS_CPU_LED_PIO == 5)
  416. #error *** CFG_ERROR: status LEDs at PIO5 not supported, expand your config.h
  417. #elif (CFG_NIOS_CPU_LED_PIO == 6)
  418. #error *** CFG_ERROR: status LEDs at PIO6 not supported, expand your config.h
  419. #elif (CFG_NIOS_CPU_LED_PIO == 7)
  420. #error *** CFG_ERROR: status LEDs at PIO7 not supported, expand your config.h
  421. #elif (CFG_NIOS_CPU_LED_PIO == 8)
  422. #error *** CFG_ERROR: status LEDs at PIO8 not supported, expand your config.h
  423. #elif (CFG_NIOS_CPU_LED_PIO == 9)
  424. #error *** CFG_ERROR: status LEDs at PIO9 not supported, expand your config.h
  425. #else
  426. #error *** CFG_ERROR: you have to set CFG_NIOS_CPU_LED_PIO in right case
  427. #endif
  428. #define CONFIG_STATUS_LED 1 /* enable status led driver */
  429. #define STATUS_LED_BIT (1 << 0) /* LED[0] */
  430. #define STATUS_LED_STATE STATUS_LED_BLINKING
  431. #define STATUS_LED_BOOT_STATE STATUS_LED_OFF
  432. #define STATUS_LED_PERIOD (CFG_HZ / 10) /* ca. 1 Hz */
  433. #define STATUS_LED_BOOT 0 /* boot LED */
  434. #if (STATUS_LED_BITS > 1)
  435. #define STATUS_LED_BIT1 (1 << 1) /* LED[1] */
  436. #define STATUS_LED_STATE1 STATUS_LED_OFF
  437. #define STATUS_LED_PERIOD1 (CFG_HZ / 50) /* ca. 5 Hz */
  438. #define STATUS_LED_RED 1 /* fail LED */
  439. #endif
  440. #if (STATUS_LED_BITS > 2)
  441. #define STATUS_LED_BIT2 (1 << 2) /* LED[2] */
  442. #define STATUS_LED_STATE2 STATUS_LED_OFF
  443. #define STATUS_LED_PERIOD2 (CFG_HZ / 10) /* ca. 1 Hz */
  444. #define STATUS_LED_YELLOW 2 /* info LED */
  445. #endif
  446. #if (STATUS_LED_BITS > 3)
  447. #define STATUS_LED_BIT3 (1 << 3) /* LED[3] */
  448. #define STATUS_LED_STATE3 STATUS_LED_OFF
  449. #define STATUS_LED_PERIOD3 (CFG_HZ / 10) /* ca. 1 Hz */
  450. #define STATUS_LED_GREEN 3 /* info LED */
  451. #endif
  452. #define STATUS_LED_PAR 1 /* makes status_led.h happy */
  453. #endif /* CFG_NIOS_CPU_PIO_NUMS */
  454. /*------------------------------------------------------------------------
  455. * SEVEN SEGMENT LED DISPLAY
  456. *----------------------------------------------------------------------*/
  457. #if (CFG_NIOS_CPU_PIO_NUMS != 0)
  458. #if (CFG_NIOS_CPU_SEVENSEG_PIO == 0)
  459. #error *** CFG_ERROR: status LEDs at PIO0 not supported, expand your config.h
  460. #elif (CFG_NIOS_CPU_SEVENSEG_PIO == 1)
  461. #error *** CFG_ERROR: status LEDs at PIO1 not supported, expand your config.h
  462. #elif (CFG_NIOS_CPU_SEVENSEG_PIO == 2)
  463. #error *** CFG_ERROR: status LEDs at PIO2 not supported, expand your config.h
  464. #elif (CFG_NIOS_CPU_SEVENSEG_PIO == 3)
  465. #define SEVENSEG_BASE CFG_NIOS_CPU_PIO3
  466. #define SEVENSEG_BITS CFG_NIOS_CPU_PIO3_BITS
  467. #define SEVENSEG_ACTIVE 0 /* LED on for bit == 1 */
  468. #if (CFG_NIOS_CPU_PIO3_TYPE == 1)
  469. #define SEVENSEG_WRONLY 1
  470. #else
  471. #undef SEVENSEG_WRONLY
  472. #endif
  473. #elif (CFG_NIOS_CPU_SEVENSEG_PIO == 4)
  474. #error *** CFG_ERROR: status LEDs at PIO4 not supported, expand your config.h
  475. #elif (CFG_NIOS_CPU_SEVENSEG_PIO == 5)
  476. #error *** CFG_ERROR: status LEDs at PIO5 not supported, expand your config.h
  477. #elif (CFG_NIOS_CPU_SEVENSEG_PIO == 6)
  478. #error *** CFG_ERROR: status LEDs at PIO6 not supported, expand your config.h
  479. #elif (CFG_NIOS_CPU_SEVENSEG_PIO == 7)
  480. #error *** CFG_ERROR: status LEDs at PIO7 not supported, expand your config.h
  481. #elif (CFG_NIOS_CPU_SEVENSEG_PIO == 8)
  482. #error *** CFG_ERROR: status LEDs at PIO8 not supported, expand your config.h
  483. #elif (CFG_NIOS_CPU_SEVENSEG_PIO == 9)
  484. #error *** CFG_ERROR: status LEDs at PIO9 not supported, expand your config.h
  485. #else
  486. #error *** CFG_ERROR: you have to set CFG_NIOS_CPU_SEVENSEG_PIO in right case
  487. #endif
  488. #define CONFIG_SEVENSEG 1 /* enable seven segment led driver */
  489. /*
  490. * Dual 7-Segment Display pin assignment -- read more in your
  491. * "Nios Development Board Reference Manual"
  492. *
  493. *
  494. * (U8) HI:D[15..8] (U9) LO:D[7..0]
  495. * ______ ______
  496. * | D14 | | D6 |
  497. * | | | |
  498. * D9| |D13 D1| |D5
  499. * |______| |______| ___
  500. * | D8 | | D0 | | A |
  501. * | | | | F|___|B
  502. * D10| |D12 D2| |D4 | G |
  503. * |______| |______| E|___|C
  504. * D11 * D3 * D *
  505. * D15 D7 DP
  506. *
  507. */
  508. #define SEVENSEG_DIGIT_HI_LO_EQUAL 1 /* high nibble equal low nibble */
  509. #define SEVENSEG_DIGIT_A (1 << 6) /* bit 6 is segment A */
  510. #define SEVENSEG_DIGIT_B (1 << 5) /* bit 5 is segment B */
  511. #define SEVENSEG_DIGIT_C (1 << 4) /* bit 4 is segment C */
  512. #define SEVENSEG_DIGIT_D (1 << 3) /* bit 3 is segment D */
  513. #define SEVENSEG_DIGIT_E (1 << 2) /* bit 2 is segment E */
  514. #define SEVENSEG_DIGIT_F (1 << 1) /* bit 1 is segment F */
  515. #define SEVENSEG_DIGIT_G (1 << 0) /* bit 0 is segment G */
  516. #define SEVENSEG_DIGIT_DP (1 << 7) /* bit 7 is decimal point */
  517. #endif /* CFG_NIOS_CPU_PIO_NUMS */
  518. /*------------------------------------------------------------------------
  519. * ASMI - Active Serial Memory Interface.
  520. *
  521. * ASMI is for Cyclone devices only and only works when the configuration
  522. * is loaded via JTAG or ASMI. Please see doc/README.dk1c20 for details.
  523. *----------------------------------------------------------------------*/
  524. #define CONFIG_NIOS_ASMI /* Enable ASMI */
  525. #define CFG_NIOS_ASMIBASE CFG_NIOS_CPU_ASMI0 /* ASMI base address */
  526. /*------------------------------------------------------------------------
  527. * COMMANDS
  528. *----------------------------------------------------------------------*/
  529. #define CONFIG_COMMANDS (CFG_CMD_ALL & ~( \
  530. CFG_CMD_ASKENV | \
  531. CFG_CMD_BEDBUG | \
  532. CFG_CMD_BMP | \
  533. CFG_CMD_BSP | \
  534. CFG_CMD_CACHE | \
  535. CFG_CMD_DATE | \
  536. CFG_CMD_DOC | \
  537. CFG_CMD_DTT | \
  538. CFG_CMD_EEPROM | \
  539. CFG_CMD_ELF | \
  540. CFG_CMD_FAT | \
  541. CFG_CMD_FDC | \
  542. CFG_CMD_FDOS | \
  543. CFG_CMD_HWFLOW | \
  544. CFG_CMD_IDE | \
  545. CFG_CMD_I2C | \
  546. CFG_CMD_JFFS2 | \
  547. CFG_CMD_KGDB | \
  548. CFG_CMD_NAND | \
  549. CFG_CMD_MMC | \
  550. CFG_CMD_MII | \
  551. CFG_CMD_PCI | \
  552. CFG_CMD_PCMCIA | \
  553. CFG_CMD_SCSI | \
  554. CFG_CMD_SPI | \
  555. CFG_CMD_VFD | \
  556. CFG_CMD_USB ) )
  557. #include <cmd_confdefs.h>
  558. /*------------------------------------------------------------------------
  559. * KGDB
  560. *----------------------------------------------------------------------*/
  561. #if (CONFIG_COMMANDS & CFG_CMD_KGDB)
  562. #define CONFIG_KGDB_BAUDRATE 9600
  563. #endif
  564. /*------------------------------------------------------------------------
  565. * MISC
  566. *----------------------------------------------------------------------*/
  567. #define CFG_LONGHELP /* undef to save memory */
  568. #define CFG_PROMPT "DK1C20 > " /* Monitor Command Prompt */
  569. #define CFG_CBSIZE 256 /* Console I/O Buffer Size */
  570. #define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
  571. #define CFG_MAXARGS 16 /* max number of command args*/
  572. #define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
  573. #if (CFG_SRAM_SIZE != 0)
  574. #define CFG_LOAD_ADDR CFG_SRAM_BASE /* Default load address */
  575. #else
  576. #undef CFG_LOAD_ADDR
  577. #endif
  578. #if (CFG_SDRAM_SIZE != 0)
  579. #define CFG_MEMTEST_START CFG_SDRAM_BASE /* SDRAM til stack area */
  580. #define CFG_MEMTEST_END (CFG_INIT_SP - (1024 * 1024)) /* 1MB stack */
  581. #else
  582. #undef CFG_MEMTEST_START
  583. #undef CFG_MEMTEST_END
  584. #endif
  585. #endif /* __CONFIG_H */