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) |
#define | MODE_GPIO(_g) |
#define | OUT_GPIO(g) SET_MODE_GPIO(g, BCM2835_GPIO_MODE_OUTPUT) |
#define | SET_MODE_GPIO(_g, m) |
Functions | |
static void | bcm2835_delay (void) |
static const char * | bcm2835_get_mem_dev (void) |
static void | bcm2835_gpio_synchronize (void) |
static void | bcm2835_swdio_drive (bool is_output) |
static int | bcm2835_swdio_read (void) |
static int | bcm2835gpio_blink (bool 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_peripheral_mem_dev) | |
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 |
static off_t | bcm2835_peri_base = 0x20000000 |
static char * | bcm2835_peri_mem_dev |
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 24 of file bcm2835gpio.c.
#define BCM2835_GPIO_MODE_INPUT 0 |
Definition at line 30 of file bcm2835gpio.c.
#define BCM2835_GPIO_MODE_OUTPUT 1 |
Definition at line 31 of file bcm2835gpio.c.
#define BCM2835_PADS_GPIO_0_27 (bcm2835_peri_base + 0x100000) |
Definition at line 26 of file bcm2835gpio.c.
#define BCM2835_PADS_GPIO_0_27_OFFSET (0x2c / 4) |
Definition at line 27 of file bcm2835gpio.c.
Definition at line 54 of file bcm2835gpio.c.
#define GPIO_LEV (*(pio_base + 13)) /* current level of the pin */ |
Definition at line 55 of file bcm2835gpio.c.
Definition at line 53 of file bcm2835gpio.c.
#define INP_GPIO | ( | _g | ) |
Definition at line 39 of file bcm2835gpio.c.
#define MODE_GPIO | ( | _g | ) |
Definition at line 34 of file bcm2835gpio.c.
#define OUT_GPIO | ( | g | ) | SET_MODE_GPIO(g, BCM2835_GPIO_MODE_OUTPUT) |
Definition at line 51 of file bcm2835gpio.c.
#define SET_MODE_GPIO | ( | _g, | |
m | |||
) |
Definition at line 44 of file bcm2835gpio.c.
|
inlinestatic |
Definition at line 90 of file bcm2835gpio.c.
References jtag_delay.
Referenced by bcm2835gpio_swd_write_fast(), bcm2835gpio_swd_write_generic(), and bcm2835gpio_write().
|
inlinestatic |
Definition at line 73 of file bcm2835gpio.c.
References bcm2835_peri_mem_dev.
Referenced by bcm2835gpio_init(), and COMMAND_HANDLER().
|
inlinestatic |
Definition at line 81 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 264 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 278 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 422 of file bcm2835gpio.c.
|
static |
Definition at line 439 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_get_mem_dev(), BCM2835_GPIO_BASE, BCM2835_PADS_GPIO_0_27, BCM2835_PADS_GPIO_0_27_OFFSET, bcm2835gpio_bitbang, bcm2835gpio_jtag_mode_possible(), 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, LOG_WARNING, NULL, pads_base, pio_base, bitbang_interface::swd_write, transport_is_jtag(), and transport_is_swd().
|
static |
Definition at line 387 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 285 of file bcm2835gpio.c.
References DIV_ROUND_UP, ERROR_FAIL, ERROR_OK, LOG_DEBUG, speed_coeff, and speed_offset.
|
static |
Definition at line 409 of file bcm2835gpio.c.
References pads_base, and pio_base.
Referenced by bcm2835gpio_quit().
|
static |
Definition at line 545 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, bcm2835_peri_mem_dev, 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 185 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 242 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 306 of file bcm2835gpio.c.
References ERROR_OK, and jtag_delay.
|
static |
Definition at line 298 of file bcm2835gpio.c.
References ERROR_OK, speed_coeff, and speed_offset.
|
static |
Definition at line 400 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 211 of file bcm2835gpio.c.
References adapter_gpio_config::active_low, ADAPTER_GPIO_IDX_SWCLK, ADAPTER_GPIO_IDX_SWDIO, bcm2835_delay(), bcm2835_gpio_synchronize(), ERROR_OK, GPIO_CLR, adapter_gpio_config::gpio_num, and GPIO_SET.
Referenced by bcm2835gpio_init().
|
static |
Definition at line 231 of file bcm2835gpio.c.
References ADAPTER_GPIO_IDX_SWCLK, ADAPTER_GPIO_IDX_SWDIO, bcm2835_delay(), ERROR_OK, and set_gpio_value().
Referenced by bcm2835gpio_init().
|
static |
Definition at line 192 of file bcm2835gpio.c.
References ADAPTER_GPIO_IDX_TCK, ADAPTER_GPIO_IDX_TDI, ADAPTER_GPIO_IDX_TMS, bcm2835_delay(), bcm2835_gpio_synchronize(), ERROR_OK, GPIO_CLR, adapter_gpio_config::gpio_num, and GPIO_SET.
COMMAND_HANDLER | ( | bcm2835gpio_handle_peripheral_base | ) |
Definition at line 336 of file bcm2835gpio.c.
COMMAND_HANDLER | ( | bcm2835gpio_handle_peripheral_mem_dev | ) |
Definition at line 324 of file bcm2835gpio.c.
References bcm2835_get_mem_dev(), bcm2835_peri_mem_dev, CMD, CMD_ARGC, CMD_ARGV, command_print(), and ERROR_OK.
COMMAND_HANDLER | ( | bcm2835gpio_handle_speed_coeffs | ) |
Definition at line 312 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 149 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 96 of file bcm2835gpio.c.
References 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 135 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 102 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 66 of file bcm2835gpio.c.
|
static |
Definition at line 23 of file bcm2835gpio.c.
|
static |
Definition at line 22 of file bcm2835gpio.c.
Referenced by bcm2835_get_mem_dev(), bcm2835gpio_quit(), and COMMAND_HANDLER().
|
static |
Definition at line 581 of file bcm2835gpio.c.
struct adapter_driver bcm2835gpio_adapter_driver |
Definition at line 581 of file bcm2835gpio.c.
|
static |
Definition at line 422 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init().
|
static |
Definition at line 336 of file bcm2835gpio.c.
|
static |
Definition at line 581 of file bcm2835gpio.c.
|
static |
Definition at line 336 of file bcm2835gpio.c.
|
static |
Definition at line 57 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init().
|
static |
Definition at line 71 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init(), and bcm2835gpio_quit().
|
static |
|
static |
Definition at line 64 of file bcm2835gpio.c.
Referenced by bcm2835_delay(), and bcm2835gpio_speed().
|
static |
Definition at line 59 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init(), bcm2835gpio_munmap(), and bcm2835gpio_quit().
|
static |
Definition at line 58 of file bcm2835gpio.c.
Referenced by bcm2835gpio_init(), and bcm2835gpio_munmap().
|
static |
Definition at line 62 of file bcm2835gpio.c.
Referenced by bcm2835gpio_khz(), bcm2835gpio_speed_div(), and COMMAND_HANDLER().
|
static |
Definition at line 63 of file bcm2835gpio.c.
Referenced by bcm2835gpio_khz(), bcm2835gpio_speed_div(), and COMMAND_HANDLER().