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

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

revision 41 by dpavlin, Mon Oct 8 16:22:11 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_gt.c,v 1.50 2007/04/29 13:44:14 debug Exp $   *  $Id: dev_gt.c,v 1.52 2007/06/15 19:11:15 debug Exp $
29   *     *  
30   *  Galileo Technology GT-64xxx PCI controller.   *  COMMENT: Galileo Technology GT-64xxx PCI controller
31   *   *
32   *      GT-64011        Used in Cobalt machines.   *      GT-64011        Used in Cobalt machines.
33   *      GT-64120        Used in evbmips machines (Malta).   *      GT-64120        Used in evbmips machines (Malta).
# Line 81  struct gt_data { Line 81  struct gt_data {
81   */   */
82  static void timer_tick(struct timer *timer, void *extra)  static void timer_tick(struct timer *timer, void *extra)
83  {  {
84          struct gt_data *d = (struct gt_data *) extra;          struct gt_data *d = extra;
85          d->pending_timer0_interrupts ++;          d->pending_timer0_interrupts ++;
86  }  }
87    
88    
89  DEVICE_TICK(gt)  DEVICE_TICK(gt)
90  {  {
91          struct gt_data *d = (struct gt_data *) extra;          struct gt_data *d = extra;
   
92          if (d->pending_timer0_interrupts > 0)          if (d->pending_timer0_interrupts > 0)
93                  INTERRUPT_ASSERT(d->timer0_irq);                  INTERRUPT_ASSERT(d->timer0_irq);
94  }  }
# Line 97  DEVICE_TICK(gt) Line 96  DEVICE_TICK(gt)
96    
97  DEVICE_ACCESS(gt)  DEVICE_ACCESS(gt)
98  {  {
99            struct gt_data *d = extra;
100          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
101          int bus, dev, func, reg;          int bus, dev, func, reg;
102          size_t i;          size_t i;
         struct gt_data *d = extra;  
103    
104          if (writeflag == MEM_WRITE)          if (writeflag == MEM_WRITE)
105                  idata = memory_readmax64(cpu, data, len);                  idata = memory_readmax64(cpu, data, len);
# Line 229  struct pci_data *dev_gt_init(struct mach Line 228  struct pci_data *dev_gt_init(struct mach
228          uint64_t pci_io_offset = 0, pci_mem_offset = 0;          uint64_t pci_io_offset = 0, pci_mem_offset = 0;
229          char *gt_name = "NO";          char *gt_name = "NO";
230    
231          d = malloc(sizeof(struct gt_data));          CHECK_ALLOCATION(d = malloc(sizeof(struct gt_data)));
         if (d == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
232          memset(d, 0, sizeof(struct gt_data));          memset(d, 0, sizeof(struct gt_data));
233    
234          INTERRUPT_CONNECT(timer_irq_path, d->timer0_irq);          INTERRUPT_CONNECT(timer_irq_path, d->timer0_irq);
# Line 304  struct pci_data *dev_gt_init(struct mach Line 299  struct pci_data *dev_gt_init(struct mach
299    
300          memory_device_register(mem, "gt", baseaddr, DEV_GT_LENGTH,          memory_device_register(mem, "gt", baseaddr, DEV_GT_LENGTH,
301              dev_gt_access, d, DM_DEFAULT, NULL);              dev_gt_access, d, DM_DEFAULT, NULL);
302          machine_add_tickfunction(machine, dev_gt_tick, d, TICK_SHIFT, 0.0);          machine_add_tickfunction(machine, dev_gt_tick, d, TICK_SHIFT);
303    
304          return d->pci_data;          return d->pci_data;
305  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26