git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@14122 27425a3e-05d8-49a3-a47f-9c15f0e5edd8

This commit is contained in:
Giovanni Di Sirio 2021-04-02 10:52:23 +00:00
parent 151b06183f
commit 781b714fd3
4 changed files with 31 additions and 57 deletions

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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 {

View File

@ -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();
}
/** @} */