drivers/bcm2835gpio: Add support for activity LED

Signed-off-by: Steve Marple <stevemarple@googlemail.com>
Change-Id: I472385753507167c93328b9b4dc62d5d61c86f74
Reviewed-on: https://review.openocd.org/c/openocd/+/7124
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
Steve Marple 2022-08-14 11:01:08 +01:00 committed by Antonio Borneo
parent 0dd969d83b
commit 24e801d5d6
1 changed files with 11 additions and 1 deletions

View File

@ -341,13 +341,21 @@ static void bcm2835gpio_munmap(void)
} }
} }
static int bcm2835gpio_blink(int on)
{
if (is_gpio_config_valid(ADAPTER_GPIO_IDX_LED))
set_gpio_value(&adapter_gpio_config[ADAPTER_GPIO_IDX_LED], on);
return ERROR_OK;
}
static struct bitbang_interface bcm2835gpio_bitbang = { static struct bitbang_interface bcm2835gpio_bitbang = {
.read = bcm2835gpio_read, .read = bcm2835gpio_read,
.write = bcm2835gpio_write, .write = bcm2835gpio_write,
.swdio_read = bcm2835_swdio_read, .swdio_read = bcm2835_swdio_read,
.swdio_drive = bcm2835_swdio_drive, .swdio_drive = bcm2835_swdio_drive,
.swd_write = bcm2835gpio_swd_write_generic, .swd_write = bcm2835gpio_swd_write_generic,
.blink = NULL .blink = bcm2835gpio_blink,
}; };
static int bcm2835gpio_init(void) static int bcm2835gpio_init(void)
@ -440,6 +448,7 @@ static int bcm2835gpio_init(void)
} }
initialize_gpio(ADAPTER_GPIO_IDX_SRST); initialize_gpio(ADAPTER_GPIO_IDX_SRST);
initialize_gpio(ADAPTER_GPIO_IDX_LED);
return ERROR_OK; return ERROR_OK;
} }
@ -467,6 +476,7 @@ static int bcm2835gpio_quit(void)
} }
restore_gpio(ADAPTER_GPIO_IDX_SRST); restore_gpio(ADAPTER_GPIO_IDX_SRST);
restore_gpio(ADAPTER_GPIO_IDX_LED);
bcm2835gpio_munmap(); bcm2835gpio_munmap();