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

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

revision 4 by dpavlin, Mon Oct 8 16:18:00 2007 UTC revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2004-2005  Anders Gavare.  All rights reserved.   *  Copyright (C) 2004-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_sfb.c,v 1.6 2005/02/18 07:22:30 debug Exp $   *  $Id: dev_sfb.c,v 1.11 2007/06/15 19:57:34 debug Exp $
29   *     *  
30   *  SFB TURBOchannel framebuffer.   *  COMMENT: SFB TURBOchannel framebuffer (graphics card)
31   *   *
32   *  See include/sfbreg.h (and NetBSD's arch/pmax/dev/sfb.c) for more info.   *  See include/sfbreg.h (and NetBSD's arch/pmax/dev/sfb.c) for more info.
33   *   *
# Line 64  struct sfb_data { Line 64  struct sfb_data {
64  };  };
65    
66    
67  /*  DEVICE_ACCESS(sfb)
  *  dev_sfb_access():  
  */  
 int dev_sfb_access(struct cpu *cpu, struct memory *mem, uint64_t relative_addr,  
         unsigned char *data, size_t len, int writeflag, void *extra)  
68  {  {
69          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
70          struct sfb_data *d = extra;          struct sfb_data *d = extra;
71    
72          idata = memory_readmax64(cpu, data, len);          if (writeflag == MEM_WRITE)
73                    idata = memory_readmax64(cpu, data, len);
74    
75          if (writeflag==MEM_READ) {          if (writeflag==MEM_READ) {
76                  odata = d->reg[(relative_addr >> 2) & (N_SFB_REGS - 1)];                  odata = d->reg[(relative_addr >> 2) & (N_SFB_REGS - 1)];
# Line 100  void dev_sfb_init(struct machine *machin Line 97  void dev_sfb_init(struct machine *machin
97  {  {
98          struct sfb_data *d;          struct sfb_data *d;
99    
100          d = malloc(sizeof(struct sfb_data));          CHECK_ALLOCATION(d = malloc(sizeof(struct sfb_data)));
         if (d == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
101          memset(d, 0, sizeof(struct sfb_data));          memset(d, 0, sizeof(struct sfb_data));
102    
103          d->vfb_data = fb;          d->vfb_data = fb;
# Line 113  void dev_sfb_init(struct machine *machin Line 106  void dev_sfb_init(struct machine *machin
106          d->reg[(SFB_VVERTICAL - SFB_ASIC_OFFSET) / 4]   = SFB_YSIZE;          d->reg[(SFB_VVERTICAL - SFB_ASIC_OFFSET) / 4]   = SFB_YSIZE;
107    
108          memory_device_register(mem, "sfb", baseaddr, SFB_REG_SIZE,          memory_device_register(mem, "sfb", baseaddr, SFB_REG_SIZE,
109              dev_sfb_access, d, MEM_DEFAULT, NULL);              dev_sfb_access, d, DM_DEFAULT, NULL);
110  }  }
111    

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

  ViewVC Help
Powered by ViewVC 1.1.26