25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_mb8696x.c,v 1.3 2007/02/03 20:14:23 debug Exp $ |
* $Id: dev_mb8696x.c,v 1.4 2007/06/15 19:11:15 debug Exp $ |
29 |
* |
* |
30 |
* Fujitsu MB8696x Ethernet interface. |
* COMMENT: Fujitsu MB8696x Ethernet interface (used in the Dreamcast) |
31 |
* |
* |
32 |
* Used as the LAN adapter (MB86967) in the Dreamcast machine mode. |
* Used as the LAN adapter (MB86967) in the Dreamcast machine mode. |
33 |
* |
* |
91 |
|
|
92 |
DEVICE_ACCESS(mb8696x) |
DEVICE_ACCESS(mb8696x) |
93 |
{ |
{ |
94 |
struct mb8696x_data *d = (struct mb8696x_data *) extra; |
struct mb8696x_data *d = extra; |
95 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
96 |
uint8_t *reg_ptr; |
uint8_t *reg_ptr; |
97 |
|
|
268 |
|
|
269 |
DEVINIT(mb8696x) |
DEVINIT(mb8696x) |
270 |
{ |
{ |
271 |
struct machine *machine = devinit->machine; |
struct mb8696x_data *d; |
272 |
struct mb8696x_data *d = malloc(sizeof(struct mb8696x_data)); |
|
273 |
if (d == NULL) { |
CHECK_ALLOCATION(d = malloc(sizeof(struct mb8696x_data))); |
|
fprintf(stderr, "out of memory\n"); |
|
|
exit(1); |
|
|
} |
|
274 |
memset(d, 0, sizeof(struct mb8696x_data)); |
memset(d, 0, sizeof(struct mb8696x_data)); |
275 |
|
|
276 |
d->addr_mult = devinit->addr_mult; |
d->addr_mult = devinit->addr_mult; |
277 |
|
|
278 |
memory_device_register(machine->memory, devinit->name, devinit->addr, |
memory_device_register(devinit->machine->memory, devinit->name, |
279 |
MB8696X_NREGS * d->addr_mult, dev_mb8696x_access, d, |
devinit->addr, MB8696X_NREGS * d->addr_mult, dev_mb8696x_access, d, |
280 |
DM_DEFAULT, NULL); |
DM_DEFAULT, NULL); |
281 |
|
|
282 |
/* NetBSD/dreamcast expects ident = 86967. */ |
/* NetBSD/dreamcast expects ident = 86967. */ |
286 |
* Generate the MAC address, both in the first 6 bytes of the |
* Generate the MAC address, both in the first 6 bytes of the |
287 |
* EEPROM, and in DLCR8..13: |
* EEPROM, and in DLCR8..13: |
288 |
*/ |
*/ |
289 |
net_generate_unique_mac(machine, &d->eeprom[0]); |
net_generate_unique_mac(devinit->machine, &d->eeprom[0]); |
290 |
memcpy(&d->reg[FE_DLCR8], &d->eeprom[0], 6); |
memcpy(&d->reg[FE_DLCR8], &d->eeprom[0], 6); |
291 |
|
|
292 |
return 1; |
return 1; |