/[gxemul]/trunk/src/devices/dev_8253.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_8253.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_8253.c,v 1.18 2006/12/30 13:30:57 debug Exp $   *  $Id: dev_8253.c,v 1.20 2007/06/15 18:13:04 debug Exp $
29   *   *
30   *  Intel 8253/8254 Programmable Interval Timer   *  COMMENT: Intel 8253/8254 Programmable Interval Timer
31   *   *
32   *  TODO/NOTE:   *  TODO/NOTE:
33   *      The timers don't really count down. Timer 0 causes clock interrupts   *      The timers don't really count down. Timer 0 causes clock interrupts
# Line 53  Line 53 
53  #include "i8253reg.h"  #include "i8253reg.h"
54    
55    
56  #define debug fatal  /*  #define debug fatal  */
57    
58  #define DEV_8253_LENGTH         4  #define DEV_8253_LENGTH         4
59  #define TICK_SHIFT              14  #define TICK_SHIFT              14
# Line 78  struct pit8253_data { Line 78  struct pit8253_data {
78    
79  static void timer0_tick(struct timer *t, void *extra)  static void timer0_tick(struct timer *t, void *extra)
80  {  {
81          struct pit8253_data *d = (struct pit8253_data *) extra;          struct pit8253_data *d = extra;
82          d->pending_interrupts_timer0 ++;          d->pending_interrupts_timer0 ++;
83    
84  #if 0          /*  printf("%i ", d->pending_interrupts_timer0); fflush(stdout);  */
         printf("%i ", d->pending_interrupts_timer0); fflush(stdout);  
 #endif  
85  }  }
86    
87    
88  DEVICE_TICK(8253)  DEVICE_TICK(8253)
89  {  {
90          struct pit8253_data *d = (struct pit8253_data *) extra;          struct pit8253_data *d = extra;
91    
92          if (!d->in_use)          if (!d->in_use)
93                  return;                  return;
# Line 241  DEVICE_ACCESS(8253) Line 239  DEVICE_ACCESS(8253)
239    
240  DEVINIT(8253)  DEVINIT(8253)
241  {  {
242          struct pit8253_data *d = malloc(sizeof(struct pit8253_data));          struct pit8253_data *d;
243    
244          if (d == NULL) {          CHECK_ALLOCATION(d = malloc(sizeof(struct pit8253_data)));
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
245          memset(d, 0, sizeof(struct pit8253_data));          memset(d, 0, sizeof(struct pit8253_data));
246    
247          d->in_use = devinit->in_use;          d->in_use = devinit->in_use;
# Line 266  DEVINIT(8253) Line 261  DEVINIT(8253)
261              DM_DEFAULT, NULL);              DM_DEFAULT, NULL);
262    
263          machine_add_tickfunction(devinit->machine, dev_8253_tick,          machine_add_tickfunction(devinit->machine, dev_8253_tick,
264              d, TICK_SHIFT, 0.0);              d, TICK_SHIFT);
265    
266          return 1;          return 1;
267  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.26