From 2b5e0544c8285976d94abe21268342698c94dd85 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 4 Jul 2009 15:33:21 +0000 Subject: Completed PAL support for LPC214x. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1056 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- ports/ARM7-LPC214x/pal_lld.c | 22 +++++++++++++++++----- ports/ARM7-LPC214x/pal_lld.h | 8 +++----- ports/ARM7-LPC214x/port.dox | 12 +++++++++++- 3 files changed, 31 insertions(+), 11 deletions(-) (limited to 'ports/ARM7-LPC214x') diff --git a/ports/ARM7-LPC214x/pal_lld.c b/ports/ARM7-LPC214x/pal_lld.c index 3d300bb55..e197a39fc 100644 --- a/ports/ARM7-LPC214x/pal_lld.c +++ b/ports/ARM7-LPC214x/pal_lld.c @@ -29,7 +29,7 @@ /** * @brief LPC214x I/O ports configuration. - * @details . + * @details FIO units and PINSEL registers initialization. * * @param[in] config the LPC214x ports configuration */ @@ -64,14 +64,26 @@ void _pal_lld_init(const LPC214xFIOConfig *config) { * * @note This function is not meant to be invoked directly by the application * code. - * @note @p PAL_MODE_UNCONNECTED is implemented as push pull output. - * @note Writing on pads programmed as pull-up or pull-down has the side - * effect to modify the resistor setting because the output latched data - * is used for the resistor selection. + * @note @p PAL_MODE_UNCONNECTED is implemented as push pull output with high + * state. + * @note This function does not alter the @p PINSELx registers. Alternate + * functions setup must be handled by device-specific code. */ void _pal_lld_setgroupmode(ioportid_t port, ioportmask_t mask, uint_fast8_t mode) { + + switch (mode) { + case PAL_MODE_RESET: + case PAL_MODE_INPUT: + port->FIO_DIR &= ~mask; + break; + case PAL_MODE_UNCONNECTED: + port->FIO_PIN |= mask; + case PAL_MODE_OUTPUT_PUSHPULL: + port->FIO_DIR |= mask; + break; + } } /** @} */ diff --git a/ports/ARM7-LPC214x/pal_lld.h b/ports/ARM7-LPC214x/pal_lld.h index 2bbb0676b..143fc103f 100644 --- a/ports/ARM7-LPC214x/pal_lld.h +++ b/ports/ARM7-LPC214x/pal_lld.h @@ -27,9 +27,7 @@ #ifndef _PAL_LLD_H_ #define _PAL_LLD_H_ -#ifndef _LPC214X_H_ #include "lpc214x.h" -#endif /*===========================================================================*/ /* Unsupported modes and specific modes */ @@ -210,9 +208,9 @@ typedef FIO * ioportid_t; * * @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 + * @note @p PAL_MODE_UNCONNECTED is implemented as push pull output with high + * state. + * @note This function does not alter the @p PINSELx registers. Alternate * functions setup must be handled by device-specific code. */ #define pal_lld_setgroupmode(port, mask, mode) \ diff --git a/ports/ARM7-LPC214x/port.dox b/ports/ARM7-LPC214x/port.dox index 332c6c191..e46ac4328 100644 --- a/ports/ARM7-LPC214x/port.dox +++ b/ports/ARM7-LPC214x/port.dox @@ -51,8 +51,18 @@ * - Output latched regardless of the pad setting. * - Direct read of input pads regardless of the pad setting. * . - * The only non atomic operations are bit toggling and bus/group writing. + *

Supported Setup Modes

+ * - @p PAL_MODE_RESET. + * - @p PAL_MODE_UNCONNECTED. + * - @p PAL_MODE_INPUT. + * - @p PAL_MODE_OUTPUT_PUSHPULL. + * . + * Any attempt to setup an invalid mode is ignored. * + *

Suboptimal Behavior

+ * - Pad/port toggling operations are not atomic. + * - Pad/group mode setup is not atomic. + * . * @ingroup LPC214x */ -- cgit v1.2.3