Subversion Repositories HelenOS

Rev

Rev 4419 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4419 Rev 4420
Line 40... Line 40...
40
#include <kbd.h>
40
#include <kbd.h>
41
#include <kbd_port.h>
41
#include <kbd_port.h>
42
#include <sysinfo.h>
42
#include <sysinfo.h>
43
#include <stdio.h>
43
#include <stdio.h>
44
#include <thread.h>
44
#include <thread.h>
-
 
45
#include <bool.h>
45
 
46
 
46
#define POLL_INTERVAL       10000
47
#define POLL_INTERVAL       10000
47
 
48
 
48
/**
49
/**
49
 * SGCN buffer header. It is placed at the very beginning of the SGCN
50
 * SGCN buffer header. It is placed at the very beginning of the SGCN
Line 90... Line 91...
90
static uintptr_t sram_buffer_offset;
91
static uintptr_t sram_buffer_offset;
91
 
92
 
92
/* polling thread */
93
/* polling thread */
93
static void *sgcn_thread_impl(void *arg);
94
static void *sgcn_thread_impl(void *arg);
94
 
95
 
-
 
96
static volatile bool polling_disabled = false;
95
 
97
 
96
/**
98
/**
97
 * Initializes the SGCN driver.
99
 * Initializes the SGCN driver.
98
 * Maps the physical memory (SRAM) and creates the polling thread.
100
 * Maps the physical memory (SRAM) and creates the polling thread.
99
 */
101
 */
Line 118... Line 120...
118
    }
120
    }
119
 
121
 
120
    return 0;
122
    return 0;
121
}
123
}
122
 
124
 
-
 
125
void kbd_port_yield(void)
-
 
126
{
-
 
127
    polling_disabled = true;
-
 
128
}
-
 
129
 
-
 
130
void kbd_port_reclaim(void)
-
 
131
{
-
 
132
    polling_disabled = false;
-
 
133
}
-
 
134
 
123
/**
135
/**
124
 * Handler of the "key pressed" event. Reads codes of all the pressed keys from
136
 * Handler of the "key pressed" event. Reads codes of all the pressed keys from
125
 * the buffer.
137
 * the buffer.
126
 */
138
 */
127
static void sgcn_key_pressed(void)
139
static void sgcn_key_pressed(void)
Line 152... Line 164...
152
static void *sgcn_thread_impl(void *arg)
164
static void *sgcn_thread_impl(void *arg)
153
{
165
{
154
    (void) arg;
166
    (void) arg;
155
 
167
 
156
    while (1) {
168
    while (1) {
-
 
169
        if (polling_disabled == false)
157
        sgcn_key_pressed();
170
            sgcn_key_pressed();
158
        usleep(POLL_INTERVAL);
171
        usleep(POLL_INTERVAL);
159
    }
172
    }
160
}
173
}
161
 
174
 
162
 
-
 
163
/** @}
175
/** @}
164
 */
176
 */