/[gxemul]/trunk/src/devices/dev_ps2_ether.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_ps2_ether.c

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

revision 18 by dpavlin, Mon Oct 8 16:19:11 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2005  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:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_ps2_ether.c,v 1.3 2005/10/26 14:37:04 debug Exp $   *  $Id: dev_ps2_ether.c,v 1.8 2007/06/15 19:57:33 debug Exp $
29   *     *  
30   *  Playstation 2 ethernet (smap and emac3).   *  COMMENT: PlayStation 2 ethernet (smap and emac3)
31   *   *
32   *  TODO   *  TODO
33   */   */
# Line 50  struct ps2_ether_data { Line 50  struct ps2_ether_data {
50  };  };
51    
52    
53  /*  DEVICE_ACCESS(ps2_ether)
  *  dev_ps2_ether_access():  
  */  
 int dev_ps2_ether_access(struct cpu *cpu, struct memory *mem,  
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
54  {  {
55          /*  struct ps2_ether_data *d = extra;  */          /*  struct ps2_ether_data *d = extra;  */
56          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
# Line 64  int dev_ps2_ether_access(struct cpu *cpu Line 59  int dev_ps2_ether_access(struct cpu *cpu
59                  idata = memory_readmax64(cpu, data, len);                  idata = memory_readmax64(cpu, data, len);
60    
61          switch (relative_addr) {          switch (relative_addr) {
62    
63          case 0x105c:          case 0x105c:
64                  /*  TODO: make these register accesses nicer  */                  /*  TODO: make these register accesses nicer  */
65                  break;                  break;
66    
67          case 0x105e:          case 0x105e:
68                  odata = 0x8000; /*  STACR_OC  */                  odata = 0x8000; /*  STACR_OC  */
69                  break;                  break;
70    
71          default:          default:
72                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
73                          debug("[ ps2_ether: read from addr 0x%x: 0x%llx ]\n",                          debug("[ ps2_ether: read from addr 0x%x: 0x%llx ]\n",
# Line 87  int dev_ps2_ether_access(struct cpu *cpu Line 85  int dev_ps2_ether_access(struct cpu *cpu
85  }  }
86    
87    
88  /*  DEVINIT(ps2_ether)
  *  devinit_ps2_ether():  
  */  
 int devinit_ps2_ether(struct devinit *devinit)  
89  {  {
90          struct ps2_ether_data *d;          struct ps2_ether_data *d;
91    
92          d = malloc(sizeof(struct ps2_ether_data));          CHECK_ALLOCATION(d = malloc(sizeof(struct ps2_ether_data)));
         if (d == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
93          memset(d, 0, sizeof(struct ps2_ether_data));          memset(d, 0, sizeof(struct ps2_ether_data));
94    
95          memory_device_register(devinit->machine->memory, devinit->name,          memory_device_register(devinit->machine->memory, devinit->name,
96              devinit->addr, 0x4000,              devinit->addr, 0x4000,
97              dev_ps2_ether_access, d, MEM_DEFAULT, NULL);              dev_ps2_ether_access, d, DM_DEFAULT, NULL);
98    
99          return 1;          return 1;
100  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26