1 |
/* |
/* |
2 |
* Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2003-2007 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_le.c,v 1.51 2006/07/14 16:33:28 debug Exp $ |
* $Id: dev_le.c,v 1.54 2006/12/31 21:35:26 debug Exp $ |
29 |
* |
* |
30 |
* LANCE ethernet, as used in DECstations. |
* LANCE ethernet, as used in DECstations. |
31 |
* |
* |
85 |
|
|
86 |
|
|
87 |
struct le_data { |
struct le_data { |
88 |
int irq_nr; |
struct interrupt irq; |
89 |
|
int irq_asserted; |
90 |
|
|
91 |
uint64_t buf_start; |
uint64_t buf_start; |
92 |
uint64_t buf_end; |
uint64_t buf_end; |
538 |
void dev_le_tick(struct cpu *cpu, void *extra) |
void dev_le_tick(struct cpu *cpu, void *extra) |
539 |
{ |
{ |
540 |
struct le_data *d = (struct le_data *) extra; |
struct le_data *d = (struct le_data *) extra; |
541 |
|
int new_assert; |
542 |
|
|
543 |
le_register_fix(cpu->machine->emul->net, d); |
le_register_fix(cpu->machine->emul->net, d); |
544 |
|
|
545 |
if (d->reg[0] & LE_INTR && d->reg[0] & LE_INEA) |
new_assert = (d->reg[0] & LE_INTR) && (d->reg[0] & LE_INEA); |
546 |
cpu_interrupt(cpu, d->irq_nr); |
if (new_assert && !d->irq_asserted) |
547 |
else |
INTERRUPT_ASSERT(d->irq); |
548 |
cpu_interrupt_ack(cpu, d->irq_nr); |
if (d->irq_asserted && !new_assert) |
549 |
|
INTERRUPT_DEASSERT(d->irq); |
550 |
|
|
551 |
|
d->irq_asserted = new_assert; |
552 |
} |
} |
553 |
|
|
554 |
|
|
770 |
* dev_le_init(): |
* dev_le_init(): |
771 |
*/ |
*/ |
772 |
void dev_le_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, |
void dev_le_init(struct machine *machine, struct memory *mem, uint64_t baseaddr, |
773 |
uint64_t buf_start, uint64_t buf_end, int irq_nr, int len) |
uint64_t buf_start, uint64_t buf_end, char *irq_path, int len) |
774 |
{ |
{ |
775 |
char *name2; |
char *name2; |
776 |
size_t nlen = 55; |
size_t nlen = 55; |
782 |
} |
} |
783 |
|
|
784 |
memset(d, 0, sizeof(struct le_data)); |
memset(d, 0, sizeof(struct le_data)); |
785 |
d->irq_nr = irq_nr; |
|
786 |
|
INTERRUPT_CONNECT(irq_path, d->irq); |
787 |
|
|
788 |
d->sram = malloc(SRAM_SIZE); |
d->sram = malloc(SRAM_SIZE); |
789 |
if (d->sram == NULL) { |
if (d->sram == NULL) { |