1
0

rtconfig.h 12 KB

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