git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6499 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
0ea5add1da
commit
cdfd3dd254
|
@ -90,6 +90,8 @@ CSRC = $(PORTSRC) \
|
|||
$(OSALSRC) \
|
||||
$(PLATFORMSRC) \
|
||||
$(BOARDSRC) \
|
||||
$(CHIBIOS)/os/various/chprintf.c \
|
||||
$(CHIBIOS)/os/various/shell.c \
|
||||
main.c
|
||||
|
||||
# C++ sources here.
|
||||
|
|
|
@ -20,9 +20,8 @@
|
|||
#include "shell.h"
|
||||
#include "chprintf.h"
|
||||
|
||||
#if 0
|
||||
#define SHELL_WA_SIZE THD_WA_SIZE(1024)
|
||||
#define TEST_WA_SIZE THD_WA_SIZE(256)
|
||||
#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(1024)
|
||||
#define TEST_WA_SIZE THD_WORKING_AREA_SIZE(256)
|
||||
|
||||
static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||
size_t n, size;
|
||||
|
@ -39,8 +38,8 @@ static void cmd_mem(BaseSequentialStream *chp, int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||
static const char *states[] = {THD_STATE_NAMES};
|
||||
Thread *tp;
|
||||
static const char *states[] = {CH_STATE_NAMES};
|
||||
thread_t *tp;
|
||||
|
||||
(void)argv;
|
||||
if (argc > 0) {
|
||||
|
@ -50,23 +49,23 @@ static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
|
|||
chprintf(chp, " addr stack prio refs state time\r\n");
|
||||
tp = chRegFirstThread();
|
||||
do {
|
||||
chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s %lu\r\n",
|
||||
chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s\r\n",
|
||||
(uint32_t)tp, (uint32_t)tp->p_ctx.sp,
|
||||
(uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1),
|
||||
states[tp->p_state], (uint32_t)tp->p_time);
|
||||
states[tp->p_state]);
|
||||
tp = chRegNextThread(tp);
|
||||
} while (tp != NULL);
|
||||
}
|
||||
|
||||
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
|
||||
Thread *tp;
|
||||
thread_t *tp;
|
||||
|
||||
(void)argv;
|
||||
if (argc > 0) {
|
||||
chprintf(chp, "Usage: test\r\n");
|
||||
return;
|
||||
}
|
||||
tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriority(),
|
||||
tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriorityX(),
|
||||
TestThread, chp);
|
||||
if (tp == NULL) {
|
||||
chprintf(chp, "out of memory\r\n");
|
||||
|
@ -90,7 +89,7 @@ static const ShellConfig shell_cfg1 = {
|
|||
/*
|
||||
* LEDs blinker thread, times are in milliseconds.
|
||||
*/
|
||||
static WORKING_AREA(waThread1, 128);
|
||||
static THD_WORKING_AREA(waThread1, 128);
|
||||
static msg_t Thread1(void *arg) {
|
||||
|
||||
(void)arg;
|
||||
|
@ -156,13 +155,12 @@ static msg_t Thread1(void *arg) {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Application entry point.
|
||||
*/
|
||||
int main(void) {
|
||||
// Thread *shelltp = NULL;
|
||||
thread_t *shelltp = NULL;
|
||||
|
||||
/*
|
||||
* System initializations.
|
||||
|
@ -171,36 +169,34 @@ int main(void) {
|
|||
* - Kernel initialization, the main() function becomes a thread and the
|
||||
* RTOS is active.
|
||||
*/
|
||||
// halInit();
|
||||
halInit();
|
||||
chSysInit();
|
||||
|
||||
/*
|
||||
* Shell manager initialization.
|
||||
*/
|
||||
// shellInit();
|
||||
shellInit();
|
||||
|
||||
/*
|
||||
* Activates the serial driver 1 using the driver default configuration.
|
||||
*/
|
||||
// sdStart(&SD1, NULL);
|
||||
sdStart(&SD1, NULL);
|
||||
|
||||
/*
|
||||
* Creates the blinker thread.
|
||||
*/
|
||||
// chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|
||||
chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);
|
||||
|
||||
/*
|
||||
* Normal main() thread activity.
|
||||
*/
|
||||
while (TRUE) {
|
||||
#if 0
|
||||
if (!shelltp)
|
||||
shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO);
|
||||
else if (chThdTerminated(shelltp)) {
|
||||
else if (chThdTerminatedX(shelltp)) {
|
||||
chThdRelease(shelltp); /* Recovers memory of the previous shell. */
|
||||
shelltp = NULL; /* Triggers spawning of a new shell. */
|
||||
}
|
||||
#endif
|
||||
chThdSleepMilliseconds(1000);
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue