lpc177x_8x.nut 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. --
  2. -- Copyright (C) 2011 Ole Reinhardt <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 LPC17xx Family Devices
  34. --
  35. -- $Id: lpc177x_8x.nut $
  36. --
  37. --
  38. lpc177x_8x_device_class = { "LPC1778", "LPC1788", "LPC4078", "LPC4088" }
  39. --
  40. -- ********************************************************************************
  41. -- LCP17xx Family
  42. -- ********************************************************************************
  43. --
  44. nutarch_cm3_lpc177x_8x_lpc407x_8x=
  45. {
  46. --
  47. -- LPC177x_8x MCU Classes
  48. --
  49. {
  50. name = "nutarch_cm3_lpc177x_8x_class",
  51. brief = "LPC177x_8x / LPC407x_8x Device Classes",
  52. requires = { "HW_MCU_LPC177x_8x_LPC407x_8x" },
  53. options =
  54. {
  55. {
  56. macro = "MCU_LPC1778",
  57. brief = "LPC1778",
  58. description = "NXP LPC1778",
  59. flavor = "booldata",
  60. exclusivity = lpc177x_8x_device_class,
  61. provides =
  62. {
  63. "HW_MCU_LPC1778",
  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_LPC1788",
  73. brief = "LPC1788",
  74. description = "NXP LPC1788",
  75. flavor = "booldata",
  76. exclusivity = lpc177x_8x_device_class,
  77. provides =
  78. {
  79. "HW_MCU_LPC1788",
  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. macro = "MCU_LPC4078",
  89. brief = "LPC4078",
  90. description = "NXP LPC4078",
  91. flavor = "booldata",
  92. exclusivity = lpc177x_8x_device_class,
  93. provides =
  94. {
  95. "HW_MCU_LPC4088",
  96. "HW_UART0_LPC17xx",
  97. "HW_UART1_LPC17xx",
  98. "HW_UART2_LPC17xx",
  99. "HW_UART3_LPC17xx",
  100. },
  101. file = "include/cfg/arch.h"
  102. },
  103. {
  104. macro = "MCU_LPC4088",
  105. brief = "LPC4088",
  106. description = "NXP LPC4088",
  107. flavor = "booldata",
  108. exclusivity = lpc177x_8x_device_class,
  109. provides =
  110. {
  111. "HW_MCU_LPC4088",
  112. "HW_UART0_LPC17xx",
  113. "HW_UART1_LPC17xx",
  114. "HW_UART2_LPC17xx",
  115. "HW_UART3_LPC17xx",
  116. },
  117. file = "include/cfg/arch.h"
  118. }
  119. }
  120. },
  121. --
  122. -- LPC177x_8x External Memory Controller
  123. --
  124. {
  125. name = "nutarch_cm3_lpc177x_8x_emc",
  126. brief = "LPC177x_8x External Memory Controller",
  127. description = "Routines for setup and programming LPC177x_8x series external memory bus and SDRAM support.\n",
  128. requires = { "HW_EMC_LPC177x_8x" },
  129. sources = { "cm3/dev/nxp/lpc177x_8x_emc.c" }
  130. },
  131. --
  132. -- LPC177x_8x EEPROM Memory
  133. --
  134. {
  135. name = "nutarch_cm3_lpc177x_8x_eeprom",
  136. brief = "LPC177x_8x EEPROM Access",
  137. requires = { "HW_EEPROM_LPC177x_8x" },
  138. provides = { "DEV_NVMEM" },
  139. sources = { "cm3/dev/nxp/lpc177x_8x_eeprom.c" }
  140. },
  141. --
  142. -- LPC177x_8x PLL Configuration
  143. --
  144. {
  145. name = "nutarch_cm3_lpc177x_8x_pll",
  146. brief = "LPC177x_8x PLL Setup",
  147. description = "PLL configuration. Currently it is hard coded. May be user configurable later.\n",
  148. requires = { "HW_MCU_LPC177x_8x", "TOOL_CC_CM3", "TOOL_GCC" },
  149. sources =
  150. {
  151. "cm3/dev/nxp/system_lpc177x_8x.c",
  152. "cm3/dev/nxp/lpc177x_8x_clk.c"
  153. }
  154. },
  155. --
  156. -- LPC407x_8x PLL Configuration
  157. --
  158. {
  159. name = "nutarch_cm3_lpc407x_8x_pll",
  160. brief = "LPC407x_8x PLL Setup",
  161. description = "PLL configuration. Currently it is hard coded. May be user configurable later.\n",
  162. requires = { "HW_MCU_LPC407x_8x", "TOOL_CC_CM3", "TOOL_GCC" },
  163. sources =
  164. {
  165. "cm3/dev/nxp/system_lpc407x_8x.c",
  166. "cm3/dev/nxp/lpc407x_8x_clk.c"
  167. }
  168. },
  169. --
  170. -- LPC177x_8x Device Drivers
  171. --
  172. --
  173. -- LPC177x_8x GPIO Interface
  174. --
  175. {
  176. name = "nutarch_cm3_lpc177x_8x_gpio",
  177. brief = "LPC177x_8x GPIO",
  178. description = "Generic port I/O API.",
  179. requires = { "HW_GPIO_LPC177x_8x" },
  180. provides = { "HW_GPIO" },
  181. sources =
  182. {
  183. "cm3/dev/nxp/lpc177x_8x_gpio.c",
  184. "cm3/dev/nxp/lpc17xx_gpioirq.c",
  185. }
  186. },
  187. --
  188. -- LPC177x_8x DEBUG UART Interface
  189. --
  190. {
  191. name = "nutarch_cm3_lpc177x_8x_debug",
  192. brief = "LPC177x_8x Debug UART Driver",
  193. description = "Polling UART driver, which can be used from interrupt context\n",
  194. requires = { "HW_UART0_LPC17xx", "HW_UART1_LPC17xx", "HW_UART2_LPC17xx", "HW_UART3_LPC17xx" },
  195. provides = { "DEV_UART", "DEV_FILE", "DEV_WRITE" },
  196. sources =
  197. {
  198. "cm3/dev/nxp/lpc177x_8x_debug0.c",
  199. "cm3/dev/nxp/lpc177x_8x_debug1.c",
  200. "cm3/dev/nxp/lpc177x_8x_debug2.c",
  201. "cm3/dev/nxp/lpc177x_8x_debug3.c"
  202. },
  203. options =
  204. {
  205. {
  206. macro = "DEBUG_INIT_BAUDRATE",
  207. brief = "Initial Baudrate",
  208. description = "Initial baudrate the debug UART is set to.",
  209. type = "integer",
  210. default = 115200,
  211. file = "include/cfg/uart.h"
  212. }
  213. }
  214. },
  215. --
  216. -- LPC177x_8x USART0 Interface
  217. --
  218. {
  219. name = "nutarch_cm3_lpc177x_8x_usart0",
  220. brief = "LPC177x_8x USART0 Driver",
  221. description = "Hardware specific USART driver. Implements hardware "..
  222. "functions for the generic driver framework.",
  223. requires = { "HW_UART0_LPC17xx", "DEV_IRQ_LPC17xx", "NUT_EVENT", "CRT_HEAPMEM" },
  224. provides =
  225. {
  226. "DEV_UART",
  227. "DEV_UART_LPC17xx",
  228. "DEV_UART_SPECIFIC",
  229. "DEV_UART0_GPIO_RTS",
  230. "DEV_UART0_GPIO_CTS"
  231. },
  232. sources =
  233. {
  234. "cm3/dev/nxp/lpc177x_8x_usart0.c",
  235. },
  236. options =
  237. {
  238. {
  239. macro = "USART0_INIT_BAUDRATE",
  240. brief = "Initial Baudrate",
  241. description = "Initial baudrate the Port is set to.",
  242. type = "integer",
  243. default = 115200,
  244. file = "include/cfg/uart.h"
  245. },
  246. {
  247. macro = "USART0_SUPPORT_IRQ",
  248. brief = "Use Interrupt Transfer",
  249. description = "When selected, the driver will use interrupt for transfers. ",
  250. flavor = "booldata",
  251. provides = { "USART0_SUPPORT_IRQ" },
  252. file = "include/cfg/uart.h"
  253. },
  254. {
  255. macro = "USART0_SUPPORT_DMA",
  256. brief = "Support DMA Blocktransfer",
  257. description = "When selected, the driver can use DMA for block transfers.\n"..
  258. "Block transfers can be enabled or disabled by calling _ioctl "..
  259. "with the following parameters:\n"..
  260. "UART_SETBLOCKREAD\nUART_SETBLOCKWRITE",
  261. flavor = "booldata",
  262. requires = { "USART0_SUPPORT_IRQ" },
  263. file = "include/cfg/uart.h"
  264. },
  265. {
  266. macro = "USART0_XONXOFF_CONTROL",
  267. brief = "XON/XOFF Protocol",
  268. description = "When selected, the driver will use software XON/XOFF protocol.",
  269. flavor = "booldata",
  270. file = "include/cfg/uart.h"
  271. }
  272. }
  273. },
  274. --
  275. -- LPC177x_8x USART1 Interface
  276. --
  277. {
  278. name = "nutarch_cm3_lpc177x_8x_usart1",
  279. brief = "LPC177x_8x USART1 Driver",
  280. description = "Hardware specific USART driver. Implements hardware "..
  281. "functions for the generic driver framework.",
  282. requires = { "HW_UART1_LPC17xx", "DEV_IRQ_LPC17xx", "NUT_EVENT", "CRT_HEAPMEM" },
  283. provides =
  284. {
  285. "DEV_UART",
  286. "DEV_UART_LPC17xx",
  287. "DEV_UART_SPECIFIC",
  288. "DEV_UART1_GPIO_RTS",
  289. "DEV_UART1_GPIO_CTS"
  290. },
  291. sources =
  292. {
  293. "cm3/dev/nxp/lpc177x_8x_usart1.c",
  294. },
  295. options =
  296. {
  297. {
  298. macro = "USART1_INIT_BAUDRATE",
  299. brief = "Initial Baudrate",
  300. description = "Initial baudrate the Port is set to.",
  301. type = "integer",
  302. default = 115200,
  303. file = "include/cfg/uart.h"
  304. },
  305. {
  306. macro = "USART1_SUPPORT_IRQ",
  307. brief = "Use Interrupt Transfer",
  308. description = "When selected, the driver will use interrupt for transfers. ",
  309. flavor = "booldata",
  310. provides = { "USART1_SUPPORT_IRQ" },
  311. file = "include/cfg/uart.h"
  312. },
  313. {
  314. macro = "USART1_SUPPORT_DMA",
  315. brief = "Support DMA Blocktransfer",
  316. description = "When selected, the driver can use DMA for block transfers.\n"..
  317. "Block transfers can be enabled or disabled by calling _ioctl "..
  318. "with the following parameters:\n"..
  319. "UART_SETBLOCKREAD\nUART_SETBLOCKWRITE",
  320. flavor = "booldata",
  321. requires = { "USART1_SUPPORT_IRQ" },
  322. file = "include/cfg/uart.h"
  323. }
  324. }
  325. },
  326. --
  327. -- LPC177x_8x USART2 Interface
  328. --
  329. {
  330. name = "nutarch_cm3_lpc177x_8x_usart2",
  331. brief = "LPC177x_8x USART2 Driver",
  332. description = "Hardware specific USART driver. Implements hardware "..
  333. "functions for the generic driver framework.",
  334. requires = { "HW_UART2_LPC17xx", "DEV_IRQ_LPC17xx", "NUT_EVENT", "CRT_HEAPMEM" },
  335. provides =
  336. {
  337. "DEV_UART",
  338. "DEV_UART_LPC17xx",
  339. "DEV_UART_SPECIFIC",
  340. "DEV_UART2_GPIO_RTS",
  341. "DEV_UART2_GPIO_CTS"
  342. },
  343. sources =
  344. {
  345. "cm3/dev/nxp/lpc177x_8x_usart2.c",
  346. },
  347. options =
  348. {
  349. {
  350. macro = "USART2_INIT_BAUDRATE",
  351. brief = "Initial Baudrate",
  352. description = "Initial baudrate the Port is set to.",
  353. type = "integer",
  354. default = 115200,
  355. file = "include/cfg/uart.h"
  356. },
  357. {
  358. macro = "USART2_SUPPORT_IRQ",
  359. brief = "Use Interrupt Transfer",
  360. description = "When selected, the driver will use interrupt for transfers. ",
  361. flavor = "booldata",
  362. provides = { "USART2_SUPPORT_IRQ" },
  363. file = "include/cfg/uart.h"
  364. },
  365. {
  366. macro = "USART2_SUPPORT_DMA",
  367. brief = "Support DMA Blocktransfer",
  368. description = "When selected, the driver can use DMA for block transfers.\n"..
  369. "Block transfers can be enabled or disabled by calling _ioctl "..
  370. "with the following parameters:\n"..
  371. "UART_SETBLOCKREAD\nUART_SETBLOCKWRITE",
  372. flavor = "booldata",
  373. requires = { "USART2_SUPPORT_IRQ" },
  374. file = "include/cfg/uart.h"
  375. }
  376. }
  377. },
  378. --
  379. -- LPC177x_8x USART3 Interface
  380. --
  381. {
  382. name = "nutarch_cm3_lpc177x_8x_usart3",
  383. brief = "LPC177x_8x USART3 Driver",
  384. description = "Hardware specific USART driver. Implements hardware "..
  385. "functions for the generic driver framework.",
  386. requires = { "HW_UART3_LPC17xx", "DEV_IRQ_LPC17xx", "NUT_EVENT", "CRT_HEAPMEM" },
  387. provides =
  388. {
  389. "DEV_UART",
  390. "DEV_UART_LPC17xx",
  391. "DEV_UART_SPECIFIC",
  392. "DEV_UART3_GPIO_RTS",
  393. "DEV_UART3_GPIO_CTS"
  394. },
  395. sources =
  396. {
  397. "cm3/dev/nxp/lpc177x_8x_usart3.c",
  398. },
  399. options =
  400. {
  401. {
  402. macro = "USART3_INIT_BAUDRATE",
  403. brief = "Initial Baudrate",
  404. description = "Initial baudrate the Port is set to.",
  405. type = "integer",
  406. default = 115200,
  407. file = "include/cfg/uart.h"
  408. },
  409. {
  410. macro = "USART3_SUPPORT_IRQ",
  411. brief = "Use Interrupt Transfer",
  412. description = "When selected, the driver will use interrupt for transfers. ",
  413. flavor = "booldata",
  414. provides = { "USART3_SUPPORT_IRQ" },
  415. file = "include/cfg/uart.h"
  416. },
  417. {
  418. macro = "USART3_SUPPORT_DMA",
  419. brief = "Support DMA Blocktransfer",
  420. description = "When selected, the driver can use DMA for block transfers.\n"..
  421. "Block transfers can be enabled or disabled by calling _ioctl "..
  422. "with the following parameters:\n"..
  423. "UART_SETBLOCKREAD\nUART_SETBLOCKWRITE",
  424. flavor = "booldata",
  425. requires = { "USART3_SUPPORT_IRQ" },
  426. file = "include/cfg/uart.h"
  427. }
  428. }
  429. },
  430. --
  431. -- LPC177x_8x MCI SDIO Interface
  432. --
  433. {
  434. name = "nutarch_cm3_lpc177x_8x_mci",
  435. brief = "LPC177x_8x MCI (SDIO) MMC driver",
  436. description = "Low level MMC interface for LPC177x_8x",
  437. requires = { "HW_MCI_LPC177x_8x" },
  438. provides = { "DEV_MMCLL" },
  439. sources =
  440. {
  441. "cm3/dev/nxp/lpc177x_8x_mmcard_sdio.c",
  442. "cm3/dev/nxp/lpc177x_8x_mci.c",
  443. },
  444. options =
  445. {
  446. {
  447. macro = "BRD_MCI_POWERED_ACTIVE_LEVEL",
  448. brief = "MCI power active level",
  449. description = "MCI power active level -> set to (0) or (1) depending your board HW.",
  450. type = "enumerated",
  451. choices = { "1", "0" },
  452. file = "include/cfg/mmci.h"
  453. },
  454. },
  455. },
  456. --
  457. -- LPC17xx I2C Controller 0, 1, 2
  458. --
  459. {
  460. name = "nutarch_cm3_lpc17xx_i2c0",
  461. brief = "LPC17xx I2C bus 0 API",
  462. description = "Routines for setup and programming LPC17xx series I2C controller 0.\n",
  463. requires = { "HW_I2C_LPC17xx", },
  464. -- sources = { "cm3/dev/nxp/lpc17xx_i2cbus0.c"}
  465. },
  466. {
  467. name = "nutarch_cm3_lpc17xx_i2c1",
  468. brief = "LPC17xx I2C bus 1 API",
  469. description = "Routines for setup and programming LPC17xx series I2C controller 1.\n",
  470. requires = { "HW_I2C_LPC17xx", },
  471. -- sources = { "cm3/dev/nxp/lpc17xx_i2cbus1.c"}
  472. },
  473. {
  474. name = "nutarch_cm3_lpc17xx_i2c2",
  475. brief = "LPC17xx I2C bus 2 API",
  476. description = "Routines for setup and programming LPC17xx series I2C controller 2.\n",
  477. requires = { "HW_I2C_LPC17xx", },
  478. -- sources = { "cm3/dev/nxp/lpc17xx_i2cbus2.c"}
  479. },
  480. }