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