OpenOCD
|
Go to the source code of this file.
Data Structures | |
struct | initial_gpio_state |
Macros | |
#define | BCM2835_GPIO_BASE (bcm2835_peri_base + 0x200000) /* GPIO controller */ |
#define | BCM2835_GPIO_MODE_INPUT 0 |
#define | BCM2835_GPIO_MODE_OUTPUT 1 |
#define | BCM2835_PADS_GPIO_0_27 (bcm2835_peri_base + 0x100000) |
#define | BCM2835_PADS_GPIO_0_27_OFFSET (0x2c / 4) |
#define | GPIO_CLR (*(pio_base+10)) /* clears bits which are 1, ignores bits which are 0 */ |
#define | GPIO_LEV (*(pio_base+13)) /* current level of the pin */ |
#define | GPIO_SET (*(pio_base+7)) /* sets bits which are 1, ignores bits which are 0 */ |
#define | INP_GPIO(g) do { *(pio_base+((g)/10)) &= ~(7<<(((g)%10)*3)); } while (0) |
#define | MODE_GPIO(g) (*(pio_base+((g)/10))>>(((g)%10)*3) & 7) |
#define | OUT_GPIO(g) SET_MODE_GPIO(g, BCM2835_GPIO_MODE_OUTPUT) |
#define | SET_MODE_GPIO(g, m) |
Functions | |
static void | bcm2835_gpio_synchronize (void) |
static void | bcm2835_swdio_drive (bool is_output) |
static int | bcm2835_swdio_read (void) |
static int | bcm2835gpio_blink (int on) |
static int | bcm2835gpio_init (void) |
static bool | bcm2835gpio_jtag_mode_possible (void) |
static int | bcm2835gpio_khz (int khz, int *jtag_speed) |
static void | bcm2835gpio_munmap (void) |
static int | bcm2835gpio_quit (void) |
static bb_value_t | bcm2835gpio_read (void) |
static int | bcm2835gpio_reset (int trst, int srst) |
static int | bcm2835gpio_speed (int speed) |
static int | bcm2835gpio_speed_div (int speed, int *khz) |
static bool | bcm2835gpio_swd_mode_possible (void) |
static int | bcm2835gpio_swd_write_fast (int swclk, int swdio) |
static int | bcm2835gpio_swd_write_generic (int swclk, int swdio) |
static int | bcm2835gpio_write (int tck, int tms, int tdi) |
COMMAND_HANDLER (bcm2835gpio_handle_peripheral_base) | |
COMMAND_HANDLER (bcm2835gpio_handle_speed_coeffs) | |
static void | initialize_gpio (enum adapter_gpio_config_index idx) |
static bool | is_gpio_config_valid (enum adapter_gpio_config_index idx) |
static void | restore_gpio (enum adapter_gpio_config_index idx) |
static void | set_gpio_value (const struct adapter_gpio_config *gpio_config, int value) |
Variables | |
static const struct adapter_gpio_config * | adapter_gpio_config |
uint32_t | bcm2835_peri_base = 0x20000000 |
static const char *const | bcm2835_transports [] = { "jtag", "swd", NULL } |
struct adapter_driver | bcm2835gpio_adapter_driver |
static struct bitbang_interface | bcm2835gpio_bitbang |
static const struct command_registration | bcm2835gpio_command_handlers [] |
static struct jtag_interface | bcm2835gpio_interface |
static const struct command_registration | bcm2835gpio_subcommand_handlers [] |
static int | dev_mem_fd |
static uint32_t | initial_drive_strength_etc |
static struct initial_gpio_state | initial_gpio_state [ADAPTER_GPIO_IDX_NUM] |
static unsigned int | jtag_delay |
static volatile uint32_t * | pads_base = MAP_FAILED |
static volatile uint32_t * | pio_base = MAP_FAILED |
static int | speed_coeff = 113714 |
static int | speed_offset = 28 |
#define BCM2835_GPIO_BASE (bcm2835_peri_base + 0x200000) /* GPIO controller */ |
Definition at line 23 of file bcm2835gpio.c.
#define BCM2835_GPIO_MODE_INPUT 0 |
Definition at line 29 of file bcm2835gpio.c.
#define BCM2835_GPIO_MODE_OUTPUT 1 |
Definition at line 30 of file bcm2835gpio.c.
#define BCM2835_PADS_GPIO_0_27 (bcm2835_peri_base + 0x100000) |
Definition at line 25 of file bcm2835gpio.c.
#define BCM2835_PADS_GPIO_0_27_OFFSET (0x2c / 4) |
Definition at line 26 of file bcm2835gpio.c.
Definition at line 41 of file bcm2835gpio.c.
#define GPIO_LEV (*(pio_base+13)) /* current level of the pin */ |
Definition at line 42 of file bcm2835gpio.c.
Definition at line 40 of file bcm2835gpio.c.
#define INP_GPIO | ( | g | ) | do { *(pio_base+((g)/10)) &= ~(7<<(((g)%10)*3)); } while (0) |
Definition at line 34 of file bcm2835gpio.c.
#define MODE_GPIO | ( | g | ) | (*(pio_base+((g)/10))>>(((g)%10)*3) & 7) |
Definition at line 33 of file bcm2835gpio.c.
#define OUT_GPIO | ( | g | ) | SET_MODE_GPIO(g, BCM2835_GPIO_MODE_OUTPUT) |
Definition at line 38 of file bcm2835gpio.c.
#define SET_MODE_GPIO | ( | g, | |
m | |||
) |
Definition at line 35 of file bcm2835gpio.c.
|
inlinestatic |
Definition at line 60 of file bcm2835gpio.c.
Referenced by bcm2835_swdio_drive(), bcm2835gpio_swd_write_fast(), bcm2835gpio_write(), initialize_gpio(), restore_gpio(), and set_gpio_value().
|
static |
Definition at line 240 of file bcm2835gpio.c.
References ADAPTER_GPIO_IDX_SWDIO, ADAPTER_GPIO_IDX_SWDIO_DIR, bcm2835_gpio_synchronize(), INP_GPIO, is_gpio_config_valid(), OUT_GPIO, and set_gpio_value().
|
static |
Definition at line 254 of file bcm2835gpio.c.
References adapter_gpio_config::active_low, ADAPTER_GPIO_IDX_SWDIO, GPIO_LEV, and adapter_gpio_config::gpio_num.
|
static |
Definition at line 372 of file bcm2835gpio.c.
|
static |
Definition at line 389 of file bcm2835gpio.c.
References ADAPTER_GPIO_DRIVE_MODE_PUSH_PULL, adapter_gpio_get_config(), ADAPTER_GPIO_IDX_LED, ADAPTER_GPIO_IDX_SRST, ADAPTER_GPIO_IDX_SWCLK, ADAPTER_GPIO_IDX_SWDIO, ADAPTER_GPIO_IDX_SWDIO_DIR, ADAPTER_GPIO_IDX_TCK, ADAPTER_GPIO_IDX_TDI, ADAPTER_GPIO_IDX_TDO, ADAPTER_GPIO_IDX_TMS, ADAPTER_GPIO_IDX_TRST, ADAPTER_GPIO_INIT_STATE_INPUT, BCM2835_GPIO_BASE, BCM2835_PADS_GPIO_0_27, BCM2835_PADS_GPIO_0_27_OFFSET, bcm2835gpio_bitbang, bcm2835gpio_jtag_mode_possible(), bcm2835gpio_munmap(), bcm2835gpio_swd_mode_possible(), bcm2835gpio_swd_write_fast(), bcm2835gpio_swd_write_generic(), dev_mem_fd, ERROR_JTAG_INIT_FAILED, ERROR_OK, initial_drive_strength_etc, initialize_gpio(), LOG_DEBUG, LOG_ERROR, LOG_INFO, NULL, pads_base, pio_base, bitbang_interface::swd_write, transport_is_jtag(), and transport_is_swd().
|
static |
Definition at line 337 of file bcm2835gpio.c.
References ADAPTER_GPIO_IDX_TCK, ADAPTER_GPIO_IDX_TDI, ADAPTER_GPIO_IDX_TDO, ADAPTER_GPIO_IDX_TMS, and is_gpio_config_valid().
Referenced by bcm2835gpio_init().
|
static |
Definition at line 261 of file bcm2835gpio.c.
References ERROR_FAIL, ERROR_OK, LOG_DEBUG, speed_coeff, and speed_offset.
|
static |
Definition at line 359 of file bcm2835gpio.c.
References pads_base, and pio_base.
Referenced by bcm2835gpio_init(), and bcm2835gpio_quit().
|
static |
Definition at line 485 of file bcm2835gpio.c.
References ADAPTER_GPIO_IDX_LED, ADAPTER_GPIO_IDX_SRST, ADAPTER_GPIO_IDX_SWCLK, ADAPTER_GPIO_IDX_SWDIO, ADAPTER_GPIO_IDX_SWDIO_DIR, ADAPTER_GPIO_IDX_TCK, ADAPTER_GPIO_IDX_TDI, ADAPTER_GPIO_IDX_TDO, ADAPTER_GPIO_IDX_TMS, ADAPTER_GPIO_IDX_TRST, BCM2835_PADS_GPIO_0_27_OFFSET, bcm2835gpio_munmap(), ERROR_OK, initial_drive_strength_etc, INP_GPIO, pads_base, restore_gpio(), transport_is_jtag(), and transport_is_swd().
|
static |
Definition at line 160 of file bcm2835gpio.c.
References adapter_gpio_config::active_low, ADAPTER_GPIO_IDX_TDO, BB_HIGH, BB_LOW, GPIO_LEV, and adapter_gpio_config::gpio_num.
|
static |
Definition at line 221 of file bcm2835gpio.c.
References ADAPTER_GPIO_IDX_SRST, ADAPTER_GPIO_IDX_TRST, ERROR_OK, is_gpio_config_valid(), LOG_DEBUG, and set_gpio_value().
|
static |
Definition at line 279 of file bcm2835gpio.c.
References ERROR_OK, and jtag_delay.
|
static |
Definition at line 273 of file bcm2835gpio.c.
References ERROR_OK, speed_coeff, and speed_offset.
|
static |
Definition at line 350 of file bcm2835gpio.c.
References ADAPTER_GPIO_IDX_SWCLK, ADAPTER_GPIO_IDX_SWDIO, and is_gpio_config_valid().
Referenced by bcm2835gpio_init().
|
static |
Definition at line 188 of file bcm2835gpio.c.
References adapter_gpio_config::active_low, ADAPTER_GPIO_IDX_SWCLK, ADAPTER_GPIO_IDX_SWDIO, bcm2835_gpio_synchronize(), ERROR_OK, GPIO_CLR, adapter_gpio_config::gpio_num, GPIO_SET, and jtag_delay.
Referenced by bcm2835gpio_init().
|
static |
Definition at line 209 of file bcm2835gpio.c.
References ADAPTER_GPIO_IDX_SWCLK, ADAPTER_GPIO_IDX_SWDIO, ERROR_OK, jtag_delay, and set_gpio_value().
Referenced by bcm2835gpio_init().
|
static |
Definition at line 168 of file bcm2835gpio.c.
References ADAPTER_GPIO_IDX_TCK, ADAPTER_GPIO_IDX_TDI, ADAPTER_GPIO_IDX_TMS, bcm2835_gpio_synchronize(), ERROR_OK, GPIO_CLR, adapter_gpio_config::gpio_num, GPIO_SET, and jtag_delay.
COMMAND_HANDLER | ( | bcm2835gpio_handle_peripheral_base | ) |
Definition at line 297 of file bcm2835gpio.c.
COMMAND_HANDLER | ( | bcm2835gpio_handle_speed_coeffs | ) |
Definition at line 285 of file bcm2835gpio.c.
References CMD, CMD_ARGC, CMD_ARGV, COMMAND_PARSE_NUMBER, command_print(), ERROR_OK, speed_coeff, and speed_offset.
|
static |
Definition at line 125 of file bcm2835gpio.c.
References ADAPTER_GPIO_DRIVE_MODE_PUSH_PULL, adapter_gpio_get_name(), ADAPTER_GPIO_INIT_STATE_ACTIVE, ADAPTER_GPIO_INIT_STATE_INACTIVE, ADAPTER_GPIO_INIT_STATE_INPUT, ADAPTER_GPIO_PULL_NONE, bcm2835_gpio_synchronize(), GPIO_LEV, adapter_gpio_config::gpio_num, INP_GPIO, is_gpio_config_valid(), LOG_DEBUG, LOG_WARNING, initial_gpio_state::mode, mode, MODE_GPIO, OUT_GPIO, initial_gpio_state::output_level, and set_gpio_value().
Referenced by bcm2835gpio_init().
|
static |
Definition at line 69 of file bcm2835gpio.c.
References adapter_gpio_config::chip_num, and adapter_gpio_config::gpio_num.
Referenced by bcm2835_swdio_drive(), bcm2835gpio_jtag_mode_possible(), bcm2835gpio_reset(), bcm2835gpio_swd_mode_possible(), initialize_gpio(), and restore_gpio().
|
static |
Definition at line 111 of file bcm2835gpio.c.
References BCM2835_GPIO_MODE_OUTPUT, bcm2835_gpio_synchronize(), GPIO_CLR, adapter_gpio_config::gpio_num, GPIO_SET, is_gpio_config_valid(), mode, and SET_MODE_GPIO.
Referenced by bcm2835gpio_quit().
|
static |
Definition at line 78 of file bcm2835gpio.c.
References adapter_gpio_config::active_low, ADAPTER_GPIO_DRIVE_MODE_OPEN_DRAIN, ADAPTER_GPIO_DRIVE_MODE_OPEN_SOURCE, ADAPTER_GPIO_DRIVE_MODE_PUSH_PULL, bcm2835_gpio_synchronize(), adapter_gpio_config::drive, GPIO_CLR, adapter_gpio_config::gpio_num, GPIO_SET, INP_GPIO, and OUT_GPIO.
Referenced by bcm2835_swdio_drive(), bcm2835gpio_reset(), bcm2835gpio_swd_write_generic(), and initialize_gpio().
|
static |
Definition at line 53 of file bcm2835gpio.c.
uint32_t bcm2835_peri_base = 0x20000000 |
Definition at line 22 of file bcm2835gpio.c.
|
static |
Definition at line 518 of file bcm2835gpio.c.
struct adapter_driver bcm2835gpio_adapter_driver |
Definition at line 518 of file bcm2835gpio.c.
|
static |
Definition at line 372 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init().
|
static |
Definition at line 297 of file bcm2835gpio.c.
|
static |
Definition at line 518 of file bcm2835gpio.c.
|
static |
Definition at line 297 of file bcm2835gpio.c.
|
static |
Definition at line 44 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init().
|
static |
Definition at line 58 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init(), and bcm2835gpio_quit().
|
static |
|
static |
Definition at line 51 of file bcm2835gpio.c.
Referenced by bcm2835gpio_speed(), bcm2835gpio_swd_write_fast(), bcm2835gpio_swd_write_generic(), and bcm2835gpio_write().
|
static |
Definition at line 46 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init(), bcm2835gpio_munmap(), and bcm2835gpio_quit().
|
static |
Definition at line 45 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init(), and bcm2835gpio_munmap().
|
static |
Definition at line 49 of file bcm2835gpio.c.
Referenced by bcm2835gpio_khz(), bcm2835gpio_speed_div(), and COMMAND_HANDLER().
|
static |
Definition at line 50 of file bcm2835gpio.c.
Referenced by bcm2835gpio_khz(), bcm2835gpio_speed_div(), and COMMAND_HANDLER().