Skip to content

Commit

Permalink
drivers: gpio_cc13xx_cc26xx: Update for latest sdk
Browse files Browse the repository at this point in the history
- 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]>
  • Loading branch information
Ayush1325 committed Dec 26, 2024
1 parent 229c257 commit 55b87b3
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
37 changes: 21 additions & 16 deletions drivers/gpio/gpio_cc13xx_cc26xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
/* the rest are for general (non-interrupt) config */
#define IOCFG_GEN_MASK (~IOCFG_INT_MASK)

/* GPIO all DIOs mask */
#define GPIO_DIO_ALL_MASK 0xFFFFFFFF

struct gpio_cc13xx_cc26xx_data {
/* gpio_driver_data needs to be first */
struct gpio_driver_data common;
Expand Down Expand Up @@ -128,41 +131,43 @@ static int gpio_cc13xx_cc26xx_port_get_raw(const struct device *port,
{
__ASSERT_NO_MSG(value != NULL);

*value = GPIO_readMultiDio(GPIO_DIO_ALL_MASK);
*value = HWREG( GPIO_BASE + GPIO_O_DIN31_0 ) & GPIO_DIO_ALL_MASK;

Check failure on line 134 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:134 space prohibited after that open parenthesis '('

Check failure on line 134 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:134 space prohibited before that close parenthesis ')'

return 0;
}

static int gpio_cc13xx_cc26xx_port_set_masked_raw(const struct device *port,
uint32_t mask,
uint32_t value)
static int gpio_cc13xx_cc26xx_port_set_bits_raw(const struct device *port,
uint32_t mask)
{
GPIO_setMultiDio(mask & value);
GPIO_clearMultiDio(mask & ~value);
HWREG( GPIO_BASE + GPIO_O_DOUTSET31_0 ) = mask;

Check failure on line 142 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:142 space prohibited after that open parenthesis '('

Check failure on line 142 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:142 space prohibited before that close parenthesis ')'

return 0;
}

static int gpio_cc13xx_cc26xx_port_set_bits_raw(const struct device *port,
uint32_t mask)
static int gpio_cc13xx_cc26xx_port_clear_bits_raw(const struct device *port,
uint32_t mask)
{
GPIO_setMultiDio(mask);
HWREG( GPIO_BASE + GPIO_O_DOUTCLR31_0 ) = mask;

Check failure on line 150 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:150 space prohibited after that open parenthesis '('

Check failure on line 150 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:150 space prohibited before that close parenthesis ')'

return 0;
}

static int gpio_cc13xx_cc26xx_port_clear_bits_raw(const struct device *port,
uint32_t mask)
static int gpio_cc13xx_cc26xx_port_set_masked_raw(const struct device *port,
uint32_t mask,
uint32_t value)
{
GPIO_clearMultiDio(mask);
gpio_cc13xx_cc26xx_port_set_bits_raw(port, mask & value);
gpio_cc13xx_cc26xx_port_clear_bits_raw(port, mask & ~value);

return 0;
}



static int gpio_cc13xx_cc26xx_port_toggle_bits(const struct device *port,
uint32_t mask)
{
GPIO_toggleMultiDio(mask);
HWREG( GPIO_BASE + GPIO_O_DOUTTGL31_0 ) = mask;

Check failure on line 170 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:170 space prohibited after that open parenthesis '('

Check failure on line 170 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:170 space prohibited before that close parenthesis ')'

return 0;
}
Expand Down Expand Up @@ -209,16 +214,16 @@ static int gpio_cc13xx_cc26xx_manage_callback(const struct device *port,

static uint32_t gpio_cc13xx_cc26xx_get_pending_int(const struct device *dev)
{
return GPIO_getEventMultiDio(GPIO_DIO_ALL_MASK);
return HWREG( GPIO_BASE + GPIO_O_EVFLAGS31_0 ) & GPIO_DIO_ALL_MASK;

Check failure on line 217 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:217 space prohibited after that open parenthesis '('

Check failure on line 217 in drivers/gpio/gpio_cc13xx_cc26xx.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

SPACING

drivers/gpio/gpio_cc13xx_cc26xx.c:217 space prohibited before that close parenthesis ')'
}

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

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

GPIO_clearEventMultiDio(status);
HWREG( GPIO_BASE + GPIO_O_EVFLAGS31_0 ) = status;

gpio_fire_callbacks(&data->callbacks, dev, status);
}
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ manifest:
groups:
- hal
- name: hal_ti
revision: 2e7b95ad079e9f636884eedc6853e6ad98b85f65
revision: pull/56/head
path: modules/hal/ti
groups:
- hal
Expand Down

0 comments on commit 55b87b3

Please sign in to comment.