git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7380 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
855065f239
commit
66ff6722d2
|
@ -108,6 +108,39 @@ osStatus osKernelStart(void) {
|
||||||
return osOK;
|
return osOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Creates a thread.
|
||||||
|
*/
|
||||||
|
osThreadId osThreadCreate (osThreadDef_t *thread_def, void *argument) {
|
||||||
|
size_t size;
|
||||||
|
|
||||||
|
size = thread_def->stacksize == 0 ? CMSIS_CFG_DEFAULT_STACK :
|
||||||
|
thread_def->stacksize;
|
||||||
|
return (osThreadId)chThdCreateFromHeap(0,
|
||||||
|
THD_WORKING_AREA_SIZE(size),
|
||||||
|
NORMALPRIO+thread_def->tpriority,
|
||||||
|
(tfunc_t)thread_def->pthread,
|
||||||
|
argument);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Thread termination.
|
||||||
|
* @note The thread is not really terminated but asked to terminate which
|
||||||
|
* is not compliant.
|
||||||
|
*/
|
||||||
|
osStatus osThreadTerminate(osThreadId thread_id) {
|
||||||
|
|
||||||
|
if (thread_id == osThreadGetId()) {
|
||||||
|
/* Note, no memory will be recovered unless a cleaner thread is
|
||||||
|
implemented using the registry.*/
|
||||||
|
chThdExit(0);
|
||||||
|
}
|
||||||
|
chThdTerminate(thread_id);
|
||||||
|
chThdWait((thread_t *)thread_id);
|
||||||
|
|
||||||
|
return osOK;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Change thread priority.
|
* @brief Change thread priority.
|
||||||
* @note This can interfere with the priority inheritance mechanism.
|
* @note This can interfere with the priority inheritance mechanism.
|
||||||
|
|
|
@ -83,6 +83,13 @@
|
||||||
/* Module pre-compile time settings. */
|
/* Module pre-compile time settings. */
|
||||||
/*===========================================================================*/
|
/*===========================================================================*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Number of pre-allocated static semaphores/mutexes.
|
||||||
|
*/
|
||||||
|
#if !defined(CMSIS_CFG_DEFAULT_STACK)
|
||||||
|
#define CMSIS_CFG_DEFAULT_STACK 256
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Number of pre-allocated static semaphores/mutexes.
|
* @brief Number of pre-allocated static semaphores/mutexes.
|
||||||
*/
|
*/
|
||||||
|
@ -340,6 +347,8 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
osStatus osKernelInitialize(void);
|
osStatus osKernelInitialize(void);
|
||||||
osStatus osKernelStart(void);
|
osStatus osKernelStart(void);
|
||||||
|
osThreadId osThreadCreate (osThreadDef_t *thread_def, void *argument);
|
||||||
|
osStatus osThreadTerminate (osThreadId thread_id);
|
||||||
osStatus osThreadSetPriority(osThreadId thread_id, osPriority newprio);
|
osStatus osThreadSetPriority(osThreadId thread_id, osPriority newprio);
|
||||||
/*osEvent osWait(uint32_t millisec);*/
|
/*osEvent osWait(uint32_t millisec);*/
|
||||||
osTimerId osTimerCreate (const osTimerDef_t *timer_def,
|
osTimerId osTimerCreate (const osTimerDef_t *timer_def,
|
||||||
|
@ -384,19 +393,6 @@ static inline uint32_t osKernelSysTick(void) {
|
||||||
return (uint32_t)chVTGetSystemTimeX();
|
return (uint32_t)chVTGetSystemTimeX();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Creates a thread.
|
|
||||||
*/
|
|
||||||
static inline osThreadId osThreadCreate (osThreadDef_t *thread_def,
|
|
||||||
void *argument) {
|
|
||||||
|
|
||||||
return (osThreadId)chThdCreateFromHeap(0,
|
|
||||||
THD_WORKING_AREA_SIZE(thread_def->stacksize),
|
|
||||||
NORMALPRIO+thread_def->tpriority,
|
|
||||||
(tfunc_t)thread_def->pthread,
|
|
||||||
argument);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the current thread.
|
* @brief Returns the current thread.
|
||||||
*/
|
*/
|
||||||
|
@ -405,18 +401,6 @@ static inline osThreadId osThreadGetId(void) {
|
||||||
return (osThreadId)chThdGetSelfX();
|
return (osThreadId)chThdGetSelfX();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Thread termination.
|
|
||||||
* @note The thread is not really terminated but asked to terminate which
|
|
||||||
* is not compliant.
|
|
||||||
*/
|
|
||||||
static inline osStatus osThreadTerminate(osThreadId thread_id) {
|
|
||||||
|
|
||||||
chThdTerminate(thread_id);
|
|
||||||
|
|
||||||
return osOK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Thread time slice yield.
|
* @brief Thread time slice yield.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue