1 |
/* |
/* |
2 |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-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_dec21143.c,v 1.26 2006/08/21 14:44:22 debug Exp $ |
* $Id: dev_dec21143.c,v 1.28 2007/01/05 15:20:06 debug Exp $ |
29 |
* |
* |
30 |
* DEC 21143 ("Tulip") ethernet controller. Implemented from Intel document |
* DEC 21143 ("Tulip") ethernet controller. Implemented from Intel document |
31 |
* 278074-001 ("21143 PC/CardBus 10/100Mb/s Ethernet LAN Controller") and by |
* 278074-001 ("21143 PC/CardBus 10/100Mb/s Ethernet LAN Controller") and by |
58 |
#include "device.h" |
#include "device.h" |
59 |
#include "devices.h" |
#include "devices.h" |
60 |
#include "emul.h" |
#include "emul.h" |
61 |
|
#include "interrupt.h" |
62 |
#include "machine.h" |
#include "machine.h" |
63 |
#include "memory.h" |
#include "memory.h" |
64 |
#include "misc.h" |
#include "misc.h" |
76 |
#define ROM_WIDTH 6 |
#define ROM_WIDTH 6 |
77 |
|
|
78 |
struct dec21143_data { |
struct dec21143_data { |
79 |
int irq_nr; |
struct interrupt irq; |
80 |
int irq_asserted; |
int irq_was_asserted; |
81 |
|
|
82 |
/* PCI: */ |
/* PCI: */ |
83 |
int pci_little_endian; |
int pci_little_endian; |
480 |
d->reg[CSR_STATUS / 8] |= STATUS_AIS; |
d->reg[CSR_STATUS / 8] |= STATUS_AIS; |
481 |
|
|
482 |
asserted = d->reg[CSR_STATUS / 8] & d->reg[CSR_INTEN / 8] & 0x0c01ffff; |
asserted = d->reg[CSR_STATUS / 8] & d->reg[CSR_INTEN / 8] & 0x0c01ffff; |
483 |
if (asserted) { |
|
484 |
cpu_interrupt(cpu, d->irq_nr); |
if (asserted) |
485 |
} else { |
INTERRUPT_ASSERT(d->irq); |
486 |
if (d->irq_asserted) |
if (!asserted && d->irq_was_asserted) |
487 |
cpu_interrupt_ack(cpu, d->irq_nr); |
INTERRUPT_DEASSERT(d->irq); |
|
} |
|
488 |
|
|
489 |
/* Remember assertion flag: */ |
/* Remember assertion flag: */ |
490 |
d->irq_asserted = asserted; |
d->irq_was_asserted = asserted; |
491 |
} |
} |
492 |
|
|
493 |
|
|
821 |
} |
} |
822 |
|
|
823 |
|
|
|
/* |
|
|
* dev_dec21143_access(): |
|
|
*/ |
|
824 |
DEVICE_ACCESS(dec21143) |
DEVICE_ACCESS(dec21143) |
825 |
{ |
{ |
826 |
struct dec21143_data *d = extra; |
struct dec21143_data *d = extra; |
994 |
} |
} |
995 |
memset(d, 0, sizeof(struct dec21143_data)); |
memset(d, 0, sizeof(struct dec21143_data)); |
996 |
|
|
997 |
d->irq_nr = devinit->irq_nr; |
INTERRUPT_CONNECT(devinit->interrupt_path, d->irq); |
998 |
d->pci_little_endian = devinit->pci_little_endian; |
d->pci_little_endian = devinit->pci_little_endian; |
999 |
|
|
1000 |
net_generate_unique_mac(devinit->machine, d->mac); |
net_generate_unique_mac(devinit->machine, d->mac); |