aboutsummaryrefslogtreecommitdiffstats
path: root/ports/ARM7-LPC214x
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-07-04 14:05:29 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-07-04 14:05:29 +0000
commit979da150361becdb50625d056915f81099710122 (patch)
tree0a97e0193abf096411c5dc7ee25f9d34ca4502f9 /ports/ARM7-LPC214x
parent40b2d98d866cf7f779855160fb4fe1bed6428f8c (diff)
downloadChibiOS-979da150361becdb50625d056915f81099710122.tar.gz
ChibiOS-979da150361becdb50625d056915f81099710122.tar.bz2
ChibiOS-979da150361becdb50625d056915f81099710122.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1055 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports/ARM7-LPC214x')
-rw-r--r--ports/ARM7-LPC214x/pal_lld.c19
-rw-r--r--ports/ARM7-LPC214x/pal_lld.h43
2 files changed, 56 insertions, 6 deletions
diff --git a/ports/ARM7-LPC214x/pal_lld.c b/ports/ARM7-LPC214x/pal_lld.c
index 3c06f39ce..3d300bb55 100644
--- a/ports/ARM7-LPC214x/pal_lld.c
+++ b/ports/ARM7-LPC214x/pal_lld.c
@@ -29,11 +29,28 @@
/**
* @brief LPC214x I/O ports configuration.
- * @details Ports A-D clocks enabled, AFIO clock enabled.
+ * @details .
*
* @param[in] config the LPC214x ports configuration
*/
void _pal_lld_init(const LPC214xFIOConfig *config) {
+
+ /* Enables the access through the fast registers.*/
+ SCS = 3;
+
+ /* I/O pads initial assignment, device drivers may change this setup at a
+ * later time.*/
+ PINSEL0 = config->pinsel0;
+ PINSEL1 = config->pinsel1;
+ PINSEL2 = config->pinsel2;
+
+ /* I/O pads direction initial setting.*/
+ FIO0Base->FIO_MASK = 0;
+ FIO0Base->FIO_PIN = config->P0Data.pin;
+ FIO0Base->FIO_DIR = config->P0Data.dir;
+ FIO1Base->FIO_MASK = 0;
+ FIO1Base->FIO_PIN = config->P1Data.pin;
+ FIO1Base->FIO_DIR = config->P1Data.dir;
}
/**
diff --git a/ports/ARM7-LPC214x/pal_lld.h b/ports/ARM7-LPC214x/pal_lld.h
index bb0f2efac..2bbb0676b 100644
--- a/ports/ARM7-LPC214x/pal_lld.h
+++ b/ports/ARM7-LPC214x/pal_lld.h
@@ -44,6 +44,16 @@
/*===========================================================================*/
/**
+ * @brief FIO port setup info.
+ */
+typedef struct {
+ /** Initial value for FIO_PIN register.*/
+ uint32_t pin;
+ /** Initial value for FIO_DIR register.*/
+ uint32_t dir;
+} lpc214x_fio_setup_t;
+
+/**
* @brief LPC214x FIO static initializer.
* @details An instance of this structure must be passed to @p palInit() at
* system startup time in order to initialized the digital I/O
@@ -51,10 +61,16 @@
* or whole ports can be reprogrammed at later time.
*/
typedef struct {
+ /** @brief PINSEL0 initial value.*/
+ uint32_t pinsel0;
+ /** @brief PINSEL1 initial value.*/
+ uint32_t pinsel1;
+ /** @brief PINSEL2 initial value.*/
+ uint32_t pinsel2;
/** @brief Port 0 setup data.*/
- ioportmask_t P0Data;
+ lpc214x_fio_setup_t P0Data;
/** @brief Port 1 setup data.*/
- ioportmask_t P1Data;
+ lpc214x_fio_setup_t P1Data;
} LPC214xFIOConfig;
/**
@@ -95,9 +111,7 @@ typedef FIO * ioportid_t;
* @brief FIO subsystem initialization.
* @details Enables the access through the fast registers.
*/
-#define pal_lld_init() { \
- SCS = 3; \
-}
+#define pal_lld_init(config) _pal_lld_init(config)
/**
* @brief Reads an I/O port.
@@ -186,6 +200,25 @@ typedef FIO * ioportid_t;
}
/**
+ * @brief Pads group mode setup.
+ * @details This function programs a pads group belonging to the same port
+ * with the specified mode.
+ *
+ * @param[in] port the port identifier
+ * @param[in] mask the group mask
+ * @param[in] mode the mode
+ *
+ * @note This function is not meant to be invoked directly by the application
+ * code.
+ * @note @p PAL_MODE_UNCONNECTED is implemented as output as recommended by
+ * the MSP430x1xx Family User's Guide.
+ * @note This function does not alter the @p PxSEL registers. Alternate
+ * functions setup must be handled by device-specific code.
+ */
+#define pal_lld_setgroupmode(port, mask, mode) \
+ _pal_lld_setgroupmode(port, mask, mode)
+
+/**
* @brief Writes a logical state on an output pad.
*
* @param[in] port the port identifier