Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
soburi committed Sep 5, 2024
1 parent 4daff63 commit eaa8e87
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
22 changes: 11 additions & 11 deletions drivers/gpio/gpio_rpi_pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ static int gpio_rpi_configure(const struct device *dev,

static int gpio_rpi_port_get_raw(const struct device *dev, gpio_port_value_t *value)
{
*value = gpio_get_all();
*value = gpio_get_all64();
return 0;
}

Expand All @@ -91,11 +91,11 @@ static int gpio_rpi_port_set_masked_raw(const struct device *port,
{
struct gpio_rpi_data *data = port->data;
/* First handle push-pull pins: */
gpio_put_masked(mask & ~data->single_ended_mask, value);
gpio_put_masked64(mask & ~data->single_ended_mask, value);
/* Then handle open-drain pins: */
gpio_set_dir_masked(mask & data->single_ended_mask & data->open_drain_mask, ~value);
gpio_set_dir_masked64(mask & data->single_ended_mask & data->open_drain_mask, ~value);
/* Then handle open-source pins: */
gpio_set_dir_masked(mask & data->single_ended_mask & ~data->open_drain_mask, value);
gpio_set_dir_masked64(mask & data->single_ended_mask & ~data->open_drain_mask, value);
return 0;
}

Expand All @@ -104,11 +104,11 @@ static int gpio_rpi_port_set_bits_raw(const struct device *port,
{
struct gpio_rpi_data *data = port->data;
/* First handle push-pull pins: */
gpio_set_mask(pins & ~data->single_ended_mask);
gpio_set_mask64(pins & ~data->single_ended_mask);
/* Then handle open-drain pins: */
gpio_set_dir_in_masked(pins & data->single_ended_mask & data->open_drain_mask);
gpio_set_dir_in_masked64(pins & data->single_ended_mask & data->open_drain_mask);
/* Then handle open-source pins: */
gpio_set_dir_out_masked(pins & data->single_ended_mask & ~data->open_drain_mask);
gpio_set_dir_out_masked64(pins & data->single_ended_mask & ~data->open_drain_mask);
return 0;
}

Expand All @@ -117,11 +117,11 @@ static int gpio_rpi_port_clear_bits_raw(const struct device *port,
{
struct gpio_rpi_data *data = port->data;
/* First handle push-pull pins: */
gpio_clr_mask(pins & ~data->single_ended_mask);
gpio_clr_mask64(pins & ~data->single_ended_mask);
/* Then handle open-drain pins: */
gpio_set_dir_out_masked(pins & data->single_ended_mask & data->open_drain_mask);
gpio_set_dir_out_masked64(pins & data->single_ended_mask & data->open_drain_mask);
/* Then handle open-source pins: */
gpio_set_dir_in_masked(pins & data->single_ended_mask & ~data->open_drain_mask);
gpio_set_dir_in_masked64(pins & data->single_ended_mask & ~data->open_drain_mask);
return 0;
}

Expand All @@ -130,7 +130,7 @@ static int gpio_rpi_port_toggle_bits(const struct device *port,
{
struct gpio_rpi_data *data = port->data;
/* First handle push-pull pins: */
gpio_xor_mask(pins & ~data->single_ended_mask);
gpio_xor_mask64(pins & ~data->single_ended_mask);
/* Then handle single-ended pins: */
/* (unfortunately there's no pico-sdk api call that can be used for this,
* but it's possible by accessing the registers directly)
Expand Down
8 changes: 6 additions & 2 deletions include/zephyr/drivers/gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#include <zephyr/device.h>
#include <zephyr/dt-bindings/gpio/gpio.h>

#define GPIO_BIT(n) BIT64(n)

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -226,6 +224,12 @@ extern "C" {
#define GPIO_DIR_MASK (GPIO_INPUT | GPIO_OUTPUT)
/** @endcond */

#if 1
#define GPIO_BIT(n) BIT64(n)
#else
#define GPIO_BIT(n) BIT(n)
#endif

/**
* @brief Identifies a set of pins associated with a port.
*
Expand Down

0 comments on commit eaa8e87

Please sign in to comment.