This header file provides interfaces of the I/O Multiplexing Module (IOMM) support.
More...
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
|
#define | TMS570_PIN_NUM_SHIFT 0 |
|
#define | TMS570_PIN_NUM_MASK 0x000007ff |
|
#define | TMS570_PIN_CLEAR_RQ_MASK 0x00008000 |
|
#define | TMS570_PIN_FNC_SHIFT 11 |
|
#define | TMS570_PIN_FNC_MASK 0x00007800 |
|
#define | TMS570_PIN_FNC_CLEAR 0x10U |
| This constant indicates that all eight function bits associated with the pin shall be cleared.
|
|
#define | TMS570_PIN_NUM_FNC_MASK 0x0000ffff |
|
#define | TMS570_PIN_IN_ALT_SHIFT 16 |
|
#define | TMS570_PIN_IN_ALT_MASK 0xffff0000 |
|
#define | TMS570_PIN_FNC_AUTO (-1) |
|
#define | TMS570_PIN_AND_FNC(pin, fnc) ((pin) | ((fnc) << TMS570_PIN_FNC_SHIFT)) |
| Defines the function of the pin.
|
|
#define | TMS570_PIN_WITH_IN_ALT(pin_num_and_fnc, pin_in_alt_num_and_fnc) ((pin_num_and_fnc) | ((pin_in_alt_num_and_fnc) << TMS570_PIN_IN_ALT_SHIFT)) |
|
#define | TMS570_BALL_WITH_MMR(mmrx, pos) ((pos) | ((mmrx) << 2)) |
|
#define | TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, pin) |
|
#define | TMS570_PINMMR_REG_VAL_ACTION(reg, pin) |
|
#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), |
|
#define | TMS570_PINMMR_COMA_LIST(pin_list) pin_list(TMS570_PINMMR_COMA_LIST_ACTION, 0) |
|
This header file provides interfaces of the I/O Multiplexing Module (IOMM) support.
◆ TMS570_PIN_AND_FNC
#define TMS570_PIN_AND_FNC |
( |
|
pin, |
|
|
|
fnc |
|
) |
| ((pin) | ((fnc) << TMS570_PIN_FNC_SHIFT)) |
Defines the function of the pin.
- Parameters
-
pin | is the pin identifier. Use TMS570_BALL_WITH_MMR() to define the pin identifier. |
param fnc is the pin function. The pin function shall be the function bit index or TMS570_PIN_FNC_CLEAR.
◆ TMS570_PIN_FNC_CLEAR
#define TMS570_PIN_FNC_CLEAR 0x10U |
This constant indicates that all eight function bits associated with the pin shall be cleared.
Use it as a special value for the pin function in TMS570_PIN_AND_FNC().
◆ TMS570_PINMMR_COMA_LIST
#define TMS570_PINMMR_COMA_LIST |
( |
|
pin_list | ) |
pin_list(TMS570_PINMMR_COMA_LIST_ACTION, 0) |
Macro which generates list of pin and function specification from from pin list which is defined as macro calling action macro for each pin
- Parameters
-
pin_list | declared as macro with parameters per_pin_action and common_arg which expands to list of per_pin_action (common_arg , TMS570_BALL_xx_function ) |
- Return values
-
list | of coma separated pin+function combined values which is terminated by coma at the end |
◆ TMS570_PINMMR_REG_SINGLE_VAL_ACTION
#define TMS570_PINMMR_REG_SINGLE_VAL_ACTION |
( |
|
reg, |
|
|
|
pin |
|
) |
| |
Value: (((((pin) & TMS570_PIN_NUM_MASK) >> 2 != (reg)) || ((pin) & TMS570_PIN_CLEAR_RQ_MASK))? 0: \
1 << ((((pin) & TMS570_PIN_FNC_MASK) >> TMS570_PIN_FNC_SHIFT) + \
((pin) & 3) * 8) \
)
◆ TMS570_PINMMR_REG_VAL
#define TMS570_PINMMR_REG_VAL |
( |
|
reg, |
|
|
|
pin_list |
|
) |
| pin_list(TMS570_PINMMR_REG_VAL_ACTION, reg) 0 |
Macro which computes value for PINMMRx register from pin list which is defined as macro calling action macro for each pin
- Parameters
-
reg | PINMMR register number (0 .. 30 for TMS570LS3137) |
pin_list | declared as macro with parameters per_pin_action and common_arg which expands to list of per_pin_action (common_arg , TMS570_BALL_xx_function ) |
- Return values
-
number | which represents connections which should be enabled in given PINMMR register. Pin setup for other registers than specified are ignored |
◆ TMS570_PINMMR_REG_VAL_ACTION
#define TMS570_PINMMR_REG_VAL_ACTION |
( |
|
reg, |
|
|
|
pin |
|
) |
| |
Value: 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) |
◆ tms570_bsp_pin_clear_function()
void tms570_bsp_pin_clear_function |
( |
int |
pin_num, |
|
|
int |
pin_fnc |
|
) |
| |
clear connection between pin and specified peripherals/function
This function switches off given connection and leaves rest of multiplexer setup intact.
- Parameters
-
[in] | pin_num | pin/ball identifier (index into pinmux array) |
[in] | pin_fnc | function number 0 .. 7, if value TMS570_PIN_FNC_AUTO is specified then pin function is extracted from pin_num argument |
- Return values
-
◆ tms570_bsp_pin_config_one()
void tms570_bsp_pin_config_one |
( |
uint32_t |
pin_num_and_fnc | ) |
|
configure one pin according to its function specification
The function setups multiplexer to interconnect pin with specified function/peripheral. Predefined values for pins combined with function are in a format TMS570_BALL_ column
row
function
(for example TMS570_BALL_W3_SCIRX
). If the function can be connected to more pins then specification includes infomation which allows to disconnect alternative pin to peripheral input connection or switch input multiplexer to right pin.
- Parameters
-
[in] | pin_num_and_fnc | pin function descriptor is build by macro TMS570_PIN_AND_FNC which takes pin/pinmmr specification build by TMS570_BALL_WITH_MMR and function index in output multiplexer. If the peripheral can be connected to other input alternative then actual pin description and alternative to disconnected/reconnect are combined together by TMS570_PIN_WITH_IN_ALT macro. If clear of alternative connection is required then flag TMS570_PIN_CLEAR_RQ_MASK is ored to alternative description. |
- Return values
-
◆ tms570_bsp_pin_set_function()
void tms570_bsp_pin_set_function |
( |
int |
pin_num, |
|
|
int |
pin_fnc |
|
) |
| |
select desired function of pin/ball
The function setups multiplexer to interconnect pin with specified function/peripheral. Pin number is index into pinmux entries array. Predefined values for pins are in a format TMS570_BALL_ column
row
(for example TMS570_BALL_N19
). The multiplexer allows to interconnect one pin to multiple signal sources/sinks in the theory but it is usually bad choice. The function sets only specified function and clears all other connections.
- Parameters
-
[in] | pin_num | pin/ball identifier (index into pinmux array), |
[in] | pin_fnc | function number 0 .. 7, if value TMS570_PIN_FNC_AUTO is specified then pin function is extracted from pin_num argument |
- Return values
-
◆ tms570_bsp_pinmmr_config()
void tms570_bsp_pinmmr_config |
( |
const uint32_t * |
pinmmr_values, |
|
|
int |
reg_start, |
|
|
int |
reg_count |
|
) |
| |
configure block or whole pin multiplexer
Function change multiplexer content. It is intended for initial chip setup and does not use locking. If complete reconfiguration is required at runtime then it is application responsibility to protect and serialize change with peripherals drivers and parallel calls
- Parameters
-
[in] | pinmmr_values | pointer to array with required multiplexer setup |
[in] | reg_start | starting register, this allows to configure non-consecutive registers groups found on some MCU family members |
[in] | reg_count | number of words in initialization array to set to corresponding registers |
- Return values
-
◆ tms570_pin_config_apply()
void tms570_pin_config_apply |
( |
uint32_t |
config | ) |
|
Applies a pin configuration.
This function can only be used if the pin configuration was prepared by tms570_pin_config_prepare().
- Parameters
-
◆ tms570_pin_config_array_apply()
void tms570_pin_config_array_apply |
( |
const uint32_t * |
config, |
|
|
size_t |
count |
|
) |
| |
Applies a pin configuration array.
This function can only be used if the pin configuration was prepared by tms570_pin_config_prepare().
- Parameters
-
config | is the pin configuration array. Calls tms570_pin_config_apply() for each pin configuration in the array. |
count | is the element count of the pin configuration array. |
◆ tms570_pin_config_prepare()
void tms570_pin_config_prepare |
( |
void |
| ) |
|