/[gxemul]/trunk/src/devices/dev_mb8696x.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_mb8696x.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 41 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 25  Line 25 
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   *   *
# Line 91  struct mb8696x_data { Line 91  struct mb8696x_data {
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    
# Line 268  DEVICE_ACCESS(mb8696x) Line 268  DEVICE_ACCESS(mb8696x)
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.  */
# Line 288  DEVINIT(mb8696x) Line 286  DEVINIT(mb8696x)
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;

Legend:
Removed from v.41  
changed lines
  Added in v.42

  ViewVC Help
Powered by ViewVC 1.1.26