git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7041 35acf78f-673a-0410-8e92-d51de3d6d3f4
parent
25069afdb7
commit
3b9e182f11
|
@ -18,74 +18,6 @@
|
||||||
#include "hal.h"
|
#include "hal.h"
|
||||||
//#include "test.h"
|
//#include "test.h"
|
||||||
|
|
||||||
#if 0
|
|
||||||
#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;
|
|
||||||
|
|
||||||
(void)argv;
|
|
||||||
if (argc > 0) {
|
|
||||||
chprintf(chp, "Usage: mem\r\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
n = chHeapStatus(NULL, &size);
|
|
||||||
chprintf(chp, "core free memory : %u bytes\r\n", chCoreStatus());
|
|
||||||
chprintf(chp, "heap fragments : %u\r\n", n);
|
|
||||||
chprintf(chp, "heap free total : %u bytes\r\n", size);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cmd_threads(BaseSequentialStream *chp, int argc, char *argv[]) {
|
|
||||||
static const char *states[] = {CH_STATE_NAMES};
|
|
||||||
thread_t *tp;
|
|
||||||
|
|
||||||
(void)argv;
|
|
||||||
if (argc > 0) {
|
|
||||||
chprintf(chp, "Usage: threads\r\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
chprintf(chp, " addr stack prio refs state time\r\n");
|
|
||||||
tp = chRegFirstThread();
|
|
||||||
do {
|
|
||||||
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]);
|
|
||||||
tp = chRegNextThread(tp);
|
|
||||||
} while (tp != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cmd_test(BaseSequentialStream *chp, int argc, char *argv[]) {
|
|
||||||
thread_t *tp;
|
|
||||||
|
|
||||||
(void)argv;
|
|
||||||
if (argc > 0) {
|
|
||||||
chprintf(chp, "Usage: test\r\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
tp = chThdCreateFromHeap(NULL, TEST_WA_SIZE, chThdGetPriorityX(),
|
|
||||||
TestThread, chp);
|
|
||||||
if (tp == NULL) {
|
|
||||||
chprintf(chp, "out of memory\r\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
chThdWait(tp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const ShellCommand commands[] = {
|
|
||||||
{"mem", cmd_mem},
|
|
||||||
{"threads", cmd_threads},
|
|
||||||
{"test", cmd_test},
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
static const ShellConfig shell_cfg1 = {
|
|
||||||
(BaseSequentialStream *)&SD1,
|
|
||||||
commands
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* LEDs blinker thread, times are in milliseconds.
|
* LEDs blinker thread, times are in milliseconds.
|
||||||
*/
|
*/
|
||||||
|
@ -174,7 +106,7 @@ int main(void) {
|
||||||
* - Kernel initialization, the main() function becomes a thread and the
|
* - Kernel initialization, the main() function becomes a thread and the
|
||||||
* RTOS is active.
|
* RTOS is active.
|
||||||
*/
|
*/
|
||||||
// halInit();
|
halInit();
|
||||||
chSysInit();
|
chSysInit();
|
||||||
|
|
||||||
/* This is now the idle thread loop, you may perform here a low priority
|
/* This is now the idle thread loop, you may perform here a low priority
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
* @note This number is not inclusive of the idle thread which is
|
* @note This number is not inclusive of the idle thread which is
|
||||||
* Implicitly handled.
|
* Implicitly handled.
|
||||||
*/
|
*/
|
||||||
#define NIL_CFG_NUM_THREADS 3
|
#define NIL_CFG_NUM_THREADS 1
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,8 @@ void port_dummy1(void) {
|
||||||
asm ("stw %r0, 0(%sp)"); /* CR. */
|
asm ("stw %r0, 0(%sp)"); /* CR. */
|
||||||
asm ("stmw %r14, 4(%sp)"); /* GPR14...GPR31. */
|
asm ("stmw %r14, 4(%sp)"); /* GPR14...GPR31. */
|
||||||
|
|
||||||
asm ("stw %sp, 12(%r4)"); /* Store swapped-out stack. */
|
asm ("stw %sp, 0(%r4)"); /* Store swapped-out stack. */
|
||||||
asm ("lwz %sp, 12(%r3)"); /* Load swapped-in stack. */
|
asm ("lwz %sp, 0(%r3)"); /* Load swapped-in stack. */
|
||||||
|
|
||||||
asm ("lmw %r14, 4(%sp)"); /* GPR14...GPR31. */
|
asm ("lmw %r14, 4(%sp)"); /* GPR14...GPR31. */
|
||||||
asm ("lwz %r0, 0(%sp)"); /* CR. */
|
asm ("lwz %r0, 0(%sp)"); /* CR. */
|
||||||
|
|
Loading…
Reference in New Issue