aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/NRF51/NRF51822/hal_pal_lld.h
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/NRF51/NRF51822/hal_pal_lld.h')
-rw-r--r--os/hal/ports/NRF51/NRF51822/hal_pal_lld.h63
1 files changed, 51 insertions, 12 deletions
diff --git a/os/hal/ports/NRF51/NRF51822/hal_pal_lld.h b/os/hal/ports/NRF51/NRF51822/hal_pal_lld.h
index 4425d24..e5b62ee 100644
--- a/os/hal/ports/NRF51/NRF51822/hal_pal_lld.h
+++ b/os/hal/ports/NRF51/NRF51822/hal_pal_lld.h
@@ -38,18 +38,9 @@
#define TOTAL_GPIO_PADS 32
/**
- * @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
- * subsystem. This represents only the initial setup, specific pads
- * or whole ports can be reprogrammed at later time.
- * @note Implementations may extend this structure to contain more,
- * architecture dependent, fields.
+ * @name Port related definitions
+ * @{
*/
-typedef struct {
- uint32_t pads[TOTAL_GPIO_PADS];
-} PALConfig;
-
/**
* @brief Width, in bits, of an I/O port.
*/
@@ -60,6 +51,50 @@ typedef struct {
* @brief This macro specifies all the valid bits into a port.
*/
#define PAL_WHOLE_PORT ((ioportmask_t)0xFFFFFFFFU)
+/** @} */
+
+/**
+ * @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)(pad)))
+
+/**
+ * @brief Decodes a port identifier from a line identifier.
+ */
+#define PAL_PORT(line) \
+ ((ioportid_t)(IOPORT1))
+
+/**
+ * @brief Decodes a pad identifier from a line identifier.
+ */
+#define PAL_PAD(line) \
+ ((uint32_t)(line))
+
+/**
+ * @brief Value identifying an invalid line.
+ */
+#define PAL_NOLINE FFU
+/** @} */
+
+/**
+ * @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
+ * subsystem. This represents only the initial setup, specific pads
+ * or whole ports can be reprogrammed at later time.
+ * @note Implementations may extend this structure to contain more,
+ * architecture dependent, fields.
+ */
+typedef struct {
+ uint32_t pads[TOTAL_GPIO_PADS];
+} PALConfig;
/**
* @brief Digital I/O port sized unsigned type.
@@ -72,6 +107,11 @@ typedef uint32_t ioportmask_t;
typedef uint8_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
@@ -266,7 +306,6 @@ typedef NRF_GPIO_Type *ioportid_t;
NRF_GPIO->OUTSET = 1 << (pad); \
} while (0)
-
/**
* @brief Pad mode setup.
* @details This function programs a pad with the specified mode.