I'm running openocd on EP9307(arm925t) CPU, as a HOST. and target is EP9307 and ARM926t with EP9307 GPIO.
this patch is, 1. speed up to usable speed. nanosleep is too slow on my machine. (linux is running 10mS timer, and I compiled openocd with uClibc.) 2. signal logic can be inverted with compile time. it can apply after my last patch. From: Hiroshi Ito <[EMAIL PROTECTED]> Subject: Re: [Openocd-development] PATCH:fix ep93xx.c Date: Tue, 02 Dec 2008 13:56:34 +0900 (JST) Message-ID: <[EMAIL PROTECTED]> -------- Hiroshi Ito Media Lab. Inc., URL http://www.mlb.co.jp ( Sorry, Japanese only. ) TEL +81-3-5294-7255 FAX +81-3-5294-7256
--- src/jtag/ep93xx.c.old 2008-12-02 13:29:35.000000000 +0900 +++ src/jtag/ep93xx.c 2008-12-02 14:31:55.000000000 +0900 @@ -25,6 +25,9 @@ #include "jtag.h" #include "bitbang.h" +#if 1 +#define INITIALIZE_GONK 1 + #define TDO_BIT 1 #define TDI_BIT 2 #define TCK_BIT 4 @@ -32,12 +35,25 @@ #define TRST_BIT 16 #define SRST_BIT 32 #define VCC_BIT 64 +#define INVERT_BITS 0 +#else +/* yet aonother cable */ +#define INITIALIZE_PORTD_AS_FLOAT 1 + +#define VCC_BIT 0 +#define TMS_BIT 1 +#define SRST_BIT 2 +#define TDI_BIT 4 +#define TDO_BIT 8 +#define TRST_BIT 16 +#define TCK_BIT 128 +#define INVERT_BITS 0/*(SRST_BIT|TRST_BIT)*/ +#endif /* system includes */ #include <string.h> #include <stdlib.h> #include <stdio.h> -#include <time.h> #include <sys/mman.h> #include <unistd.h> #include <fcntl.h> @@ -59,8 +75,6 @@ int ep93xx_init(void); int ep93xx_quit(void); -struct timespec ep93xx_zzzz; - jtag_interface_t ep93xx_interface = { .name = "ep93xx", @@ -83,7 +97,15 @@ int ep93xx_read(void) { - return !!(*gpio_data_register & TDO_BIT); + return !!((*gpio_data_register ^ INVERT_BITS ) & TDO_BIT); +} + +static void output_data(void) +{ + int i; + *gpio_data_register = output_value ^ INVERT_BITS; + for ( i = 0; i < 10; i++ ) + ; } void ep93xx_write(int tck, int tms, int tdi) @@ -103,8 +125,7 @@ else output_value &= ~TDI_BIT; - *gpio_data_register = output_value; - nanosleep(&ep93xx_zzzz, NULL); + output_data(); } /* (1) assert or (0) deassert reset lines */ @@ -120,8 +141,7 @@ else if (srst == 1) output_value &= ~SRST_BIT; - *gpio_data_register = output_value; - nanosleep(&ep93xx_zzzz, NULL); + output_data(); } int ep93xx_speed(int speed) @@ -136,6 +156,8 @@ return ERROR_OK; } +#ifdef INITIALIZE_GONK +/* set a keypad interface as a GPIO PORT C and PORT D. */ static int set_gonk_mode(void) { void *syscon; @@ -156,16 +178,16 @@ return ERROR_OK; } +#endif int ep93xx_init(void) { +#ifdef INITIALIZE_GONK int ret; +#endif bitbang_interface = &ep93xx_bitbang; - ep93xx_zzzz.tv_sec = 0; - ep93xx_zzzz.tv_nsec = 10000000; - dev_mem_fd = open("/dev/mem", O_RDWR | O_SYNC); if (dev_mem_fd < 0) { perror("open"); @@ -180,12 +202,14 @@ return ERROR_JTAG_INIT_FAILED; } +#ifdef INITIALIZE_GONK ret = set_gonk_mode(); if (ret != ERROR_OK) { munmap(gpio_controller, 4096); close(dev_mem_fd); return ret; } +#endif #if 0 /* Use GPIO port A. */ @@ -206,6 +230,12 @@ gpio_data_direction_register = gpio_controller + 0x1c; #endif +#ifdef INITIALIZE_PORTD_AS_FLOAT + /* unused pin is set to input(port D). */ + gpio_data_direction_register = gpio_controller + 0x1c; + *gpio_data_direction_register = 0; +#endif + /* Use GPIO port C. */ gpio_data_register = gpio_controller + 0x08; gpio_data_direction_register = gpio_controller + 0x18; @@ -218,8 +248,7 @@ * TMS/TRST/SRST high. */ output_value = TMS_BIT | TRST_BIT | SRST_BIT | VCC_BIT; - *gpio_data_register = output_value; - nanosleep(&ep93xx_zzzz, NULL); + output_data(); /* * Configure the direction register. 1 = output, 0 = input. @@ -227,12 +256,12 @@ *gpio_data_direction_register = TDI_BIT | TCK_BIT | TMS_BIT | TRST_BIT | SRST_BIT | VCC_BIT; - nanosleep(&ep93xx_zzzz, NULL); return ERROR_OK; } int ep93xx_quit(void) { + *gpio_data_direction_register = 0; return ERROR_OK; }
_______________________________________________ Openocd-development mailing list Openocd-development@lists.berlios.de https://lists.berlios.de/mailman/listinfo/openocd-development