Ignore:
File:
1 edited

Legend:

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

    rd9fae235 r36e9cd1  
    3030 * @ingroup  kbd
    3131 * @{
    32  */
     32 */ 
    3333/** @file
    34  * @brief NS16550 port driver.
     34 * @brief       NS16550 port driver.
    3535 */
    3636
     
    4343#include <sun.h>
    4444#include <ddi.h>
    45 #include <errno.h>
    4645
    4746/* NS16550 registers */
    48 #define RBR_REG  0  /** Receiver Buffer Register. */
    49 #define IER_REG  1  /** Interrupt Enable Register. */
    50 #define IIR_REG  2  /** Interrupt Ident Register (read). */
    51 #define FCR_REG  2  /** FIFO control register (write). */
    52 #define LCR_REG  3  /** Line Control register. */
    53 #define MCR_REG  4  /** Modem Control Register. */
    54 #define LSR_REG  5  /** Line Status Register. */
     47#define RBR_REG         0       /** Receiver Buffer Register. */
     48#define IER_REG         1       /** Interrupt Enable Register. */
     49#define IIR_REG         2       /** Interrupt Ident Register (read). */
     50#define FCR_REG         2       /** FIFO control register (write). */
     51#define LCR_REG         3       /** Line Control register. */
     52#define MCR_REG         4       /** Modem Control Register. */
     53#define LSR_REG         5       /** Line Status Register. */
    5554
    56 #define LSR_DATA_READY  0x01
     55#define LSR_DATA_READY  0x01
    5756
    5857static irq_cmd_t ns16550_cmds[] = {
    5958        {
    6059                .cmd = CMD_PIO_READ_8,
    61                 .addr = (void *) 0,     /* Will be patched in run-time */
     60                .addr = (void *) 0,     /* will be patched in run-time */
    6261                .dstarg = 1
    6362        },
     
    7574        {
    7675                .cmd = CMD_PIO_READ_8,
    77                 .addr = (void *) 0,     /* Will be patched in run-time */
     76                .addr = (void *) 0,     /* will be patched in run-time */
    7877                .dstarg = 2
    7978        },
     
    9796        void *vaddr;
    9897
    99         if (sysinfo_get_value("kbd.address.physical", &ns16550_physical) != EOK)
    100                 return -1;
    101        
    102         if (sysinfo_get_value("kbd.address.kernel", &ns16550_kernel) != EOK)
    103                 return -1;
    104        
    105         sysarg_t inr;
    106         if (sysinfo_get_value("kbd.inr", &inr) != EOK)
    107                 return -1;
    108        
     98        async_set_interrupt_received(ns16550_irq_handler);
     99
     100        ns16550_physical = sysinfo_value("kbd.address.physical");
     101        ns16550_kernel = sysinfo_value("kbd.address.kernel");
    109102        ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG);
    110103        ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG);
    111        
    112         async_set_interrupt_received(ns16550_irq_handler);
    113         ipc_register_irq(inr, device_assign_devno(), inr, &ns16550_kbd);
    114        
     104        ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(),
     105            sysinfo_value("kbd.inr"), &ns16550_kbd);
    115106        return pio_enable((void *) ns16550_physical, 8, &vaddr);
    116107}
Note: See TracChangeset for help on using the changeset viewer.