Skip to content

Commit

Permalink
Minor change
Browse files Browse the repository at this point in the history
change IMXRT106XGPIO_DEBUG to GPIO_DEBUG
  • Loading branch information
Julian Uziemblo committed Aug 20, 2024
1 parent 443b4cc commit 2628562
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions drivers/imxrt106x-gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ static oid_t multidrv;

#define ID_GPIO(n) (id_gpio1 + n - 1)

/* Extract GPIO number from [cfg] string
* [cfg] like: `/dev/gpioX`, where X - gpio number
* returns:
* * the GPIO number on success
* * -1 on failure
/** @briefExtract GPIO number from [cfg] string
* @param cfg like: `/dev/gpioX`, where `X` - gpio number
* @returns the GPIO number on success; or -1 on failure
*/
static inline unsigned int gpio_getNum(const char *cfg)
{
Expand All @@ -42,7 +40,7 @@ static inline int itobool(int val)
return !!val;
}

#if IMXRTGPIO_DEBUG
#if GPIO_DEBUG
#define IMSG_STRUCT_FORMAT_STR "\
imsg={\n\
.gpio={\n\
Expand Down Expand Up @@ -100,7 +98,7 @@ int gpio_setPin(int gpio, int pin, int state)
imsg->gpio.port.val = itobool(state << pin);
imsg->gpio.port.mask = 1 << pin;

#if IMXRTGPIO_DEBUG
#if GPIO_DEBUG
printf("lwip: imxrt-gpio: gpio_setPin: gpio=%d, pin=%d, state=%d\n",
gpio, pin, state);
printf("lwip: imxrt-gpio: gpio_setPin: sending message to GPIO:\n");
Expand All @@ -123,7 +121,7 @@ int gpio_setDir(int gpio, int pin, int dir)
imsg->gpio.dir.val = itobool(dir << pin);
imsg->gpio.dir.mask = 1 << pin;

#if IMXRTGPIO_DEBUG
#if GPIO_DEBUG
printf("lwip: imxrt-gpio: gpio_setDir: gpio=%d, pin=%d, dir=%s (%d)\n",
gpio, pin,
dir == GPIO_INPUT ?
Expand Down Expand Up @@ -152,7 +150,7 @@ int gpio_set(gpio_info_t *gp, int active)
uint32_t gpio_get(gpio_info_t *gp)
{
if (!gpio_valid(gp)) {
#if IMXRTGPIO_DEBUG
#if GPIO_DEBUG
printf("imxrt106x-gpio: gpio_get: gpio isn't valid, returning 0\n");
#endif
return 0;
Expand All @@ -179,7 +177,7 @@ int gpio_wait(gpio_info_t *gp, int active, time_t timeout_us)
val = gpio_get(gp);

if (itobool((1 << gp->pin) & val) == itobool(active)) {
#if IMXRTGPIO_DEBUG
#if GPIO_DEBUG
printf("imxrt106x-gpio: gpio_wait: gp->pin=%d, 1 << gp->pin=0x%08x, val=0x%08x, (1 << gp->pin) & val=%u, active=%u\n",
gp->pin, 1 << gp->pin, val, (1 << gp->pin) & val, active);
#endif
Expand All @@ -198,7 +196,7 @@ int gpio_wait(gpio_info_t *gp, int active, time_t timeout_us)

int gpio_init(gpio_info_t *gp, const char *arg, unsigned flags)
{
#if IMXRTGPIO_DEBUG
#if GPIO_DEBUG
printf("lwip: imxrt-gpio: init started, args: `%s`, flags: 0x%08x\n", arg, flags);
#endif

Expand Down Expand Up @@ -236,7 +234,7 @@ int gpio_init(gpio_info_t *gp, const char *arg, unsigned flags)

gp->fd = ID_GPIO(gpio_getNum(arg));

#if IMXRTGPIO_DEBUG
#if GPIO_DEBUG
printf("lwip: imxrt-gpio: got multidrv, oid=%u (0x%08x), port=%d (0x%08x)\n",
multidrv.id, multidrv.id, multidrv.port, multidrv.port);
printf("lwip: imxrt-gpio: before sending messages, gp={.fd=%u, .pin=%u, .flags=0x%08x}\n",
Expand Down

0 comments on commit 2628562

Please sign in to comment.