Skip to content

Commit

Permalink
pc-tty: add option to override threads' priority with board_config.h
Browse files Browse the repository at this point in the history
JIRA: RTOS-896
  • Loading branch information
adamgreloch committed Jan 13, 2025
1 parent aa1dc51 commit c418ab5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
15 changes: 11 additions & 4 deletions tty/pc-tty/ttypc_kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,22 @@
#include <fcntl.h>
#include <posix/utils.h>

#include <board_config.h>

#include "ttypc_kbd.h"
#include "ttypc_mouse.h"
#include "ttypc_vga.h"
#include "ttypc_ps2.h"
#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 */
Expand Down Expand Up @@ -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;
}
Expand Down
10 changes: 6 additions & 4 deletions tty/pc-tty/ttypc_mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

#include <errno.h>

#include "board_config.h"
#include <board_config.h>

#include "ttypc_mouse.h"

#if PC_TTY_MOUSE_ENABLE
Expand All @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c418ab5

Please sign in to comment.