~martin-decky/helenos/rcu

« back to all changes in this revision

Viewing changes to uspace/srv/hid/input/port/gxemul.c

  • Committer: Martin Sucha
  • Date: 2011-07-08 17:01:01 UTC
  • mfrom: (1095 main-clone)
  • mto: This revision was merged to the branch mainline in revision 1123.
  • Revision ID: sucha14@st.fmph.uniba.sk-20110708170101-eosjw1koauuvmzkz
MergeĀ mainlineĀ changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Copyright (c) 2007 Michal Kebrt
 
3
 * Copyright (c) 2011 Jiri Svoboda
3
4
 * All rights reserved.
4
5
 *
5
6
 * Redistribution and use in source and binary forms, with or without
41
42
#include <ddi.h>
42
43
#include <errno.h>
43
44
 
 
45
static int gxemul_port_init(kbd_dev_t *);
 
46
static void gxemul_port_yield(void);
 
47
static void gxemul_port_reclaim(void);
 
48
static void gxemul_port_write(uint8_t data);
 
49
 
 
50
kbd_port_ops_t gxemul_port = {
 
51
        .init = gxemul_port_init,
 
52
        .yield = gxemul_port_yield,
 
53
        .reclaim = gxemul_port_reclaim,
 
54
        .write = gxemul_port_write
 
55
};
 
56
 
 
57
static kbd_dev_t *kbd_dev;
 
58
 
44
59
static irq_cmd_t gxemul_cmds[] = {
45
60
        { 
46
61
                .cmd = CMD_PIO_READ_8, 
60
75
static void gxemul_irq_handler(ipc_callid_t iid, ipc_call_t *call);
61
76
 
62
77
/** Initializes keyboard handler. */
63
 
int kbd_port_init(void)
 
78
static int gxemul_port_init(kbd_dev_t *kdev)
64
79
{
 
80
        kbd_dev = kdev;
 
81
        
65
82
        sysarg_t addr;
66
83
        if (sysinfo_get_value("kbd.address.virtual", &addr) != EOK)
67
84
                return -1;
76
93
        return 0;
77
94
}
78
95
 
79
 
void kbd_port_yield(void)
80
 
{
81
 
}
82
 
 
83
 
void kbd_port_reclaim(void)
84
 
{
85
 
}
86
 
 
87
 
void kbd_port_write(uint8_t data)
 
96
static void gxemul_port_yield(void)
 
97
{
 
98
}
 
99
 
 
100
static void gxemul_port_reclaim(void)
 
101
{
 
102
}
 
103
 
 
104
static void gxemul_port_write(uint8_t data)
88
105
{
89
106
        (void) data;
90
107
}
91
108
 
92
109
/** Process data sent when a key is pressed.
93
 
 *  
94
 
 *  @param keybuffer Buffer of pressed keys.
95
 
 *  @param call      IPC call.
96
 
 *
97
 
 *  @return Always 1.
 
110
 *
 
111
 * @param keybuffer Buffer of pressed keys.
 
112
 * @param call      IPC call.
 
113
 *
98
114
 */
99
115
static void gxemul_irq_handler(ipc_callid_t iid, ipc_call_t *call)
100
116
{
101
 
        int scan_code = IPC_GET_ARG2(*call);
102
 
 
103
 
        kbd_push_scancode(scan_code);
 
117
        kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
104
118
}
105
119
 
106
120
/** @}