/[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 12 by dpavlin, Mon Oct 8 16:18:38 2007 UTC revision 14 by dpavlin, Mon Oct 8 16:18:51 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_pckbc.c,v 1.48 2005/08/16 06:49:27 debug Exp $   *  $Id: dev_pckbc.c,v 1.51 2005/09/27 23:55:44 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 65  Line 65 
65    
66  #define PS2     100  #define PS2     100
67    
68  #define PCKBC_TICKSHIFT         14  #define PCKBC_TICKSHIFT         15
69    
70  struct pckbc_data {  struct pckbc_data {
71          int             console_handle;          int             console_handle;
# Line 74  struct pckbc_data { Line 74  struct pckbc_data {
74          int             reg[DEV_PCKBC_LENGTH];          int             reg[DEV_PCKBC_LENGTH];
75          int             keyboard_irqnr;          int             keyboard_irqnr;
76          int             mouse_irqnr;          int             mouse_irqnr;
77            int             currently_asserted[2];
78          int             type;          int             type;
79          int             pc_style_flag;          int             pc_style_flag;
80    
# Line 83  struct pckbc_data { Line 84  struct pckbc_data {
84          int             tx_int_enable;          int             tx_int_enable;
85    
86          int             keyscanning_enabled;          int             keyscanning_enabled;
87            int             translation_table;
88          int             state;          int             state;
89          int             cmdbyte;          int             cmdbyte;
90          int             output_byte;          int             output_byte;
# Line 96  struct pckbc_data { Line 98  struct pckbc_data {
98  #define STATE_LDCMDBYTE                 1  #define STATE_LDCMDBYTE                 1
99  #define STATE_RDCMDBYTE                 2  #define STATE_RDCMDBYTE                 2
100  #define STATE_WAITING_FOR_TRANSLTABLE   3  #define STATE_WAITING_FOR_TRANSLTABLE   3
101  #define STATE_LDOUTPUT                  4  #define STATE_WAITING_FOR_F3            4
102  #define STATE_RDOUTPUT                  5  #define STATE_WAITING_FOR_FC            5
103    #define STATE_LDOUTPUT                  6
104    #define STATE_RDOUTPUT                  7
105    
106    
107  /*  /*
# Line 132  int pckbc_get_code(struct pckbc_data *d, Line 136  int pckbc_get_code(struct pckbc_data *d,
136    
137    
138  /*  /*
139     *  ascii_to_scancodes_type3():
140     *
141     *  Conversion from ASCII codes to default (US) keyboard scancodes.
142     *  (See http://www.computer-engineering.org/ps2keyboard/scancodes3.html)
143     */
144    static void ascii_to_pc_scancodes_type3(int a, struct pckbc_data *d)
145    {
146            int old_head;
147            int p = 0;      /*  port  */
148            int shift = 0, ctrl = 0;
149    
150            if (a >= 'A' && a <= 'Z') { a += 32; shift = 1; }
151            if ((a >= 1 && a <= 26) && (a!='\n' && a!='\t' && a!='\b' && a!='\r'))
152                    { a += 96; ctrl = 1; }
153            if (a=='!')  {  a = '1'; shift = 1; }
154            if (a=='@')  {  a = '2'; shift = 1; }
155            if (a=='#')  {  a = '3'; shift = 1; }
156            if (a=='$')  {  a = '4'; shift = 1; }
157            if (a=='%')  {  a = '5'; shift = 1; }
158            if (a=='^')  {  a = '6'; shift = 1; }
159            if (a=='&')  {  a = '7'; shift = 1; }
160            if (a=='*')  {  a = '8'; shift = 1; }
161            if (a=='(')  {  a = '9'; shift = 1; }
162            if (a==')')  {  a = '0'; shift = 1; }
163            if (a=='_')  {  a = '-'; shift = 1; }
164            if (a=='+')  {  a = '='; shift = 1; }
165            if (a=='{')  {  a = '['; shift = 1; }
166            if (a=='}')  {  a = ']'; shift = 1; }
167            if (a==':')  {  a = ';'; shift = 1; }
168            if (a=='"')  {  a = '\''; shift = 1; }
169            if (a=='|')  {  a = '\\'; shift = 1; }
170            if (a=='<')  {  a = ','; shift = 1; }
171            if (a=='>')  {  a = '.'; shift = 1; }
172            if (a=='?')  {  a = '/'; shift = 1; }
173    
174            if (shift)
175                    pckbc_add_code(d, 0x12, p);
176            if (ctrl)
177                    pckbc_add_code(d, 0x11, p);
178    
179            /*
180             *  Note: The ugly hack used to add release codes for all of these
181             *  keys is as follows:  we remember how much of the kbd buf that
182             *  is in use here, before we add any scancode. After we've added
183             *  one or more scancodes (ie an optional shift + another key)
184             *  then we add 0xf0 + the last scancode _if_ the kbd buf was altered.
185             */
186    
187            old_head = d->head[p];
188    
189            if (a==27)      pckbc_add_code(d, 0x08, p);
190    
191            if (a=='1')     pckbc_add_code(d, 0x16, p);
192            if (a=='2')     pckbc_add_code(d, 0x1e, p);
193            if (a=='3')     pckbc_add_code(d, 0x26, p);
194            if (a=='4')     pckbc_add_code(d, 0x25, p);
195            if (a=='5')     pckbc_add_code(d, 0x2e, p);
196            if (a=='6')     pckbc_add_code(d, 0x36, p);
197            if (a=='7')     pckbc_add_code(d, 0x3d, p);
198            if (a=='8')     pckbc_add_code(d, 0x3e, p);
199            if (a=='9')     pckbc_add_code(d, 0x46, p);
200            if (a=='0')     pckbc_add_code(d, 0x45, p);
201            if (a=='-')     pckbc_add_code(d, 0x4e, p);
202            if (a=='=')     pckbc_add_code(d, 0x55, p);
203    
204            if (a=='\b')    pckbc_add_code(d, 0x29, p);
205    
206            if (a=='\t')    pckbc_add_code(d, 0x0d, p);
207            if (a=='q')     pckbc_add_code(d, 0x15, p);
208            if (a=='w')     pckbc_add_code(d, 0x1d, p);
209            if (a=='e')     pckbc_add_code(d, 0x24, p);
210            if (a=='r')     pckbc_add_code(d, 0x2d, p);
211            if (a=='t')     pckbc_add_code(d, 0x2c, p);
212            if (a=='y')     pckbc_add_code(d, 0x35, p);
213            if (a=='u')     pckbc_add_code(d, 0x3c, p);
214            if (a=='i')     pckbc_add_code(d, 0x43, p);
215            if (a=='o')     pckbc_add_code(d, 0x44, p);
216            if (a=='p')     pckbc_add_code(d, 0x4d, p);
217    
218            if (a=='[')     pckbc_add_code(d, 0x54, p);
219            if (a==']')     pckbc_add_code(d, 0x5b, p);
220    
221            if (a=='\n' || a=='\r') pckbc_add_code(d, 0x5a, p);
222    
223            if (a=='a')     pckbc_add_code(d, 0x1c, p);
224            if (a=='s')     pckbc_add_code(d, 0x1b, p);
225            if (a=='d')     pckbc_add_code(d, 0x23, p);
226            if (a=='f')     pckbc_add_code(d, 0x2b, p);
227            if (a=='g')     pckbc_add_code(d, 0x34, p);
228            if (a=='h')     pckbc_add_code(d, 0x33, p);
229            if (a=='j')     pckbc_add_code(d, 0x3b, p);
230            if (a=='k')     pckbc_add_code(d, 0x42, p);
231            if (a=='l')     pckbc_add_code(d, 0x4b, p);
232    
233            if (a==';')     pckbc_add_code(d, 0x4c, p);
234            if (a=='\'')    pckbc_add_code(d, 0x52, p);
235    /*      if (a=='~')     pckbc_add_code(d, 0x29, p);  ?  */
236            if (a=='\\')    pckbc_add_code(d, 0x5c, p);
237    
238            if (a=='z')     pckbc_add_code(d, 0x1a, p);
239            if (a=='x')     pckbc_add_code(d, 0x22, p);
240            if (a=='c')     pckbc_add_code(d, 0x21, p);
241            if (a=='v')     pckbc_add_code(d, 0x2a, p);
242            if (a=='b')     pckbc_add_code(d, 0x32, p);
243            if (a=='n')     pckbc_add_code(d, 0x31, p);
244            if (a=='m')     pckbc_add_code(d, 0x3a, p);
245    
246            if (a==',')     pckbc_add_code(d, 0x41, p);
247            if (a=='.')     pckbc_add_code(d, 0x49, p);
248            if (a=='/')     pckbc_add_code(d, 0x4a, p);
249    
250            if (a==' ')     pckbc_add_code(d, 0x29, p);
251    
252            /*  Add release code, if a key was pressed:  */
253            if (d->head[p] != old_head) {
254                    int code = d->key_queue[p][d->head[p]];
255                    pckbc_add_code(d, 0xf0, p);
256                    pckbc_add_code(d, code, p);
257            }
258    
259            /*  Release shift and ctrl:  */
260            if (shift) {
261                    pckbc_add_code(d, 0xf0, p);
262                    pckbc_add_code(d, 0x12, p);
263            }
264            if (ctrl) {
265                    pckbc_add_code(d, 0xf0, p);
266                    pckbc_add_code(d, 0x11, p);
267            }
268    }
269    
270    
271    /*
272   *  ascii_to_scancodes():   *  ascii_to_scancodes():
273   *   *
274   *  Conversion from ASCII codes to default (US) keyboard scancodes.   *  Conversion from ASCII codes to default (US) keyboard scancodes.
# Line 143  static void ascii_to_pc_scancodes(int a, Line 280  static void ascii_to_pc_scancodes(int a,
280          int p = 0;      /*  port  */          int p = 0;      /*  port  */
281          int shift = 0, ctrl = 0;          int shift = 0, ctrl = 0;
282    
283            if (d->translation_table == 3) {
284                    ascii_to_pc_scancodes_type3(a, d);
285                    return;
286            }
287    
288            if (d->translation_table != 1) {
289                    fatal("[ ascii_to_pc_scancodes: unimplemented type! ]\n");
290                    return;
291            }
292    
293          if (a >= 'A' && a <= 'Z') { a += 32; shift = 1; }          if (a >= 'A' && a <= 'Z') { a += 32; shift = 1; }
294          if ((a >= 1 && a <= 26) && (a!='\n' && a!='\t' && a!='\b' && a!='\r'))          if ((a >= 1 && a <= 26) && (a!='\n' && a!='\t' && a!='\b' && a!='\r'))
295                  { a += 96; ctrl = 1; }                  { a += 96; ctrl = 1; }
296    
297            if (a=='!')  {  a = '1'; shift = 1; }
298            if (a=='@')  {  a = '2'; shift = 1; }
299            if (a=='#')  {  a = '3'; shift = 1; }
300            if (a=='$')  {  a = '4'; shift = 1; }
301            if (a=='%')  {  a = '5'; shift = 1; }
302            if (a=='^')  {  a = '6'; shift = 1; }
303            if (a=='&')  {  a = '7'; shift = 1; }
304            if (a=='*')  {  a = '8'; shift = 1; }
305            if (a=='(')  {  a = '9'; shift = 1; }
306            if (a==')')  {  a = '0'; shift = 1; }
307            if (a=='_')  {  a = '-'; shift = 1; }
308            if (a=='+')  {  a = '='; shift = 1; }
309            if (a=='{')  {  a = '['; shift = 1; }
310            if (a=='}')  {  a = ']'; shift = 1; }
311            if (a==':')  {  a = ';'; shift = 1; }
312            if (a=='"')  {  a = '\''; shift = 1; }
313            if (a=='|')  {  a = '\\'; shift = 1; }
314            if (a=='<')  {  a = ','; shift = 1; }
315            if (a=='>')  {  a = '.'; shift = 1; }
316            if (a=='?')  {  a = '/'; shift = 1; }
317    
318          if (shift)          if (shift)
319                  pckbc_add_code(d, 0x2a, p);                  pckbc_add_code(d, 0x2a, p);
320          else          else
# Line 199  static void ascii_to_pc_scancodes(int a, Line 367  static void ascii_to_pc_scancodes(int a,
367                          pckbc_add_code(d, 0x09, p); }                          pckbc_add_code(d, 0x09, p); }
368          if (a=='(')  {  pckbc_add_code(d, 0x2a, p);          if (a=='(')  {  pckbc_add_code(d, 0x2a, p);
369                          pckbc_add_code(d, 0x0a, p); }                          pckbc_add_code(d, 0x0a, p); }
         if (a==')')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x0b, p); }  
         if (a=='_')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x0c, p); }  
         if (a=='+')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x0d, p); }  
