25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_le.c,v 1.39 2005/03/14 19:14:02 debug Exp $ |
* $Id: dev_le.c,v 1.44 2005/10/26 14:37:04 debug Exp $ |
29 |
* |
* |
30 |
* LANCE ethernet, as used in DECstations. |
* LANCE ethernet, as used in DECstations. |
31 |
* |
* |
93 |
int reg_select; |
int reg_select; |
94 |
uint16_t reg[N_REGISTERS]; |
uint16_t reg[N_REGISTERS]; |
95 |
|
|
96 |
unsigned char sram[SRAM_SIZE]; |
unsigned char *sram; |
97 |
|
|
98 |
/* Initialization block: */ |
/* Initialization block: */ |
99 |
uint32_t init_block_addr; |
uint32_t init_block_addr; |
658 |
int i, retval = 1; |
int i, retval = 1; |
659 |
struct le_data *d = extra; |
struct le_data *d = extra; |
660 |
|
|
661 |
idata = memory_readmax64(cpu, data, len); |
if (writeflag == MEM_WRITE) |
662 |
|
idata = memory_readmax64(cpu, data, len); |
663 |
|
|
664 |
#ifdef LE_DEBUG |
#ifdef LE_DEBUG |
665 |
if (writeflag == MEM_WRITE) { |
if (writeflag == MEM_WRITE) { |
769 |
uint64_t buf_start, uint64_t buf_end, int irq_nr, int len) |
uint64_t buf_start, uint64_t buf_end, int irq_nr, int len) |
770 |
{ |
{ |
771 |
char *name2; |
char *name2; |
772 |
|
size_t nlen = 55; |
773 |
struct le_data *d = malloc(sizeof(struct le_data)); |
struct le_data *d = malloc(sizeof(struct le_data)); |
774 |
|
|
775 |
if (d == NULL) { |
if (d == NULL) { |
780 |
memset(d, 0, sizeof(struct le_data)); |
memset(d, 0, sizeof(struct le_data)); |
781 |
d->irq_nr = irq_nr; |
d->irq_nr = irq_nr; |
782 |
|
|
783 |
|
d->sram = malloc(SRAM_SIZE); |
784 |
|
if (d->sram == NULL) { |
785 |
|
fprintf(stderr, "out of memory\n"); |
786 |
|
exit(1); |
787 |
|
} |
788 |
|
memset(d->sram, 0, SRAM_SIZE); |
789 |
|
|
790 |
/* TODO: Are these actually used yet? */ |
/* TODO: Are these actually used yet? */ |
791 |
d->len = len; |
d->len = len; |
792 |
d->buf_start = buf_start; |
d->buf_start = buf_start; |
825 |
|
|
826 |
memory_device_register(mem, "le_sram", baseaddr, |
memory_device_register(mem, "le_sram", baseaddr, |
827 |
SRAM_SIZE, dev_le_sram_access, (void *)d, |
SRAM_SIZE, dev_le_sram_access, (void *)d, |
828 |
MEM_BINTRANS_OK | MEM_BINTRANS_WRITE_OK, d->sram); |
MEM_DYNTRANS_OK | MEM_DYNTRANS_WRITE_OK |
829 |
|
| MEM_READING_HAS_NO_SIDE_EFFECTS, d->sram); |
830 |
|
|
831 |
name2 = malloc(50); |
name2 = malloc(nlen); |
832 |
if (name2 == NULL) { |
if (name2 == NULL) { |
833 |
fprintf(stderr, "out of memory in dev_le_init()\n"); |
fprintf(stderr, "out of memory in dev_le_init()\n"); |
834 |
exit(1); |
exit(1); |
835 |
} |
} |
836 |
sprintf(name2, "le [%02x:%02x:%02x:%02x:%02x:%02x]", |
snprintf(name2, nlen, "le [%02x:%02x:%02x:%02x:%02x:%02x]", |
837 |
d->rom[0], d->rom[1], d->rom[2], d->rom[3], d->rom[4], d->rom[5]); |
d->rom[0], d->rom[1], d->rom[2], d->rom[3], d->rom[4], d->rom[5]); |
838 |
|
|
839 |
memory_device_register(mem, name2, baseaddr + 0x100000, |
memory_device_register(mem, name2, baseaddr + 0x100000, |