git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@714 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
528e9fea35
commit
36deb792c1
15
docs/ch.txt
15
docs/ch.txt
|
@ -234,8 +234,13 @@
|
||||||
* becomes negative the thread is queued in the semaphore and suspended.
|
* becomes negative the thread is queued in the semaphore and suspended.
|
||||||
* - <b>Reset</b>: The semaphore counter is reset to a non-negative value
|
* - <b>Reset</b>: The semaphore counter is reset to a non-negative value
|
||||||
* and all the threads in the queue are released.
|
* 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.<br>
|
* 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.<br>
|
||||||
|
* 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.<br>
|
||||||
* In order to use the Semaphores APIs the @p CH_USE_SEMAPHORES
|
* In order to use the Semaphores APIs the @p CH_USE_SEMAPHORES
|
||||||
* option must be specified in @p chconf.h.<br><br>
|
* option must be specified in @p chconf.h.<br><br>
|
||||||
* @file semaphores.h Semaphores macros and structures.
|
* @file semaphores.h Semaphores macros and structures.
|
||||||
|
@ -256,6 +261,7 @@
|
||||||
* - <b>Unlock</b>: The mutex is released by the owner and the highest
|
* - <b>Unlock</b>: The mutex is released by the owner and the highest
|
||||||
* priority thread waiting in the queue, if any, is resumed and made owner
|
* priority thread waiting in the queue, if any, is resumed and made owner
|
||||||
* of the mutex.
|
* of the mutex.
|
||||||
|
*
|
||||||
* In order to use the Event APIs the @p CH_USE_MUTEXES option must be
|
* In order to use the Event APIs the @p CH_USE_MUTEXES option must be
|
||||||
* specified in @p chconf.h.<br>
|
* specified in @p chconf.h.<br>
|
||||||
*
|
*
|
||||||
|
@ -320,7 +326,7 @@
|
||||||
/**
|
/**
|
||||||
* @defgroup Messages Messages
|
* @defgroup Messages Messages
|
||||||
* @{
|
* @{
|
||||||
* Synchronous inter-thread Messages.
|
* Synchronous inter-thread messages.
|
||||||
* <h2>Operation Mode</h2>
|
* <h2>Operation Mode</h2>
|
||||||
* Messages are an easy to use and fast IPC mechanism, threads can both serve
|
* 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
|
* messages and send messages to other threads, the mechanism allows data to
|
||||||
|
@ -360,6 +366,7 @@
|
||||||
* - <b>Full duplex queue</b>, bidirectional queue where read and write
|
* - <b>Full duplex queue</b>, bidirectional queue where read and write
|
||||||
* operations can happen at the same time. Full duplex queues
|
* operations can happen at the same time. Full duplex queues
|
||||||
* are implemented by pairing an input queue and an output queue together.
|
* 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
|
* In order to use the I/O queues the @p CH_USE_QUEUES option must
|
||||||
* be specified in @p chconf.h.<br>
|
* be specified in @p chconf.h.<br>
|
||||||
* In order to use the half duplex queues the @p CH_USE_QUEUES_HALFDUPLEX
|
* 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
|
* 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.<br>
|
* system APIs in order to make very clear that it is not "core" code.<br>
|
||||||
* The main difference is that library code is not formally tested in the
|
* 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.
|
||||||
*/
|
*/
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -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
|
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
|
those are not functions but inlined code. Also introduced a new macro
|
||||||
CH_IRQ_HANDLER that should be used when declaring an interrupt handler.
|
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.
|
- Improved ARM7 and Cortex-M3 support, new configuration options.
|
||||||
- Introduced the concept of interrupt classes, see the documentation.
|
- Introduced the concept of interrupt classes, see the documentation.
|
||||||
- Introduced the concept of system states, see the documentation.
|
- Introduced the concept of system states, see the documentation.
|
||||||
|
|
|
@ -26,7 +26,7 @@ char *panicmsg;
|
||||||
/**
|
/**
|
||||||
* @brief Debug subsystem initialization.
|
* @brief Debug subsystem initialization.
|
||||||
*/
|
*/
|
||||||
void chDbgInit(void) {
|
void debug_init(void) {
|
||||||
|
|
||||||
#ifdef CH_USE_TRACE
|
#ifdef CH_USE_TRACE
|
||||||
dbgtb.tb_size = TRACE_BUFFER_SIZE;
|
dbgtb.tb_size = TRACE_BUFFER_SIZE;
|
||||||
|
|
|
@ -65,10 +65,9 @@ static struct {
|
||||||
/**
|
/**
|
||||||
* @brief Initializes the allocator subsystem.
|
* @brief Initializes the allocator subsystem.
|
||||||
*
|
*
|
||||||
* @note It is internally invoked, this function should not normally be
|
* @note Internal use only.
|
||||||
* invoked from the user code.
|
|
||||||
*/
|
*/
|
||||||
void chHeapInit(void) {
|
void heap_init(void) {
|
||||||
struct header *hp;
|
struct header *hp;
|
||||||
|
|
||||||
#if CH_HEAP_SIZE == 0
|
#if CH_HEAP_SIZE == 0
|
||||||
|
|
|
@ -32,7 +32,7 @@ ReadyList rlist;
|
||||||
* @brief Scheduler initialization.
|
* @brief Scheduler initialization.
|
||||||
* @note Internally invoked by the @p chSysInit().
|
* @note Internally invoked by the @p chSysInit().
|
||||||
*/
|
*/
|
||||||
void chSchInit(void) {
|
void scheduler_init(void) {
|
||||||
|
|
||||||
queue_init(&rlist);
|
queue_init(&rlist);
|
||||||
rlist.r_prio = NOPRIO;
|
rlist.r_prio = NOPRIO;
|
||||||
|
|
10
src/chsys.c
10
src/chsys.c
|
@ -57,17 +57,17 @@ void chSysInit(void) {
|
||||||
static Thread mainthread;
|
static Thread mainthread;
|
||||||
|
|
||||||
port_init();
|
port_init();
|
||||||
chSchInit();
|
scheduler_init();
|
||||||
chDbgInit();
|
debug_init();
|
||||||
chVTInit();
|
vt_init();
|
||||||
#ifdef CH_USE_HEAP
|
#ifdef CH_USE_HEAP
|
||||||
chHeapInit();
|
heap_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now this instructions flow becomes the main thread.
|
* Now this instructions flow becomes the main thread.
|
||||||
*/
|
*/
|
||||||
(currp = init_thread(&mainthread, NORMALPRIO))->p_state = PRCURR;
|
(currp = init_thread(&mainthread, NORMALPRIO))->p_state = PRCURR;
|
||||||
|
|
||||||
chSysEnable();
|
chSysEnable();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -31,7 +31,7 @@ VTList vtlist;
|
||||||
*
|
*
|
||||||
* @note Internal use only.
|
* @note Internal use only.
|
||||||
*/
|
*/
|
||||||
void chVTInit(void) {
|
void vt_init(void) {
|
||||||
|
|
||||||
vtlist.vt_next = vtlist.vt_prev = (void *)&vtlist;
|
vtlist.vt_next = vtlist.vt_prev = (void *)&vtlist;
|
||||||
vtlist.vt_time = (systime_t)-1;
|
vtlist.vt_time = (systime_t)-1;
|
||||||
|
|
|
@ -62,7 +62,7 @@ extern char *dbglastmsg;
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void chDbgInit(void);
|
void debug_init(void);
|
||||||
void chDbgPanic(char *msg);
|
void chDbgPanic(char *msg);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -83,7 +83,7 @@ extern "C" {
|
||||||
|
|
||||||
#else /* !CH_USE_DEBUG */
|
#else /* !CH_USE_DEBUG */
|
||||||
|
|
||||||
#define chDbgInit()
|
#define debug_init()
|
||||||
#define chDbgPanic(msg) {}
|
#define chDbgPanic(msg) {}
|
||||||
#define chDbgAssert(c, m) {(void)(c);}
|
#define chDbgAssert(c, m) {(void)(c);}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void chHeapInit(void);
|
void heap_init(void);
|
||||||
void *chHeapAlloc(size_t size);
|
void *chHeapAlloc(size_t size);
|
||||||
void chHeapFree(void *p);
|
void chHeapFree(void *p);
|
||||||
size_t chHeapStatus(size_t *sizep);
|
size_t chHeapStatus(size_t *sizep);
|
||||||
|
|
|
@ -75,7 +75,7 @@ extern ReadyList rlist;
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void chSchInit(void);
|
void scheduler_init(void);
|
||||||
Thread *chSchReadyI(Thread *tp);
|
Thread *chSchReadyI(Thread *tp);
|
||||||
void chSchGoSleepS(tstate_t newstate);
|
void chSchGoSleepS(tstate_t newstate);
|
||||||
msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time);
|
msg_t chSchGoSleepTimeoutS(tstate_t newstate, systime_t time);
|
||||||
|
|
|
@ -99,7 +99,7 @@ extern VTList vtlist;
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
void chVTInit(void);
|
void vt_init(void);
|
||||||
void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par);
|
void chVTSetI(VirtualTimer *vtp, systime_t time, vtfunc_t vtfunc, void *par);
|
||||||
void chVTResetI(VirtualTimer *vtp);
|
void chVTResetI(VirtualTimer *vtp);
|
||||||
bool_t chSysInTimeWindow(systime_t start, systime_t end);
|
bool_t chSysInTimeWindow(systime_t start, systime_t end);
|
||||||
|
|
Loading…
Reference in New Issue