370    
371          if (a=='\b')    pckbc_add_code(d, 0x0e, p);          if (a=='\b')    pckbc_add_code(d, 0x0e, p);
372    
# Line 221  static void ascii_to_pc_scancodes(int a, Line 383  static void ascii_to_pc_scancodes(int a,
383          if (a=='p')     pckbc_add_code(d, 0x19, p);          if (a=='p')     pckbc_add_code(d, 0x19, p);
384    
385          if (a=='[')     pckbc_add_code(d, 0x1a, p);          if (a=='[')     pckbc_add_code(d, 0x1a, p);
         if (a=='{')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x1a, p); }  
386          if (a==']')     pckbc_add_code(d, 0x1b, p);          if (a==']')     pckbc_add_code(d, 0x1b, p);
         if (a=='}')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x1b, p); }  
387    
388          if (a=='\n' || a=='\r') pckbc_add_code(d, 0x1c, p);          if (a=='\n' || a=='\r') pckbc_add_code(d, 0x1c, p);
389    
# Line 240  static void ascii_to_pc_scancodes(int a, Line 398  static void ascii_to_pc_scancodes(int a,
398          if (a=='l')     pckbc_add_code(d, 0x26, p);          if (a=='l')     pckbc_add_code(d, 0x26, p);
399    
400          if (a==';')     pckbc_add_code(d, 0x27, p);          if (a==';')     pckbc_add_code(d, 0x27, p);
         if (a==':')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x27, p); }  
