git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@434 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
8248aca282
commit
2a9e6947a1
|
@ -5,7 +5,7 @@
|
|||
#---------------------------------------------------------------------------
|
||||
DOXYFILE_ENCODING = UTF-8
|
||||
PROJECT_NAME = ChibiOS/RT
|
||||
PROJECT_NUMBER = "0.7.0 beta"
|
||||
PROJECT_NUMBER = "0.7.1 beta"
|
||||
OUTPUT_DIRECTORY = .
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td style="text-align: center; vertical-align: top; width: 150px;">Current
|
||||
Version 0.7.0<br>
|
||||
Version 0.7.1<br>
|
||||
-<br>
|
||||
<a href="http://sourceforge.net/projects/chibios/" rel="me" target="_top">Project on SourceForge</a><br>
|
||||
<a href="html/index.html" target="_top" rel="me">Documentation</a><br>
|
||||
|
|
|
@ -74,6 +74,15 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
|||
*** Releases ***
|
||||
*****************************************************************************
|
||||
|
||||
*** 0.7.1 ***
|
||||
- NEW: New chThdInit() API, this API allows to quickly create threads in the
|
||||
PRSUSPENDED state. This API also allows to start threads from interrupt
|
||||
handlers.
|
||||
- CHANGE: The chThdCreate() API no more has the mode parameter, a different
|
||||
API is now used in order to start suspended threads.
|
||||
- FIX: The chThdCreate() had a regression in 0.7.0, the mode parameter was
|
||||
ignored. Note that in this version the mode parameter had been removed.
|
||||
|
||||
*** 0.7.0 ***
|
||||
- NEW: Memory Heap Allocator functionality added. The allocator implements a
|
||||
first-fit strategy but there is an option that allow it to wrap the compiler
|
||||
|
|
|
@ -49,7 +49,7 @@ void chSysInit(void) {
|
|||
/*
|
||||
* Now this instructions flow becomes the main thread.
|
||||
*/
|
||||
init_thread(NORMALPRIO, 0, &mainthread);
|
||||
init_thread(NORMALPRIO, &mainthread);
|
||||
mainthread.p_state = PRCURR;
|
||||
currp = &mainthread;
|
||||
|
||||
|
@ -61,8 +61,8 @@ void chSysInit(void) {
|
|||
* serve interrupts in its context while keeping the lowest energy saving
|
||||
* mode compatible with the system status.
|
||||
*/
|
||||
chThdCreateFast(IDLEPRIO, waIdleThread,
|
||||
sizeof(waIdleThread), (tfunc_t)_IdleThread);
|
||||
chThdCreateFast(IDLEPRIO, waIdleThread, sizeof(waIdleThread),
|
||||
(tfunc_t)_IdleThread);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,12 +27,13 @@
|
|||
/*
|
||||
* Initializes a thread structure.
|
||||
*/
|
||||
void init_thread(tprio_t prio, tmode_t mode, Thread *tp) {
|
||||
void init_thread(tprio_t prio, Thread *tp) {
|
||||
static tid_t nextid = 0;
|
||||
|
||||
tp->p_tid = nextid++;
|
||||
tp->p_flags = mode;
|
||||
tp->p_flags = 0;
|
||||
tp->p_prio = prio;
|
||||
tp->p_state = PRSUSPENDED;
|
||||
#ifdef CH_USE_MUTEXES
|
||||
/* realprio is the thread's own, non-inherited, priority */
|
||||
tp->p_realprio = prio;
|
||||
|
@ -63,24 +64,46 @@ static void memfill(uint8_t *p, uint32_t n, uint8_t v) {
|
|||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Initializes a new thread.
|
||||
* The new thread is initialized but not inserted in the ready list, the
|
||||
* initial state is \p PRSUSPENDED.
|
||||
* @param prio the priority level for the new thread. Usually the threads are
|
||||
* created with priority \p NORMALPRIO, priorities
|
||||
* can range from \p LOWPRIO to \p HIGHPRIO.
|
||||
* @param workspace pointer to a working area dedicated to the thread stack
|
||||
* @param wsize size of the working area.
|
||||
* @param pf the thread function. Returning from this function automatically
|
||||
* terminates the thread.
|
||||
* @param arg an argument passed to the thread function. It can be \p NULL.
|
||||
* @return the pointer to the \p Thread structure allocated for the
|
||||
* thread into the working space area.
|
||||
* @note A thread can terminate by calling \p chThdExit() or by simply
|
||||
* returning from its main function.
|
||||
* @note This function can be used to start a thead from within an interrupt
|
||||
* handler by manually making it ready with \p chSchReadyI().
|
||||
*/
|
||||
Thread *chThdInit(tprio_t prio, void *workspace,
|
||||
size_t wsize, tfunc_t pf, void *arg) {
|
||||
/* thread structure is layed out in the lower part of the thread workspace */
|
||||
Thread *tp = workspace;
|
||||
|
||||
chDbgAssert((wsize >= UserStackSize(0)) && (prio <= HIGHPRIO) &&
|
||||
(workspace != NULL) && (pf != NULL),
|
||||
"chthreads.c, chThdInit()");
|
||||
#ifdef CH_USE_DEBUG
|
||||
memfill(workspace, wsize, MEM_FILL_PATTERN);
|
||||
#endif
|
||||
SETUP_CONTEXT(workspace, wsize, pf, arg);
|
||||
init_thread(prio, tp);
|
||||
return tp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new thread.
|
||||
* @param prio the priority level for the new thread. Usually the threads are
|
||||
* created with priority \p NORMALPRIO, priorities
|
||||
* can range from \p LOWPRIO to \p HIGHPRIO.
|
||||
* @param mode the creation option flags for the thread. The following options
|
||||
* can be OR'ed in this parameter:<br>
|
||||
* <ul>
|
||||
* <li>\p P_SUSPENDED, the thread is created in the
|
||||
* \p PRSUSPENDED state and a subsequent call to
|
||||
* \p chThdResume() will make it ready for
|
||||
* execution.</li>
|
||||
* <li>\p P_TERMINATED, this flag is usually set
|
||||
* by the \p chThdTerminate() function and it is not
|
||||
* normally used as parameter for this function. The
|
||||
* result would be to create a thread with a termination
|
||||
* request already pending.</li>
|
||||
* </ul>
|
||||
* @param workspace pointer to a working area dedicated to the thread stack
|
||||
* @param wsize size of the working area.
|
||||
* @param pf the thread function. Returning from this function automatically
|
||||
|
@ -91,30 +114,13 @@ static void memfill(uint8_t *p, uint32_t n, uint8_t v) {
|
|||
* @note A thread can terminate by calling \p chThdExit() or by simply
|
||||
* returning from its main function.
|
||||
*/
|
||||
Thread *chThdCreate(tprio_t prio, tmode_t mode, void *workspace,
|
||||
Thread *chThdCreate(tprio_t prio, void *workspace,
|
||||
size_t wsize, tfunc_t pf, void *arg) {
|
||||
/* thread structure is layed out in the lower part of the thread workspace */
|
||||
Thread *tp = workspace;
|
||||
|
||||
chDbgAssert((wsize >= UserStackSize(0)) && (prio <= HIGHPRIO) &&
|
||||
(workspace != NULL) && (pf != NULL),
|
||||
"chthreads.c, chThdCreate()");
|
||||
#ifdef CH_USE_DEBUG
|
||||
memfill(workspace, wsize, MEM_FILL_PATTERN);
|
||||
#endif
|
||||
SETUP_CONTEXT(workspace, wsize, pf, arg);
|
||||
init_thread(prio, mode, tp);
|
||||
#ifdef CH_USE_RESUME
|
||||
if (tp->p_flags & P_SUSPENDED)
|
||||
tp->p_state = PRSUSPENDED;
|
||||
else {
|
||||
#endif
|
||||
chSysLock();
|
||||
chSchWakeupS(tp, RDY_OK);
|
||||
chSysUnlock();
|
||||
#ifdef CH_USE_RESUME
|
||||
}
|
||||
#endif
|
||||
Thread *tp = chThdInit(prio, workspace, wsize, pf, arg);
|
||||
chSysLock();
|
||||
chSchWakeupS(tp, RDY_OK);
|
||||
chSysUnlock();
|
||||
return tp;
|
||||
}
|
||||
|
||||
|
@ -131,19 +137,12 @@ Thread *chThdCreate(tprio_t prio, tmode_t mode, void *workspace,
|
|||
* thread into the working space area.
|
||||
* @note A thread can terminate by calling \p chThdExit() or by simply
|
||||
* returning from its main function.
|
||||
* @deprecated
|
||||
*/
|
||||
Thread *chThdCreateFast(tprio_t prio, void *workspace,
|
||||
size_t wsize, tfunc_t pf) {
|
||||
Thread *tp = workspace;
|
||||
|
||||
chDbgAssert((wsize >= UserStackSize(0)) && (prio <= HIGHPRIO) &&
|
||||
(workspace != NULL) && (pf != NULL),
|
||||
"chthreads.c, chThdCreateFast()");
|
||||
#ifdef CH_USE_DEBUG
|
||||
memfill(workspace, wsize, MEM_FILL_PATTERN);
|
||||
#endif
|
||||
SETUP_CONTEXT(workspace, wsize, pf, NULL);
|
||||
init_thread(prio, 0, tp);
|
||||
Thread *tp = chThdInit(prio, workspace, wsize, pf, NULL);
|
||||
chSysLock();
|
||||
chSchWakeupS(tp, RDY_OK);
|
||||
chSysUnlock();
|
||||
|
|
|
@ -153,7 +153,7 @@ struct Thread {
|
|||
#define ABSPRIO 255
|
||||
|
||||
/* Not an API, don't use into the application code.*/
|
||||
void init_thread(tprio_t prio, tmode_t mode, Thread *tp);
|
||||
void init_thread(tprio_t prio, Thread *tp);
|
||||
|
||||
/** Thread function.*/
|
||||
typedef msg_t (*tfunc_t)(void *);
|
||||
|
@ -164,7 +164,9 @@ typedef msg_t (*tfunc_t)(void *);
|
|||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
Thread *chThdCreate(tprio_t prio, tmode_t mode, void *workspace,
|
||||
Thread *chThdInit(tprio_t prio, void *workspace,
|
||||
size_t wsize, tfunc_t pf, void *arg);
|
||||
Thread *chThdCreate(tprio_t prio, void *workspace,
|
||||
size_t wsize, tfunc_t pf, void *arg);
|
||||
Thread *chThdCreateFast(tprio_t prio, void *workspace,
|
||||
size_t wsize, tfunc_t pf);
|
||||
|
|
|
@ -47,7 +47,7 @@ static msg_t thread(void *p) {
|
|||
static void msg1_execute(void) {
|
||||
msg_t msg;
|
||||
|
||||
threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread, chThdSelf());
|
||||
threads[0] = chThdCreate(chThdGetPriority()-1, wa[0], STKSIZE, thread, chThdSelf());
|
||||
do {
|
||||
chMsgRelease(msg = chMsgWait());
|
||||
if (msg)
|
||||
|
|
|
@ -52,11 +52,11 @@ static void mtx1_execute(void) {
|
|||
|
||||
tprio_t prio = chThdGetPriority(); // Bacause priority inheritance.
|
||||
chMtxLock(&m1);
|
||||
threads[0] = chThdCreate(prio+1, 0, wa[0], STKSIZE, thread1, "E");
|
||||
threads[1] = chThdCreate(prio+2, 0, wa[1], STKSIZE, thread1, "D");
|
||||
threads[2] = chThdCreate(prio+3, 0, wa[2], STKSIZE, thread1, "C");
|
||||
threads[3] = chThdCreate(prio+4, 0, wa[3], STKSIZE, thread1, "B");
|
||||
threads[4] = chThdCreate(prio+5, 0, wa[4], STKSIZE, thread1, "A");
|
||||
threads[0] = chThdCreate(prio+1, wa[0], STKSIZE, thread1, "E");
|
||||
threads[1] = chThdCreate(prio+2, wa[1], STKSIZE, thread1, "D");
|
||||
threads[2] = chThdCreate(prio+3, wa[2], STKSIZE, thread1, "C");
|
||||
threads[3] = chThdCreate(prio+4, wa[3], STKSIZE, thread1, "B");
|
||||
threads[4] = chThdCreate(prio+5, wa[4], STKSIZE, thread1, "A");
|
||||
chMtxUnlock();
|
||||
test_assert(prio == chThdGetPriority(), "priority return failure");
|
||||
test_wait_threads();
|
||||
|
@ -117,9 +117,9 @@ static msg_t thread4(void *p) {
|
|||
*/
|
||||
static void mtx2_execute(void) {
|
||||
|
||||
threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread2, "A");
|
||||
threads[1] = chThdCreate(chThdGetPriority()-3, 0, wa[1], STKSIZE, thread3, "C");
|
||||
threads[2] = chThdCreate(chThdGetPriority()-2, 0, wa[2], STKSIZE, thread4, "B");
|
||||
threads[0] = chThdCreate(chThdGetPriority()-1, wa[0], STKSIZE, thread2, "A");
|
||||
threads[1] = chThdCreate(chThdGetPriority()-3, wa[1], STKSIZE, thread3, "C");
|
||||
threads[2] = chThdCreate(chThdGetPriority()-2, wa[2], STKSIZE, thread4, "B");
|
||||
test_wait_threads();
|
||||
test_assert_sequence("ABC");
|
||||
}
|
||||
|
@ -206,11 +206,11 @@ static msg_t thread9(void *p) {
|
|||
*/
|
||||
static void mtx3_execute(void) {
|
||||
|
||||
threads[0] = chThdCreate(chThdGetPriority()-5, 0, wa[0], STKSIZE, thread5, "E");
|
||||
threads[1] = chThdCreate(chThdGetPriority()-4, 0, wa[1], STKSIZE, thread6, "D");
|
||||
threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread7, "C");
|
||||
threads[3] = chThdCreate(chThdGetPriority()-2, 0, wa[3], STKSIZE, thread8, "B");
|
||||
threads[4] = chThdCreate(chThdGetPriority()-1, 0, wa[4], STKSIZE, thread9, "A");
|
||||
threads[0] = chThdCreate(chThdGetPriority()-5, wa[0], STKSIZE, thread5, "E");
|
||||
threads[1] = chThdCreate(chThdGetPriority()-4, wa[1], STKSIZE, thread6, "D");
|
||||
threads[2] = chThdCreate(chThdGetPriority()-3, wa[2], STKSIZE, thread7, "C");
|
||||
threads[3] = chThdCreate(chThdGetPriority()-2, wa[3], STKSIZE, thread8, "B");
|
||||
threads[4] = chThdCreate(chThdGetPriority()-1, wa[4], STKSIZE, thread9, "A");
|
||||
test_wait_threads();
|
||||
test_assert_sequence("ABCDE");
|
||||
}
|
||||
|
|
|
@ -40,11 +40,11 @@ static void rdy1_teardown(void) {
|
|||
|
||||
static void rdy1_execute(void) {
|
||||
|
||||
threads[0] = chThdCreate(chThdGetPriority()-5, 0, wa[0], STKSIZE, thread, "E");
|
||||
threads[1] = chThdCreate(chThdGetPriority()-4, 0, wa[1], STKSIZE, thread, "D");
|
||||
threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread, "C");
|
||||
threads[3] = chThdCreate(chThdGetPriority()-2, 0, wa[3], STKSIZE, thread, "B");
|
||||
threads[4] = chThdCreate(chThdGetPriority()-1, 0, wa[4], STKSIZE, thread, "A");
|
||||
threads[0] = chThdCreate(chThdGetPriority()-5, wa[0], STKSIZE, thread, "E");
|
||||
threads[1] = chThdCreate(chThdGetPriority()-4, wa[1], STKSIZE, thread, "D");
|
||||
threads[2] = chThdCreate(chThdGetPriority()-3, wa[2], STKSIZE, thread, "C");
|
||||
threads[3] = chThdCreate(chThdGetPriority()-2, wa[3], STKSIZE, thread, "B");
|
||||
threads[4] = chThdCreate(chThdGetPriority()-1, wa[4], STKSIZE, thread, "A");
|
||||
test_wait_threads();
|
||||
test_assert_sequence("ABCDE");
|
||||
}
|
||||
|
@ -69,11 +69,11 @@ static void rdy2_teardown(void) {
|
|||
|
||||
static void rdy2_execute(void) {
|
||||
|
||||
threads[1] = chThdCreate(chThdGetPriority()-4, 0, wa[1], STKSIZE, thread, "D");
|
||||
threads[0] = chThdCreate(chThdGetPriority()-5, 0, wa[0], STKSIZE, thread, "E");
|
||||
threads[4] = chThdCreate(chThdGetPriority()-1, 0, wa[4], STKSIZE, thread, "A");
|
||||
threads[3] = chThdCreate(chThdGetPriority()-2, 0, wa[3], STKSIZE, thread, "B");
|
||||
threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread, "C");
|
||||
threads[1] = chThdCreate(chThdGetPriority()-4, wa[1], STKSIZE, thread, "D");
|
||||
threads[0] = chThdCreate(chThdGetPriority()-5, wa[0], STKSIZE, thread, "E");
|
||||
threads[4] = chThdCreate(chThdGetPriority()-1, wa[4], STKSIZE, thread, "A");
|
||||
threads[3] = chThdCreate(chThdGetPriority()-2, wa[3], STKSIZE, thread, "B");
|
||||
threads[2] = chThdCreate(chThdGetPriority()-3, wa[2], STKSIZE, thread, "C");
|
||||
test_wait_threads();
|
||||
test_assert_sequence("ABCDE");
|
||||
}
|
||||
|
|
|
@ -47,11 +47,11 @@ static msg_t thread(void *p) {
|
|||
|
||||
static void sem1_execute(void) {
|
||||
|
||||
threads[0] = chThdCreate(chThdGetPriority()+5, 0, wa[0], STKSIZE, thread, "A");
|
||||
threads[1] = chThdCreate(chThdGetPriority()+1, 0, wa[1], STKSIZE, thread, "B");
|
||||
threads[2] = chThdCreate(chThdGetPriority()+3, 0, wa[2], STKSIZE, thread, "C");
|
||||
threads[3] = chThdCreate(chThdGetPriority()+4, 0, wa[3], STKSIZE, thread, "D");
|
||||
threads[4] = chThdCreate(chThdGetPriority()+2, 0, wa[4], STKSIZE, thread, "E");
|
||||
threads[0] = chThdCreate(chThdGetPriority()+5, wa[0], STKSIZE, thread, "A");
|
||||
threads[1] = chThdCreate(chThdGetPriority()+1, wa[1], STKSIZE, thread, "B");
|
||||
threads[2] = chThdCreate(chThdGetPriority()+3, wa[2], STKSIZE, thread, "C");
|
||||
threads[3] = chThdCreate(chThdGetPriority()+4, wa[3], STKSIZE, thread, "D");
|
||||
threads[4] = chThdCreate(chThdGetPriority()+2, wa[4], STKSIZE, thread, "E");
|
||||
chSemSignal(&sem1);
|
||||
chSemSignal(&sem1);
|
||||
chSemSignal(&sem1);
|
||||
|
|
Loading…
Reference in New Issue