Ignore:
Timestamp:
2006-10-18T09:54:13Z (18 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6fb30a1
Parents:
19de05f
Message:

mips32: update for new IRQ subsystem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/src/drivers/serial.c

    r19de05f r7688b5d  
    3838#include <console/chardev.h>
    3939#include <console/console.h>
     40#include <ddi/irq.h>
    4041
     42#define SERIAL_IRQ 2
     43
     44static irq_t serial_irq;
    4145static chardev_t console;
    4246static serial_t sconf[SERIAL_MAX];
     
    9296}
    9397
    94 
    95 /** Process keyboard interrupt. Does not work in simics? */
    96 static void serial_interrupt(int n, void *stack)
     98static void serial_handler(void)
    9799{
    98         serial_t *sd = (serial_t *)console.data;
     100        serial_t *sd = (serial_t *) console.data;
    99101        char ch;
    100102
     
    108110}
    109111
     112/** Process keyboard interrupt. Does not work in simics? */
     113static void serial_irq_handler(irq_t *irq, void *arg, ...)
     114{
     115        if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox))
     116                ipc_irq_send_notif(irq);
     117        else
     118                serial_handler();
     119}
    110120
     121static irq_ownership_t serial_claim(void)
     122{
     123        return IRQ_ACCEPT;
     124}
    111125
    112126static chardev_operations_t serial_ops = {
     
    117131};
    118132
    119 iroutine old_timer;
    120 /** Do polling on timer interrupt */
    121 static void timer_replace(int n, istate_t *istate)
    122 {
    123         old_timer(n, istate);
    124         serial_interrupt(n, istate);
    125 }
    126 
    127 void serial_console(void)
     133void serial_console(devno_t devno)
    128134{
    129135        serial_t *sd = &sconf[0];
     
    133139        console.data = sd;
    134140        kb_enabled = true;
     141       
     142        irq_initialize(&serial_irq);
     143        serial_irq.devno = devno;
     144        serial_irq.inr = SERIAL_IRQ;
     145        serial_irq.claim = serial_claim;
     146        serial_irq.handler = serial_irq_handler;
     147        irq_register(&serial_irq);
    135148
    136 //      int_register(2, "serial_drvr", serial_interrupt);
    137149        /* I don't know why, but the serial interrupts simply
    138150         * don't work on simics
    139151         */
    140         old_timer = int_register(TIMER_IRQ, "serial_drvr_poll", timer_replace);
     152        timer_fnc = &serial_handler;
    141153       
    142154        stdin = &console;
Note: See TracChangeset for help on using the changeset viewer.