~ubuntu-branches/ubuntu/hardy/kvm/hardy-backports

« back to all changes in this revision

Viewing changes to qemu/hw/slavio_serial.c

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2008-02-26 13:10:57 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: james.westby@ubuntu.com-20080226131057-s67x6l89mtjw1x9b
Tags: 1:62+dfsg-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
215
215
static void handle_kbd_command(ChannelState *s, int val);
216
216
static int serial_can_receive(void *opaque);
217
217
static void serial_receive_byte(ChannelState *s, int ch);
218
 
static inline void set_txint(ChannelState *s);
219
218
 
220
219
static void clear_queue(void *opaque)
221
220
{
305
304
            STATUS_CTS | STATUS_TXUNDRN;
306
305
    else
307
306
        s->rregs[R_STATUS] = STATUS_TXEMPTY | STATUS_TXUNDRN;
308
 
    s->rregs[R_SPEC] = SPEC_BITS8;
 
307
    s->rregs[R_SPEC] = SPEC_BITS8 | SPEC_ALLSENT;
309
308
 
310
309
    s->rx = s->tx = 0;
311
310
    s->rxint = s->txint = 0;
321
320
    slavio_serial_reset_chn(&s->chn[1]);
322
321
}
323
322
 
324
 
static inline void clr_rxint(ChannelState *s)
325
 
{
326
 
    s->rxint = 0;
327
 
    s->rxint_under_svc = 0;
328
 
    if (s->chn == chn_a) {
329
 
        if (s->wregs[W_MINTR] & MINTR_STATUSHI)
330
 
            s->otherchn->rregs[R_IVEC] = IVEC_HINOINT;
331
 
        else
332
 
            s->otherchn->rregs[R_IVEC] = IVEC_LONOINT;
333
 
        s->rregs[R_INTR] &= ~INTR_RXINTA;
334
 
    } else {
335
 
        if (s->wregs[W_MINTR] & MINTR_STATUSHI)
336
 
            s->rregs[R_IVEC] = IVEC_HINOINT;
337
 
        else
338
 
            s->rregs[R_IVEC] = IVEC_LONOINT;
339
 
        s->otherchn->rregs[R_INTR] &= ~INTR_RXINTB;
340
 
    }
341
 
    if (s->txint)
342
 
        set_txint(s);
343
 
    slavio_serial_update_irq(s);
344
 
}
345
 
 
346
323
static inline void set_rxint(ChannelState *s)
347
324
{
348
325
    s->rxint = 1;
367
344
    slavio_serial_update_irq(s);
368
345
}
369
346
 
370
 
static inline void clr_txint(ChannelState *s)
371
 
{
372
 
    s->txint = 0;
373
 
    s->txint_under_svc = 0;
374
 
    if (s->chn == chn_a) {
375
 
        if (s->wregs[W_MINTR] & MINTR_STATUSHI)
376
 
            s->otherchn->rregs[R_IVEC] = IVEC_HINOINT;
377
 
        else
378
 
            s->otherchn->rregs[R_IVEC] = IVEC_LONOINT;
379
 
        s->rregs[R_INTR] &= ~INTR_TXINTA;
380
 
    } else {
381
 
        if (s->wregs[W_MINTR] & MINTR_STATUSHI)
382
 
            s->rregs[R_IVEC] = IVEC_HINOINT;
383
 
        else
384
 
            s->rregs[R_IVEC] = IVEC_LONOINT;
385
 
        s->otherchn->rregs[R_INTR] &= ~INTR_TXINTB;
386
 
    }
387
 
    if (s->rxint)
388
 
        set_rxint(s);
389
 
    slavio_serial_update_irq(s);
390
 
}
391
 
 
392
347
static inline void set_txint(ChannelState *s)
393
348
{
394
349
    s->txint = 1;
410
365
    slavio_serial_update_irq(s);
411
366
}
412
367
 
 
368
static inline void clr_rxint(ChannelState *s)
 
369
{
 
370
    s->rxint = 0;
 
371
    s->rxint_under_svc = 0;
 
372
    if (s->chn == chn_a) {
 
373
        if (s->wregs[W_MINTR] & MINTR_STATUSHI)
 
374
            s->otherchn->rregs[R_IVEC] = IVEC_HINOINT;
 
375
        else
 
376
            s->otherchn->rregs[R_IVEC] = IVEC_LONOINT;
 
377
        s->rregs[R_INTR] &= ~INTR_RXINTA;
 
378
    } else {
 
379
        if (s->wregs[W_MINTR] & MINTR_STATUSHI)
 
380
            s->rregs[R_IVEC] = IVEC_HINOINT;
 
381
        else
 
382
            s->rregs[R_IVEC] = IVEC_LONOINT;
 
383
        s->otherchn->rregs[R_INTR] &= ~INTR_RXINTB;
 
384
    }
 
385
    if (s->txint)
 
386
        set_txint(s);
 
387
    slavio_serial_update_irq(s);
 
388
}
 
389
 
 
390
static inline void clr_txint(ChannelState *s)
 
391
{
 
392
    s->txint = 0;
 
393
    s->txint_under_svc = 0;
 
394
    if (s->chn == chn_a) {
 
395
        if (s->wregs[W_MINTR] & MINTR_STATUSHI)
 
396
            s->otherchn->rregs[R_IVEC] = IVEC_HINOINT;
 
397
        else
 
398
            s->otherchn->rregs[R_IVEC] = IVEC_LONOINT;
 
399
        s->rregs[R_INTR] &= ~INTR_TXINTA;
 
400
    } else {
 
401
        if (s->wregs[W_MINTR] & MINTR_STATUSHI)
 
402
            s->rregs[R_IVEC] = IVEC_HINOINT;
 
403
        else
 
404
            s->rregs[R_IVEC] = IVEC_LONOINT;
 
405
        s->otherchn->rregs[R_INTR] &= ~INTR_TXINTB;
 
406
    }
 
407
    if (s->rxint)
 
408
        set_rxint(s);
 
409
    slavio_serial_update_irq(s);
 
410
}
 
411
 
413
412
static void slavio_serial_update_parameters(ChannelState *s)
414
413
{
415
414
    int speed, parity, data_bits, stop_bits;
641
640
 
642
641
static CPUReadMemoryFunc *slavio_serial_mem_read[3] = {
643
642
    slavio_serial_mem_readb,
644
 
    slavio_serial_mem_readb,
645
 
    slavio_serial_mem_readb,
 
643
    NULL,
 
644
    NULL,
646
645
};
647
646
 
648
647
static CPUWriteMemoryFunc *slavio_serial_mem_write[3] = {
649
648
    slavio_serial_mem_writeb,
650
 
    slavio_serial_mem_writeb,
651
 
    slavio_serial_mem_writeb,
 
649
    NULL,
 
650
    NULL,
652
651
};
653
652
 
654
653
static void slavio_serial_save_chn(QEMUFile *f, ChannelState *s)