401          if (a=='\'')    pckbc_add_code(d, 0x28, p);          if (a=='\'')    pckbc_add_code(d, 0x28, p);
         if (a=='"')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x28, p); }  
402          if (a=='~')     pckbc_add_code(d, 0x29, p);          if (a=='~')     pckbc_add_code(d, 0x29, p);
   
403          if (a=='\\')    pckbc_add_code(d, 0x2b, p);          if (a=='\\')    pckbc_add_code(d, 0x2b, p);
         if (a=='|')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x2b, p); }  
404    
405          if (a=='z')     pckbc_add_code(d, 0x2c, p);          if (a=='z')     pckbc_add_code(d, 0x2c, p);
406          if (a=='x')     pckbc_add_code(d, 0x2d, p);          if (a=='x')     pckbc_add_code(d, 0x2d, p);
# Line 260  static void ascii_to_pc_scancodes(int a, Line 411  static void ascii_to_pc_scancodes(int a,
411          if (a=='m')     pckbc_add_code(d, 0x32, p);          if (a=='m')     pckbc_add_code(d, 0x32, p);
412    
413          if (a==',')     pckbc_add_code(d, 0x33, p);          if (a==',')     pckbc_add_code(d, 0x33, p);
         if (a=='<')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x33, p); }  
414          if (a=='.')     pckbc_add_code(d, 0x34, p);          if (a=='.')     pckbc_add_code(d, 0x34, p);
         if (a=='>')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x34, p); }  
