From 36deb792c105ce4900870abe69da77393ce7a692 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 3 Feb 2009 16:13:59 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@714 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- docs/ch.txt | 15 +++++++++++---- readme.txt | 2 ++ src/chdebug.c | 2 +- src/chheap.c | 5 ++--- src/chschd.c | 2 +- src/chsys.c | 10 +++++----- src/chvt.c | 2 +- src/include/debug.h | 4 ++-- src/include/heap.h | 2 +- src/include/scheduler.h | 2 +- src/include/vt.h | 2 +- 11 files changed, 28 insertions(+), 20 deletions(-) diff --git a/docs/ch.txt b/docs/ch.txt index e3e73da97..5e2fd2077 100644 --- a/docs/ch.txt +++ b/docs/ch.txt @@ -234,8 +234,13 @@ * becomes negative the thread is queued in the semaphore and suspended. * - Reset: The semaphore counter is reset to a non-negative value * and all the threads in the queue are released. - * Semaphores can be used as guards for mutual exclusion code zones but - * also have other uses, queues guards and counters as example.
+ * + * Semaphores can be used as guards for mutual exclusion code zones (note that + * mutexes are recommended for this kind of use) but also have other uses, + * queues guards and counters as example.
+ * Semaphores usually use FIFO queues but it is possible to make them + * order threads by priority by specifying CH_USE_SEMAPHORES_PRIORITY in + * @p chconf.h.
* In order to use the Semaphores APIs the @p CH_USE_SEMAPHORES * option must be specified in @p chconf.h.

