Improved demo to make report readable.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14906 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-10-13 11:19:23 +00:00
parent de716ad412
commit 529ed73085
4 changed files with 30 additions and 16 deletions

View File

@ -5,7 +5,7 @@
# Compiler options here. # Compiler options here.
ifeq ($(USE_OPT),) ifeq ($(USE_OPT),)
USE_OPT = -Og -ggdb -fomit-frame-pointer -falign-functions=16 USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
endif endif
# C specific options here (added to USE_OPT). # C specific options here (added to USE_OPT).

View File

@ -101,19 +101,13 @@ static THD_WORKING_AREA(waUnprivileged2, 256);
*/ */
static THD_WORKING_AREA(waThread1, 256); static THD_WORKING_AREA(waThread1, 256);
static THD_FUNCTION(Thread1, arg) { static THD_FUNCTION(Thread1, arg) {
unsigned i = 1U;
(void)arg; (void)arg;
chRegSetThreadName("blinker"); chRegSetThreadName("blinker");
while (true) { while (true) {
palClearLine(LINE_LED_GREEN); palToggleLine(LINE_LED_GREEN);
chThdSleepMilliseconds(500); chThdSleepMilliseconds(500);
(void) sbSendMessageTimeout(&sbx1, (msg_t)i, TIME_MS2I(10));
palSetLine(LINE_LED_GREEN);
chThdSleepMilliseconds(500);
(void) sbSendMessageTimeout(&sbx2, (msg_t)i, TIME_MS2I(10));
i++;
} }
} }
@ -121,6 +115,7 @@ static THD_FUNCTION(Thread1, arg) {
* Application entry point. * Application entry point.
*/ */
int main(void) { int main(void) {
unsigned i = 1U;
thread_t *utp1, *utp2; thread_t *utp1, *utp2;
event_listener_t el1; event_listener_t el1;
@ -190,6 +185,18 @@ int main(void) {
chprintf((BaseSequentialStream *)&LPSD1, "SB2 terminated\r\n"); chprintf((BaseSequentialStream *)&LPSD1, "SB2 terminated\r\n");
} }
} }
if ((i & 1) == 0U) {
if (!chThdTerminatedX(utp1)) {
(void) sbSendMessageTimeout(&sbx1, (msg_t)i, TIME_MS2I(10));
}
}
else {
if (!chThdTerminatedX(utp2)) {
(void) sbSendMessageTimeout(&sbx2, (msg_t)i, TIME_MS2I(10));
}
}
i++;
} }
} }

View File

@ -5,7 +5,7 @@
# Compiler options here. # Compiler options here.
ifeq ($(USE_OPT),) ifeq ($(USE_OPT),)
USE_OPT = -Og -ggdb -fomit-frame-pointer -falign-functions=16 USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16
endif endif
# C specific options here (added to USE_OPT). # C specific options here (added to USE_OPT).

View File

@ -73,19 +73,13 @@ static THD_WORKING_AREA(waUnprivileged2, 256);
*/ */
static THD_WORKING_AREA(waThread1, 256); static THD_WORKING_AREA(waThread1, 256);
static THD_FUNCTION(Thread1, arg) { static THD_FUNCTION(Thread1, arg) {
unsigned i = 1U;
(void)arg; (void)arg;
chRegSetThreadName("blinker"); chRegSetThreadName("blinker");
while (true) { while (true) {
palClearLine(LINE_LED_GREEN); palToggleLine(LINE_LED_GREEN);
chThdSleepMilliseconds(500); chThdSleepMilliseconds(500);
(void) sbSendMessageTimeout(&sbx1, (msg_t)i, TIME_MS2I(10));
palSetLine(LINE_LED_GREEN);
chThdSleepMilliseconds(500);
(void) sbSendMessageTimeout(&sbx2, (msg_t)i, TIME_MS2I(10));
i++;
} }
} }
@ -93,6 +87,7 @@ static THD_FUNCTION(Thread1, arg) {
* Application entry point. * Application entry point.
*/ */
int main(void) { int main(void) {
unsigned i = 1U;
thread_t *utp1, *utp2; thread_t *utp1, *utp2;
event_listener_t el1; event_listener_t el1;
@ -180,6 +175,18 @@ int main(void) {
chprintf((BaseSequentialStream *)&LPSD1, "SB2 terminated\r\n"); chprintf((BaseSequentialStream *)&LPSD1, "SB2 terminated\r\n");
} }
} }
if ((i & 1) == 0U) {
if (!chThdTerminatedX(utp1)) {
(void) sbSendMessageTimeout(&sbx1, (msg_t)i, TIME_MS2I(10));
}
}
else {
if (!chThdTerminatedX(utp2)) {
(void) sbSendMessageTimeout(&sbx2, (msg_t)i, TIME_MS2I(10));
}
}
i++;
} }
} }