adapter/bitbang: Use 'bool' data type for blink()

Change-Id: I187f8944ad5fd92f28cbd32e447f9ec1a97e16d6
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8515
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Marc Schink 2024-08-30 11:06:13 +02:00 committed by Antonio Borneo
parent f4d81cd4d4
commit 337db329c9
8 changed files with 17 additions and 17 deletions

View File

@ -275,10 +275,10 @@ static int am335xgpio_swdio_read(void)
return get_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_SWDIO]);
}
static int am335xgpio_blink(int on)
static int am335xgpio_blink(bool on)
{
if (is_gpio_config_valid(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED]))
set_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED], on);
set_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED], on ? 1 : 0);
return ERROR_OK;
}

View File

@ -419,10 +419,10 @@ static void bcm2835gpio_munmap(void)
}
}
static int bcm2835gpio_blink(int on)
static int bcm2835gpio_blink(bool on)
{
if (is_gpio_config_valid(ADAPTER_GPIO_IDX_LED))
set_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED], on);
set_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED], on ? 1 : 0);
return ERROR_OK;
}

View File

@ -309,7 +309,7 @@ int bitbang_execute_queue(struct jtag_command *cmd_queue)
retval = ERROR_OK;
if (bitbang_interface->blink) {
if (bitbang_interface->blink(1) != ERROR_OK)
if (bitbang_interface->blink(true) != ERROR_OK)
return ERROR_FAIL;
}
@ -377,7 +377,7 @@ int bitbang_execute_queue(struct jtag_command *cmd_queue)
cmd = cmd->next;
}
if (bitbang_interface->blink) {
if (bitbang_interface->blink(0) != ERROR_OK)
if (bitbang_interface->blink(false) != ERROR_OK)
return ERROR_FAIL;
}
@ -396,7 +396,7 @@ static void bitbang_swd_exchange(bool rnw, uint8_t buf[], unsigned int offset, u
{
if (bitbang_interface->blink) {
/* FIXME: we should manage errors */
bitbang_interface->blink(1);
bitbang_interface->blink(true);
}
for (unsigned int i = offset; i < bit_cnt + offset; i++) {
@ -418,7 +418,7 @@ static void bitbang_swd_exchange(bool rnw, uint8_t buf[], unsigned int offset, u
if (bitbang_interface->blink) {
/* FIXME: we should manage errors */
bitbang_interface->blink(0);
bitbang_interface->blink(false);
}
}

View File

@ -45,7 +45,7 @@ struct bitbang_interface {
int (*write)(int tck, int tms, int tdi);
/** Blink led (optional). */
int (*blink)(int on);
int (*blink)(bool on);
/** Sample SWDIO and return the value. */
int (*swdio_read)(void);

View File

@ -72,7 +72,7 @@ static int dummy_reset(int trst, int srst)
return ERROR_OK;
}
static int dummy_led(int on)
static int dummy_led(bool on)
{
return ERROR_OK;
}

View File

@ -178,14 +178,14 @@ static int linuxgpiod_swd_write(int swclk, int swdio)
return ERROR_OK;
}
static int linuxgpiod_blink(int on)
static int linuxgpiod_blink(bool on)
{
int retval;
if (!is_gpio_config_valid(ADAPTER_GPIO_IDX_LED))
return ERROR_OK;
retval = gpiod_line_set_value(gpiod_line[ADAPTER_GPIO_IDX_LED], on);
retval = gpiod_line_set_value(gpiod_line[ADAPTER_GPIO_IDX_LED], on ? 1 : 0);
if (retval < 0)
LOG_WARNING("Fail set led");
return retval;

View File

@ -183,8 +183,8 @@ static int parport_reset(int trst, int srst)
return ERROR_OK;
}
/* turn LED on parport adapter on (1) or off (0) */
static int parport_led(int on)
/* turn LED on parport adapter on (true) or off (true) */
static int parport_led(bool on)
{
if (on)
dataport_value |= cable->LED_MASK;
@ -364,7 +364,7 @@ static int parport_init(void)
return ERROR_FAIL;
if (parport_write(0, 0, 0) != ERROR_OK)
return ERROR_FAIL;
if (parport_led(1) != ERROR_OK)
if (parport_led(true) != ERROR_OK)
return ERROR_FAIL;
bitbang_interface = &parport_bitbang;
@ -374,7 +374,7 @@ static int parport_init(void)
static int parport_quit(void)
{
if (parport_led(0) != ERROR_OK)
if (parport_led(false) != ERROR_OK)
return ERROR_FAIL;
if (parport_exit) {

View File

@ -251,7 +251,7 @@ static int remote_bitbang_sleep(unsigned int microseconds)
return remote_bitbang_flush();
}
static int remote_bitbang_blink(int on)
static int remote_bitbang_blink(bool on)
{
char c = on ? 'B' : 'b';
return remote_bitbang_queue(c, FLUSH_SEND_BUF);