rtconfig.h 11 KB

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