415          if (a=='/')     pckbc_add_code(d, 0x35, p);          if (a=='/')     pckbc_add_code(d, 0x35, p);
         if (a=='?')  {  pckbc_add_code(d, 0x2a, p);  
                         pckbc_add_code(d, 0x35, p); }  
416    
417          if (a==' ')     pckbc_add_code(d, 0x39, p);          if (a==' ')     pckbc_add_code(d, 0x39, p);
418    
# Line 311  void dev_pckbc_tick(struct cpu *cpu, voi Line 456  void dev_pckbc_tick(struct cpu *cpu, voi
456                          debug("[ pckbc: interrupt port %i ]\n", port_nr);                          debug("[ pckbc: interrupt port %i ]\n", port_nr);
457                          cpu_interrupt(cpu, port_nr==0? d->keyboard_irqnr                          cpu_interrupt(cpu, port_nr==0? d->keyboard_irqnr
458                              : d->mouse_irqnr);                              : d->mouse_irqnr);
459                            d->currently_asserted[port_nr] = 1;
460                  } else {                  } else {
461                          cpu_interrupt_ack(cpu, port_nr==0? d->keyboard_irqnr                          if (d->currently_asserted[port_nr])
462                              : d->mouse_irqnr);                                  cpu_interrupt_ack(cpu, port_nr==0?
463                                        d->keyboard_irqnr : d->mouse_irqnr);
464                            d->currently_asserted[port_nr] = 0;
465                  }                  }
466          }          }
467  }  }
# Line 332  static void dev_pckbc_command(struct pck Line 480  static void dev_pckbc_command(struct pck
480                  cmd = d->reg[PS2_TXBUF];                  cmd = d->reg[PS2_TXBUF];
481    
482          if (d->state == STATE_WAITING_FOR_TRANSLTABLE) {          if (d->state == STATE_WAITING_FOR_TRANSLTABLE) {
483                  debug("[ pckbc: switching to translation table 0x%02x ]\n",                  debug("[ pckbc: (port %i) switching to translation table "
484                      cmd);                      "0x%02x ]\n", port_nr, cmd);
485                    switch (cmd) {
486                    case 1:
487                    case 3: d->translation_table = cmd;
488                            break;
489                    default:fatal("[ pckbc: (port %i) translation table "
490                        "0x%02x is NOT YET IMPLEMENTED ]\n", port_nr, cmd);
491                    }
492                    pckbc_add_code(d, KBR_ACK, port_nr);
493                    d->state = STATE_NORMAL;
494                    return;
495            }
496    
497            if (d->state == STATE_WAITING_FOR_F3) {
498                    debug("[ pckbc: (port %i) received '0xf3' data: "
499                        "0x%02x ]\n", port_nr, cmd);
500                    pckbc_add_code(d, KBR_ACK, port_nr);
501                    d->state = STATE_NORMAL;
502                    return;
503            }
504    
505            if (d->state == STATE_WAITING_FOR_FC) {
506                    debug("[ pckbc: (port %i) received '0xfc' data: "
507                        "0x%02x ]\n", port_nr, cmd);
508                  pckbc_add_code(d, KBR_ACK, port_nr);                  pckbc_add_code(d, KBR_ACK, port_nr);
509                  d->state = STATE_NORMAL;                  d->state = STATE_NORMAL;
510                  return;                  return;
# Line 362  static void dev_pckbc_command(struct pck Line 533  static void dev_pckbc_command(struct pck
533          case KBC_SETDEFAULT:          case KBC_SETDEFAULT:
534                  pckbc_add_code(d, KBR_ACK, port_nr);                  pckbc_add_code(d, KBR_ACK, port_nr);
535                  break;                  break;
536            case 0xf3:
537                    pckbc_add_code(d, KBR_ACK, port_nr);
538                    d->state = STATE_WAITING_FOR_F3;
539                    break;
540            case 0xfa:      /*  Just ack?  */
541                    pckbc_add_code(d, KBR_ACK, port_nr);
542                    break;
543            case 0xfc:
544                    pckbc_add_code(d, KBR_ACK, port_nr);
545                    d->state = STATE_WAITING_FOR_FC;
546                    break;
547          case KBC_RESET:          case KBC_RESET:
548                  pckbc_add_code(d, KBR_ACK, port_nr);                  pckbc_add_code(d, KBR_ACK, port_nr);
549                  pckbc_add_code(d, KBR_RSTDONE, port_nr);                  pckbc_add_code(d, KBR_RSTDONE, port_nr);
550                  break;                  break;
551          default:          default:
552                  fatal("[ pckbc: UNIMPLEMENTED 8048 command 0x%02x ]\n", cmd);                  fatal("[ pckbc: (port %i) UNIMPLEMENTED 8048 command"
553                        " 0x%02x ]\n", port_nr, cmd);
554          }          }
555  }  }
556    
# Line 550  if (x&1) Line 733  if (x&1)
733           *  8242 (PS2):           *  8242 (PS2):
734           */           */
735    
 /*  
  *  BIG TODO: The following should be rewritten to use dev_pckbc_command()  
  *  etc, like the 8042 code above does.  
  */  
   
