/[gxemul]/trunk/src/devices/dev_px.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_px.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_px.c,v 1.36 2006/12/30 13:30:59 debug Exp $   *  $Id: dev_px.c,v 1.38 2007/06/15 19:57:33 debug Exp $
29   *     *  
30   *  TURBOchannel Pixelstamp graphics device.   *  COMMENT: TURBOchannel Pixelstamp graphics card
31   *   *
32   *      PMAG-CA = PX   *      PMAG-CA = PX
33   *      PMAG-DA = PXG   *      PMAG-DA = PXG
# Line 98  Line 98 
98  /* #define PX_DEBUG  */  /* #define PX_DEBUG  */
99    
100    
101  /*  DEVICE_TICK(px)
  *  dev_px_tick():  
  */  
 void dev_px_tick(struct cpu *cpu, void *extra)  
102  {  {
103  #if 0  #if 0
104          struct px_data *d = extra;          struct px_data *d = extra;
# Line 558  void dev_px_dma(struct cpu *cpu, uint32_ Line 555  void dev_px_dma(struct cpu *cpu, uint32_
555  }  }
556    
557    
 /*  
  *  dev_px_access():  
  */  
558  DEVICE_ACCESS(px)  DEVICE_ACCESS(px)
559  {  {
560          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
# Line 635  DEVICE_ACCESS(px) Line 629  DEVICE_ACCESS(px)
629          /*  TODO:  Most of these aren't implemented yet.  */          /*  TODO:  Most of these aren't implemented yet.  */
630    
631          switch (relative_addr) {          switch (relative_addr) {
632    
633          case 0x180008:          /*  hsync  */          case 0x180008:          /*  hsync  */
634                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
635                          debug("[ px: read from hsync: 0x%08llx ]\n",                          debug("[ px: read from hsync: 0x%08llx ]\n",
# Line 644  DEVICE_ACCESS(px) Line 639  DEVICE_ACCESS(px)
639                              (long long)idata);                              (long long)idata);
640                  }                  }
641                  break;                  break;
642    
643          case 0x18000c:          /*  hsync2  */          case 0x18000c:          /*  hsync2  */
644                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
645                          debug("[ px: read from hsync2: 0x%08llx ]\n",                          debug("[ px: read from hsync2: 0x%08llx ]\n",
# Line 653  DEVICE_ACCESS(px) Line 649  DEVICE_ACCESS(px)
649                              (long long)idata);                              (long long)idata);
650                  }                  }
651                  break;                  break;
652    
653          case 0x180010:          /*  hblank  */          case 0x180010:          /*  hblank  */
654                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
655                          debug("[ px: read from hblank: 0x%08llx ]\n",                          debug("[ px: read from hblank: 0x%08llx ]\n",
# Line 662  DEVICE_ACCESS(px) Line 659  DEVICE_ACCESS(px)
659                              (long long)idata);                              (long long)idata);
660                  }                  }
661                  break;                  break;
662    
663          case 0x180014:          /*  vsync  */          case 0x180014:          /*  vsync  */
664                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
665                          debug("[ px: read from vsync: 0x%08llx ]\n",                          debug("[ px: read from vsync: 0x%08llx ]\n",
# Line 671  DEVICE_ACCESS(px) Line 669  DEVICE_ACCESS(px)
669                              (long long)idata);                              (long long)idata);
670                  }                  }
671                  break;                  break;
672    
673          case 0x180018:          /*  vblank  */          case 0x180018:          /*  vblank  */
674                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
675                          debug("[ px: read from vblank: 0x%08llx ]\n",                          debug("[ px: read from vblank: 0x%08llx ]\n",
# Line 680  DEVICE_ACCESS(px) Line 679  DEVICE_ACCESS(px)
679                              (long long)idata);                              (long long)idata);
680                  }                  }
681                  break;                  break;
682    
683          case 0x180020:          /*  ipdvint  */          case 0x180020:          /*  ipdvint  */
684                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
685                          odata = d->intr;                          odata = d->intr;
# Line 701  odata = random(); Line 701  odata = random();
701                              (long long)idata);                              (long long)idata);
702                  }                  }
703                  break;                  break;
704    
705          case 0x180028:          /*  sticsr  */          case 0x180028:          /*  sticsr  */
706                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
707                          debug("[ px: read from sticsr: 0x%08llx ]\n",                          debug("[ px: read from sticsr: 0x%08llx ]\n",
# Line 710  odata = random(); Line 711  odata = random();
711                              (long long)idata);                              (long long)idata);
712                  }                  }
713                  break;                  break;
714    
715          case 0x180038:          /*  buscsr  */          case 0x180038:          /*  buscsr  */
716                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
717                          debug("[ px: read from buscsr: 0x%08llx ]\n",                          debug("[ px: read from buscsr: 0x%08llx ]\n",
# Line 719  odata = random(); Line 721  odata = random();
721                              (long long)idata);                              (long long)idata);
722                  }                  }
723                  break;                  break;
724    
725          case 0x18003c:          /*  modcl  */          case 0x18003c:          /*  modcl  */
726                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
727                          odata = (d->type << 12) + (d->xconfig << 11) +                          odata = (d->type << 12) + (d->xconfig << 11) +
# Line 730  odata = random(); Line 733  odata = random();
733                              (long long)idata);                              (long long)idata);
734                  }                  }
735                  break;                  break;
736    
737          default:          default:
738                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
739                          debug("[ px: read from addr 0x%x: 0x%llx ]\n",                          debug("[ px: read from addr 0x%x: 0x%llx ]\n",
# Line 747  odata = random(); Line 751  odata = random();
751  }  }
752    
753    
 /*  
  *  dev_px_init():  
  */  
754  void dev_px_init(struct machine *machine, struct memory *mem,  void dev_px_init(struct machine *machine, struct memory *mem,
755          uint64_t baseaddr, int px_type, char *irq_path)          uint64_t baseaddr, int px_type, char *irq_path)
756  {  {
757          struct px_data *d;          struct px_data *d;
758    
759          d = malloc(sizeof(struct px_data));          CHECK_ALLOCATION(d = malloc(sizeof(struct px_data)));
         if (d == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
760          memset(d, 0, sizeof(struct px_data));          memset(d, 0, sizeof(struct px_data));
761    
762          d->type = px_type;          d->type = px_type;
# Line 822  void dev_px_init(struct machine *machine Line 819  void dev_px_init(struct machine *machine
819    
820          memory_device_register(mem, "px", baseaddr, DEV_PX_LENGTH,          memory_device_register(mem, "px", baseaddr, DEV_PX_LENGTH,
821              dev_px_access, d, DM_DEFAULT, NULL);              dev_px_access, d, DM_DEFAULT, NULL);
822          machine_add_tickfunction(machine, dev_px_tick, d, 14, 0.0);          machine_add_tickfunction(machine, dev_px_tick, d, 14);
823  }  }
824    

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

  ViewVC Help
Powered by ViewVC 1.1.26