EE445M RTOS
Taken at the University of Texas Spring 2015
thread_structures.h File Reference
#include "libstd/defines.h"
Include dependency graph for thread_structures.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  tcb_t
 
struct  sched_task
 
struct  sched_task_pool
 

Macros

#define SEMAPHORE_DEFAULT_VALUE   0
 
#define spinlock_until(blocker)   while (!(*blocker))
 
#define sem_init_(sem, initial_value)
 
#define sem_guard(sem)   if(!semaphore_blocked(sem))
 
#define sem_take(sem)
 
#define sem_check(sem)
 
#define sem_init(sem)   sem_init_(sem, SEMAPHORE_DEFAULT_VALUE)
 
#define sem_signal(sem)   sem_post(sem)
 
#define sem_post(sem)
 
#define sem_wait(sem)
 
#define semaphore_blocked(sem)   (sem <= 0)
 
#define thread_blocked(tcb_t)   (tcb_t->sem != NULL)
 

Typedefs

typedef uint32_t tick_t
 
typedef int8_t semaphore_t
 
typedef uint8_t priority_t
 
typedef int32_t deadline_t
 
typedef int32_t microseconds_t
 
typedef struct tcb_t tcb_t
 
typedef struct sched_task sched_task
 
typedef struct sched_task_pool sched_task_pool
 

Enumerations

enum  DEADLINE_TYPE { DL_HARD, DL_SOFT }
 

Macro Definition Documentation

#define sem_check (   sem)

Definition at line 48 of file thread_structures.h.

#define sem_guard (   sem)    if(!semaphore_blocked(sem))

Guard the following code block to evaluate only in the semaphore may be obtained.

Definition at line 36 of file thread_structures.h.

Referenced by display_adc_data_for_checkout(), hw_daemon(), led_blink_green(), and postpone_suicide().

#define sem_init (   sem)    sem_init_(sem, SEMAPHORE_DEFAULT_VALUE)

Initialize a semaphore_t to .

Definition at line 51 of file thread_structures.h.

Referenced by main().

#define sem_init_ (   sem,
  initial_value 
)
Value:
sem = initial_value
int8_t semaphore_t
volatile uint32_t sem
Definition: test-timer.c:31

Initialize to .

Definition at line 30 of file thread_structures.h.

#define sem_post (   sem)
Value:
atomic ( \
++sem; \
/* TODO: wake thread */ \
)
#define atomic(x)
Definition: nexus.h:32
volatile uint32_t sem
Definition: test-timer.c:31

Signal and update all threads watching . If the highest priority thread watching is released by this post, and it is of a higher priority than the currently executing thread, then suspend the current thread. The thread-context switcher will then choose the higher-priority thread to execute.

Definition at line 64 of file thread_structures.h.

Referenced by ADC0Seq2_Handler(), button_debounce_end(), timer_task(), and UART0_Handler().

#define sem_signal (   sem)    sem_post(sem)

A convenience alias to to allow comparison of source code to course documents.

Definition at line 56 of file thread_structures.h.

Referenced by TIMER0A_Handler().

#define sem_take (   sem)
Value:
atomic ( \
--sem; \
/* TODO: wake thread */ \
)
#define atomic(x)
Definition: nexus.h:32
volatile uint32_t sem
Definition: test-timer.c:31

without the br, to be used when you know you can take the semaphore.

Definition at line 41 of file thread_structures.h.

Referenced by display_adc_data_for_checkout(), hw_daemon(), led_blink_green(), and postpone_suicide().

#define sem_wait (   sem)
Value:
} \
--sem; \
)
#define atomic(x)
Definition: nexus.h:32
#define os_surrender_context()
Definition: os.h:142
volatile uint32_t sem
Definition: test-timer.c:31
#define semaphore_blocked(sem)

Stall execution of current thread until is nonblocking. If becomes blocking during this invocation, call for the current executing thread.

Definition at line 73 of file thread_structures.h.

#define semaphore_blocked (   sem)    (sem <= 0)

Conditional evaluating to true when a semaphore is blocked by virtue of being non-NULL.

Definition at line 83 of file thread_structures.h.

Referenced by Task1().

#define SEMAPHORE_DEFAULT_VALUE   0

The default initialization value of a semaphore_t.

Definition at line 20 of file thread_structures.h.

#define spinlock_until (   blocker)    while (!(*blocker))

Spinlock until is non-zero.

Definition at line 26 of file thread_structures.h.

#define thread_blocked (   tcb_t)    (tcb_t->sem != NULL)

Conditional evaluating to true when a thread's tcb_t is blocked by a semaphore.

Definition at line 88 of file thread_structures.h.

Typedef Documentation

typedef int32_t deadline_t

Definition at line 95 of file thread_structures.h.

typedef int32_t microseconds_t

Definition at line 96 of file thread_structures.h.

typedef uint8_t priority_t

OS thread priority levels; 0 is highest.

Definition at line 93 of file thread_structures.h.

typedef struct sched_task sched_task
typedef int8_t semaphore_t

Typedef of a semaphore.

Definition at line 23 of file thread_structures.h.

typedef struct tcb_t tcb_t

Thread Control Block definition

typedef uint32_t tick_t

Count of SysTick ticks (each of which is equivalent to a bus cycle). Note that the SysTick can only count down from a 24-bit register.

Definition at line 17 of file thread_structures.h.

Enumeration Type Documentation

Enumerator
DL_HARD 
DL_SOFT 

Definition at line 98 of file thread_structures.h.

98  {
99  DL_HARD,
100  DL_SOFT,
101 } DEADLINE_TYPE;
DEADLINE_TYPE