Subversion Repositories HelenOS

Rev

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

Rev 4329 Rev 4330
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 120... Line 122...
120
    return 0;
122
    return 0;
121
}
123
}
122
 
124
 
123
void kbd_port_yield(void)
125
void kbd_port_yield(void)
124
{
126
{
-
 
127
    polling_disabled = true;
125
}
128
}
126
 
129
 
127
void kbd_port_reclaim(void)
130
void kbd_port_reclaim(void)
128
{
131
{
-
 
132
    polling_disabled = false;
129
}
133
}
130
 
134
 
131
/**
135
/**
132
 * 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
133
 * the buffer.
137
 * the buffer.
Line 160... Line 164...
160
static void *sgcn_thread_impl(void *arg)
164
static void *sgcn_thread_impl(void *arg)
161
{
165
{
162
    (void) arg;
166
    (void) arg;
163
 
167
 
164
    while (1) {
168
    while (1) {
-
 
169
        if (polling_disabled == false)
165
        sgcn_key_pressed();
170
            sgcn_key_pressed();
166
        usleep(POLL_INTERVAL);
171
        usleep(POLL_INTERVAL);
167
    }
172
    }
168
}
173
}
169
 
174
 
170
 
-
 
171
/** @}
175
/** @}
172
 */
176
 */