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

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

revision 22 by dpavlin, Mon Oct 8 16:19:37 2007 UTC revision 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_dc7085.c,v 1.54 2006/01/01 13:17:16 debug Exp $   *  $Id: dev_dc7085.c,v 1.58 2006/09/06 04:55:35 debug Exp $
29   *     *  
30   *  DC7085 serial controller, used in some DECstation models.   *  DC7085 serial controller, used in some DECstation models.
31   */   */
# Line 46  Line 46 
46    
47  #define DC_TICK_SHIFT           14  #define DC_TICK_SHIFT           14
48    
49  #define MAX_QUEUE_LEN           4096  #define MAX_QUEUE_LEN           32768
50    
51  struct dc_data {  struct dc_data {
52          struct dc7085regs       regs;          struct dc7085regs       regs;
# Line 78  void add_to_rx_queue(void *e, int ch, in Line 78  void add_to_rx_queue(void *e, int ch, in
78          struct dc_data *d = (struct dc_data *) e;          struct dc_data *d = (struct dc_data *) e;
79          int entries_in_use = d->cur_rx_queue_pos_write -          int entries_in_use = d->cur_rx_queue_pos_write -
80              d->cur_rx_queue_pos_read;              d->cur_rx_queue_pos_read;
81    
82          while (entries_in_use < 0)          while (entries_in_use < 0)
83                  entries_in_use += MAX_QUEUE_LEN;                  entries_in_use += MAX_QUEUE_LEN;
84    
# Line 96  void add_to_rx_queue(void *e, int ch, in Line 97  void add_to_rx_queue(void *e, int ch, in
97  }  }
98    
99    
100  /*  DEVICE_TICK(dc7085)
  *  dev_dc7085_tick():  
  *  
  *  This function is called "every now and then".  
  *  If a key is available from the keyboard, add it to the rx queue.  
  *  If other bits are set, an interrupt might need to be caused.  
  */  
 void dev_dc7085_tick(struct cpu *cpu, void *extra)  
101  {  {
102            /*
103             *  If a key is available from the keyboard, add it to the rx queue.
104             *  If other bits are set, an interrupt might need to be caused.
105             */
106          struct dc_data *d = extra;          struct dc_data *d = extra;
107          int avail;          int avail;
108    
# Line 149  void dev_dc7085_tick(struct cpu *cpu, vo Line 147  void dev_dc7085_tick(struct cpu *cpu, vo
147                          return;                          return;
148          }          }
149    
150          lk201_tick(&d->lk201);          lk201_tick(cpu->machine, &d->lk201);
151    
152          avail = d->cur_rx_queue_pos_write != d->cur_rx_queue_pos_read;          avail = d->cur_rx_queue_pos_write != d->cur_rx_queue_pos_read;
153    
# Line 161  void dev_dc7085_tick(struct cpu *cpu, vo Line 159  void dev_dc7085_tick(struct cpu *cpu, vo
159  }  }
160    
161    
 /*  
  *  dev_dc7085_access():  
  */  
162  DEVICE_ACCESS(dc7085)  DEVICE_ACCESS(dc7085)
163  {  {
164          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
# Line 320  int dev_dc7085_init(struct machine *mach Line 315  int dev_dc7085_init(struct machine *mach
315    
316          memory_device_register(mem, "dc7085", baseaddr, DEV_DC7085_LENGTH,          memory_device_register(mem, "dc7085", baseaddr, DEV_DC7085_LENGTH,
317              dev_dc7085_access, d, DM_DEFAULT, NULL);              dev_dc7085_access, d, DM_DEFAULT, NULL);
318          machine_add_tickfunction(machine, dev_dc7085_tick, d, DC_TICK_SHIFT);          machine_add_tickfunction(machine, dev_dc7085_tick, d,
319                DC_TICK_SHIFT, 0.0);
320    
321          return d->console_handle;          return d->console_handle;
322  }  }

Legend:
Removed from v.22  
changed lines
  Added in v.32

  ViewVC Help
Powered by ViewVC 1.1.26