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

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

revision 21 by dpavlin, Mon Oct 8 16:19:23 2007 UTC revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2006  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_bt459.c,v 1.61 2005/11/13 00:14:08 debug Exp $   *  $Id: dev_bt459.c,v 1.63 2006/01/01 13:17:16 debug Exp $
29   *     *  
30   *  Brooktree 459 vdac, used by TURBOchannel graphics cards.   *  Brooktree 459 vdac, used by TURBOchannel graphics cards.
31   */   */
# Line 101  struct bt459_data { Line 101  struct bt459_data {
101    
102    
103  /*  /*
  *  bt459_state():  
  */  
 int bt459_state(struct cpu *cpu, struct memory *mem, void *extra, int wf,  
         int nr, int *type, char **namep, void **data, size_t *len)  
 {  
         struct bt459_data *d = (struct bt459_data *) extra;  
   
         switch (nr) {  
         case 0: if (wf) {  
                         memcpy(&d->cursor_on, *data, *len);  
                 } else {  
                         (*namep) = "cursor_on";  
                         (*type) = DEVICE_STATE_TYPE_INT;  
                         *len = sizeof(d->cursor_on);  
                         *data = &d->cursor_on;  
                 }  
                 break;  
         case 1: if (wf) {  
                         memcpy(&d->cursor_x, *data, *len);  
                 } else {  
                         (*namep) = "cursor_x";  
                         (*type) = DEVICE_STATE_TYPE_INT;  
                         *len = sizeof(d->cursor_x);  
                         *data = &d->cursor_x;  
                 }  
                 break;  
         case 2: if (wf) {  
                         memcpy(&d->cursor_y, *data, *len);  
                 } else {  
                         (*namep) = "cursor_y";  
                         (*type) = DEVICE_STATE_TYPE_INT;  
                         *len = sizeof(d->cursor_y);  
                         *data = &d->cursor_y;  
                 }  
                 break;  
         case 3: if (wf) {  
                         memcpy(&d->cursor_xsize, *data, *len);  
                 } else {  
                         (*namep) = "cursor_xsize";  
                         (*type) = DEVICE_STATE_TYPE_INT;  
                         *len = sizeof(d->cursor_xsize);  
                         *data = &d->cursor_xsize;  
                 }  
                 break;  
         case 4: if (wf) {  
                         memcpy(&d->cursor_ysize, *data, *len);  
                 } else {  
                         (*namep) = "cursor_ysize";  
                         (*type) = DEVICE_STATE_TYPE_INT;  
                         *len = sizeof(d->cursor_ysize);  
                         *data = &d->cursor_ysize;  
                 }  
                 break;  
         default:  
                 return 0;  
         }  
   
         return 1;  
 }  
   
   
 /*  
104   *  bt459_update_X_cursor():   *  bt459_update_X_cursor():
105   *   *
106   *  This routine takes the color values in the cursor RAM area, and put them   *  This routine takes the color values in the cursor RAM area, and put them
# Line 350  void dev_bt459_tick(struct cpu *cpu, voi Line 288  void dev_bt459_tick(struct cpu *cpu, voi
288  /*  /*
289   *  dev_bt459_irq_access():   *  dev_bt459_irq_access():
290   */   */
291  int dev_bt459_irq_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(bt459_irq)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
292  {  {
293          struct bt459_data *d = (struct bt459_data *) extra;          struct bt459_data *d = (struct bt459_data *) extra;
294          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
# Line 378  int dev_bt459_irq_access(struct cpu *cpu Line 314  int dev_bt459_irq_access(struct cpu *cpu
314  /*  /*
315   *  dev_bt459_access():   *  dev_bt459_access():
316   */   */
317  int dev_bt459_access(struct cpu *cpu, struct memory *mem,  DEVICE_ACCESS(bt459)
         uint64_t relative_addr, unsigned char *data, size_t len,  
         int writeflag, void *extra)  
318  {  {
319          struct bt459_data *d = (struct bt459_data *) extra;          struct bt459_data *d = (struct bt459_data *) extra;
320          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
# Line 656  void dev_bt459_init(struct machine *mach Line 590  void dev_bt459_init(struct machine *mach
590                      dev_bt459_irq_access, (void *)d, DM_DEFAULT, NULL);                      dev_bt459_irq_access, (void *)d, DM_DEFAULT, NULL);
591    
592          machine_add_tickfunction(machine, dev_bt459_tick, d, BT459_TICK_SHIFT);          machine_add_tickfunction(machine, dev_bt459_tick, d, BT459_TICK_SHIFT);
   
         memory_device_register_statefunction(mem, d, bt459_state);  
593  }  }
594    

Legend:
Removed from v.21  
changed lines
  Added in v.22

  ViewVC Help
Powered by ViewVC 1.1.26