diff --git a/demos/RP/RT-RP2040-PICO/c1_main.c b/demos/RP/RT-RP2040-PICO/c1_main.c index 97e9a2399..8ea18748c 100644 --- a/demos/RP/RT-RP2040-PICO/c1_main.c +++ b/demos/RP/RT-RP2040-PICO/c1_main.c @@ -17,21 +17,19 @@ #include "ch.h" #include "hal.h" -/* - * Green LED blinker thread, times are in milliseconds. - */ -static THD_WORKING_AREA(waThread1, 128); -static THD_FUNCTION(Thread1, arg) { +#include "shell.h" +#include "chprintf.h" - (void)arg; - chRegSetThreadName("blinker"); - while (true) { - palClearLine(25U); - chThdSleepMilliseconds(500); - palSetLine(25U); - chThdSleepMilliseconds(500); - } -} +#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048) + +static const ShellCommand commands[] = { + {NULL, NULL} +}; + +static const ShellConfig shell_cfg1 = { + (BaseSequentialStream *)&SIOD1, + commands +}; /** * @brief Core 1 OS instance. @@ -81,18 +79,22 @@ void c1_main(void) { */ palSetLineMode(0U, PAL_MODE_ALTERNATE_UART); palSetLineMode(1U, PAL_MODE_ALTERNATE_UART); - palSetLineMode(25U, PAL_MODE_OUTPUT_PUSHPULL | PAL_RP_PAD_DRIVE12); /* - * Creates the blinker thread. + * Activates the Serial or SIO driver using the default configuration. */ - chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); + sioStart(&SIOD1, NULL); + sioStartOperation(&SIOD1, NULL); /* * Normal main() thread activity, in this demo it does nothing except - * sleeping in a loop. + * sleeping in a loop (re)spawning a shell. */ while (true) { + thread_t *shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE, + "shell", NORMALPRIO + 1, + shellThread, (void *)&shell_cfg1); + chThdWait(shelltp); /* Waiting termination. */ chThdSleepMilliseconds(500); } } diff --git a/demos/RP/RT-RP2040-PICO/main.c b/demos/RP/RT-RP2040-PICO/main.c index c284bf850..18ccd4fd5 100644 --- a/demos/RP/RT-RP2040-PICO/main.c +++ b/demos/RP/RT-RP2040-PICO/main.c @@ -16,24 +16,7 @@ #include "ch.h" #include "hal.h" -#include "rt_test_root.h" -#include "oslib_test_root.h" -#include "shell.h" -#include "chprintf.h" - -#define SHELL_WA_SIZE THD_WORKING_AREA_SIZE(2048) - -static const ShellCommand commands[] = { - {NULL, NULL} -}; - -static const ShellConfig shell_cfg1 = { - (BaseSequentialStream *)&SIOD1, - commands -}; - -#if 0 /* * Green LED blinker thread, times are in milliseconds. */ @@ -49,7 +32,6 @@ static THD_FUNCTION(Thread1, arg) { chThdSleepMilliseconds(500); } } -#endif /* Courtesy of Pico-SDK.*/ static void start_core1(void) { @@ -100,30 +82,18 @@ int main(void) { /* * Setting up GPIOs. */ -// palSetLineMode(0U, PAL_MODE_ALTERNATE_UART); -// palSetLineMode(1U, PAL_MODE_ALTERNATE_UART); -// palSetLineMode(25U, PAL_MODE_OUTPUT_PUSHPULL | PAL_RP_PAD_DRIVE12); - - /* - * Activates the Serial or SIO driver using the default configuration. - */ - sioStart(&SIOD1, NULL); - sioStartOperation(&SIOD1, NULL); + palSetLineMode(25U, PAL_MODE_OUTPUT_PUSHPULL | PAL_RP_PAD_DRIVE12); /* * Creates the blinker thread. */ -// chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); + chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL); /* * Normal main() thread activity, in this demo it does nothing except - * sleeping in a loop (re)spawning a shell. + * sleeping in a loop. */ while (true) { - thread_t *shelltp = chThdCreateFromHeap(NULL, SHELL_WA_SIZE, - "shell", NORMALPRIO + 1, - shellThread, (void *)&shell_cfg1); - chThdWait(shelltp); /* Waiting termination. */ chThdSleepMilliseconds(500); } } diff --git a/os/hal/ports/RP/LLD/UARTv1/hal_sio_lld.c b/os/hal/ports/RP/LLD/UARTv1/hal_sio_lld.c index baa928e7a..00d737f4f 100644 --- a/os/hal/ports/RP/LLD/UARTv1/hal_sio_lld.c +++ b/os/hal/ports/RP/LLD/UARTv1/hal_sio_lld.c @@ -232,11 +232,13 @@ bool sio_lld_start(SIODriver *siop) { #if RP_SIO_USE_UART0 == TRUE else if (&SIOD1 == siop) { hal_lld_peripheral_unreset(RESETS_ALLREG_UART0); + nvicEnableVector(RP_UART0_IRQ_NUMBER, RP_IRQ_UART0_PRIORITY); } #endif #if RP_SIO_USE_UART1 == TRUE else if (&SIOD2 == siop) { hal_lld_peripheral_unreset(RESETS_ALLREG_UART1); + nvicEnableVector(RP_UART1_IRQ_NUMBER, RP_IRQ_UART1_PRIORITY); } #endif else { @@ -275,14 +277,14 @@ void sio_lld_stop(SIODriver *siop) { } #if RP_SIO_USE_UART0 == TRUE else if (&SIOD1 == siop) { + nvicDisableVector(RP_UART0_IRQ_NUMBER); hal_lld_peripheral_reset(RESETS_ALLREG_UART0); -// rccDisableUSART1(); } #endif #if RP_SIO_USE_UART1 == TRUE else if (&SIOD2 == siop) { + nvicDisableVector(RP_UART1_IRQ_NUMBER); hal_lld_peripheral_reset(RESETS_ALLREG_UART1); -// rccDisableUSART2(); } #endif else { diff --git a/os/hal/ports/RP/RP2040/rp_isr.c b/os/hal/ports/RP/RP2040/rp_isr.c index b854eecae..160ed67f1 100644 --- a/os/hal/ports/RP/RP2040/rp_isr.c +++ b/os/hal/ports/RP/RP2040/rp_isr.c @@ -58,8 +58,8 @@ */ void irqInit(void) { - uart0_irq_init(); - uart1_irq_init(); +// uart0_irq_init(); +// uart1_irq_init(); } /** @@ -69,8 +69,8 @@ void irqInit(void) { */ void irqDeinit(void) { - uart0_irq_deinit(); - uart1_irq_deinit(); +// uart0_irq_deinit(); +// uart1_irq_deinit(); } /** @} */