Ignore:
Timestamp:
2006-10-18T09:54:13Z (19 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/msim.c

    r19de05f r7688b5d  
    3838#include <arch/cp0.h>
    3939#include <console/console.h>
     40#include <ddi/irq.h>
     41#include <sysinfo/sysinfo.h>
     42
     43/** Address of devices. */
     44#define MSIM_VIDEORAM           0xB0000000
     45#define MSIM_KBD_ADDRESS        0xB0000000
     46#define MSIM_KBD_IRQ            2
    4047
    4148static chardev_t console;
     49static irq_t msim_irq;
    4250
    4351static void msim_write(chardev_t *dev, const char ch);
     
    9098
    9199/** Process keyboard interrupt. */
    92 static void msim_interrupt(int n, istate_t *istate)
     100static void msim_irq_handler(irq_t *irq, void *arg, ...)
    93101{
    94         char ch = 0;
     102        if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox))
     103                ipc_irq_send_notif(irq);
     104        else {
     105                char ch = 0;
     106               
     107                        ch = *((char *) MSIM_KBD_ADDRESS);
     108                        if (ch =='\r')
     109                                ch = '\n';
     110                        if (ch == 0x7f)
     111                                ch = '\b';
     112                        chardev_push_character(&console, ch);
     113        }
     114}
    95115
    96         ch = *((char *) MSIM_KBD_ADDRESS);
    97         if (ch =='\r')
    98                 ch = '\n';
    99         if (ch == 0x7f)
    100                 ch = '\b';
    101         chardev_push_character(&console, ch);
     116static irq_ownership_t msim_claim(void)
     117{
     118        return IRQ_ACCEPT;
     119}
     120
     121void msim_kbd_grab(void)
     122{
     123        msim_irq.notif_cfg.notify = false;
     124}
     125
     126void msim_kbd_release(void)
     127{
     128        if (msim_irq.notif_cfg.answerbox)
     129                msim_irq.notif_cfg.notify = true;
    102130}
    103131
    104132
    105133/* Return console object representing msim console */
    106 void msim_console(void)
     134void msim_console(devno_t devno)
    107135{
    108136        chardev_initialize("msim_console", &console, &msim_ops);
    109 
    110         int_register(MSIM_KBD_IRQ, "msim_kbd", msim_interrupt);
    111 
    112         cp0_unmask_int(MSIM_KBD_IRQ);
    113 
    114137        stdin = &console;
    115138        stdout = &console;
    116 }
    117 
    118 static iroutine oldvector;
    119 void msim_kbd_grab(void)
    120 {
    121         oldvector = int_register(MSIM_KBD_IRQ, "msim_kbd", msim_interrupt);
    122 }
    123 void msim_kbd_release(void)
    124 {
    125         if (oldvector)
    126                 int_register(MSIM_KBD_IRQ, "user_interrupt", oldvector);
     139       
     140        irq_initialize(&msim_irq);
     141        msim_irq.devno = devno;
     142        msim_irq.inr = MSIM_KBD_IRQ;
     143        msim_irq.claim = msim_claim;
     144        msim_irq.handler = msim_irq_handler;
     145        irq_register(&msim_irq);
     146       
     147        cp0_unmask_int(MSIM_KBD_IRQ);
     148       
     149        sysinfo_set_item_val("kbd", NULL, true);
     150        sysinfo_set_item_val("kbd.devno", NULL, devno);
     151        sysinfo_set_item_val("kbd.inr", NULL, MSIM_KBD_IRQ);
     152        sysinfo_set_item_val("kbd.address.virtual", NULL, MSIM_KBD_ADDRESS);
    127153}
    128154
Note: See TracChangeset for help on using the changeset viewer.