@@ -48,7 +48,7 @@ static uint8_t gpioa_pincm_lut[NUM_GPIOA_PIN] = {
48
48
IOMUX_PINCM5 , IOMUX_PINCM6 ,
49
49
};
50
50
#elif CONFIG_SOC_SERIES_MSPM0L /* if CONFIG_SOC_SERIES_MSPM0L */
51
- #define GPIOA_NODE DT_NODELABEL(gpioa)
51
+ #define GPIOA_NODE DT_NODELABEL(gpioa)
52
52
#define NUM_GPIOA_PIN 31
53
53
#define gpioa_pins NUM_GPIOA_PIN
54
54
static uint8_t gpioa_pincm_lut [NUM_GPIOA_PIN ] = {
@@ -57,8 +57,7 @@ static uint8_t gpioa_pincm_lut[NUM_GPIOA_PIN] = {
57
57
IOMUX_PINCM38 , IOMUX_PINCM39 , IOMUX_PINCM40 , IOMUX_PINCM41 , IOMUX_PINCM42 , IOMUX_PINCM49 ,
58
58
IOMUX_PINCM50 , IOMUX_PINCM51 , IOMUX_PINCM52 , IOMUX_PINCM56 , IOMUX_PINCM57 , IOMUX_PINCM67 ,
59
59
IOMUX_PINCM68 , IOMUX_PINCM69 , IOMUX_PINCM73 , IOMUX_PINCM74 , IOMUX_PINCM3 , IOMUX_PINCM4 ,
60
- IOMUX_PINCM5
61
- };
60
+ IOMUX_PINCM5 };
62
61
#else
63
62
#error "Series lookup table not supported"
64
63
#endif /* if CONFIG_SOC_SERIES_MSPM0G */
@@ -77,7 +76,7 @@ static uint8_t gpiob_pincm_lut[NUM_GPIOB_PIN] = {
77
76
IOMUX_PINCM52 , IOMUX_PINCM56 , IOMUX_PINCM57 , IOMUX_PINCM58 ,
78
77
};
79
78
#elif CONFIG_SOC_SERIES_MSPM0L /* if CONFIG_SOC_SERIES_MSPM0L */
80
- #define GPIOB_NODE DT_NODELABEL(gpiob)
79
+ #define GPIOB_NODE DT_NODELABEL(gpiob)
81
80
#define NUM_GPIOB_PIN 32
82
81
#define gpiob_pins NUM_GPIOB_PIN
83
82
static uint8_t gpiob_pincm_lut [NUM_GPIOB_PIN ] = {
@@ -86,8 +85,7 @@ static uint8_t gpiob_pincm_lut[NUM_GPIOB_PIN] = {
86
85
IOMUX_PINCM33 , IOMUX_PINCM34 , IOMUX_PINCM35 , IOMUX_PINCM36 , IOMUX_PINCM37 , IOMUX_PINCM53 ,
87
86
IOMUX_PINCM54 , IOMUX_PINCM55 , IOMUX_PINCM62 , IOMUX_PINCM63 , IOMUX_PINCM64 , IOMUX_PINCM65 ,
88
87
IOMUX_PINCM66 , IOMUX_PINCM70 , IOMUX_PINCM71 , IOMUX_PINCM72 , IOMUX_PINCM21 , IOMUX_PINCM22 ,
89
- IOMUX_PINCM23 , IOMUX_PINCM24
90
- };
88
+ IOMUX_PINCM23 , IOMUX_PINCM24 };
91
89
#endif /* CONFIG_SOC_SERIES_MSPM0G */
92
90
#endif /* DT_NODE_HAS_STATUS(DT_NODELABEL(gpiob), okay) */
93
91
@@ -113,8 +111,7 @@ static int gpio_mspm0_port_get_raw(const struct device *port, uint32_t *value)
113
111
return 0 ;
114
112
}
115
113
116
- static int gpio_mspm0_port_set_masked_raw (const struct device * port ,
117
- uint32_t mask , uint32_t value )
114
+ static int gpio_mspm0_port_set_masked_raw (const struct device * port , uint32_t mask , uint32_t value )
118
115
{
119
116
const struct gpio_mspm0_config * config = port -> config ;
120
117
@@ -123,8 +120,7 @@ static int gpio_mspm0_port_set_masked_raw(const struct device *port,
123
120
return 0 ;
124
121
}
125
122
126
- static int gpio_mspm0_port_set_bits_raw (const struct device * port ,
127
- uint32_t mask )
123
+ static int gpio_mspm0_port_set_bits_raw (const struct device * port , uint32_t mask )
128
124
{
129
125
const struct gpio_mspm0_config * config = port -> config ;
130
126
@@ -133,8 +129,7 @@ static int gpio_mspm0_port_set_bits_raw(const struct device *port,
133
129
return 0 ;
134
130
}
135
131
136
- static int gpio_mspm0_port_clear_bits_raw (const struct device * port ,
137
- uint32_t mask )
132
+ static int gpio_mspm0_port_clear_bits_raw (const struct device * port , uint32_t mask )
138
133
{
139
134
const struct gpio_mspm0_config * config = port -> config ;
140
135
@@ -143,8 +138,7 @@ static int gpio_mspm0_port_clear_bits_raw(const struct device *port,
143
138
return 0 ;
144
139
}
145
140
146
- static int gpio_mspm0_port_toggle_bits (const struct device * port ,
147
- uint32_t mask )
141
+ static int gpio_mspm0_port_toggle_bits (const struct device * port , uint32_t mask )
148
142
{
149
143
const struct gpio_mspm0_config * config = port -> config ;
150
144
@@ -153,9 +147,7 @@ static int gpio_mspm0_port_toggle_bits(const struct device *port,
153
147
return 0 ;
154
148
}
155
149
156
- static int gpio_mspm0_pin_configure (const struct device * port ,
157
- gpio_pin_t pin ,
158
- gpio_flags_t flags )
150
+ static int gpio_mspm0_pin_configure (const struct device * port , gpio_pin_t pin , gpio_flags_t flags )
159
151
{
160
152
const struct gpio_mspm0_config * config = port -> config ;
161
153
/* determine pull up resistor value based on flags */
@@ -172,17 +164,13 @@ static int gpio_mspm0_pin_configure(const struct device *port,
172
164
/* Config pin based on flags */
173
165
switch (flags & (GPIO_INPUT | GPIO_OUTPUT )) {
174
166
case GPIO_INPUT :
175
- DL_GPIO_initDigitalInputFeatures (config -> pincm_lut [pin ],
176
- DL_GPIO_INVERSION_DISABLE ,
177
- pull_res ,
178
- DL_GPIO_HYSTERESIS_DISABLE ,
167
+ DL_GPIO_initDigitalInputFeatures (config -> pincm_lut [pin ], DL_GPIO_INVERSION_DISABLE ,
168
+ pull_res , DL_GPIO_HYSTERESIS_DISABLE ,
179
169
DL_GPIO_WAKEUP_DISABLE );
180
170
break ;
181
171
case GPIO_OUTPUT :
182
- DL_GPIO_initDigitalOutputFeatures (config -> pincm_lut [pin ],
183
- DL_GPIO_INVERSION_DISABLE ,
184
- pull_res ,
185
- DL_GPIO_DRIVE_STRENGTH_LOW ,
172
+ DL_GPIO_initDigitalOutputFeatures (config -> pincm_lut [pin ], DL_GPIO_INVERSION_DISABLE ,
173
+ pull_res , DL_GPIO_DRIVE_STRENGTH_LOW ,
186
174
DL_GPIO_HIZ_DISABLE );
187
175
188
176
/* Set initial state */
@@ -204,10 +192,8 @@ static int gpio_mspm0_pin_configure(const struct device *port,
204
192
return 0 ;
205
193
}
206
194
207
- static int gpio_mspm0_pin_interrupt_configure (const struct device * port ,
208
- gpio_pin_t pin ,
209
- enum gpio_int_mode mode ,
210
- enum gpio_int_trig trig )
195
+ static int gpio_mspm0_pin_interrupt_configure (const struct device * port , gpio_pin_t pin ,
196
+ enum gpio_int_mode mode , enum gpio_int_trig trig )
211
197
{
212
198
const struct gpio_mspm0_config * config = port -> config ;
213
199
@@ -229,11 +215,10 @@ static int gpio_mspm0_pin_interrupt_configure(const struct device *port,
229
215
}
230
216
231
217
if (pin < MSPM0_PINS_LOW_GROUP ) {
232
- DL_GPIO_setLowerPinsPolarity (config -> base ,
233
- polarity << (2 * pin ));
218
+ DL_GPIO_setLowerPinsPolarity (config -> base , polarity << (2 * pin ));
234
219
} else {
235
- DL_GPIO_setUpperPinsPolarity (config -> base ,
236
- polarity << (2 * (pin - MSPM0_PINS_LOW_GROUP )));
220
+ DL_GPIO_setUpperPinsPolarity (
221
+ config -> base , polarity << (2 * (pin - MSPM0_PINS_LOW_GROUP )));
237
222
}
238
223
239
224
DL_GPIO_clearInterruptStatus (config -> base , BIT (pin ));
@@ -246,8 +231,7 @@ static int gpio_mspm0_pin_interrupt_configure(const struct device *port,
246
231
return 0 ;
247
232
}
248
233
249
- static int gpio_mspm0_manage_callback (const struct device * port ,
250
- struct gpio_callback * callback ,
234
+ static int gpio_mspm0_manage_callback (const struct device * port , struct gpio_callback * callback ,
251
235
bool set )
252
236
{
253
237
struct gpio_mspm0_data * data = port -> data ;
@@ -267,9 +251,9 @@ static void gpio_mspm0_isr(const struct device *port)
267
251
struct gpio_mspm0_data * data ;
268
252
const struct gpio_mspm0_config * config ;
269
253
const struct device * dev_list [] = {
270
- DEVICE_DT_GET_OR_NULL (GPIOA_NODE ),
271
- DEVICE_DT_GET_OR_NULL (GPIOB_NODE ),
272
- DEVICE_DT_GET_OR_NULL (GPIOC_NODE ),
254
+ DEVICE_DT_GET_OR_NULL (GPIOA_NODE ),
255
+ DEVICE_DT_GET_OR_NULL (GPIOB_NODE ),
256
+ DEVICE_DT_GET_OR_NULL (GPIOC_NODE ),
273
257
};
274
258
275
259
for (uint8_t i = 0 ; i < ARRAY_SIZE (dev_list ); i ++ ) {
@@ -282,13 +266,11 @@ static void gpio_mspm0_isr(const struct device *port)
282
266
data = dev_list [i ]-> data ;
283
267
config = dev_list [i ]-> config ;
284
268
285
- status = DL_GPIO_getRawInterruptStatus (config -> base ,
286
- 0xFFFFFFFF );
269
+ status = DL_GPIO_getRawInterruptStatus (config -> base , 0xFFFFFFFF );
287
270
288
271
DL_GPIO_clearInterruptStatus (config -> base , status );
289
272
if (status != 0 ) {
290
- gpio_fire_callbacks (& data -> callbacks ,
291
- dev_list [i ], status );
273
+ gpio_fire_callbacks (& data -> callbacks , dev_list [i ], status );
292
274
}
293
275
}
294
276
}
@@ -306,8 +288,8 @@ static int gpio_mspm0_init(const struct device *dev)
306
288
if (init_irq ) {
307
289
init_irq = false;
308
290
309
- IRQ_CONNECT (DT_INST_IRQN (0 ), DT_INST_IRQ (0 , priority ),
310
- gpio_mspm0_isr , DEVICE_DT_INST_GET (0 ), 0 );
291
+ IRQ_CONNECT (DT_INST_IRQN (0 ), DT_INST_IRQ (0 , priority ), gpio_mspm0_isr ,
292
+ DEVICE_DT_INST_GET (0 ), 0 );
311
293
irq_enable (DT_INST_IRQN (0 ));
312
294
}
313
295
@@ -326,21 +308,23 @@ static const struct gpio_driver_api gpio_mspm0_driver_api = {
326
308
.get_pending_int = gpio_mspm0_get_pending_int ,
327
309
};
328
310
329
- #define GPIO_DEVICE_INIT (n , __suffix , __base_addr ) \
330
- static const struct gpio_mspm0_config gpio_mspm0_cfg_##__suffix = { \
331
- .common = { .port_pin_mask = \
332
- GPIO_PORT_PIN_MASK_FROM_NGPIOS(gpio##__suffix##_pins), \
333
- }, \
334
- .base = (GPIO_Regs *)__base_addr, \
335
- .pincm_lut = gpio##__suffix##_pincm_lut, \
336
- }; \
337
- static struct gpio_mspm0_data gpio_mspm0_data_##__suffix; \
338
- DEVICE_DT_DEFINE(n, gpio_mspm0_init, NULL, &gpio_mspm0_data_##__suffix, \
339
- &gpio_mspm0_cfg_##__suffix, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \
311
+ #define GPIO_DEVICE_INIT (n , __suffix , __base_addr ) \
312
+ static const struct gpio_mspm0_config gpio_mspm0_cfg_##__suffix = { \
313
+ .common = \
314
+ { \
315
+ .port_pin_mask = \
316
+ GPIO_PORT_PIN_MASK_FROM_NGPIOS(gpio##__suffix##_pins), \
317
+ }, \
318
+ .base = (GPIO_Regs *)__base_addr, \
319
+ .pincm_lut = gpio##__suffix##_pincm_lut, \
320
+ }; \
321
+ static struct gpio_mspm0_data gpio_mspm0_data_##__suffix; \
322
+ DEVICE_DT_DEFINE(n, gpio_mspm0_init, NULL, &gpio_mspm0_data_##__suffix, \
323
+ &gpio_mspm0_cfg_##__suffix, PRE_KERNEL_1, CONFIG_GPIO_INIT_PRIORITY, \
340
324
&gpio_mspm0_driver_api)
341
325
342
- #define GPIO_DEVICE_INIT_MSPM0 (__suffix ) \
343
- GPIO_DEVICE_INIT(DT_NODELABEL(gpio##__suffix), __suffix, \
326
+ #define GPIO_DEVICE_INIT_MSPM0 (__suffix ) \
327
+ GPIO_DEVICE_INIT(DT_NODELABEL(gpio##__suffix), __suffix, \
344
328
DT_REG_ADDR(DT_NODELABEL(gpio##__suffix)))
345
329
346
330
#if DT_NODE_HAS_STATUS (DT_NODELABEL (gpioa ), okay )
0 commit comments