/[gxemul]/trunk/src/devices/dev_dreamcast_rtc.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_dreamcast_rtc.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_dreamcast_rtc.c,v 1.3 2007/02/03 20:14:23 debug Exp $   *  $Id: dev_dreamcast_rtc.c,v 1.4 2007/06/15 19:11:15 debug Exp $
29   *     *  
30   *  Dreamcast Real-Time Clock.   *  COMMENT: Dreamcast Real-Time Clock
31   *   *
32   *  Pretty basic; two 32-bit words at physical addresses 0x00710000 and   *  Pretty basic; two 32-bit words at physical addresses 0x00710000 and
33   *  0x00710004 hold the high and low 16-bit parts, respectively, of the   *  0x00710004 hold the high and low 16-bit parts, respectively, of the
# Line 58  struct dreamcast_rtc_data { Line 58  struct dreamcast_rtc_data {
58    
59  DEVICE_ACCESS(dreamcast_rtc)  DEVICE_ACCESS(dreamcast_rtc)
60  {  {
61          /*  struct dreamcast_rtc_data *d =          /*  struct dreamcast_rtc_data *d = extra;  */
             (struct dreamcast_rtc_data *) extra;  */  
62          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
63          struct timeval tv;          struct timeval tv;
64    
# Line 85  DEVICE_ACCESS(dreamcast_rtc) Line 84  DEVICE_ACCESS(dreamcast_rtc)
84                          odata &= 0xffff;                          odata &= 0xffff;
85                  break;                  break;
86    
87          default:if (writeflag == MEM_READ) {          default:
88                    if (writeflag == MEM_READ) {
89                          fatal("[ dreamcast_rtc: read from addr 0x%x ]\n",                          fatal("[ dreamcast_rtc: read from addr 0x%x ]\n",
90                              (int)relative_addr);                              (int)relative_addr);
91                  } else {                  } else {
# Line 103  DEVICE_ACCESS(dreamcast_rtc) Line 103  DEVICE_ACCESS(dreamcast_rtc)
103    
104  DEVINIT(dreamcast_rtc)  DEVINIT(dreamcast_rtc)
105  {  {
106          struct machine *machine = devinit->machine;          struct dreamcast_rtc_data *d;
107          struct dreamcast_rtc_data *d =  
108              malloc(sizeof(struct dreamcast_rtc_data));          CHECK_ALLOCATION(d = malloc(sizeof(struct dreamcast_rtc_data)));
         if (d == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
109          memset(d, 0, sizeof(struct dreamcast_rtc_data));          memset(d, 0, sizeof(struct dreamcast_rtc_data));
110    
111          memory_device_register(machine->memory, devinit->name,          memory_device_register(devinit->machine->memory, devinit->name,
112              0x00710000, 0x100, dev_dreamcast_rtc_access, d, DM_DEFAULT, NULL);              0x00710000, 0x100, dev_dreamcast_rtc_access, d, DM_DEFAULT, NULL);
113    
114          return 1;          return 1;

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

  ViewVC Help
Powered by ViewVC 1.1.26