added PAL_LINE support

follow template order
This commit is contained in:
Stephane D'Alu 2016-05-09 15:31:42 +02:00
parent de959be01f
commit 9308e90aff
1 changed files with 51 additions and 12 deletions

View File

@ -37,6 +37,52 @@
#define TOTAL_GPIO_PADS 32
/**
* @name Port related definitions
* @{
*/
/**
* @brief Width, in bits, of an I/O port.
*/
#define PAL_IOPORTS_WIDTH 32U
/**
* @brief Whole port mask.
* @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
@ -50,17 +96,6 @@ typedef struct {
uint32_t pads[TOTAL_GPIO_PADS];
} PALConfig;
/**
* @brief Width, in bits, of an I/O port.
*/
#define PAL_IOPORTS_WIDTH 32U
/**
* @brief Whole port mask.
* @brief This macro specifies all the valid bits into a port.
*/
#define PAL_WHOLE_PORT ((ioportmask_t)0xFFFFFFFFU)
/**
* @brief Digital I/O port sized unsigned type.
*/
@ -71,6 +106,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
@ -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.