X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fjtag%2Fdrivers%2Fbcm2835gpio.c;h=38ef163fab53fdf0da378491bce801769b89d1a2;hb=5c941edc7b0d6e0bed596293d81867453d1462e9;hp=7dfabcb4552ac33e28e4bec2e7bdf1b421cd01b4;hpb=962b3eb40cc5b69d9b3d6fcc4c5d56c4d204a307;p=fw%2Fopenocd diff --git a/src/jtag/drivers/bcm2835gpio.c b/src/jtag/drivers/bcm2835gpio.c index 7dfabcb45..38ef163fa 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., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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<