RTEMS
5.0.0
bsps
arm
lpc176x
include
bsp
io-defs.h
Go to the documentation of this file.
1
9
/*
10
* Copyright (c) 2014 Taller Technologies.
11
*
12
* @author Boretto Martin (martin.boretto@tallertechnologies.com)
13
* @author Diaz Marcos (marcos.diaz@tallertechnologies.com)
14
* @author Lenarduzzi Federico (federico.lenarduzzi@tallertechnologies.com)
15
* @author Daniel Chicco (daniel.chicco@tallertechnologies.com)
16
*
17
* The license and distribution terms for this file may be
18
* found in the file LICENSE in this distribution or at
19
* http://www.rtems.org/license/LICENSE.
20
*/
21
22
#ifndef LIBBSP_ARM_LPC176X_IO_DEFS_H
23
#define LIBBSP_ARM_LPC176X_IO_DEFS_H
24
25
#include <
bsp/lpc176x.h
>
26
#include <
bsp/common-types.h
>
27
28
#ifdef __cplusplus
29
extern
"C"
{
30
#endif
/* __cplusplus */
31
32
#define LPC176X_PLL0CON 0XAAU
33
#define LPC176X_PLL0CFG 0X55U
34
35
#define LPC176X_CCLK_PRESCALER_DIVISOR 1000000U
36
37
#define LPC176X_PINSEL ( &PINSEL0 )
38
#define LPC176X_PINMODE ( &PINMODE0 )
39
40
#define LPC176X_PIN_SELECT( index ) ( ( index ) >> 4U )
41
#define LPC176X_PIN_SELECT_SHIFT( index ) ( ( ( index ) & 0xFU ) << 1U )
42
#define LPC176X_PIN_SELECT_MASK 0x3U
43
#define LPC176X_PIN_SELECT_MASK_SIZE 2U
44
#define LPC176X_PIN_UART_0_TXD 2U
45
#define LPC176X_PIN_UART_0_RXD 3U
46
#define LPC176X_PIN_UART_1_TXD 15U
47
#define LPC176X_PIN_UART_1_RXD 16U
48
#define LPC176X_PIN_UART_2_TXD 10U
49
#define LPC176X_PIN_UART_2_RXD 11U
50
#define LPC176X_PIN_UART_3_TXD 0U
51
#define LPC176X_PIN_UART_3_RXD 1U
52
53
#define LPC176X_MODULE_BITS_COUNT 32U
54
#define LPC176X_MODULE_COUNT ( LPC176X_MODULE_USB + 1U )
55
56
#define LPC176X_IO_PORT_COUNT 5U
57
#define LPC176X_IO_INDEX_MAX ( LPC176X_IO_PORT_COUNT * \
58
LPC176X_MODULE_BITS_COUNT )
59
#define LPC176X_IO_INDEX_BY_PORT( port, bit ) ( ( ( port ) << 5U ) + ( bit ) )
60
#define LPC176X_IO_PORT( index ) ( ( index ) >> 5U )
61
#define LPC176X_IO_PORT_BIT( index ) ( ( index ) & 0x1FU )
62
68
typedef
enum
{
69
LPC176X_PIN_FUNCTION_00,
70
LPC176X_PIN_FUNCTION_01,
71
LPC176X_PIN_FUNCTION_10,
72
LPC176X_PIN_FUNCTION_11,
73
LPC176X_PIN_FUNCTION_COUNT
74
}
75
lpc176x_pin_function
;
76
81
typedef
enum
{
82
LPC176X_PIN_MODE_PULLUP,
83
LPC176X_PIN_MODE_REPEATER,
84
LPC176X_PIN_MODE_NONE,
85
LPC176X_PIN_MODE_PULLDOWN,
86
LPC176X_PIN_MODE_COUNT
87
}
88
lpc176x_pin_mode
;
89
95
typedef
enum
{
96
LPC176X_PIN_TYPE_DEFAULT,
97
LPC176X_PIN_TYPE_ADC,
98
LPC176X_PIN_TYPE_DAC,
99
LPC176X_PIN_TYPE_OPEN_DRAIN
100
}
lpc176x_pin_type
;
101
107
typedef
enum
{
108
LPC176X_SCB_PCLKSEL0,
109
LPC176X_SCB_PCLKSEL1,
110
LPC176X_SCB_PCLKSEL_COUNT
111
}
lpc176x_scb_value_pclksel
;
112
116
typedef
struct
{
120
unsigned
char
power
: 1;
124
unsigned
char
clock
: 1;
128
unsigned
char
index
: 6;
129
}
lpc176x_module_entry
;
130
131
#define LPC176X_MODULE_ENTRY( mod, pwr, clk, idx ) \
132
[ mod ] = { \
133
.power = pwr, \
134
.clock = clk, \
135
.index = idx \
136
}
137
138
#ifdef __cplusplus
139
}
140
#endif
/* __cplusplus */
141
142
#endif
/* LIBBSP_ARM_LPC176X_IO_DEFS_H */
lpc176x_module_entry::index
unsigned char index
Index entry bits.
Definition:
io-defs.h:128
lpc176x_module_entry::power
unsigned char power
Power entry bit.
Definition:
io-defs.h:120
lpc176x_scb_value_pclksel
lpc176x_scb_value_pclksel
Represents each pclksel number.
Definition:
io-defs.h:107
lpc176x_module_entry
Defines the module entry.
Definition:
io-defs.h:116
lpc176x_pin_type
lpc176x_pin_type
Defines all type of pins.
Definition:
io-defs.h:95
lpc176x_pin_function
lpc176x_pin_function
Defines the functions according to the pin.
Definition:
io-defs.h:68
common-types.h
Definitions types used by some devices in common.
lpc176x.h
Specific register definitions according to lpc176x family boards.
lpc176x_module_entry::clock
unsigned char clock
Clock entry bit.
Definition:
io-defs.h:124
lpc176x_pin_mode
lpc176x_pin_mode
Defines the pin modes.
Definition:
io-defs.h:81
Generated by
1.8.13