Subversion Repositories HelenOS

Rev

Rev 4236 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4236 Rev 4462
Line 25... Line 25...
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
29
/** @addtogroup kbdgen
29
/** @addtogroup kbdgen
30
 * @brief   HelenOS generic uspace keyboard handler.
30
 * @brief HelenOS generic uspace keyboard handler.
31
 * @ingroup  kbd
31
 * @ingroup kbd
32
 * @{
32
 * @{
33
 */
33
 */
34
/** @file
34
/** @file
35
 */
35
 */
36
 
36
 
37
#ifndef __KEY_BUFFER_H__
37
#ifndef __KEYBUFFER_H__
38
#define __KEY_BUFFER_H__
38
#define __KEYBUFFER_H__
39
 
39
 
40
#include <sys/types.h>
40
#include <sys/types.h>
-
 
41
#include <io/console.h>
41
#include <kbd/kbd.h>
42
#include <bool.h>
42
 
43
 
43
/** Size of buffer for pressed keys */
44
/** Size of buffer for pressed keys */
44
#define KEYBUFFER_SIZE 128 
45
#define KEYBUFFER_SIZE  128
45
 
46
 
46
typedef struct {
47
typedef struct {
47
    kbd_event_t fifo[KEYBUFFER_SIZE];
48
    console_event_t fifo[KEYBUFFER_SIZE];
48
    unsigned long head;
49
    unsigned long head;
49
    unsigned long tail;
50
    unsigned long tail;
50
    unsigned long items;
51
    unsigned long items;
51
} keybuffer_t;
52
} keybuffer_t;
52
 
53
 
53
extern void keybuffer_free(keybuffer_t *);
54
extern void keybuffer_free(keybuffer_t *);
54
extern void keybuffer_init(keybuffer_t *);
55
extern void keybuffer_init(keybuffer_t *);
55
extern int keybuffer_available(keybuffer_t *);
56
extern size_t keybuffer_available(keybuffer_t *);
56
extern int keybuffer_empty(keybuffer_t *);
57
extern bool keybuffer_empty(keybuffer_t *);
57
extern void keybuffer_push(keybuffer_t *, const kbd_event_t *);
58
extern void keybuffer_push(keybuffer_t *, const console_event_t *);
58
extern int keybuffer_pop(keybuffer_t *, kbd_event_t *);
59
extern bool keybuffer_pop(keybuffer_t *, console_event_t *);
59
 
60
 
60
#endif
61
#endif
61
 
62
 
62
/**
63
/**
63
 * @}
64
 * @}
64
 */
65
 */
65
 
-