aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/templates
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-11-02 10:07:40 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-11-02 10:07:40 +0000
commitb8c517e46d35e5c9691545eda8fe9b6c40d6943a (patch)
tree1979780cb2222b6ee45d49fe054343e5cc99fbd8 /os/hal/templates
parentca59ce3238108443bf04729f717f9c37d3472937 (diff)
downloadChibiOS-b8c517e46d35e5c9691545eda8fe9b6c40d6943a.tar.gz
ChibiOS-b8c517e46d35e5c9691545eda8fe9b6c40d6943a.tar.bz2
ChibiOS-b8c517e46d35e5c9691545eda8fe9b6c40d6943a.zip
Lines support in PAL driver.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8417 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/templates')
-rw-r--r--os/hal/templates/pal_lld.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/os/hal/templates/pal_lld.h b/os/hal/templates/pal_lld.h
index 71a85d1d9..d8be65452 100644
--- a/os/hal/templates/pal_lld.h
+++ b/os/hal/templates/pal_lld.h
@@ -36,6 +36,52 @@
/*===========================================================================*/
/**
+ * @name Port related definitions
+ * @{
+ */
+/**
+ * @brief Width, in bits, of an I/O port.
+ */
+#define PAL_IOPORTS_WIDTH 16
+
+/**
+ * @brief Whole port mask.
+ * @details This macro specifies all the valid bits into a port.
+ */
+#define PAL_WHOLE_PORT ((ioportmask_t)0xFFFF)
+/** @} */
+
+/**
+ * @name Line handling macros
+ * @{
+ */
+/**
+ * @brief Forms a line identifier.
+ * @details A port/pad pair are encoded into an @p ioline_t type. The encoding
+ * of this type is platform-dependent.
+ */
+#define PAL_LINE(port, pad) \
+ ((ioline_t)((uint32_t)(port)) | ((uint32_t)(pad)))
+
+/**
+ * @brief Decodes a port identifier from a line identifier.
+ */
+#define PAL_PORT(line) \
+ ((stm32_gpio_t *)(((uint32_t)(line)) & 0xFFFFFFF0U))
+
+/**
+ * @brief Decodes a pad identifier from a line identifier.
+ */
+#define PAL_PAD(line) \
+ ((uint32_t)((uint32_t)(line) & 0x0000000FU))
+
+/**
+ * @brief Value identifying an invalid line.
+ */
+#define PAL_NOLINE 0U
+/** @} */
+
+/**
* @brief Generic I/O ports 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
@@ -70,6 +116,11 @@ typedef uint32_t ioportmask_t;
typedef uint32_t iomode_t;
/**
+ * @brief Type of an I/O line.
+ */
+typedef uint32_t ioline_t;
+
+/**
* @brief Port Identifier.
* @details This type can be a scalar or some kind of pointer, do not make
* any assumption about it, use the provided macros when populating