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

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

revision 34 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_malta_lcd.c,v 1.9 2007/02/03 20:14:23 debug Exp $   *  $Id: dev_malta_lcd.c,v 1.11 2007/06/15 19:11:15 debug Exp $
29   *   *
30   *  Malta (evbmips) LCD thingy. Mostly a dummy device.   *  COMMENT: Malta (evbmips) LCD display
31     *
32     *  TODO. This is mostly a dummy device.
33   */   */
34    
35  #include <stdio.h>  #include <stdio.h>
# Line 52  struct malta_lcd_data { Line 54  struct malta_lcd_data {
54  };  };
55    
56    
57    DEVICE_TICK(malta_lcd)
 /*  
  *  dev_malta_lcd_tick():  
  */      
 void dev_malta_lcd_tick(struct cpu *cpu, void *extra)  
58  {  {
59          struct malta_lcd_data *d = extra;          struct malta_lcd_data *d = extra;
60          int i;          int i;
# Line 67  void dev_malta_lcd_tick(struct cpu *cpu, Line 65  void dev_malta_lcd_tick(struct cpu *cpu,
65                  d->display_modified = 2;                  d->display_modified = 2;
66                  return;                  return;
67          }          }
68    
69          debug("[ malta_lcd:  ");          debug("[ malta_lcd:  ");
70          for (i=0; i<LCD_LEN; i++)          for (i=0; i<LCD_LEN; i++)
71                  if (d->display[i] >= ' ')                  if (d->display[i] >= ' ')
72                          debug("%c", d->display[i]);                          debug("%c", d->display[i]);
73          debug("  ]\n");          debug("  ]\n");
74    
75          d->display_modified = 0;          d->display_modified = 0;
76  }  }
77    
78    
 /*  
  *  dev_malta_lcd_access():  
  */  
79  DEVICE_ACCESS(malta_lcd)  DEVICE_ACCESS(malta_lcd)
80  {  {
81          struct malta_lcd_data *d = (struct malta_lcd_data *) extra;          struct malta_lcd_data *d = extra;
82          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
83          int i;          int i;
84    
# Line 89  DEVICE_ACCESS(malta_lcd) Line 86  DEVICE_ACCESS(malta_lcd)
86                  idata = memory_readmax64(cpu, data, len);                  idata = memory_readmax64(cpu, data, len);
87    
88          switch (relative_addr) {          switch (relative_addr) {
89    
90          case 0x18:          case 0x18:
91          case 0x20:          case 0x20:
92          case 0x28:          case 0x28:
# Line 104  DEVICE_ACCESS(malta_lcd) Line 102  DEVICE_ACCESS(malta_lcd)
102                  } else                  } else
103                          odata = d->display[i];                          odata = d->display[i];
104                  break;                  break;
105    
106          default:if (writeflag == MEM_WRITE) {          default:if (writeflag == MEM_WRITE) {
107                          fatal("[ malta_lcd: unimplemented write to "                          fatal("[ malta_lcd: unimplemented write to "
108                              "offset 0x%x: data=0x%02x ]\n", (int)                              "offset 0x%x: data=0x%02x ]\n", (int)
# Line 123  DEVICE_ACCESS(malta_lcd) Line 122  DEVICE_ACCESS(malta_lcd)
122    
123  DEVINIT(malta_lcd)  DEVINIT(malta_lcd)
124  {  {
125          struct malta_lcd_data *d = malloc(sizeof(struct malta_lcd_data));          struct malta_lcd_data *d;
126    
127          if (d == NULL) {          CHECK_ALLOCATION(d = malloc(sizeof(struct malta_lcd_data)));
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
128          memset(d, 0, sizeof(struct malta_lcd_data));          memset(d, 0, sizeof(struct malta_lcd_data));
129    
130          memory_device_register(devinit->machine->memory, devinit->name,          memory_device_register(devinit->machine->memory, devinit->name,
# Line 136  DEVINIT(malta_lcd) Line 132  DEVINIT(malta_lcd)
132              dev_malta_lcd_access, (void *)d, DM_DEFAULT, NULL);              dev_malta_lcd_access, (void *)d, DM_DEFAULT, NULL);
133    
134          machine_add_tickfunction(devinit->machine, dev_malta_lcd_tick,          machine_add_tickfunction(devinit->machine, dev_malta_lcd_tick,
135              d, MALTA_LCD_TICK_SHIFT, 0.0);              d, MALTA_LCD_TICK_SHIFT);
136    
137          return 1;          return 1;
138  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26