From 5547e99922a8c44ac5d8ffd1e1a82793413630d3 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 5 Nov 2017 07:34:34 +0000 Subject: Aligned to latest PAL template. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10949 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/ports/LPC/LPC214x/hal_pal_lld.h | 72 ++++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) (limited to 'os') diff --git a/os/hal/ports/LPC/LPC214x/hal_pal_lld.h b/os/hal/ports/LPC/LPC214x/hal_pal_lld.h index 7c12d045e..f771c787f 100644 --- a/os/hal/ports/LPC/LPC214x/hal_pal_lld.h +++ b/os/hal/ports/LPC/LPC214x/hal_pal_lld.h @@ -25,7 +25,7 @@ #ifndef HAL_PAL_LLD_H #define HAL_PAL_LLD_H -#if HAL_USE_PAL || defined(__DOXYGEN__) +#if (HAL_USE_PAL == TRUE) || defined(__DOXYGEN__) /*===========================================================================*/ /* Unsupported modes and specific modes */ @@ -69,6 +69,10 @@ typedef struct { lpc214x_fio_setup_t P1Data; } PALConfig; +/** + * @name Port related definitions + * @{ + */ /** * @brief Width, in bits, of an I/O port. */ @@ -78,7 +82,38 @@ typedef struct { * @brief Whole port mask. * @details This macro specifies all the valid bits into a port. */ -#define PAL_WHOLE_PORT ((ioportmask_t)0xFFFFFFFF) +#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)(port)) | ((uint32_t)(pad))) + +/** + * @brief Decodes a port identifier from a line identifier. + */ +#define PAL_PORT(line) \ + ((FIO *)(((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 Digital I/O port sized unsigned type. @@ -90,11 +125,21 @@ 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. */ typedef FIO * ioportid_t; +/** + * @brief Type of an pad identifier. + */ +typedef uint32_t iopadid_t; + /*===========================================================================*/ /* I/O Ports Identifiers. */ /*===========================================================================*/ @@ -233,6 +278,25 @@ typedef FIO * ioportid_t; */ #define pal_lld_writepad(port, pad, bit) pal_lld_writegroup(port, 1, pad, bit) +/** + * @brief Returns a PAL event structure associated to a pad. + * + * @param[in] port port identifier + * @param[in] pad pad number within the port + * + * @notapi + */ +#define pal_lld_get_pad_event(port, pad) NULL; (void)port; (void)pad + +/** + * @brief Returns a PAL event structure associated to a line. + * + * @param[in] line line identifier + * + * @notapi + */ +#define pal_lld_get_line_event(line) NULL; (void)line + /** * @brief FIO port setup. * @details This function programs the pins direction within a port. @@ -241,7 +305,9 @@ typedef FIO * ioportid_t; */ #define pal_lld_lpc214x_set_direction(port, dir) ((port)->FIO_DIR = (dir)) +#if !defined(__DOXYGEN__) extern const PALConfig pal_default_config; +#endif #ifdef __cplusplus extern "C" { @@ -254,7 +320,7 @@ extern "C" { } #endif -#endif /* HAL_USE_PAL */ +#endif /* HAL_USE_PAL == TRUE */ #endif /* HAL_PAL_LLD_H */ -- cgit v1.2.3