Subversion Repositories HelenOS

Rev

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

Rev 4346 Rev 4348
Line 40... Line 40...
40
#include <unistd.h>
40
#include <unistd.h>
41
#include <kbd.h>
41
#include <kbd.h>
42
#include <kbd_port.h>
42
#include <kbd_port.h>
43
#include <sys/types.h>
43
#include <sys/types.h>
44
#include <thread.h>
44
#include <thread.h>
-
 
45
#include <bool.h>
45
 
46
 
46
#define SKI_GETCHAR     21
47
#define SKI_GETCHAR     21
47
 
48
 
48
#define POLL_INTERVAL       10000
49
#define POLL_INTERVAL       10000
49
 
50
 
50
static void *ski_thread_impl(void *arg);
51
static void *ski_thread_impl(void *arg);
51
static int32_t ski_getchar(void);
52
static int32_t ski_getchar(void);
52
 
53
 
-
 
54
static volatile bool polling_disabled = false;
-
 
55
 
53
/** Initialize Ski port driver. */
56
/** Initialize Ski port driver. */
54
int kbd_port_init(void)
57
int kbd_port_init(void)
55
{
58
{
56
    thread_id_t tid;
59
    thread_id_t tid;
57
    int rc;
60
    int rc;
Line 62... Line 65...
62
    }
65
    }
63
 
66
 
64
    return 0;
67
    return 0;
65
}
68
}
66
 
69
 
-
 
70
void kbd_port_yield(void)
-
 
71
{
-
 
72
    polling_disabled = true;
-
 
73
}
-
 
74
 
-
 
75
void kbd_port_reclaim(void)
-
 
76
{
-
 
77
    polling_disabled = false;
-
 
78
}
-
 
79
 
67
/** Thread to poll Ski for keypresses. */
80
/** Thread to poll Ski for keypresses. */
68
static void *ski_thread_impl(void *arg)
81
static void *ski_thread_impl(void *arg)
69
{
82
{
70
    int32_t c;
83
    int32_t c;
71
    (void) arg;
84
    (void) arg;
72
 
85
 
73
    while (1) {
86
    while (1) {
74
        while (1) {
87
        while (polling_disabled == false) {
75
            c = ski_getchar();
88
            c = ski_getchar();
76
            if (c == 0)
89
            if (c == 0)
77
                break;
90
                break;
78
            kbd_push_scancode(c);
91
            kbd_push_scancode(c);
79
        }
92
        }