git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@328 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2008-07-02 12:32:13 +00:00
parent 8a02a67d83
commit 5f4dbf9ca9
8 changed files with 363 additions and 1454 deletions

File diff suppressed because it is too large Load Diff

View File

@ -507,3 +507,13 @@
* @file chserial.c Serial Drivers code. * @file chserial.c Serial Drivers code.
*/ */
/** @} */ /** @} */
/**
* @defgroup CPlusPlusLibrary C++ Wrapper
* @{
* C++ wrapper module. This module allows to use the ChibiOS/RT functionalities
* from C++ as classes and objects rather the traditional "C" APIs.
* @file ch.hpp C++ wrapper classes and definitions.
* @file ch.cpp C++ wrapper code.
*/
/** @} */

View File

@ -12,7 +12,7 @@
</tr> </tr>
<tr> <tr>
<td style="text-align: center; vertical-align: top; width: 150px;">Current <td style="text-align: center; vertical-align: top; width: 150px;">Current
Version 0.6.6<br> Version 0.6.7<br>
-<br> -<br>
<a href="http://sourceforge.net/projects/chibios/" rel="me" target="_top">Project on SourceForge</a><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> <a href="html/index.html" target="_top" rel="me">Documentation</a><br>

View File

@ -74,6 +74,11 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process,
*** Releases *** *** Releases ***
***************************************************************************** *****************************************************************************
*** 0.6.7 ***
- 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.
*** 0.6.6 *** *** 0.6.6 ***
- NEW: Improved test suite, now the suite is divided in modules and the code - NEW: Improved test suite, now the suite is divided in modules and the code
is much easier to understand. The new framework simplifies the inclusion of is much easier to understand. The new framework simplifies the inclusion of

View File

@ -41,12 +41,15 @@ namespace chibios_rt {
/** /**
* Disables interrupts. * Disables interrupts.
* @note On some ports it is faster to invoke chSysLock() directly. * @note On some ports it is faster to invoke chSysLock() directly because
* inlining.
*/ */
static void Lock(void); static void Lock(void);
/** /**
* Enables interrupts. * Enables interrupts.
* @note On some ports it is faster to invoke chSysUnlock() directly. * @note On some ports it is faster to invoke chSysUnlock() directly
* because inlining.
*/ */
static void Unlock(void); static void Unlock(void);
@ -89,7 +92,7 @@ namespace chibios_rt {
/** /**
* Base class for a ChibiOS/RT thread, the thread body is the virtual * Base class for a ChibiOS/RT thread, the thread body is the virtual
* function /p Main(). * function \p Main().
*/ */
class BaseThread { class BaseThread {
public: public:
@ -162,7 +165,7 @@ namespace chibios_rt {
static msg_t WaitMessage(void); static msg_t WaitMessage(void);
/** /**
* Returns an enqueued message or /p NULL. * Returns an enqueued message or \p NULL.
*/ */
static msg_t GetMessage(void); static msg_t GetMessage(void);
@ -207,7 +210,7 @@ namespace chibios_rt {
/** /**
* Simplified constructor, it allows to create a thread by simply * Simplified constructor, it allows to create a thread by simply
* specifying a name. In is assumed /p NORMALPRIO as initial priority * specifying a name. In is assumed \p NORMALPRIO as initial priority
* and no special option flags. * and no special option flags.
*/ */
EnhancedThread(const char *tname) : EnhancedThread(const char *tname) :
@ -219,7 +222,7 @@ namespace chibios_rt {
#ifdef CH_USE_SEMAPHORES #ifdef CH_USE_SEMAPHORES
/** /**
* Class encapsulating a /p Semaphore. * Class encapsulating a \p Semaphore.
*/ */
class Semaphore { class Semaphore {
public: public:
@ -263,7 +266,7 @@ namespace chibios_rt {
#ifdef CH_USE_MUTEXES #ifdef CH_USE_MUTEXES
/** /**
* Class encapsulating a /p Mutex. * Class encapsulating a \p Mutex.
*/ */
class Mutex { class Mutex {
public: public:
@ -298,7 +301,7 @@ namespace chibios_rt {
#ifdef CH_USE_EVENTS #ifdef CH_USE_EVENTS
/** /**
* Class encapsulating an /p EventSource. * Class encapsulating an \p EventSource.
*/ */
class Event { class Event {
public: public:

View File

@ -167,22 +167,27 @@ void test_cpu_pulse(systime_t ms) {
systime_t test_wait_tick(void) { systime_t test_wait_tick(void) {
systime_t time = chSysGetTime() + 1; chThdSleep(1);
if (time) { return chSysGetTime();
while (chSysGetTime() < time) { }
#if defined(WIN32)
ChkIntSources(); /*
#endif * Timer utils.
} */
} static VirtualTimer vt;
else { bool_t test_timer_done;
while (chSysGetTime() > time) {
#if defined(WIN32) static void tmr(void *p) {
ChkIntSources();
#endif test_timer_done = TRUE;
} }
}
return time; void test_start_timer(systime_t time) {
test_timer_done = FALSE;
chSysLock();
chVTSetI(&vt, time, tmr, NULL);
chSysUnlock();
} }
/* /*

View File

@ -53,11 +53,13 @@ extern "C" {
void test_wait_threads(void); void test_wait_threads(void);
systime_t test_wait_tick(void); systime_t test_wait_tick(void);
void test_cpu_pulse(systime_t ms); void test_cpu_pulse(systime_t ms);
void test_start_timer(systime_t time);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
extern Thread *threads[MAX_THREADS]; extern Thread *threads[MAX_THREADS];
extern void *wa[MAX_THREADS]; extern void *wa[MAX_THREADS];
extern bool_t test_timer_done;
#endif /* _TEST_H_ */ #endif /* _TEST_H_ */

View File

@ -25,9 +25,9 @@ __attribute__((noinline))
static unsigned int msg_loop_test(Thread *tp) { static unsigned int msg_loop_test(Thread *tp) {
uint32_t n = 0; uint32_t n = 0;
systime_t start = test_wait_tick(); test_wait_tick();
systime_t end = start + 1000; test_start_timer(1000);
while (chSysInTimeWindow(start, end)) { while (!test_timer_done) {
(void)chMsgSend(tp, 0); (void)chMsgSend(tp, 0);
n++; n++;
#if defined(WIN32) #if defined(WIN32)
@ -164,10 +164,10 @@ static void bmk4_teardown(void) {
static void bmk4_execute(void) { static void bmk4_execute(void) {
systime_t start = test_wait_tick();
systime_t end = start + 1000;
uint32_t n = 0; uint32_t n = 0;
while (chSysInTimeWindow(start, end)) { test_wait_tick();
test_start_timer(1000);
while (!test_timer_done) {
threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread2, NULL); threads[0] = chThdCreate(chThdGetPriority()-1, 0, wa[0], STKSIZE, thread2, NULL);
chThdWait(threads[0]); chThdWait(threads[0]);
n++; n++;
@ -203,10 +203,10 @@ static void bmk5_execute(void) {
static Queue iq; static Queue iq;
chIQInit(&iq, ib, sizeof(ib), NULL); chIQInit(&iq, ib, sizeof(ib), NULL);
systime_t start = test_wait_tick();
systime_t end = start + 1000;
uint32_t n = 0; uint32_t n = 0;
while (chSysInTimeWindow(start, end)) { test_wait_tick();
test_start_timer(1000);
while (!test_timer_done) {
chIQPutI(&iq, 0); chIQPutI(&iq, 0);
chIQPutI(&iq, 1); chIQPutI(&iq, 1);
chIQPutI(&iq, 2); chIQPutI(&iq, 2);