source: mainline/uspace/srv/hid/input/port/msim.c@ 593e023

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since 593e023 was 593e023, checked in by Martin Decky <martin@…>, 11 years ago

allow compositor and console to coexist side-by-side, use the input server as a poor man's seat arbitrator

  • kernel console notifies both about the release and grab events
  • input server arbitrates the seat selection between kernel console and any number of user space UIs (currently the console server and the compositor server)
  • input port yield and reclaim methods have been removed (they are used only on Ski and Niagara, both already need a more generic mechanism for the kernel/user space cooperation)
  • console and compositor server keep track of the kernel console via the input arbitration
  • move the waiting for a character device from init and terminal widget to getterm
  • Property mode set to 100644
File size: 2.9 KB
Line 
1/*
2 * Copyright (c) 2006 Josef Cejka
3 * Copyright (c) 2011 Jiri Svoboda
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup kbd_port
31 * @ingroup kbd
32 * @{
33 */
34/** @file
35 * @brief Msim keyboard port driver.
36 */
37
38#include <async.h>
39#include <sysinfo.h>
40#include <ddi.h>
41#include <errno.h>
42#include "../kbd_port.h"
43#include "../kbd.h"
44
45static int msim_port_init(kbd_dev_t *);
46static void msim_port_write(uint8_t data);
47
48kbd_port_ops_t msim_port = {
49 .init = msim_port_init,
50 .write = msim_port_write
51};
52
53static kbd_dev_t *kbd_dev;
54
55static irq_pio_range_t msim_ranges[] = {
56 {
57 .base = 0,
58 .size = 1
59 }
60};
61
62static irq_cmd_t msim_cmds[] = {
63 {
64 .cmd = CMD_PIO_READ_8,
65 .addr = (void *) 0, /* will be patched in run-time */
66 .dstarg = 2
67 },
68 {
69 .cmd = CMD_ACCEPT
70 }
71};
72
73static irq_code_t msim_kbd = {
74 sizeof(msim_ranges) / sizeof(irq_pio_range_t),
75 msim_ranges,
76 sizeof(msim_cmds) / sizeof(irq_cmd_t),
77 msim_cmds
78};
79
80static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call);
81
82static int msim_port_init(kbd_dev_t *kdev)
83{
84 kbd_dev = kdev;
85
86 sysarg_t paddr;
87 if (sysinfo_get_value("kbd.address.physical", &paddr) != EOK)
88 return -1;
89
90 sysarg_t inr;
91 if (sysinfo_get_value("kbd.inr", &inr) != EOK)
92 return -1;
93
94 msim_ranges[0].base = paddr;
95 msim_cmds[0].addr = (void *) paddr;
96 async_set_interrupt_received(msim_irq_handler);
97 irq_register(inr, device_assign_devno(), 0, &msim_kbd);
98
99 return 0;
100}
101
102static void msim_port_write(uint8_t data)
103{
104 (void) data;
105}
106
107static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call)
108{
109 kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
110}
111
112/** @}
113 */
Note: See TracBrowser for help on using the repository browser.