Updates to JIM, code skeleton for flash attached to some_cpu bus

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@949 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Kolja Waschk 17 years ago
parent 80a9a73fca
commit 8d7e8c7c57

@ -1,3 +1,9 @@
2008-01-25 Kolja Waschk <kawk>
* include/jim.h, src/jim/tap.c, intel_28f800b3.c, Makefile.am,
some_cpu.c: Code skeleton and alloc/free calls for actual parts
connected to JIM's some_cpu
2008-01-24 Kolja Waschk <kawk>
* tap/cable/ft2232.c, tap/parport/ftdi.c, tap/cable.c: added support

@ -71,6 +71,7 @@ typedef struct jim_device
void (*tck_rise)(struct jim_device *dev, int tms, int tdi);
void (*tck_fall)(struct jim_device *dev);
void (*dev_free)(struct jim_device *dev);
void *state;
int num_sregs;
int current_dr;
shift_reg_t *sreg;
@ -86,6 +87,24 @@ typedef struct jim_state
}
jim_state_t;
typedef struct jim_bus_device
{
int width; /* bits */
uint32_t size; /* bytes */
void *state; /* device-dependent */
void (*init)(struct jim_bus_device *x);
void (*access)(struct jim_bus_device *x,
uint32_t address, uint32_t data, uint32_t control);
void (*free)(struct jim_bus_device *x);
}
jim_bus_device_t;
typedef struct
{
uint32_t offset;
jim_bus_device_t *part;
}
jim_attached_part_t;
void jim_set_trst(jim_state_t *s, int trst);
int jim_get_trst(jim_state_t *s);

@ -27,4 +27,5 @@ noinst_LIBRARIES = libjim.a
libjim_a_SOURCES = \
tap.c \
some_cpu.c
some_cpu.c \
intel_28f800b3.c

@ -0,0 +1,27 @@
#include <jim.h>
#include <stdint.h>
#include <stdlib.h>
void intel_28f800b3_init(jim_bus_device_t *d)
{
}
void intel_28f800b3_free(jim_bus_device_t *d)
{
}
void intel_28f800b3_access(jim_bus_device_t *d,
uint32_t address, uint32_t data, uint32_t control)
{
}
jim_bus_device_t intel_28f800b3 =
{
16, /* width [bits] */
0x800, /* size [bytes] */
NULL, /* state */
intel_28f800b3_init, /* init() */
intel_28f800b3_access, /* access() */
intel_28f800b3_free /* free() */
};

@ -23,8 +23,18 @@
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <jim.h>
extern jim_bus_device_t intel_28f800b3;
jim_attached_part_t some_cpu_attached[] =
{
{ 0x00000000, &intel_28f800b3 },
{ 0xFFFFFFFF, NULL }
};
#define BSR_LEN 202
void some_cpu_report_idcode(jim_device_t *dev)
@ -34,10 +44,28 @@ void some_cpu_report_idcode(jim_device_t *dev)
dev->current_dr = 1; /* IDR */
}
void some_cpu_tck_rise(jim_device_t *dev, int tms, int tdi)
void some_cpu_extest(char *st, jim_device_t *dev)
{
int i;
printf("EXTEST/%s with A=%08X, D=%08X%s%s%s\n", st,
dev->sreg[2].reg[0], dev->sreg[2].reg[1],
(dev->sreg[2].reg[2] & 1) ? ", OE":"",
(dev->sreg[2].reg[2] & 2) ? ", WE":"",
(dev->sreg[2].reg[2] & 4) ? ", CS":"");
for(i=0; some_cpu_attached[i].part; i++)
{
jim_bus_device_t *b = ((jim_attached_part_t*)(dev->state))[i].part;
b->access(b, dev->sreg[2].reg[0],
dev->sreg[2].reg[1],
dev->sreg[2].reg[2]);
}
}
void some_cpu_tck_rise(jim_device_t *dev, int tms, int tdi)
{
// jim_print_tap_state(dev);
switch(dev->tap_state)
@ -49,12 +77,7 @@ void some_cpu_tck_rise(jim_device_t *dev, int tms, int tdi)
case UPDATE_DR:
if(dev->current_dr == 2)
{
printf("UPDATE_DR(BSR): A=%08X, D=%08X%s%s%s\n",
dev->sreg[2].reg[0],
dev->sreg[2].reg[1],
(dev->sreg[2].reg[2] & 1) ? ", OE":"",
(dev->sreg[2].reg[2] & 2) ? ", WE":"",
(dev->sreg[2].reg[2] & 4) ? ", CS":"");
if(dev->sreg[0].reg[0] == 0) some_cpu_extest("UPDATE_DR", dev);
};
break;
@ -64,6 +87,7 @@ void some_cpu_tck_rise(jim_device_t *dev, int tms, int tdi)
case 0x0: /* EXTEST */
printf("EXTEST\n");
dev->current_dr = 2;
some_cpu_extest("UPDATE_IR", dev);
break;
case 0x1: /* IDCODE */
printf("IDCODE\n");
@ -86,6 +110,21 @@ void some_cpu_tck_rise(jim_device_t *dev, int tms, int tdi)
}
}
void some_cpu_free(jim_device_t *dev)
{
int i;
if(!dev) return;
if(!dev->state) return;
for(i=0;some_cpu_attached[i].part;i++)
{
jim_bus_device_t *b = ((jim_attached_part_t*)(dev->state))[i].part;
if(b->free != NULL) b->free(b);
}
free(dev->state);
}
jim_device_t *some_cpu(void)
{
jim_device_t *dev;
@ -95,7 +134,24 @@ jim_device_t *some_cpu(void)
if(dev)
{
dev->tck_rise = some_cpu_tck_rise;
dev->state = malloc(sizeof(some_cpu_attached));
if(!dev->state)
{
free(dev);
dev = NULL;
}
else
{
int i;
dev->tck_rise = some_cpu_tck_rise;
dev->dev_free = some_cpu_free;
memcpy(dev->state, some_cpu_attached, sizeof(some_cpu_attached));
for(i=0;some_cpu_attached[i].part;i++)
{
jim_bus_device_t *b = ((jim_attached_part_t*)(dev->state))[i].part;
b->init(b);
}
}
}
return dev;

@ -248,6 +248,7 @@ jim_state_t *jim_init(void)
s->trst = 0;
s->last_device_in_chain = some_cpu();
if(s->last_device_in_chain != NULL)
{
s->last_device_in_chain->prev = NULL;

Loading…
Cancel
Save