]> rtime.felk.cvut.cz Git - lincan.git/blob - embedded/arch/arm/mach-lpc17xx/libs/hal/hal_gpio_def.h
Contributed support for LCP17xx devices and PiKRON's LMC1 board.
[lincan.git] / embedded / arch / arm / mach-lpc17xx / libs / hal / hal_gpio_def.h
1 #ifndef _HAL_GPIO_DEF_H_
2 #define _HAL_GPIO_DEF_H_
3
4 #ifndef PORT_SHIFT
5 #define PORT_SHIFT          5
6 #endif
7 #ifndef PORT_PIN
8 #define PORT_PIN(p,n,conf)  (((p)<<PORT_SHIFT) | (n) | (conf))
9 #define PORT_CONF_MASK      0xff000000
10 #endif
11
12 #define PORT_CONF_DIR_MASK  0x01000000
13 #define PORT_CONF_DIR_IN    (0x00000000 | PORT_CONF_SET_DIR)
14 #define PORT_CONF_DIR_OUT   (0x01000000 | PORT_CONF_SET_DIR)
15
16 #define PORT_CONF_INIT_MASK 0x02000000
17 #define PORT_CONF_INIT_LOW  0x00000000
18 #define PORT_CONF_INIT_HIGH 0x02000000
19
20 #define PORT_CONF_OD_MASK   0x04000000
21 #define PORT_CONF_OD_OFF    0x00000000
22 #define PORT_CONF_OD_ON     0x04000000
23
24 #define PORT_CONF_SET_DIR   0x08000000
25
26 #define PORT_CONF_MODE_MASK 0x30000000
27 #define PORT_CONF_MODE_PU   0x00000000
28 #define PORT_CONF_MODE_REP  0x10000000
29 #define PORT_CONF_MODE_NORM 0x20000000
30 #define PORT_CONF_MODE_PD   0x30000000
31
32 #define PORT_CONF_FNC_MASK  0xc0000000
33 #define PORT_CONF_FNC_GPIO  0x00000000
34 #define PORT_CONF_FNC_0     0x00000000
35 #define PORT_CONF_FNC_1     0x40000000
36 #define PORT_CONF_FNC_2     0x80000000
37 #define PORT_CONF_FNC_3     0xc0000000
38
39 #define PORT_CONF_GPIO_IN   (PORT_CONF_DIR_IN | PORT_CONF_FNC_GPIO | PORT_CONF_MODE_NORM)
40 #define PORT_CONF_GPIO_IN_PU (PORT_CONF_DIR_IN | PORT_CONF_FNC_GPIO | PORT_CONF_MODE_PU)
41 #define PORT_CONF_GPIO_IN_PD (PORT_CONF_DIR_IN | PORT_CONF_FNC_GPIO | PORT_CONF_MODE_PD)
42 #define PORT_CONF_GPIO_IN_REP (PORT_CONF_DIR_IN | PORT_CONF_FNC_GPIO | PORT_CONF_MODE_REP)
43
44 #define PORT_CONF_GPIO_OUT_LO (PORT_CONF_DIR_OUT | PORT_CONF_FNC_GPIO | PORT_CONF_INIT_LOW)
45 #define PORT_CONF_GPIO_OUT_HI (PORT_CONF_DIR_OUT | PORT_CONF_FNC_GPIO | PORT_CONF_INIT_HIGH)
46 #define PORT_CONF_GPIO_OUT_LO_OD (PORT_CONF_GPIO_OUT_LO | PORT_CONF_OD_ON)
47 #define PORT_CONF_GPIO_OUT_HI_OD (PORT_CONF_GPIO_OUT_LO | PORT_CONF_OD_ON)
48
49 #define PORT_CONF_OUT_LO_NORM (PORT_CONF_DIR_OUT | PORT_CONF_INIT_LOW | PORT_CONF_MODE_NORM)
50 #define PORT_CONF_IN_PU       (PORT_CONF_DIR_IN | PORT_CONF_MODE_PU)
51
52
53 #endif /*_HAL_GPIO_H_*/