summaryrefslogtreecommitdiff
path: root/firmware/kernel/include
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/kernel/include')
-rw-r--r--firmware/kernel/include/mrsw_lock.h7
-rw-r--r--firmware/kernel/include/mutex.h12
-rw-r--r--firmware/kernel/include/queue.h4
-rw-r--r--firmware/kernel/include/semaphore.h8
-rw-r--r--firmware/kernel/include/thread.h18
5 files changed, 32 insertions, 17 deletions
diff --git a/firmware/kernel/include/mrsw_lock.h b/firmware/kernel/include/mrsw_lock.h
index d919f7be26..7511f87e93 100644
--- a/firmware/kernel/include/mrsw_lock.h
+++ b/firmware/kernel/include/mrsw_lock.h
@@ -39,10 +39,9 @@
39 */ 39 */
40struct mrsw_lock 40struct mrsw_lock
41{ 41{
42 int volatile count; /* rd/wr counter; >0 = reader(s), <0 = writer */ 42 int volatile count; /* counter; >0 = reader(s), <0 = writer */
43 struct thread_entry *queue; 43 struct __wait_queue queue; /* waiter list */
44 struct blocker_splay splay; /* priority inheritance info 44 struct blocker_splay splay; /* priority inheritance/owner info */
45 for waiters */
46 uint8_t rdrecursion[MAXTHREADS]; /* per-thread reader recursion counts */ 45 uint8_t rdrecursion[MAXTHREADS]; /* per-thread reader recursion counts */
47 IF_COP( struct corelock cl; ) 46 IF_COP( struct corelock cl; )
48}; 47};
diff --git a/firmware/kernel/include/mutex.h b/firmware/kernel/include/mutex.h
index 72736ec8fd..b74bfe23f5 100644
--- a/firmware/kernel/include/mutex.h
+++ b/firmware/kernel/include/mutex.h
@@ -26,13 +26,13 @@
26 26
27struct mutex 27struct mutex
28{ 28{
29 struct thread_entry *queue; /* waiter list */ 29 struct __wait_queue queue; /* waiter list */
30 int recursion; /* lock owner recursion count */ 30 int recursion; /* lock owner recursion count */
31 struct blocker blocker; /* priority inheritance info 31 struct blocker blocker; /* priority inheritance info
32 for waiters and owner*/ 32 for waiters and owner*/
33 IF_COP( struct corelock cl; ) /* multiprocessor sync */ 33 IF_COP( struct corelock cl; ) /* multiprocessor sync */
34#ifdef HAVE_PRIORITY_SCHEDULING 34#ifdef HAVE_PRIORITY_SCHEDULING
35 bool no_preempt; 35 bool no_preempt;
36#endif 36#endif
37}; 37};
38 38
diff --git a/firmware/kernel/include/queue.h b/firmware/kernel/include/queue.h
index 3f24598d5b..afee4c90ff 100644
--- a/firmware/kernel/include/queue.h
+++ b/firmware/kernel/include/queue.h
@@ -88,7 +88,7 @@ struct queue_sender_list
88 /* If non-NULL, there is a thread waiting for the corresponding event */ 88 /* If non-NULL, there is a thread waiting for the corresponding event */
89 /* Must be statically allocated to put in non-cached ram. */ 89 /* Must be statically allocated to put in non-cached ram. */
90 struct thread_entry *senders[QUEUE_LENGTH]; /* message->thread map */ 90 struct thread_entry *senders[QUEUE_LENGTH]; /* message->thread map */
91 struct thread_entry *list; /* list of senders in map */ 91 struct __wait_queue list; /* list of senders in map */
92 /* Send info for last message dequeued or NULL if replied or not sent */ 92 /* Send info for last message dequeued or NULL if replied or not sent */
93 struct thread_entry * volatile curr_sender; 93 struct thread_entry * volatile curr_sender;
94#ifdef HAVE_PRIORITY_SCHEDULING 94#ifdef HAVE_PRIORITY_SCHEDULING
@@ -108,7 +108,7 @@ struct queue_sender_list
108 108
109struct event_queue 109struct event_queue
110{ 110{
111 struct thread_entry *queue; /* waiter list */ 111 struct __wait_queue queue; /* waiter list */
112 struct queue_event events[QUEUE_LENGTH]; /* list of events */ 112 struct queue_event events[QUEUE_LENGTH]; /* list of events */
113 unsigned int volatile read; /* head of queue */ 113 unsigned int volatile read; /* head of queue */
114 unsigned int volatile write; /* tail of queue */ 114 unsigned int volatile write; /* tail of queue */
diff --git a/firmware/kernel/include/semaphore.h b/firmware/kernel/include/semaphore.h
index 16095d9c2d..1d604a4e76 100644
--- a/firmware/kernel/include/semaphore.h
+++ b/firmware/kernel/include/semaphore.h
@@ -26,10 +26,10 @@
26 26
27struct semaphore 27struct semaphore
28{ 28{
29 struct thread_entry *queue; /* Waiter list */ 29 struct __wait_queue queue; /* Waiter list */
30 int volatile count; /* # of waits remaining before unsignaled */ 30 int volatile count; /* # of waits remaining before unsignaled */
31 int max; /* maximum # of waits to remain signaled */ 31 int max; /* maximum # of waits to remain signaled */
32 IF_COP( struct corelock cl; ) /* multiprocessor sync */ 32 IF_COP( struct corelock cl; ) /* multiprocessor sync */
33}; 33};
34 34
35extern void semaphore_init(struct semaphore *s, int max, int start); 35extern void semaphore_init(struct semaphore *s, int max, int start);
diff --git a/firmware/kernel/include/thread.h b/firmware/kernel/include/thread.h
index 5a8bff0107..dfb632785e 100644
--- a/firmware/kernel/include/thread.h
+++ b/firmware/kernel/include/thread.h
@@ -26,6 +26,7 @@
26#include <stdbool.h> 26#include <stdbool.h>
27#include "config.h" 27#include "config.h"
28#include "gcc_extensions.h" 28#include "gcc_extensions.h"
29#include "linked_list.h"
29#include "bitarray.h" 30#include "bitarray.h"
30#include "corelock.h" 31#include "corelock.h"
31 32
@@ -52,7 +53,7 @@
52#define PRIORITY_REALTIME_4 4 53#define PRIORITY_REALTIME_4 4
53#define PRIORITY_REALTIME 4 /* Lowest realtime range */ 54#define PRIORITY_REALTIME 4 /* Lowest realtime range */
54#define PRIORITY_BUFFERING 15 /* Codec buffering thread */ 55#define PRIORITY_BUFFERING 15 /* Codec buffering thread */
55#define PRIORITY_USER_INTERFACE 16 /* The main thread */ 56#define PRIORITY_USER_INTERFACE 16 /* For most UI thrads */
56#define PRIORITY_RECORDING 16 /* Recording thread */ 57#define PRIORITY_RECORDING 16 /* Recording thread */
57#define PRIORITY_PLAYBACK 16 /* Variable between this and MAX */ 58#define PRIORITY_PLAYBACK 16 /* Variable between this and MAX */
58#define PRIORITY_PLAYBACK_MAX 5 /* Maximum allowable playback priority */ 59#define PRIORITY_PLAYBACK_MAX 5 /* Maximum allowable playback priority */
@@ -61,6 +62,7 @@
61#define NUM_PRIORITIES 32 62#define NUM_PRIORITIES 32
62#define PRIORITY_IDLE 32 /* Priority representative of no tasks */ 63#define PRIORITY_IDLE 32 /* Priority representative of no tasks */
63 64
65#define PRIORITY_MAIN_THREAD PRIORITY_USER_INTERFACE
64#define IO_PRIORITY_IMMEDIATE 0 66#define IO_PRIORITY_IMMEDIATE 0
65#define IO_PRIORITY_BACKGROUND 32 67#define IO_PRIORITY_BACKGROUND 32
66 68
@@ -108,6 +110,9 @@ extern unsigned sleep(unsigned ticks);
108#define IFN_PRIO(...) __VA_ARGS__ 110#define IFN_PRIO(...) __VA_ARGS__
109#endif 111#endif
110 112
113#define __wait_queue lld_head
114#define __wait_queue_node lld_node
115
111/* Basic structure describing the owner of an object */ 116/* Basic structure describing the owner of an object */
112struct blocker 117struct blocker
113{ 118{
@@ -168,6 +173,7 @@ int thread_get_priority(unsigned int thread_id);
168void thread_set_io_priority(unsigned int thread_id, int io_priority); 173void thread_set_io_priority(unsigned int thread_id, int io_priority);
169int thread_get_io_priority(unsigned int thread_id); 174int thread_get_io_priority(unsigned int thread_id);
170#endif /* HAVE_IO_PRIORITY */ 175#endif /* HAVE_IO_PRIORITY */
176
171#if NUM_CORES > 1 177#if NUM_CORES > 1
172unsigned int switch_core(unsigned int new_core); 178unsigned int switch_core(unsigned int new_core);
173#endif 179#endif
@@ -186,11 +192,21 @@ int core_get_debug_info(unsigned int core, struct core_debug_info *infop);
186 192
187#endif /* NUM_CORES */ 193#endif /* NUM_CORES */
188 194
195#ifdef HAVE_SDL_THREADS
196#define IF_SDL(x...) x
197#define IFN_SDL(x...)
198#else
199#define IF_SDL(x...)
200#define IFN_SDL(x...) x
201#endif
202
189struct thread_debug_info 203struct thread_debug_info
190{ 204{
191 char statusstr[4]; 205 char statusstr[4];
192 char name[32]; 206 char name[32];
207#ifndef HAVE_SDL_THREADS
193 unsigned int stack_usage; 208 unsigned int stack_usage;
209#endif
194#if NUM_CORES > 1 210#if NUM_CORES > 1
195 unsigned int core; 211 unsigned int core;
196#endif 212#endif