From c418ab514d7eafb5d671212e5d30e3072d5b8b25 Mon Sep 17 00:00:00 2001 From: Adam Greloch Date: Mon, 13 Jan 2025 14:58:36 +0100 Subject: [PATCH] pc-tty: add option to override threads' priority with board_config.h JIRA: RTOS-896 --- tty/pc-tty/ttypc_kbd.c | 15 +++++++++++---- tty/pc-tty/ttypc_mouse.c | 10 ++++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/tty/pc-tty/ttypc_kbd.c b/tty/pc-tty/ttypc_kbd.c index 86506558..1f3b5f85 100644 --- a/tty/pc-tty/ttypc_kbd.c +++ b/tty/pc-tty/ttypc_kbd.c @@ -28,6 +28,8 @@ #include #include +#include + #include "ttypc_kbd.h" #include "ttypc_mouse.h" #include "ttypc_vga.h" @@ -35,8 +37,13 @@ #include "event_queue.h" -#define CTL_THREAD_PRIORITY 1 -#define POOL_THREAD_PRIORITY 1 +#ifndef TTYPC_KBD_CTL_PRIO +#define TTYPC_KBD_CTL_PRIO 1 +#endif + +#ifndef TTYPC_KBD_POOL_PRIO +#define TTYPC_KBD_POOL_PRIO 1 +#endif /* Keyboard key map entry */ @@ -694,14 +701,14 @@ int ttypc_kbd_init(ttypc_t *ttypc) } /* Launch keyboard/mouse control thread */ - err = beginthread(ttypc_kbd_ctlthr, CTL_THREAD_PRIORITY, ttypc->kstack, sizeof(ttypc->kstack), ttypc); + err = beginthread(ttypc_kbd_ctlthr, TTYPC_KBD_CTL_PRIO, ttypc->kstack, sizeof(ttypc->kstack), ttypc); if (err < 0) { break; } #if PC_TTY_CREATE_PS2_VDEVS /* Launch keyboard pool thread */ - err = beginthread(ttypc_kbd_poolthr, POOL_THREAD_PRIORITY, ttypc->kpstack, sizeof(ttypc->kpstack), ttypc); + err = beginthread(ttypc_kbd_poolthr, TTYPC_KBD_POOL_PRIO, ttypc->kpstack, sizeof(ttypc->kpstack), ttypc); if (err < 0) { break; } diff --git a/tty/pc-tty/ttypc_mouse.c b/tty/pc-tty/ttypc_mouse.c index e845ecb8..33325541 100644 --- a/tty/pc-tty/ttypc_mouse.c +++ b/tty/pc-tty/ttypc_mouse.c @@ -13,7 +13,8 @@ #include -#include "board_config.h" +#include + #include "ttypc_mouse.h" #if PC_TTY_MOUSE_ENABLE @@ -32,8 +33,9 @@ #include "event_queue.h" #include "ttypc_ps2.h" - -#define POOL_THREAD_PRIORITY 1 +#ifndef TTYPC_MOUSE_POOL_PRIO +#define TTYPC_MOUSE_POOL_PRIO 1 +#endif static int _ttypc_mouse_setup(ttypc_t *ttypc) @@ -269,7 +271,7 @@ int ttypc_mouse_init(ttypc_t *ttypc) #if PC_TTY_CREATE_PS2_VDEVS /* Launch mouse pool thread */ - err = beginthread(_ttypc_kbd_mouse_poolthr, POOL_THREAD_PRIORITY, ttypc->mpstack, sizeof(ttypc->mpstack), ttypc); + err = beginthread(_ttypc_kbd_mouse_poolthr, TTYPC_MOUSE_POOL_PRIO, ttypc->mpstack, sizeof(ttypc->mpstack), ttypc); if (err < 0) { portDestroy(ttypc->mport); event_queue_destroy(&ttypc->meq);