diff --git a/src/hlib/main.c b/src/hlib/main.c index 43ac97d..7775d13 100644 --- a/src/hlib/main.c +++ b/src/hlib/main.c @@ -81,4 +81,19 @@ return (returnType)request(serviceId, functionId, data, 0); \ } +#define REQUEST0(returnType, functionName, service, function) \ + returnType functionName() { \ + static uint32_t serviceId = 0; \ + if (!serviceId) { \ + serviceId = getService(service); \ + serviceId = getService(service); \ + } \ + static uint32_t functionId = 0; \ + if (!functionId) { \ + functionId = getFunction(serviceId, function); \ + } \ + return (returnType)request(serviceId, functionId, 0, 0); \ + } + REQUEST1(void, sleep, "pit", "sleep") +REQUEST0(bool, checkFocus, "ioManager", "checkFocus") diff --git a/src/hlib/main.c b/src/hlib/main.c index 43ac97d..7775d13 100644 --- a/src/hlib/main.c +++ b/src/hlib/main.c @@ -81,4 +81,19 @@ return (returnType)request(serviceId, functionId, data, 0); \ } +#define REQUEST0(returnType, functionName, service, function) \ + returnType functionName() { \ + static uint32_t serviceId = 0; \ + if (!serviceId) { \ + serviceId = getService(service); \ + serviceId = getService(service); \ + } \ + static uint32_t functionId = 0; \ + if (!functionId) { \ + functionId = getFunction(serviceId, function); \ + } \ + return (returnType)request(serviceId, functionId, 0, 0); \ + } + REQUEST1(void, sleep, "pit", "sleep") +REQUEST0(bool, checkFocus, "ioManager", "checkFocus") diff --git a/src/include/hlib.h b/src/include/hlib.h index ed26b16..c75670a 100644 --- a/src/include/hlib.h +++ b/src/include/hlib.h @@ -105,4 +105,6 @@ #define printf(...) _printf(allocationData, __VA_ARGS__) #define asprintf(...) _asprintf(allocationData, __VA_ARGS__) +extern bool checkFocus(); + #endif diff --git a/src/hlib/main.c b/src/hlib/main.c index 43ac97d..7775d13 100644 --- a/src/hlib/main.c +++ b/src/hlib/main.c @@ -81,4 +81,19 @@ return (returnType)request(serviceId, functionId, data, 0); \ } +#define REQUEST0(returnType, functionName, service, function) \ + returnType functionName() { \ + static uint32_t serviceId = 0; \ + if (!serviceId) { \ + serviceId = getService(service); \ + serviceId = getService(service); \ + } \ + static uint32_t functionId = 0; \ + if (!functionId) { \ + functionId = getFunction(serviceId, function); \ + } \ + return (returnType)request(serviceId, functionId, 0, 0); \ + } + REQUEST1(void, sleep, "pit", "sleep") +REQUEST0(bool, checkFocus, "ioManager", "checkFocus") diff --git a/src/include/hlib.h b/src/include/hlib.h index ed26b16..c75670a 100644 --- a/src/include/hlib.h +++ b/src/include/hlib.h @@ -105,4 +105,6 @@ #define printf(...) _printf(allocationData, __VA_ARGS__) #define asprintf(...) _asprintf(allocationData, __VA_ARGS__) +extern bool checkFocus(); + #endif diff --git a/src/userland/hid/main.c b/src/userland/hid/main.c index 3ede05d..aa9465f 100644 --- a/src/userland/hid/main.c +++ b/src/userland/hid/main.c @@ -2,7 +2,6 @@ #include -REQUEST(checkFocus, "ioManager", "checkFocus"); ListElement *hidDevices = NULL; char *collectionTypes[] = { @@ -302,7 +301,7 @@ initialized = true; initialize(); } - if (!checkFocus(0, 0)) { + if (!checkFocus()) { return 0; } } diff --git a/src/hlib/main.c b/src/hlib/main.c index 43ac97d..7775d13 100644 --- a/src/hlib/main.c +++ b/src/hlib/main.c @@ -81,4 +81,19 @@ return (returnType)request(serviceId, functionId, data, 0); \ } +#define REQUEST0(returnType, functionName, service, function) \ + returnType functionName() { \ + static uint32_t serviceId = 0; \ + if (!serviceId) { \ + serviceId = getService(service); \ + serviceId = getService(service); \ + } \ + static uint32_t functionId = 0; \ + if (!functionId) { \ + functionId = getFunction(serviceId, function); \ + } \ + return (returnType)request(serviceId, functionId, 0, 0); \ + } + REQUEST1(void, sleep, "pit", "sleep") +REQUEST0(bool, checkFocus, "ioManager", "checkFocus") diff --git a/src/include/hlib.h b/src/include/hlib.h index ed26b16..c75670a 100644 --- a/src/include/hlib.h +++ b/src/include/hlib.h @@ -105,4 +105,6 @@ #define printf(...) _printf(allocationData, __VA_ARGS__) #define asprintf(...) _asprintf(allocationData, __VA_ARGS__) +extern bool checkFocus(); + #endif diff --git a/src/userland/hid/main.c b/src/userland/hid/main.c index 3ede05d..aa9465f 100644 --- a/src/userland/hid/main.c +++ b/src/userland/hid/main.c @@ -2,7 +2,6 @@ #include -REQUEST(checkFocus, "ioManager", "checkFocus"); ListElement *hidDevices = NULL; char *collectionTypes[] = { @@ -302,7 +301,7 @@ initialized = true; initialize(); } - if (!checkFocus(0, 0)) { + if (!checkFocus()) { return 0; } } diff --git a/src/userland/ioManager/main.c b/src/userland/ioManager/main.c index 03711c7..5c51ade 100644 --- a/src/userland/ioManager/main.c +++ b/src/userland/ioManager/main.c @@ -26,7 +26,7 @@ lock = false; } -bool checkFocus() { +bool doCheckFocus() { return stackContains(focusService); } @@ -121,7 +121,7 @@ ioManager = getServiceId(); logFunction = createFunction("", (void *)handleLog); createFunction("keyCallback", (void *)handleKey); - createFunction("checkFocus", (void *)checkFocus); + createFunction("checkFocus", (void *)doCheckFocus); mainService = loadFromInitrd("vga"); mainOut = getFunction(mainService, "writeChar"); globalService = loadFromInitrd("parallel"); diff --git a/src/hlib/main.c b/src/hlib/main.c index 43ac97d..7775d13 100644 --- a/src/hlib/main.c +++ b/src/hlib/main.c @@ -81,4 +81,19 @@ return (returnType)request(serviceId, functionId, data, 0); \ } +#define REQUEST0(returnType, functionName, service, function) \ + returnType functionName() { \ + static uint32_t serviceId = 0; \ + if (!serviceId) { \ + serviceId = getService(service); \ + serviceId = getService(service); \ + } \ + static uint32_t functionId = 0; \ + if (!functionId) { \ + functionId = getFunction(serviceId, function); \ + } \ + return (returnType)request(serviceId, functionId, 0, 0); \ + } + REQUEST1(void, sleep, "pit", "sleep") +REQUEST0(bool, checkFocus, "ioManager", "checkFocus") diff --git a/src/include/hlib.h b/src/include/hlib.h index ed26b16..c75670a 100644 --- a/src/include/hlib.h +++ b/src/include/hlib.h @@ -105,4 +105,6 @@ #define printf(...) _printf(allocationData, __VA_ARGS__) #define asprintf(...) _asprintf(allocationData, __VA_ARGS__) +extern bool checkFocus(); + #endif diff --git a/src/userland/hid/main.c b/src/userland/hid/main.c index 3ede05d..aa9465f 100644 --- a/src/userland/hid/main.c +++ b/src/userland/hid/main.c @@ -2,7 +2,6 @@ #include -REQUEST(checkFocus, "ioManager", "checkFocus"); ListElement *hidDevices = NULL; char *collectionTypes[] = { @@ -302,7 +301,7 @@ initialized = true; initialize(); } - if (!checkFocus(0, 0)) { + if (!checkFocus()) { return 0; } } diff --git a/src/userland/ioManager/main.c b/src/userland/ioManager/main.c index 03711c7..5c51ade 100644 --- a/src/userland/ioManager/main.c +++ b/src/userland/ioManager/main.c @@ -26,7 +26,7 @@ lock = false; } -bool checkFocus() { +bool doCheckFocus() { return stackContains(focusService); } @@ -121,7 +121,7 @@ ioManager = getServiceId(); logFunction = createFunction("", (void *)handleLog); createFunction("keyCallback", (void *)handleKey); - createFunction("checkFocus", (void *)checkFocus); + createFunction("checkFocus", (void *)doCheckFocus); mainService = loadFromInitrd("vga"); mainOut = getFunction(mainService, "writeChar"); globalService = loadFromInitrd("parallel"); diff --git a/src/userland/lspci/main.c b/src/userland/lspci/main.c index fbbe21d..2d5af4c 100644 --- a/src/userland/lspci/main.c +++ b/src/userland/lspci/main.c @@ -89,8 +89,6 @@ pciDevice->bar[i] = bar; } listAdd(&pciDevices, pciDevice); - printf("device at [%i:%i:%i]: %s (subclass %i)\n", bus, device, function, - classNames[class], subclass); if (class == 6 && subclass == 4) { checkBus(pciConfigRead(bus, device, function, 0x19) & 0xFF); } @@ -190,7 +188,9 @@ int32_t main() { if (!initialized) { initializePci(); - return 0; + } + if (!checkFocus()) { + //return 0; } foreach (pciDevices, PciDevice *, device, { printf("[%i:%i:%i]: %s\n", device->bus, device->device, diff --git a/src/hlib/main.c b/src/hlib/main.c index 43ac97d..7775d13 100644 --- a/src/hlib/main.c +++ b/src/hlib/main.c @@ -81,4 +81,19 @@ return (returnType)request(serviceId, functionId, data, 0); \ } +#define REQUEST0(returnType, functionName, service, function) \ + returnType functionName() { \ + static uint32_t serviceId = 0; \ + if (!serviceId) { \ + serviceId = getService(service); \ + serviceId = getService(service); \ + } \ + static uint32_t functionId = 0; \ + if (!functionId) { \ + functionId = getFunction(serviceId, function); \ + } \ + return (returnType)request(serviceId, functionId, 0, 0); \ + } + REQUEST1(void, sleep, "pit", "sleep") +REQUEST0(bool, checkFocus, "ioManager", "checkFocus") diff --git a/src/include/hlib.h b/src/include/hlib.h index ed26b16..c75670a 100644 --- a/src/include/hlib.h +++ b/src/include/hlib.h @@ -105,4 +105,6 @@ #define printf(...) _printf(allocationData, __VA_ARGS__) #define asprintf(...) _asprintf(allocationData, __VA_ARGS__) +extern bool checkFocus(); + #endif diff --git a/src/userland/hid/main.c b/src/userland/hid/main.c index 3ede05d..aa9465f 100644 --- a/src/userland/hid/main.c +++ b/src/userland/hid/main.c @@ -2,7 +2,6 @@ #include -REQUEST(checkFocus, "ioManager", "checkFocus"); ListElement *hidDevices = NULL; char *collectionTypes[] = { @@ -302,7 +301,7 @@ initialized = true; initialize(); } - if (!checkFocus(0, 0)) { + if (!checkFocus()) { return 0; } } diff --git a/src/userland/ioManager/main.c b/src/userland/ioManager/main.c index 03711c7..5c51ade 100644 --- a/src/userland/ioManager/main.c +++ b/src/userland/ioManager/main.c @@ -26,7 +26,7 @@ lock = false; } -bool checkFocus() { +bool doCheckFocus() { return stackContains(focusService); } @@ -121,7 +121,7 @@ ioManager = getServiceId(); logFunction = createFunction("", (void *)handleLog); createFunction("keyCallback", (void *)handleKey); - createFunction("checkFocus", (void *)checkFocus); + createFunction("checkFocus", (void *)doCheckFocus); mainService = loadFromInitrd("vga"); mainOut = getFunction(mainService, "writeChar"); globalService = loadFromInitrd("parallel"); diff --git a/src/userland/lspci/main.c b/src/userland/lspci/main.c index fbbe21d..2d5af4c 100644 --- a/src/userland/lspci/main.c +++ b/src/userland/lspci/main.c @@ -89,8 +89,6 @@ pciDevice->bar[i] = bar; } listAdd(&pciDevices, pciDevice); - printf("device at [%i:%i:%i]: %s (subclass %i)\n", bus, device, function, - classNames[class], subclass); if (class == 6 && subclass == 4) { checkBus(pciConfigRead(bus, device, function, 0x19) & 0xFF); } @@ -190,7 +188,9 @@ int32_t main() { if (!initialized) { initializePci(); - return 0; + } + if (!checkFocus()) { + //return 0; } foreach (pciDevices, PciDevice *, device, { printf("[%i:%i:%i]: %s\n", device->bus, device->device, diff --git a/src/userland/lspci/pci.h b/src/userland/lspci/pci.h index b54720c..d32f502 100644 --- a/src/userland/lspci/pci.h +++ b/src/userland/lspci/pci.h @@ -1,4 +1,4 @@ -#ifndef PIC_H +#ifndef PCI_H #define PCI_H #include diff --git a/src/hlib/main.c b/src/hlib/main.c index 43ac97d..7775d13 100644 --- a/src/hlib/main.c +++ b/src/hlib/main.c @@ -81,4 +81,19 @@ return (returnType)request(serviceId, functionId, data, 0); \ } +#define REQUEST0(returnType, functionName, service, function) \ + returnType functionName() { \ + static uint32_t serviceId = 0; \ + if (!serviceId) { \ + serviceId = getService(service); \ + serviceId = getService(service); \ + } \ + static uint32_t functionId = 0; \ + if (!functionId) { \ + functionId = getFunction(serviceId, function); \ + } \ + return (returnType)request(serviceId, functionId, 0, 0); \ + } + REQUEST1(void, sleep, "pit", "sleep") +REQUEST0(bool, checkFocus, "ioManager", "checkFocus") diff --git a/src/include/hlib.h b/src/include/hlib.h index ed26b16..c75670a 100644 --- a/src/include/hlib.h +++ b/src/include/hlib.h @@ -105,4 +105,6 @@ #define printf(...) _printf(allocationData, __VA_ARGS__) #define asprintf(...) _asprintf(allocationData, __VA_ARGS__) +extern bool checkFocus(); + #endif diff --git a/src/userland/hid/main.c b/src/userland/hid/main.c index 3ede05d..aa9465f 100644 --- a/src/userland/hid/main.c +++ b/src/userland/hid/main.c @@ -2,7 +2,6 @@ #include -REQUEST(checkFocus, "ioManager", "checkFocus"); ListElement *hidDevices = NULL; char *collectionTypes[] = { @@ -302,7 +301,7 @@ initialized = true; initialize(); } - if (!checkFocus(0, 0)) { + if (!checkFocus()) { return 0; } } diff --git a/src/userland/ioManager/main.c b/src/userland/ioManager/main.c index 03711c7..5c51ade 100644 --- a/src/userland/ioManager/main.c +++ b/src/userland/ioManager/main.c @@ -26,7 +26,7 @@ lock = false; } -bool checkFocus() { +bool doCheckFocus() { return stackContains(focusService); } @@ -121,7 +121,7 @@ ioManager = getServiceId(); logFunction = createFunction("", (void *)handleLog); createFunction("keyCallback", (void *)handleKey); - createFunction("checkFocus", (void *)checkFocus); + createFunction("checkFocus", (void *)doCheckFocus); mainService = loadFromInitrd("vga"); mainOut = getFunction(mainService, "writeChar"); globalService = loadFromInitrd("parallel"); diff --git a/src/userland/lspci/main.c b/src/userland/lspci/main.c index fbbe21d..2d5af4c 100644 --- a/src/userland/lspci/main.c +++ b/src/userland/lspci/main.c @@ -89,8 +89,6 @@ pciDevice->bar[i] = bar; } listAdd(&pciDevices, pciDevice); - printf("device at [%i:%i:%i]: %s (subclass %i)\n", bus, device, function, - classNames[class], subclass); if (class == 6 && subclass == 4) { checkBus(pciConfigRead(bus, device, function, 0x19) & 0xFF); } @@ -190,7 +188,9 @@ int32_t main() { if (!initialized) { initializePci(); - return 0; + } + if (!checkFocus()) { + //return 0; } foreach (pciDevices, PciDevice *, device, { printf("[%i:%i:%i]: %s\n", device->bus, device->device, diff --git a/src/userland/lspci/pci.h b/src/userland/lspci/pci.h index b54720c..d32f502 100644 --- a/src/userland/lspci/pci.h +++ b/src/userland/lspci/pci.h @@ -1,4 +1,4 @@ -#ifndef PIC_H +#ifndef PCI_H #define PCI_H #include diff --git a/src/userland/mouse/main.c b/src/userland/mouse/main.c index a438b68..07d17ca 100644 --- a/src/userland/mouse/main.c +++ b/src/userland/mouse/main.c @@ -4,8 +4,6 @@ volatile uint32_t updateEvent; volatile bool buttons[5]; -REQUEST(checkFocus, "ioManager", "checkFocus"); - void moveAbsolute(int32_t newX, int32_t newY) { x = newX; y = newY; @@ -43,7 +41,7 @@ int32_t main() { if (!initialized) { initialize(); } - if (!checkFocus(0, 0)) { + if (!checkFocus()) { return 0; } uint32_t serviceId = getServiceId();