summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/arm/lpc24xx/include/io.h
diff options
context:
space:
mode:
authorThomas Doerfler <Thomas.Doerfler@embedded-brains.de>2009-12-15 15:20:47 +0000
committerThomas Doerfler <Thomas.Doerfler@embedded-brains.de>2009-12-15 15:20:47 +0000
commitc468f18bb73a570bf2b3eb279a7dea60b91c3319 (patch)
treeb181297c2b4a0f8fa3edbb9987fd99a3ecc45a8b /c/src/lib/libbsp/arm/lpc24xx/include/io.h
parentadd support for ARM11, reimplement nested interrupts (diff)
downloadrtems-c468f18bb73a570bf2b3eb279a7dea60b91c3319.tar.bz2
add support for LPC32xx
Diffstat (limited to 'c/src/lib/libbsp/arm/lpc24xx/include/io.h')
-rw-r--r--c/src/lib/libbsp/arm/lpc24xx/include/io.h68
1 files changed, 39 insertions, 29 deletions
diff --git a/c/src/lib/libbsp/arm/lpc24xx/include/io.h b/c/src/lib/libbsp/arm/lpc24xx/include/io.h
index ac107ff0fa..a29cf44357 100644
--- a/c/src/lib/libbsp/arm/lpc24xx/include/io.h
+++ b/c/src/lib/libbsp/arm/lpc24xx/include/io.h
@@ -44,39 +44,53 @@ extern "C" {
#define LPC24XX_IO_INDEX_MAX (LPC24XX_IO_PORT_COUNT * 32U)
-#define LPC24XX_IO_INDEX_BY_PORT( port, bit) (((port) << 5U) + (bit))
+#define LPC24XX_IO_INDEX_BY_PORT(port, bit) (((port) << 5U) + (bit))
-#define LPC24XX_IO_PORT( index) (index >> 5U)
+#define LPC24XX_IO_PORT(index) (index >> 5U)
-#define LPC24XX_IO_PORT_BIT( index) (index & 0x1fU)
+#define LPC24XX_IO_PORT_BIT(index) (index & 0x1fU)
typedef enum {
- LPC24XX_MODULE_ACF,
+ LPC24XX_MODULE_ACF = 0,
LPC24XX_MODULE_ADC,
LPC24XX_MODULE_BAT_RAM,
- LPC24XX_MODULE_CAN,
+ LPC24XX_MODULE_CAN_0,
+ LPC24XX_MODULE_CAN_1,
LPC24XX_MODULE_DAC,
LPC24XX_MODULE_EMC,
LPC24XX_MODULE_ETHERNET,
LPC24XX_MODULE_GPDMA,
LPC24XX_MODULE_GPIO,
- LPC24XX_MODULE_I2C,
+ LPC24XX_MODULE_I2C_0,
+ LPC24XX_MODULE_I2C_1,
+ LPC24XX_MODULE_I2C_2,
LPC24XX_MODULE_I2S,
LPC24XX_MODULE_LCD,
LPC24XX_MODULE_MCI,
LPC24XX_MODULE_PCB,
- LPC24XX_MODULE_PWM,
+ LPC24XX_MODULE_PWM_0,
+ LPC24XX_MODULE_PWM_1,
LPC24XX_MODULE_RTC,
LPC24XX_MODULE_SPI,
- LPC24XX_MODULE_SSP,
+ LPC24XX_MODULE_SSP_0,
+ LPC24XX_MODULE_SSP_1,
LPC24XX_MODULE_SYSCON,
- LPC24XX_MODULE_TIMER,
- LPC24XX_MODULE_UART,
+ LPC24XX_MODULE_TIMER_0,
+ LPC24XX_MODULE_TIMER_1,
+ LPC24XX_MODULE_TIMER_2,
+ LPC24XX_MODULE_TIMER_3,
+ LPC24XX_MODULE_UART_0,
+ LPC24XX_MODULE_UART_1,
+ LPC24XX_MODULE_UART_2,
+ LPC24XX_MODULE_UART_3,
LPC24XX_MODULE_USB,
- LPC24XX_MODULE_WDT,
- LPC24XX_MODULE_COUNT
+ LPC24XX_MODULE_WDT
} lpc24xx_module;
+#define LPC24XX_MODULE_FIRST LPC24XX_MODULE_ACF
+
+#define LPC24XX_MODULE_COUNT (LPC24XX_MODULE_WDT + 1)
+
typedef enum {
LPC24XX_MODULE_PCLK_DEFAULT = 0x0U,
LPC24XX_MODULE_CCLK = 0x1U,
@@ -102,24 +116,20 @@ typedef enum {
rtems_status_code lpc24xx_module_enable(
lpc24xx_module module,
- unsigned index,
lpc24xx_module_clock clock
);
rtems_status_code lpc24xx_module_disable(
- lpc24xx_module module,
- unsigned index
+ lpc24xx_module module
);
rtems_status_code lpc24xx_io_config(
lpc24xx_module module,
- unsigned index,
unsigned config
);
rtems_status_code lpc24xx_io_release(
lpc24xx_module module,
- unsigned index,
unsigned config
);
@@ -128,40 +138,40 @@ rtems_status_code lpc24xx_gpio_config(
lpc24xx_gpio_settings settings
);
-static inline void lpc24xx_gpio_set( unsigned index)
+static inline void lpc24xx_gpio_set(unsigned index)
{
if (index <= LPC24XX_IO_INDEX_MAX) {
- unsigned port = LPC24XX_IO_PORT( index);
- unsigned bit = LPC24XX_IO_PORT_BIT( index);
+ unsigned port = LPC24XX_IO_PORT(index);
+ unsigned bit = LPC24XX_IO_PORT_BIT(index);
LPC24XX_FIO [port].set = 1U << bit;
}
}
-static inline void lpc24xx_gpio_clear( unsigned index)
+static inline void lpc24xx_gpio_clear(unsigned index)
{
if (index <= LPC24XX_IO_INDEX_MAX) {
- unsigned port = LPC24XX_IO_PORT( index);
- unsigned bit = LPC24XX_IO_PORT_BIT( index);
+ unsigned port = LPC24XX_IO_PORT(index);
+ unsigned bit = LPC24XX_IO_PORT_BIT(index);
LPC24XX_FIO [port].clr = 1U << bit;
}
}
-static inline void lpc24xx_gpio_write( unsigned index, bool value)
+static inline void lpc24xx_gpio_write(unsigned index, bool value)
{
if (value) {
- lpc24xx_gpio_set( index);
+ lpc24xx_gpio_set(index);
} else {
- lpc24xx_gpio_clear( index);
+ lpc24xx_gpio_clear(index);
}
}
-static inline bool lpc24xx_gpio_get( unsigned index)
+static inline bool lpc24xx_gpio_get(unsigned index)
{
if (index <= LPC24XX_IO_INDEX_MAX) {
- unsigned port = LPC24XX_IO_PORT( index);
- unsigned bit = LPC24XX_IO_PORT_BIT( index);
+ unsigned port = LPC24XX_IO_PORT(index);
+ unsigned bit = LPC24XX_IO_PORT_BIT(index);
return (LPC24XX_FIO [port].pin & (1U << bit)) != 0;
} else {