rtconfig.h 11 KB

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