Skip to content

Commit 99e7223

Browse files
Ayush1325kartben
authored andcommitted
drivers: gpio_cc13xx_cc26xx: Update for latest sdk
- It seems that the mask variants of GPIO functions are not present in the latest sdk, so replace those with direct register access. Signed-off-by: Ayush Singh <[email protected]>
1 parent 7431e52 commit 99e7223

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

drivers/gpio/gpio_cc13xx_cc26xx.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
/* the rest are for general (non-interrupt) config */
3333
#define IOCFG_GEN_MASK (~IOCFG_INT_MASK)
3434

35+
/* GPIO all DIOs mask */
36+
#define GPIO_DIO_ALL_MASK 0xFFFFFFFF
37+
3538
struct gpio_cc13xx_cc26xx_data {
3639
/* gpio_driver_data needs to be first */
3740
struct gpio_driver_data common;
@@ -128,41 +131,38 @@ static int gpio_cc13xx_cc26xx_port_get_raw(const struct device *port,
128131
{
129132
__ASSERT_NO_MSG(value != NULL);
130133

131-
*value = GPIO_readMultiDio(GPIO_DIO_ALL_MASK);
134+
*value = HWREG(GPIO_BASE + GPIO_O_DIN31_0) & GPIO_DIO_ALL_MASK;
132135

133136
return 0;
134137
}
135138

136-
static int gpio_cc13xx_cc26xx_port_set_masked_raw(const struct device *port,
137-
uint32_t mask,
138-
uint32_t value)
139+
static int gpio_cc13xx_cc26xx_port_set_bits_raw(const struct device *port, uint32_t mask)
139140
{
140-
GPIO_setMultiDio(mask & value);
141-
GPIO_clearMultiDio(mask & ~value);
141+
HWREG(GPIO_BASE + GPIO_O_DOUTSET31_0) = mask;
142142

143143
return 0;
144144
}
145145

146-
static int gpio_cc13xx_cc26xx_port_set_bits_raw(const struct device *port,
147-
uint32_t mask)
146+
static int gpio_cc13xx_cc26xx_port_clear_bits_raw(const struct device *port, uint32_t mask)
148147
{
149-
GPIO_setMultiDio(mask);
148+
HWREG(GPIO_BASE + GPIO_O_DOUTCLR31_0) = mask;
150149

151150
return 0;
152151
}
153152

154-
static int gpio_cc13xx_cc26xx_port_clear_bits_raw(const struct device *port,
155-
uint32_t mask)
153+
static int gpio_cc13xx_cc26xx_port_set_masked_raw(const struct device *port, uint32_t mask,
154+
uint32_t value)
156155
{
157-
GPIO_clearMultiDio(mask);
156+
gpio_cc13xx_cc26xx_port_set_bits_raw(port, mask & value);
157+
gpio_cc13xx_cc26xx_port_clear_bits_raw(port, mask & ~value);
158158

159159
return 0;
160160
}
161161

162162
static int gpio_cc13xx_cc26xx_port_toggle_bits(const struct device *port,
163163
uint32_t mask)
164164
{
165-
GPIO_toggleMultiDio(mask);
165+
HWREG(GPIO_BASE + GPIO_O_DOUTTGL31_0) = mask;
166166

167167
return 0;
168168
}
@@ -209,16 +209,16 @@ static int gpio_cc13xx_cc26xx_manage_callback(const struct device *port,
209209

210210
static uint32_t gpio_cc13xx_cc26xx_get_pending_int(const struct device *dev)
211211
{
212-
return GPIO_getEventMultiDio(GPIO_DIO_ALL_MASK);
212+
return HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) & GPIO_DIO_ALL_MASK;
213213
}
214214

215215
static void gpio_cc13xx_cc26xx_isr(const struct device *dev)
216216
{
217217
struct gpio_cc13xx_cc26xx_data *data = dev->data;
218218

219-
uint32_t status = GPIO_getEventMultiDio(GPIO_DIO_ALL_MASK);
219+
uint32_t status = HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) & GPIO_DIO_ALL_MASK;
220220

221-
GPIO_clearEventMultiDio(status);
221+
HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) = status;
222222

223223
gpio_fire_callbacks(&data->callbacks, dev, status);
224224
}

samples/boards/ti/cc13x2_cc26x2/system_off/src/main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414

1515
#include <driverlib/ioc.h>
1616

17+
/* GPIO all DIOs mask */
18+
#define GPIO_DIO_ALL_MASK 0xFFFFFFFF
19+
1720
static const struct gpio_dt_spec sw0_gpio = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios);
1821

1922
#define BUSY_WAIT_S 5U
@@ -56,8 +59,8 @@ int main(void)
5659
printk("Powering off; press BUTTON1 to restart\n");
5760

5861
/* Clear GPIO interrupt */
59-
status = GPIO_getEventMultiDio(GPIO_DIO_ALL_MASK);
60-
GPIO_clearEventMultiDio(status);
62+
status = HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) & GPIO_DIO_ALL_MASK;
63+
HWREG(GPIO_BASE + GPIO_O_EVFLAGS31_0) = status;
6164

6265
sys_poweroff();
6366

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ manifest:
253253
groups:
254254
- hal
255255
- name: hal_ti
256-
revision: 258652a3ac5d7df68ba8df20e4705c3bd98ede38
256+
revision: 46407c76196ca250c3f955376d52dc3ea25ba381
257257
path: modules/hal/ti
258258
groups:
259259
- hal

0 commit comments

Comments
 (0)