1 /*!
2 * ======== GPIO ========
3 * MSP430 General Purpose Input Output Ports
4 */
5 metaonlyinterface IGPIO inherits xdc.platform.IPeripheral {
6
7 /*! GPIO Bit 0 Definitions */
8 enum Bit0_t {
9 BIT0_OFF = 0x00u,
10 BIT0 = 0x01u
11 };
12
13 enum Bit1_t {
14 BIT1_OFF = 0x00u,
15 BIT1 = 0x02u
16 };
17
18 enum Bit2_t {
19 BIT2_OFF = 0x00u,
20 BIT2 = 0x04u
21 };
22
23 enum Bit3_t {
24 BIT3_OFF = 0x00u,
25 BIT3 = 0x08u
26 };
27
28 enum Bit4_t {
29 BIT4_OFF = 0x00u,
30 BIT4 = 0x10u
31 };
32
33 enum Bit5_t {
34 BIT5_OFF = 0x00u,
35 BIT5 = 0x20u
36 };
37
38 enum Bit6_t {
39 BIT6_OFF = 0x00u,
40 BIT6 = 0x20u
41 };
42
43 enum Bit7_t {
44 BIT7_OFF = 0x00u,
45 BIT7 = 0x80u
46 };
47
48 /*!
49 * ======== GpioBits8_t ========
50 * Generic GPIO 8-bit register
51 *
52 * @see #GpioBits8_t
53 */
54 struct GpioBits8PxIn_t {
55 Bit0_t Bit0; /*! GPIO Input Signal Bit 0 */
56 Bit1_t Bit1; /*! GPIO Input Signal Bit 1 */
57 Bit2_t Bit2; /*! GPIO Input Signal Bit 2 */
58 Bit3_t Bit3; /*! GPIO Input Signal Bit 3 */
59 Bit4_t Bit4; /*! GPIO Input Signal Bit 4 */
60 Bit5_t Bit5; /*! GPIO Input Signal Bit 5 */
61 Bit6_t Bit6; /*! GPIO Input Signal Bit 6 */
62 Bit7_t Bit7; /*! GPIO Input Signal Bit 7 */
63 }
64
65 /*!
66 * ======== GpioBits8PxOut_t ========
67 * Generic GPIO 8-bit PxOUT register
68 *
69 * @see #GpioBits8PxOut_t
70 */
71 struct GpioBits8PxOut_t {
72 Bit0_t Bit0; /*! GPIO Output Signal Bit 0 */
73 Bit1_t Bit1; /*! GPIO Output Signal Bit 1 */
74 Bit2_t Bit2; /*! GPIO Output Signal Bit 2 */
75 Bit3_t Bit3; /*! GPIO Output Signal Bit 3 */
76 Bit4_t Bit4; /*! GPIO Output Signal Bit 4 */
77 Bit5_t Bit5; /*! GPIO Output Signal Bit 5 */
78 Bit6_t Bit6; /*! GPIO Output Signal Bit 6 */
79 Bit7_t Bit7; /*! GPIO Output Signal Bit 7 */
80 }
81
82 /*!
83 * ======== GpioBits8PxDir_t ========
84 * Generic GPIO 8-bit PxDIR register
85 *
86 * @see #GpioBits8PxDir_t
87 */
88 struct GpioBits8PxDir_t {
89 Bit0_t Bit0; /*! GPIO Select Direction Bit 0
90 * Bit = 0: The port pin is switched to input direction
91 * Bit = 1: The port pin is switched to output direction */
92 Bit1_t Bit1; /*! GPIO Select Direction Bit 1
93 * Bit = 0: The port pin is switched to input direction
94 * Bit = 1: The port pin is switched to output direction */
95 Bit2_t Bit2; /*! GPIO Select Direction Bit 2
96 * Bit = 0: The port pin is switched to input direction
97 * Bit = 1: The port pin is switched to output direction */
98 Bit3_t Bit3; /*! GPIO Select Direction Bit 3
99 * Bit = 0: The port pin is switched to input direction
100 * Bit = 1: The port pin is switched to output direction */
101 Bit4_t Bit4; /*! GPIO Select Direction Bit 4
102 * Bit = 0: The port pin is switched to input direction
103 * Bit = 1: The port pin is switched to output direction */
104 Bit5_t Bit5; /*! GPIO Select Direction Bit 5
105 * Bit = 0: The port pin is switched to input direction
106 * Bit = 1: The port pin is switched to output direction */
107 Bit6_t Bit6; /*! GPIO Select Direction Bit 6
108 * Bit = 0: The port pin is switched to input direction
109 * Bit = 1: The port pin is switched to output direction */
110 Bit7_t Bit7; /*! GPIO Select Direction Bit 7
111 * Bit = 0: The port pin is switched to input direction
112 * Bit = 1: The port pin is switched to output direction */
113 }
114
115 /*!
116 * ======== GpioBits8PxRen_t ========
117 * Generic GPIO 8-bit PxREN register
118 *
119 * @see #GpioBits8PxRen_t
120 */
121 struct GpioBits8PxRen_t {
122 Bit0_t Bit0; /*! GPIO Enables or Disables Pullup/Pulldown Bit 0
123 * Bit = 0: Pullup/pulldown resistor disabled
124 * Bit = 1: Pullup/pulldown resistor enabled */
125 Bit1_t Bit1; /*! GPIO Enables or Disables Pullup/Pulldown Bit 1
126 * Bit = 0: Pullup/pulldown resistor disabled
127 * Bit = 1: Pullup/pulldown resistor enabled */
128 Bit2_t Bit2; /*! GPIO Enables or Disables Pullup/Pulldown Bit 2
129 * Bit = 0: Pullup/pulldown resistor disabled
130 * Bit = 1: Pullup/pulldown resistor enabled */
131 Bit3_t Bit3; /*! GPIO Enables or Disables Pullup/Pulldown Bit 3
132 * Bit = 0: Pullup/pulldown resistor disabled
133 * Bit = 1: Pullup/pulldown resistor enabled */
134 Bit4_t Bit4; /*! GPIO Enables or Disables Pullup/Pulldown Bit 4
135 * Bit = 0: Pullup/pulldown resistor disabled
136 * Bit = 1: Pullup/pulldown resistor enabled */
137 Bit5_t Bit5; /*! GPIO Enables or Disables Pullup/Pulldown Bit 5
138 * Bit = 0: Pullup/pulldown resistor disabled
139 * Bit = 1: Pullup/pulldown resistor enabled */
140 Bit6_t Bit6; /*! GPIO Enables or Disables Pullup/Pulldown Bit 6
141 * Bit = 0: Pullup/pulldown resistor disabled
142 * Bit = 1: Pullup/pulldown resistor enabled */
143 Bit7_t Bit7; /*! GPIO Enables or Disables Pullup/Pulldown Bit 7
144 * Bit = 0: Pullup/pulldown resistor disabled
145 * Bit = 1: Pullup/pulldown resistor enabled */
146 }
147
148 /*!
149 * ======== GpioBits8PxSel_t ========
150 * Generic GPIO 8-bit PxSEL register
151 *
152 * @see #GpioBits8PxSel_t
153 */
154 struct GpioBits8PxSel_t {
155 Bit0_t Bit0; /*! GPIO Select Pin Function Bit 0
156 *See the device-specific data sheet to determine pin functions. */
157 Bit1_t Bit1; /*! GPIO Select Pin Function Bit 1
158 *See the device-specific data sheet to determine pin functions. */
159 Bit2_t Bit2; /*! GPIO Select Pin Function Bit 2
160 *See the device-specific data sheet to determine pin functions. */
161 Bit3_t Bit3; /*! GPIO Select Pin Function Bit 3
162 *See the device-specific data sheet to determine pin functions. */
163 Bit4_t Bit4; /*! GPIO Select Pin Function Bit 4
164 *See the device-specific data sheet to determine pin functions. */
165 Bit5_t Bit5; /*! GPIO Select Pin Function Bit 5
166 *See the device-specific data sheet to determine pin functions. */
167 Bit6_t Bit6; /*! GPIO Select Pin Function Bit 6
168 *See the device-specific data sheet to determine pin functions. */
169 Bit7_t Bit7; /*! GPIO Select Pin Function Bit 7
170 *See the device-specific data sheet to determine pin functions. */
171 }
172
173 /*!
174 * ======== GpioBits8PxIe_t ========
175 * Generic GPIO 8-bit PxIE register
176 *
177 * @see #GpioBits8PxIe_t
178 */
179 struct GpioBits8PxIe_t {
180 Bit0_t Bit0; /*! GPIO Interrupt Enable Bit 0
181 * Bit = 0: The interrupt is disabled.
182 * Bit = 1: The interrupt is enabled. */
183 Bit1_t Bit1; /*! GPIO Interrupt Enable Bit 1
184 * Bit = 0: The interrupt is disabled.
185 * Bit = 1: The interrupt is enabled. */
186 Bit2_t Bit2; /*! GPIO Interrupt Enable Bit 2
187 * Bit = 0: The interrupt is disabled.
188 * Bit = 1: The interrupt is enabled. */
189 Bit3_t Bit3; /*! GPIO Interrupt Enable Bit 3
190 * Bit = 0: The interrupt is disabled.
191 * Bit = 1: The interrupt is enabled. */
192 Bit4_t Bit4; /*! GPIO Interrupt Enable Bit 4
193 * Bit = 0: The interrupt is disabled.
194 * Bit = 1: The interrupt is enabled. */
195 Bit5_t Bit5; /*! GPIO Interrupt Enable Bit 5
196 * Bit = 0: The interrupt is disabled.
197 * Bit = 1: The interrupt is enabled. */
198 Bit6_t Bit6; /*! GPIO Interrupt Enable Bit 6
199 * Bit = 0: The interrupt is disabled.
200 * Bit = 1: The interrupt is enabled. */
201 Bit7_t Bit7; /*! GPIO Interrupt Enable Bit 7
202 * Bit = 0: The interrupt is disabled.
203 * Bit = 1: The interrupt is enabled. */
204 }
205
206 /*!
207 * ======== GpioBits8PxIes_t ========
208 * Generic GPIO 8-bit PxIES register
209 *
210 * @see #GpioBits8PxIes_t
211 */
212 struct GpioBits8PxIes_t {
213 Bit0_t Bit0; /*! GPIO Select Interrupt Edge Bit 0
214 * Bit = 0: The PxIFGx flag is set with a low-to-high transition
215 * Bit = 1: The PxIFGx flag is set with a high-to-low transition */
216 Bit1_t Bit1; /*! GPIO Select Interrupt Edge Bit 1
217 * Bit = 0: The PxIFGx flag is set with a low-to-high transition
218 * Bit = 1: The PxIFGx flag is set with a high-to-low transition */
219 Bit2_t Bit2; /*! GPIO Select Interrupt Edge Bit 2
220 * Bit = 0: The PxIFGx flag is set with a low-to-high transition
221 * Bit = 1: The PxIFGx flag is set with a high-to-low transition */
222 Bit3_t Bit3; /*! GPIO Select Interrupt Edge Bit 3
223 * Bit = 0: The PxIFGx flag is set with a low-to-high transition
224 * Bit = 1: The PxIFGx flag is set with a high-to-low transition */
225 Bit4_t Bit4; /*! GPIO Select Interrupt Edge Bit 4
226 * Bit = 0: The PxIFGx flag is set with a low-to-high transition
227 * Bit = 1: The PxIFGx flag is set with a high-to-low transition */
228 Bit5_t Bit5; /*! GPIO Select Interrupt Edge Bit 5
229 * Bit = 0: The PxIFGx flag is set with a low-to-high transition
230 * Bit = 1: The PxIFGx flag is set with a high-to-low transition */
231 Bit6_t Bit6; /*! GPIO Select Interrupt Edge Bit 6
232 * Bit = 0: The PxIFGx flag is set with a low-to-high transition
233 * Bit = 1: The PxIFGx flag is set with a high-to-low transition */
234 Bit7_t Bit7; /*! GPIO Select Interrupt Edge Bit 7
235 * Bit = 0: The PxIFGx flag is set with a low-to-high transition
236 * Bit = 1: The PxIFGx flag is set with a high-to-low transition */
237 }
238
239 /*!
240 * ======== GpioBits8PxIfg_t ========
241 * Generic GPIO 8-bit PxIFG register
242 *
243 * @see #GpioBits8PxIfg_t
244 */
245 struct GpioBits8PxIfg_t {
246 Bit0_t Bit0; /*! GPIO Interrupt Flag Bit 0
247 * Bit = 0: No interrupt is pending
248 * Bit = 1: An interrupt is pending */
249 Bit1_t Bit1; /*! GPIO Interrupt Flag Bit 1
250 * Bit = 0: No interrupt is pending
251 * Bit = 1: An interrupt is pending */
252 Bit2_t Bit2; /*! GPIO Interrupt Flag Bit 2
253 * Bit = 0: No interrupt is pending
254 * Bit = 1: An interrupt is pending */
255 Bit3_t Bit3; /*! GPIO Interrupt Flag Bit 3
256 * Bit = 0: No interrupt is pending
257 * Bit = 1: An interrupt is pending */
258 Bit4_t Bit4; /*! GPIO Interrupt Flag Bit 4
259 * Bit = 0: No interrupt is pending
260 * Bit = 1: An interrupt is pending */
261 Bit5_t Bit5; /*! GPIO Interrupt Flag Bit 5
262 * Bit = 0: No interrupt is pending
263 * Bit = 1: An interrupt is pending */
264 Bit6_t Bit6; /*! GPIO Interrupt Flag Bit 6
265 * Bit = 0: No interrupt is pending
266 * Bit = 1: An interrupt is pending */
267 Bit7_t Bit7; /*! GPIO Interrupt Flag Bit 7
268 * Bit = 0: No interrupt is pending
269 * Bit = 1: An interrupt is pending */
270 }
271
272 /*!
273 * ======== DeviceRegisterConfig_t ========
274 * Type to describe how a register is configured for a particular
275 * use. The type allows setting and clearing of an arbitrary bit
276 * pattern inside the specified register.
277 *
278 * @see #DeviceRegisterConfig_t
279 */
280 struct DeviceRegisterConfig_t {
281 String register;
282 UInt bitSetMask;
283 UInt bitClearMask;
284 }
285
286 /*!
287 * ======== DevicePinFunction_t ========
288 * Type to describe how a device pin is configured for all its
289 * different uses that are possible. The function names are consolidated
290 * in one String array rather than located together with the function-
291 * specific data to allow easier access by Grace widgets. The functionConfig
292 * member contains an arbitrary-length array describing all register
293 * settings that need to be performed to configure a certain function.
294 *
295 * @see #DevicePinFunction_t
296 */
297 struct DevicePinFunction_t {
298 String functionName[];
299 DeviceRegisterConfig_t functionConfig[][];
300 }
301
302 /*!
303 * ======== DevicePin_t ========
304 * Type to describe a single device pin and all its possible
305 * configurations.
306 *
307 * @see #DevicePin_t
308 */
309 struct DevicePin_t {
310 String pinName;
311 DevicePinFunction_t pinFunction;
312 }
313
314 /*!
315 * ======== DevicePinSetting_t ========
316 * Type to store the selected pin configuration and a reference
317 * to the object that last modified the configuration.
318 *
319 * @see #DevicePinSetting_t
320 */
321 struct DevicePinSetting_t {
322 UInt pinConfig;
323 /* TODO: Store the object that last configured this pin */
324 /* XdcObjectType usedBy; */
325 }
326
327 instance:
328 /*!
329 * Get getNumberOfPorts
330 */
331 UChar getNumberOfPorts();
332
333 /*!
334 * Get getTotalNumberOfGPIOs
335 */
336 UChar getTotalNumberOfGPIOs();
337 }