/[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 32 by dpavlin, Mon Oct 8 16:20:58 2007 UTC revision 34 by dpavlin, Mon Oct 8 16:21:17 2007 UTC
# Line 1  Line 1 
1  /*  /*
2   *  Copyright (C) 2003-2006  Anders Gavare.  All rights reserved.   *  Copyright (C) 2003-2007  Anders Gavare.  All rights reserved.
3   *   *
4   *  Redistribution and use in source and binary forms, with or without   *  Redistribution and use in source and binary forms, with or without
5   *  modification, are permitted provided that the following conditions are met:   *  modification, are permitted provided that the following conditions are met:
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_dc7085.c,v 1.58 2006/09/06 04:55:35 debug Exp $   *  $Id: dev_dc7085.c,v 1.60 2006/12/31 21:35:26 debug Exp $
29   *     *  
30   *  DC7085 serial controller, used in some DECstation models.   *  DC7085 serial controller, used in some DECstation models.
31   */   */
# Line 63  struct dc_data { Line 63  struct dc_data {
63    
64          int                     tx_scanner;          int                     tx_scanner;
65    
66          int                     irqnr;          struct interrupt        irq;
67          int                     use_fb;          int                     use_fb;
68    
69          struct lk201_data       lk201;          struct lk201_data       lk201;
# Line 131  DEVICE_TICK(dc7085) Line 131  DEVICE_TICK(dc7085)
131                          if (d->regs.dc_tcr & (1 << d->tx_scanner)) {                          if (d->regs.dc_tcr & (1 << d->tx_scanner)) {
132                                  d->regs.dc_csr |= CSR_TRDY;                                  d->regs.dc_csr |= CSR_TRDY;
133                                  if (d->regs.dc_csr & CSR_TIE)                                  if (d->regs.dc_csr & CSR_TIE)
134                                          cpu_interrupt(cpu, d->irqnr);                                          INTERRUPT_ASSERT(d->irq);
135    
136                                  d->regs.dc_csr &= ~CSR_TX_LINE_NUM;                                  d->regs.dc_csr &= ~CSR_TX_LINE_NUM;
137                                  d->regs.dc_csr |= (d->tx_scanner << 8);                                  d->regs.dc_csr |= (d->tx_scanner << 8);
# Line 155  DEVICE_TICK(dc7085) Line 155  DEVICE_TICK(dc7085)
155                  d->regs.dc_csr |= CSR_RDONE;                  d->regs.dc_csr |= CSR_RDONE;
156    
157          if ((d->regs.dc_csr & CSR_RDONE) && (d->regs.dc_csr & CSR_RIE))          if ((d->regs.dc_csr & CSR_RDONE) && (d->regs.dc_csr & CSR_RIE))
158                  cpu_interrupt(cpu, d->irqnr);                  INTERRUPT_ASSERT(d->irq);
159  }  }
160    
161    
# Line 221  DEVICE_ACCESS(dc7085) Line 221  DEVICE_ACCESS(dc7085)
221                              (lineno << RBUF_LINE_NUM_SHIFT) | ch;                              (lineno << RBUF_LINE_NUM_SHIFT) | ch;
222    
223                          d->regs.dc_csr &= ~CSR_RDONE;                          d->regs.dc_csr &= ~CSR_RDONE;
224                          cpu_interrupt_ack(cpu, d->irqnr);                          INTERRUPT_DEASSERT(d->irq);
225    
226                          d->just_transmitted_something = 4;                          d->just_transmitted_something = 4;
227                  }                  }
# Line 232  DEVICE_ACCESS(dc7085) Line 232  DEVICE_ACCESS(dc7085)
232                              (int)idata);  */                              (int)idata);  */
233                          d->regs.dc_tcr = idata;                          d->regs.dc_tcr = idata;
234                          d->regs.dc_csr &= ~CSR_TRDY;                          d->regs.dc_csr &= ~CSR_TRDY;
235                          cpu_interrupt_ack(cpu, d->irqnr);                          INTERRUPT_DEASSERT(d->irq);
236                          goto do_return;                          goto do_return;
237                  } else {                  } else {
238                          /*  read:  */                          /*  read:  */
# Line 250  DEVICE_ACCESS(dc7085) Line 250  DEVICE_ACCESS(dc7085)
250                          lk201_tx_data(&d->lk201, line_no, idata);                          lk201_tx_data(&d->lk201, line_no, idata);
251    
252                          d->regs.dc_csr &= ~CSR_TRDY;                          d->regs.dc_csr &= ~CSR_TRDY;
253                          cpu_interrupt_ack(cpu, d->irqnr);                          INTERRUPT_DEASSERT(d->irq);
254    
255                          d->just_transmitted_something = 4;                          d->just_transmitted_something = 4;
256                  } else {                  } else {
# Line 293  do_return: Line 293  do_return:
293   *  DECstation keyboard, instead of a plain serial console.   *  DECstation keyboard, instead of a plain serial console.
294   */   */
295  int dev_dc7085_init(struct machine *machine, struct memory *mem,  int dev_dc7085_init(struct machine *machine, struct memory *mem,
296          uint64_t baseaddr, int irq_nr, int use_fb)          uint64_t baseaddr, char *irq_path, int use_fb)
297  {  {
298          struct dc_data *d;          struct dc_data *d;
299    
# Line 303  int dev_dc7085_init(struct machine *mach Line 303  int dev_dc7085_init(struct machine *mach
303                  exit(1);                  exit(1);
304          }          }
305          memset(d, 0, sizeof(struct dc_data));          memset(d, 0, sizeof(struct dc_data));
306          d->irqnr  = irq_nr;  
307            INTERRUPT_CONNECT(irq_path, d->irq);
308          d->use_fb = use_fb;          d->use_fb = use_fb;
309    
310          d->regs.dc_csr = CSR_TRDY | CSR_MSE;          d->regs.dc_csr = CSR_TRDY | CSR_MSE;

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

  ViewVC Help
Powered by ViewVC 1.1.26