Migrating to chibios18 (#687)

* first step #631

* chconf #631

* no EXT driver

* #631 progress

* #631 WOW it already compiles?!

* #631 simulator progress

* #631 CAN is back

* more changes about 25MHz

* Migrate to Chibios 18 stable #631

* undoing some merge mistake?

* little mess

* Migrate to Chibios 18 stable #631

* Migrate to Chibios 18 stable #631

* Migrate to Chibios 18 stable #631
joystick works!

* Migrate to Chibios 18 stable #631
done?!
This commit is contained in:
rusefi 2019-02-05 18:36:25 -05:00 committed by GitHub
parent bb40911bfa
commit a3b150a171
18 changed files with 400 additions and 106 deletions

2
.gitmodules vendored
View File

@ -1,7 +1,7 @@
[submodule "firmware/ChibiOS"]
path = firmware/ChibiOS4
url = https://github.com/rusefi/ChibiOS.git
branch = stable_17.6.rusefi
branch = stable_18.2.rusefi
[submodule "firmware/ChibiOS-Contrib"]
path = firmware/ChibiOS-Contrib
url = https://github.com/ChibiOS/ChibiOS-Contrib.git

@ -1 +1 @@
Subproject commit b5321c7e0ef470ed2dbb50dc1322c1252dea2d50
Subproject commit bdcee915863d3f4bcc561c192cef1155e1f65b02

@ -1 +1 @@
Subproject commit 0be2c22cb0809c62f5d90c94697c5a113940eec7
Subproject commit 128405fb03b41d63225ac3197806e80727ba6a74

View File

@ -171,7 +171,7 @@ CSRC = $(STARTUPSRC) \
$(PLATFORMSRC) \
$(BOARDSRC) \
$(BOOTLOADERSRC) \
$(CHIBIOS)/os/various/devices_lib/accel/lis302dl.c \
$(CHIBIOS)/os/ex/ST/lis302dl.c \
$(CHIBIOS)/os/various/syscalls.c \
$(CHIBIOS)/os/hal/lib/streams/memstreams.c \
$(CHIBIOS)/os/hal/lib/streams/chprintf.c \
@ -252,7 +252,8 @@ INCDIR = $(CHIBIOS)/os/license \
$(CHCPPINC) \
$(CHIBIOS)/os/hal/lib/streams \
$(CHIBIOS)/os/various \
$(CHIBIOS)/os/various/devices_lib/accel \
$(CHIBIOS)/os/ex/ST \
$(CHIBIOS)/os/hal/lib/peripherals/sensors \
$(CONFIGPATH) \
config/engines \
config \

View File

@ -1,5 +1,5 @@
/*
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -20,14 +20,70 @@
*/
#include "hal.h"
#include "stm32_gpio.h"
#if HAL_USE_PAL || defined(__DOXYGEN__)
/**
* @brief Type of STM32 GPIO port setup.
*/
typedef struct {
uint32_t moder;
uint32_t otyper;
uint32_t ospeedr;
uint32_t pupdr;
uint32_t odr;
uint32_t afrl;
uint32_t afrh;
} gpio_setup_t;
/**
* @brief Type of STM32 GPIO initialization data.
*/
typedef struct {
#if STM32_HAS_GPIOA || defined(__DOXYGEN__)
gpio_setup_t PAData;
#endif
#if STM32_HAS_GPIOB || defined(__DOXYGEN__)
gpio_setup_t PBData;
#endif
#if STM32_HAS_GPIOC || defined(__DOXYGEN__)
gpio_setup_t PCData;
#endif
#if STM32_HAS_GPIOD || defined(__DOXYGEN__)
gpio_setup_t PDData;
#endif
#if STM32_HAS_GPIOE || defined(__DOXYGEN__)
gpio_setup_t PEData;
#endif
#if STM32_HAS_GPIOF || defined(__DOXYGEN__)
gpio_setup_t PFData;
#endif
#if STM32_HAS_GPIOG || defined(__DOXYGEN__)
gpio_setup_t PGData;
#endif
#if STM32_HAS_GPIOH || defined(__DOXYGEN__)
gpio_setup_t PHData;
#endif
#if STM32_HAS_GPIOI || defined(__DOXYGEN__)
gpio_setup_t PIData;
#endif
#if STM32_HAS_GPIOJ || defined(__DOXYGEN__)
gpio_setup_t PJData;
#endif
#if STM32_HAS_GPIOK || defined(__DOXYGEN__)
gpio_setup_t PKData;
#endif
} gpio_config_t;
/**
* @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
* This variable is used by the HAL when initializing the PAL driver.
*/
const PALConfig pal_default_config = {
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -65,7 +121,65 @@ const PALConfig pal_default_config = {
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH}
#endif
};
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
static void gpio_init(stm32_gpio_t *gpiop, const gpio_setup_t *config) {
gpiop->OTYPER = config->otyper;
gpiop->OSPEEDR = config->ospeedr;
gpiop->PUPDR = config->pupdr;
gpiop->ODR = config->odr;
gpiop->AFRL = config->afrl;
gpiop->AFRH = config->afrh;
gpiop->MODER = config->moder;
}
static void stm32_gpio_init(void) {
/* Enabling GPIO-related clocks, the mask comes from the
registry header file.*/
rccResetAHB1(STM32_GPIO_EN_MASK);
rccEnableAHB1(STM32_GPIO_EN_MASK, true);
/* Initializing all the defined GPIO ports.*/
#if STM32_HAS_GPIOA
gpio_init(GPIOA, &gpio_default_config.PAData);
#endif
#if STM32_HAS_GPIOB
gpio_init(GPIOB, &gpio_default_config.PBData);
#endif
#if STM32_HAS_GPIOC
gpio_init(GPIOC, &gpio_default_config.PCData);
#endif
#if STM32_HAS_GPIOD
gpio_init(GPIOD, &gpio_default_config.PDData);
#endif
#if STM32_HAS_GPIOE
gpio_init(GPIOE, &gpio_default_config.PEData);
#endif
#if STM32_HAS_GPIOF
gpio_init(GPIOF, &gpio_default_config.PFData);
#endif
#if STM32_HAS_GPIOG
gpio_init(GPIOG, &gpio_default_config.PGData);
#endif
#if STM32_HAS_GPIOH
gpio_init(GPIOH, &gpio_default_config.PHData);
#endif
#if STM32_HAS_GPIOI
gpio_init(GPIOI, &gpio_default_config.PIData);
#endif
#if STM32_HAS_GPIOJ
gpio_init(GPIOJ, &gpio_default_config.PJData);
#endif
#if STM32_HAS_GPIOK
gpio_init(GPIOK, &gpio_default_config.PKData);
#endif
}
/**
* @brief Early initialization code.
@ -74,8 +188,10 @@ const PALConfig pal_default_config = {
*/
void __early_init(void) {
stm32_clock_init();
stm32_gpio_init();
stm32_clock_init();
}
#endif
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**

View File

@ -32,6 +32,7 @@
#define CORE_CLOCK 168000000
#define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_5_1_
#define PORT_IDLE_THREAD_STACK_SIZE 1024
#define PORT_INT_REQUIRED_STACK 768
@ -99,6 +100,22 @@ extern "C"
*/
#define CH_CFG_ST_FREQUENCY 1000
/**
* @brief Time intervals data size.
* @note Allowed values are 16, 32 or 64 bits.
*/
#if !defined(CH_CFG_INTERVALS_SIZE)
#define CH_CFG_INTERVALS_SIZE 32
#endif
/**
* @brief Time types data size.
* @note Allowed values are 16 or 32 bits.
*/
#if !defined(CH_CFG_TIME_TYPES_SIZE)
#define CH_CFG_TIME_TYPES_SIZE 32
#endif
/**
* @brief Time delta constant for the tick-less mode.
* @note If this value is zero then the system uses the classic
@ -407,7 +424,84 @@ extern "C"
* @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
*/
#if !defined(CH_CFG_USE_DYNAMIC)
#define CH_CFG_USE_DYNAMIC FALSE
#endif
/**
* @brief Objects FIFOs APIs.
* @details If enabled then the objects FIFOs APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_OBJ_FIFOS)
#define CH_CFG_USE_OBJ_FIFOS FALSE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Objects factory options
* @{
*/
/*===========================================================================*/
/**
* @brief Objects Factory APIs.
* @details If enabled then the objects factory APIs are included in the
* kernel.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_CFG_USE_FACTORY)
#define CH_CFG_USE_FACTORY FALSE
#endif
/**
* @brief Maximum length for object names.
* @details If the specified length is zero then the name is stored by
* pointer but this could have unintended side effects.
*/
#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
#endif
/**
* @brief Enables the registry of generic objects.
*/
#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
#define CH_CFG_FACTORY_OBJECTS_REGISTRY FALSE
#endif
/**
* @brief Enables factory for generic buffers.
*/
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
#define CH_CFG_FACTORY_GENERIC_BUFFERS FALSE
#endif
/**
* @brief Enables factory for semaphores.
*/
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
#define CH_CFG_FACTORY_SEMAPHORES FALSE
#endif
/**
* @brief Enables factory for mailboxes.
*/
#if !defined(CH_CFG_FACTORY_MAILBOXES)
#define CH_CFG_FACTORY_MAILBOXES FALSE
#endif
/**
* @brief Enables factory for objects FIFOs.
*/
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
#define CH_CFG_FACTORY_OBJ_FIFOS FALSE
#endif
/** @} */
@ -545,6 +639,22 @@ extern "C"
*/
/*===========================================================================*/
/**
* @brief System structure extension.
* @details User fields added to the end of the @p ch_system_t structure.
*/
#define CH_CFG_SYSTEM_EXTRA_FIELDS \
/* Add threads custom fields here.*/
/**
* @brief System initialization hook.
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
#define CH_CFG_SYSTEM_INIT_HOOK() { \
/* Add threads initialization code here.*/ \
}
/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure.

