23 #ifndef LIBBSP_ARM_TMS570_PINMUX_H 24 #define LIBBSP_ARM_TMS570_PINMUX_H 27 #include <bsp/tms570.h> 34 #define TMS570_PIN_NUM_SHIFT 0 35 #define TMS570_PIN_NUM_MASK 0x000007ff 43 #define TMS570_PIN_CLEAR_RQ_MASK 0x00000800 45 #define TMS570_PIN_FNC_SHIFT 12 46 #define TMS570_PIN_FNC_MASK 0x0000f000 48 #define TMS570_PIN_NUM_FNC_MASK 0x0000ffff 50 #define TMS570_PIN_IN_ALT_SHIFT 16 51 #define TMS570_PIN_IN_ALT_MASK 0xffff0000 53 #define TMS570_PIN_FNC_AUTO (-1) 55 #define TMS570_PIN_AND_FNC(pin, fnc) \ 56 ((pin) | ((fnc) << TMS570_PIN_FNC_SHIFT)) 58 #define TMS570_PIN_WITH_IN_ALT(pin_num_and_fnc, pin_in_alt_num_and_fnc) \ 59 ((pin_num_and_fnc) | ((pin_in_alt_num_and_fnc) << TMS570_PIN_IN_ALT_SHIFT)) 61 #define TMS570_BALL_WITH_MMR(mmrx, pos) \ 62 ((pos) | ((mmrx) << 2)) 75 tms570_bsp_pin_to_pinmmrx(
volatile uint32_t **pinmmrx,
unsigned int *pin_shift,
78 pin_num = (pin_num & TMS570_PIN_NUM_MASK) >> TMS570_PIN_NUM_SHIFT;
79 *pinmmrx = &TMS570_IOMM.PINMUX.PINMMR0 + (pin_num >> 2);
80 *pin_shift = (pin_num & 0x3)*8;
83 #define TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, pin) \ 84 (((((pin) & TMS570_PIN_NUM_MASK) >> 2 != (reg)) || ((pin) & TMS570_PIN_CLEAR_RQ_MASK))? 0: \ 85 1 << ((((pin) & TMS570_PIN_FNC_MASK) >> TMS570_PIN_FNC_SHIFT) + \ 89 #define TMS570_PINMMR_REG_VAL_ACTION(reg, pin) \ 90 TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, pin) | \ 91 ((pin) & TMS570_PIN_IN_ALT_MASK? \ 92 TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, (pin) >> TMS570_PIN_IN_ALT_SHIFT ): \ 108 #define TMS570_PINMMR_REG_VAL(reg, pin_list) \ 109 pin_list(TMS570_PINMMR_REG_VAL_ACTION, reg) 0 111 #define TMS570_PINMMR_COMA_LIST_ACTION(reg, pin) \ 125 #define TMS570_PINMMR_COMA_LIST(pin_list) \ 126 pin_list(TMS570_PINMMR_COMA_LIST_ACTION, 0) void tms570_bsp_pin_config_one(uint32_t pin_num_and_fnc)
configure one pin according to its function specification
Definition: pinmux.c:110
void tms570_bsp_pin_set_function(int pin_num, int pin_fnc)
select desired function of pin/ball
Definition: pinmux.c:49
void tms570_bsp_pin_clear_function(int pin_num, int pin_fnc)
clear connection between pin and specified peripherals/function
Definition: pinmux.c:74
void tms570_bsp_pinmmr_config(const uint32_t *pinmmr_values, int reg_start, int reg_count)
configure block or whole pin multiplexer
Definition: pinmux.c:161