/[gxemul]/trunk/src/devices/dev_footbridge.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_footbridge.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_footbridge.c,v 1.55 2007/02/03 16:18:56 debug Exp $   *  $Id: dev_footbridge.c,v 1.57 2007/06/15 19:11:15 debug Exp $
29   *   *
30   *  Footbridge. Used in Netwinder and Cats.   *  COMMENT: DC21285 "Footbridge" controller; used in Netwinder and Cats
31   *   *
32   *  TODO:   *  TODO:
33   *      o)  Add actual support for the fcom serial port.   *      o)  Add actual support for the fcom serial port.
# Line 125  static void reload_timer_value(struct cp Line 125  static void reload_timer_value(struct cp
125    
126    
127  /*  /*
  *  dev_footbridge_tick():  
  *  
128   *  The 4 footbridge timers should decrease and cause interrupts. Periodic   *  The 4 footbridge timers should decrease and cause interrupts. Periodic
129   *  interrupts restart as soon as they are acknowledged, non-periodic   *  interrupts restart as soon as they are acknowledged, non-periodic
130   *  interrupts need to be "reloaded" to restart.   *  interrupts need to be "reloaded" to restart.
# Line 134  static void reload_timer_value(struct cp Line 132  static void reload_timer_value(struct cp
132   *  TODO: Hm. I thought I had solved this, but it didn't quite work.   *  TODO: Hm. I thought I had solved this, but it didn't quite work.
133   *        This needs to be re-checked against documentation, sometime.   *        This needs to be re-checked against documentation, sometime.
134   */   */
135  void dev_footbridge_tick(struct cpu *cpu, void *extra)  DEVICE_TICK(footbridge)
136  {  {
137            struct footbridge_data *d = extra;
138          int i;          int i;
         struct footbridge_data *d = (struct footbridge_data *) extra;  
139    
140          for (i=0; i<N_FOOTBRIDGE_TIMERS; i++) {          for (i=0; i<N_FOOTBRIDGE_TIMERS; i++) {
141                  if (d->timer_control[i] & TIMER_ENABLE) {                  if (d->timer_control[i] & TIMER_ENABLE) {
# Line 181  void footbridge_interrupt_deassert(struc Line 179  void footbridge_interrupt_deassert(struc
179    
180    
181  /*  /*
  *  dev_footbridge_isa_access():  
  *  
182   *  Reading the byte at 0x79000000 is a quicker way to figure out which ISA   *  Reading the byte at 0x79000000 is a quicker way to figure out which ISA
183   *  interrupt has occurred (and acknowledging it at the same time), than   *  interrupt has occurred (and acknowledging it at the same time), than
184   *  dealing with the legacy 0x20/0xa0 ISA ports.   *  dealing with the legacy 0x20/0xa0 ISA ports.
# Line 234  exit(1); Line 230  exit(1);
230    
231    
232  /*  /*
  *  dev_footbridge_pci_access():  
  *  
233   *  The Footbridge PCI configuration space is implemented as a direct memory   *  The Footbridge PCI configuration space is implemented as a direct memory
234   *  space (i.e. not one port for addr and one port for data). This function   *  space (i.e. not one port for addr and one port for data). This function
235   *  translates that into bus_pci calls.   *  translates that into bus_pci calls.
# Line 273  DEVICE_ACCESS(footbridge_pci) Line 267  DEVICE_ACCESS(footbridge_pci)
267  }  }
268    
269    
 /*  
  *  dev_footbridge_access():  
  *  
  *  The DC21285 registers.  
  */  
270  DEVICE_ACCESS(footbridge)  DEVICE_ACCESS(footbridge)
271  {  {
272          struct footbridge_data *d = extra;          struct footbridge_data *d = extra;
# Line 491  DEVINIT(footbridge) Line 480  DEVINIT(footbridge)
480          uint64_t pci_addr = 0x7b000000;          uint64_t pci_addr = 0x7b000000;
481          int i;          int i;
482    
483          d = malloc(sizeof(struct footbridge_data));          CHECK_ALLOCATION(d = malloc(sizeof(struct footbridge_data)));
         if (d == NULL) {  
                 fprintf(stderr, "out of memory\n");  
                 exit(1);  
         }  
484          memset(d, 0, sizeof(struct footbridge_data));          memset(d, 0, sizeof(struct footbridge_data));
485    
486          /*  Connect to the CPU which this footbridge will interrupt:  */          /*  Connect to the CPU which this footbridge will interrupt:  */
# Line 594  DEVINIT(footbridge) Line 579  DEVINIT(footbridge)
579                  d->timer_control[i] = TIMER_MODE_PERIODIC;                  d->timer_control[i] = TIMER_MODE_PERIODIC;
580                  d->timer_load[i] = TIMER_MAX_VAL;                  d->timer_load[i] = TIMER_MAX_VAL;
581          }          }
582    
583          machine_add_tickfunction(devinit->machine,          machine_add_tickfunction(devinit->machine,
584              dev_footbridge_tick, d, DEV_FOOTBRIDGE_TICK_SHIFT, 0.0);              dev_footbridge_tick, d, DEV_FOOTBRIDGE_TICK_SHIFT);
585    
586          devinit->return_ptr = d->pcibus;          devinit->return_ptr = d->pcibus;
587          return 1;          return 1;

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

  ViewVC Help
Powered by ViewVC 1.1.26