View File

@ -142,7 +142,7 @@
#endif
#if !defined(EFI_MEMS) || defined(__DOXYGEN__)
#define EFI_MEMS TRUE
#define EFI_MEMS FALSE
#endif
#ifndef EFI_INTERNAL_ADC

View File

@ -62,7 +62,7 @@
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT TRUE
#define HAL_USE_EXT FALSE
#endif
/**

View File

@ -21,7 +21,7 @@
* @brief Enables the community overlay.
*/
#if !defined(HAL_USE_COMMUNITY) || defined(__DOXYGEN__)
#define HAL_USE_COMMUNITY TRUE
#define HAL_USE_COMMUNITY FALSE
#endif
/**

View File

@ -135,8 +135,5 @@ void unlockAnyContext(void);
}
#endif
// a step towards ChibiOS18
#define TIME_MS2I(x) MS2ST(x)
#endif /* GLOBAL_H_ */

View File

@ -43,17 +43,14 @@ void ionPostState(TunerStudioOutputChannels *tsOutputChannels) {
static CdmState instance;
static void extIonCallback(EXTDriver *extp, expchannel_t channel) {
UNUSED(extp);
static void extIonCallback(int pinIndex) {
UNUSED(pinIndex);
int currentRevolution = engine->triggerCentral.triggerState.getTotalRevolutionCounter();
instance.onNewSignal(currentRevolution);
}
void cdmIonInit(void) {
// todo: allow 'GPIOA_0' once we migrate to new mandatory configuration
if (CONFIGB(cdmInputPin) == GPIOA_0 || CONFIGB(cdmInputPin) == GPIO_UNASSIGNED) {
@ -65,10 +62,7 @@ void cdmIonInit(void) {
return;
}
enableExti(CONFIGB(cdmInputPin), EXT_CH_MODE_RISING_EDGE, extIonCallback);
enableExti(CONFIGB(cdmInputPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extIonCallback);
}
#endif /* EFI_CDM_INTEGRATION */

View File

@ -7,7 +7,7 @@
#include "global.h"
#if HAL_USE_EXT || defined(__DOXYGEN__)
#if HAL_USE_PAL && EFI_PROD_CODE || defined(__DOXYGEN__)
#include "digital_input_exti.h"
#include "efiGpio.h"
@ -19,63 +19,17 @@
* because pin '0' would be used on two different ports
*/
static EXTConfig extcfg = { {
/* CH#00 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#01 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#02 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#03 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#04 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#05 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#06 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#07 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#08 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#09 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#10 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#11 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#12 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#13 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#14 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#15 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#16 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#17 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#18 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#19 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#20 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#21 */{ EXT_CH_MODE_DISABLED, NULL },
/* CH#22 */{ EXT_CH_MODE_DISABLED, NULL } } };
static uint32_t getExtMode(ioportid_t port) {
if (port == GPIOA) {
return EXT_MODE_GPIOA;
} else if (port == GPIOB) {
return EXT_MODE_GPIOB;
} else if (port == GPIOC) {
return EXT_MODE_GPIOC;
} else if (port == GPIOD) {
return EXT_MODE_GPIOD;
} else if (port == GPIOE) {
return EXT_MODE_GPIOE;
} else if (port == GPIOF) {
return EXT_MODE_GPIOF;
}
firmwareError(CUSTOM_ERR_EXT_MODE, "Unsupported %d", port);
return 0;
}
// EXT is not able to give you the front direction but you could read the pin in the callback.
void enableExti(brain_pin_e pin, uint32_t mode, extcallback_t cb) {
void enableExti(brain_pin_e pin, uint32_t mode, palcallback_t cb) {
if (pin == GPIO_UNASSIGNED)
return;
int index = getHwPin("joy", pin);
ioportid_t port = getHwPort("joy", pin);
extcfg.channels[index].mode = mode | EXT_CH_MODE_AUTOSTART | getExtMode(port);
extcfg.channels[index].cb = cb;
ioline_t line = PAL_LINE(port, index);
palEnableLineEvent(line, mode);
palSetLineCallback(line, cb, (void*)index);
}
void myExtStart(void) {
extStart(&EXTD1, &extcfg);
}
#endif /* HAL_USE_EXT */
#endif /* HAL_USE_PAL && EFI_PROD_CODE */

View File

@ -10,9 +10,8 @@
#include "global.h"
#if HAL_USE_EXT || defined(__DOXYGEN__)
void enableExti(brain_pin_e pin, uint32_t mode, extcallback_t cb);
void myExtStart(void);
#endif
#if HAL_USE_PAL || defined(__DOXYGEN__)
void enableExti(brain_pin_e pin, uint32_t mode, palcallback_t cb);
#endif /* HAL_USE_PAL */
#endif /* HW_LAYER_DIGITAL_INPUT_EXTI_H_ */

View File

@ -499,9 +499,9 @@ void initHardware(Logging *l) {
cdmIonInit();
#endif
#if HAL_USE_EXT || defined(__DOXYGEN__)
#if (HAL_USE_PAL && EFI_PROD_CODE) || defined(__DOXYGEN__)
initJoystick(sharedLogger);
#endif
#endif /* HAL_USE_PAL && EFI_PROD_CODE */
calcFastAdcIndexes();

View File

@ -18,7 +18,7 @@
#include "engine.h"
#if HAL_USE_EXT || defined(__DOXYGEN__)
#if (HAL_USE_PAL && EFI_PROD_CODE) || defined(__DOXYGEN__)
#include "joystick.h"
#include "pin_repository.h"
#include "digital_input_exti.h"
@ -47,8 +47,7 @@ static bool isJitter() {
return false;
}
static void extCallback(EXTDriver *extp, expchannel_t channel) {
UNUSED(extp);
static void extCallback(int channel) {
if (isJitter())
return;
joyTotal++;
@ -100,26 +99,22 @@ static bool isJoystickEnabled() {
}
void initJoystick(Logging *shared) {
addConsoleAction("joystickinfo", joystickInfo);
if (!isJoystickEnabled())
return;
sharedLogger = shared;
enableExti(CONFIGB(joystickCenterPin), EXT_CH_MODE_RISING_EDGE, extCallback);
enableExti(CONFIGB(joystickAPin), EXT_CH_MODE_RISING_EDGE, extCallback);
enableExti(CONFIGB(joystickCenterPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extCallback);
enableExti(CONFIGB(joystickAPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extCallback);
// not used so far applyPin(CONFIGB(joystickBPin));
// not used so far applyPin(CONFIGB(joystickCPin));
enableExti(CONFIGB(joystickDPin), EXT_CH_MODE_RISING_EDGE, extCallback);
enableExti(CONFIGB(joystickDPin), PAL_EVENT_MODE_RISING_EDGE, (palcallback_t)extCallback);
efiSetPadMode("joy center", CONFIGB(joystickCenterPin), PAL_MODE_INPUT_PULLUP);
efiSetPadMode("joy A", CONFIGB(joystickAPin), PAL_MODE_INPUT_PULLUP);
// not used so far efiSetPadMode("joy B", CONFIGB(joystickBPin), PAL_MODE_INPUT_PULLUP);
// not used so far efiSetPadMode("joy C", CONFIGB(joystickCPin), PAL_MODE_INPUT_PULLUP);
efiSetPadMode("joy D", CONFIGB(joystickDPin), PAL_MODE_INPUT_PULLUP);
addConsoleAction("joystickinfo", joystickInfo);
// todo: this is not a great place to invoke this method. open question if we have to start only after enablng all EXTI?
myExtStart();
}
#endif /* HAL_USE_EXT */
#endif /* HAL_USE_PAL && EFI_PROD_CODE */

View File

@ -29,7 +29,7 @@
#define CHCONF_H
#define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_5_1_
#define CHPRINTF_USE_FLOAT TRUE
@ -53,7 +53,25 @@
* @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit.
*/
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000
#endif
/**
* @brief Time intervals data size.
* @note Allowed values are 16, 32 or 64 bits.
*/
#if !defined(CH_CFG_INTERVALS_SIZE)
#define CH_CFG_INTERVALS_SIZE 32
#endif
/**
* @brief Time types data size.
* @note Allowed values are 16 or 32 bits.
*/
#if !defined(CH_CFG_TIME_TYPES_SIZE)
#define CH_CFG_TIME_TYPES_SIZE 32
#endif
/**
* @brief Time delta constant for the tick-less mode.
@ -303,15 +321,9 @@
* @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES.
*/
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE
/**
* @brief I/O Queues APIs.
* @details If enabled then the I/O queues APIs are included in the kernel.
*
* @note The default is @p TRUE.
*/
#define CH_CFG_USE_QUEUES TRUE
#endif
/**
* @brief Core Memory Manager APIs.
@ -334,7 +346,9 @@
* @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended.
*/
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE
#endif
/**
* @brief Memory Pools Allocator APIs.
@ -343,7 +357,20 @@
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS TRUE
#endif
/**
* @brief Objects FIFOs APIs.
* @details If enabled then the objects FIFOs APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_OBJ_FIFOS)
#define CH_CFG_USE_OBJ_FIFOS FALSE
#endif
/**
* @brief Dynamic Threads APIs.
@ -354,7 +381,73 @@
* @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS.
*/
#if !defined(CH_CFG_USE_DYNAMIC)
#define CH_CFG_USE_DYNAMIC TRUE
#endif
/** @} */
/*===========================================================================*/
/**
* @name Objects factory options
* @{
*/
/*===========================================================================*/
/**
* @brief Objects Factory APIs.
* @details If enabled then the objects factory APIs are included in the
* kernel.
*
* @note The default is @p FALSE.
*/
#if !defined(CH_CFG_USE_FACTORY)
#define CH_CFG_USE_FACTORY FALSE
#endif
/**
* @brief Maximum length for object names.
* @details If the specified length is zero then the name is stored by
* pointer but this could have unintended side effects.
*/
#if !defined(CH_CFG_FACTORY_MAX_NAMES_LENGTH)
#define CH_CFG_FACTORY_MAX_NAMES_LENGTH 8
#endif
/**
* @brief Enables the registry of generic objects.
*/
#if !defined(CH_CFG_FACTORY_OBJECTS_REGISTRY)
#define CH_CFG_FACTORY_OBJECTS_REGISTRY FALSE
#endif
/**
* @brief Enables factory for generic buffers.
*/
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
#define CH_CFG_FACTORY_GENERIC_BUFFERS FALSE
#endif
/**
* @brief Enables factory for semaphores.
*/
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
#define CH_CFG_FACTORY_SEMAPHORES FALSE
#endif
/**
* @brief Enables factory for mailboxes.
*/
#if !defined(CH_CFG_FACTORY_MAILBOXES)
#define CH_CFG_FACTORY_MAILBOXES FALSE
#endif
/**
* @brief Enables factory for objects FIFOs.
*/
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
#define CH_CFG_FACTORY_OBJ_FIFOS FALSE
#endif
/** @} */
@ -419,7 +512,18 @@
*
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#define CH_DBG_ENABLE_TRACE FALSE
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
* @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/**
* @brief Debug option, stack checks.
@ -469,6 +573,22 @@
*/
/*===========================================================================*/
/**
* @brief System structure extension.
* @details User fields added to the end of the @p ch_system_t structure.
*/
#define CH_CFG_SYSTEM_EXTRA_FIELDS \
/* Add threads custom fields here.*/
/**
* @brief System initialization hook.
* @details User initialization code added to the @p chSysInit() function
* just before interrupts are enabled globally.
*/
#define CH_CFG_SYSTEM_INIT_HOOK() { \
/* Add threads initialization code here.*/ \
}
/**
* @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure.

View File

@ -68,14 +68,25 @@ static msg_t wt_get(void *ip) {
return CONSOLE_PORT->vmt->get(CONSOLE_PORT);
}
static msg_t _ctl(void *ip, unsigned int operation, void *arg) {
(void)ip;
(void)operation;
(void)arg;
return MSG_OK;
}
/**
* These implementation print same content on console screen and send data over the underlying CONSOLE_PORT
* this is useful to see what's going on.
* See #wt_get() as a typical implementation
*/
static const struct BaseChannelVMT vmt = {
(size_t)0,
wt_writes, wt_reads, wt_put, wt_get,
wt_putt, wt_gett, wt_writet, wt_readt,
_ctl
};
void initTestStream(BaseChannel *ts) {

View File

@ -82,9 +82,6 @@ void applyNewConfiguration(void);
#define hal_lld_get_counter_value() 0
// a step towards ChibiOS18
#define TIME_MS2I(x) MS2ST(x)
#endif /* GLOBAL_H_ */