rtconfig.h 12 KB

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