lpc176x.nut 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. --
  2. -- Copyright (C) 2011 Ole Reinhardt, Thermotemp (ole.reinhardt@embedded-it.de)
  3. --
  4. -- Redistribution and use in source and binary forms, with or without
  5. -- modification, are permitted provided that the following conditions
  6. -- are met:
  7. --
  8. -- 1. Redistributions of source code must retain the above copyright
  9. -- notice, this list of conditions and the following disclaimer.
  10. -- 2. Redistributions in binary form must reproduce the above copyright
  11. -- notice, this list of conditions and the following disclaimer in the
  12. -- documentation and/or other materials provided with the distribution.
  13. -- 3. Neither the name of the copyright holders nor the names of
  14. -- contributors may be used to endorse or promote products derived
  15. -- from this software without specific prior written permission.
  16. --
  17. -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. -- ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. -- FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  21. -- COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. -- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. -- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  24. -- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  25. -- AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. -- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  27. -- THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. -- SUCH DAMAGE.
  29. --
  30. -- For additional information see http://www.ethernut.de/
  31. --
  32. -- ARM CortexM3 Architecture
  33. -- NXP LPC176x Family Devices
  34. --
  35. -- $Id: lpc176x.nut $
  36. --
  37. --
  38. lpc176x_device_class = { "LPC1758", "LPC1768" }
  39. --
  40. -- ********************************************************************************
  41. -- LCP176x Family
  42. -- ********************************************************************************
  43. --
  44. nutarch_cm3_lpc176x =
  45. {
  46. --
  47. -- LPC17xx MCU Classes
  48. --
  49. {
  50. name = "nutarch_cm3_lpc176x_class",
  51. brief = "LPC176x Device Classes",
  52. requires = { "HW_MCU_LPC176x" },
  53. options =
  54. {
  55. {
  56. macro = "MCU_LPC1758",
  57. brief = "LPC1758",
  58. description = "NXP LPC1758",
  59. flavor = "booldata",
  60. exclusivity = lpc176x_device_class,
  61. provides =
  62. {
  63. "HW_MCU_LPC1758",
  64. "HW_UART0_LPC17xx",
  65. "HW_UART1_LPC17xx",
  66. "HW_UART2_LPC17xx",
  67. "HW_UART3_LPC17xx",
  68. },
  69. file = "include/cfg/arch.h"
  70. },
  71. {
  72. macro = "MCU_LPC1768",
  73. brief = "LPC1768",
  74. description = "NXP LPC1768",
  75. flavor = "booldata",
  76. exclusivity = lpc176x_device_class,
  77. provides =
  78. {
  79. "HW_MCU_LPC1768",
  80. "HW_UART0_LPC17xx",
  81. "HW_UART1_LPC17xx",
  82. "HW_UART2_LPC17xx",
  83. "HW_UART3_LPC17xx",
  84. },
  85. file = "include/cfg/arch.h"
  86. }
  87. }
  88. },
  89. --
  90. -- LPC176x PLL Configuration
  91. --
  92. {
  93. name = "nutarch_cm3_lpc176x_pll",
  94. brief = "LPC175x / LPC176x PLL Setup",
  95. description = "PLL configuration. Currently it is hard coded. May be user configurable later.\n",
  96. requires = { "HW_MCU_LPC176x", "TOOL_CC_CM3", "TOOL_GCC" },
  97. sources =
  98. {
  99. "cm3/dev/nxp/system_lpc176x.c",
  100. "cm3/dev/nxp/lpc176x_clk.c"
  101. }
  102. },
  103. --
  104. -- LPC176x Device Drivers
  105. --
  106. --
  107. -- LPC176x GPIO Interface
  108. --
  109. {
  110. name = "nutarch_cm3_lpc176x_gpio",
  111. brief = "LPC175x / LPC176x GPIO",
  112. description = "Generic port I/O API.",
  113. requires = { "HW_GPIO_LPC176x" },
  114. provides = { "HW_GPIO" },
  115. sources =
  116. {
  117. "cm3/dev/nxp/lpc176x_gpio.c",
  118. "cm3/dev/nxp/lpc17xx_gpioirq.c",
  119. }
  120. },
  121. --
  122. -- LPC176x DEBUG UART Interface
  123. --
  124. {
  125. name = "nutarch_cm3_lpc176x_debug",
  126. brief = "LPC176x Debug UART Driver",
  127. description = "Polling UART driver, which can be used from interrupt context\n",
  128. requires = { "HW_UART0_LPC17xx", "HW_UART1_LPC17xx", "HW_UART2_LPC17xx", "HW_UART3_LPC17xx" },
  129. provides = { "DEV_UART", "DEV_FILE", "DEV_WRITE" },
  130. sources =
  131. {
  132. "cm3/dev/nxp/lpc176x_debug0.c",
  133. "cm3/dev/nxp/lpc176x_debug1.c",
  134. "cm3/dev/nxp/lpc176x_debug2.c",
  135. "cm3/dev/nxp/lpc176x_debug3.c"
  136. },
  137. options =
  138. {
  139. {
  140. macro = "DEBUG_INIT_BAUDRATE",
  141. brief = "Initial Baudrate",
  142. description = "Initial baudrate the debug UART is set to.",
  143. type = "integer",
  144. default = 115200,
  145. file = "include/cfg/uart.h"
  146. }
  147. }
  148. },
  149. --
  150. -- LPC176x USART0 Interface
  151. --
  152. {
  153. name = "nutarch_cm3_lpc176x_usart0",
  154. brief = "LPC175x / LPC176x USART0 Driver",
  155. description = "Hardware specific USART driver. Implements hardware "..
  156. "functions for the generic driver framework.",
  157. requires = { "HW_UART0_LPC17xx", "DEV_IRQ_LPC17xx", "NUT_EVENT", "CRT_HEAPMEM" },
  158. provides =
  159. {
  160. "DEV_UART",
  161. "DEV_UART_LPC17xx",
  162. "DEV_UART_SPECIFIC"
  163. },
  164. sources =
  165. {
  166. "cm3/dev/nxp/lpc176x_usart0.c",
  167. },
  168. options =
  169. {
  170. {
  171. macro = "USART0_INIT_BAUDRATE",
  172. brief = "Initial Baudrate",
  173. description = "Initial baudrate the Port is set to.",
  174. type = "integer",
  175. default = 115200,
  176. file = "include/cfg/uart.h"
  177. },
  178. {
  179. macro = "USART0_SUPPORT_IRQ",
  180. brief = "Use Interrupt Transfer",
  181. description = "When selected, the driver will use interrupt for transfers. ",
  182. flavor = "booldata",
  183. provides = { "USART0_SUPPORT_IRQ" },
  184. file = "include/cfg/uart.h"
  185. },
  186. {
  187. macro = "USART0_SUPPORT_DMA",
  188. brief = "Support DMA Blocktransfer",
  189. description = "When selected, the driver can use DMA for block transfers.\n"..
  190. "Block transfers can be enabled or disabled by calling _ioctl "..
  191. "with the following parameters:\n"..
  192. "UART_SETBLOCKREAD\nUART_SETBLOCKWRITE",
  193. flavor = "booldata",
  194. requires = { "USART0_SUPPORT_IRQ" },
  195. file = "include/cfg/uart.h"
  196. },
  197. {
  198. macro = "USART0_MODE_IRDA",
  199. brief = "Set To IrDA Mode",
  200. description = "When selected, the USART will run in IrDA mode.",
  201. flavor = "booldata",
  202. file = "include/cfg/uart.h"
  203. },
  204. {
  205. macro = "USART0_XONXOFF_CONTROL",
  206. brief = "XON/XOFF Protocol",
  207. description = "When selected, the driver will use software XON/XOFF protocol.",
  208. flavor = "booldata",
  209. file = "include/cfg/uart.h"
  210. }
  211. }
  212. },
  213. --
  214. -- LPC17xx USART1 Interface
  215. --
  216. {
  217. name = "nutarch_cm3_lpc176x_usart1",
  218. brief = "LPC175x / LPC176x USART1 Driver",
  219. description = "Hardware specific USART driver. Implements hardware "..
  220. "functions for the generic driver framework.",
  221. requires = { "HW_UART1_LPC17xx", "DEV_IRQ_LPC17xx", "NUT_EVENT", "CRT_HEAPMEM" },
  222. provides =
  223. {
  224. "DEV_UART",
  225. "DEV_UART_LPC17xx",
  226. "DEV_UART_SPECIFIC",
  227. "DEV_UART1_GPIO_RTS",
  228. "DEV_UART1_GPIO_CTS"
  229. },
  230. sources = { "cm3/dev/nxp/lpc176x_usart1.c",
  231. },
  232. options =
  233. {
  234. {
  235. macro = "USART1_INIT_BAUDRATE",
  236. brief = "Initial Baudrate",
  237. description = "Initial baudrate the Port is set to.",
  238. type = "integer",
  239. default = 115200,
  240. file = "include/cfg/uart.h"
  241. },
  242. {
  243. macro = "USART1_SUPPORT_IRQ",
  244. brief = "Use Interrupt Transfer",
  245. description = "When selected, the driver will use interrupt for transfers. ",
  246. flavor = "booldata",
  247. provides = { "USART1_SUPPORT_IRQ" },
  248. file = "include/cfg/uart.h"
  249. },
  250. {
  251. macro = "USART1_SUPPORT_DMA",
  252. brief = "Support DMA Blocktransfer",
  253. description = "When selected, the driver can use DMA for block transfers.\n"..
  254. "Block transfers can be enabled or disabled by calling _ioctl "..
  255. "with the following parameters:\n"..
  256. "UART_SETBLOCKREAD\nUART_SETBLOCKWRITE",
  257. flavor = "booldata",
  258. requires = { "USART1_SUPPORT_IRQ" },
  259. file = "include/cfg/uart.h"
  260. },
  261. {
  262. macro = "USART1_XONXOFF_CONTROL",
  263. brief = "XON/XOFF Protocol",
  264. description = "When selected, the driver will use software XON/XOFF protocol.",
  265. flavor = "booldata",
  266. file = "include/cfg/uart.h"
  267. }
  268. }
  269. },
  270. --
  271. -- LPC17xx USART2 Interface
  272. --
  273. {
  274. name = "nutarch_cm3_lpc176x_usart2",
  275. brief = "LPC175x / LPC176x USART2 Driver",
  276. description = "Hardware specific USART driver. Implements hardware "..
  277. "functions for the generic driver framework.",
  278. requires = { "HW_UART2_LPC17xx", "DEV_IRQ_LPC17xx", "NUT_EVENT", "CRT_HEAPMEM" },
  279. provides =
  280. {
  281. "DEV_UART",
  282. "DEV_UART_LPC17xx",
  283. "DEV_UART_SPECIFIC"
  284. },
  285. sources = { "cm3/dev/nxp/lpc176x_usart2.c",
  286. },
  287. options =
  288. {
  289. {
  290. macro = "USART2_INIT_BAUDRATE",
  291. brief = "Initial Baudrate",
  292. description = "Initial baudrate the Port is set to.",
  293. type = "integer",
  294. default = 115200,
  295. file = "include/cfg/uart.h"
  296. },
  297. {
  298. macro = "USART2_SUPPORT_IRQ",
  299. brief = "Use Interrupt Transfer",
  300. description = "When selected, the driver will use interrupt for transfers. ",
  301. flavor = "booldata",
  302. provides = { "USART2_SUPPORT_IRQ" },
  303. file = "include/cfg/uart.h"
  304. },
  305. {
  306. macro = "USART2_SUPPORT_DMA",
  307. brief = "Support DMA Blocktransfer",
  308. description = "When selected, the driver can use DMA for block transfers.\n"..
  309. "Block transfers can be enabled or disabled by calling _ioctl "..
  310. "with the following parameters:\n"..
  311. "UART_SETBLOCKREAD\nUART_SETBLOCKWRITE",
  312. flavor = "booldata",
  313. requires = { "USART2_SUPPORT_IRQ" },
  314. file = "include/cfg/uart.h"
  315. },
  316. {
  317. macro = "USART2_XONXOFF_CONTROL",
  318. brief = "XON/XOFF Protocol",
  319. description = "When selected, the driver will use software XON/XOFF protocol.",
  320. flavor = "booldata",
  321. file = "include/cfg/uart.h"
  322. }
  323. }
  324. },
  325. --
  326. -- LPC17xx USART3 Interface
  327. --
  328. {
  329. name = "nutarch_cm3_lpc176x_usart3",
  330. brief = "LPC175x / LPC176x USART3 Driver",
  331. description = "Hardware specific USART driver. Implements hardware "..
  332. "functions for the generic driver framework.",
  333. requires = { "HW_UART3_LPC17xx", "DEV_IRQ_LPC17xx", "NUT_EVENT", "CRT_HEAPMEM" },
  334. provides =
  335. {
  336. "DEV_UART",
  337. "DEV_UART_LPC17xx",
  338. "DEV_UART_SPECIFIC"
  339. },
  340. sources = { "cm3/dev/nxp/lpc176x_usart3.c",
  341. },
  342. options =
  343. {
  344. {
  345. macro = "USART3_INIT_BAUDRATE",
  346. brief = "Initial Baudrate",
  347. description = "Initial baudrate the Port is set to.",
  348. type = "integer",
  349. default = 115200,
  350. file = "include/cfg/uart.h"
  351. },
  352. {
  353. macro = "USART3_SUPPORT_IRQ",
  354. brief = "Use Interrupt Transfer",
  355. description = "When selected, the driver will use interrupt for transfers. ",
  356. flavor = "booldata",
  357. provides = { "USART3_SUPPORT_IRQ" },
  358. file = "include/cfg/uart.h"
  359. },
  360. {
  361. macro = "USART3_SUPPORT_DMA",
  362. brief = "Support DMA Blocktransfer",
  363. description = "When selected, the driver can use DMA for block transfers.\n"..
  364. "Block transfers can be enabled or disabled by calling _ioctl "..
  365. "with the following parameters:\n"..
  366. "UART_SETBLOCKREAD\nUART_SETBLOCKWRITE",
  367. flavor = "booldata",
  368. requires = { "USART3_SUPPORT_IRQ" },
  369. file = "include/cfg/uart.h"
  370. },
  371. {
  372. macro = "USART3_XONXOFF_CONTROL",
  373. brief = "XON/XOFF Protocol",
  374. description = "When selected, the driver will use software XON/XOFF protocol.",
  375. flavor = "booldata",
  376. file = "include/cfg/uart.h"
  377. }
  378. }
  379. },
  380. --
  381. -- LPC176x SPI
  382. --
  383. {
  384. name = "nutarch_cm3_lpc176x_spi",
  385. brief = "SPI Bus (LPC176x)",
  386. description = "LPC176x SPI driver, currently implemented as polling driver \n"..
  387. "without interrupt or dma usage\n",
  388. requires = { "HW_SPI_LPC17xx" },
  389. provides = { "SPIBUS_CONTROLLER" },
  390. sources = { "cm3/dev/nxp/lpc176x_spi.c" },
  391. },
  392. }