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

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

revision 72 by dpavlin, Sun Oct 14 16:53:47 2007 UTC revision 73 by dpavlin, Sun Oct 14 18:35:57 2007 UTC
# Line 131  DEVICE_ACCESS(openpic) Line 131  DEVICE_ACCESS(openpic)
131                  if (writeflag == MEM_READ) {                  if (writeflag == MEM_READ) {
132                          // version 1.x, so 2 -> 1.2                          // version 1.x, so 2 -> 1.2
133                          odata = 2;                          odata = 2;
134                          fatal("[ openpic: read version "                          debug("[ openpic: read version "
135                              "offset 0x%x = 1.%d]\n", (int)                                  "offset 0x%x = 1.%d]\n", (int)
136                              relative_addr, (int)odata);                                  relative_addr, (int)odata);
137                            odata |= 0x00190000; // FIXME ?
138    
139                  }                  }
140                  fatal("[ openpic: unimplemented write to "                  fatal("[ openpic: unimplemented write to "
141                      "offset 0x%x: data=0x%x (OpenPIC version) ]\n", (int)                      "offset 0x%x: data=0x%x (OpenPIC version) ]\n", (int)
# Line 143  DEVICE_ACCESS(openpic) Line 145  DEVICE_ACCESS(openpic)
145          // global timer frequency          // global timer frequency
146          case 0xf0:          case 0xf0:
147                  if (writeflag == MEM_READ) {                  if (writeflag == MEM_READ) {
148                          odata = 170 * 1000000;  // MHz                          // this would be correct, but real DSM-G600 isn't
149                          fatal("[ openpic: read global timer frequency "                          // returning it!
150                            //odata = 170 * 1000000;        // MHz
151                            odata = 0;
152                            debug("[ openpic: read global timer frequency "
153                              "offset 0x%x = %x]\n", (int)                              "offset 0x%x = %x]\n", (int)
154                              relative_addr, (int)odata);                              relative_addr, (int)odata);
155                  }                  }
# Line 257  DEVICE_ACCESS(openpic) Line 262  DEVICE_ACCESS(openpic)
262                                  (int)relative_addr, (int)idata                                  (int)relative_addr, (int)idata
263                          );                          );
264                  } else {                  } else {
265                          fatal("[ openpic: unimplemented read from "                          // decoded from real device
266                                  "offset 0x%x odata = %x ]\n",                          odata |= OPENPIC_MASK;
267                                  (int)relative_addr, (int)odata                          
268                            int vec =
269                            (
270                                    (
271                                            (
272                                                    (
273                                                            ( relative_addr - 0x120 ) & 0xfff
274                                                    ) / 0x40
275                                            )
276                                    ) & 0xff
277                            ) + 0x40;
278    
279                            odata |= vec;
280    
281                            debug("[ openpic: unimplemented read from "
282                                    "offset 0x%x decoded vec = 0x%02x %d odata = %x ]\n",
283                                    (int)relative_addr, vec, vec, (int)odata
284                          );                          );
285                  }                  }
286          }          }
287    
288          if (writeflag == MEM_READ) {          if (writeflag == MEM_READ) {
289    
290                    debug("[ openpic: READ %05x | %08x ]\n",
291                            (int)relative_addr, (int)odata
292                    );
293    
294                  // shuffle byte order                  // shuffle byte order
295                  odata =                  odata =
296                          ( odata & 0x000000ff ) << 24 |                          ( odata & 0x000000ff ) << 24 |
# Line 272  DEVICE_ACCESS(openpic) Line 298  DEVICE_ACCESS(openpic)
298                          ( odata & 0x00ff0000 ) >> 8  |                          ( odata & 0x00ff0000 ) >> 8  |
299                          ( odata & 0xff000000 ) >> 24 ;                          ( odata & 0xff000000 ) >> 24 ;
300                  memory_writemax64(cpu, data, len, odata);                  memory_writemax64(cpu, data, len, odata);
                 debug("[ openpic: READ %05x | %08x ]\n",  
                         (int)relative_addr, (int)odata  
                 );  
301          }          }
302    
303          return 1;          return 1;

Legend:
Removed from v.72  
changed lines
  Added in v.73

  ViewVC Help
Powered by ViewVC 1.1.26