|
32 | 32 | /* the rest are for general (non-interrupt) config */ |
33 | 33 | #define IOCFG_GEN_MASK (~IOCFG_INT_MASK) |
34 | 34 |
|
35 | | -/* GPIO all DIOs mask */ |
36 | | -#define GPIO_DIO_ALL_MASK 0xFFFFFFFF |
37 | | - |
38 | 35 | struct gpio_cc13xx_cc26xx_data { |
39 | 36 | /* gpio_driver_data needs to be first */ |
40 | 37 | struct gpio_driver_data common; |
@@ -131,38 +128,41 @@ static int gpio_cc13xx_cc26xx_port_get_raw(const struct device *port, |
131 | 128 | { |
132 | 129 | __ASSERT_NO_MSG(value != NULL); |
133 | 130 |
|
134 | | - *value = HWREG(GPIO_BASE + GPIO_O_DIN31_0) & GPIO_DIO_ALL_MASK; |
| 131 | + *value = GPIO_readMultiDio(GPIO_DIO_ALL_MASK); |
135 | 132 |
|
136 | 133 | return 0; |
137 | 134 | } |
138 | 135 |
|
139 | | -static int gpio_cc13xx_cc26xx_port_set_bits_raw(const struct device *port, uint32_t mask) |
| 136 | +static int gpio_cc13xx_cc26xx_port_set_masked_raw(const struct device *port, |
| 137 | + uint32_t mask, |
| 138 | + uint32_t value) |
140 | 139 | { |
141 | | - HWREG(GPIO_BASE + GPIO_O_DOUTSET31_0) = mask; |
| 140 | + GPIO_setMultiDio(mask & value); |
| 141 | + GPIO_clearMultiDio(mask & ~value); |
142 | 142 |
|
143 | 143 | return 0; |
144 | 144 | } |
145 | 145 |
|
146 | | -static int gpio_cc13xx_cc26xx_port_clear_bits_raw(const struct device *port, uint32_t mask) |
| 146 | +static int gpio_cc13xx_cc26xx_port_set_bits_raw(const struct device *port, |
| 147 | + uint32_t mask) |
147 | 148 | { |
148 | | - HWREG(GPIO_BASE + GPIO_O_DOUTCLR31_0) = mask; |
| 149 | + GPIO_setMultiDio(mask); |
149 | 150 |
|
150 | 151 | return 0; |
151 | 152 | } |
152 | 153 |
|
153 | | -static int gpio_cc13xx_cc26xx_port_set_masked_raw(const struct device *port, uint32_t mask, |
154 | | - uint32_t value) |
| 154 | +static int gpio_cc13xx_cc26xx_port_clear_bits_raw(const struct device *port, |
| 155 | + uint32_t mask) |
155 | 156 | { |
156 | | - gpio_cc13xx_cc26xx_port_set_bits_raw(port, mask & value); |
157 | | - gpio_cc13xx_cc26xx_port_clear_bits_raw(port, mask & ~value); |
| 157 | + GPIO_clearMultiDio(mask); |
158 | 158 |
|
159 | 159 | return 0; |
160 | 160 | } |
161 | 161 |
|
162 | 162 | static int gpio_cc13xx_cc26xx_port_toggle_bits(const struct device *port, |
163 | 163 | uint32_t mask) |
164 | 164 | { |
165 | | - HWREG(GPIO_BASE + GPIO_O_DOUTTGL31_0) = mask; |
| 165 | + GPIO_toggleMultiDio(mask); |
166 | 166 |
|
167 | 167 | return 0; |
168 | 168 | } |
@@ -209,16 +209,16 @@ static int gpio_cc13xx_cc26xx_manage_callback(const struct device *port, |
209 | 209 |
|
210 | 210 | static uint32_t gpio_cc13xx_cc26xx_get_pending_int(const struct device *dev) |
211 | 211 | { |
212 | | - return HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) & GPIO_DIO_ALL_MASK; |
| 212 | + return GPIO_getEventMultiDio(GPIO_DIO_ALL_MASK); |
213 | 213 | } |
214 | 214 |
|
215 | 215 | static void gpio_cc13xx_cc26xx_isr(const struct device *dev) |
216 | 216 | { |
217 | 217 | struct gpio_cc13xx_cc26xx_data *data = dev->data; |
218 | 218 |
|
219 | | - uint32_t status = HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) & GPIO_DIO_ALL_MASK; |
| 219 | + uint32_t status = GPIO_getEventMultiDio(GPIO_DIO_ALL_MASK); |
220 | 220 |
|
221 | | - HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) = status; |
| 221 | + GPIO_clearEventMultiDio(status); |
222 | 222 |
|
223 | 223 | gpio_fire_callbacks(&data->callbacks, dev, status); |
224 | 224 | } |
|
0 commit comments