736          case PS2 + PS2_TXBUF:          case PS2 + PS2_TXBUF:
737                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
738                          odata = random() & 0xff;                          odata = random() & 0xff;
# Line 565  if (x&1) Line 743  if (x&1)
743                              "0x%llx ]\n", port_nr, (long long)idata);                              "0x%llx ]\n", port_nr, (long long)idata);
744    
745                          /*  Handle keyboard commands:  */                          /*  Handle keyboard commands:  */
746                          switch (idata) {                          d->reg[PS2_TXBUF] = idata;
747                          /*  These are incorrect, the second byte of                          dev_pckbc_command(d, port_nr);
                             commands should be treated better:  */  
                         case 0x00:      /*  second byte of 0xed,  
                                             SGI-IP32's prom  */  
                                 pckbc_add_code(d, 0x03, port_nr);/*  ack  (?) */  
                                 break;  
                         case 0x14:      /*  second byte of 0xfc,  
                                             SGI-IP32's prom  */  
                         case 0x28:      /*  second byte of 0xf3,  
                                             SGI-IP32's prom  */  
                         case 0x76:      /*  third byte of 0xfc,  
                                             SGI-IP32's prom  */  
                         case 0x03:      /*  second byte of  
                                             ATKBD_CMD_GSCANSET (?)  */  
                         case 0x04:  
                                 pckbc_add_code(d, 0x03, port_nr);/*  ?  */  
                                 break;  
   
                         /*  Command bytes:  */  
                         case 0xf0:      /*  ATKBD_CMD_GSCANSET (?)  */  
                                 pckbc_add_code(d, 0x03, port_nr);/*  ?  */  
                                 break;  
                         case 0xf2:      /*  Get keyboard ID  */  
                                 /*  The keyboard should generate 2  
                                     status bytes.  */  
                                 pckbc_add_code(d, 0xab, port_nr);  
                                 pckbc_add_code(d, 0x83, port_nr);  
                                 break;  
                         case 0xed:      /*  "ATKBD_CMD_SETLEDS",  
                                             takes 1 byte arg  */  
                         case 0xf3:      /*  "PSMOUSE_CMD_SETRATE",  
                                             takes 1 byte arg  */  
                         case 0xf4:      /*  "ATKBD_CMD_ENABLE" (or  
                                             PSMOUSE_CMD_ENABLE), no args  */  
                         case 0xf5:      /*  "ATKBD_CMD_RESET_DIS" (keyboard,  
                                             according to Linux sources)  */  
                         case 0xf6:      /*  "PSMOUSE_CMD_RESET_DIS" (mouse,  
                                             according to Linux sources)  */  
                                 /*  TODO: what does this do?  */  
                                 pckbc_add_code(d, 0xfa, port_nr);/*  ack  (?) */  
                                 break;  
                         case 0xfa:      /*  "ATKBD_CMD_SETALL_MBR" (linux)  */  
                                 pckbc_add_code(d, 0xfa, port_nr);/*  ack  (?) */  
                                 break;  
                         case 0xfc:      /*  ?  */  
                                 pckbc_add_code(d, 0xfa, port_nr);/*  ack  (?) */  
                                 break;  
                         case 0xff:      /*  Keyboard reset  */  
                                 /*  The keyboard should generate 2  
                                     status bytes.  */  
                                 pckbc_add_code(d, 0xfa, port_nr);/*  ack  (?) */  
                                 pckbc_add_code(d, 0xaa, port_nr);  
                                         /*  battery ok (?)  */  
                                 break;  
                         default:  
                                 debug("[ pckbc: UNIMPLEMENTED keyboard command"  
                                     " 0x%02x (port %i) ]\n", (int)idata,  
                                     port_nr);  
                         }  
