/[gxemul]/trunk/src/devices/dev_pckbc.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_pckbc.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_pckbc.c,v 1.70 2006/08/22 15:13:03 debug Exp $   *  $Id: dev_pckbc.c,v 1.72 2006/12/30 13:30:58 debug Exp $
29   *     *  
30   *  Standard 8042 PC keyboard controller (and a 8242WB PS2 keyboard/mouse   *  Standard 8042 PC keyboard controller (and a 8242WB PS2 keyboard/mouse
31   *  controller), including the 8048 keyboard chip.   *  controller), including the 8048 keyboard chip.
# Line 75  struct pckbc_data { Line 75  struct pckbc_data {
75          int             in_use;          int             in_use;
76    
77          int             reg[DEV_PCKBC_LENGTH];          int             reg[DEV_PCKBC_LENGTH];
78          int             keyboard_irqnr;  
79          int             mouse_irqnr;          struct interrupt irq_keyboard;
80            struct interrupt irq_mouse;
81          int             currently_asserted[2];          int             currently_asserted[2];
82          int             type;          int             type;
83          int             pc_style_flag;          int             pc_style_flag;
# Line 460  void dev_pckbc_tick(struct cpu *cpu, voi Line 461  void dev_pckbc_tick(struct cpu *cpu, voi
461          for (port_nr=0; port_nr<2; port_nr++) {          for (port_nr=0; port_nr<2; port_nr++) {
462                  /*  Cause receive interrupt, if there's something in the                  /*  Cause receive interrupt, if there's something in the
463                      receive buffer: (Otherwise deassert the interrupt.)  */                      receive buffer: (Otherwise deassert the interrupt.)  */
                 int irq = port_nr==0? d->keyboard_irqnr : d->mouse_irqnr;  
464    
465                  if (d->head[port_nr] != d->tail[port_nr] && ints_enabled) {                  if (d->head[port_nr] != d->tail[port_nr] && ints_enabled) {
466                          debug("[ pckbc: interrupt port %i ]\n", port_nr);                          debug("[ pckbc: interrupt port %i ]\n", port_nr);
467                          cpu_interrupt(cpu, irq);                          if (port_nr == 0)
468                                    INTERRUPT_ASSERT(d->irq_keyboard);
469                            else
470                                    INTERRUPT_ASSERT(d->irq_mouse);
471                          d->currently_asserted[port_nr] = 1;                          d->currently_asserted[port_nr] = 1;
472                  } else {                  } else {
473                          if (d->currently_asserted[port_nr])                          if (d->currently_asserted[port_nr]) {
474                                  cpu_interrupt_ack(cpu, irq);                                  if (port_nr == 0)
475                                            INTERRUPT_DEASSERT(d->irq_keyboard);
476                                    else
477                                            INTERRUPT_DEASSERT(d->irq_mouse);
478                            }
479                          d->currently_asserted[port_nr] = 0;                          d->currently_asserted[port_nr] = 0;
480                  }                  }
481          }          }
# Line 899  if (x&1) Line 906  if (x&1)
906   *  Type should be PCKBC_8042 or PCKBC_8242.   *  Type should be PCKBC_8042 or PCKBC_8242.
907   */   */
908  int dev_pckbc_init(struct machine *machine, struct memory *mem,  int dev_pckbc_init(struct machine *machine, struct memory *mem,
909          uint64_t baseaddr, int type, int keyboard_irqnr, int mouse_irqnr,          uint64_t baseaddr, int type, char *keyboard_irqpath,
910          int in_use, int pc_style_flag)          char *mouse_irqpath, int in_use, int pc_style_flag)
911  {  {
912          struct pckbc_data *d;          struct pckbc_data *d;
913          int len = DEV_PCKBC_LENGTH;          int len = DEV_PCKBC_LENGTH;
# Line 920  int dev_pckbc_init(struct machine *machi Line 927  int dev_pckbc_init(struct machine *machi
927                  len = DEV_PCKBC_LENGTH + 0x60;                  len = DEV_PCKBC_LENGTH + 0x60;
928          }          }
929    
930            INTERRUPT_CONNECT(keyboard_irqpath, d->irq_keyboard);
931            INTERRUPT_CONNECT(mouse_irqpath, d->irq_mouse);
932    
933          d->type              = type;          d->type              = type;
         d->keyboard_irqnr    = keyboard_irqnr;  
         d->mouse_irqnr       = mouse_irqnr;  
934          d->in_use            = in_use;          d->in_use            = in_use;
935          d->pc_style_flag     = pc_style_flag;          d->pc_style_flag     = pc_style_flag;
936          d->translation_table = 2;          d->translation_table = 2;

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

  ViewVC Help
Powered by ViewVC 1.1.26