aboutsummaryrefslogtreecommitdiffstats
path: root/ports/ARM7-LPC214x
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-06-07 16:11:41 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-06-07 16:11:41 +0000
commitf9ecd9f46e829010b0457a04993d2a89a37c104a (patch)
tree2e0a1556bc6075d3976d3f121c6748859b4514f7 /ports/ARM7-LPC214x
parenta5df28e309adbccff162d67cfb9f55c653c73f7b (diff)
downloadChibiOS-f9ecd9f46e829010b0457a04993d2a89a37c104a.tar.gz
ChibiOS-f9ecd9f46e829010b0457a04993d2a89a37c104a.tar.bz2
ChibiOS-f9ecd9f46e829010b0457a04993d2a89a37c104a.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1024 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'ports/ARM7-LPC214x')
-rw-r--r--ports/ARM7-LPC214x/pal_lld.h (renamed from ports/ARM7-LPC214x/ioports_lld.h)83
-rw-r--r--ports/ARM7-LPC214x/port.dox4
2 files changed, 51 insertions, 36 deletions
diff --git a/ports/ARM7-LPC214x/ioports_lld.h b/ports/ARM7-LPC214x/pal_lld.h
index cedc9e361..ce56f9562 100644
--- a/ports/ARM7-LPC214x/ioports_lld.h
+++ b/ports/ARM7-LPC214x/pal_lld.h
@@ -18,14 +18,14 @@
*/
/**
- * @file ports/ARM-LPC214x/ioports_lld.h
+ * @file ports/ARM7-LPC214x/ioports_lld.h
* @brief LPC214x FIO low level driver
- * @addtogroup LPC214x_IOPORTS
+ * @addtogroup LPC214x_PAL
* @{
*/
-#ifndef _IOPORTS_LLD_H_
-#define _IOPORTS_LLD_H_
+#ifndef _PAL_LLD_H_
+#define _PAL_LLD_H_
#ifndef _LPC214X_H_
#include "lpc214x.h"
@@ -38,7 +38,7 @@
/**
* @brief Width, in bits, of an I/O port.
*/
-#define IOPORTS_WIDTH 32
+#define PAL_IOPORTS_WIDTH 32
/**
* @brief Digital I/O port sized unsigned type.
@@ -73,102 +73,117 @@ typedef FIO * ioportid_t;
* @brief FIO subsystem initialization.
* @details Enables the access through the fast registers.
*/
-#define ioport_init_lld() { \
+#define pal_lld_init() { \
SCS = 3; \
}
/**
- * @brief Writes a bits mask on a I/O port.
+ * @brief Reads an I/O port.
+ * @details This function is implemented by reading the FIO PIN register, the
+ * implementation has no side effects.
*
* @param[in] port the port identifier
- * @param[in] bits the bits to be written on the specified port
+ * @return the port bits
*
* @note This function is not meant to be invoked directly by the application
* code.
*/
-#define ioport_write_lld(port, bits) ((port)->FIO_PIN = (bits))
+#define pal_lld_readport(port) ((port)->FIO_PIN)
/**
- * @brief Reads an I/O port.
+ * @brief Reads the output latch.
+ * @details This function is implemented by reading the FIO SET register, the
+ * implementation has no side effects.
*
* @param[in] port the port identifier
- * @return the port bits
+ * @return The latched logical states.
*
* @note This function is not meant to be invoked directly by the application
* code.
*/
-#define ioport_read_lld(port) ((port)->FIO_PIN)
+#define pal_lld_readlatch(port) ((port)->FIO_SET)
/**
- * @brief Sets a bits mask on a I/O port.
+ * @brief Writes a bits mask on a I/O port.
+ * @details This function is implemented by writing the FIO PIN register, the
+ * implementation has no side effects.
*
* @param[in] port the port identifier
- * @param[in] bits the bits to be ORed on the specified port
+ * @param[in] bits the bits to be written on the specified port
*
* @note This function is not meant to be invoked directly by the application
* code.
*/
-#define ioport_set_lld(port, bits) ((port)->FIO_SET = (bits))
+#define pal_lld_writeport(port, bits) ((port)->FIO_PIN = (bits))
/**
- * @brief Clears a bits mask on a I/O port.
+ * @brief Sets a bits mask on a I/O port.
+ * @details This function is implemented by writing the FIO SET register, the
+ * implementation has no side effects.
*
* @param[in] port the port identifier
- * @param[in] bits the bits to be cleared on the specified port
+ * @param[in] bits the bits to be ORed on the specified port
*
* @note This function is not meant to be invoked directly by the application
* code.
*/
-#define ioport_clear_lld(port, bits) ((port)->FIO_CLR = (bits))
+#define pal_lld_setport(port, bits) ((port)->FIO_SET = (bits))
/**
- * @brief Toggles a bits mask on a I/O port.
+ * @brief Clears a bits mask on a I/O port.
+ * @details This function is implemented by writing the FIO CLR register, the
+ * implementation has no side effects.
*
* @param[in] port the port identifier
- * @param[in] bits the bits to be XORed on the specified port
+ * @param[in] bits the bits to be cleared on the specified port
*
* @note This function is not meant to be invoked directly by the application
* code.
*/
-#define ioport_toggle_lld(port, bits) ((port)->FIO_PIN ^= (bits))
+#define pal_lld_clearport(port, bits) ((port)->FIO_CLR = (bits))
/**
* @brief Writes a value on an I/O bus.
+ * @details This function is implemented by writing the FIO PIN and MASK
+ * registers, the implementation is not atomic because the multiple
+ * accesses.
*
- * @param[in] bus the I/O bus, pointer to a @p IOBus structure
- * @param[in] bits the bits to be written on the I/O bus. Values exceeding
- * the bus width are masked so most significant bits are lost.
+ * @param[in] port the port identifier
+ * @param[in] mask the group mask
+ * @param[in] offset the group bit offset within the port
+ * @param[in] bits the bits to be written. Values exceeding the group width
+ * are masked.
*
* @note This function is not meant to be invoked directly by the application
* code.
*/
-#define ioport_writebus_lld(bus, bits) { \
- (port)->FIO_MASK = (bus)->bus_mask; \
- (port)->FIO_PIN = (bits) << (bus)->bus_offset; \
+#define pal_lld_writegroup(port, mask, offset, bits) { \
+ (port)->FIO_MASK = (mask) << (offset); \
+ (port)->FIO_PIN = (bits) << (offset); \
(port)->FIO_MASK = 0; \
}
/**
- * @brief Reads a value from an I/O bus.
+ * @brief Writes a logical state on an output pad.
*
- * @param[in] bus the I/O bus, pointer to a @p IOBus structure
- * @return the bus bits
+ * @param[in] port the port identifier
+ * @param[in] pad the pad number within the port
+ * @param[out] bit the logical value, the value must be @p 0 or @p 1
*
* @note This function is not meant to be invoked directly by the application
* code.
*/
-#define ioport_readbus_lld(bus) \
- (((bus)->bus_portid->FIO_PIN & (bus)->bus_mask) >> (bus)->bus_offset)
+#define pal_lld_writepad(port, pad, bit) pal_lld_writegroup(port, 1, pad, bit)
/**
* @brief FIO port setup.
* @details This function initializes a FIO port, note that this functionality
* is LPC214x specific and non portable.
*/
-#define ioport_lpc214x_set_direction_lld(port, dir) { \
+#define pal_lld_lpc214x_set_direction(port, dir) { \
(port)->FIO_DIR = (dir); \
}
-#endif /* _IOPORTS_LLD_H_ */
+#endif /* _PAL_LLD_H_ */
/** @} */
diff --git a/ports/ARM7-LPC214x/port.dox b/ports/ARM7-LPC214x/port.dox
index 7db0867b2..69d8d6198 100644
--- a/ports/ARM7-LPC214x/port.dox
+++ b/ports/ARM7-LPC214x/port.dox
@@ -49,14 +49,14 @@
* @defgroup LPC214x_IOPORTS I/O Ports Support
* @brief I/O Ports peripherals support.
* @details This module supports the LPC214x FIO controller. The controller
- * supports the following features (see @ref IOPorts):
+ * supports the following features (see @ref PAL):
* - 32 bits wide ports.
* - Atomic set/reset functions.
* - Atomic set+reset function (atomic bus operations).
* - 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 writing.
+ * The only non atomic operations are bit toggling and bus/group writing.
*
* @ingroup LPC214x
*/