rtconfig.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. /***************************************************************************//**
  2. * @file rtconfig.h
  3. * @brief RT-Thread config file
  4. * COPYRIGHT (C) 2009, RT-Thread Development Team
  5. * @author
  6. * @version 0.4 beta
  7. *******************************************************************************
  8. * @section License
  9. * The license and distribution terms for this file may be found in the file
  10. * LICENSE in this distribution or at http://www.rt-thread.org/license/LICENSE
  11. ******************************************************************************/
  12. #ifndef __RTTHREAD_CFG_H__
  13. #define __RTTHREAD_CFG_H__
  14. /* Includes ------------------------------------------------------------------*/
  15. /* Exported types ------------------------------------------------------------*/
  16. /* Exported constants --------------------------------------------------------*/
  17. /* Exported macro ------------------------------------------------------------*/
  18. /* RT_NAME_MAX*/
  19. #define RT_NAME_MAX (8)
  20. /* RT_ALIGN_SIZE*/
  21. #define RT_ALIGN_SIZE (4)
  22. /* PRIORITY_MAX */
  23. #define RT_THREAD_PRIORITY_MAX (32)
  24. /* Tick per Second */
  25. #define RT_TICK_PER_SECOND (100)
  26. /* SECTION: RT_DEBUG */
  27. #define RT_DEBUG
  28. //#define RT_DEBUG_MEM (1)
  29. //#define RT_DEBUG_SCHEDULER (1)
  30. //#define RT_DEBUG_IPC (1)
  31. //#define THREAD_DEBUG
  32. //#define IRQ_DEBUG
  33. #define RT_USING_OVERFLOW_CHECK
  34. //#define DFS_DEBUG
  35. #define RT_LWIP_DEBUG
  36. //#define RT_IRQHDL_DEBUG
  37. //#define RT_USART_DEBUG
  38. //#define RT_LEUART_DEBUG
  39. //#define RT_IIC_DEBUG
  40. //#define RT_MISC_DEBUG
  41. //#define RT_ADC_DEBUG
  42. //#define RT_ACMP_DEBUG
  43. //#define RT_TIMER_DEBUG
  44. //#define RT_RTC_DEBUG
  45. #define EFM32_DEBUG
  46. #define EFM32_ACCEL_DEBUG
  47. #define EFM32_SFLASH_DEBUG
  48. //#define EFM32_SDCARD_DEBUG
  49. #define EFM32_ETHERNET_DEBUG
  50. #define EFM32_LCD_DEBUG
  51. //#define EFM32_KEYS_DEBUG
  52. /* Using Hook */
  53. //#define RT_USING_HOOK
  54. /* Using Software Timer */
  55. /* #define RT_USING_TIMER_SOFT */
  56. #define RT_TIMER_THREAD_PRIO (4)
  57. #define RT_TIMER_THREAD_STACK_SIZE (512)
  58. #define RT_TIMER_TICK_PER_SECOND (10)
  59. /* SECTION: IPC */
  60. /* Using Semaphore*/
  61. #define RT_USING_SEMAPHORE /* Required by DFS and lwIP */
  62. /* Using Mutex */
  63. #define RT_USING_MUTEX /* Required by DFS */
  64. /* Using Event */
  65. //#define RT_USING_EVENT
  66. /* Using MailBox */
  67. #define RT_USING_MAILBOX /* Required by lwIP */
  68. /* Using Message Queue */
  69. #define RT_USING_MESSAGEQUEUE /* Required by RTGUI */
  70. /* SECTION: Memory Management */
  71. /* Using Memory Pool Management*/
  72. //#define RT_USING_MEMPOOL
  73. /* Using Dynamic Heap Management */
  74. #define RT_USING_HEAP
  75. /* Using Small MM */
  76. #define RT_USING_SMALL_MEM
  77. /* SECTION: Device System */
  78. /* Using Device System */
  79. #define RT_USING_DEVICE
  80. /* SECTION: UART options */
  81. /* USART/UART/LEUART Device for Console */
  82. #if defined(EFM32_G8XX_STK)
  83. #define RT_USING_USART1 (0x1UL)
  84. #define RT_USART1_NAME "debug"
  85. //#define RT_USART1_USING_DMA (0x0UL)
  86. #elif defined(EFM32_GXXX_DK)
  87. #define RT_USING_USART1 (0x0UL)
  88. #define RT_USART1_NAME "debug"
  89. //#define RT_USART1_USING_DMA (0x0UL)
  90. #elif defined(EFM32GG_DK3750)
  91. #define EFM32GG_DK3750_USING_LEUART1
  92. #if defined(EFM32GG_DK3750_USING_LEUART1)
  93. #define RT_USING_LEUART1 (0x0UL)
  94. #define RT_LEUART1_NAME "debug0"
  95. //#define RT_LEUART1_USING_DMA (0x0UL)
  96. #else
  97. #define RT_USING_UART1 (0x2UL)
  98. #define RT_UART1_NAME "debug"
  99. //#define RT_UART1_USING_DMA (0x0UL)
  100. #endif
  101. #endif
  102. /* SECTION: SPI options */
  103. #define EFM32_SPI_MASTER (1 << 0) /* Master mode */
  104. #define EFM32_SPI_AUTOCS (1 << 1) /* Auto chip select */
  105. #define EFM32_SPI_9BIT (1 << 2) /* 9-bit data */
  106. /*
  107. 0: Clock idle low, sample on rising edge
  108. 1: Clock idle low, sample on falling edge
  109. 2: Clock idle high, sample on falling edge
  110. 3: Clock idle high, sample on rising edge.
  111. */
  112. #define EFM32_SPI_CLK_MODE(mode) (mode << 3) /* clock mode */
  113. #if defined(EFM32_G8XX_STK)
  114. //#define RT_USING_USART0 (0x0UL)
  115. //#define RT_USART0_SYNC_MODE (EFM32_SPI_MASTER)
  116. //#define RT_USART0_NAME "spi0"
  117. //#define RT_USART0_USING_DMA (0x1UL)
  118. #elif defined(EFM32_GXXX_DK)
  119. #define RT_USING_USART0 (0x2UL)
  120. #define RT_USART0_SYNC_MODE (EFM32_SPI_MASTER | EFM32_SPI_AUTOCS | \
  121. EFM32_SPI_CLK_MODE(0))
  122. #define RT_USART0_NAME "spi0"
  123. #define RT_USART0_USING_DMA (0x1UL)
  124. #define RT_USING_USART2 (0x1UL)
  125. #define RT_USART2_SYNC_MODE (EFM32_SPI_MASTER | EFM32_SPI_CLK_MODE(0))
  126. #define RT_USART2_NAME "spi2"
  127. #define RT_USART2_USING_DMA (0x2UL)
  128. #elif defined(EFM32GG_DK3750)
  129. #define RT_USING_USART0 (0x1UL)
  130. #define RT_USART0_SYNC_MODE (EFM32_SPI_MASTER | EFM32_SPI_AUTOCS | \
  131. EFM32_SPI_CLK_MODE(0))
  132. #define RT_USART0_NAME "spi0"
  133. #define RT_USART0_USING_DMA (0x1UL)
  134. #define RT_USING_USART1 (0x1UL)
  135. #define RT_USART1_SYNC_MODE (EFM32_SPI_MASTER | EFM32_SPI_AUTOCS | \
  136. EFM32_SPI_9BIT | EFM32_SPI_CLK_MODE(3))
  137. #define RT_USART1_NAME "spi1"
  138. #define RT_USART1_USING_DMA (0x2UL)
  139. #endif
  140. /* SECTION: IIC options */
  141. //#define RT_USING_IIC0 0x3UL
  142. #define RT_IIC0_NAME "iic0"
  143. /* SECTION: ACMP options */
  144. //#define RT_USING_ACMP0
  145. #define RT_ACMP0_NAME "acmp0"
  146. /* SECTION: ADC options */
  147. #define RT_USING_ADC0
  148. #define RT_ADC0_NAME "adc0"
  149. #if defined(RT_USING_ADC0)
  150. #define RT_USING_MISC
  151. #endif
  152. /* SECTION: TIMER options */
  153. //#define RT_USING_TIMER2 (0x00) /* Continuous mode */
  154. #define RT_TIMER2_NAME "tmr2"
  155. /* SECTION: RTC options */
  156. #if (defined(EFM32_G8XX_STK) || defined(EFM32_GXXX_DK) || defined(EFM32GG_DK3750))
  157. #define RT_USING_RTC
  158. #define RT_RTC_NAME "rtc"
  159. #endif
  160. /* SECTION: Serial options */
  161. #define EFM_USART0 (0x00UL)
  162. #define EFM_USART1 (0x01UL)
  163. #define EFM_USART2 (0x02UL)
  164. #define EFM_UART0 (0x10UL)
  165. #define EFM_UART1 (0x11UL)
  166. #define EFM_LEUART0 (0x20UL)
  167. #define EFM_LEUART1 (0x21UL)
  168. #if defined(EFM32_G8XX_STK)
  169. #define RT_CONSOLE_DEVICE (EFM_USART1)
  170. #elif defined(EFM32_GXXX_DK)
  171. #define RT_CONSOLE_DEVICE (EFM_USART1)
  172. #elif defined(EFM32GG_DK3750)
  173. #if defined(EFM32GG_DK3750_USING_LEUART1)
  174. #define RT_CONSOLE_DEVICE (EFM_LEUART1)
  175. #else
  176. #define RT_CONSOLE_DEVICE (EFM_UART1)
  177. #endif
  178. #endif
  179. /* SECTION: Runtime library */
  180. // #define RT_USING_NOLIBC
  181. // #define RT_USING_NEWLIB
  182. /* SECTION: Console options */
  183. #define RT_USING_CONSOLE
  184. /* the buffer size of console*/
  185. #define RT_CONSOLEBUF_SIZE (128)
  186. /* SECTION: finsh, a C-Express shell */
  187. #define RT_USING_FINSH
  188. /* Using symbol table */
  189. #define FINSH_USING_SYMTAB
  190. #define FINSH_USING_DESCRIPTION
  191. /* SECTION: Peripheral devices */
  192. #define EFM32_INTERFACE_ADC (0)
  193. #define EFM32_INTERFACE_IIC (1)
  194. #define EFM32_INTERFACE_SPI (2)
  195. #if (defined(EFM32_GXXX_DK) || defined(EFM32GG_DK3750))
  196. //#define EFM32_USING_ACCEL EFM32_INTERFACE_IIC /* Three axis accelerometer */
  197. //#define EFM32_USING_SFLASH /* SPI Flash */
  198. #define EFM32_USING_SPISD /* MicroSD card */
  199. //#define EFM32_USING_ETHERNET /* Ethernet controller */
  200. #define EFM32_USING_LCD /* TFT LCD */
  201. #define EFM32_USING_KEYS /* Keys and joystick */
  202. #endif
  203. #if defined(EFM32_USING_ACCEL)
  204. #if (EFM32_USING_ACCEL == EFM32_INTERFACE_ADC)
  205. #define ACCEL_USING_DEVICE_NAME RT_ADC0_NAME
  206. #define ACCEL_USING_DMA (0x3UL) /* For multiple channels scan mode */
  207. #elif (EFM32_USING_ACCEL == EFM32_INTERFACE_IIC)
  208. #define ACCEL_USING_DEVICE_NAME RT_IIC0_NAME
  209. #endif
  210. #endif
  211. #if defined(EFM32_USING_SFLASH)
  212. #define SFLASH_USING_DEVICE_NAME RT_USART0_NAME
  213. #endif
  214. #if defined(EFM32_USING_SPISD)
  215. #define SPISD_USING_DEVICE_NAME RT_USART0_NAME
  216. #define SPISD_DEVICE_NAME "spiSd"
  217. #endif
  218. #if defined(EFM32_USING_ETHERNET)
  219. #if defined(EFM32_GXXX_DK)
  220. #define ETH_USING_DEVICE_NAME RT_USART2_NAME
  221. #elif defined(EFM32GG_DK3750)
  222. #define ETH_USING_DEVICE_NAME RT_USART1_NAME
  223. #endif
  224. #define ETH_DEVICE_NAME "spiEth"
  225. #define ETH_ADDR_DEFAULT {0x00, 0x01, 0x02, 0x03, 0x04, 0x05}
  226. #endif
  227. /* SECTION: device filesystem */
  228. #if (defined(RT_USING_NEWLIB) || defined(EFM32_USING_SPISD))
  229. #define RT_USING_DFS
  230. /* the max number of mounted filesystem */
  231. #define DFS_FILESYSTEMS_MAX (2)
  232. /* the max number of opened files */
  233. #define DFS_FD_MAX (4)
  234. /* the max number of cached sector */
  235. #define DFS_CACHE_MAX_NUM (4)
  236. #endif /* defined(RT_USING_NEWLIB) || defined(EFM32_USING_SPISD) */
  237. #if defined(EFM32_USING_SPISD)
  238. #define RT_USING_DFS_ELMFAT
  239. #define DFS_ELMFAT_INTERFACE_EFM
  240. #endif /* defined(EFM32_USING_SPISD) */
  241. #if defined(RT_USING_NEWLIB)
  242. #define RT_USING_DFS_DEVFS
  243. #endif /* defined(RT_USING_DFS_DEVFS) */
  244. /* SECTION: lwip, a lighwight TCP/IP protocol stack */
  245. #if defined(EFM32_USING_ETHERNET)
  246. #define EFM32_USING_ETH_HTTPD
  247. //#define EFM32_USING_ETH_UTILS
  248. //#define hostName "onelife.dyndns.org"
  249. //#define userPwdB64 "dXNlcjpwYXNzd2Q="
  250. //#define RT_USING_LWIP
  251. //#define RT_USING_NETUTILS
  252. //#define RT_LWIP_DHCP
  253. /* LwIP uses RT-Thread Memory Management */
  254. #define RT_LWIP_USING_RT_MEM
  255. /* Enable ICMP protocol*/
  256. #define RT_LWIP_ICMP
  257. /* Enable ICMP protocol*/
  258. //#define RT_LWIP_IGMP
  259. /* Enable UDP protocol*/
  260. #define RT_LWIP_UDP
  261. /* Enable TCP protocol*/
  262. #define RT_LWIP_TCP
  263. /* Enable DHCP */
  264. //#define RT_LWIP_DHCP
  265. /* Enable DNS */
  266. //#define RT_LWIP_DNS
  267. /* the number of simulatenously active TCP connections*/
  268. #define RT_LWIP_TCP_PCB_NUM (2)
  269. /* ip address of target*/
  270. #define RT_LWIP_IPADDR0 (192)
  271. #define RT_LWIP_IPADDR1 (168)
  272. #define RT_LWIP_IPADDR2 (1)
  273. #define RT_LWIP_IPADDR3 (118)
  274. /* gateway address of target*/
  275. #define RT_LWIP_GWADDR0 (192)
  276. #define RT_LWIP_GWADDR1 (168)
  277. #define RT_LWIP_GWADDR2 (1)
  278. #define RT_LWIP_GWADDR3 (1)
  279. /* mask address of target*/
  280. #define RT_LWIP_MSKADDR0 (255)
  281. #define RT_LWIP_MSKADDR1 (255)
  282. #define RT_LWIP_MSKADDR2 (255)
  283. #define RT_LWIP_MSKADDR3 (0)
  284. /* tcp thread options */
  285. #define RT_LWIP_TCPTHREAD_PRIORITY (12)
  286. #define RT_LWIP_TCPTHREAD_MBOX_SIZE (4)
  287. #define RT_LWIP_TCPTHREAD_STACKSIZE (1024)
  288. /* ethernet if thread options */
  289. #define RT_LWIP_ETHTHREAD_PRIORITY (15)
  290. #define RT_LWIP_ETHTHREAD_MBOX_SIZE (4)
  291. #define RT_LWIP_ETHTHREAD_STACKSIZE (512)
  292. #endif /* defined(EFM32_USING_ETHERNET) */
  293. /* SECTION: RTGUI support */
  294. #if defined(EFM32_USING_LCD)
  295. #define LCD_USING_DEVICE_NAME RT_USART1_NAME
  296. #define LCD_DEVICE_NAME "lcd"
  297. /* using RTGUI support */
  298. #define RT_USING_RTGUI
  299. /* name length of RTGUI object */
  300. #define RTGUI_NAME_MAX (16)
  301. /* support 16 weight font */
  302. #define RTGUI_USING_FONT16
  303. /* support 12 weight font */
  304. #define RTGUI_USING_FONT12
  305. /* support Chinese font */
  306. #define RTGUI_USING_FONTHZ
  307. /* use DFS as file interface */
  308. #define RTGUI_USING_DFS_FILERW
  309. /* use font file as Chinese font */
  310. /* #define RTGUI_USING_HZ_FILE */
  311. /* use Chinese bitmap font */
  312. #define RTGUI_USING_HZ_BMP
  313. /* use small size in RTGUI */
  314. /* #define RTGUI_USING_SMALL_SIZE */
  315. /* use mouse cursor */
  316. #define RTGUI_USING_MOUSE_CURSOR
  317. /* RTGUI image options */
  318. #define RTGUI_IMAGE_XPM
  319. //#define RTGUI_IMAGE_JPEG
  320. #define RTGUI_IMAGE_TJPGD
  321. //#define RTGUI_IMAGE_PNG
  322. #define RTGUI_IMAGE_BMP
  323. #endif /* defined(EFM32_USING_LCD) */
  324. /* Exported functions ------------------------------------------------------- */
  325. #endif /* __RTTHREAD_CFG_H__ */