* @file semaphores.h Semaphores macros and structures. @@ -256,6 +261,7 @@ * - Unlock: The mutex is released by the owner and the highest * priority thread waiting in the queue, if any, is resumed and made owner * of the mutex. + * * In order to use the Event APIs the @p CH_USE_MUTEXES option must be * specified in @p chconf.h.
* @@ -320,7 +326,7 @@ /** * @defgroup Messages Messages * @{ - * Synchronous inter-thread Messages. + * Synchronous inter-thread messages. *

Operation Mode

* Messages are an easy to use and fast IPC mechanism, threads can both serve * messages and send messages to other threads, the mechanism allows data to @@ -360,6 +366,7 @@ * - Full duplex queue, bidirectional queue where read and write * operations can happen at the same time. Full duplex queues * are implemented by pairing an input queue and an output queue together. + * * In order to use the I/O queues the @p CH_USE_QUEUES option must * be specified in @p chconf.h.
* In order to use the half duplex queues the @p CH_USE_QUEUES_HALFDUPLEX @@ -397,7 +404,7 @@ * The library code does not follow the same naming convention of the * system APIs in order to make very clear that it is not "core" code.
* The main difference is that library code is not formally tested in the - * test suite but through usage in the various demo application. + * test suite but through usage in the various demo applications. */ /** @} */ diff --git a/readme.txt b/readme.txt index a869bd09f..d4ba1a99c 100644 --- a/readme.txt +++ b/readme.txt @@ -101,6 +101,8 @@ Win32-MinGW - ChibiOS/RT simulator and demo into a WIN32 process, CH_IRQ_PROLOGUE() and CH_IRQ_EPILOGUE() in order to make very clear that those are not functions but inlined code. Also introduced a new macro CH_IRQ_HANDLER that should be used when declaring an interrupt handler. + CHANGE: Renamed several internal initialization functions by removing the + "ch" prefix because could not be considered system APIs. - Improved ARM7 and Cortex-M3 support, new configuration options. - Introduced the concept of interrupt classes, see the documentation. - Introduced the concept of system states, see the documentation. diff --git a/src/chdebug.c b/src/chdebug.c index 238071cc4..41a0adc62 100644 --- a/src/chdebug.c +++ b/src/chdebug.c @@ -26,7 +26,7 @@ char *panicmsg; /** * @brief Debug subsystem initialization. */ -void chDbgInit(void) { +void debug_init(void) { #ifdef CH_USE_TRACE dbgtb.tb_size = TRACE_BUFFER_SIZE; diff --git a/src/chheap.c b/src/chheap.c index 8ba55f9ad..c07212226 100644 --- a/src/chheap.c +++ b/src/chheap.c @@ -65,10 +65,9 @@ static struct { /** * @brief Initializes the allocator subsystem. * - * @note It is internally invoked, this function should not normally be - * invoked from the user code. + * @note Internal use only. */ -void chHeapInit(void) { +void heap_init(void) { struct header *hp; #if CH_HEAP_SIZE == 0 diff --git a/src/chschd.c b/src/chschd.c index cc89682a8..2de941f0a 100644 --- a/src/chschd.c +++ b/src/chschd.c @@ -32,7 +32,7 @@ ReadyList rlist; * @brief Scheduler initialization. * @note Internally invoked by the @p chSysInit(). */ -void chSchInit(void) { +void scheduler_init(void) { queue_init(&rlist); rlist.r_prio = NOPRIO; diff --git a/src/chsys.c b/src/chsys.c index 1629796dd..807e2590f 100644 --- a/src/chsys.c +++ b/src/chsys.c @@ -57,17 +57,17 @@ void chSysInit(void) { static Thread mainthread; port_init(); - chSchInit(); - chDbgInit(); - chVTInit(); + scheduler_init(); + debug_init(); + vt_init(); #ifdef CH_USE_HEAP - chHeapInit(); + heap_init(); #endif + /* * Now this instructions flow becomes the main thread. */ (currp = init_thread(&mainthread, NORMALPRIO))->p_state = PRCURR; - chSysEnable(); /* diff --git a/src/chvt.c b/src/chvt.c index 7f63437ad..63bfd219e 100644 --- a/src/chvt.c +++ b/src/chvt.c @@ -31,7 +31,7 @@ VTList vtlist; * * @note Internal use only. */ -void chVTInit(void) { +void vt_init(void) { vtlist.vt_next = vtlist.vt_prev = (void *)&vtlist; vtlist.vt_time = (systime_t)-1; diff --git a/src/include/debug.h b/src/include/debug.h index 631882fad..71a2613eb 100644 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -62,7 +62,7 @@ extern char *dbglastmsg; #ifdef __cplusplus extern "C" { #endif - void chDbgInit(void); + void debug_init(void); void chDbgPanic(char *msg); #ifdef __cplusplus } @@ -83,7 +83,7 @@ extern "C" { #else /* !CH_USE_DEBUG */ -#define chDbgInit() +#define debug_init() #define chDbgPanic(msg) {} #define chDbgAssert(c, m) {(void)(c);} diff --git a/src/include/heap.h b/src/include/heap.h index b303fde1a..b8633f5cf 100644 --- a/src/include/heap.h +++ b/src/include/heap.h @@ -28,7 +28,7 @@ #ifdef __cplusplus extern "C" { #endif - void chHeapInit(void); + void heap_init(void); void *chHeapAlloc(size_t size); void chHeapFree(void *p); size_t chHeapStatus(size_t *sizep); diff --git a/src/include/scheduler.h b/src/include/scheduler.h index fde23a0ce..3d2f46e5e 100644 --- a/src/include/scheduler.h +++ b/src/include/scheduler.h @@ -75,7 +75,7 @@ extern ReadyList rlist; #ifdef __cplusplus extern "C" { #endif - void chSchInit(void); + void scheduler_init(void); Thread *chSchReadyI(Thread *tp); void chSchGoSleepS(tstate_t newstate); msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time); diff --git a/src/include/vt.h b/src/include/vt.h index 73f2881a3..1e718da3a 100644 --- a/src/include/vt.h +++ b/src/include/vt.h @@ -99,7 +99,7 @@ extern VTList vtlist; #ifdef __cplusplus extern "C" { #endif - void chVTInit(void); + void vt_init(void); void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par); void chVTResetI(VirtualTimer *vtp); bool_t chSysInTimeWindow(systime_t start, systime_t end); -- cgit v1.2.3