X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fjtag%2Fdrivers%2Fbcm2835gpio.c;h=926bd89d338fb8e6e7dac6a21147eea769f78e89;hp=5af92c36375bf537a04ed34b2858224537a7e51a;hb=b61e454869c988e7fafc1c16982ccfec04415b51;hpb=45bafc5c99297d0feccb06a2e002f2aae821d268 diff --git a/src/jtag/drivers/bcm2835gpio.c b/src/jtag/drivers/bcm2835gpio.c index 5af92c3637..926bd89d33 100644 --- a/src/jtag/drivers/bcm2835gpio.c +++ b/src/jtag/drivers/bcm2835gpio.c @@ -16,9 +16,7 @@ * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * + * along with this program. If not, see . * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -30,8 +28,11 @@ #include -#define BCM2835_PERI_BASE 0x20000000 -#define BCM2835_GPIO_BASE (BCM2835_PERI_BASE + 0x200000) /* GPIO controller */ +uint32_t bcm2835_peri_base = 0x20000000; +#define BCM2835_GPIO_BASE (bcm2835_peri_base + 0x200000) /* GPIO controller */ + +#define BCM2835_PADS_GPIO_0_27 (bcm2835_peri_base + 0x100000) +#define BCM2835_PADS_GPIO_0_27_OFFSET (0x2c / 4) /* GPIO setup macros */ #define MODE_GPIO(g) (*(pio_base+((g)/10))>>(((g)%10)*3) & 7) @@ -48,9 +49,12 @@ static int dev_mem_fd; static volatile uint32_t *pio_base; -static int bcm2835gpio_read(void); -static void bcm2835gpio_write(int tck, int tms, int tdi); -static void bcm2835gpio_reset(int trst, int srst); +static bb_value_t bcm2835gpio_read(void); +static int bcm2835gpio_write(int tck, int tms, int tdi); +static int bcm2835gpio_reset(int trst, int srst); + +static int bcm2835_swdio_read(void); +static void bcm2835_swdio_drive(bool is_output); static int bcm2835gpio_init(void); static int bcm2835gpio_quit(void); @@ -59,6 +63,8 @@ static struct bitbang_interface bcm2835gpio_bitbang = { .read = bcm2835gpio_read, .write = bcm2835gpio_write, .reset = bcm2835gpio_reset, + .swdio_read = bcm2835_swdio_read, + .swdio_drive = bcm2835_swdio_drive, .blink = NULL }; @@ -75,18 +81,22 @@ static int trst_gpio = -1; static int trst_gpio_mode; static int srst_gpio = -1; static int srst_gpio_mode; +static int swclk_gpio = -1; +static int swclk_gpio_mode; +static int swdio_gpio = -1; +static int swdio_gpio_mode; /* Transition delay coefficients */ static int speed_coeff = 113714; static int speed_offset = 28; static unsigned int jtag_delay; -static int bcm2835gpio_read(void) +static bb_value_t bcm2835gpio_read(void) { - return !!(GPIO_LEV & 1<