git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@31 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
2310f80695
commit
dd18ff8898
|
@ -63,7 +63,7 @@ UADEFS =
|
||||||
|
|
||||||
# List ARM-mode C source files here
|
# List ARM-mode C source files here
|
||||||
ASRC = chcore.c main.c buzzer.c \
|
ASRC = chcore.c main.c buzzer.c \
|
||||||
../../ports/ARM7-LPC214x/GCC/lpc214x_serial.c \
|
../../test/test.c ../../ports/ARM7-LPC214x/GCC/lpc214x_serial.c \
|
||||||
../../src/chinit.c ../../src/chlists.c ../../src/chdelta.c ../../src/chschd.c \
|
../../src/chinit.c ../../src/chlists.c ../../src/chdelta.c ../../src/chschd.c \
|
||||||
../../src/chthreads.c ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c \
|
../../src/chthreads.c ../../src/chsem.c ../../src/chevents.c ../../src/chmsg.c \
|
||||||
../../src/chsleep.c ../../src/chqueues.c ../../src/chserial.c
|
../../src/chsleep.c ../../src/chqueues.c ../../src/chserial.c
|
||||||
|
|
|
@ -53,15 +53,22 @@ static t_msg Thread2(void *arg) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BYTE8 waThread3[UserStackSize(32)];
|
static BYTE8 waThread3[UserStackSize(64)];
|
||||||
|
|
||||||
static t_msg Thread3(void *arg) {
|
static t_msg Thread3(void *arg) {
|
||||||
|
t_msg TestThread(void *p);
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
if (!(IO0PIN & 0x00008000)) // Button 1
|
if (!(IO0PIN & 0x00018000)) {
|
||||||
PlaySound(1000, 100);
|
TestThread(&COM1);
|
||||||
if (!(IO0PIN & 0x00010000)) // Button 2
|
PlaySound(500, 100);
|
||||||
chFDDWrite(&COM1, (BYTE8 *)"Hello World!\r\n", 14);
|
}
|
||||||
|
else {
|
||||||
|
if (!(IO0PIN & 0x00008000)) // Button 1
|
||||||
|
PlaySound(1000, 100);
|
||||||
|
if (!(IO0PIN & 0x00010000)) // Button 2
|
||||||
|
chFDDWrite(&COM1, (BYTE8 *)"Hello World!\r\n", 14);
|
||||||
|
}
|
||||||
chThdSleep(500);
|
chThdSleep(500);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -11,7 +11,8 @@ members of the LPC2000 family should be an easy task.
|
||||||
|
|
||||||
The demo blinks the leds on the board by using multiple threads. By pressing
|
The demo blinks the leds on the board by using multiple threads. By pressing
|
||||||
the buttons on the board it is possible to activate the buzzer and send a
|
the buttons on the board it is possible to activate the buzzer and send a
|
||||||
message over the serial ports.
|
message over the serial ports. Pressing both buttons activates the test
|
||||||
|
procedure on the serial port 1.
|
||||||
See main.c for details. Buzzer.c contains an interesting device driver
|
See main.c for details. Buzzer.c contains an interesting device driver
|
||||||
example that uses a physical timer for the waveform generation and a virtual
|
example that uses a physical timer for the waveform generation and a virtual
|
||||||
timer for the sound duration.
|
timer for the sound duration.
|
||||||
|
|
32
readme.txt
32
readme.txt
|
@ -2,19 +2,20 @@
|
||||||
*** Directories structure ***
|
*** Directories structure ***
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
./readme.txt - This file.
|
./readme.txt - This file.
|
||||||
./license.txt - GPL3 license file.
|
./license.txt - GPL3 license file.
|
||||||
./src/ - ChibiOS/RT portable kernel source files.
|
./src/ - ChibiOS/RT portable kernel source files.
|
||||||
./src/include/ - ChibiOS/RT include files.
|
./src/include/ - ChibiOS/RT include files.
|
||||||
./src/templates/ - ChibiOS/RT non portable source templates, new ports are
|
./src/templates/ - ChibiOS/RT non portable source templates, new ports
|
||||||
started by copying the templates into a new directory
|
are started by copying the templates into a new
|
||||||
under ./demos/.
|
directory under ./demos/.
|
||||||
./ports/ - Architecture/compiler specific portable files.
|
./ports/ - Architecture/compiler specific portable files.
|
||||||
./demos/ - Demo programs for specific archtectures/boards.
|
./demos/ - Demo programs for specific archtectures/boards.
|
||||||
./docs/Doxifile - Doxigen project file.
|
./test/ - Test code, used by some demos.
|
||||||
./docs/index.html - ChibiOS/RT documentation (after running doxigen). The
|
./docs/Doxifile - Doxigen project file.
|
||||||
documentation is also available on the project web
|
./docs/html/index.html - ChibiOS/RT documentation (after running doxigen).
|
||||||
page: http://chibios.sourceforge.net/
|
The documentation is also available on the project
|
||||||
|
web page: http://chibios.sourceforge.net/
|
||||||
|
|
||||||
Current ports under ./demos:
|
Current ports under ./demos:
|
||||||
|
|
||||||
|
@ -33,8 +34,9 @@ LPC214x-GCC - ChibiOS/RT port for ARM7 LPC2148, the demo targets the
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
|
|
||||||
*** 0.3.1 ***
|
*** 0.3.1 ***
|
||||||
- Test program added to the MinGW and MSVS demos. Telnet the demo and type
|
- Test program added to the demos. Telnet the MinGW and MSVS demos and type
|
||||||
"test" at the "ch>" prompt. The test performs integrity tests on the main
|
"test" at the "ch>" prompt. On the LPC214x demo the test is activated by
|
||||||
|
pressing both the board. The test performs integrity tests on the main
|
||||||
ChibiOS/RT functionalities.
|
ChibiOS/RT functionalities.
|
||||||
The test code is also a good example of APIs usage and ChibiOS/RT behavior.
|
The test code is also a good example of APIs usage and ChibiOS/RT behavior.
|
||||||
- Fixed bug in chEvtWaitTimeout(), the timeout code performed an useless
|
- Fixed bug in chEvtWaitTimeout(), the timeout code performed an useless
|
||||||
|
|
84
test/test.c
84
test/test.c
|
@ -75,34 +75,6 @@ t_msg Thread3(void *p) {
|
||||||
}
|
}
|
||||||
|
|
||||||
t_msg Thread4(void *p) {
|
t_msg Thread4(void *p) {
|
||||||
|
|
||||||
chSemWait(&sem1);
|
|
||||||
chFDDPut(comp, *(BYTE8 *)p);
|
|
||||||
/*
|
|
||||||
* NOTE: chSemSignalWait() is not the same of chSemSignal()+chSemWait().
|
|
||||||
* The former is performed atomically, try it.
|
|
||||||
*/
|
|
||||||
chSemSignalWait(&sem1, &sem2);
|
|
||||||
// chSemSignal(&sem1);
|
|
||||||
// chSemWait(&sem2);
|
|
||||||
chFDDPut(comp, *(BYTE8 *)p);
|
|
||||||
chSemSignal(&sem2);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
t_msg Thread5(void *p) {
|
|
||||||
|
|
||||||
chSemWait(&sem1);
|
|
||||||
chFDDPut(comp, *(BYTE8 *)p);
|
|
||||||
chSemRaisePrioSignalWait(&sem1, &sem2);
|
|
||||||
// chSemSignal(&sem1);
|
|
||||||
// chSemRaisePrioWait(&sem2);
|
|
||||||
chFDDPut(comp, *(BYTE8 *)p);
|
|
||||||
chSemLowerPrioSignal(&sem2);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
t_msg Thread6(void *p) {
|
|
||||||
t_msg msg;
|
t_msg msg;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -114,7 +86,7 @@ t_msg Thread6(void *p) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
t_msg Thread7(void *p) {
|
t_msg Thread5(void *p) {
|
||||||
|
|
||||||
// NOTE, this thread does not serve messages this causes the client to
|
// NOTE, this thread does not serve messages this causes the client to
|
||||||
// timeout.
|
// timeout.
|
||||||
|
@ -130,6 +102,10 @@ t_msg TestThread(void *p) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
comp = p;
|
comp = p;
|
||||||
|
println("*****************************");
|
||||||
|
println("*** ChibiOS/RT test suite ***");
|
||||||
|
println("*****************************");
|
||||||
|
println("");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ready list ordering test.
|
* Ready list ordering test.
|
||||||
|
@ -169,6 +145,7 @@ t_msg TestThread(void *p) {
|
||||||
wait();
|
wait();
|
||||||
println("");
|
println("");
|
||||||
println("*** Semaphores, priority enqueuing test #1, you should read ABCDE:");
|
println("*** Semaphores, priority enqueuing test #1, you should read ABCDE:");
|
||||||
|
chSemInit(&sem1, 0);
|
||||||
t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E");
|
t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E");
|
||||||
t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D");
|
t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D");
|
||||||
t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread3, "C");
|
t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread3, "C");
|
||||||
|
@ -182,6 +159,7 @@ t_msg TestThread(void *p) {
|
||||||
wait();
|
wait();
|
||||||
println("");
|
println("");
|
||||||
println("*** Semaphores, priority enqueuing test #2, you should read ABCDE:");
|
println("*** Semaphores, priority enqueuing test #2, you should read ABCDE:");
|
||||||
|
chSemInit(&sem1, 0);
|
||||||
t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D");
|
t4 = chThdCreate(NORMALPRIO+2, 0, wsT4, sizeof(wsT4), Thread3, "D");
|
||||||
t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E");
|
t5 = chThdCreate(NORMALPRIO+1, 0, wsT5, sizeof(wsT5), Thread3, "E");
|
||||||
t1 = chThdCreate(NORMALPRIO+5, 0, wsT1, sizeof(wsT1), Thread3, "A");
|
t1 = chThdCreate(NORMALPRIO+5, 0, wsT1, sizeof(wsT1), Thread3, "A");
|
||||||
|
@ -194,50 +172,6 @@ t_msg TestThread(void *p) {
|
||||||
chSemLowerPrioSignal(&sem1);
|
chSemLowerPrioSignal(&sem1);
|
||||||
wait();
|
wait();
|
||||||
println("");
|
println("");
|
||||||
println("*** Semaphores, atomicity test #1, you should read ABCDEABCDE:");
|
|
||||||
chSemInit(&sem1, 0);
|
|
||||||
chSemInit(&sem2, 1);
|
|
||||||
t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread4, "A");
|
|
||||||
t2 = chThdCreate(NORMALPRIO+2, 0, wsT2, sizeof(wsT2), Thread4, "B");
|
|
||||||
t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread4, "C");
|
|
||||||
t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread4, "D");
|
|
||||||
t5 = chThdCreate(NORMALPRIO+5, 0, wsT5, sizeof(wsT5), Thread4, "E");
|
|
||||||
chSemSignal(&sem1);
|
|
||||||
wait();
|
|
||||||
println("");
|
|
||||||
println("*** Semaphores, atomicity test #2, you should read ABCDEABCDE:");
|
|
||||||
chSemInit(&sem1, 0);
|
|
||||||
chSemInit(&sem2, 1);
|
|
||||||
t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread4, "A");
|
|
||||||
t2 = chThdCreate(NORMALPRIO+5, 0, wsT2, sizeof(wsT2), Thread4, "B");
|
|
||||||
t3 = chThdCreate(NORMALPRIO+2, 0, wsT3, sizeof(wsT3), Thread4, "C");
|
|
||||||
t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread4, "D");
|
|
||||||
t5 = chThdCreate(NORMALPRIO+3, 0, wsT5, sizeof(wsT5), Thread4, "E");
|
|
||||||
chSemSignal(&sem1);
|
|
||||||
wait();
|
|
||||||
println("");
|
|
||||||
println("*** Semaphores, atomicity test #3, you should read AABBCCDDEE:");
|
|
||||||
chSemInit(&sem1, 0);
|
|
||||||
chSemInit(&sem2, 1);
|
|
||||||
t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread5, "A");
|
|
||||||
t2 = chThdCreate(NORMALPRIO+2, 0, wsT2, sizeof(wsT2), Thread5, "B");
|
|
||||||
t3 = chThdCreate(NORMALPRIO+3, 0, wsT3, sizeof(wsT3), Thread5, "C");
|
|
||||||
t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread5, "D");
|
|
||||||
t5 = chThdCreate(NORMALPRIO+5, 0, wsT5, sizeof(wsT5), Thread5, "E");
|
|
||||||
chSemSignal(&sem1);
|
|
||||||
wait();
|
|
||||||
println("");
|
|
||||||
println("*** Semaphores, atomicity test #4, you should read AABBCCDDEE:");
|
|
||||||
chSemInit(&sem1, 0);
|
|
||||||
chSemInit(&sem2, 1);
|
|
||||||
t1 = chThdCreate(NORMALPRIO+1, 0, wsT1, sizeof(wsT1), Thread5, "A");
|
|
||||||
t2 = chThdCreate(NORMALPRIO+5, 0, wsT2, sizeof(wsT2), Thread5, "B");
|
|
||||||
t3 = chThdCreate(NORMALPRIO+2, 0, wsT3, sizeof(wsT3), Thread5, "C");
|
|
||||||
t4 = chThdCreate(NORMALPRIO+4, 0, wsT4, sizeof(wsT4), Thread5, "D");
|
|
||||||
t5 = chThdCreate(NORMALPRIO+3, 0, wsT5, sizeof(wsT5), Thread5, "E");
|
|
||||||
chSemSignal(&sem1);
|
|
||||||
wait();
|
|
||||||
println("");
|
|
||||||
println("*** Semaphores, timeout test, you should read ABCDE (slowly):");
|
println("*** Semaphores, timeout test, you should read ABCDE (slowly):");
|
||||||
chSemInit(&sem1, 0);
|
chSemInit(&sem1, 0);
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
|
@ -250,7 +184,7 @@ t_msg TestThread(void *p) {
|
||||||
* Messages test.
|
* Messages test.
|
||||||
*/
|
*/
|
||||||
println("*** Messages, dispatch test, you should read AABBCCDDEE:");
|
println("*** Messages, dispatch test, you should read AABBCCDDEE:");
|
||||||
t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread6, chThdSelf());
|
t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread4, chThdSelf());
|
||||||
do {
|
do {
|
||||||
chMsgRelease(msg = chMsgWait());
|
chMsgRelease(msg = chMsgWait());
|
||||||
if (msg)
|
if (msg)
|
||||||
|
@ -259,7 +193,7 @@ t_msg TestThread(void *p) {
|
||||||
chThdWait(t1);
|
chThdWait(t1);
|
||||||
println("");
|
println("");
|
||||||
println("*** Messages, timeout test, you should read ABCDE (slowly):");
|
println("*** Messages, timeout test, you should read ABCDE (slowly):");
|
||||||
t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread7, chThdSelf());
|
t1 = chThdCreate(NORMALPRIO-1, 0, wsT1, sizeof(wsT1), Thread5, chThdSelf());
|
||||||
for (i = 0; i < 5; i++) {
|
for (i = 0; i < 5; i++) {
|
||||||
chFDDPut(comp, 'A'+i);
|
chFDDPut(comp, 'A'+i);
|
||||||
chMsgSendTimeout(t1, 'A'+i, 500);
|
chMsgSendTimeout(t1, 'A'+i, 500);
|
||||||
|
|
Loading…
Reference in New Issue