dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

Abstracts the concept of a thread to hide different implementations. More...

Macros

#define PIOS_THREAD_TIMEOUT_MAX   0xffffffff
 
#define PIOS_THREAD_STACK_SIZE_MIN   (4096)
 

Enumerations

enum  pios_thread_prio_e { PIOS_THREAD_PRIO_LOW = 0, PIOS_THREAD_PRIO_NORMAL, PIOS_THREAD_PRIO_HIGH, PIOS_THREAD_PRIO_HIGHEST }
 

Functions

struct pios_thread * PIOS_Thread_Create (void(*fp)(void *), const char *namep, size_t stack_bytes, void *argp, enum pios_thread_prio_e prio)
 
void PIOS_Thread_Delete (struct pios_thread *threadp)
 
uint32_t PIOS_Thread_Systime (void)
 
void PIOS_Thread_Sleep (uint32_t time_ms)
 
void PIOS_Thread_Sleep_Until (uint32_t *previous_ms, uint32_t increment_ms)
 
uint32_t PIOS_Thread_Get_Stack_Usage (struct pios_thread *threadp)
 
uint32_t PIOS_Thread_Get_Runtime (struct pios_thread *threadp)
 
void PIOS_Thread_Scheduler_Suspend (void)
 
void PIOS_Thread_Scheduler_Resume (void)
 
bool PIOS_Thread_Period_Elapsed (const uint32_t prev_systime, const uint32_t increment_ms)
 Determine if a period has elapsed since a datum. More...
 
struct pios_thread * PIOS_Thread_WrapCurrentThread (const char *namep)
 Creates a handle for the current thread. More...
 
void PIOS_Thread_ChangePriority (enum pios_thread_prio_e prio)
 
bool __attribute__ ((weak))
 
static uint32_t PIOS_Thread_GetClock_Impl ()
 
bool PIOS_Thread_FakeClock_IsActive (void)
 

Variables

static volatile uint32_t fake_clock
 
static pthread_cond_t fake_clock_cond = PTHREAD_COND_INITIALIZER
 
static pthread_mutex_t fake_clock_mutex = PTHREAD_MUTEX_INITIALIZER
 

Detailed Description

Abstracts the concept of a thread to hide different implementations.

Macro Definition Documentation

#define PIOS_THREAD_STACK_SIZE_MIN   (4096)

Definition at line 55 of file pios_thread.h.

#define PIOS_THREAD_TIMEOUT_MAX   0xffffffff

Definition at line 29 of file pios_thread.h.

Enumeration Type Documentation

Enumerator
PIOS_THREAD_PRIO_LOW 
PIOS_THREAD_PRIO_NORMAL 
PIOS_THREAD_PRIO_HIGH 
PIOS_THREAD_PRIO_HIGHEST 

Definition at line 57 of file pios_thread.h.

Function Documentation

bool __attribute__ ( (weak )

Definition at line 35 of file pios_thread.c.

void PIOS_Thread_ChangePriority ( enum pios_thread_prio_e  prio)

Definition at line 78 of file pios_thread.c.

struct pios_thread * PIOS_Thread_Create ( void(*)(void *)  fp,
const char *  namep,
size_t  stack_bytes,
void *  argp,
enum pios_thread_prio_e  prio 
)

Definition at line 89 of file pios_thread.c.

void PIOS_Thread_Delete ( struct pios_thread *  threadp)

Definition at line 132 of file pios_thread.c.

bool PIOS_Thread_FakeClock_IsActive ( void  )

Definition at line 207 of file pios_thread.c.

uint32_t PIOS_Thread_Get_Runtime ( struct pios_thread *  threadp)
Todo:

Definition at line 276 of file pios_thread.c.

uint32_t PIOS_Thread_Get_Stack_Usage ( struct pios_thread *  threadp)
Todo:

Definition at line 271 of file pios_thread.c.

static uint32_t PIOS_Thread_GetClock_Impl ( )
inlinestatic

Definition at line 151 of file pios_thread.c.

bool PIOS_Thread_Period_Elapsed ( const uint32_t  prev_systime,
const uint32_t  increment_ms 
)

Determine if a period has elapsed since a datum.

Parameters
[in]prev_systimeOpaque timestamp (at least in future) from PIOS_Thread_Systime()
[in]increment_msThe period in ms
Return values
trueif period has elapsed, false otherwise

Definition at line 281 of file pios_thread.c.

void PIOS_Thread_Scheduler_Resume ( void  )
void PIOS_Thread_Scheduler_Suspend ( void  )
void PIOS_Thread_Sleep ( uint32_t  time_ms)

Definition at line 229 of file pios_thread.c.

void PIOS_Thread_Sleep_Until ( uint32_t *  previous_ms,
uint32_t  increment_ms 
)

Definition at line 255 of file pios_thread.c.

uint32_t PIOS_Thread_Systime ( void  )

Definition at line 212 of file pios_thread.c.

struct pios_thread * PIOS_Thread_WrapCurrentThread ( const char *  namep)

Creates a handle for the current thread.

Parameters
[in]nameppointer to thread name
Returns
instance of struct pios_thread or NULL on failure

Definition at line 51 of file pios_thread.c.

Variable Documentation

volatile uint32_t fake_clock
static

Definition at line 147 of file pios_thread.c.

pthread_cond_t fake_clock_cond = PTHREAD_COND_INITIALIZER
static

Definition at line 148 of file pios_thread.c.

pthread_mutex_t fake_clock_mutex = PTHREAD_MUTEX_INITIALIZER
static

Definition at line 149 of file pios_thread.c.