RTEMS 6.1-rc1
tms570-pinmux.h
Go to the documentation of this file.
1
9/*
10 * Copyright (c) 2015 Premysl Houdek <kom541000@gmail.com>
11 *
12 * Google Summer of Code 2014 at
13 * Czech Technical University in Prague
14 * Zikova 1903/4
15 * 166 36 Praha 6
16 * Czech Republic
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23#ifndef LIBBSP_ARM_TMS570_PINMUX_H
24#define LIBBSP_ARM_TMS570_PINMUX_H
25
26#include <stddef.h>
27#include <stdint.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif /* __cplusplus */
32
33
34#define TMS570_PIN_NUM_SHIFT 0
35#define TMS570_PIN_NUM_MASK 0x000007ff
36
37/*
38 * Request clear of interconnection in setup
39 * to ensure that previous peripheral to pin
40 * connection is not enabled in parallel to other one.
41 * Mask is ored with pin number in such list.
42 */
43#define TMS570_PIN_CLEAR_RQ_MASK 0x00008000
44
45#define TMS570_PIN_FNC_SHIFT 11
46#define TMS570_PIN_FNC_MASK 0x00007800
47
54#define TMS570_PIN_FNC_CLEAR 0x10U
55
56#define TMS570_PIN_NUM_FNC_MASK 0x0000ffff
57
58#define TMS570_PIN_IN_ALT_SHIFT 16
59#define TMS570_PIN_IN_ALT_MASK 0xffff0000
60
61#define TMS570_PIN_FNC_AUTO (-1)
62
72#define TMS570_PIN_AND_FNC(pin, fnc) \
73 ((pin) | ((fnc) << TMS570_PIN_FNC_SHIFT))
74
75#define TMS570_PIN_WITH_IN_ALT(pin_num_and_fnc, pin_in_alt_num_and_fnc) \
76 ((pin_num_and_fnc) | ((pin_in_alt_num_and_fnc) << TMS570_PIN_IN_ALT_SHIFT))
77
78#define TMS570_BALL_WITH_MMR(mmrx, pos) \
79 ((pos) | ((mmrx) << 2))
80
88
98void tms570_pin_config_apply(uint32_t config);
99
111void tms570_pin_config_array_apply(const uint32_t *config, size_t count);
112
117
118/* Generic functions select pin to peripheral connection */
119
120void tms570_bsp_pin_set_function(int pin_num, int pin_fnc);
121
122void tms570_bsp_pin_clear_function(int pin_num, int pin_fnc);
123
124void tms570_bsp_pin_config_one(uint32_t pin_num_and_fnc);
125
126void tms570_bsp_pinmmr_config(const uint32_t *pinmmr_values, int reg_start, int reg_count);
127
128#define TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, pin) \
129 (((((pin) & TMS570_PIN_NUM_MASK) >> 2 != (reg)) || ((pin) & TMS570_PIN_CLEAR_RQ_MASK))? 0: \
130 1 << ((((pin) & TMS570_PIN_FNC_MASK) >> TMS570_PIN_FNC_SHIFT) + \
131 ((pin) & 3) * 8) \
132 )
133
134#define TMS570_PINMMR_REG_VAL_ACTION(reg, pin) \
135 TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, pin) | \
136 ((pin) & TMS570_PIN_IN_ALT_MASK? \
137 TMS570_PINMMR_REG_SINGLE_VAL_ACTION(reg, (pin) >> TMS570_PIN_IN_ALT_SHIFT ): \
138 0) |
139
153#define TMS570_PINMMR_REG_VAL(reg, pin_list) \
154 pin_list(TMS570_PINMMR_REG_VAL_ACTION, reg) 0
155
156#define TMS570_PINMMR_COMA_LIST_ACTION(reg, pin) \
157 (pin),
158
170#define TMS570_PINMMR_COMA_LIST(pin_list) \
171 pin_list(TMS570_PINMMR_COMA_LIST_ACTION, 0)
172
175#ifdef __cplusplus
176}
177#endif /* __cplusplus */
178
179#endif /* LIBBSP_ARM_TMS570_IRQ_H */
Definition: deflate.c:114
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:150
void tms570_bsp_pin_set_function(int pin_num, int pin_fnc)
select desired function of pin/ball
Definition: pinmux.c:60
void tms570_pin_config_array_apply(const uint32_t *config, size_t count)
Applies a pin configuration array.
Definition: pinmux.c:227
void tms570_bsp_pin_config_one(uint32_t pin_num_and_fnc)
configure one pin according to its function specification
Definition: pinmux.c:121
void tms570_pin_config_apply(uint32_t config)
Applies a pin configuration.
Definition: pinmux.c:212
void tms570_pin_config_complete(void)
Completes a pin configuration sequence.
Definition: pinmux.c:236
void tms570_pin_config_prepare(void)
Prepares a pin configuration sequence.
Definition: pinmux.c:184
void tms570_bsp_pin_clear_function(int pin_num, int pin_fnc)
clear connection between pin and specified peripherals/function
Definition: pinmux.c:85