DK1S10.h 24 KB

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