Kernel: Reads from PS/2 keyboard and mouse can be terminated
This commit is contained in:
parent
41ae05dd6e
commit
f0cf54e194
|
@ -35,7 +35,7 @@ namespace Kernel::Input
|
||||||
uint8_t m_mouse_id { 0x00 };
|
uint8_t m_mouse_id { 0x00 };
|
||||||
uint8_t m_button_mask { 0x00 };
|
uint8_t m_button_mask { 0x00 };
|
||||||
|
|
||||||
BAN::CircularQueue<MouseEvent, 25> m_event_queue;
|
BAN::CircularQueue<MouseEvent, 128> m_event_queue;
|
||||||
|
|
||||||
Semaphore m_semaphore;
|
Semaphore m_semaphore;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <kernel/FS/DevFS/FileSystem.h>
|
#include <kernel/FS/DevFS/FileSystem.h>
|
||||||
#include <kernel/Input/PS2/Config.h>
|
#include <kernel/Input/PS2/Config.h>
|
||||||
#include <kernel/Input/PS2/Keyboard.h>
|
#include <kernel/Input/PS2/Keyboard.h>
|
||||||
|
#include <kernel/Thread.h>
|
||||||
|
|
||||||
#define SET_MASK(byte, mask, on_off) ((on_off) ? ((byte) | (mask)) : ((byte) & ~(mask)))
|
#define SET_MASK(byte, mask, on_off) ((on_off) ? ((byte) | (mask)) : ((byte) & ~(mask)))
|
||||||
#define TOGGLE_MASK(byte, mask) ((byte) ^ (mask))
|
#define TOGGLE_MASK(byte, mask) ((byte) ^ (mask))
|
||||||
|
@ -158,7 +159,7 @@ namespace Kernel::Input
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (m_event_queue.empty())
|
if (m_event_queue.empty())
|
||||||
m_semaphore.block();
|
TRY(Thread::current().block_or_eintr(m_semaphore));
|
||||||
|
|
||||||
CriticalScope _;
|
CriticalScope _;
|
||||||
if (m_event_queue.empty())
|
if (m_event_queue.empty())
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <kernel/FS/DevFS/FileSystem.h>
|
#include <kernel/FS/DevFS/FileSystem.h>
|
||||||
#include <kernel/Input/PS2/Config.h>
|
#include <kernel/Input/PS2/Config.h>
|
||||||
#include <kernel/Input/PS2/Mouse.h>
|
#include <kernel/Input/PS2/Mouse.h>
|
||||||
|
#include <kernel/Thread.h>
|
||||||
|
|
||||||
#define SET_MASK(byte, mask, on_off) ((on_off) ? ((byte) | (mask)) : ((byte) & ~(mask)))
|
#define SET_MASK(byte, mask, on_off) ((on_off) ? ((byte) | (mask)) : ((byte) & ~(mask)))
|
||||||
#define TOGGLE_MASK(byte, mask) ((byte) ^ (mask))
|
#define TOGGLE_MASK(byte, mask) ((byte) ^ (mask))
|
||||||
|
@ -188,7 +189,7 @@ namespace Kernel::Input
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (m_event_queue.empty())
|
if (m_event_queue.empty())
|
||||||
m_semaphore.block();
|
TRY(Thread::current().block_or_eintr(m_semaphore));
|
||||||
|
|
||||||
CriticalScope _;
|
CriticalScope _;
|
||||||
if (m_event_queue.empty())
|
if (m_event_queue.empty())
|
||||||
|
|
Loading…
Reference in New Issue