Key Updates, I/O APIC and sleep
Posted: Fri Oct 13, 2017 4:45 pm
Hi!
I'm currently working on my keyboard driver and the infrastructure for the driver. Since configuring the I/O APIC is kind of a pain in the @$$, i've currently only activated activated the PIC and the APIC.
Consider the following code:
keys.hpp:
keyboard.cpp:
Now in the far future i'll have a GUI, which means Keys::UpdateFocusedElement(); will call a function of a process that is currently focused. But in order to do so, i'll have to make two task switches per Update, which means hitting Q would cause 4 task switches and releasing it would cause 2 task switches. Isn't that a little bit performance hungry? I mean i could maybe eliminate the second call by deleting .IsHeld and making it an process internal value...
By the way, the Key-Objects will get copied into public read-only memory for all processes.
APIC and I/O APIC:
If i've understood it correctly, the I/O APIC is only used for IRQs and IPIs, right? Is there a reason why i shouldn't send all IRQs to the BSP? Because if there is no real reason, i could just leave the PIC activated. And is there a good programmers documentation on ACPI? It seems to be a pain in the @$$ to detect and configure
sleep:
How does sleep work if i have multiple requests? I'll need the APIC-Timer for multitasking, so i'll have to use the PIT. But what should i do if i get multiple sleep requests at once? Set a 1ms timer, subtract 1ms from all requests at each IRQ00 and switch task if necessary? I mean I want to complete a sheduling round every 1ms, so i would need a 1ms PIT anyways...
I'm currently working on my keyboard driver and the infrastructure for the driver. Since configuring the I/O APIC is kind of a pain in the @$$, i've currently only activated activated the PIC and the APIC.
Consider the following code:
keys.hpp:
Code: Select all
#ifndef KEYS_KEYS_HPP
#define KEYS_KEYS_HPP
namespace Keys
{
void Init();
class Key
{
public:
bool IsPressed;
bool IsHeld;
bool IsReleased;
};
extern void(*UpdateFocusedElement)();
extern Key A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z;
}
#endif
Code: Select all
char ScanCode(uint8_t iCode, uint8_t iTable)
{
if (iTable = 1)
{
switch (iCode)
{
case 0x10: Keys::Q.IsPressed = true; Keys::UpdateFocusedElement(); Keys::Q.IsPressed = false; Keys::Q.IsHeld = true; Keys::UpdateFocusedElement(); break;
}
}
}
By the way, the Key-Objects will get copied into public read-only memory for all processes.
APIC and I/O APIC:
If i've understood it correctly, the I/O APIC is only used for IRQs and IPIs, right? Is there a reason why i shouldn't send all IRQs to the BSP? Because if there is no real reason, i could just leave the PIC activated. And is there a good programmers documentation on ACPI? It seems to be a pain in the @$$ to detect and configure
sleep:
How does sleep work if i have multiple requests? I'll need the APIC-Timer for multitasking, so i'll have to use the PIT. But what should i do if i get multiple sleep requests at once? Set a 1ms timer, subtract 1ms from all requests at each IRQ00 and switch task if necessary? I mean I want to complete a sheduling round every 1ms, so i would need a 1ms PIT anyways...