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


Ignore:
Timestamp:
2011-11-06T22:21:05Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
898e847
Parents:
2bdf8313 (diff), 7b5f4c9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

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

    r2bdf8313 rb0f00a9  
    11/*
    22 * Copyright (c) 2006 Josef Cejka
     3 * Copyright (c) 2011 Jiri Svoboda
    34 * All rights reserved.
    45 *
     
    3839#include <async.h>
    3940#include <sysinfo.h>
     41#include <input.h>
    4042#include <kbd.h>
    4143#include <kbd_port.h>
    42 #include <sun.h>
    4344#include <ddi.h>
    4445#include <errno.h>
     46
     47static int ns16550_port_init(kbd_dev_t *);
     48static void ns16550_port_yield(void);
     49static void ns16550_port_reclaim(void);
     50static void ns16550_port_write(uint8_t data);
     51
     52kbd_port_ops_t ns16550_port = {
     53        .init = ns16550_port_init,
     54        .yield = ns16550_port_yield,
     55        .reclaim = ns16550_port_reclaim,
     56        .write = ns16550_port_write
     57};
     58
     59static kbd_dev_t *kbd_dev;
    4560
    4661/* NS16550 registers */
     
    90105
    91106static uintptr_t ns16550_physical;
    92 static uintptr_t ns16550_kernel; 
     107static uintptr_t ns16550_kernel;
    93108
    94 int ns16550_port_init(void)
     109static kbd_dev_t *kbd_dev;
     110
     111static int ns16550_port_init(kbd_dev_t *kdev)
    95112{
    96113        void *vaddr;
    97 
     114       
     115        kbd_dev = kdev;
     116       
     117        sysarg_t ns16550;
     118        if (sysinfo_get_value("kbd.type.ns16550", &ns16550) != EOK)
     119                return -1;
     120        if (!ns16550)
     121                return -1;
     122       
    98123        if (sysinfo_get_value("kbd.address.physical", &ns16550_physical) != EOK)
    99124                return -1;
     
    115140}
    116141
     142static void ns16550_port_yield(void)
     143{
     144}
     145
     146static void ns16550_port_reclaim(void)
     147{
     148}
     149
     150static void ns16550_port_write(uint8_t data)
     151{
     152        (void) data;
     153}
     154
    117155static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    118156{
    119         int scan_code = IPC_GET_ARG2(*call);
    120         kbd_push_scancode(scan_code);
     157        kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
    121158       
    122         if (irc_service)
    123                 async_msg_1(irc_phone, IRC_CLEAR_INTERRUPT,
    124                     IPC_GET_IMETHOD(*call));
     159        if (irc_service) {
     160                async_exch_t *exch = async_exchange_begin(irc_sess);
     161                async_msg_1(exch, IRC_CLEAR_INTERRUPT, IPC_GET_IMETHOD(*call));
     162                async_exchange_end(exch);
     163        }
    125164}
    126165
Note: See TracChangeset for help on using the changeset viewer.