Changeset 8820544 in mainline for uspace/srv/hid/input/port/ns16550.c


Ignore:
Timestamp:
2014-08-16T00:02:04Z (10 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
35b8bfe, 8cd680c
Parents:
83f29e0
Message:

support for kernel notification multiplexing in the async framework

  • rename SYS_EVENT_* and SYS_IRQ_* syscalls to unify the terminology
  • add SYS_IPC_EVENT_UNSUBSCRIBE
  • remove IRQ handler multiplexing from DDF, the generic mechanism replaces it (unfortunatelly the order of arguments used by interrupt_handler_t needs to be permutated to align with the async framework conventions)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/port/ns16550.c

    r83f29e0 r8820544  
    107107};
    108108
    109 static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call);
     109static uintptr_t ns16550_physical;
     110static kbd_dev_t *kbd_dev;
     111static sysarg_t inr;
    110112
    111 static uintptr_t ns16550_physical;
    112 
    113 static kbd_dev_t *kbd_dev;
     113static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *arg)
     114{
     115        kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
     116       
     117        if (irc_service) {
     118                async_exch_t *exch = async_exchange_begin(irc_sess);
     119                async_msg_1(exch, IRC_CLEAR_INTERRUPT, inr);
     120                async_exchange_end(exch);
     121        }
     122}
    114123
    115124static int ns16550_port_init(kbd_dev_t *kdev)
    116125{
    117         void *vaddr;
    118        
    119126        kbd_dev = kdev;
    120127       
     
    128135                return -1;
    129136       
    130         sysarg_t inr;
    131137        if (sysinfo_get_value("kbd.inr", &inr) != EOK)
    132138                return -1;
     
    136142        ns16550_kbd.cmds[3].addr = (void *) (ns16550_physical + RBR_REG);
    137143       
    138         async_set_interrupt_received(ns16550_irq_handler);
    139         irq_register(inr, device_assign_devno(), inr, &ns16550_kbd);
     144        async_irq_subscribe(inr, device_assign_devno(), ns16550_irq_handler, NULL,
     145            &ns16550_kbd);
    140146       
     147        void *vaddr;
    141148        return pio_enable((void *) ns16550_physical, 8, &vaddr);
    142149}
     
    147154}
    148155
    149 static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    150 {
    151         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
    152        
    153         if (irc_service) {
    154                 async_exch_t *exch = async_exchange_begin(irc_sess);
    155                 async_msg_1(exch, IRC_CLEAR_INTERRUPT, IPC_GET_IMETHOD(*call));
    156                 async_exchange_end(exch);
    157         }
    158 }
    159 
    160156/**
    161157 * @}
Note: See TracChangeset for help on using the changeset viewer.