748                  }                  }
749                  break;                  break;
750    
# Line 689  if (x&1) Line 809  if (x&1)
809                  }                  }
810          }          }
811    
812            /*  SGI?  */
813            if (len == 8)
814                    odata |= (odata << 8) | (odata << 16) | (odata << 24) |
815                        (odata << 32) | (odata << 40) | (odata << 48) |
816                        (odata << 56);
817    
818          if (writeflag == MEM_READ)          if (writeflag == MEM_READ)
819                  memory_writemax64(cpu, data, len, odata);                  memory_writemax64(cpu, data, len, odata);
820    
# Line 725  int dev_pckbc_init(struct machine *machi Line 851  int dev_pckbc_init(struct machine *machi
851                  len = DEV_PCKBC_LENGTH + 0x60;                  len = DEV_PCKBC_LENGTH + 0x60;
852          }          }
853    
854          d->type           = type;          d->type              = type;
855          d->keyboard_irqnr = keyboard_irqnr;          d->keyboard_irqnr    = keyboard_irqnr;
856          d->mouse_irqnr    = mouse_irqnr;          d->mouse_irqnr       = mouse_irqnr;
857          d->in_use         = in_use;          d->in_use            = in_use;
858          d->pc_style_flag  = pc_style_flag;          d->pc_style_flag     = pc_style_flag;
859          d->console_handle = console_start_slave_inputonly(machine, "pckbc");          d->console_handle    = console_start_slave_inputonly(machine, "pckbc");
860          d->rx_int_enable  = 1;          d->translation_table = 1;
861          d->output_byte    = 0x02;       /*  A20 enable on PCs  */          d->rx_int_enable     = 1;
862            d->output_byte       = 0x02;    /*  A20 enable on PCs  */
863    
864          memory_device_register(mem, "pckbc", baseaddr,          memory_device_register(mem, "pckbc", baseaddr,
865              len, dev_pckbc_access, d, MEM_DEFAULT, NULL);              len, dev_pckbc_access, d, MEM_DEFAULT, NULL);

Legend:
Removed from v.12  
changed lines
  Added in v.14

  ViewVC Help
Powered by ViewVC 1.1.26