aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-06-21 09:35:39 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-06-21 09:35:39 +0000
commit8183016f1cb574d923c83eab468ca37617051d78 (patch)
tree41308cf6e02ac0bc848c2a6f5733e81f576495cd /src/lib
parent1c7e52eb35c244e5855ea7978ab02d9540829e00 (diff)
downloadChibiOS-8183016f1cb574d923c83eab468ca37617051d78.tar.gz
ChibiOS-8183016f1cb574d923c83eab468ca37617051d78.tar.bz2
ChibiOS-8183016f1cb574d923c83eab468ca37617051d78.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1043 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/pal.c13
-rw-r--r--src/lib/pal.h35
2 files changed, 41 insertions, 7 deletions
diff --git a/src/lib/pal.c b/src/lib/pal.c
index 95ab43883..4dec01589 100644
--- a/src/lib/pal.c
+++ b/src/lib/pal.c
@@ -70,6 +70,19 @@ void palWriteBus(IOBus *bus, ioportmask_t bits) {
palWriteGroup(bus->bus_portid, bus->bus_mask, bus->bus_offset, bits);
}
+/**
+ * @brief Programs a bus with the specified mode.
+ *
+ * @param[in] bus the I/O bus, pointer to a @p IOBus structure
+ * @param[in] mode the mode
+ *
+ * @note The operation is not guaranteed to be atomic on all the architectures,
+ * for atomicity and/or portability reasons you may need to enclose port
+ * I/O operations between @p chSysLock() and @p chSysUnlock().
+ * @note The default implementation is non atomic and not necessarily
+ * optimal. Low level drivers may optimize the function by using
+ * specific hardware or coding.
+ */
void palSetBusMode(IOBus *bus, uint_fast8_t mode) {
chDbgCheck((bus != NULL) &&
diff --git a/src/lib/pal.h b/src/lib/pal.h
index 96ed8c312..c45a801e6 100644
--- a/src/lib/pal.h
+++ b/src/lib/pal.h
@@ -296,6 +296,24 @@ typedef struct {
pal_lld_writegroup(port, mask, offset, bits)
#endif
+
+/**
+ * @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 setup mode
+ *
+ * @note Programming an unknown or unsupported mode is silently ignored.
+ */
+#if !defined(pal_lld_setgroupmode) || defined(__DOXYGEN__)
+#define palSetGroupMode(port, mask, mode)
+#else
+#define palSetGroupMode(port, mask, mode) pal_lld_setgroupmode(port, mask, mode)
+#endif
+
/**
* @brief Reads an input pad logical state.
*
@@ -400,21 +418,24 @@ typedef struct {
#define palTogglePad(port, pad) pal_lld_togglepad(port, pad)
#endif
+
/**
- * @brief Pads mode setup.
- * @details This function programs a pads group belonging to the same port
- * with the specified mode.
+ * @brief Pad mode setup.
+ * @details This function programs a pad with the specified mode.
*
* @param[in] port the port identifier
- * @param[in] mask the group mask
+ * @param[in] pad the pad number within the port
* @param[in] mode the setup mode
*
+ * @note The default implementation not necessarily optimal. Low level drivers
+ * may optimize the function by using specific hardware or coding.
* @note Programming an unknown or unsupported mode is silently ignored.
*/
-#if !defined(pal_lld_setmode) || defined(__DOXYGEN__)
-#define palSetMode(port, mask, mode)
+#if !defined(pal_lld_setpadmode) || defined(__DOXYGEN__)
+#define palSetPadMode(port, pad, mode) \
+ palSetGroupMode(port, PAL_PORT_BIT(pad), mode)
#else
-#define palSetMode(port, mask, mode) pal_lld_setmode(port, mask, mode)
+#define palSetPadMode(port, pad, mode) pal_lld_setpadmode(port, pad, mode)
#endif
#ifdef __cplusplus