Changeset d9fae235 in mainline for uspace/srv/hid/kbd/port/ns16550.c


Ignore:
Timestamp:
2010-04-17T01:28:38Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9d6bfa5
Parents:
9256ad29
Message:

sysinfo overhaul

  • cleanup (nicer data structures, use of SLAB allocator)
  • add support for storing arbitrary binary data
  • properly reimplement non-constant values (generated by functions)
  • add support for non-constant subtrees (generated by functions)
  • syscall ABI change, libc API change
  • reflect changes in user code

libc: task_spawn() can now return error code

  • reflect change in user code, print error strings after failed task_spawn()

uspace cleanup

  • more use of string and other constants
  • more use of str_error()
  • unify error reporting in init
File:
1 edited

Legend:

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

    r9256ad29 rd9fae235  
    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>
    4546
    4647/* NS16550 registers */
    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. */
     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. */
    5455
    55 #define LSR_DATA_READY  0x01
     56#define LSR_DATA_READY  0x01
    5657
    5758static irq_cmd_t ns16550_cmds[] = {
    5859        {
    5960                .cmd = CMD_PIO_READ_8,
    60                 .addr = (void *) 0,     /* will be patched in run-time */
     61                .addr = (void *) 0,     /* Will be patched in run-time */
    6162                .dstarg = 1
    6263        },
     
    7475        {
    7576                .cmd = CMD_PIO_READ_8,
    76                 .addr = (void *) 0,     /* will be patched in run-time */
     77                .addr = (void *) 0,     /* Will be patched in run-time */
    7778                .dstarg = 2
    7879        },
     
    9697        void *vaddr;
    9798
    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");
     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       
    102109        ns16550_kbd.cmds[0].addr = (void *) (ns16550_kernel + LSR_REG);
    103110        ns16550_kbd.cmds[3].addr = (void *) (ns16550_kernel + RBR_REG);
    104         ipc_register_irq(sysinfo_value("kbd.inr"), device_assign_devno(),
    105             sysinfo_value("kbd.inr"), &ns16550_kbd);
     111       
     112        async_set_interrupt_received(ns16550_irq_handler);
     113        ipc_register_irq(inr, device_assign_devno(), inr, &ns16550_kbd);
     114       
    106115        return pio_enable((void *) ns16550_physical, 8, &vaddr);
    107116}
Note: See TracChangeset for help on using the changeset viewer.