<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-05-19)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-05-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
* Makefile.am, preinstall.am: Install new header files.
* include/bsp.h, include/emc.h, include/lpc32xx.h, misc/emc.c: Update
for API changes.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog.diff?r1=text&tr1=1.29&r2=text&tr2=1.30&diff_format=h">M</a></td><td width='1%'>1.30</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am.diff?r1=text&tr1=1.9&r2=text&tr2=1.10&diff_format=h">M</a></td><td width='1%'>1.10</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/include/bsp.h.diff?r1=text&tr1=1.8&r2=text&tr2=1.9&diff_format=h">M</a></td><td width='1%'>1.9</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/include/bsp.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/include/emc.h.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/include/emc.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/include/lpc32xx.h.diff?r1=text&tr1=1.12&r2=text&tr2=1.13&diff_format=h">M</a></td><td width='1%'>1.13</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/include/lpc32xx.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/misc/emc.c.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/misc/emc.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc32xx/preinstall.am.diff?r1=text&tr1=1.8&r2=text&tr2=1.9&diff_format=h">M</a></td><td width='1%'>1.9</td><td width='100%'>c/src/lib/libbsp/arm/lpc32xx/preinstall.am</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog:1.29 rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog:1.30
--- rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog:1.29 Mon Mar 28 04:00:00 2011
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/ChangeLog Thu May 19 07:11:35 2011
</font><font color='#997700'>@@ -1,3 +1,9 @@
</font><font color='#000088'>+2011-05-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * Makefile.am, preinstall.am: Install new header files.
+ * include/bsp.h, include/emc.h, include/lpc32xx.h, misc/emc.c: Update
+ for API changes.
+
</font> 2011-03-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
* configure.ac, include/bspopts.h.in: New BSP option
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am:1.9 rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am:1.10
--- rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am:1.9 Fri Dec 3 03:29:07 2010
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/Makefile.am Thu May 19 07:11:35 2011
</font><font color='#997700'>@@ -39,6 +39,8 @@
</font> include_bsp_HEADERS += ../shared/lpc/include/lpc-timer.h
include_bsp_HEADERS += ../shared/lpc/include/lpc-dma.h
include_bsp_HEADERS += ../shared/lpc/include/lpc-i2s.h
<font color='#000088'>+include_bsp_HEADERS += ../shared/lpc/include/lpc-emc.h
+include_bsp_HEADERS += ../shared/lpc/include/lpc-lcd.h
</font> include_bsp_HEADERS += include/irq.h
include_bsp_HEADERS += include/mmu.h
include_bsp_HEADERS += include/lpc32xx.h
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/include/bsp.h:1.8 rtems/c/src/lib/libbsp/arm/lpc32xx/include/bsp.h:1.9
--- rtems/c/src/lib/libbsp/arm/lpc32xx/include/bsp.h:1.8 Mon Mar 28 04:00:00 2011
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/include/bsp.h Thu May 19 07:11:36 2011
</font><font color='#997700'>@@ -147,12 +147,12 @@
</font> #define LPC32XX_DO_STOP_GPDMA \
do { \
if ((LPC32XX_DMACLK_CTRL & 0x1) != 0) { \
<font color='#880000'>- if ((lpc32xx.dma.cfg & LPC_DMA_CFG_EN) != 0) { \
</font><font color='#000088'>+ if ((lpc32xx.dma.cfg & DMA_CFG_E) != 0) { \
</font> int i = 0; \
for (i = 0; i < 8; ++i) { \
lpc32xx.dma.channels [i].cfg = 0; \
} \
<font color='#880000'>- lpc32xx.dma.cfg &= ~LPC_DMA_CFG_EN; \
</font><font color='#000088'>+ lpc32xx.dma.cfg &= ~DMA_CFG_E; \
</font> } \
LPC32XX_DMACLK_CTRL = 0; \
} \
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/include/emc.h:1.2 rtems/c/src/lib/libbsp/arm/lpc32xx/include/emc.h:1.3
--- rtems/c/src/lib/libbsp/arm/lpc32xx/include/emc.h:1.2 Thu Oct 14 04:37:18 2010
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/include/emc.h Thu May 19 07:11:36 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2010
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2010-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -24,23 +25,20 @@
</font>
#include <rtems.h>
<font color='#880000'>-#include <bsp/lpc32xx.h>
</font><font color='#000088'>+#include <bsp/lpc-emc.h>
</font>
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/**
<font color='#880000'>- * @defgroup lpc32xx_emc EMC Support
- *
- * @ingroup lpc32xx
</font><font color='#000088'>+ * @addtogroup lpc_emc
</font> *
* @brief EMC Support
*
* @{
*/
<font color='#880000'>-
</font> /**
* @name SDRAM Clock Control Register (SDRAMCLK_CTRL)
*
<font color='#997700'>@@ -64,74 +62,6 @@
</font> /** @} */
/**
<font color='#880000'>- * @name EMC Control Register (EMCControl)
- *
- * @{
- */
-
-#define EMC_CTRL_EN BSP_BIT32(0)
-#define EMC_CTRL_LOW_POWER BSP_BIT32(2)
-
-/** @} */
-
-/**
- * @name EMC Dynamic Memory Control Register (EMCDynamicControl)
- *
- * @{
- */
-
-#define EMC_DYN_CTRL_CE BSP_BIT32(0)
-#define EMC_DYN_CTRL_CS BSP_BIT32(1)
-#define EMC_DYN_CTRL_SR BSP_BIT32(2)
-#define EMC_DYN_CTRL_SRMCC BSP_BIT32(3)
-#define EMC_DYN_CTRL_IMCC BSP_BIT32(4)
-#define EMC_DYN_CTRL_MCC BSP_BIT32(5)
-#define EMC_DYN_CTRL_I_MASK BSP_MSK32(7, 8)
-#define EMC_DYN_CTRL_I_NORMAL BSP_FLD32(0x0, 7, 8)
-#define EMC_DYN_CTRL_I_MODE BSP_FLD32(0x1, 7, 8)
-#define EMC_DYN_CTRL_I_PALL BSP_FLD32(0x2, 7, 8)
-#define EMC_DYN_CTRL_I_NOP BSP_FLD32(0x3, 7, 8)
-#define EMC_DYN_CTRL_DP BSP_BIT32(9)
-
-/** @} */
-
-/**
- * @name EMC Dynamic Memory Read Configuration Register (EMCDynamicReadConfig)
- *
- * @{
- */
-
-#define EMC_DYN_READ_CONFIG_SDR_STRAT(val) BSP_FLD32(val, 0, 1)
-#define EMC_DYN_READ_CONFIG_SDR_POL_POS BSP_BIT32(4)
-#define EMC_DYN_READ_CONFIG_DDR_STRAT(val) BSP_FLD32(val, 8, 9)
-#define EMC_DYN_READ_CONFIG_DDR_POL_POS BSP_BIT32(12)
-
-/** @} */
-
-/**
- * @name EMC Dynamic Memory Configuration N Register (EMCDynamicConfigN)
- *
- * @{
- */
-
-#define EMC_DYN_CFG_MD(val) BSP_FLD32(val, 0, 2)
-#define EMC_DYN_CFG_AM(val) BSP_FLD32(val, 7, 14)
-#define EMC_DYN_CFG_P(val) BSP_BIT32(20)
-
-/** @} */
-
-/**
- * @name EMC Dynamic Memory RAS and CAS Delay N Register (EMCDynamicRasCasN)
- *
- * @{
- */
-
-#define EMC_DYN_RAS(val) BSP_FLD32(val, 0, 3)
-#define EMC_DYN_CAS(val) BSP_FLD32(val, 7, 10)
-
-/** @} */
-
-/**
</font> * @name EMC AHB Control Register (EMCAHBControl)
*
* @{
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/include/lpc32xx.h:1.12 rtems/c/src/lib/libbsp/arm/lpc32xx/include/lpc32xx.h:1.13
--- rtems/c/src/lib/libbsp/arm/lpc32xx/include/lpc32xx.h:1.12 Thu Dec 16 07:35:06 2010
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/include/lpc32xx.h Thu May 19 07:11:36 2011
</font><font color='#997700'>@@ -28,6 +28,7 @@
</font> #include <bsp/lpc-timer.h>
#include <bsp/lpc-dma.h>
#include <bsp/lpc-i2s.h>
<font color='#000088'>+#include <bsp/lpc-emc.h>
</font>
/**
* @defgroup lpc32xx_reg Register Definitions
<font color='#997700'>@@ -232,7 +233,8 @@
</font>
/** @} */
<font color='#880000'>-#define LPC32XX_RESERVED(a, b, s) (((b) - (a) - sizeof(s)) / 4)
</font><font color='#000088'>+#define LPC32XX_FILL(a, b, s) uint8_t reserved_ ## b [b - a - sizeof(s)]
+#define LPC32XX_RESERVE(a, b) uint8_t reserved_ ## b [b - a]
</font>
typedef struct {
} lpc32xx_nand_slc;
<font color='#997700'>@@ -431,7 +433,10 @@
</font> uint32_t p2_inp_state;
uint32_t p2_outp_set;
uint32_t p2_outp_clr;
<font color='#880000'>- uint32_t reserved_0 [6];
</font><font color='#000088'>+ uint32_t p2_mux_set;
+ uint32_t p2_mux_clr;
+ uint32_t p2_mux_state;
+ LPC32XX_RESERVE(0x034, 0x040);
</font> uint32_t p0_inp_state;
uint32_t p0_outp_set;
uint32_t p0_outp_clr;
<font color='#997700'>@@ -439,7 +444,7 @@
</font> uint32_t p0_dir_set;
uint32_t p0_dir_clr;
uint32_t p0_dir_state;
<font color='#880000'>- uint32_t reserved_1 [1];
</font><font color='#000088'>+ LPC32XX_RESERVE(0x05c, 0x060);
</font> uint32_t p1_inp_state;
uint32_t p1_outp_set;
uint32_t p1_outp_clr;
<font color='#997700'>@@ -447,6 +452,16 @@
</font> uint32_t p1_dir_set;
uint32_t p1_dir_clr;
uint32_t p1_dir_state;
<font color='#000088'>+ LPC32XX_RESERVE(0x07c, 0x110);
+ uint32_t p3_mux_set;
+ uint32_t p3_mux_clr;
+ uint32_t p3_mux_state;
+ uint32_t p0_mux_set;
+ uint32_t p0_mux_clr;
+ uint32_t p0_mux_state;
+ uint32_t p1_mux_set;
+ uint32_t p1_mux_clr;
+ uint32_t p1_mux_state;
</font> } lpc32xx_gpio;
typedef struct {
<font color='#997700'>@@ -475,27 +490,6 @@
</font> uint32_t sram [32];
} lpc32xx_rtc;
<font color='#880000'>-#define EMC_DYN_CHIP_COUNT 2
-
-#define EMC_STATIC_CHIP_COUNT 4
-
-typedef struct {
- uint32_t config;
- uint32_t rascas;
- uint32_t reserved_0 [6];
-} lpc32xx_emc_dynamic;
-
-typedef struct {
- uint32_t config;
- uint32_t waitwen;
- uint32_t waitoen;
- uint32_t waitrd;
- uint32_t waitpage;
- uint32_t waitwr;
- uint32_t waitturn;
- uint32_t reserved_0 [1];
-} lpc32xx_emc_static;
-
</font> typedef struct {
uint32_t control;
uint32_t status;
<font color='#997700'>@@ -504,36 +498,6 @@
</font> } lpc32xx_emc_ahb;
typedef struct {
<font color='#880000'>- uint32_t control;
- uint32_t status;
- uint32_t config;
- uint32_t reserved_0 [5];
- uint32_t dynamiccontrol;
- uint32_t dynamicrefresh;
- uint32_t dynamicreadconfig;
- uint32_t reserved_1;
- uint32_t dynamictrp;
- uint32_t dynamictras;
- uint32_t dynamictsrex;
- uint32_t reserved_2 [2];
- uint32_t dynamictwr;
- uint32_t dynamictrc;
- uint32_t dynamictrfc;
- uint32_t dynamictxsr;
- uint32_t dynamictrrd;
- uint32_t dynamictmrd;
- uint32_t dynamictcdlr;
- uint32_t reserved_3 [8];
- uint32_t staticextendedwait;
- uint32_t reserved_4 [31];
- lpc32xx_emc_dynamic dynamic [EMC_DYN_CHIP_COUNT];
- uint32_t reserved_5 [48];
- lpc32xx_emc_static emcstatic [EMC_STATIC_CHIP_COUNT];
- uint32_t reserved_6 [96];
- lpc32xx_emc_ahb ahb [5];
-} lpc32xx_emc;
-
-typedef struct {
</font> union {
uint32_t w32;
uint16_t w16;
<font color='#997700'>@@ -569,93 +533,95 @@
</font>
typedef struct {
lpc32xx_nand_slc nand_slc;
<font color='#880000'>- uint32_t reserved_0 [LPC32XX_RESERVED(0x20020000, 0x20084000, lpc32xx_nand_slc)];
</font><font color='#000088'>+ LPC32XX_FILL(0x20020000, 0x20084000, lpc32xx_nand_slc);
</font> lpc32xx_ssp ssp_0;
<font color='#880000'>- uint32_t reserved_1 [LPC32XX_RESERVED(0x20084000, 0x20088000, lpc32xx_ssp)];<span style="background-color: #FF0000"> </span>
</font><font color='#000088'>+ LPC32XX_FILL(0x20084000, 0x20088000, lpc32xx_ssp);<span style="background-color: #FF0000"> </span>
</font> lpc32xx_spi spi_1;
<font color='#880000'>- uint32_t reserved_2 [LPC32XX_RESERVED(0x20088000, 0x2008c000, lpc32xx_spi)];
</font><font color='#000088'>+ LPC32XX_FILL(0x20088000, 0x2008c000, lpc32xx_spi);
</font> lpc32xx_ssp ssp_1;
<font color='#880000'>- uint32_t reserved_3 [LPC32XX_RESERVED(0x2008c000, 0x20090000, lpc32xx_ssp)];
</font><font color='#000088'>+ LPC32XX_FILL(0x2008c000, 0x20090000, lpc32xx_ssp);
</font> lpc32xx_spi spi_2;
<font color='#880000'>- uint32_t reserved_4 [LPC32XX_RESERVED(0x20090000, 0x20094000, lpc32xx_spi)];
</font><font color='#000088'>+ LPC32XX_FILL(0x20090000, 0x20094000, lpc32xx_spi);
</font> lpc_i2s i2s_0;
<font color='#880000'>- uint32_t reserved_5 [LPC32XX_RESERVED(0x20094000, 0x20098000, lpc_i2s)];
</font><font color='#000088'>+ LPC32XX_FILL(0x20094000, 0x20098000, lpc_i2s);
</font> lpc32xx_sd_card sd_card;
<font color='#880000'>- uint32_t reserved_6 [LPC32XX_RESERVED(0x20098000, 0x2009c000, lpc32xx_sd_card)];
</font><font color='#000088'>+ LPC32XX_FILL(0x20098000, 0x2009c000, lpc32xx_sd_card);
</font> lpc_i2s i2s_1;
<font color='#880000'>- uint32_t reserved_7 [LPC32XX_RESERVED(0x2009c000, 0x200a8000, lpc_i2s)];
</font><font color='#000088'>+ LPC32XX_FILL(0x2009c000, 0x200a8000, lpc_i2s);
</font> lpc32xx_nand_mlc nand_mlc;
<font color='#880000'>- uint32_t reserved_8 [LPC32XX_RESERVED(0x200a8000, 0x31000000, lpc32xx_nand_mlc)];
</font><font color='#000088'>+ LPC32XX_FILL(0x200a8000, 0x31000000, lpc32xx_nand_mlc);
</font> lpc_dma dma;
<font color='#880000'>- uint32_t reserved_9 [LPC32XX_RESERVED(0x31000000, 0x31020000, lpc_dma)];
</font><font color='#000088'>+ LPC32XX_FILL(0x31000000, 0x31020000, lpc_dma);
</font> lpc32xx_usb usb;
<font color='#880000'>- uint32_t reserved_10 [LPC32XX_RESERVED(0x31020000, 0x31040000, lpc32xx_usb)];
</font><font color='#000088'>+ LPC32XX_FILL(0x31020000, 0x31040000, lpc32xx_usb);
</font> lpc32xx_lcd lcd;
<font color='#880000'>- uint32_t reserved_11 [LPC32XX_RESERVED(0x31040000, 0x31060000, lpc32xx_lcd)];
</font><font color='#000088'>+ LPC32XX_FILL(0x31040000, 0x31060000, lpc32xx_lcd);
</font> lpc32xx_eth eth;
<font color='#880000'>- uint32_t reserved_12 [LPC32XX_RESERVED(0x31060000, 0x31080000, lpc32xx_eth)];
- lpc32xx_emc emc;
- uint32_t reserved_13 [LPC32XX_RESERVED(0x31080000, 0x310c0000, lpc32xx_emc)];
</font><font color='#000088'>+ LPC32XX_FILL(0x31060000, 0x31080000, lpc32xx_eth);
+ lpc_emc emc;
+ LPC32XX_FILL(0x31080000, 0x31080400, lpc_emc);
+ lpc32xx_emc_ahb emc_ahb [5];
+ LPC32XX_FILL(0x31080400, 0x310c0000, lpc32xx_emc_ahb [5]);
</font> lpc32xx_etb etb;
<font color='#880000'>- uint32_t reserved_14 [LPC32XX_RESERVED(0x310c0000, 0x40004000, lpc32xx_etb)];
</font><font color='#000088'>+ LPC32XX_FILL(0x310c0000, 0x40004000, lpc32xx_etb);
</font> lpc32xx_syscon syscon;
<font color='#880000'>- uint32_t reserved_15 [LPC32XX_RESERVED(0x40004000, 0x40008000, lpc32xx_syscon)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40004000, 0x40008000, lpc32xx_syscon);
</font> lpc32xx_irq mic;
<font color='#880000'>- uint32_t reserved_16 [LPC32XX_RESERVED(0x40008000, 0x4000c000, lpc32xx_irq)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40008000, 0x4000c000, lpc32xx_irq);
</font> lpc32xx_irq sic_1;
<font color='#880000'>- uint32_t reserved_17 [LPC32XX_RESERVED(0x4000c000, 0x40010000, lpc32xx_irq)];
</font><font color='#000088'>+ LPC32XX_FILL(0x4000c000, 0x40010000, lpc32xx_irq);
</font> lpc32xx_irq sic_2;
<font color='#880000'>- uint32_t reserved_18 [LPC32XX_RESERVED(0x40010000, 0x40014000, lpc32xx_irq)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40010000, 0x40014000, lpc32xx_irq);
</font> lpc32xx_uart uart_1;
<font color='#880000'>- uint32_t reserved_19 [LPC32XX_RESERVED(0x40014000, 0x40018000, lpc32xx_uart)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40014000, 0x40018000, lpc32xx_uart);
</font> lpc32xx_uart uart_2;
<font color='#880000'>- uint32_t reserved_20 [LPC32XX_RESERVED(0x40018000, 0x4001c000, lpc32xx_uart)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40018000, 0x4001c000, lpc32xx_uart);
</font> lpc32xx_uart uart_7;
<font color='#880000'>- uint32_t reserved_21 [LPC32XX_RESERVED(0x4001c000, 0x40024000, lpc32xx_uart)];
</font><font color='#000088'>+ LPC32XX_FILL(0x4001c000, 0x40024000, lpc32xx_uart);
</font> lpc32xx_rtc rtc;
<font color='#880000'>- uint32_t reserved_22 [LPC32XX_RESERVED(0x40024000, 0x40028000, lpc32xx_rtc)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40024000, 0x40028000, lpc32xx_rtc);
</font> lpc32xx_gpio gpio;
<font color='#880000'>- uint32_t reserved_23 [LPC32XX_RESERVED(0x40028000, 0x4002c000, lpc32xx_gpio)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40028000, 0x4002c000, lpc32xx_gpio);
</font> lpc_timer timer_4;
<font color='#880000'>- uint32_t reserved_24 [LPC32XX_RESERVED(0x4002c000, 0x40030000, lpc_timer)];
</font><font color='#000088'>+ LPC32XX_FILL(0x4002c000, 0x40030000, lpc_timer);
</font> lpc_timer timer_5;
<font color='#880000'>- uint32_t reserved_25 [LPC32XX_RESERVED(0x40030000, 0x40034000, lpc_timer)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40030000, 0x40034000, lpc_timer);
</font> lpc32xx_ms_timer ms_timer;
<font color='#880000'>- uint32_t reserved_26 [LPC32XX_RESERVED(0x40034000, 0x40038000, lpc32xx_ms_timer)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40034000, 0x40038000, lpc32xx_ms_timer);
</font> lpc32xx_hs_timer hs_timer;
<font color='#880000'>- uint32_t reserved_27 [LPC32XX_RESERVED(0x40038000, 0x4003c000, lpc32xx_hs_timer)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40038000, 0x4003c000, lpc32xx_hs_timer);
</font> lpc32xx_wdt wdt;
<font color='#880000'>- uint32_t reserved_28 [LPC32XX_RESERVED(0x4003c000, 0x40040000, lpc32xx_wdt)];
</font><font color='#000088'>+ LPC32XX_FILL(0x4003c000, 0x40040000, lpc32xx_wdt);
</font> lpc32xx_debug debug;
<font color='#880000'>- uint32_t reserved_29 [LPC32XX_RESERVED(0x40040000, 0x40044000, lpc32xx_debug)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40040000, 0x40044000, lpc32xx_debug);
</font> lpc_timer timer_0;
<font color='#880000'>- uint32_t reserved_30 [LPC32XX_RESERVED(0x40044000, 0x40048000, lpc_timer)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40044000, 0x40048000, lpc_timer);
</font> lpc32xx_adc adc;
<font color='#880000'>- uint32_t reserved_31 [LPC32XX_RESERVED(0x40048000, 0x4004c000, lpc32xx_adc)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40048000, 0x4004c000, lpc32xx_adc);
</font> lpc_timer timer_1;
<font color='#880000'>- uint32_t reserved_32 [LPC32XX_RESERVED(0x4004c000, 0x40050000, lpc_timer)];
</font><font color='#000088'>+ LPC32XX_FILL(0x4004c000, 0x40050000, lpc_timer);
</font> lpc32xx_keyscan keyscan;
<font color='#880000'>- uint32_t reserved_33 [LPC32XX_RESERVED(0x40050000, 0x40054000, lpc32xx_keyscan)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40050000, 0x40054000, lpc32xx_keyscan);
</font> lpc32xx_uart_ctrl uart_ctrl;
<font color='#880000'>- uint32_t reserved_34 [LPC32XX_RESERVED(0x40054000, 0x40058000, lpc32xx_uart_ctrl)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40054000, 0x40058000, lpc32xx_uart_ctrl);
</font> lpc_timer timer_2;
<font color='#880000'>- uint32_t reserved_35 [LPC32XX_RESERVED(0x40058000, 0x4005c000, lpc_timer)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40058000, 0x4005c000, lpc_timer);
</font> lpc32xx_pwm pwm_1_and_pwm_2;
<font color='#880000'>- uint32_t reserved_36 [LPC32XX_RESERVED(0x4005c000, 0x40060000, lpc32xx_pwm)];
</font><font color='#000088'>+ LPC32XX_FILL(0x4005c000, 0x40060000, lpc32xx_pwm);
</font> lpc_timer timer3;
<font color='#880000'>- uint32_t reserved_37 [LPC32XX_RESERVED(0x40060000, 0x40080000, lpc_timer)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40060000, 0x40080000, lpc_timer);
</font> lpc32xx_uart uart_3;
<font color='#880000'>- uint32_t reserved_38 [LPC32XX_RESERVED(0x40080000, 0x40088000, lpc32xx_uart)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40080000, 0x40088000, lpc32xx_uart);
</font> lpc32xx_uart uart_4;
<font color='#880000'>- uint32_t reserved_39 [LPC32XX_RESERVED(0x40088000, 0x40090000, lpc32xx_uart)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40088000, 0x40090000, lpc32xx_uart);
</font> lpc32xx_uart uart_5;
<font color='#880000'>- uint32_t reserved_40 [LPC32XX_RESERVED(0x40090000, 0x40098000, lpc32xx_uart)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40090000, 0x40098000, lpc32xx_uart);
</font> lpc32xx_uart uart_6;
<font color='#880000'>- uint32_t reserved_41 [LPC32XX_RESERVED(0x40098000, 0x400a0000, lpc32xx_uart)];
</font><font color='#000088'>+ LPC32XX_FILL(0x40098000, 0x400a0000, lpc32xx_uart);
</font> lpc32xx_i2c i2c_1;
<font color='#880000'>- uint32_t reserved_42 [LPC32XX_RESERVED(0x400a0000, 0x400a8000, lpc32xx_i2c)];
</font><font color='#000088'>+ LPC32XX_FILL(0x400a0000, 0x400a8000, lpc32xx_i2c);
</font> lpc32xx_i2c i2c_2;
<font color='#880000'>- uint32_t reserved_43 [LPC32XX_RESERVED(0x400a8000, 0x400e8000, lpc32xx_i2c)];
</font><font color='#000088'>+ LPC32XX_FILL(0x400a8000, 0x400e8000, lpc32xx_i2c);
</font> lpc32xx_mcpwm mcpwm;
} lpc32xx_registers;
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/misc/emc.c:1.2 rtems/c/src/lib/libbsp/arm/lpc32xx/misc/emc.c:1.3
--- rtems/c/src/lib/libbsp/arm/lpc32xx/misc/emc.c:1.2 Tue Sep 28 09:38:26 2010
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/misc/emc.c Thu May 19 07:11:36 2011
</font><font color='#997700'>@@ -24,7 +24,9 @@
</font> #include <bsp.h>
#include <bsp/mmu.h>
<font color='#880000'>-static volatile lpc32xx_emc *const emc = &lpc32xx.emc;
</font><font color='#000088'>+static volatile lpc_emc *const emc = &lpc32xx.emc;
+
+static volatile lpc32xx_emc_ahb *const emc_ahb = &lpc32xx.emc_ahb [0];
</font>
static void dynamic_init(const lpc32xx_emc_dynamic_config *cfg)
{
<font color='#997700'>@@ -95,17 +97,17 @@
</font> LPC32XX_HCLKDIV_CTRL |= HCLK_DIV_DDRAM_CLK(1);
/* Enable buffers in AHB ports */
<font color='#880000'>- emc->ahb [0].control = EMC_AHB_PORT_BUFF_EN;
- emc->ahb [3].control = EMC_AHB_PORT_BUFF_EN;
- emc->ahb [4].control = EMC_AHB_PORT_BUFF_EN;
</font><font color='#000088'>+ emc_ahb [0].control = EMC_AHB_PORT_BUFF_EN;
+ emc_ahb [3].control = EMC_AHB_PORT_BUFF_EN;
+ emc_ahb [4].control = EMC_AHB_PORT_BUFF_EN;
</font>
/* Set AHB port timeouts */
<font color='#880000'>- emc->ahb [0].timeout = EMC_AHB_TIMEOUT(32);
- emc->ahb [3].timeout = EMC_AHB_TIMEOUT(32);
- emc->ahb [4].timeout = EMC_AHB_TIMEOUT(32);
</font><font color='#000088'>+ emc_ahb [0].timeout = EMC_AHB_TIMEOUT(32);
+ emc_ahb [3].timeout = EMC_AHB_TIMEOUT(32);
+ emc_ahb [4].timeout = EMC_AHB_TIMEOUT(32);
</font>
/* Enable EMC */
<font color='#880000'>- emc->control = EMC_CTRL_EN,
</font><font color='#000088'>+ emc->control = EMC_CTRL_E,
</font> emc->config = 0;
dynamic_init(dyn_cfg);
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc32xx/preinstall.am:1.8 rtems/c/src/lib/libbsp/arm/lpc32xx/preinstall.am:1.9
--- rtems/c/src/lib/libbsp/arm/lpc32xx/preinstall.am:1.8 Fri Dec 3 03:29:07 2010
+++ rtems/c/src/lib/libbsp/arm/lpc32xx/preinstall.am Thu May 19 07:11:35 2011
</font><font color='#997700'>@@ -102,6 +102,14 @@
</font> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/lpc-i2s.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/lpc-i2s.h
<font color='#000088'>+$(PROJECT_INCLUDE)/bsp/lpc-emc.h: ../shared/lpc/include/lpc-emc.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/lpc-emc.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/lpc-emc.h
+
+$(PROJECT_INCLUDE)/bsp/lpc-lcd.h: ../shared/lpc/include/lpc-lcd.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/lpc-lcd.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/lpc-lcd.h
+
</font> $(PROJECT_INCLUDE)/bsp/irq.h: include/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
</pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>sh</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-05-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
* i2c/i2c-config.c: New file.
* include/lcd.h: Removed EMC definitions.
* misc/dma.c: Fixed initialization.
* include/i2c.h, include/io.h, include/lpc-ethernet-config.h,
include/lpc24xx.h, console/console-config.c, i2c/i2c.c, misc/io.c,
misc/lcd.c, startup/bspstart.c, startup/bspstarthooks.c: New pin
configuration API.
* Makefile.am, preinstall.am: Update.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/ChangeLog.diff?r1=text&tr1=1.66&r2=text&tr2=1.67&diff_format=h">M</a></td><td width='1%'>1.67</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/Makefile.am.diff?r1=text&tr1=1.31&r2=text&tr2=1.32&diff_format=h">M</a></td><td width='1%'>1.32</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/console/console-config.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/i2c/i2c-config.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">c/src/lib/libbsp/arm/lpc24xx/i2c/i2c-config.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/i2c/i2c.c.diff?r1=text&tr1=1.4&r2=text&tr2=1.5&diff_format=h">M</a></td><td width='1%'>1.5</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/i2c/i2c.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/include/i2c.h.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/include/i2c.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/include/io.h.diff?r1=text&tr1=1.4&r2=text&tr2=1.5&diff_format=h">M</a></td><td width='1%'>1.5</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/include/io.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/include/lcd.h.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/include/lcd.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc-ethernet-config.h.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/include/lpc-ethernet-config.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc24xx.h.diff?r1=text&tr1=1.13&r2=text&tr2=1.14&diff_format=h">M</a></td><td width='1%'>1.14</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/include/lpc24xx.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/misc/dma.c.diff?r1=text&tr1=1.7&r2=text&tr2=1.8&diff_format=h">M</a></td><td width='1%'>1.8</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/misc/dma.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/misc/io.c.diff?r1=text&tr1=1.8&r2=text&tr2=1.9&diff_format=h">M</a></td><td width='1%'>1.9</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/misc/io.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/misc/lcd.c.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/misc/lcd.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/preinstall.am.diff?r1=text&tr1=1.20&r2=text&tr2=1.21&diff_format=h">M</a></td><td width='1%'>1.21</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/preinstall.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c.diff?r1=text&tr1=1.9&r2=text&tr2=1.10&diff_format=h">M</a></td><td width='1%'>1.10</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c.diff?r1=text&tr1=1.8&r2=text&tr2=1.9&diff_format=h">M</a></td><td width='1%'>1.9</td><td width='100%'>c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/ChangeLog:1.66 rtems/c/src/lib/libbsp/arm/lpc24xx/ChangeLog:1.67
--- rtems/c/src/lib/libbsp/arm/lpc24xx/ChangeLog:1.66 Wed Mar 16 12:13:20 2011
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/ChangeLog Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -1,3 +1,14 @@
</font><font color='#000088'>+2011-05-19 Sebastian Huber <sebastian.huber@embedded-brains.de>
+
+ * i2c/i2c-config.c: New file.
+ * include/lcd.h: Removed EMC definitions.
+ * misc/dma.c: Fixed initialization.
+ * include/i2c.h, include/io.h, include/lpc-ethernet-config.h,
+ include/lpc24xx.h, console/console-config.c, i2c/i2c.c, misc/io.c,
+ misc/lcd.c, startup/bspstart.c, startup/bspstarthooks.c: New pin
+ configuration API.
+ * Makefile.am, preinstall.am: Update.
+
</font> 2011-03-16 Joel Sherrill <joel.sherrill@oarcorp.com>
* README: Add example mkimage command.
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/Makefile.am:1.31 rtems/c/src/lib/libbsp/arm/lpc24xx/Makefile.am:1.32
--- rtems/c/src/lib/libbsp/arm/lpc24xx/Makefile.am:1.31 Mon Feb 21 06:56:34 2011
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/Makefile.am Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -37,6 +37,9 @@
</font> include_bsp_HEADERS += ../shared/include/start.h
include_bsp_HEADERS += ../shared/lpc/include/lpc-timer.h
include_bsp_HEADERS += ../shared/lpc/include/lpc-i2s.h
<font color='#000088'>+include_bsp_HEADERS += ../shared/lpc/include/lpc-emc.h
+include_bsp_HEADERS += ../shared/lpc/include/lpc-dma.h
+include_bsp_HEADERS += ../shared/lpc/include/lpc-lcd.h
</font> include_bsp_HEADERS += include/irq.h
include_bsp_HEADERS += include/lpc24xx.h
include_bsp_HEADERS += include/system-clocks.h
<font color='#997700'>@@ -131,7 +134,8 @@
</font> libbsp_a_SOURCES += ssp/ssp.c
# I2C
<font color='#880000'>-libbsp_a_SOURCES += i2c/i2c.c
</font><font color='#000088'>+libbsp_a_SOURCES += i2c/i2c.c \
+ i2c/i2c-config.c
</font>
# Cache
libbsp_a_SOURCES += ../../../libcpu/shared/src/cache_manager.c \
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c:1.5 rtems/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c:1.6
--- rtems/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c:1.5 Tue Dec 15 09:20:46 2009
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/console/console-config.c Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2008
- * Embedded Brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * rtems@embedded-brains.de
</font><font color='#000088'>+ * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be found in the file
* LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
<font color='#997700'>@@ -24,8 +25,9 @@
</font> #include <bsp.h>
#include <bsp/lpc24xx.h>
#include <bsp/irq.h>
<font color='#000088'>+#include <bsp/io.h>
</font>
<font color='#880000'>-static uint8_t lpc24xx_uart_register(uint32_t addr, uint8_t i)
</font><font color='#000088'>+static uint8_t lpc24xx_uart_get_register(uint32_t addr, uint8_t i)
</font> {
volatile uint32_t *reg = (volatile uint32_t *) addr;
<font color='#997700'>@@ -39,6 +41,54 @@
</font> reg [i] = val;
}
<font color='#000088'>+#ifdef LPC24XX_CONFIG_UART_1
+ static bool lpc24xx_uart_probe_1(int minor)
+ {
+ static const lpc24xx_pin_range pins [] = {
+ LPC24XX_PIN_UART_1_TXD_P0_15,
+ LPC24XX_PIN_UART_1_RXD_P0_16,
+ LPC24XX_PIN_TERMINAL
+ };
+
+ lpc24xx_module_enable(LPC24XX_MODULE_UART_1, LPC24XX_MODULE_CCLK);
+ lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
+
+ return true;
+ }
+#endif
+
+#ifdef LPC24XX_CONFIG_UART_2
+ static bool lpc24xx_uart_probe_2(int minor)
+ {
+ static const lpc24xx_pin_range pins [] = {
+ LPC24XX_PIN_UART_2_TXD_P0_10,
+ LPC24XX_PIN_UART_2_RXD_P0_11,
+ LPC24XX_PIN_TERMINAL
+ };
+
+ lpc24xx_module_enable(LPC24XX_MODULE_UART_2, LPC24XX_MODULE_CCLK);
+ lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
+
+ return true;
+ }
+#endif
+
+#ifdef LPC24XX_CONFIG_UART_3
+ static bool lpc24xx_uart_probe_3(int minor)
+ {
+ static const lpc24xx_pin_range pins [] = {
+ LPC24XX_PIN_UART_3_TXD_P0_0,
+ LPC24XX_PIN_UART_3_RXD_P0_1,
+ LPC24XX_PIN_TERMINAL
+ };
+
+ lpc24xx_module_enable(LPC24XX_MODULE_UART_3, LPC24XX_MODULE_CCLK);
+ lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
+
+ return true;
+ }
+#endif
+
</font> rtems_device_minor_number Console_Port_Minor = 0;
console_tbl Console_Port_Tbl [] = {
<font color='#997700'>@@ -55,7 +105,7 @@
</font> .ulCtrlPort1 = UART0_BASE_ADDR,
.ulCtrlPort2 = 0,
.ulDataPort = UART0_BASE_ADDR,
<font color='#880000'>- .getRegister = lpc24xx_uart_register,
</font><font color='#000088'>+ .getRegister = lpc24xx_uart_get_register,
</font> .setRegister = lpc24xx_uart_set_register,
.getData = NULL,
.setData = NULL,
<font color='#997700'>@@ -68,7 +118,7 @@
</font> .sDeviceName = "/dev/ttyS1",
.deviceType = SERIAL_NS16550,
.pDeviceFns = &ns16550_fns,
<font color='#880000'>- .deviceProbe = NULL,
</font><font color='#000088'>+ .deviceProbe = lpc24xx_uart_probe_1,
</font> .pDeviceFlow = NULL,
.ulMargin = 16,
.ulHysteresis = 8,
<font color='#997700'>@@ -76,7 +126,7 @@
</font> .ulCtrlPort1 = UART1_BASE_ADDR,
.ulCtrlPort2 = 0,
.ulDataPort = UART1_BASE_ADDR,
<font color='#880000'>- .getRegister = lpc24xx_uart_register,
</font><font color='#000088'>+ .getRegister = lpc24xx_uart_get_register,
</font> .setRegister = lpc24xx_uart_set_register,
.getData = NULL,
.setData = NULL,
<font color='#997700'>@@ -89,7 +139,7 @@
</font> .sDeviceName = "/dev/ttyS2",
.deviceType = SERIAL_NS16550,
.pDeviceFns = &ns16550_fns,
<font color='#880000'>- .deviceProbe = NULL,
</font><font color='#000088'>+ .deviceProbe = lpc24xx_uart_probe_2,
</font> .pDeviceFlow = NULL,
.ulMargin = 16,
.ulHysteresis = 8,
<font color='#997700'>@@ -97,7 +147,7 @@
</font> .ulCtrlPort1 = UART2_BASE_ADDR,
.ulCtrlPort2 = 0,
.ulDataPort = UART2_BASE_ADDR,
<font color='#880000'>- .getRegister = lpc24xx_uart_register,
</font><font color='#000088'>+ .getRegister = lpc24xx_uart_get_register,
</font> .setRegister = lpc24xx_uart_set_register,
.getData = NULL,
.setData = NULL,
<font color='#997700'>@@ -110,7 +160,7 @@
</font> .sDeviceName = "/dev/ttyS3",
.deviceType = SERIAL_NS16550,
.pDeviceFns = &ns16550_fns,
<font color='#880000'>- .deviceProbe = NULL,
</font><font color='#000088'>+ .deviceProbe = lpc24xx_uart_probe_3,
</font> .pDeviceFlow = NULL,
.ulMargin = 16,
.ulHysteresis = 8,
<font color='#997700'>@@ -118,7 +168,7 @@
</font> .ulCtrlPort1 = UART3_BASE_ADDR,
.ulCtrlPort2 = 0,
.ulDataPort = UART3_BASE_ADDR,
<font color='#880000'>- .getRegister = lpc24xx_uart_register,
</font><font color='#000088'>+ .getRegister = lpc24xx_uart_get_register,
</font> .setRegister = lpc24xx_uart_set_register,
.getData = NULL,
.setData = NULL,
<font color='#997700'>@@ -128,9 +178,9 @@
</font> #endif
};
<font color='#880000'>-#define LPC24XX_UART_NUMBER \
</font><font color='#000088'>+#define LPC24XX_UART_COUNT \
</font> (sizeof(Console_Port_Tbl) / sizeof(Console_Port_Tbl [0]))
<font color='#880000'>-unsigned long Console_Port_Count = LPC24XX_UART_NUMBER;
</font><font color='#000088'>+unsigned long Console_Port_Count = LPC24XX_UART_COUNT;
</font>
<font color='#880000'>-console_data Console_Port_Data [LPC24XX_UART_NUMBER];
</font><font color='#000088'>+console_data Console_Port_Data [LPC24XX_UART_COUNT];
</font>
<font color='#006600'>diff -u /dev/null rtems/c/src/lib/libbsp/arm/lpc24xx/i2c/i2c-config.c:1.1
--- /dev/null Thu May 19 08:11:44 2011
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/i2c/i2c-config.c Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -0,0 +1,91 @@
</font><font color='#000088'>+/**
+ * @file
+ *
+ * @ingroup lpc24xx_libi2c
+ *
+ * @brief LibI2C bus driver for the I2C modules.
+ */
+
+/*
+ * Copyright (c) 2009-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ */
+
+#include <bspopts.h>
+#include <bsp/i2c.h>
+#include <bsp/irq.h>
+
+#ifdef LPC24XX_CONFIG_I2C_0
+ static const lpc24xx_pin_range lpc24xx_i2c_pins_0 [] = {
+ LPC24XX_PIN_I2C_0_SDA,
+ LPC24XX_PIN_I2C_0_SCL,
+ LPC24XX_PIN_TERMINAL
+ };
+
+ static lpc24xx_i2c_bus_entry lpc24xx_i2c_entry_0 = {
+ .bus = {
+ .ops = &lpc24xx_i2c_ops,
+ .size = sizeof(lpc24xx_i2c_bus_entry)
+ },
+ .regs = (volatile lpc24xx_i2c *) I2C0_BASE_ADDR,
+ .index = 0,
+ .pins = &lpc24xx_i2c_pins_0 [0],
+ .vector = LPC24XX_IRQ_I2C_0
+ };
+
+ rtems_libi2c_bus_t * const lpc24xx_i2c_0 =
+ &lpc24xx_i2c_entry_0.bus;
+#endif
+
+#ifdef LPC24XX_CONFIG_I2C_1
+ static const lpc24xx_pin_range lpc24xx_i2c_pins_1 [] = {
+ LPC24XX_PIN_I2C_1_SDA_P0_19,
+ LPC24XX_PIN_I2C_1_SCL_P0_20,
+ LPC24XX_PIN_TERMINAL
+ };
+
+ static lpc24xx_i2c_bus_entry lpc24xx_i2c_entry_1 = {
+ .bus = {
+ .ops = &lpc24xx_i2c_ops,
+ .size = sizeof(lpc24xx_i2c_bus_entry)
+ },
+ .regs = (volatile lpc24xx_i2c *) I2C1_BASE_ADDR,
+ .index = 1,
+ .pins = &lpc24xx_i2c_pins_1 [0],
+ .vector = LPC24XX_IRQ_I2C_1
+ };
+
+ rtems_libi2c_bus_t * const lpc24xx_i2c_1 =
+ &lpc24xx_i2c_entry_1.bus;
+#endif
+
+#ifdef LPC24XX_CONFIG_I2C_2
+ static const lpc24xx_pin_range lpc24xx_i2c_pins_2 [] = {
+ LPC24XX_PIN_I2C_2_SDA_P0_10,
+ LPC24XX_PIN_I2C_2_SCL_P0_11,
+ LPC24XX_PIN_TERMINAL
+ };
+
+ static lpc24xx_i2c_bus_entry lpc24xx_i2c_entry_2 = {
+ .bus = {
+ .ops = &lpc24xx_i2c_ops,
+ .size = sizeof(lpc24xx_i2c_bus_entry)
+ },
+ .regs = (volatile lpc24xx_i2c *) I2C2_BASE_ADDR,
+ .index = 2,
+ .pins = &lpc24xx_i2c_pins_2 [0],
+ .vector = LPC24XX_IRQ_I2C_2
+ };
+
+ rtems_libi2c_bus_t * const lpc24xx_i2c_2 =
+ &lpc24xx_i2c_entry_2.bus;
+#endif
</font>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/i2c/i2c.c:1.4 rtems/c/src/lib/libbsp/arm/lpc24xx/i2c/i2c.c:1.5
--- rtems/c/src/lib/libbsp/arm/lpc24xx/i2c/i2c.c:1.4 Tue Dec 15 09:20:46 2009
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/i2c/i2c.c Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -7,43 +7,29 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2009-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
<font color='#880000'>-#include <rtems.h>
-
</font> #include <bsp.h>
#include <bsp/i2c.h>
<font color='#880000'>-#include <bsp/io.h>
</font> #include <bsp/irq.h>
#include <bsp/irq-generic.h>
<font color='#880000'>-#include <bsp/lpc24xx.h>
</font> #include <bsp/system-clocks.h>
#define RTEMS_STATUS_CHECKS_USE_PRINTK
#include <rtems/status-checks.h>
<font color='#880000'>-typedef struct {
- rtems_libi2c_bus_t bus;
- volatile lpc24xx_i2c *regs;
- unsigned index;
- unsigned config;
- rtems_vector_number vector;
- rtems_id state_update;
- uint8_t * volatile data;
- uint8_t * volatile end;
-} lpc24xx_i2c_bus_entry;
-
</font> static void lpc24xx_i2c_handler(void *arg)
{
lpc24xx_i2c_bus_entry *e = arg;
<font color='#997700'>@@ -131,9 +117,9 @@
</font> sc = lpc24xx_module_enable(LPC24XX_MODULE_I2C_0 + e->index, LPC24XX_MODULE_CCLK_8);
RTEMS_CHECK_SC(sc, "enable module");
<font color='#880000'>- /* IO configuration */
- sc = lpc24xx_io_config(LPC24XX_MODULE_I2C_0 + e->index, e->config);
- RTEMS_CHECK_SC(sc, "IO configuration");
</font><font color='#000088'>+ /* Pin configuration */
+ sc = lpc24xx_pin_config(e->pins, LPC24XX_PIN_SET_FUNCTION);
+ RTEMS_CHECK_SC(sc, "pin configuration");
</font>
/* Clock high and low duty cycles */
regs->sclh = cycles;
<font color='#997700'>@@ -327,7 +313,7 @@
</font> return rv;
}
<font color='#880000'>-static const rtems_libi2c_bus_ops_t lpc24xx_i2c_ops = {
</font><font color='#000088'>+const rtems_libi2c_bus_ops_t lpc24xx_i2c_ops = {
</font> .init = lpc24xx_i2c_init,
.send_start = lpc24xx_i2c_send_start,
.send_stop = lpc24xx_i2c_send_stop,
<font color='#997700'>@@ -336,51 +322,3 @@
</font> .write_bytes = lpc24xx_i2c_write,
.ioctl = lpc24xx_i2c_ioctl
};
<font color='#880000'>-
-#ifdef LPC24XX_CONFIG_I2C_0
- static lpc24xx_i2c_bus_entry lpc24xx_i2c_entry_0 = {
- .bus = {
- .ops = &lpc24xx_i2c_ops,
- .size = sizeof(lpc24xx_i2c_bus_entry)
- },
- .regs = (volatile lpc24xx_i2c *) I2C0_BASE_ADDR,
- .index = 0,
- .config = LPC24XX_CONFIG_I2C_0,
- .vector = LPC24XX_IRQ_I2C_0
- };
-
- rtems_libi2c_bus_t * const lpc24xx_i2c_0 =
- (rtems_libi2c_bus_t *) &lpc24xx_i2c_entry_0;
-#endif
-
-#ifdef LPC24XX_CONFIG_I2C_1
- static lpc24xx_i2c_bus_entry lpc24xx_i2c_entry_1 = {
- .bus = {
- .ops = &lpc24xx_i2c_ops,
- .size = sizeof(lpc24xx_i2c_bus_entry)
- },
- .regs = (volatile lpc24xx_i2c *) I2C1_BASE_ADDR,
- .index = 1,
- .config = LPC24XX_CONFIG_I2C_1,
- .vector = LPC24XX_IRQ_I2C_1
- };
-
- rtems_libi2c_bus_t * const lpc24xx_i2c_1 =
- (rtems_libi2c_bus_t *) &lpc24xx_i2c_entry_1;
-#endif
-
-#ifdef LPC24XX_CONFIG_I2C_2
- static lpc24xx_i2c_bus_entry lpc24xx_i2c_entry_2 = {
- .bus = {
- .ops = &lpc24xx_i2c_ops,
- .size = sizeof(lpc24xx_i2c_bus_entry)
- },
- .regs = (volatile lpc24xx_i2c *) I2C2_BASE_ADDR,
- .index = 2,
- .config = LPC24XX_CONFIG_I2C_2,
- .vector = LPC24XX_IRQ_I2C_2
- };
-
- rtems_libi2c_bus_t * const lpc24xx_i2c_2 =
- (rtems_libi2c_bus_t *) &lpc24xx_i2c_entry_2;
-#endif
</font>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/include/i2c.h:1.2 rtems/c/src/lib/libbsp/arm/lpc24xx/include/i2c.h:1.3
--- rtems/c/src/lib/libbsp/arm/lpc24xx/include/i2c.h:1.2 Fri Sep 18 03:05:40 2009
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/include/i2c.h Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2009-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -22,8 +23,12 @@
</font> #ifndef LIBBSP_ARM_LPC24XX_I2C_H
#define LIBBSP_ARM_LPC24XX_I2C_H
<font color='#000088'>+#include <rtems.h>
</font> #include <rtems/libi2c.h>
<font color='#000088'>+#include <bsp/io.h>
+#include <bsp/lpc24xx.h>
+
</font> #ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
<font color='#997700'>@@ -38,11 +43,24 @@
</font> * @{
*/
<font color='#880000'>-extern rtems_libi2c_bus_t * const lpc24xx_i2c_0;
</font><font color='#000088'>+typedef struct {
+ rtems_libi2c_bus_t bus;
+ volatile lpc24xx_i2c *regs;
+ size_t index;
+ const lpc24xx_pin_range *pins;
+ rtems_vector_number vector;
+ rtems_id state_update;
+ uint8_t *volatile data;
+ uint8_t *volatile end;
+} lpc24xx_i2c_bus_entry;
+
+extern const rtems_libi2c_bus_ops_t lpc24xx_i2c_ops;
+
+extern rtems_libi2c_bus_t *const lpc24xx_i2c_0;
</font>
<font color='#880000'>-extern rtems_libi2c_bus_t * const lpc24xx_i2c_1;
</font><font color='#000088'>+extern rtems_libi2c_bus_t *const lpc24xx_i2c_1;
</font>
<font color='#880000'>-extern rtems_libi2c_bus_t * const lpc24xx_i2c_2;
</font><font color='#000088'>+extern rtems_libi2c_bus_t *const lpc24xx_i2c_2;
</font>
/** @} */
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/include/io.h:1.4 rtems/c/src/lib/libbsp/arm/lpc24xx/include/io.h:1.5
--- rtems/c/src/lib/libbsp/arm/lpc24xx/include/io.h:1.4 Fri Dec 3 03:56:47 2010
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/include/io.h Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2009-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -37,65 +38,6 @@
</font> *
* @brief Input and output module.
*
<font color='#880000'>- * <table>
- * <tr><th>Module</th><th>Configuration</th><th>First Pin</th><th>Last Pin</th></tr>
- * <tr><td>UART 0</td><td>0</td><td>P0.2</td><td>P0.3</td></tr>
- * <tr><td rowspan=3>UART 1</td><td>0</td><td>P0.15</td><td>P0.16</td></tr>
- * <tr><td>1</td><td>P2.0</td><td>P2.1</td></tr>
- * <tr><td>2</td><td>P3.16</td><td>P3.17</td></tr>
- * <tr><td rowspan=3>UART 2</td><td>0</td><td>P0.10</td><td>P0.11</td></tr>
- * <tr><td>1</td><td>P2.8</td><td>P2.9</td></tr>
- * <tr><td>2</td><td>P4.22</td><td>P4.23</td></tr>
- * <tr><td rowspan=3>UART 3</td><td>0</td><td>P0.0</td><td>P0.1</td></tr>
- * <tr><td>1</td><td>P0.25</td><td>P0.26</td></tr>
- * <tr><td>2</td><td>P4.28</td><td>P4.29</td></tr>
- * <tr><td rowspan=5>ETHERNET</td><td>0</td><td>P1.0</td><td>P1.17</td></tr>
- * <tr><td rowspan=4>1</td><td>P1.0</td><td>P1.1</td></tr>
- * <tr><td>P1.4</td><td>P1.4</td></tr>
- * <tr><td>P1.8</td><td>P1.10</td></tr>
- * <tr><td>P1.14</td><td>P1.17</td></tr>
- * <tr><td rowspan=4>ADC</td><td>0</td><td>P0.12</td><td>P0.13</td></tr>
- * <tr><td>1</td><td>P0.23</td><td>P0.25</td></tr>
- * <tr><td rowspan=2>2</td><td>P0.26</td><td>P0.26</td></tr>
- * <tr><td>P1.30</td><td>P1.31</td></tr>
- * <tr><td>I2C 0</td><td>0</td><td>P0.27</td><td>P0.28</td></tr>
- * <tr><td rowspan=3>I2C 1</td><td>0</td><td>P0.0</td><td>P0.1</td></tr>
- * <tr><td>1</td><td>P0.19</td><td>P0.20</td></tr>
- * <tr><td>2</td><td>P2.14</td><td>P2.15</td></tr>
- * <tr><td rowspan=3>I2C 2</td><td>0</td><td>P0.10</td><td>P0.11</td></tr>
- * <tr><td>1</td><td>P2.30</td><td>P2.31</td></tr>
- * <tr><td>2</td><td>P4.20</td><td>P4.21</td></tr>
- * <tr><td rowspan=3>I2S</td><td>0</td><td>P0.4</td><td>P0.9</td></tr>
- * <tr><td rowspan=2>1</td><td>P0.23</td><td>P0.25</td></tr>
- * <tr><td>P2.11</td><td>P2.13</td></tr>
- * <tr><td rowspan=5>SSP 0</td><td>0</td><td>P0.15</td><td>P0.18</td></tr>
- * <tr><td rowspan=2>1</td><td>P1.20</td><td>P0.21</td></tr>
- * <tr><td>P1.23</td><td>P0.24</td></tr>
- * <tr><td rowspan=2>2</td><td>P2.22</td><td>P2.23</td></tr>
- * <tr><td>P2.26</td><td>P2.27</td></tr>
- * <tr><td rowspan=5>SSP 1</td><td>0</td><td>P0.6</td><td>P0.9</td></tr>
- * <tr><td rowspan=3>1</td><td>P0.12</td><td>P0.13</td></tr>
- * <tr><td>P0.14</td><td>P0.14</td></tr>
- * <tr><td>P1.31</td><td>P1.31</td></tr>
- * <tr><td>2</td><td>P4.20</td><td>P4.23</td></tr>
- * <tr><td rowspan=2>USB</td><td rowspan=2>0</td><td>P0.29</td><td>P0.30</td></tr>
- * <tr><td>P1.19</td><td>P1.19</td></tr>
- * <tr><td>SPI</td><td>0</td><td>P0.15</td><td>P0.18</td></tr>
- * <tr><td>PWM 1</td><td>0</td><td>P2.0</td><td>P2.0</td></tr>
- * <tr><td rowspan=11>LCD</td><td rowspan=6>0</td><td>P0.4</td><td>P0.9</td></tr>
- * <tr><td>P1.20</td><td>P1.29</td></tr>
- * <tr><td>P2.0</td><td>P2.3</td></tr>
- * <tr><td>P2.5</td><td>P2.9</td></tr>
- * <tr><td>P2.12</td><td>P2.13</td></tr>
- * <tr><td>P4.28</td><td>P4.29</td></tr>
- * <tr><td rowspan=5>1</td><td>P1.20</td><td>P1.29</td></tr>
- * <tr><td>P2.0</td><td>P2.3</td></tr>
- * <tr><td>P2.5</td><td>P2.9</td></tr>
- * <tr><td>P2.12</td><td>P2.13</td></tr>
- * <tr><td>P4.28</td><td>P4.29</td></tr>
- * <tr><td>DAC</td><td>0</td><td>P0.26</td><td>P0.26</td></tr>
- * </table>
- *
</font> * @{
*/
<font color='#997700'>@@ -182,33 +124,6 @@
</font> lpc24xx_module module
);
<font color='#880000'>-/**
- * @brief Applies the configuration with index @a config for the @a module.
- *
- * The pin mode will not be altered.
- *
- * @retval RTEMS_SUCCESSFUL Successful operation.
- * @retval RTEMS_INVALID_ID Invalid module or configuration.
- */
-rtems_status_code lpc24xx_io_config(
- lpc24xx_module module,
- unsigned config
-);
-
-/**
- * @brief Releases the configuration with index @a config for the @a module.
- *
- * The pins are set to general purpose IO function. The pin mode will not be
- * altered.
- *
- * @retval RTEMS_SUCCESSFUL Successful operation.
- * @retval RTEMS_INVALID_ID Invalid module or configuration.
- */
-rtems_status_code lpc24xx_io_release(
- lpc24xx_module module,
- unsigned config
-);
-
</font> rtems_status_code lpc24xx_gpio_config(
unsigned index,
lpc24xx_gpio_settings settings
<font color='#997700'>@@ -255,6 +170,650 @@
</font> }
}
<font color='#000088'>+typedef enum {
+ /**
+ * @brief Sets the pin function.
+ */
+ LPC24XX_PIN_SET_FUNCTION = 0,
+
+ /**
+ * @brief Checks if all pins are configured with the specified function.
+ */
+ LPC24XX_PIN_CHECK_FUNCTION,
+
+ /**
+ * @brief Configures the pins as input.
+ */
+ LPC24XX_PIN_SET_INPUT,
+
+ /**
+ * @brief Checks if all pins are configured as input.
+ */
+ LPC24XX_PIN_CHECK_INPUT
+} lpc24xx_pin_action;
+
+typedef union {
+ struct {
+ uint16_t port : 3;
+ uint16_t index_begin : 5;
+ uint16_t index_last : 5;
+ uint16_t function : 3;
+ } fields;
+ uint16_t value;
+} lpc24xx_pin_range;
+
+#define LPC24XX_PIN_FUNCTION_00 0x0
+#define LPC24XX_PIN_FUNCTION_01 0x1
+#define LPC24XX_PIN_FUNCTION_10 0x2
+#define LPC24XX_PIN_FUNCTION_11 0x3
+
+#define LPC24XX_PIN(p, i, f) { { p, i, i, f } }
+
+#define LPC24XX_PIN_RANGE(p, i, j, f) { { p, i, j, f } }
+
+#define LPC24XX_PIN_TERMINAL { { 0x3, 0x1f, 0x1f, 0x3 } }
+
+/**
+ * @brief Performs the @a action with the @a pins
+ *
+ * @code
+ * #include <assert.h>
+ * #include <bsp/io.h>
+ *<span style="background-color: #FF0000"> </span>
+ * void example(void)
+ * {
+ * static const lpc24xx_pin_range pins [] = {
+ * LPC24XX_PIN_I2S_RX_CLK_P0_4,
+ * LPC24XX_PIN_I2S_RX_WS_P0_5,
+ * LPC24XX_PIN_I2S_RX_SDA_P0_6,
+ * LPC24XX_PIN_I2S_TX_CLK_P0_7,
+ * LPC24XX_PIN_I2S_TX_WS_P0_8,
+ * LPC24XX_PIN_I2S_TX_SDA_P0_9,
+ * LPC24XX_PIN_TERMINAL
+ * };
+ * rtems_status_code sc = RTEMS_SUCCESSFUL;
+ *<span style="background-color: #FF0000"> </span>
+ * sc = lpc24xx_module_enable(LPC24XX_MODULE_I2S, LPC24XX_MODULE_CCLK_8);
+ * assert(sc == RTEMS_SUCCESSFUL);
+ * sc = lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
+ * assert(sc == RTEMS_SUCCESSFUL);
+ * }
+ * @endcode
+ *
+ * @retval RTEMS_SUCCESSFUL Successful operation.
+ * @retval RTEMS_IO_ERROR Check failed.
+ * @retval RTEMS_NOT_DEFINED Invalid action.
+ */
+rtems_status_code lpc24xx_pin_config(
+ const lpc24xx_pin_range *pins,
+ lpc24xx_pin_action action
+);
+
+/**
+ * @name ADC Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_ADC_CHANNEL_0 \
+ LPC24XX_PIN(0, 23, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_ADC_CHANNEL_1 \
+ LPC24XX_PIN(0, 24, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_ADC_CHANNEL_2 \
+ LPC24XX_PIN(0, 25, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_ADC_CHANNEL_3 \
+ LPC24XX_PIN(0, 26, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_ADC_CHANNEL_4 \
+ LPC24XX_PIN(1, 30, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_ADC_CHANNEL_5 \
+ LPC24XX_PIN(1, 31, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_ADC_CHANNEL_6 \
+ LPC24XX_PIN(0, 12, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_ADC_CHANNEL_7 \
+ LPC24XX_PIN(0, 13, LPC24XX_PIN_FUNCTION_11)
+
+/** @} */
+
+/**
+ * @name DAC Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_DAC \
+ LPC24XX_PIN(0, 26, LPC24XX_PIN_FUNCTION_10)
+
+/** @} */
+
+/**
+ * @name Ethernet Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_ETHERNET_MII \
+ LPC24XX_PIN_RANGE(1, 0, 17, LPC24XX_PIN_FUNCTION_01)
+
+#define LPC24XX_PIN_ETHERNET_RMII_0 \
+ LPC24XX_PIN_RANGE(1, 0, 1, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_ETHERNET_RMII_1 \
+ LPC24XX_PIN(1, 4, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_ETHERNET_RMII_2 \
+ LPC24XX_PIN_RANGE(1, 8, 10, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_ETHERNET_RMII_3 \
+ LPC24XX_PIN_RANGE(1, 14, 17, LPC24XX_PIN_FUNCTION_01)
+
+/** @} */
+
+/**
+ * @name I2C 0 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_I2C_0_SDA \
+ LPC24XX_PIN(0, 27, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_I2C_0_SCL \
+ LPC24XX_PIN(0, 28, LPC24XX_PIN_FUNCTION_01)
+
+/** @} */
+
+/**
+ * @name I2C 1 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_I2C_1_SDA_P0_0 \
+ LPC24XX_PIN(0, 0, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_I2C_1_SDA_P0_19 \
+ LPC24XX_PIN(0, 19, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_I2C_1_SDA_P2_14 \
+ LPC24XX_PIN(2, 14, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_I2C_1_SCL_P0_20 \
+ LPC24XX_PIN(0, 20, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_I2C_1_SCL_P0_1 \
+ LPC24XX_PIN(0, 1, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_I2C_1_SCL_P2_15 \
+ LPC24XX_PIN(2, 15, LPC24XX_PIN_FUNCTION_11)
+
+/** @} */
+
+/**
+ * @name I2C 2 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_I2C_2_SDA_P0_10 \
+ LPC24XX_PIN(0, 10, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_I2C_2_SDA_P2_30 \
+ LPC24XX_PIN(2, 30, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_I2C_2_SDA_P4_20 \
+ LPC24XX_PIN(4, 20, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_I2C_2_SCL_P2_31 \
+ LPC24XX_PIN(2, 31, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_I2C_2_SCL_P0_11 \
+ LPC24XX_PIN(0, 11, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_I2C_2_SCL_P4_21 \
+ LPC24XX_PIN(4, 21, LPC24XX_PIN_FUNCTION_10)
+
+/** @} */
+
+/**
+ * @name I2S Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_I2S_RX_CLK_P0_4 \
+ LPC24XX_PIN(0, 4, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_I2S_RX_CLK_P0_23 \
+ LPC24XX_PIN(0, 23, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_I2S_RX_WS_P0_5 \
+ LPC24XX_PIN(0, 5, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_I2S_RX_WS_P0_24 \
+ LPC24XX_PIN(0, 24, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_I2S_RX_SDA_P0_6 \
+ LPC24XX_PIN(0, 6, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_I2S_RX_SDA_P0_25 \
+ LPC24XX_PIN(0, 25, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_I2S_TX_CLK_P0_7 \
+ LPC24XX_PIN(0, 7, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_I2S_TX_CLK_P2_11 \
+ LPC24XX_PIN(2, 11, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_I2S_TX_WS_P0_8 \
+ LPC24XX_PIN(0, 8, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_I2S_TX_WS_P2_12 \
+ LPC24XX_PIN(2, 12, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_I2S_TX_SDA_P0_9 \
+ LPC24XX_PIN(0, 9, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_I2S_TX_SDA_P2_13 \
+ LPC24XX_PIN(2, 13, LPC24XX_PIN_FUNCTION_11)
+
+/** @} */
+
+/**
+ * @name LCD Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_LCD_PWR \
+ LPC24XX_PIN(2, 0, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_LE \
+ LPC24XX_PIN(2, 1, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_DCLK \
+ LPC24XX_PIN(2, 2, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_FP \
+ LPC24XX_PIN(2, 3, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_ENAB_M \
+ LPC24XX_PIN(2, 4, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_LP \
+ LPC24XX_PIN(2, 5, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_CLKIN \
+ LPC24XX_PIN(2, 11, LPC24XX_PIN_FUNCTION_01)
+
+#define LPC24XX_PIN_LCD_VD_P0_4 \
+ LPC24XX_PIN(0, 4, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P0_5 \
+ LPC24XX_PIN(0, 5, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P0_6 \
+ LPC24XX_PIN(0, 6, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P0_7 \
+ LPC24XX_PIN(0, 7, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P0_8 \
+ LPC24XX_PIN(0, 8, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P0_9 \
+ LPC24XX_PIN(0, 9, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_20 \
+ LPC24XX_PIN(1, 20, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_21 \
+ LPC24XX_PIN(1, 21, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_22 \
+ LPC24XX_PIN(1, 22, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_23 \
+ LPC24XX_PIN(1, 23, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_24 \
+ LPC24XX_PIN(1, 24, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_25 \
+ LPC24XX_PIN(1, 25, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_26 \
+ LPC24XX_PIN(1, 26, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_27 \
+ LPC24XX_PIN(1, 27, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_28 \
+ LPC24XX_PIN(1, 28, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P1_29 \
+ LPC24XX_PIN(1, 29, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P2_6 \
+ LPC24XX_PIN(2, 6, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_VD_P2_7 \
+ LPC24XX_PIN(2, 7, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_VD_P2_8 \
+ LPC24XX_PIN(2, 8, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_VD_P2_9 \
+ LPC24XX_PIN(2, 9, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_LCD_VD_P2_12 \
+ LPC24XX_PIN(2, 12, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P2_13 \
+ LPC24XX_PIN(2, 13, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_LCD_VD_P4_28 \
+ LPC24XX_PIN(4, 28, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_LCD_VD_P4_29 \
+ LPC24XX_PIN(4, 29, LPC24XX_PIN_FUNCTION_10)
+
+/** @} */
+
+/**
+ * @name PWM 0 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_PWM_0_CHANNEL_1_P1_2 \
+ LPC24XX_PIN(1, 2, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_PWM_0_CHANNEL_1_P3_16 \
+ LPC24XX_PIN(3, 16, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_PWM_0_CHANNEL_2_P1_3 \
+ LPC24XX_PIN(1, 3, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_PWM_0_CHANNEL_2_P3_17 \
+ LPC24XX_PIN(3, 17, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_PWM_0_CHANNEL_3_P1_5 \
+ LPC24XX_PIN(1, 5, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_PWM_0_CHANNEL_3_P3_18 \
+ LPC24XX_PIN(3, 18, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_PWM_0_CHANNEL_4_P1_6 \
+ LPC24XX_PIN(1, 6, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_PWM_0_CHANNEL_4_P3_19 \
+ LPC24XX_PIN(3, 19, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_PWM_0_CHANNEL_5_P1_7 \
+ LPC24XX_PIN(1, 7, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_PWM_0_CHANNEL_5_P3_20 \
+ LPC24XX_PIN(3, 20, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_PWM_0_CHANNEL_6_P1_11 \
+ LPC24XX_PIN(1, 11, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_PWM_0_CHANNEL_6_P3_21 \
+ LPC24XX_PIN(3, 21, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_PWM_0_CAPTURE_0_P1_12 \
+ LPC24XX_PIN(1, 12, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_PWM_0_CAPTURE_0_P3_22 \
+ LPC24XX_PIN(3, 22, LPC24XX_PIN_FUNCTION_10)
+
+/** @} */
+
+/**
+ * @name PWM 1 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_PWM_1_CHANNEL_1_P1_18 \
+ LPC24XX_PIN(1, 18, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_PWM_1_CHANNEL_1_P2_0 \
+ LPC24XX_PIN(2, 0, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_PWM_1_CHANNEL_1_P3_24 \
+ LPC24XX_PIN(3, 24, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_PWM_1_CHANNEL_2_P1_20 \
+ LPC24XX_PIN(1, 20, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_PWM_1_CHANNEL_2_P2_1 \
+ LPC24XX_PIN(2, 1, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_PWM_1_CHANNEL_2_P3_25 \
+ LPC24XX_PIN(3, 25, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_PWM_1_CHANNEL_3_P1_21 \
+ LPC24XX_PIN(1, 21, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_PWM_1_CHANNEL_3_P2_2 \
+ LPC24XX_PIN(2, 2, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_PWM_1_CHANNEL_3_P3_26 \
+ LPC24XX_PIN(3, 26, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_PWM_1_CHANNEL_4_P1_23 \
+ LPC24XX_PIN(1, 23, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_PWM_1_CHANNEL_4_P2_3 \
+ LPC24XX_PIN(2, 3, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_PWM_1_CHANNEL_4_P3_27 \
+ LPC24XX_PIN(3, 27, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_PWM_1_CHANNEL_5_P1_24 \
+ LPC24XX_PIN(1, 24, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_PWM_1_CHANNEL_5_P2_4 \
+ LPC24XX_PIN(2, 4, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_PWM_1_CHANNEL_5_P3_28 \
+ LPC24XX_PIN(3, 28, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_PWM_1_CHANNEL_6_P1_26 \
+ LPC24XX_PIN(1, 26, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_PWM_1_CHANNEL_6_P2_5 \
+ LPC24XX_PIN(2, 5, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_PWM_1_CHANNEL_6_P3_29 \
+ LPC24XX_PIN(3, 29, LPC24XX_PIN_FUNCTIO9_11)
+
+#define LPC24XX_PIN_PWM_1_CAPTURE_0_P1_28 \
+ LPC24XX_PIN(1, 28, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_PWM_1_CAPTURE_0_P2_7 \
+ LPC24XX_PIN(2, 6, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_PWM_1_CAPTURE_0_P3_23 \
+ LPC24XX_PIN(3, 23, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_PWM_1_CAPTURE_1_P1_29 \
+ LPC24XX_PIN(1, 29, LPC24XX_PIN_FUNCTION_10)
+
+/** @} */
+
+/**
+ * @name SPI Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_SPI_SCK \
+ LPC24XX_PIN(0, 15, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_SPI_SSEL \
+ LPC24XX_PIN(0, 16, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_SPI_MISO \
+ LPC24XX_PIN(0, 17, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_SPI_MOSI \
+ LPC24XX_PIN(0, 18, LPC24XX_PIN_FUNCTION_11)
+
+/** @} */
+
+/**
+ * @name SSP 0 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_SSP_0_SCK_P0_15 \
+ LPC24XX_PIN(0, 15, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_0_SCK_P1_20 \
+ LPC24XX_PIN(1, 20, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_SSP_0_SCK_P2_22 \
+ LPC24XX_PIN(2, 22, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_SSP_0_SSEL_P0_16 \
+ LPC24XX_PIN(0, 16, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_0_SSEL_P1_21 \
+ LPC24XX_PIN(1, 21, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_SSP_0_SSEL_P2_23 \
+ LPC24XX_PIN(2, 23, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_SSP_0_MISO_P0_17 \
+ LPC24XX_PIN(0, 17, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_0_MISO_P1_23 \
+ LPC24XX_PIN(1, 23, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_SSP_0_MISO_P2_26 \
+ LPC24XX_PIN(2, 26, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_SSP_0_MOSI_P0_18 \
+ LPC24XX_PIN(0, 18, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_0_MOSI_P1_24 \
+ LPC24XX_PIN(1, 24, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_SSP_0_MOSI_P2_27 \
+ LPC24XX_PIN(2, 27, LPC24XX_PIN_FUNCTION_11)
+
+/** @} */
+
+/**
+ * @name SSP 1 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_SSP_1_SCK_P0_6 \
+ LPC24XX_PIN(0, 6, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_1_SCK_P0_12 \
+ LPC24XX_PIN(0, 12, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_1_SCK_P4_20 \
+ LPC24XX_PIN(4, 20, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_SSP_1_SSEL_P0_7 \
+ LPC24XX_PIN(0, 7, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_1_SSEL_P0_13 \
+ LPC24XX_PIN(0, 13, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_1_SSEL_P4_21 \
+ LPC24XX_PIN(4, 21, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_SSP_1_MISO_P0_8 \
+ LPC24XX_PIN(0, 8, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_1_MISO_P0_14 \
+ LPC24XX_PIN(0, 14, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_SSP_1_MISO_P4_22 \
+ LPC24XX_PIN(4, 22, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_SSP_1_MOSI_P0_9 \
+ LPC24XX_PIN(0, 9, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_1_MOSI_P1_31 \
+ LPC24XX_PIN(1, 31, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_SSP_1_MOSI_P4_23 \
+ LPC24XX_PIN(4, 23, LPC24XX_PIN_FUNCTION_11)
+
+/** @} */
+
+/**
+ * @name UART 0 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_UART_0_TXD \
+ LPC24XX_PIN(0, 2, LPC24XX_PIN_FUNCTION_01)
+
+#define LPC24XX_PIN_UART_0_RXD \
+ LPC24XX_PIN(0, 3, LPC24XX_PIN_FUNCTION_01)
+
+/** @} */
+
+/**
+ * @name UART 1 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_UART_1_TXD_P0_15 \
+ LPC24XX_PIN(0, 15, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_UART_1_TXD_P2_0 \
+ LPC24XX_PIN(2, 0, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_UART_1_TXD_P3_16 \
+ LPC24XX_PIN(3, 16, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_UART_1_RXD_P0_16 \
+ LPC24XX_PIN(0, 16, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_UART_1_RXD_P2_1 \
+ LPC24XX_PIN(2, 1, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_UART_1_RXD_P3_17 \
+ LPC24XX_PIN(3, 17, LPC24XX_PIN_FUNCTION_11)
+
+/** @} */
+
+/**
+ * @name UART 2 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_UART_2_TXD_P0_10 \
+ LPC24XX_PIN(0, 10, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_UART_2_TXD_P2_8 \
+ LPC24XX_PIN(2, 8, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_UART_2_TXD_P4_22 \
+ LPC24XX_PIN(4, 22, LPC24XX_PIN_FUNCTION_10)
+
+#define LPC24XX_PIN_UART_2_RXD_P0_11 \
+ LPC24XX_PIN(0, 11, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_UART_2_RXD_P2_9 \
+ LPC24XX_PIN(2, 9, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_UART_2_RXD_P4_23 \
+ LPC24XX_PIN(4, 23, LPC24XX_PIN_FUNCTION_10)
+
+/** @} */
+
+/**
+ * @name UART 3 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_UART_3_TXD_P0_0 \
+ LPC24XX_PIN(0, 0, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_UART_3_TXD_P0_25 \
+ LPC24XX_PIN(0, 25, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_UART_3_TXD_P4_28 \
+ LPC24XX_PIN(4, 28, LPC24XX_PIN_FUNCTION_11)
+
+#define LPC24XX_PIN_UART_3_RXD_P0_1 \
+ LPC24XX_PIN(0, 1, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_UART_3_RXD_P0_25 \
+ LPC24XX_PIN(0, 26, LPC24XX_PIN_FUNCTION_11)
+#define LPC24XX_PIN_UART_3_RXD_P4_29 \
+ LPC24XX_PIN(4, 29, LPC24XX_PIN_FUNCTION_11)
+
+/** @} */
+
+/**
+ * @name USB Port 1 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_USB_D_PLUS_1\
+ LPC24XX_PIN(0, 29, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_D_MINUS_1\
+ LPC24XX_PIN(0, 30, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_UP_LED_1\
+ LPC24XX_PIN(1, 18, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_TX_E_1\
+ LPC24XX_PIN(1, 19, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_PPWR_1\
+ LPC24XX_PIN(1, 19, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_USB_TX_DP_1\
+ LPC24XX_PIN(1, 20, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_TX_DM_1\
+ LPC24XX_PIN(1, 21, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_RCV_1\
+ LPC24XX_PIN(1, 22, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_PWRD_1\
+ LPC24XX_PIN(1, 22, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_USB_RX_DP_1\
+ LPC24XX_PIN(1, 23, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_RX_DM_1\
+ LPC24XX_PIN(1, 24, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_LS_1\
+ LPC24XX_PIN(1, 25, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_HSTEN_1\
+ LPC24XX_PIN(1, 25, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_USB_SSPND_1\
+ LPC24XX_PIN(1, 26, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_INT_1\
+ LPC24XX_PIN(1, 27, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_OVRCR_1\
+ LPC24XX_PIN(1, 27, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_USB_SCL_1\
+ LPC24XX_PIN(1, 28, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_SDA_1\
+ LPC24XX_PIN(1, 29, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_CONNECT_1\
+ LPC24XX_PIN(2, 9, LPC24XX_PIN_FUNCTION_01)
+
+/** @} */
+
+/**
+ * @name USB Port 2 Pins
+ *
+ * @{
+ */
+
+#define LPC24XX_PIN_USB_PPWR_2\
+ LPC24XX_PIN(0, 12, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_UP_LED_2\
+ LPC24XX_PIN(0, 13, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_HSTEN_2\
+ LPC24XX_PIN(0, 14, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_CONNECT_2\
+ LPC24XX_PIN(0, 14, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_D_PLUS_2\
+ LPC24XX_PIN(0, 31, LPC24XX_PIN_FUNCTION_10)
+#define LPC24XX_PIN_USB_PWRD_2\
+ LPC24XX_PIN(1, 30, LPC24XX_PIN_FUNCTION_01)
+#define LPC24XX_PIN_USB_OVRCR_2\
+ LPC24XX_PIN(1, 31, LPC24XX_PIN_FUNCTION_01)
+
+/** @} */
+
</font> /** @} */
#ifdef __cplusplus
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/include/lcd.h:1.1 rtems/c/src/lib/libbsp/arm/lpc24xx/include/lcd.h:1.2
--- rtems/c/src/lib/libbsp/arm/lpc24xx/include/lcd.h:1.1 Fri Dec 3 03:56:48 2010
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/include/lcd.h Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -25,6 +25,8 @@
</font>
#include <rtems.h>
<font color='#000088'>+#include <bsp/io.h>
+
</font> #ifdef __cplusplus
extern "C" {
#endif
<font color='#997700'>@@ -54,16 +56,16 @@
</font> /**
* @brief Set the LCD @a mode.
*
<font color='#880000'>- * The pins are configured according to the @a pin_config.
</font><font color='#000088'>+ * The pins are configured according to @a pins.
</font> *
<font color='#880000'>- * @see lpc24xx_io_config() and lpc24xx_io_release().
</font><font color='#000088'>+ * @see lpc24xx_pin_config().
</font> *
* @retval RTEMS_SUCCESSFUL Successful operation.
* @retval RTEMS_IO_ERROR Invalid mode.
*/
rtems_status_code lpc24xx_lcd_set_mode(
lpc24xx_lcd_mode mode,
<font color='#880000'>- unsigned pin_config
</font><font color='#000088'>+ const lpc24xx_pin_range *pins
</font> );
lpc24xx_lcd_mode lpc24xx_lcd_current_mode(void);
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc-ethernet-config.h:1.2 rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc-ethernet-config.h:1.3
--- rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc-ethernet-config.h:1.2 Fri Mar 12 02:25:53 2010
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc-ethernet-config.h Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2009-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -47,14 +48,27 @@
</font>
static void lpc_eth_config_module_enable(void)
{
<font color='#000088'>+ static const lpc24xx_pin_range pins [] = {
+ LPC24XX_PIN_ETHERNET_RMII_0,
+ LPC24XX_PIN_ETHERNET_RMII_1,
+ LPC24XX_PIN_ETHERNET_RMII_2,
+ LPC24XX_PIN_ETHERNET_RMII_3,
+ LPC24XX_PIN_TERMINAL
+ };
+
</font> lpc24xx_module_enable(LPC24XX_MODULE_ETHERNET, LPC24XX_MODULE_PCLK_DEFAULT);
<font color='#880000'>- lpc24xx_io_config(LPC24XX_MODULE_ETHERNET, 1);
</font><font color='#000088'>+ lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
</font> }
#else
static void lpc_eth_config_module_enable(void)
{
<font color='#000088'>+ static const lpc24xx_pin_range pins [] = {
+ LPC24XX_PIN_ETHERNET_MII,
+ LPC24XX_PIN_TERMINAL
+ };
+
</font> lpc24xx_module_enable(LPC24XX_MODULE_ETHERNET, LPC24XX_MODULE_PCLK_DEFAULT);
<font color='#880000'>- lpc24xx_io_config(LPC24XX_MODULE_ETHERNET, 0);
</font><font color='#000088'>+ lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
</font> }
#endif
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc24xx.h:1.13 rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc24xx.h:1.14
--- rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc24xx.h:1.13 Fri Dec 3 03:56:48 2010
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/include/lpc24xx.h Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -1913,30 +1913,6 @@
</font> #define SET_AHBCFG_EP5(reg, val) \
SET_FIELD(reg, val, AHBCFG_EP5_MASK, 28)
<font color='#880000'>-/* EMC */
-
-#define EMC_DYN_CTRL_CE 0x00000001U
-
-#define EMC_DYN_CTRL_CS 0x00000002U
-
-#define EMC_DYN_CTRL_CMD_NORMAL 0x00000000U
-
-#define EMC_DYN_CTRL_CMD_MODE 0x00000080U
-
-#define EMC_DYN_CTRL_CMD_PALL 0x00000100U
-
-#define EMC_DYN_CTRL_CMD_NOP 0x00000180U
-
-typedef struct {
- uint32_t cfg;
- uint32_t waitwen;
- uint32_t waitoen;
- uint32_t waitrd;
- uint32_t waitpage;
- uint32_t waitwr;
- uint32_t waitrun;
-} lpc24xx_emc_static;
-
</font> /* I2C */
typedef struct {
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/misc/dma.c:1.7 rtems/c/src/lib/libbsp/arm/lpc24xx/misc/dma.c:1.8
--- rtems/c/src/lib/libbsp/arm/lpc24xx/misc/dma.c:1.7 Thu May 20 09:23:13 2010
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/misc/dma.c Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2008, 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -38,19 +39,21 @@
</font> /* Disable module */
GPDMA_CONFIG = 0;
<font color='#880000'>- /* Enable module */
- #if BYTE_ORDER == LITTLE_ENDIAN
- GPDMA_CONFIG = GPDMA_CONFIG_EN;
- #else
- GPDMA_CONFIG = GPDMA_CONFIG_EN | GPDMA_CONFIG_MODE;
- #endif
-
</font> /* Reset registers */
GPDMA_SOFT_SREQ = 0;
GPDMA_SOFT_BREQ = 0;
GPDMA_SOFT_LSREQ = 0;
GPDMA_SOFT_LBREQ = 0;
GPDMA_SYNC = 0;
<font color='#000088'>+ GPDMA_CH0_CFG = 0;
+ GPDMA_CH1_CFG = 0;
+
+ /* Enable module */
+ #if BYTE_ORDER == LITTLE_ENDIAN
+ GPDMA_CONFIG = GPDMA_CONFIG_EN;
+ #else
+ GPDMA_CONFIG = GPDMA_CONFIG_EN | GPDMA_CONFIG_MODE;
+ #endif
</font> }
rtems_status_code lpc24xx_dma_channel_obtain(unsigned channel)
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/misc/io.c:1.8 rtems/c/src/lib/libbsp/arm/lpc24xx/misc/io.c:1.9
--- rtems/c/src/lib/libbsp/arm/lpc24xx/misc/io.c:1.8 Fri Dec 3 03:56:48 2010
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/misc/io.c Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2009, 2010
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2009-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -22,193 +23,11 @@
</font> #include <bsp/io.h>
#include <bsp/system-clocks.h>
<font color='#880000'>-#define LPC24XX_IO_SELECT(pin) (pin >> 4U)
-
-#define LPC24XX_IO_SELECT_SHIFT(pin) ((pin & 0xfU) << 1U)
-
-#define LPC24XX_IO_SELECT_MASK 0x3U
-
-#define LPC24XX_IO_PRIMARY 0x0U
-
-#define LPC24XX_IO_ALTERNATE_0 0x1U
-
-#define LPC24XX_IO_ALTERNATE_1 0x2U
-
-#define LPC24XX_IO_ALTERNATE_2 0x3U
-
-#define LPC24XX_IO_ENTRY(mod, cfg, begin_port, begin_index, last_port, last_index, function) \
- { \
- .module = mod, \
- .config = cfg, \
- .pin_begin = LPC24XX_IO_INDEX_BY_PORT(begin_port, begin_index), \
- .pin_last = LPC24XX_IO_INDEX_BY_PORT(last_port, last_index), \
- .pin_function = function \
- }
-
-typedef struct {
- unsigned module : 6;
- unsigned config : 4;
- unsigned pin_begin : 8;
- unsigned pin_last : 8;
- unsigned pin_function : 3;
-} lpc24xx_io_entry;
-
-typedef void (*lpc24xx_io_iterate_routine)(unsigned pin, unsigned function);
-
-static const lpc24xx_io_entry lpc24xx_io_config_table [] = {
- /* UART */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_0, 0, 0, 2, 0, 3, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_1, 0, 0, 15, 0, 16, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_1, 1, 2, 0, 2, 1, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_1, 2, 3, 16, 3, 17, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_2, 0, 0, 10, 0, 11, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_2, 1, 2, 8, 2, 9, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_2, 2, 4, 22, 4, 23, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_3, 0, 0, 0, 0, 1, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_3, 1, 0, 25, 0, 26, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_UART_3, 2, 4, 28, 4, 29, LPC24XX_IO_ALTERNATE_2),
-
- /* Ethernet */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_ETHERNET, 0, 1, 0, 1, 17, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_ETHERNET, 1, 1, 0, 1, 1, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_ETHERNET, 1, 1, 4, 1, 4, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_ETHERNET, 1, 1, 8, 1, 10, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_ETHERNET, 1, 1, 14, 1, 17, LPC24XX_IO_ALTERNATE_0),
-
- /* ADC */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_ADC, 0, 0, 12, 0, 13, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_ADC, 1, 0, 23, 0, 25, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_ADC, 2, 0, 26, 0, 26, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_ADC, 2, 1, 30, 1, 31, LPC24XX_IO_ALTERNATE_2),
-
- /* I2C */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2C_0, 0, 0, 27, 0, 28, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2C_1, 0, 0, 0, 0, 1, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2C_1, 1, 0, 19, 0, 20, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2C_1, 2, 2, 14, 2, 15, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2C_2, 0, 0, 10, 0, 11, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2C_2, 1, 2, 30, 2, 31, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2C_2, 2, 4, 20, 4, 21, LPC24XX_IO_ALTERNATE_1),
-
- /* I2S */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2S, 0, 0, 4, 0, 9, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2S, 1, 0, 23, 0, 25, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_I2S, 1, 2, 11, 2, 13, LPC24XX_IO_ALTERNATE_2),
-
- /* SSP */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_0, 0, 0, 15, 0, 18, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_0, 1, 1, 20, 0, 21, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_0, 1, 1, 23, 0, 24, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_0, 2, 2, 22, 2, 23, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_0, 2, 2, 26, 2, 27, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_1, 0, 0, 6, 0, 9, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_1, 1, 0, 12, 0, 13, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_1, 1, 0, 14, 0, 14, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_1, 1, 1, 31, 1, 31, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SSP_1, 2, 4, 20, 4, 23, LPC24XX_IO_ALTERNATE_2),
-
- /* USB */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_USB, 0, 0, 29, 0, 30, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_USB, 0, 1, 19, 1, 19, LPC24XX_IO_ALTERNATE_1),
-
- /* SPI */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_SPI, 0, 0, 15, 0, 18, LPC24XX_IO_ALTERNATE_2),
-
- /* PWM */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_PWM_1, 0, 2, 0, 2, 0, LPC24XX_IO_ALTERNATE_0),
-
- /* LCD */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 0, 0, 4, 0, 9, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 0, 1, 20, 1, 29, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 0, 2, 0, 2, 3, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 0, 2, 5, 2, 9, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 0, 2, 12, 2, 13, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 0, 4, 28, 4, 29, LPC24XX_IO_ALTERNATE_1),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 1, 1, 20, 1, 29, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 1, 2, 0, 2, 3, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 1, 2, 5, 2, 9, LPC24XX_IO_ALTERNATE_2),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 1, 2, 12, 2, 13, LPC24XX_IO_ALTERNATE_0),
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_LCD, 1, 4, 28, 4, 29, LPC24XX_IO_ALTERNATE_1),
-
- /* DAC */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_DAC, 0, 0, 26, 0, 26, LPC24XX_IO_ALTERNATE_1),
-
- /* Terminate */
- LPC24XX_IO_ENTRY(LPC24XX_MODULE_COUNT, 0, 0, 0, 0, 0, 0)
-};
-
-static rtems_status_code lpc24xx_io_iterate(
- lpc24xx_module module,
- unsigned config,
- lpc24xx_io_iterate_routine routine
-)
-{
- rtems_status_code sc = RTEMS_SUCCESSFUL;
- const lpc24xx_io_entry *e = &lpc24xx_io_config_table [0];
-
- while (e->module != LPC24XX_MODULE_COUNT) {
- if (e->module == module && e->config == config) {
- unsigned pin = e->pin_begin;
- unsigned last = e->pin_last;
- unsigned function = e->pin_function;
-
- while (pin <= last) {
- (*routine)(pin, function);
-
- ++pin;
- }
-
- sc = RTEMS_SUCCESSFUL;
- }
- ++e;
- }
-
- return sc;
-}
-
-static void lpc24xx_io_do_config(unsigned pin, unsigned function)
-{
- rtems_interrupt_level level;
- unsigned select = LPC24XX_IO_SELECT(pin);
- unsigned shift = LPC24XX_IO_SELECT_SHIFT(pin);
- unsigned mask = LPC24XX_IO_SELECT_MASK << shift;
- unsigned pinsel = 0;
</font><font color='#000088'>+#define LPC24XX_PIN_SELECT(pin) (pin >> 4U)
</font>
<font color='#880000'>- rtems_interrupt_disable(level);
- pinsel = LPC24XX_PINSEL [select];
- pinsel &= ~mask;
- pinsel |= (function & LPC24XX_IO_SELECT_MASK) << shift;
- LPC24XX_PINSEL [select] = pinsel;
- rtems_interrupt_enable(level);
-}
-
-static void lpc24xx_io_do_release(unsigned pin, unsigned function)
-{
- rtems_interrupt_level level;
- unsigned select = LPC24XX_IO_SELECT(pin);
- unsigned shift = LPC24XX_IO_SELECT_SHIFT(pin);
- unsigned mask = LPC24XX_IO_SELECT_MASK << shift;
</font><font color='#000088'>+#define LPC24XX_PIN_SELECT_SHIFT(pin) ((pin & 0xfU) << 1U)
</font>
<font color='#880000'>- rtems_interrupt_disable(level);
- LPC24XX_PINSEL [select] &= ~mask;
- rtems_interrupt_enable(level);
-}
-
-rtems_status_code lpc24xx_io_config(
- lpc24xx_module module,
- unsigned config
-)
-{
- return lpc24xx_io_iterate(module, config, lpc24xx_io_do_config);
-}
-
-rtems_status_code lpc24xx_io_release(
- lpc24xx_module module,
- unsigned config
-)
-{
- return lpc24xx_io_iterate(module, config, lpc24xx_io_do_release);
-}
</font><font color='#000088'>+#define LPC24XX_PIN_SELECT_MASK 0x3U
</font>
rtems_status_code lpc24xx_gpio_config(
unsigned pin,
<font color='#997700'>@@ -219,8 +38,8 @@
</font> rtems_interrupt_level level;
unsigned port = LPC24XX_IO_PORT(pin);
unsigned bit = LPC24XX_IO_PORT_BIT(pin);
<font color='#880000'>- unsigned select = LPC24XX_IO_SELECT(pin);
- unsigned shift = LPC24XX_IO_SELECT_SHIFT(pin);
</font><font color='#000088'>+ unsigned select = LPC24XX_PIN_SELECT(pin);
+ unsigned shift = LPC24XX_PIN_SELECT_SHIFT(pin);
</font> unsigned resistor = settings & LPC24XX_GPIO_RESISTOR_MASK;
unsigned output = (settings & LPC24XX_GPIO_OUTPUT) != 0 ? 1U : 0U;
<font color='#997700'>@@ -244,8 +63,8 @@
</font>
/* Resistor */
LPC24XX_PINMODE [select] =
<font color='#880000'>- (LPC24XX_PINMODE [select] & ~(LPC24XX_IO_SELECT_MASK << shift))
- | ((resistor & LPC24XX_IO_SELECT_MASK) << shift);
</font><font color='#000088'>+ (LPC24XX_PINMODE [select] & ~(LPC24XX_PIN_SELECT_MASK << shift))
+ | ((resistor & LPC24XX_PIN_SELECT_MASK) << shift);
</font>
rtems_interrupt_flash(level);
<font color='#997700'>@@ -392,3 +211,124 @@
</font> {
return lpc24xx_module_do_enable(module, 0U, false);
}
<font color='#000088'>+
+typedef rtems_status_code (*lpc24xx_pin_visitor)(
+ volatile uint32_t *pinsel,
+ uint32_t pinsel_mask,
+ uint32_t pinsel_value,
+ volatile uint32_t *fio_dir,
+ uint32_t fio_bit
+);
+
+static rtems_status_code lpc24xx_pin_set_function(
+ volatile uint32_t *pinsel,
+ uint32_t pinsel_mask,
+ uint32_t pinsel_value,
+ volatile uint32_t *fio_dir,
+ uint32_t fio_bit
+)
+{
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable(level);
+ *pinsel = (*pinsel & ~pinsel_mask) | pinsel_value;
+ rtems_interrupt_enable(level);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+static rtems_status_code lpc24xx_pin_check_function(
+ volatile uint32_t *pinsel,
+ uint32_t pinsel_mask,
+ uint32_t pinsel_value,
+ volatile uint32_t *fio_dir,
+ uint32_t fio_bit
+)
+{
+ if ((*pinsel & pinsel_mask) == pinsel_value) {
+ return RTEMS_SUCCESSFUL;
+ } else {
+ return RTEMS_IO_ERROR;
+ }
+}
+
+static rtems_status_code lpc24xx_pin_set_input(
+ volatile uint32_t *pinsel,
+ uint32_t pinsel_mask,
+ uint32_t pinsel_value,
+ volatile uint32_t *fio_dir,
+ uint32_t fio_bit
+)
+{
+ rtems_interrupt_level level;
+
+ rtems_interrupt_disable(level);
+ *fio_dir &= ~fio_bit;
+ *pinsel &= ~pinsel_mask;
+ rtems_interrupt_enable(level);
+
+ return RTEMS_SUCCESSFUL;
+}
+
+static rtems_status_code lpc24xx_pin_check_input(
+ volatile uint32_t *pinsel,
+ uint32_t pinsel_mask,
+ uint32_t pinsel_value,
+ volatile uint32_t *fio_dir,
+ uint32_t fio_bit
+)
+{
+ if ((*pinsel & pinsel_mask) == 0 && (*fio_dir & fio_bit) == 0) {
+ return RTEMS_SUCCESSFUL;
+ } else {
+ return RTEMS_IO_ERROR;
+ }
+}
+
+static const lpc24xx_pin_visitor lpc24xx_pin_visitors [] = {
+ [LPC24XX_PIN_SET_FUNCTION] = lpc24xx_pin_set_function,
+ [LPC24XX_PIN_CHECK_FUNCTION] = lpc24xx_pin_check_function,
+ [LPC24XX_PIN_SET_INPUT] = lpc24xx_pin_set_input,
+ [LPC24XX_PIN_CHECK_INPUT] = lpc24xx_pin_check_input
+};
+
+rtems_status_code lpc24xx_pin_config(
+ const lpc24xx_pin_range *pins,
+ lpc24xx_pin_action action
+)
+{
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
+
+ if ((unsigned) action <= LPC24XX_PIN_CHECK_INPUT) {
+ lpc24xx_pin_visitor visitor = lpc24xx_pin_visitors [action];
+ lpc24xx_pin_range terminal = LPC24XX_PIN_TERMINAL;
+
+ while (sc == RTEMS_SUCCESSFUL && pins->value != terminal.value) {
+ uint32_t port = pins->fields.port;
+ uint32_t index = pins->fields.index_begin;
+ uint32_t last = pins->fields.index_last;
+ uint32_t function = pins->fields.function;
+ volatile uint32_t *fio_dir = &LPC24XX_FIO [port].dir;
+
+ while (sc == RTEMS_SUCCESSFUL && index <= last) {
+ uint32_t pin = LPC24XX_IO_INDEX_BY_PORT(port, index);
+ uint32_t select = LPC24XX_PIN_SELECT(pin);
+ uint32_t shift = LPC24XX_PIN_SELECT_SHIFT(pin);
+ volatile uint32_t *pinsel = &LPC24XX_PINSEL [select];
+ uint32_t pinsel_mask = LPC24XX_PIN_SELECT_MASK << shift;
+ uint32_t pinsel_value = (function & LPC24XX_PIN_SELECT_MASK) << shift;
+ uint32_t fio_bit = 1U << index;
+
+ sc = (*visitor)(pinsel, pinsel_mask, pinsel_value, fio_dir, fio_bit);
+
+ ++index;
+ }
+
+ ++pins;
+ }
+ } else {
+ sc = RTEMS_NOT_DEFINED;
+ }
+
+ return sc;
+}
</font>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/misc/lcd.c:1.1 rtems/c/src/lib/libbsp/arm/lpc24xx/misc/lcd.c:1.2
--- rtems/c/src/lib/libbsp/arm/lpc24xx/misc/lcd.c:1.1 Fri Dec 3 03:56:48 2010
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/misc/lcd.c Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -23,14 +23,16 @@
</font> #include <assert.h>
#include <bsp/lpc24xx.h>
<font color='#880000'>-#include <bsp/io.h>
</font> #include <bsp/lcd.h>
#include <bsp/utility.h>
#include <bsp/system-clocks.h>
#define LCD_ENABLE BSP_BIT32(0)
<font color='#880000'>-rtems_status_code lpc24xx_lcd_set_mode(lpc24xx_lcd_mode mode, unsigned pin_config)
</font><font color='#000088'>+rtems_status_code lpc24xx_lcd_set_mode(
+ lpc24xx_lcd_mode mode,
+ const lpc24xx_pin_range *pins
+)
</font> {
rtems_status_code sc = RTEMS_SUCCESSFUL;
bool enable = false;
<font color='#997700'>@@ -61,7 +63,7 @@
</font>
PINSEL11 = BSP_FLD32(mode, 1, 3) | LCD_ENABLE;
<font color='#880000'>- sc = lpc24xx_io_config(LPC24XX_MODULE_LCD, pin_config);
</font><font color='#000088'>+ sc = lpc24xx_pin_config(pins, LPC24XX_PIN_SET_FUNCTION);
</font> assert(sc == RTEMS_SUCCESSFUL);
} else {
if (lpc24xx_lcd_current_mode() != LCD_MODE_DISABLED) {
<font color='#997700'>@@ -78,7 +80,7 @@
</font> LCD_CTRL = lcd_ctrl;
}
<font color='#880000'>- sc = lpc24xx_io_release(LPC24XX_MODULE_LCD, pin_config);
</font><font color='#000088'>+ sc = lpc24xx_pin_config(pins, LPC24XX_PIN_SET_INPUT);
</font> assert(sc == RTEMS_SUCCESSFUL);
PINSEL11 = 0;
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/preinstall.am:1.20 rtems/c/src/lib/libbsp/arm/lpc24xx/preinstall.am:1.21
--- rtems/c/src/lib/libbsp/arm/lpc24xx/preinstall.am:1.20 Fri Dec 3 03:56:47 2010
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/preinstall.am Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -94,6 +94,18 @@
</font> $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/lpc-i2s.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/lpc-i2s.h
<font color='#000088'>+$(PROJECT_INCLUDE)/bsp/lpc-emc.h: ../shared/lpc/include/lpc-emc.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/lpc-emc.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/lpc-emc.h
+
+$(PROJECT_INCLUDE)/bsp/lpc-dma.h: ../shared/lpc/include/lpc-dma.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/lpc-dma.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/lpc-dma.h
+
+$(PROJECT_INCLUDE)/bsp/lpc-lcd.h: ../shared/lpc/include/lpc-lcd.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
+ $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/lpc-lcd.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/lpc-lcd.h
+
</font> $(PROJECT_INCLUDE)/bsp/irq.h: include/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c:1.9 rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c:1.10
--- rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c:1.9 Thu May 20 08:10:56 2010
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstart.c Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2008, 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -61,6 +62,21 @@
</font> #endif
}
<font color='#000088'>+static void initialize_console(void)
+{
+ #ifdef LPC24XX_CONFIG_CONSOLE
+ static const lpc24xx_pin_range pins [] = {
+ LPC24XX_PIN_UART_0_TXD,
+ LPC24XX_PIN_UART_0_RXD,
+ LPC24XX_PIN_TERMINAL
+ };
+
+ lpc24xx_module_enable(LPC24XX_MODULE_UART_0, LPC24XX_MODULE_CCLK);
+ lpc24xx_pin_config(&pins [0], LPC24XX_PIN_SET_FUNCTION);
+ BSP_CONSOLE_UART_INIT(lpc24xx_cclk() / 16 / LPC24XX_UART_BAUD);
+ #endif
+}
+
</font> void bsp_start(void)
{
/* Initialize Timer 1 */
<font color='#997700'>@@ -69,12 +85,7 @@
</font> /* Initialize standard timer */
lpc24xx_timer_initialize();
<font color='#880000'>- /* Initialize console */
- #ifdef LPC24XX_CONFIG_CONSOLE
- lpc24xx_module_enable(LPC24XX_MODULE_UART_0, LPC24XX_MODULE_CCLK);
- lpc24xx_io_config(LPC24XX_MODULE_UART_0, LPC24XX_CONFIG_CONSOLE);
- BSP_CONSOLE_UART_INIT(lpc24xx_cclk() / 16 / LPC24XX_UART_BAUD);
- #endif
</font><font color='#000088'>+ initialize_console();
</font>
/* Interrupts */
if (bsp_interrupt_initialize() != RTEMS_SUCCESSFUL) {
<font color='#997700'>@@ -91,18 +102,4 @@
</font> (uintptr_t) bsp_section_stack_size
);
#endif
<font color='#880000'>-
- /* UART configurations */
- #ifdef LPC24XX_CONFIG_UART_1
- lpc24xx_module_enable(LPC24XX_MODULE_UART_1, LPC24XX_MODULE_CCLK);
- lpc24xx_io_config(LPC24XX_MODULE_UART_1, LPC24XX_CONFIG_UART_1);
- #endif
- #ifdef LPC24XX_CONFIG_UART_2
- lpc24xx_module_enable(LPC24XX_MODULE_UART_2, LPC24XX_MODULE_CCLK);
- lpc24xx_io_config(LPC24XX_MODULE_UART_2, LPC24XX_CONFIG_UART_2);
- #endif
- #ifdef LPC24XX_CONFIG_UART_3
- lpc24xx_module_enable(LPC24XX_MODULE_UART_3, LPC24XX_MODULE_CCLK);
- lpc24xx_io_config(LPC24XX_MODULE_UART_3, LPC24XX_CONFIG_UART_3);
- #endif
</font> }
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c:1.8 rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c:1.9
--- rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c:1.8 Fri Feb 11 05:48:16 2011
+++ rtems/c/src/lib/libbsp/arm/lpc24xx/startup/bspstarthooks.c Thu May 19 07:30:00 2011
</font><font color='#997700'>@@ -7,12 +7,13 @@
</font> */
/*
<font color='#880000'>- * Copyright (c) 2008, 2009
- * embedded brains GmbH
- * Obere Lagerstr. 30
- * D-82178 Puchheim
- * Germany
- * <rtems@embedded-brains.de>
</font><font color='#000088'>+ * Copyright (c) 2008-2011 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
</font> *
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
<font color='#997700'>@@ -23,13 +24,48 @@
</font>
#include <bspopts.h>
#include <bsp/start.h>
<font color='#880000'>-#include <bsp/lpc24xx.h>
</font> #include <bsp/linker-symbols.h>
<font color='#000088'>+#include <bsp/lpc24xx.h>
+#include <bsp/lpc-emc.h>
</font>
#if defined(LPC24XX_EMC_MICRON) || defined(LPC24XX_EMC_NUMONYX)
#define LPC24XX_EMC_INIT
#endif
<font color='#000088'>+static volatile lpc_emc *const emc = (lpc_emc *) EMC_BASE_ADDR;
+
+typedef struct {
+ uint32_t refresh;
+ uint32_t readconfig;
+ uint32_t trp;
+ uint32_t tras;
+ uint32_t tsrex;
+ uint32_t tapr;
+ uint32_t tdal;
+ uint32_t twr;
+ uint32_t trc;
+ uint32_t trfc;
+ uint32_t txsr;
+ uint32_t trrd;
+ uint32_t tmrd;
+} lpc24xx_emc_dynamic_config;
+
+typedef struct {
+ uint32_t config;
+ uint32_t rascas;
+ uint32_t mode;
+} lpc24xx_emc_dynamic_chip_config;
+
+typedef struct {
+ uint32_t config;
+ uint32_t waitwen;
+ uint32_t waitoen;
+ uint32_t waitrd;
+ uint32_t waitpage;
+ uint32_t waitwr;
+ uint32_t waitrun;
+} lpc24xx_emc_static_chip_config;
+
</font> #ifdef LPC24XX_EMC_MICRON
static void BSP_START_TEXT_SECTION lpc24xx_ram_test_32(void)
{
<font color='#997700'>@@ -55,9 +91,7 @@
</font> #endif
}
<font color='#880000'>- static void BSP_START_TEXT_SECTION lpc24xx_cpu_delay(
- unsigned ticks
- )
</font><font color='#000088'>+ static void BSP_START_TEXT_SECTION lpc24xx_cpu_delay(unsigned ticks)
</font> {
unsigned i = 0;
<font color='#997700'>@@ -68,173 +102,206 @@
</font> __asm__ volatile ("nop");
}
}
<font color='#000088'>+
+ static void BSP_START_TEXT_SECTION lpc24xx_udelay(unsigned us)
+ {
+ lpc24xx_cpu_delay(us * (LPC24XX_CCLK / 1000000));
+ }
</font> #endif
<font color='#880000'>-/**
- * @brief EMC initialization hook 0.
- */
-static void BSP_START_TEXT_SECTION lpc24xx_init_emc_0(void)
</font><font color='#000088'>+static void BSP_START_TEXT_SECTION lpc24xx_init_emc_pinsel(void)
+{
+ #ifdef LPC24XX_EMC_INIT
+ static const BSP_START_DATA_SECTION uint32_t pinsel_5_9 [5] = {
+ 0x05010115,
+ 0x55555555,
+ 0x0,
+ 0x55555555,
+ 0x40050155
+ };
+
+ bsp_start_memcpy(
+ (int *) &PINSEL5,
+ (const int *) &pinsel_5_9,
+ sizeof(pinsel_5_9)
+ );
+ #endif
+}
+
+static void BSP_START_TEXT_SECTION lpc24xx_init_emc_static(void)
</font> {
#ifdef LPC24XX_EMC_NUMONYX
/*
* Static Memory 1: Numonyx M29W160EB
*
* 1 clock cycle = 1/72MHz = 13.9ns
<font color='#880000'>- *
- * We cannot use an initializer since this will result in the usage of the
- * read-only data section which is not available here.
- */
- lpc24xx_emc_static numonyx;
-
- /*
- * 16 bit, page mode disabled, active LOW chip select, extended wait
- * disabled, writes not protected, byte lane state LOW/LOW (!).
</font> */
<font color='#880000'>- numonyx.cfg = 0x81;
-
- /* 1 clock cycles delay from the chip select 1 to the write enable */
- numonyx.waitwen = 0;
</font><font color='#000088'>+ static const BSP_START_DATA_SECTION lpc24xx_emc_static_chip_config chip_config = {
+ /*
+ * 16 bit, page mode disabled, active LOW chip select, extended wait
+ * disabled, writes not protected, byte lane state LOW/LOW (!).
+ */
+ .config = 0x81,
</font>
<font color='#880000'>- /*
- * 0 clock cycles delay from the chip select 1 or address change
- * (whichever is later) to the output enable
- */
- numonyx.waitoen = 0;
</font><font color='#000088'>+ /* 1 clock cycles delay from the chip select 1 to the write enable */
+ .waitwen = 0,
</font>
<font color='#880000'>- /* 7 clock cycles delay from the chip select 1 to the read access */
- numonyx.waitrd = 0x6;
</font><font color='#000088'>+ /*
+ * 0 clock cycles delay from the chip select 1 or address change
+ * (whichever is later) to the output enable
+ */
+ .waitoen = 0,
</font>
<font color='#880000'>- /*
- * 32 clock cycles delay for asynchronous page mode sequential accesses
- */
- numonyx.waitpage = 0x1f;
</font><font color='#000088'>+ /* 7 clock cycles delay from the chip select 1 to the read access */
+ .waitrd = 0x6,
</font>
<font color='#880000'>- /* 5 clock cycles delay from the chip select 1 to the write access */
- numonyx.waitwr = 0x3;
</font><font color='#000088'>+ /*
+ * 32 clock cycles delay for asynchronous page mode sequential accesses
+ */
+ .waitpage = 0x1f,
</font>
<font color='#880000'>- /* 16 bus turnaround cycles */
- numonyx.waitrun = 0xf;
- #endif
</font><font color='#000088'>+ /* 5 clock cycles delay from the chip select 1 to the write access */
+ .waitwr = 0x3,
</font>
<font color='#880000'>- #ifdef LPC24XX_EMC_INIT
- /* Set pin functions for EMC */
- PINSEL5 = (PINSEL5 & 0xf000f000) | 0x05550555;
- PINSEL6 = 0x55555555;
- PINSEL8 = 0x55555555;
- PINSEL9 = (PINSEL9 & 0x0f000000) | 0x50555555;
- #endif
</font><font color='#000088'>+ /* 16 bus turnaround cycles */
+ .waitrun = 0xf
+ };
+ lpc24xx_emc_static_chip_config chip_config_on_stack;
</font>
<font color='#880000'>- #ifdef LPC24XX_EMC_NUMONYX
- /* Static Memory 1 settings */
</font><font color='#000088'>+ bsp_start_memcpy(
+ (int *) &chip_config_on_stack,
+ (const int *) &chip_config,
+ sizeof(chip_config_on_stack)
+ );
</font> bsp_start_memcpy(
(int *) EMC_STA_BASE_1,
<font color='#880000'>- (const int *) &numonyx,
- sizeof(numonyx)
</font><font color='#000088'>+ (const int *) &chip_config_on_stack,
+ sizeof(chip_config_on_stack)
</font> );
#endif
}
<font color='#880000'>-/**
- * @brief EMC initialization hook 1.
- */
-static void BSP_START_TEXT_SECTION lpc24xx_init_emc_1(void)
</font><font color='#000088'>+static void BSP_START_TEXT_SECTION lpc24xx_init_emc_memory_map(void)
</font> {
#ifdef LPC24XX_EMC_INIT
/* Use normal memory map */
EMC_CTRL &= ~0x2U;
#endif
<font color='#000088'>+}
</font>
<font color='#000088'>+static void BSP_START_TEXT_SECTION lpc24xx_init_emc_dynamic(void)
+{
</font> #ifdef LPC24XX_EMC_MICRON
<font color='#880000'>- /* Check if we need to initialize it */
- if ((EMC_DYN_CFG0 & 0x00080000) == 0) {
- /*
- * The buffer enable bit is not set. Now we assume that the controller
- * is not properly initialized.
- */
</font><font color='#000088'>+ /* Dynamic Memory 0: Micron M T48LC 4M16 A2 P 75 IT */
</font>
<font color='#880000'>- /* Global dynamic settings */
-
- /* FIXME */
- EMC_DYN_APR = 2;
</font><font color='#000088'>+ static const BSP_START_DATA_SECTION lpc24xx_emc_dynamic_config dynamic_config = {
+ /* Auto-refresh command every 15.6 us */
+ .refresh = 0x46,
</font>
<font color='#880000'>- /* Data-in to active command period tWR + tRP */
- EMC_DYN_DAL = 4;
</font><font color='#000088'>+ /* Use command delayed strategy */
+ .readconfig = 1,
</font>
<font color='#880000'>- /* Load mode register to active or refresh command period 2 tCK */
- EMC_DYN_MRD = 1;
</font><font color='#000088'>+ /* Precharge command period 20 ns */
+ .trp = 1,
</font>
/* Active to precharge command period 44 ns */
<font color='#880000'>- EMC_DYN_RAS = 3;
</font><font color='#000088'>+ .tras = 3,
</font>
<font color='#880000'>- /* Active to active command period 66 ns */
- EMC_DYN_RC = 4;
-
- /* Use command delayed strategy */
- EMC_DYN_RD_CFG = 1;
</font><font color='#000088'>+ /* FIXME */
+ .tsrex = 5,
</font>
<font color='#880000'>- /* Auto refresh period 66 ns */
- EMC_DYN_RFC = 4;
</font><font color='#000088'>+ /* FIXME */
+ .tapr = 2,
</font>
<font color='#880000'>- /* Precharge command period 20 ns */
- EMC_DYN_RP = 1;
</font><font color='#000088'>+ /* Data-in to active command period tWR + tRP */
+ .tdal = 4,
</font>
<font color='#880000'>- /* Active bank a to active bank b command period 15 ns */
- EMC_DYN_RRD = 1;
</font><font color='#000088'>+ /* Write recovery time 15 ns */
+ .twr = 1,
</font>
<font color='#880000'>- /* FIXME */
- EMC_DYN_SREX = 5;
</font><font color='#000088'>+ /* Active to active command period 66 ns */
+ .trc = 4,
</font>
<font color='#880000'>- /* Write recovery time 15 ns */
- EMC_DYN_WR = 1;
</font><font color='#000088'>+ /* Auto refresh period 66 ns */
+ .trfc = 4,
</font>
/* Exit self refresh to active command period 75 ns */
<font color='#880000'>- EMC_DYN_XSR = 5;
</font><font color='#000088'>+ .txsr = 5,
</font>
<font color='#880000'>- /* Dynamic Memory 0: Micron M T48LC 4M16 A2 P 75 IT */
</font><font color='#000088'>+ /* Active bank a to active bank b command period 15 ns */
+ .trrd = 1,
</font>
<font color='#000088'>+ /* Load mode register to active or refresh command period 2 tCK */
+ .tmrd = 1,
+ };
+ static const BSP_START_DATA_SECTION lpc24xx_emc_dynamic_chip_config chip_config = {
</font> /*
* Use SDRAM, 0 0 001 01 address mapping, disabled buffer, unprotected writes
*/
<font color='#880000'>- EMC_DYN_CFG0 = 0x0280;
</font><font color='#000088'>+ .config = 0x280,
</font>
<font color='#880000'>- /* CAS and RAS latency */
- EMC_DYN_RASCAS0 = 0x0202;
</font><font color='#000088'>+ .rascas = EMC_DYN_RASCAS_RAS(2) | EMC_DYN_RASCAS_CAS(2, 0),
+ .mode = 0xa0000000 | (0x23 << (1 + 2 + 8))
+ };
</font>
<font color='#880000'>- /* Wait 50 micro seconds */
- lpc24xx_cpu_delay(3600);
</font><font color='#000088'>+ volatile lpc_emc_dynamic *chip = &emc->dynamic [0];
+ uint32_t dynamiccontrol = EMC_DYN_CTRL_CE | EMC_DYN_CTRL_CS;
</font>
<font color='#880000'>- /* Send command: NOP */
- EMC_DYN_CTRL = EMC_DYN_CTRL_CE | EMC_DYN_CTRL_CS | EMC_DYN_CTRL_CMD_NOP;
-
- /* Wait 50 micro seconds */
- lpc24xx_cpu_delay(3600);
</font><font color='#000088'>+ /* Check if we need to initialize it */
+ if ((chip->config & EMC_DYN_CFG_B) == 0) {
+ /*
+ * The buffer enable bit is not set. Now we assume that the controller
+ * is not properly initialized.
+ */
</font>
<font color='#880000'>- /* Send command: PRECHARGE ALL */
- EMC_DYN_CTRL = EMC_DYN_CTRL_CE | EMC_DYN_CTRL_CS | EMC_DYN_CTRL_CMD_PALL;
</font><font color='#000088'>+ /* Global dynamic settings */
+ emc->dynamicreadconfig = dynamic_config.readconfig;
+ emc->dynamictrp = dynamic_config.trp;
+ emc->dynamictras = dynamic_config.tras;
+ emc->dynamictsrex = dynamic_config.tsrex;
+ emc->dynamictapr = dynamic_config.tapr;
+ emc->dynamictdal = dynamic_config.tdal;
+ emc->dynamictwr = dynamic_config.twr;
+ emc->dynamictrc = dynamic_config.trc;
+ emc->dynamictrfc = dynamic_config.trfc;
+ emc->dynamictxsr = dynamic_config.txsr;
+ emc->dynamictrrd = dynamic_config.trrd;
+ emc->dynamictmrd = dynamic_config.tmrd;
+
+ /* Wait 100us after the power is applied and the clocks have stabilized */
+ lpc24xx_udelay(100);
+
+ /* NOP period, disable self-refresh */
+ emc->dynamiccontrol = dynamiccontrol | EMC_DYN_CTRL_I_NOP;
+ lpc24xx_udelay(200);
</font>
<font color='#880000'>- /* Shortest possible refresh period */
- EMC_DYN_RFSH = 0x01;
</font><font color='#000088'>+ /* Precharge all */
+ emc->dynamiccontrol = dynamiccontrol | EMC_DYN_CTRL_I_PALL;
</font>
<font color='#880000'>- /* Wait at least 128 AHB clock cycles */
</font><font color='#000088'>+ /*
+ * Perform several refresh cycles with a memory refresh every 16 AHB
+ * clock cycles. Wait until eight SDRAM refresh cycles have occurred
+ * (128 AHB clock cycles).
+ */
+ emc->dynamicrefresh = 1;
</font> lpc24xx_cpu_delay(128);
<font color='#880000'>- /* Wait 1 micro second */
- lpc24xx_cpu_delay(72);
-
</font> /* Set refresh period */
<font color='#880000'>- EMC_DYN_RFSH = 0x46;
</font><font color='#000088'>+ emc->dynamicrefresh = dynamic_config.refresh;
</font>
<font color='#880000'>- /* Send command: MODE */
- EMC_DYN_CTRL = EMC_DYN_CTRL_CE | EMC_DYN_CTRL_CS | EMC_DYN_CTRL_CMD_MODE;
</font><font color='#000088'>+ /* Operational values for the chip */
+ chip->rascas = chip_config.rascas;
+ chip->config = chip_config.config;
+
+ /* Mode */
+ emc->dynamiccontrol = dynamiccontrol | EMC_DYN_CTRL_I_MODE;
+ *((volatile uint32_t *) chip_config.mode);
</font>
<font color='#880000'>- /* Set mode register in SDRAM */
- *((volatile uint32_t *) (0xa0000000 | (0x23 << (1 + 2 + 8))));
-
- /* Send command: NORMAL */
- EMC_DYN_CTRL = 0;
</font><font color='#000088'>+ /* Normal operation */
+ emc->dynamiccontrol = 0;
</font>
/* Enable buffer */
<font color='#880000'>- EMC_DYN_CFG0 |= 0x00080000;
</font><font color='#000088'>+ chip->config |= EMC_DYN_CFG_B;
</font>
/* Test RAM */
lpc24xx_ram_test_32();
<font color='#997700'>@@ -355,11 +422,9 @@
</font>
void BSP_START_TEXT_SECTION bsp_start_hook_0(void)
{
<font color='#880000'>- /* Initialize PLL */
</font> lpc24xx_init_pll();
<font color='#880000'>-
- /* Initialize EMC hook 0 */
- lpc24xx_init_emc_0();
</font><font color='#000088'>+ lpc24xx_init_emc_pinsel();
+ lpc24xx_init_emc_static();
</font> }
void BSP_START_TEXT_SECTION bsp_start_hook_1(void)
<font color='#997700'>@@ -395,8 +460,8 @@
</font> FIO3CLR = 0xffffffff;
FIO4CLR = 0xffffffff;
<font color='#880000'>- /* Initialize EMC hook 1 */
- lpc24xx_init_emc_1();
</font><font color='#000088'>+ lpc24xx_init_emc_memory_map();
+ lpc24xx_init_emc_dynamic();
</font>
#ifdef LPC24XX_STOP_GPDMA
if ((PCONP & PCONP_GPDMA) != 0) {
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>