git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6330 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
67177198e9
commit
2c928f2833
|
@ -27,7 +27,7 @@
|
|||
<link>
|
||||
<name>board</name>
|
||||
<type>2</type>
|
||||
<locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
|
||||
<locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>os</name>
|
||||
|
|
|
@ -152,7 +152,7 @@
|
|||
#define STM32_PWM_USE_TIM2 FALSE
|
||||
#define STM32_PWM_USE_TIM3 FALSE
|
||||
#define STM32_PWM_USE_TIM4 FALSE
|
||||
#define STM32_PWM_USE_TIM5 FALSE
|
||||
#define STM32_PWM_USE_TIM5 TRUE
|
||||
#define STM32_PWM_TIM2_IRQ_PRIORITY 7
|
||||
#define STM32_PWM_TIM3_IRQ_PRIORITY 7
|
||||
#define STM32_PWM_TIM4_IRQ_PRIORITY 7
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<link>
|
||||
<name>board</name>
|
||||
<type>2</type>
|
||||
<locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
|
||||
<locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>os</name>
|
||||
|
|
|
@ -102,10 +102,11 @@ static const ADCConversionGroup adcgrpcfg2 = {
|
|||
/*
|
||||
* Red LEDs blinker thread, times are in milliseconds.
|
||||
*/
|
||||
static WORKING_AREA(waThread1, 128);
|
||||
static msg_t Thread1(void *arg) {
|
||||
static THD_WORKING_AREA(waThread1, 128);
|
||||
static THD_FUNCTION(Thread1, arg) {
|
||||
|
||||
(void)arg;
|
||||
|
||||
chRegSetThreadName("blinker");
|
||||
while (TRUE) {
|
||||
palClearPad(GPIOC, GPIOC_LED1);
|
||||
|
|
|
@ -63,9 +63,9 @@
|
|||
* ADC driver system settings.
|
||||
*/
|
||||
#define STM32_ADC_USE_ADC1 TRUE
|
||||
#define STM32_ADC_USE_SDADC1 FALSE
|
||||
#define STM32_ADC_USE_SDADC2 FALSE
|
||||
#define STM32_ADC_USE_SDADC3 FALSE
|
||||
#define STM32_ADC_USE_SDADC1 TRUE
|
||||
#define STM32_ADC_USE_SDADC2 TRUE
|
||||
#define STM32_ADC_USE_SDADC3 TRUE
|
||||
#define STM32_ADC_ADC1_DMA_PRIORITY 2
|
||||
#define STM32_ADC_SDADC1_DMA_PRIORITY 2
|
||||
#define STM32_ADC_SDADC2_DMA_PRIORITY 2
|
||||
|
@ -81,7 +81,7 @@
|
|||
/*
|
||||
* CAN driver system settings.
|
||||
*/
|
||||
#define STM32_CAN_USE_CAN1 TRUE
|
||||
#define STM32_CAN_USE_CAN1 FALSE
|
||||
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
|
||||
|
||||
/*
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<link>
|
||||
<name>board</name>
|
||||
<type>2</type>
|
||||
<locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
|
||||
<locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>os</name>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
* @brief Enables the ADC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ADC TRUE
|
||||
#define HAL_USE_ADC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -132,7 +132,7 @@
|
|||
* @brief Enables the SPI subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SPI FALSE
|
||||
#define HAL_USE_SPI TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -48,10 +48,11 @@ static uint8_t rxbuf[512];
|
|||
/*
|
||||
* SPI bus contender 1.
|
||||
*/
|
||||
static WORKING_AREA(spi_thread_1_wa, 256);
|
||||
static msg_t spi_thread_1(void *p) {
|
||||
static THD_WORKING_AREA(spi_thread_1_wa, 256);
|
||||
static THD_FUNCTION(spi_thread_1, p) {
|
||||
|
||||
(void)p;
|
||||
|
||||
chRegSetThreadName("SPI thread 1");
|
||||
while (TRUE) {
|
||||
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
|
||||
|
@ -69,10 +70,11 @@ static msg_t spi_thread_1(void *p) {
|
|||
/*
|
||||
* SPI bus contender 2.
|
||||
*/
|
||||
static WORKING_AREA(spi_thread_2_wa, 256);
|
||||
static msg_t spi_thread_2(void *p) {
|
||||
static THD_WORKING_AREA(spi_thread_2_wa, 256);
|
||||
static THD_FUNCTION(spi_thread_2, p) {
|
||||
|
||||
(void)p;
|
||||
|
||||
chRegSetThreadName("SPI thread 2");
|
||||
while (TRUE) {
|
||||
spiAcquireBus(&SPID2); /* Acquire ownership of the bus. */
|
||||
|
@ -91,10 +93,11 @@ static msg_t spi_thread_2(void *p) {
|
|||
* This is a periodic thread that does absolutely nothing except flashing
|
||||
* a LED.
|
||||
*/
|
||||
static WORKING_AREA(blinker_wa, 128);
|
||||
static msg_t blinker(void *arg) {
|
||||
static THD_WORKING_AREA(blinker_wa, 128);
|
||||
static THD_FUNCTION(blinker, arg) {
|
||||
|
||||
(void)arg;
|
||||
|
||||
chRegSetThreadName("blinker");
|
||||
while (TRUE) {
|
||||
palSetPad(GPIOC, GPIOC_LED1);
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
/*
|
||||
* ADC driver system settings.
|
||||
*/
|
||||
#define STM32_ADC_USE_ADC1 TRUE
|
||||
#define STM32_ADC_USE_ADC1 FALSE
|
||||
#define STM32_ADC_USE_SDADC1 FALSE
|
||||
#define STM32_ADC_USE_SDADC2 FALSE
|
||||
#define STM32_ADC_USE_SDADC3 FALSE
|
||||
|
@ -81,7 +81,7 @@
|
|||
/*
|
||||
* CAN driver system settings.
|
||||
*/
|
||||
#define STM32_CAN_USE_CAN1 TRUE
|
||||
#define STM32_CAN_USE_CAN1 FALSE
|
||||
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
|
||||
|
||||
/*
|
||||
|
@ -175,9 +175,9 @@
|
|||
/*
|
||||
* SPI driver system settings.
|
||||
*/
|
||||
#define STM32_SPI_USE_SPI1 FALSE
|
||||
#define STM32_SPI_USE_SPI2 FALSE
|
||||
#define STM32_SPI_USE_SPI3 FALSE
|
||||
#define STM32_SPI_USE_SPI1 TRUE
|
||||
#define STM32_SPI_USE_SPI2 TRUE
|
||||
#define STM32_SPI_USE_SPI3 TRUE
|
||||
#define STM32_SPI_SPI1_DMA_PRIORITY 1
|
||||
#define STM32_SPI_SPI2_DMA_PRIORITY 1
|
||||
#define STM32_SPI_SPI3_DMA_PRIORITY 1
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<link>
|
||||
<name>board</name>
|
||||
<type>2</type>
|
||||
<locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
|
||||
<locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>os</name>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
* @brief Enables the ADC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ADC TRUE
|
||||
#define HAL_USE_ADC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -139,7 +139,7 @@
|
|||
* @brief Enables the UART subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_UART FALSE
|
||||
#define HAL_USE_UART TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,15 +17,15 @@
|
|||
#include "ch.h"
|
||||
#include "hal.h"
|
||||
|
||||
static VirtualTimer vt1, vt2;
|
||||
static virtual_timer_t vt1, vt2;
|
||||
|
||||
static void restart(void *p) {
|
||||
|
||||
(void)p;
|
||||
|
||||
chSysLockFromIsr();
|
||||
chSysLockFromISR();
|
||||
uartStartSendI(&UARTD2, 14, "Hello World!\r\n");
|
||||
chSysUnlockFromIsr();
|
||||
chSysUnlockFromISR();
|
||||
}
|
||||
|
||||
static void ledoff(void *p) {
|
||||
|
@ -51,11 +51,10 @@ static void txend2(UARTDriver *uartp) {
|
|||
|
||||
(void)uartp;
|
||||
palSetPad(GPIOC, GPIOC_LED1);
|
||||
chSysLockFromIsr();
|
||||
if (chVTIsArmedI(&vt1))
|
||||
chVTResetI(&vt1);
|
||||
chVTSetI(&vt1, MS2ST(5000), restart, NULL);
|
||||
chSysUnlockFromIsr();
|
||||
chSysLockFromISR();
|
||||
chVTResetI(&vt1);
|
||||
chVTDoSetI(&vt1, MS2ST(5000), restart, NULL);
|
||||
chSysUnlockFromISR();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -78,11 +77,10 @@ static void rxchar(UARTDriver *uartp, uint16_t c) {
|
|||
(void)c;
|
||||
/* Flashing the LED each time a character is received.*/
|
||||
palClearPad(GPIOC, GPIOC_LED1);
|
||||
chSysLockFromIsr();
|
||||
if (chVTIsArmedI(&vt2))
|
||||
chVTResetI(&vt2);
|
||||
chVTSetI(&vt2, MS2ST(200), ledoff, NULL);
|
||||
chSysUnlockFromIsr();
|
||||
chSysLockFromISR();
|
||||
chVTResetI(&vt2);
|
||||
chVTDoSetI(&vt2, MS2ST(200), ledoff, NULL);
|
||||
chSysUnlockFromISR();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
/*
|
||||
* ADC driver system settings.
|
||||
*/
|
||||
#define STM32_ADC_USE_ADC1 TRUE
|
||||
#define STM32_ADC_USE_ADC1 FALSE
|
||||
#define STM32_ADC_USE_SDADC1 FALSE
|
||||
#define STM32_ADC_USE_SDADC2 FALSE
|
||||
#define STM32_ADC_USE_SDADC3 FALSE
|
||||
|
@ -81,7 +81,7 @@
|
|||
/*
|
||||
* CAN driver system settings.
|
||||
*/
|
||||
#define STM32_CAN_USE_CAN1 TRUE
|
||||
#define STM32_CAN_USE_CAN1 FALSE
|
||||
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
|
||||
|
||||
/*
|
||||
|
@ -195,9 +195,9 @@
|
|||
/*
|
||||
* UART driver system settings.
|
||||
*/
|
||||
#define STM32_UART_USE_USART1 FALSE
|
||||
#define STM32_UART_USE_USART2 FALSE
|
||||
#define STM32_UART_USE_USART3 FALSE
|
||||
#define STM32_UART_USE_USART1 TRUE
|
||||
#define STM32_UART_USE_USART2 TRUE
|
||||
#define STM32_UART_USE_USART3 TRUE
|
||||
#define STM32_UART_USART1_IRQ_PRIORITY 12
|
||||
#define STM32_UART_USART2_IRQ_PRIORITY 12
|
||||
#define STM32_UART_USART3_IRQ_PRIORITY 12
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<link>
|
||||
<name>board</name>
|
||||
<type>2</type>
|
||||
<locationURI>CHIBIOS/boards/ST_STM32373C_EVAL</locationURI>
|
||||
<locationURI>CHIBIOS/os/hal/boards/ST_STM32373C_EVAL</locationURI>
|
||||
</link>
|
||||
<link>
|
||||
<name>os</name>
|
||||
|
|
|
@ -96,6 +96,8 @@ CSRC = $(PORTSRC) \
|
|||
$(OSALSRC) \
|
||||
$(PLATFORMSRC) \
|
||||
$(BOARDSRC) \
|
||||
$(CHIBIOS)/os/various/chprintf.c \
|
||||
$(CHIBIOS)/os/various/shell.c \
|
||||
main.c
|
||||
|
||||
# C++ sources that can be compiled in ARM or THUMB mode depending on the global
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
* @brief Enables the ADC subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_ADC TRUE
|
||||
#define HAL_USE_ADC FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -125,7 +125,7 @@
|
|||
* @brief Enables the SERIAL over USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_SERIAL_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_SERIAL_USB FALSE
|
||||
#define HAL_USE_SERIAL_USB TRUE
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -146,7 +146,7 @@
|
|||
* @brief Enables the USB subsystem.
|
||||
*/
|
||||
#if !defined(HAL_USE_USB) || defined(__DOXYGEN__)
|
||||
#define HAL_USE_USB FALSE
|
||||
#define HAL_USE_USB TRUE
|
||||
#endif
|
||||
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -291,7 +291,7 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
|
|||
case USB_EVENT_ADDRESS:
|
||||
return;
|
||||
case USB_EVENT_CONFIGURED:
|
||||
chSysLockFromIsr();
|
||||
chSysLockFromISR();
|
||||
|
||||
/* Enables the endpoints specified into the configuration.
|
||||
Note, this callback is invoked from an ISR so I-Class functions
|
||||
|
@ -302,7 +302,7 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
|
|||
/* Resetting the state of the CDC subsystem.*/
|
||||
sduConfigureHookI(&SDU1);
|
||||
|
||||
chSysUnlockFromIsr();
|
||||
chSysUnlockFromISR();
|
||||
return;
|
||||
case USB_EVENT_SUSPEND:
|
||||
return;
|
||||
|
@ -338,8 +338,8 @@ static const SerialUSBConfig serusbcfg = {
|
|||
/* Command line related. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#define SHELL_WA_SIZE THD_WA_SIZE(2048)
|
||||
#define TEST_WA_SIZE THD_WA_SIZE(256)
|
||||
#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;
|
||||
|
@ -356,8 +356,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) {
|
||||
|
@ -367,23 +367,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.r13,
|
||||
(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");
|
||||
|
@ -443,10 +443,11 @@ static const ShellConfig shell_cfg1 = {
|
|||
/*
|
||||
* Red LED blinker thread, times are in milliseconds.
|
||||
*/
|
||||
static WORKING_AREA(waThread1, 128);
|
||||
static msg_t Thread1(void *arg) {
|
||||
static THD_WORKING_AREA(waThread1, 128);
|
||||
static THD_FUNCTION(Thread1, arg) {
|
||||
|
||||
(void)arg;
|
||||
|
||||
chRegSetThreadName("blinker");
|
||||
while (TRUE) {
|
||||
systime_t time = serusbcfg.usbp->state == USB_ACTIVE ? 250 : 500;
|
||||
|
@ -461,7 +462,7 @@ static msg_t Thread1(void *arg) {
|
|||
* Application entry point.
|
||||
*/
|
||||
int main(void) {
|
||||
Thread *shelltp = NULL;
|
||||
thread_t *shelltp = NULL;
|
||||
|
||||
/*
|
||||
* System initializations.
|
||||
|
@ -506,7 +507,7 @@ int main(void) {
|
|||
while (TRUE) {
|
||||
if (!shelltp && (SDU1.config->usbp->state == USB_ACTIVE))
|
||||
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. */
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
/*
|
||||
* ADC driver system settings.
|
||||
*/
|
||||
#define STM32_ADC_USE_ADC1 TRUE
|
||||
#define STM32_ADC_USE_ADC1 FALSE
|
||||
#define STM32_ADC_USE_SDADC1 FALSE
|
||||
#define STM32_ADC_USE_SDADC2 FALSE
|
||||
#define STM32_ADC_USE_SDADC3 FALSE
|
||||
|
@ -81,7 +81,7 @@
|
|||
/*
|
||||
* CAN driver system settings.
|
||||
*/
|
||||
#define STM32_CAN_USE_CAN1 TRUE
|
||||
#define STM32_CAN_USE_CAN1 FALSE
|
||||
#define STM32_CAN_CAN1_IRQ_PRIORITY 11
|
||||
|
||||
/*
|
||||
|
@ -209,7 +209,7 @@
|
|||
/*
|
||||
* USB driver system settings.
|
||||
*/
|
||||
#define STM32_USB_USE_USB1 FALSE
|
||||
#define STM32_USB_USE_USB1 TRUE
|
||||
#define STM32_USB_LOW_POWER_ON_SUSPEND FALSE
|
||||
#define STM32_USB_USB1_HP_IRQ_PRIORITY 13
|
||||
#define STM32_USB_USB1_LP_IRQ_PRIORITY 14
|
||||
|
|
Loading…
Reference in New Issue