git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@94 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
da365c95e4
commit
195a9c7951
|
@ -25,7 +25,7 @@ __abt_stack_size__ = 0x0004;
|
|||
__fiq_stack_size__ = 0x0010;
|
||||
__irq_stack_size__ = 0x0080;
|
||||
__svc_stack_size__ = 0x0004;
|
||||
__sys_stack_size__ = 0x0080;
|
||||
__sys_stack_size__ = 0x0100;
|
||||
__stacks_total_size__ = __und_stack_size__ + __abt_stack_size__ + __fiq_stack_size__ + __irq_stack_size__ + __svc_stack_size__ + __sys_stack_size__;
|
||||
|
||||
MEMORY
|
||||
|
|
|
@ -25,12 +25,21 @@
|
|||
#include "buzzer.h"
|
||||
#include "evtimer.h"
|
||||
|
||||
/*
|
||||
* System Idle Thread, this thread only runs when on other threads in the
|
||||
* system require the CPU.
|
||||
* The role of this thread is to minimize the power consumption when idling
|
||||
* and serve the interrupts.
|
||||
*/
|
||||
static BYTE8 waIdleThread[UserStackSize(16)];
|
||||
static t_msg IdleThread(void *arg) {
|
||||
|
||||
chSysPause();
|
||||
}
|
||||
|
||||
/*
|
||||
* Red LEDs blinker thread, times are in milliseconds.
|
||||
*/
|
||||
static BYTE8 waThread1[UserStackSize(32)];
|
||||
static t_msg Thread1(void *arg) {
|
||||
|
||||
|
@ -47,6 +56,9 @@ static t_msg Thread1(void *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Yellow LED blinker thread, times are in milliseconds.
|
||||
*/
|
||||
static BYTE8 waThread2[UserStackSize(32)];
|
||||
static t_msg Thread2(void *arg) {
|
||||
|
||||
|
@ -59,6 +71,9 @@ static t_msg Thread2(void *arg) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Executed as event handler at 500mS intervals.
|
||||
*/
|
||||
static void TimerHandler(t_eventid id) {
|
||||
t_msg TestThread(void *p);
|
||||
|
||||
|
@ -76,6 +91,10 @@ static void TimerHandler(t_eventid id) {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Plays sounds when a MMC/SD card is inserted, then initializes the MMC
|
||||
* driver and reads a sector.
|
||||
*/
|
||||
static void InsertHandler(t_eventid id) {
|
||||
static BYTE8 rwbuf[512];
|
||||
MMCCSD data;
|
||||
|
@ -92,39 +111,30 @@ static void InsertHandler(t_eventid id) {
|
|||
PlaySound(440, 200);
|
||||
}
|
||||
|
||||
/*
|
||||
* Plays sounds when a MMC/SD card is removed.
|
||||
*/
|
||||
static void RemoveHandler(t_eventid id) {
|
||||
|
||||
PlaySoundWait(2000, 100);
|
||||
PlaySoundWait(1000, 100);
|
||||
}
|
||||
|
||||
/*static BYTE8 waThread3[UserStackSize(256)];*/
|
||||
static EvTimer evt;
|
||||
static t_evhandler evhndl[] = {
|
||||
TimerHandler,
|
||||
InsertHandler,
|
||||
RemoveHandler
|
||||
};
|
||||
|
||||
/*static t_msg Thread3(void *arg) {
|
||||
struct EventListener el0, el1, el2;
|
||||
|
||||
evtInit(&evt, 500);
|
||||
evtStart(&evt);
|
||||
mmcStartPolling();
|
||||
evtRegister(&evt, &el0, 0);
|
||||
chEvtRegister(&MMCInsertEventSource, &el1, 1);
|
||||
chEvtRegister(&MMCRemoveEventSource, &el2, 2);
|
||||
while (TRUE)
|
||||
chEvtWait(ALL_EVENTS, evhndl);
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
/*
|
||||
* Entry point, the interrupts are disabled on entry.
|
||||
*/
|
||||
int main(int argc, char **argv) {
|
||||
static const t_evhandler evhndl[] = {
|
||||
TimerHandler,
|
||||
InsertHandler,
|
||||
RemoveHandler
|
||||
};
|
||||
static EvTimer evt;
|
||||
struct EventListener el0, el1, el2;
|
||||
|
||||
/*
|
||||
* The main() function becomes a thread here, ChibiOS/RT goes live.
|
||||
* The main() function becomes a thread here then the interrupts are
|
||||
* enabled and ChibiOS/RT goes live.
|
||||
*/
|
||||
chSysInit();
|
||||
|
||||
|
|
12
readme.txt
12
readme.txt
|
@ -41,17 +41,21 @@ AVR-AT90CANx-GCC - Port on AVR AT90CAN128, not complete yet.
|
|||
*** 0.4.1 ***
|
||||
- Cleaned up the LPC2148 demo in main.c, it is now well documented and
|
||||
explains everything, I assumed too much stuff to be "obvious".
|
||||
- Included a Makefile in the LPC2148 demo that builds in THUMB mode.
|
||||
- Added a spreadsheet in the documentation that describes the advantages
|
||||
and disadvantages of the various optimization options (both GCC options and
|
||||
ChibiOS/RT options), very interesting read IMO. No .xls available, ODF only.
|
||||
- The GCC option +falign-functions=16 is now default in the Makefile, it is
|
||||
required because of the MAM unit into the LPC chips, without this option
|
||||
the code performance is less predictable and can change of some % points
|
||||
depending on how the code is aligned in the flash memory, unpredictabilty
|
||||
depending on how the code is aligned in the flash memory, unpredictability
|
||||
is bad for a RTOS. This option however increases the code size slightly
|
||||
because of alignment gaps.
|
||||
- Fine tuning in the scheduler code for improved performance.
|
||||
because of the alignment gaps.
|
||||
- Fine tuning in the scheduler code for improved performance, deeper
|
||||
inlining and small changes.
|
||||
- Increased the default system-mode stack size from 128 to 256 bytes because
|
||||
some optimizations and the THUMB mode seem to use more stack space.
|
||||
- Included a Makefile in the LPC2148 demo that builds in THUMB mode.
|
||||
- Const-ified a parameter in the chEvtWait() and chEvtWaitTimeout() APIs.
|
||||
|
||||
*** 0.4.0 ***
|
||||
- NEW, added a benchmark functionality to the test suite. The benchmark
|
||||
|
|
|
@ -136,7 +136,7 @@ void chEvtSendI(EventSource *esp) {
|
|||
* an higher priority.
|
||||
*/
|
||||
t_eventid chEvtWait(t_eventmask ewmask,
|
||||
t_evhandler handlers[]) {
|
||||
const t_evhandler handlers[]) {
|
||||
t_eventid i;
|
||||
t_eventmask m;
|
||||
|
||||
|
@ -191,7 +191,7 @@ static void wakeup(void *p) {
|
|||
* option is enabled in \p chconf.h.
|
||||
*/
|
||||
t_eventid chEvtWaitTimeout(t_eventmask ewmask,
|
||||
t_evhandler handlers[],
|
||||
const t_evhandler handlers[],
|
||||
t_time time) {
|
||||
t_eventid i;
|
||||
t_eventmask m;
|
||||
|
|
|
@ -61,13 +61,17 @@ void chSchInit(void) {
|
|||
* be called soon after.
|
||||
* @note The function is not meant to be used in the user code directly.
|
||||
*/
|
||||
#ifdef CH_OPTIMIZE_SPEED
|
||||
/* NOTE: it is inlined in this module only.*/
|
||||
INLINE Thread *chSchReadyI(Thread *tp) {
|
||||
#else
|
||||
Thread *chSchReadyI(Thread *tp) {
|
||||
Thread *cp;
|
||||
#endif
|
||||
Thread *cp = rlist.r_queue.p_prev;
|
||||
t_prio prio = tp->p_prio;
|
||||
|
||||
tp->p_state = PRREADY;
|
||||
tp->p_rdymsg = RDY_OK;
|
||||
cp = rlist.r_queue.p_prev;
|
||||
while (cp->p_prio < prio)
|
||||
cp = cp->p_prev;
|
||||
// Insertion on p_next
|
||||
|
@ -79,6 +83,7 @@ Thread *chSchReadyI(Thread *tp) {
|
|||
/*
|
||||
* Switches to the next thread in the ready list, the ready list is assumed
|
||||
* to contain at least a thread.
|
||||
* NOTE: it is inlined in this module only.
|
||||
*/
|
||||
#ifdef CH_OPTIMIZE_SPEED
|
||||
static INLINE void nextready(void) {
|
||||
|
|
|
@ -85,11 +85,11 @@ extern "C" {
|
|||
void chEvtSend(EventSource *esp);
|
||||
void chEvtSendI(EventSource *esp);
|
||||
t_eventid chEvtWait(t_eventmask ewmask,
|
||||
t_evhandler handlers[]);
|
||||
const t_evhandler handlers[]);
|
||||
#ifdef CH_USE_EVENTS_TIMEOUT
|
||||
t_eventid chEvtWaitTimeout(t_eventmask ewmask,
|
||||
t_evhandler handlers[],
|
||||
t_time time);
|
||||
const t_evhandler handlers[],
|
||||
t_time time);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue