embedded-software
reusable software modules for embedded systems
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hal_pin_macros.h
Go to the documentation of this file.
1 // Contains macros.h include
2 #include "library.h"
3 
9 #define GET_GPIO_PORT(x) (GPIOA0_BASE + (0x1000 * (x/8)))
10 #define GET_GPIO_PORT_PERIPHERAL(x) (PRCM_GPIOA0 + (x/8))
11 #define GET_GPIO_BIT(x) (1 << (x % 8))
12 #define GET_GPIO_PIN(x) CAT3(GPIO, x, _PIN_NUM)
13 
14 #define GPIO_READ(x) ((GPIOPinRead(GET_GPIO_PORT(x), GET_GPIO_BIT(x)) >> (x % 8)) & 0x01)
15 
16 /******************************************************
17  * Macros for modes of each pin
18  *****************************************************/
19 
20 #define GPIO0_UART0_RTS PIN_MODE_3
21 #define GPIO0_McAXR0 PIN_MODE_4
22 #define GPIO0_McAXR1 PIN_MODE_6
23 #define GPIO0_GT_CCP00 PIN_MODE_7
24 #define GPIO0_GSPI_CS PIN_MODE_9
25 #define GPIO0_UART1_RTS PIN_MODE_10
26 #define GPIO0_UART0_CTS PIN_MODE_12
27 
28 #define GPIO1_UART0_TX PIN_MODE_3
29 #define GPIO1_PIXCLK PIN_MODE_4
30 #define GPIO1_UART1_TX PIN_MODE_6
31 #define GPIO1_GT_CCP01 PIN_MODE_7
32 
33 #define GPIO2_UART0_RX PIN_MODE_3
34 #define GPIO2_UART1_RX PIN_MODE_6
35 #define GPIO2_GT_CCP02 PIN_MODE_7
36 
37 #define GPIO3_CAM_D3 PIN_MODE_4
38 #define GPIO3_UART1_TX PIN_MODE_6
39 
40 #define GPIO4_CAM_D2 PIN_MODE_4
41 #define GPIO4_UART1_RX PIN_MODE_6
42 
43 #define GPIO5_CAM_D1 PIN_MODE_4
44 #define GPIO5_McAXR1 PIN_MODE_6
45 #define GPIO5_GT_CCP05 PIN_MODE_7
46 
47 #define GPIO6_UART1_CTS PIN_MODE_3
48 #define GPIO6_CAM_D0 PIN_MODE_4
49 #define GPIO6_UART0_RTS PIN_MODE_5
50 #define GPIO6_UART0_CTS PIN_MODE_6
51 #define GPIO6_GT_CCP06 PIN_MODE_7
52 
53 #define GPIO7_UART1_RTS PIN_MODE_3
54 #define GPIO7_UART0_RTS PIN_MODE_10
55 #define GPIO7_UART0_TX PIN_MODE_11
56 #define GPIO7_McACLKX PIN_MODE_13
57 
58 #define GPIO8_SDCARD_IRQ PIN_MODE_6
59 #define GPIO8_McAFSX PIN_MODE_7
60 #define GPIO8_GT_CCP06 PIN_MODE_12
61 
62 #define GPIO9_GT_PWM05 PIN_MODE_3
63 #define GPIO9_SDCARD_D0 PIN_MODE_6
64 #define GPIO9_McAXR0 PIN_MODE_7
65 #define GPIO9_GT_CCP00 PIN_MODE_12
66 
67 #define GPIO10_I2C_SCL PIN_MODE_1
68 #define GPIO10_GT_PWM06 PIN_MODE_3
69 #define GPIO10_SDCARD_CLK PIN_MODE_6
70 #define GPIO10_UART1_TX PIN_MODE_7
71 #define GPIO10_GT_CCP01 PIN_MODE_12
72 
73 #define GPIO11_I2C_SDA PIN_MODE_1
74 #define GPIO11_GT_PWM07 PIN_MODE_3
75 #define GPIO11_XVCLK PIN_MODE_4
76 #define GPIO11_SDCARD_CMD PIN_MODE_6
77 #define GPIO11_UART1_RX PIN_MODE_7
78 #define GPIO11_GT_CCP02 PIN_MODE_12
79 #define GPIO11_McAFSX PIN_MODE_13
80 
81 #define GPIO12_McACLK PIN_MODE_3
82 #define GPIO12_VSYNC PIN_MODE_4
83 #define GPIO12_I2C_SCL PIN_MODE_5
84 #define GPIO12_UART0_TX PIN_MODE_7
85 #define GPIO12_GT_CCP03 PIN_MODE_12
86 
87 #define GPIO13_HSYNC PIN_MODE_4
88 #define GPIO13_I2C_SDA PIN_MODE_5
89 #define GPIO13_UART0_RX PIN_MODE_7
90 #define GPIO13_GT_CCP04 PIN_MODE_12
91 
92 #define GPIO14_CAM_D4 PIN_MODE_4
93 #define GPIO14_I2C_SCL PIN_MODE_5
94 #define GPIO14_GSPI_CLK PIN_MODE_7
95 #define GPIO14_GT_CCP05 PIN_MODE_12
96 
97 #define GPIO15_CAM_D5 PIN_MODE_4
98 #define GPIO15_I2C_SCL PIN_MODE_5
99 #define GPIO15_GSPI_MIMO PIN_MODE_7
100 #define GPIO15_SDCARD_D0 PIN_MODE_8
101 #define GPIO15_GT_CCP06 PIN_MODE_13
102 
103 #define GPIO16_CAM_D6 PIN_MODE_4
104 #define GPIO16_UART1_TX PIN_MODE_5
105 #define GPIO16_GSPI_MOSI PIN_MODE_7
106 #define GPIO16_SDCARD_CLK PIN_MODE_8
107 #define GPIO16_GT_CCP07 PIN_MODE_13
108 
109 #define GPIO17_CAM_D7 PIN_MODE_4
110 #define GPIO17_UART1_RX PIN_MODE_5
111 #define GPIO17_GSPI_CS PIN_MODE_7
112 #define GPIO17_SDCARD_CMD PIN_MODE_8
113 
114 #define GPIO22_GTCCP04 PIN_MODE_5
115 #define GPIO22_McAFSC PIN_MODE_7
116 
117 /******************************************************
118  * Macros for getting pin number from GPIO Number
119  *****************************************************/
120 
121 #define GPIO0_PIN_NUM PIN_50
122 #define GPIO1_PIN_NUM PIN_55
123 #define GPIO2_PIN_NUM PIN_57
124 #define GPIO3_PIN_NUM PIN_58
125 #define GPIO4_PIN_NUM PIN_59
126 #define GPIO5_PIN_NUM PIN_60
127 #define GPIO6_PIN_NUM PIN_61
128 #define GPIO7_PIN_NUM PIN_62
129 #define GPIO8_PIN_NUM PIN_63
130 #define GPIO9_PIN_NUM PIN_64
131 #define GPIO10_PIN_NUM PIN_01
132 #define GPIO11_PIN_NUM PIN_02
133 #define GPIO12_PIN_NUM PIN_03
134 #define GPIO13_PIN_NUM PIN_04
135 #define GPIO14_PIN_NUM PIN_05
136 #define GPIO15_PIN_NUM PIN_06
137 #define GPIO16_PIN_NUM PIN_07
138 #define GPIO17_PIN_NUM PIN_08
139 #define GPIO22_PIN_NUM PIN_15
140 #define GPIO28_PIN_NUM PIN_18
141 #define GPIO30_PIN_NUM PIN_53
142 
143 
144 
145 
146 
147 
148 
149 
150 
151 
152 
153 
154 
155 
156 
157 
158 
159 
160 
161 
162 
163 
164 
165