Commit b9652ca3a5c027f8bc55323e0f6010f641479255

Authored by blueswir1
1 parent 19221bda

Fix keyboard serial and mouse bugs


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2709 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 29 additions and 15 deletions
hw/slavio_serial.c
@@ -222,8 +222,6 @@ static inline void clr_rxint(ChannelState *s) @@ -222,8 +222,6 @@ static inline void clr_rxint(ChannelState *s)
222 } 222 }
223 if (s->txint) 223 if (s->txint)
224 set_txint(s); 224 set_txint(s);
225 - else  
226 - s->rregs[2] = 6;  
227 slavio_serial_update_irq(s); 225 slavio_serial_update_irq(s);
228 } 226 }
229 227
@@ -237,30 +235,39 @@ static inline void set_rxint(ChannelState *s) @@ -237,30 +235,39 @@ static inline void set_rxint(ChannelState *s)
237 s->otherchn->rregs[2] = 0x30; 235 s->otherchn->rregs[2] = 0x30;
238 else 236 else
239 s->otherchn->rregs[2] = 0x0c; 237 s->otherchn->rregs[2] = 0x0c;
240 - s->rregs[3] |= 0x20;  
241 } else { 238 } else {
242 if (s->wregs[9] & 0x10) 239 if (s->wregs[9] & 0x10)
243 s->rregs[2] = 0x20; 240 s->rregs[2] = 0x20;
244 else 241 else
245 s->rregs[2] = 0x04; 242 s->rregs[2] = 0x04;
246 - s->otherchn->rregs[3] |= 4;  
247 } 243 }
248 - slavio_serial_update_irq(s);  
249 } 244 }
  245 + if (s->chn == chn_a)
  246 + s->rregs[3] |= 0x20;
  247 + else
  248 + s->otherchn->rregs[3] |= 4;
  249 + slavio_serial_update_irq(s);
250 } 250 }
251 251
252 static inline void clr_txint(ChannelState *s) 252 static inline void clr_txint(ChannelState *s)
253 { 253 {
254 s->txint = 0; 254 s->txint = 0;
255 s->txint_under_svc = 0; 255 s->txint_under_svc = 0;
256 - if (s->chn == chn_a) 256 + if (s->chn == chn_a) {
  257 + if (s->wregs[9] & 0x10)
  258 + s->otherchn->rregs[2] = 0x60;
  259 + else
  260 + s->otherchn->rregs[2] = 0x06;
257 s->rregs[3] &= ~0x10; 261 s->rregs[3] &= ~0x10;
258 - else 262 + } else {
  263 + if (s->wregs[9] & 0x10)
  264 + s->rregs[2] = 0x60;
  265 + else
  266 + s->rregs[2] = 0x06;
259 s->otherchn->rregs[3] &= ~2; 267 s->otherchn->rregs[3] &= ~2;
  268 + }
260 if (s->rxint) 269 if (s->rxint)
261 set_rxint(s); 270 set_rxint(s);
262 - else  
263 - s->rregs[2] = 6;  
264 slavio_serial_update_irq(s); 271 slavio_serial_update_irq(s);
265 } 272 }
266 273
@@ -269,13 +276,20 @@ static inline void set_txint(ChannelState *s) @@ -269,13 +276,20 @@ static inline void set_txint(ChannelState *s)
269 s->txint = 1; 276 s->txint = 1;
270 if (!s->rxint_under_svc) { 277 if (!s->rxint_under_svc) {
271 s->txint_under_svc = 1; 278 s->txint_under_svc = 1;
272 - if (s->chn == chn_a)  
273 - s->rregs[3] |= 0x10;  
274 - else  
275 - s->otherchn->rregs[3] |= 2;  
276 - s->rregs[2] = 0;  
277 - slavio_serial_update_irq(s); 279 + if (s->chn == chn_a) {
  280 + if (s->wregs[9] & 0x10)
  281 + s->otherchn->rregs[2] = 0x10;
  282 + else
  283 + s->otherchn->rregs[2] = 0x08;
  284 + } else {
  285 + s->rregs[2] = 0;
  286 + }
278 } 287 }
  288 + if (s->chn == chn_a)
  289 + s->rregs[3] |= 0x10;
  290 + else
  291 + s->otherchn->rregs[3] |= 2;
  292 + slavio_serial_update_irq(s);
279 } 293 }
280 294
281 static void slavio_serial_update_parameters(ChannelState *s) 295 static void slavio_serial_update_parameters(ChannelState *s)