git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@332 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
0b7254491c
commit
e5bd637729
|
@ -131,8 +131,8 @@ int main(int argc, char **argv) {
|
|||
* are not started in order to make accurate benchmarks.
|
||||
*/
|
||||
if ((IO0PIN & 0x00018000) == 0x00018000) {
|
||||
chThdCreate(NORMALPRIO, 0, waThread1, sizeof(waThread1), Thread1, NULL);
|
||||
chThdCreate(NORMALPRIO, 0, waThread2, sizeof(waThread2), Thread2, NULL);
|
||||
chThdCreateFast(NORMALPRIO, waThread1, sizeof(waThread1), Thread1);
|
||||
chThdCreateFast(NORMALPRIO, waThread2, sizeof(waThread2), Thread2);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -75,10 +75,14 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
|
|||
*****************************************************************************
|
||||
|
||||
*** 0.6.7 ***
|
||||
- NEW: New chThdCreateFast() API, it is a simplified form of chThdCreate()
|
||||
that allows even faster threads creation. The new API does not support
|
||||
the "mode" and "arg" parameters (still available in the old API).
|
||||
- OPT: Removed an unrequired initialization from the chThdCreate().
|
||||
- OPT: Improvements to the test framework, now a virtual timer is used instead
|
||||
of software loops into the bechmarks in order to have more stable results.
|
||||
- Added the C++ wrapper entries to the documentation.
|
||||
- Fixed the documentation entry for the chThdCreate() API.
|
||||
|
||||
*** 0.6.6 ***
|
||||
- NEW: Improved test suite, now the suite is divided in modules and the code
|
||||
|
|
|
@ -55,7 +55,8 @@ void chSysInit(void) {
|
|||
* serve interrupts in its context while keeping the lowest energy saving
|
||||
* mode compatible with the system status.
|
||||
*/
|
||||
chThdCreate(IDLEPRIO, 0, waIdleThread, sizeof(waIdleThread), (tfunc_t)_IdleThread, NULL);
|
||||
chThdCreateFast(IDLEPRIO, waIdleThread,
|
||||
sizeof(waIdleThread), (tfunc_t)_IdleThread);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,9 +62,8 @@ static void memfill(uint8_t *p, uint32_t n, uint8_t v) {
|
|||
/**
|
||||
* Creates a new thread.
|
||||
* @param prio the priority level for the new thread. Usually the threads are
|
||||
* created with priority \p NORMALPRIO (128), priorities
|
||||
* can range from \p LOWPRIO (1) to \p HIGHPRIO
|
||||
* (255).
|
||||
* 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>
|
||||
|
@ -106,9 +105,7 @@ Thread *chThdCreate(tprio_t prio, tmode_t mode, void *workspace,
|
|||
else {
|
||||
#endif
|
||||
chSysLock();
|
||||
|
||||
chSchWakeupS(tp, RDY_OK);
|
||||
|
||||
chSysUnlock();
|
||||
#ifdef CH_USE_RESUME
|
||||
}
|
||||
|
@ -116,6 +113,38 @@ Thread *chThdCreate(tprio_t prio, tmode_t mode, void *workspace,
|
|||
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 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.
|
||||
* @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.
|
||||
*/
|
||||
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
|
||||
init_thread(prio, 0, tp);
|
||||
SETUP_CONTEXT(workspace, wsize, pf, NULL);
|
||||
chSysLock();
|
||||
chSchWakeupS(tp, RDY_OK);
|
||||
chSysUnlock();
|
||||
return tp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the thread priority, reschedules if necessary.
|
||||
* @param newprio the new priority of the invoking thread
|
||||
|
|
|
@ -170,6 +170,8 @@ extern "C" {
|
|||
#endif
|
||||
Thread *chThdCreate(tprio_t prio, tmode_t mode, void *workspace,
|
||||
size_t wsize, tfunc_t pf, void *arg);
|
||||
Thread *chThdCreateFast(tprio_t prio, void *workspace,
|
||||
size_t wsize, tfunc_t pf);
|
||||
void chThdSetPriority(tprio_t newprio);
|
||||
void chThdExit(msg_t msg);
|
||||
#ifdef CH_USE_RESUME
|
||||
|
|
|
@ -61,7 +61,7 @@ static void bmk1_teardown(void) {
|
|||
static void bmk1_execute(void) {
|
||||
uint32_t n;
|
||||
|
||||
threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread1, 0);
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()-1, wa[0], STKSIZE, thread1);
|
||||
n = msg_loop_test(threads[0]);
|
||||
chThdTerminate(threads[0]);
|
||||
test_wait_threads();
|
||||
|
@ -93,7 +93,7 @@ static void bmk2_teardown(void) {
|
|||
static void bmk2_execute(void) {
|
||||
uint32_t n;
|
||||
|
||||
threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, 0);
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread1);
|
||||
n = msg_loop_test(threads[0]);
|
||||
chThdTerminate(threads[0]);
|
||||
test_wait_threads();
|
||||
|
@ -130,11 +130,11 @@ static void bmk3_teardown(void) {
|
|||
static void bmk3_execute(void) {
|
||||
uint32_t n;
|
||||
|
||||
threads[0] = chThdCreate(chThdGetPriority()+1, 0, wa[0], STKSIZE, thread1, 0);
|
||||
threads[1] = chThdCreate(chThdGetPriority()-2, 0, wa[1], STKSIZE, thread2, 0);
|
||||
threads[2] = chThdCreate(chThdGetPriority()-3, 0, wa[2], STKSIZE, thread2, 0);
|
||||
threads[3] = chThdCreate(chThdGetPriority()-4, 0, wa[3], STKSIZE, thread2, 0);
|
||||
threads[4] = chThdCreate(chThdGetPriority()-5, 0, wa[4], STKSIZE, thread2, 0);
|
||||
threads[0] = chThdCreateFast(chThdGetPriority()+1, wa[0], STKSIZE, thread1);
|
||||
threads[1] = chThdCreateFast(chThdGetPriority()-2, wa[1], STKSIZE, thread2);
|
||||
threads[2] = chThdCreateFast(chThdGetPriority()-3, wa[2], STKSIZE, thread2);
|
||||
threads[3] = chThdCreateFast(chThdGetPriority()-4, wa[3], STKSIZE, thread2);
|
||||
threads[4] = chThdCreateFast(chThdGetPriority()-5, wa[4], STKSIZE, thread2);
|
||||
n = msg_loop_test(threads[0]);
|
||||
chThdTerminate(threads[0]);
|
||||
test_wait_threads();
|
||||
|
@ -171,7 +171,7 @@ static void bmk4_execute(void) {
|
|||
test_wait_tick();
|
||||
test_start_timer(1000);
|
||||
do {
|
||||
chThdWait(chThdCreate(prio, 0, wap, STKSIZE, thread2, NULL));
|
||||
chThdWait(chThdCreateFast(prio, wap, STKSIZE, thread2));
|
||||
n++;
|
||||
#if defined(WIN32)
|
||||
ChkIntSources();
|
||||
|
|
Loading…
Reference in New Issue