From 367bc6bcce15d90b49b040d865c3a8f69321b80e Mon Sep 17 00:00:00 2001 From: Nicolas Reinecke Date: Sun, 1 May 2016 01:38:31 +0200 Subject: update stm32 demo and testhal projects to upstream chibios --- demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c | 75 ++++--------------------- 1 file changed, 10 insertions(+), 65 deletions(-) (limited to 'demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c') diff --git a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c index d0b07d3..aa7ac10 100644 --- a/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c +++ b/demos/STM32/RT-STM32F429-DISCOVERY-DMA2D/main.c @@ -16,18 +16,17 @@ #include "ch.h" #include "hal.h" -#include "test.h" #include "chprintf.h" #include "shell.h" -#if HAL_USE_SERIAL_USB +#if (HAL_USE_SERIAL_USB == TRUE) #include "usbcfg.h" #endif -#include "fsmc_sdram.h" +#include "hal_fsmc_sdram.h" #include "ili9341.h" -#include "stm32_ltdc.h" -#include "stm32_dma2d.h" +#include "hal_stm32_ltdc.h" +#include "hal_stm32_dma2d.h" #include "res/wolf3d_vgagraph_chunk87.h" @@ -474,7 +473,7 @@ static void dma2d_test(void) { /* Command line related. */ /*===========================================================================*/ -#if HAL_USE_SERIAL_USB +#if (HAL_USE_SERIAL_USB == TRUE) /* Virtual serial port over USB.*/ SerialUSBDriver SDU1; #endif @@ -482,57 +481,6 @@ SerialUSBDriver SDU1; #define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048) #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", chCoreGetStatusX()); - 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, "%08lx %08lx %4lu %4lu %9s\r\n", - (uint32_t)tp, (uint32_t)tp->p_ctx.r13, - (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 void cmd_reset(BaseSequentialStream *chp, int argc, char *argv[]) { (void)argv; if (argc > 0) { @@ -546,15 +494,12 @@ static void cmd_reset(BaseSequentialStream *chp, int argc, char *argv[]) { } static const ShellCommand commands[] = { - {"mem", cmd_mem}, - {"threads", cmd_threads}, - {"test", cmd_test}, {"reset", cmd_reset}, {NULL, NULL} }; static const ShellConfig shell_cfg1 = { -#if HAL_USE_SERIAL_USB +#if (HAL_USE_SERIAL_USB == TRUE) (BaseSequentialStream *)&SDU1, #else (BaseSequentialStream *)&SD1, @@ -587,7 +532,7 @@ int main(void) { */ shellInit(); -#if HAL_USE_SERIAL_USB +#if (HAL_USE_SERIAL_USB == TRUE) /* * Initializes a serial-over-USB CDC driver. */ @@ -648,13 +593,13 @@ int main(void) { */ while (true) { if (!shelltp) { -#if HAL_USE_SERIAL_USB +#if (HAL_USE_SERIAL_USB == TRUE) if (SDU1.config->usbp->state == USB_ACTIVE) { /* Spawns a new shell.*/ - shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO); + shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE, "shell", NORMALPRIO, shellThread, (void *) &shell_cfg1); } #else - shelltp = shellCreate(&shell_cfg1, SHELL_WA_SIZE, NORMALPRIO); + shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE, "shell", NORMALPRIO, shellThread, (void *) &shell_cfg1); #endif } else { -- cgit v1.2.3