From 9d09f4977f88770729f617b6e2ddad892e7791f5 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Mon, 20 Jun 2016 18:55:49 +0200 Subject: bsp/tms570: update pinmux to provide support for initialization lists and clear of alt outputs. --- .../lib/libbsp/arm/tms570/include/tms570-pinmux.h | 136 +++++++++++---------- c/src/lib/libbsp/arm/tms570/include/tms570.h | 3 + 2 files changed, 74 insertions(+), 65 deletions(-) (limited to 'c/src/lib/libbsp/arm/tms570/include') diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570-pinmux.h b/c/src/lib/libbsp/arm/tms570/include/tms570-pinmux.h index 8979f231f0..8b93c66bfa 100644 --- a/c/src/lib/libbsp/arm/tms570/include/tms570-pinmux.h +++ b/c/src/lib/libbsp/arm/tms570/include/tms570-pinmux.h @@ -31,79 +31,35 @@ extern "C" { #endif /* __cplusplus */ -#define TMS570_PIN_NUM_SHIFT 0 -#define TMS570_PIN_NUM_MASK 0x0fff +#define TMS570_PIN_NUM_SHIFT 0 +#define TMS570_PIN_NUM_MASK 0x000007ff -#define TMS570_PIN_FNC_SHIFT 12 -#define TMS570_PIN_FNC_MASK 0xf000 - -#define TMS570_PIN_FNC_AUTO (-1) - -#define TMS570_PIN_AND_FNC(pin, fnc) \ - ((pin) | ((fnc)<> 2 != (reg)) || ((pin) & TMS570_PIN_CLEAR_RQ_MASK))? 0: \ + 1 << ((((pin) & TMS570_PIN_FNC_MASK) >> TMS570_PIN_FNC_SHIFT) + \ + ((pin) & 3) * 8) \ + ) + +#define TMS570_PINMMR_REG_VAL_ACTION(reg, pin) \ + TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, pin) | \ + ((pin) & TMS570_PIN_IN_ALT_MASK? \ + TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, (pin) >> TMS570_PIN_IN_ALT_SHIFT ): \ + 0) | + +/** + * Macro which computes value for PINMMRx register from pin list + * which is defined as macro calling action macro for each pin + * + * @param reg PINMMR register number (0 .. 30 for TMS570LS3137) + * @param pin_list declared as macro with parameters + * \c per_pin_action and \c common_arg which expands + * to list of \c per_pin_action(\c common_arg, \c TMS570_BALL_xx_function) + * + * @retval number which represents connections which should be enabled + * in given PINMMR register. Pin setup for other registers than specified + * are ignored + */ +#define TMS570_PINMMR_REG_VAL(reg, pin_list) \ + pin_list(TMS570_PINMMR_REG_VAL_ACTION, reg) 0 + +#define TMS570_PINMMR_COMA_LIST_ACTION(reg, pin) \ + (pin), + +/** + * Macro which generates list of pin and function specification from + * from pin list which is defined as macro calling action macro for each pin + * + * @param pin_list declared as macro with parameters + * \c per_pin_action and \c common_arg which expands + * to list of \c per_pin_action(\c common_arg, \c TMS570_BALL_xx_function) + * + * @retval list of coma separated pin+function combined values which is terminated by coma + * at the end + */ +#define TMS570_PINMMR_COMA_LIST(pin_list) \ + pin_list(TMS570_PINMMR_COMA_LIST_ACTION, 0) + + #endif /** @} */ diff --git a/c/src/lib/libbsp/arm/tms570/include/tms570.h b/c/src/lib/libbsp/arm/tms570/include/tms570.h index 439387e401..f3daac11de 100644 --- a/c/src/lib/libbsp/arm/tms570/include/tms570.h +++ b/c/src/lib/libbsp/arm/tms570/include/tms570.h @@ -38,6 +38,9 @@ */ #ifndef LIBBSP_ARM_TMS570 #define LIBBSP_ARM_TMS570 + +#include + #include #include #include -- cgit v1.2.3