2020 February 29 Breaking Changes Update (#8064)

This commit is contained in:
James Young 2020-02-29 12:00:00 -08:00
parent 85041ff05b
commit 26eef35f07
No known key found for this signature in database
GPG Key ID: 06FAA77B63D48E80
362 changed files with 27772 additions and 8810 deletions

3
.gitignore vendored
View File

@ -70,3 +70,6 @@ id_rsa_*
# python things # python things
__pycache__ __pycache__
# prerequisites for updating ChibiOS
/util/fmpp*

1
.gitmodules vendored
View File

@ -4,7 +4,6 @@
[submodule "lib/chibios-contrib"] [submodule "lib/chibios-contrib"]
path = lib/chibios-contrib path = lib/chibios-contrib
url = https://github.com/qmk/ChibiOS-Contrib url = https://github.com/qmk/ChibiOS-Contrib
branch = k-type-fix
[submodule "lib/ugfx"] [submodule "lib/ugfx"]
path = lib/ugfx path = lib/ugfx
url = https://github.com/qmk/uGFX url = https://github.com/qmk/uGFX

View File

@ -5,7 +5,8 @@
// Configure glob patterns for excluding files and folders. // Configure glob patterns for excluding files and folders.
"files.exclude": { "files.exclude": {
"**/.build": true, "**/.build": true,
"**/*.hex": true "**/*.hex": true,
"**/*.bin": true
}, },
"files.associations": { "files.associations": {
"*.h": "c", "*.h": "c",

View File

@ -623,13 +623,19 @@ endif
# Generate the version.h file # Generate the version.h file
ifndef SKIP_GIT ifndef SKIP_GIT
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S") GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
CHIBIOS_VERSION := $(shell cd lib/chibios && git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
CHIBIOS_CONTRIB_VERSION := $(shell cd lib/chibios-contrib && git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
else else
GIT_VERSION := NA GIT_VERSION := NA
CHIBIOS_VERSION := NA
CHIBIOS_CONTRIB_VERSION := NA
endif endif
ifndef SKIP_VERSION ifndef SKIP_VERSION
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S") BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
$(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(ROOT_DIR)/quantum/version.h) $(shell echo '#define QMK_VERSION "$(GIT_VERSION)"' > $(ROOT_DIR)/quantum/version.h)
$(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(ROOT_DIR)/quantum/version.h) $(shell echo '#define QMK_BUILDDATE "$(BUILD_DATE)"' >> $(ROOT_DIR)/quantum/version.h)
$(shell echo '#define CHIBIOS_VERSION "$(CHIBIOS_VERSION)"' >> $(ROOT_DIR)/quantum/version.h)
$(shell echo '#define CHIBIOS_CONTRIB_VERSION "$(CHIBIOS_CONTRIB_VERSION)"' >> $(ROOT_DIR)/quantum/version.h)
else else
BUILD_DATE := NA BUILD_DATE := NA
endif endif

View File

@ -298,6 +298,7 @@ VALID_BACKLIGHT_TYPES := pwm software custom
BACKLIGHT_ENABLE ?= no BACKLIGHT_ENABLE ?= no
BACKLIGHT_DRIVER ?= pwm BACKLIGHT_DRIVER ?= pwm
ifeq ($(strip $(BACKLIGHT_ENABLE)), yes) ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC += $(QUANTUM_DIR)/process_keycode/process_backlight.c
ifeq ($(filter $(BACKLIGHT_DRIVER),$(VALID_BACKLIGHT_TYPES)),) ifeq ($(filter $(BACKLIGHT_DRIVER),$(VALID_BACKLIGHT_TYPES)),)
$(error BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type) $(error BACKLIGHT_DRIVER="$(BACKLIGHT_DRIVER)" is not a valid backlight type)
endif endif

View File

@ -0,0 +1,75 @@
# QMK Breaking Change - 2020 Feb 29 Changelog
Four times a year QMK runs a process for merging Breaking Changes. A Breaking Change is any change which modifies how QMK behaves in a way that is incompatible or potentially dangerous. We limit these changes to 4 times per year so that users can have confidence that updating their QMK tree will not break their keymaps.
## Update ChibiOS/ChibiOS-Contrib/uGFX submodules
* General Notes
* A `make git-submodule` may be required after pulling the latest QMK firmware code to update affected submodules to the upgraded revisions
* Enabling link-time-optimization (`LINK_TIME_OPTIMIZATION_ENABLE = yes`) should work on a lot more boards
* Upgrade to ChibiOS ver19.1.3
* This will allow QMK to update to upstream ChibiOS a lot easier -- the old version was ~2 years out of date. Automated update scripts have been made available to simplify future upgrades.
* Includes improved MCU support and bugfixes
* ChibiOS revision is now included in Command output
* Timers should now be more accurate
* Upgrade to newer ChibiOS-Contrib
* Also includes improved MCU support and bugfixes
* ChibiOS-Contrib revision is now included in Command output
* Upgrade to newer uGFX
* Required in order to support updated ChibiOS
## Fix ChibiOS timer overflow for 16-bit SysTick devices
* On 16-bit SysTick devices, the timer subsystem in QMK was incorrectly dealing with overflow.
* When running at a 100000 SysTick frequency (possible on 16-bit devices, but uncommon), this overflow would occur after 0.65 seconds.
* Timers are now correctly handling this overflow case and timing should now be correct on ChibiOS/ARM.
## Update LUFA submodule
* Updates the LUFA submodule to include updates from upstream (abcminiuser/lufa)
* Includes some cleanup for QMK DFU generation
## Encoder flip
* Flips the encoder direction so that `clockwise == true` is for actually turning the knob clockwise
* Adds `ENCODER_DIRECTION_FLIP` define, so that reversing the expected dirction is simple for users.
* Cleans up documentation page for encoders
## Adding support for `BACKLIGHT_ON_STATE` for hardware PWM backlight
* Previously, the define only affected software PWM, and hardware PWM always assumed an N-channel MOSFET.
* The hardware PWM backlight setup has been updated to respect this option.
* The default "on" state has been changed to `1` - **this impacts all keyboards using software PWM backlight that do not define it explicitly**. If your keyboard's backlight is acting strange, it may have a P-channel MOSFET, and will need to have `#define BACKLIGHT_ON_STATE 0` added to the keyboard-level `config.h`. Please see the PR for more detailed information.
## Migrating `ACTION_LAYER_TAP_KEY()` entries in `fn_actions` to `LT()` keycodes
* `fn_actions` is deprecated, and its functionality has been superseded by direct keycodes and `process_record_user()`
* The end result of removing this obsolete feature should result in a decent reduction in firmware size and code complexity
* All keymaps affected are recommended to switch away from `fn_actions` in favour of the [custom keycode](https://docs.qmk.fm/#/custom_quantum_functions) and [macro](https://docs.qmk.fm/#/feature_macros) features
## Moving backlight keycode handling to `process_keycode/`
* This refactors the backlight keycode logic to be clearer and more modular.
* All backlight-related keycodes are now actioned in a single file.
* The `ACTION_BACKLIGHT_*` macros have also been deleted. If you are still using these in a `fn_actions[]` block, please switch to using the backlight keycodes or functions directly.
## Refactor Planck keymaps to use Layout Macros
* Refactor Planck keymaps to use layout macros instead of raw matrix assignments
* Makes keymaps revision-agnostic
* Should reduce noise and errors in Travis CI logs
## GON NerD codebase refactor
* Splits the codebase for GON NerD 60 and NerdD TKL PCBs into two separate directories.
* If your keymap is for a NerD 60 PCB, your `make` command is now `make gon/nerd60:<keymap>`.
* If your keymap is for a NerD TKL PCB, your `make` command is now `make gon/nerdtkl:<keymap>`.

View File

@ -120,9 +120,21 @@ When both timers are in use for Audio, the backlight PWM will not use a hardware
To change the behavior of the backlighting, `#define` these in your `config.h`: To change the behavior of the backlighting, `#define` these in your `config.h`:
|Define |Default |Description | |Define |Default |Description |
|---------------------|-------------|--------------------------------------------------------------------------------------------------------------| |---------------------|-------------|-------------------------------------------------------------------------------------------------------------|
|`BACKLIGHT_PIN` |`B7` |The pin that controls the LEDs. Unless you are designing your own keyboard, you shouldn't need to change this| |`BACKLIGHT_PIN` |`B7` |The pin that controls the LEDs. Unless you are designing your own keyboard, you shouldn't need to change this|
|`BACKLIGHT_PINS` |*Not defined*|experimental: see below for more information | |`BACKLIGHT_PINS` |*Not defined*|experimental: see below for more information |
|`BACKLIGHT_LEVELS` |`3` |The number of brightness levels (maximum 31 excluding off) |
|`BACKLIGHT_CAPS_LOCK`|*Not defined*|Enable Caps Lock indicator using backlight (for keyboards without dedicated LED) |
|`BACKLIGHT_BREATHING`|*Not defined*|Enable backlight breathing, if supported |
|`BREATHING_PERIOD` |`6` |The length of one backlight "breath" in seconds |
|`BACKLIGHT_ON_STATE` |`1` |The state of the backlight pin when the backlight is "on" - `1` for high, `0` for low |
### Backlight On State
Most backlight circuits are driven by an N-channel MOSFET or NPN transistor. This means that to turn the transistor *on* and light the LEDs, you must drive the backlight pin, connected to the gate or base, *high*.
Sometimes, however, a P-channel MOSFET, or a PNP transistor is used. In this case, when the transistor is on, the pin is driven *low* instead.
This functionality is configured at the keyboard level with the `BACKLIGHT_ON_STATE` define.
### Multiple backlight pins ### Multiple backlight pins

View File

@ -2,23 +2,35 @@
Basic encoders are supported by adding this to your `rules.mk`: Basic encoders are supported by adding this to your `rules.mk`:
```make
ENCODER_ENABLE = yes ENCODER_ENABLE = yes
```
and this to your `config.h`: and this to your `config.h`:
```c
#define ENCODERS_PAD_A { B12 } #define ENCODERS_PAD_A { B12 }
#define ENCODERS_PAD_B { B13 } #define ENCODERS_PAD_B { B13 }
```
Each PAD_A/B variable defines an array so multiple encoders can be defined, e.g.: Each PAD_A/B variable defines an array so multiple encoders can be defined, e.g.:
```c
#define ENCODERS_PAD_A { encoder1a, encoder2a } #define ENCODERS_PAD_A { encoder1a, encoder2a }
#define ENCODERS_PAD_B { encoder1b, encoder2b } #define ENCODERS_PAD_B { encoder1b, encoder2b }
```
If your encoder's clockwise directions are incorrect, you can swap the A & B pad definitions. If your encoder's clockwise directions are incorrect, you can swap the A & B pad definitions. They can also be flipped with a define:
```c
#define ENCODER_DIRECTION_FLIP
```
Additionally, the resolution can be specified in the same file (the default & suggested is 4): Additionally, the resolution can be specified in the same file (the default & suggested is 4):
```c
#define ENCODER_RESOLUTION 4 #define ENCODER_RESOLUTION 4
```
## Split Keyboards ## Split Keyboards
@ -33,12 +45,15 @@ If you are using different pinouts for the encoders on each half of a split keyb
The callback functions can be inserted into your `<keyboard>.c`: The callback functions can be inserted into your `<keyboard>.c`:
```c
void encoder_update_kb(uint8_t index, bool clockwise) { void encoder_update_kb(uint8_t index, bool clockwise) {
encoder_update_user(index, clockwise); encoder_update_user(index, clockwise);
} }
```
or `keymap.c`: or `keymap.c`:
```c
void encoder_update_user(uint8_t index, bool clockwise) { void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { /* First encoder */ if (index == 0) { /* First encoder */
if (clockwise) { if (clockwise) {
@ -48,12 +63,13 @@ or `keymap.c`:
} }
} else if (index == 1) { /* Second encoder */ } else if (index == 1) { /* Second encoder */
if (clockwise) { if (clockwise) {
tap_code(KC_UP);
} else {
tap_code(KC_DOWN); tap_code(KC_DOWN);
} else {
tap_code(KC_UP);
} }
} }
} }
```
## Hardware ## Hardware

View File

@ -79,14 +79,14 @@ i2c_status_t i2c_start(uint8_t address) {
i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) { i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout) {
i2c_address = address; i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout)); msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, TIME_MS2I(timeout));
return chibios_to_qmk(&status); return chibios_to_qmk(&status);
} }
i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) { i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout) {
i2c_address = address; i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout)); msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, TIME_MS2I(timeout));
return chibios_to_qmk(&status); return chibios_to_qmk(&status);
} }
@ -100,14 +100,14 @@ i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data,
} }
complete_packet[0] = regaddr; complete_packet[0] = regaddr;
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout)); msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, TIME_MS2I(timeout));
return chibios_to_qmk(&status); return chibios_to_qmk(&status);
} }
i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) { i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout) {
i2c_address = devaddr; i2c_address = devaddr;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), &regaddr, 1, data, length, MS2ST(timeout)); msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), &regaddr, 1, data, length, TIME_MS2I(timeout));
return chibios_to_qmk(&status); return chibios_to_qmk(&status);
} }

View File

@ -60,7 +60,7 @@ void ws2812_init(void) {
// TODO: more dynamic baudrate // TODO: more dynamic baudrate
static const SPIConfig spicfg = { static const SPIConfig spicfg = {
NULL, PAL_PORT(RGB_DI_PIN), PAL_PAD(RGB_DI_PIN), 0, NULL, PAL_PORT(RGB_DI_PIN), PAL_PAD(RGB_DI_PIN),
SPI_CR1_BR_1 | SPI_CR1_BR_0 // baudrate : fpclk / 8 => 1tick is 0.32us (2.25 MHz) SPI_CR1_BR_1 | SPI_CR1_BR_0 // baudrate : fpclk / 8 => 1tick is 0.32us (2.25 MHz)
}; };

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #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}, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
#endif #endif
@ -53,23 +115,114 @@ const PALConfig pal_default_config = {
{VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(STM32_GPIO_EN_MASK, true);
/* Initializing all the defined GPIO ports.*/
#if STM32_HAS_GPIOA
gpio_init(GPIOA, &gpio_default_config.PAData);
#endif #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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
__attribute__((weak)) void enter_bootloader_mode_if_requested(void) {} __attribute__((weak)) void enter_bootloader_mode_if_requested(void) {}
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -22,6 +22,10 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* /*
* Setup for Generic STM32_F072 Board * Setup for Generic STM32_F072 Board
*/ */
@ -167,11 +171,9 @@
#define LINE_USB_DP PAL_LINE(GPIOA, 12U) #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U) #define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
#define LINE_LED_RED PAL_LINE(GPIOC, 6U) #define LINE_LED_RED PAL_LINE(GPIOC, 6U)
#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U) #define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
@ -179,10 +181,25 @@
#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U) #define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U) #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U) #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -373,6 +390,10 @@
#define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_OSC_IN, 0U) | PIN_AFIO_AF(GPIOF_OSC_OUT, 0U) | PIN_AFIO_AF(GPIOF_PIN2, 0U) | PIN_AFIO_AF(GPIOF_PIN3, 0U) | PIN_AFIO_AF(GPIOF_PIN4, 0U) | PIN_AFIO_AF(GPIOF_PIN5, 0U) | PIN_AFIO_AF(GPIOF_PIN6, 0U) | PIN_AFIO_AF(GPIOF_PIN7, 0U)) #define VAL_GPIOF_AFRL (PIN_AFIO_AF(GPIOF_OSC_IN, 0U) | PIN_AFIO_AF(GPIOF_OSC_OUT, 0U) | PIN_AFIO_AF(GPIOF_PIN2, 0U) | PIN_AFIO_AF(GPIOF_PIN3, 0U) | PIN_AFIO_AF(GPIOF_PIN4, 0U) | PIN_AFIO_AF(GPIOF_PIN5, 0U) | PIN_AFIO_AF(GPIOF_PIN6, 0U) | PIN_AFIO_AF(GPIOF_PIN7, 0U))
#define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | PIN_AFIO_AF(GPIOF_PIN9, 0U) | PIN_AFIO_AF(GPIOF_PIN10, 0U) | PIN_AFIO_AF(GPIOF_PIN11, 0U) | PIN_AFIO_AF(GPIOF_PIN12, 0U) | PIN_AFIO_AF(GPIOF_PIN13, 0U) | PIN_AFIO_AF(GPIOF_PIN14, 0U) | PIN_AFIO_AF(GPIOF_PIN15, 0U)) #define VAL_GPIOF_AFRH (PIN_AFIO_AF(GPIOF_PIN8, 0U) | PIN_AFIO_AF(GPIOF_PIN9, 0U) | PIN_AFIO_AF(GPIOF_PIN10, 0U) | PIN_AFIO_AF(GPIOF_PIN11, 0U) | PIN_AFIO_AF(GPIOF_PIN12, 0U) | PIN_AFIO_AF(GPIOF_PIN13, 0U) | PIN_AFIO_AF(GPIOF_PIN14, 0U) | PIN_AFIO_AF(GPIOF_PIN15, 0U))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
# ifdef __cplusplus # ifdef __cplusplus
extern "C" { extern "C" {

View File

@ -3,3 +3,7 @@ BOARDSRC = $(BOARD_PATH)/boards/GENERIC_STM32_F072XB/board.c
# Required include directories # Required include directories
BOARDINC = $(BOARD_PATH)/boards/GENERIC_STM32_F072XB BOARDINC = $(BOARD_PATH)/boards/GENERIC_STM32_F072XB
# Shared variables
ALLCSRC += $(BOARDSRC)
ALLINC += $(BOARDINC)

View File

@ -6,7 +6,7 @@
<configuration_settings> <configuration_settings>
<templates_path>resources/gencfg/processors/boards/stm32f0xx/templates</templates_path> <templates_path>resources/gencfg/processors/boards/stm32f0xx/templates</templates_path>
<output_path>..</output_path> <output_path>..</output_path>
<hal_version>3.0.x</hal_version> <hal_version>5.0.x</hal_version>
</configuration_settings> </configuration_settings>
<board_name>ST STM32F072B-Discovery</board_name> <board_name>ST STM32F072B-Discovery</board_name>
<board_id>ST_STM32F072B_DISCOVERY</board_id> <board_id>ST_STM32F072B_DISCOVERY</board_id>

View File

@ -0,0 +1,15 @@
sourceRoot: ../../../../../tools/ftl/processors/boards/stm32f0xx/templates
outputRoot: ..
dataRoot: .
freemarkerLinks: {
lib: ../../../../../tools/ftl/libs
}
data : {
doc1:xml (
board.chcfg
{
}
)
}

View File

@ -14,15 +14,82 @@
limitations under the License. limitations under the License.
*/ */
#include "hal.h" /*
* This file has been automatically generated using ChibiStudio board
#if HAL_USE_PAL || defined(__DOXYGEN__) * generator plugin. Do not edit manually.
/**
* @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 = {
#include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
/**
* @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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #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}, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
#endif #endif
@ -48,10 +115,71 @@ const PALConfig pal_default_config = {
{VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH}, {VAL_GPIOH_MODER, VAL_GPIOH_OTYPER, VAL_GPIOH_OSPEEDR, VAL_GPIOH_PUPDR, VAL_GPIOH_ODR, VAL_GPIOH_AFRL, VAL_GPIOH_AFRH},
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR, VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR, VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(STM32_GPIO_EN_MASK, true);
/* Initializing all the defined GPIO ports.*/
#if STM32_HAS_GPIOA
gpio_init(GPIOA, &gpio_default_config.PAData);
#endif #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
}
void enter_bootloader_mode_if_requested(void); void enter_bootloader_mode_if_requested(void);
@ -62,6 +190,8 @@ void enter_bootloader_mode_if_requested(void);
*/ */
void __early_init(void) { void __early_init(void) {
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }

View File

@ -24,10 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
/* Driver hardware support. */ /* Driver hardware support. */
/*===========================================================================*/ /*===========================================================================*/
# define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing # define GDISP_HARDWARE_FLUSH GFXON // This controller requires flushing
# define GDISP_HARDWARE_DRAWPIXEL TRUE # define GDISP_HARDWARE_DRAWPIXEL GFXON
# define GDISP_HARDWARE_PIXELREAD TRUE # define GDISP_HARDWARE_PIXELREAD GFXON
# define GDISP_HARDWARE_CONTROL TRUE # define GDISP_HARDWARE_CONTROL GFXON
# define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256 # define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_GRAY256

View File

@ -14,11 +14,11 @@
/* Driver hardware support. */ /* Driver hardware support. */
/*===========================================================================*/ /*===========================================================================*/
# define GDISP_HARDWARE_FLUSH TRUE // This controller requires flushing # define GDISP_HARDWARE_FLUSH GFXON // This controller requires flushing
# define GDISP_HARDWARE_DRAWPIXEL TRUE # define GDISP_HARDWARE_DRAWPIXEL GFXON
# define GDISP_HARDWARE_PIXELREAD TRUE # define GDISP_HARDWARE_PIXELREAD GFXON
# define GDISP_HARDWARE_CONTROL TRUE # define GDISP_HARDWARE_CONTROL GFXON
# define GDISP_HARDWARE_BITFILLS TRUE # define GDISP_HARDWARE_BITFILLS GFXON
# define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO # define GDISP_LLD_PIXELFORMAT GDISP_PIXELFORMAT_MONO

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,33 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
@ -349,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -74,7 +74,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \ HPR_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ CTL_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
SFT_BSP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ SFT_BSP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \
KC_LCTL, MEH_GRV, KC_LALT, KC_LGUI, F(0), RAISE, KC_RGUI, KC_RALT, KC_RCTL \ KC_LCTL, MEH_GRV, KC_LALT, KC_LGUI, LT(_LOWER, KC_SPC), RAISE, KC_RGUI, KC_RALT, KC_RCTL \
), ),
/* Colemak /* Colemak
@ -92,7 +92,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \ HPR_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ CTL_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
SFT_BSP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \ SFT_BSP, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, SFT_ENT, \
KC_LCTL, MEH_GRV, KC_LALT, KC_LGUI, F(0), RAISE, KC_RGUI, KC_RALT, KC_RCTL \ KC_LCTL, MEH_GRV, KC_LALT, KC_LGUI, LT(_LOWER, KC_SPC), RAISE, KC_RGUI, KC_RALT, KC_RCTL \
), ),
/* Dvorak /* Dvorak
@ -110,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \ HPR_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \ CTL_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
SFT_BSP, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, \ SFT_BSP, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, SFT_ENT, \
KC_LCTL, MEH_GRV, KC_LALT, KC_LGUI, F(0), RAISE, KC_RGUI, KC_RALT, KC_RCTL \ KC_LCTL, MEH_GRV, KC_LALT, KC_LGUI, LT(_LOWER, KC_SPC), RAISE, KC_RGUI, KC_RALT, KC_RCTL \
), ),
/* Lower /* Lower
@ -168,10 +168,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
) )
}; };
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_TAP_KEY(_LOWER, KC_SPC),
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {
case QWERTY: case QWERTY:

View File

@ -13,7 +13,9 @@
#define _RAISE 2 #define _RAISE 2
#define _ADJUST 3 #define _ADJUST 3
#define LOW_SPC LT(_LOWER, KC_SPC)
#define RSE_SPC LT(_RAISE, KC_SPC)
#define ADJ_TAB LT(ADJUST, KC_TAB)
enum custom_keycodes { enum custom_keycodes {
QWERTY = SAFE_RANGE, QWERTY = SAFE_RANGE,
@ -26,9 +28,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT( \ [_QWERTY] = LAYOUT( \
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,\ KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC,\
F(2), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, \ ADJ_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \ KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, \
KC_LCTL, KC_LGUI,KC_LALT, F(0), F(1), KC_RGUI,KC_RALT, KC_RCTL \ KC_LCTL, KC_LGUI,KC_LALT, LOW_SPC, RSE_SPC, KC_RGUI,KC_RALT, KC_RCTL \
), ),
[_LOWER] = LAYOUT( \ [_LOWER] = LAYOUT( \
@ -54,25 +56,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
enum function_id {
LAUNCH,
RGBLED_TOGGLE,
};
const uint16_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_TAP_KEY(_LOWER, KC_SPC),
[1] = ACTION_LAYER_TAP_KEY(_RAISE, KC_SPC),
[2] = ACTION_LAYER_TAP_KEY(_ADJUST,KC_TAB),
};
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
return MACRO_NONE;
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) { bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) { switch (keycode) {

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -62,23 +124,118 @@ const PALConfig pal_default_config = {
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #endif
}; };
#endif
void enter_bootloader_mode_if_requested(void); /*===========================================================================*/
/* 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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.
@ -106,4 +263,6 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {
SYSCFG->CFGR1 |= SYSCFG_CFGR1_I2C1_DMA_RMP;
SYSCFG->CFGR1 &= ~(SYSCFG_CFGR1_SPI2_DMA_RMP);
} }

View File

@ -22,6 +22,10 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* /*
* Setup for ST STM32F072B-Discovery board. * Setup for ST STM32F072B-Discovery board.
*/ */
@ -166,11 +170,9 @@
#define LINE_USB_DP PAL_LINE(GPIOA, 12U) #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U) #define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
#define LINE_LED_RED PAL_LINE(GPIOC, 6U) #define LINE_LED_RED PAL_LINE(GPIOC, 6U)
#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U) #define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
@ -178,12 +180,25 @@
#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U) #define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U) #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U) #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -908,6 +923,9 @@
PIN_AFIO_AF(GPIOF_PIN14, 0U) | \ PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
PIN_AFIO_AF(GPIOF_PIN15, 0U)) PIN_AFIO_AF(GPIOF_PIN15, 0U))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,33 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
@ -349,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -21,11 +21,7 @@ enum custom_macros {
R_POINT R_POINT
}; };
const uint16_t PROGMEM fn_actions[] = { #define SPC_LW LT(_LOWER, KC_SPC)
[0] = ACTION_LAYER_TAP_KEY(_LOWER, KC_SPC), //Hold for momentary Lower layer, Tap for Space,
};
#define SPC_LW FUNC(0)
#define MSE MO(_MOUSE) #define MSE MO(_MOUSE)
#define PIPE M(R_PIPE) #define PIPE M(R_PIPE)
#define POINT M(R_POINT) #define POINT M(R_POINT)

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -62,24 +124,117 @@ const PALConfig pal_default_config = {
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #endif
}; };
#endif
void enter_bootloader_mode_if_requested(void); /*===========================================================================*/
/* 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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
@ -108,4 +263,6 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {
SYSCFG->CFGR1 |= SYSCFG_CFGR1_I2C1_DMA_RMP;
SYSCFG->CFGR1 &= ~(SYSCFG_CFGR1_SPI2_DMA_RMP);
} }

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI FALSE #define HAL_USE_SPI FALSE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -62,23 +124,118 @@ const PALConfig pal_default_config = {
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #endif
}; };
#endif
void enter_bootloader_mode_if_requested(void); /*===========================================================================*/
/* 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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.
@ -106,4 +263,6 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {
SYSCFG->CFGR1 |= SYSCFG_CFGR1_I2C1_DMA_RMP;
SYSCFG->CFGR1 &= ~(SYSCFG_CFGR1_SPI2_DMA_RMP);
} }

View File

@ -22,6 +22,10 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* /*
* Setup for ST STM32F072B-Discovery board. * Setup for ST STM32F072B-Discovery board.
*/ */
@ -166,11 +170,9 @@
#define LINE_USB_DP PAL_LINE(GPIOA, 12U) #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U) #define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
#define LINE_LED_RED PAL_LINE(GPIOC, 6U) #define LINE_LED_RED PAL_LINE(GPIOC, 6U)
#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U) #define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
@ -178,12 +180,25 @@
#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U) #define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U) #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U) #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -908,6 +923,9 @@
PIN_AFIO_AF(GPIOF_PIN14, 0U) | \ PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
PIN_AFIO_AF(GPIOF_PIN15, 0U)) PIN_AFIO_AF(GPIOF_PIN15, 0U))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,33 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
@ -349,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -45,6 +45,7 @@ static THD_FUNCTION(ledsThread, arg) {
} }
static const SPIConfig spicfg = { static const SPIConfig spicfg = {
false,
NULL, NULL,
PORT_WS2812, PORT_WS2812,
PIN_WS2812, PIN_WS2812,

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -62,23 +124,118 @@ const PALConfig pal_default_config = {
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #endif
}; };
#endif
void enter_bootloader_mode_if_requested(void); /*===========================================================================*/
/* 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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.
@ -106,4 +263,6 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {
SYSCFG->CFGR1 |= SYSCFG_CFGR1_I2C1_DMA_RMP;
SYSCFG->CFGR1 &= ~(SYSCFG_CFGR1_SPI2_DMA_RMP);
} }

View File

@ -22,6 +22,10 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* /*
* Setup for ST STM32F072B-Discovery board. * Setup for ST STM32F072B-Discovery board.
*/ */
@ -166,11 +170,9 @@
#define LINE_USB_DP PAL_LINE(GPIOA, 12U) #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U) #define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
#define LINE_LED_RED PAL_LINE(GPIOC, 6U) #define LINE_LED_RED PAL_LINE(GPIOC, 6U)
#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U) #define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
@ -178,12 +180,25 @@
#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U) #define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U) #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U) #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -908,6 +923,9 @@
PIN_AFIO_AF(GPIOF_PIN14, 0U) | \ PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
PIN_AFIO_AF(GPIOF_PIN15, 0U)) PIN_AFIO_AF(GPIOF_PIN15, 0U))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI FALSE #define HAL_USE_SPI FALSE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,33 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
@ -349,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -62,23 +124,118 @@ const PALConfig pal_default_config = {
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #endif
}; };
#endif
void enter_bootloader_mode_if_requested(void); /*===========================================================================*/
/* 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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.
@ -106,4 +263,6 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {
SYSCFG->CFGR1 |= SYSCFG_CFGR1_I2C1_DMA_RMP;
SYSCFG->CFGR1 &= ~(SYSCFG_CFGR1_SPI2_DMA_RMP);
} }

View File

@ -22,6 +22,10 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* /*
* Setup for ST STM32F072B-Discovery board. * Setup for ST STM32F072B-Discovery board.
*/ */
@ -166,11 +170,9 @@
#define LINE_USB_DP PAL_LINE(GPIOA, 12U) #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U) #define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
#define LINE_LED_RED PAL_LINE(GPIOC, 6U) #define LINE_LED_RED PAL_LINE(GPIOC, 6U)
#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U) #define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
@ -178,12 +180,25 @@
#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U) #define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U) #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U) #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -908,6 +923,9 @@
PIN_AFIO_AF(GPIOF_PIN14, 0U) | \ PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
PIN_AFIO_AF(GPIOF_PIN15, 0U)) PIN_AFIO_AF(GPIOF_PIN15, 0U))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,33 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
@ -349,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -62,23 +124,118 @@ const PALConfig pal_default_config = {
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #endif
}; };
#endif
void enter_bootloader_mode_if_requested(void); /*===========================================================================*/
/* 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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.
@ -106,4 +263,6 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {
SYSCFG->CFGR1 |= SYSCFG_CFGR1_I2C1_DMA_RMP;
SYSCFG->CFGR1 &= ~(SYSCFG_CFGR1_SPI2_DMA_RMP);
} }

View File

@ -22,6 +22,10 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* /*
* Setup for ST STM32F072B-Discovery board. * Setup for ST STM32F072B-Discovery board.
*/ */
@ -166,11 +170,9 @@
#define LINE_USB_DP PAL_LINE(GPIOA, 12U) #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U) #define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
#define LINE_LED_RED PAL_LINE(GPIOC, 6U) #define LINE_LED_RED PAL_LINE(GPIOC, 6U)
#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U) #define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
@ -178,12 +180,25 @@
#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U) #define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U) #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U) #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -908,6 +923,9 @@
PIN_AFIO_AF(GPIOF_PIN14, 0U) | \ PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
PIN_AFIO_AF(GPIOF_PIN15, 0U)) PIN_AFIO_AF(GPIOF_PIN15, 0U))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI FALSE #define HAL_USE_SPI FALSE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,33 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
@ -349,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 0 #define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 0 #define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 0 #define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 0 #define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 0 #define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -62,23 +124,118 @@ const PALConfig pal_default_config = {
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #endif
}; };
#endif
void enter_bootloader_mode_if_requested(void); /*===========================================================================*/
/* 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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.

View File

@ -22,6 +22,10 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* /*
* Setup for ST STM32F072B-Discovery board. * Setup for ST STM32F072B-Discovery board.
*/ */
@ -166,11 +170,9 @@
#define LINE_USB_DP PAL_LINE(GPIOA, 12U) #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U) #define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
#define LINE_LED_RED PAL_LINE(GPIOC, 6U) #define LINE_LED_RED PAL_LINE(GPIOC, 6U)
#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U) #define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
@ -178,12 +180,25 @@
#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U) #define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U) #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U) #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -908,6 +923,9 @@
PIN_AFIO_AF(GPIOF_PIN14, 0U) | \ PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
PIN_AFIO_AF(GPIOF_PIN15, 0U)) PIN_AFIO_AF(GPIOF_PIN15, 0U))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,33 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
@ -349,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -81,7 +81,7 @@ i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length,
i2c_address = address; i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
i2cAcquireBus(&I2C_DRIVER); i2cAcquireBus(&I2C_DRIVER);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, MS2ST(timeout)); msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, 0, 0, TIME_MS2I(timeout));
i2cReleaseBus(&I2C_DRIVER); i2cReleaseBus(&I2C_DRIVER);
return chibios_to_qmk(status); return chibios_to_qmk(status);
} }
@ -90,7 +90,7 @@ i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16
{ {
i2c_address = address; i2c_address = address;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, MS2ST(timeout)); msg_t status = i2cMasterReceiveTimeout(&I2C_DRIVER, (i2c_address >> 1), data, length, TIME_MS2I(timeout));
return chibios_to_qmk(status); return chibios_to_qmk(status);
} }
@ -106,7 +106,7 @@ i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data,
} }
complete_packet[0] = regaddr; complete_packet[0] = regaddr;
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, MS2ST(timeout)); msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), complete_packet, length + 1, 0, 0, TIME_MS2I(timeout));
return chibios_to_qmk(status); return chibios_to_qmk(status);
} }
@ -114,7 +114,7 @@ i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16
{ {
i2c_address = devaddr; i2c_address = devaddr;
i2cStart(&I2C_DRIVER, &i2cconfig); i2cStart(&I2C_DRIVER, &i2cconfig);
msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), &regaddr, 1, data, length, MS2ST(timeout)); msg_t status = i2cMasterTransmitTimeout(&I2C_DRIVER, (i2c_address >> 1), &regaddr, 1, data, length, TIME_MS2I(timeout));
return chibios_to_qmk(status); return chibios_to_qmk(status);
} }

View File

@ -63,6 +63,16 @@
#define STM32_USART1SW STM32_USART1SW_PCLK #define STM32_USART1SW STM32_USART1SW_PCLK
#define STM32_RTCSEL STM32_RTCSEL_LSE #define STM32_RTCSEL STM32_RTCSEL_LSE
/*
* IRQ system settings.
*/
#define STM32_IRQ_EXTI0_1_IRQ_PRIORITY 3
#define STM32_IRQ_EXTI2_3_IRQ_PRIORITY 3
#define STM32_IRQ_EXTI4_15_IRQ_PRIORITY 3
#define STM32_IRQ_EXTI16_IRQ_PRIORITY 3
#define STM32_IRQ_EXTI17_20_IRQ_PRIORITY 3
#define STM32_IRQ_EXTI21_22_IRQ_PRIORITY 3
/* /*
* ADC driver system settings. * ADC driver system settings.
*/ */
@ -71,15 +81,6 @@
#define STM32_ADC_IRQ_PRIORITY 2 #define STM32_ADC_IRQ_PRIORITY 2
#define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 2 #define STM32_ADC_ADC1_DMA_IRQ_PRIORITY 2
/*
* EXT driver system settings.
*/
#define STM32_EXT_EXTI0_1_IRQ_PRIORITY 3
#define STM32_EXT_EXTI2_3_IRQ_PRIORITY 3
#define STM32_EXT_EXTI4_15_IRQ_PRIORITY 3
#define STM32_EXT_EXTI16_IRQ_PRIORITY 3
#define STM32_EXT_EXTI17_IRQ_PRIORITY 3
/* /*
* GPT driver system settings. * GPT driver system settings.
*/ */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -62,23 +124,118 @@ const PALConfig pal_default_config = {
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #endif
}; };
#endif
void enter_bootloader_mode_if_requested(void); /*===========================================================================*/
/* 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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.
@ -106,4 +263,6 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {
SYSCFG->CFGR1 |= SYSCFG_CFGR1_I2C1_DMA_RMP;
SYSCFG->CFGR1 &= ~(SYSCFG_CFGR1_SPI2_DMA_RMP);
} }

View File

@ -22,6 +22,10 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* /*
* Setup for ST STM32F072B-Discovery board. * Setup for ST STM32F072B-Discovery board.
*/ */
@ -166,11 +170,9 @@
#define LINE_USB_DP PAL_LINE(GPIOA, 12U) #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U) #define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
#define LINE_LED_RED PAL_LINE(GPIOC, 6U) #define LINE_LED_RED PAL_LINE(GPIOC, 6U)
#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U) #define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
@ -178,12 +180,25 @@
#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U) #define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U) #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U) #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -908,6 +923,9 @@
PIN_AFIO_AF(GPIOF_PIN14, 0U) | \ PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
PIN_AFIO_AF(GPIOF_PIN15, 0U)) PIN_AFIO_AF(GPIOF_PIN15, 0U))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,33 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
@ -349,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -61,6 +61,7 @@ static THD_FUNCTION(hsv_transThread, arg) {
#endif #endif
static const SPIConfig spicfg = { static const SPIConfig spicfg = {
false,
NULL, NULL,
GPIOB, GPIOB,
15, 15,

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -20,14 +20,76 @@
*/ */
#include "hal.h" #include "hal.h"
#include "stm32_gpio.h"
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
/** /**
* @brief PAL setup. * @brief Type of STM32 GPIO port 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 = { 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 STM32 GPIO static initialization data.
*/
static const gpio_config_t gpio_default_config = {
#if STM32_HAS_GPIOA #if STM32_HAS_GPIOA
{VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR, {VAL_GPIOA_MODER, VAL_GPIOA_OTYPER, VAL_GPIOA_OSPEEDR, VAL_GPIOA_PUPDR,
VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH}, VAL_GPIOA_ODR, VAL_GPIOA_AFRL, VAL_GPIOA_AFRH},
@ -62,23 +124,118 @@ const PALConfig pal_default_config = {
#endif #endif
#if STM32_HAS_GPIOI #if STM32_HAS_GPIOI
{VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR, {VAL_GPIOI_MODER, VAL_GPIOI_OTYPER, VAL_GPIOI_OSPEEDR, VAL_GPIOI_PUPDR,
VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH} VAL_GPIOI_ODR, VAL_GPIOI_AFRL, VAL_GPIOI_AFRH},
#endif
#if STM32_HAS_GPIOJ
{VAL_GPIOJ_MODER, VAL_GPIOJ_OTYPER, VAL_GPIOJ_OSPEEDR, VAL_GPIOJ_PUPDR,
VAL_GPIOJ_ODR, VAL_GPIOJ_AFRL, VAL_GPIOJ_AFRH},
#endif
#if STM32_HAS_GPIOK
{VAL_GPIOK_MODER, VAL_GPIOK_OTYPER, VAL_GPIOK_OSPEEDR, VAL_GPIOK_PUPDR,
VAL_GPIOK_ODR, VAL_GPIOK_AFRL, VAL_GPIOK_AFRH}
#endif #endif
}; };
#endif
void enter_bootloader_mode_if_requested(void); /*===========================================================================*/
/* 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.*/
rccResetAHB(STM32_GPIO_EN_MASK);
rccEnableAHB(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
}
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/** /**
* @brief Early initialization code. * @brief Early initialization code.
* @details This initialization must be performed just after stack setup * @details GPIO ports and system clocks are initialized before everything
* and before any other initialization. * else.
*/ */
void __early_init(void) { void __early_init(void) {
extern void enter_bootloader_mode_if_requested(void);
enter_bootloader_mode_if_requested(); enter_bootloader_mode_if_requested();
stm32_gpio_init();
stm32_clock_init(); stm32_clock_init();
} }
#if HAL_USE_SDC || defined(__DOXYGEN__)
/**
* @brief SDC card detection.
*/
bool sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return true;
}
/**
* @brief SDC card write protection detection.
*/
bool sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void)sdcp;
/* TODO: Fill the implementation.*/
return false;
}
#endif /* HAL_USE_SDC */
#if HAL_USE_MMC_SPI || defined(__DOXYGEN__) #if HAL_USE_MMC_SPI || defined(__DOXYGEN__)
/** /**
* @brief MMC_SPI card detection. * @brief MMC_SPI card detection.
@ -106,4 +263,6 @@ bool mmc_lld_is_write_protected(MMCDriver *mmcp) {
* @todo Add your board-specific code, if any. * @todo Add your board-specific code, if any.
*/ */
void boardInit(void) { void boardInit(void) {
SYSCFG->CFGR1 |= SYSCFG_CFGR1_I2C1_DMA_RMP;
SYSCFG->CFGR1 &= ~(SYSCFG_CFGR1_SPI2_DMA_RMP);
} }

View File

@ -22,6 +22,10 @@
#ifndef BOARD_H #ifndef BOARD_H
#define BOARD_H #define BOARD_H
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/* /*
* Setup for ST STM32F072B-Discovery board. * Setup for ST STM32F072B-Discovery board.
*/ */
@ -166,11 +170,9 @@
#define LINE_USB_DP PAL_LINE(GPIOA, 12U) #define LINE_USB_DP PAL_LINE(GPIOA, 12U)
#define LINE_SWDIO PAL_LINE(GPIOA, 13U) #define LINE_SWDIO PAL_LINE(GPIOA, 13U)
#define LINE_SWCLK PAL_LINE(GPIOA, 14U) #define LINE_SWCLK PAL_LINE(GPIOA, 14U)
#define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U) #define LINE_SPI2_SCK PAL_LINE(GPIOB, 13U)
#define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U) #define LINE_SPI2_MISO PAL_LINE(GPIOB, 14U)
#define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U) #define LINE_SPI2_MOSI PAL_LINE(GPIOB, 15U)
#define LINE_MEMS_CS PAL_LINE(GPIOC, 0U) #define LINE_MEMS_CS PAL_LINE(GPIOC, 0U)
#define LINE_LED_RED PAL_LINE(GPIOC, 6U) #define LINE_LED_RED PAL_LINE(GPIOC, 6U)
#define LINE_LED_BLUE PAL_LINE(GPIOC, 7U) #define LINE_LED_BLUE PAL_LINE(GPIOC, 7U)
@ -178,12 +180,25 @@
#define LINE_LED_GREEN PAL_LINE(GPIOC, 9U) #define LINE_LED_GREEN PAL_LINE(GPIOC, 9U)
#define LINE_OSC32_IN PAL_LINE(GPIOC, 14U) #define LINE_OSC32_IN PAL_LINE(GPIOC, 14U)
#define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U) #define LINE_OSC32_OUT PAL_LINE(GPIOC, 15U)
#define LINE_OSC_IN PAL_LINE(GPIOF, 0U) #define LINE_OSC_IN PAL_LINE(GPIOF, 0U)
#define LINE_OSC_OUT PAL_LINE(GPIOF, 1U) #define LINE_OSC_OUT PAL_LINE(GPIOF, 1U)
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/* /*
* I/O ports initial setup, this configuration is established soon after reset * I/O ports initial setup, this configuration is established soon after reset
* in the initialization code. * in the initialization code.
@ -908,6 +923,9 @@
PIN_AFIO_AF(GPIOF_PIN14, 0U) | \ PIN_AFIO_AF(GPIOF_PIN14, 0U) | \
PIN_AFIO_AF(GPIOF_PIN15, 0U)) PIN_AFIO_AF(GPIOF_PIN15, 0U))
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if !defined(_FROM_ASM_) #if !defined(_FROM_ASM_)
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,33 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
@ -349,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 10000 #define CH_CFG_ST_FREQUENCY 10000
#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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,11 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/* Use __WFI in the idle thread for waiting. Does lower the power
* consumption. */
#define CORTEX_ENABLE_WFI_IDLE TRUE
/** @} */ /** @} */
@ -126,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED FALSE #define CH_CFG_OPTIMIZE_SPEED FALSE
#endif
/** @} */ /** @} */
@ -144,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -152,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -161,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -169,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -180,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -188,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -198,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -208,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -218,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -226,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -236,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -245,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -256,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -266,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -275,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE FALSE #define CH_CFG_USE_MEMCORE FALSE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -287,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP FALSE #define CH_CFG_USE_HEAP FALSE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -296,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES TRUE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -307,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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 TRUE
#endif
/**
* @brief Enables factory for generic buffers.
*/
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
#endif
/**
* @brief Enables factory for semaphores.
*/
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
#define CH_CFG_FACTORY_SEMAPHORES TRUE
#endif
/**
* @brief Enables factory for mailboxes.
*/
#if !defined(CH_CFG_FACTORY_MAILBOXES)
#define CH_CFG_FACTORY_MAILBOXES TRUE
#endif
/**
* @brief Enables factory for objects FIFOs.
*/
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
#endif
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES TRUE
#endif
/** @} */ /** @} */
@ -323,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -332,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -341,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -351,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -359,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -378,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -388,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -399,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -410,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -419,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI FALSE #define HAL_USE_SPI FALSE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM TRUE #define CH_CFG_USE_TM TRUE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY TRUE #define CH_CFG_USE_MESSAGES_PRIORITY TRUE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS TRUE #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 TRUE
#endif
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES TRUE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #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 TRUE
#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 TRUE
#endif
/**
* @brief Enables factory for generic buffers.
*/
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
#endif
/**
* @brief Enables factory for semaphores.
*/
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
#define CH_CFG_FACTORY_SEMAPHORES TRUE
#endif
/**
* @brief Enables factory for mailboxes.
*/
#if !defined(CH_CFG_FACTORY_MAILBOXES)
#define CH_CFG_FACTORY_MAILBOXES TRUE
#endif
/**
* @brief Enables factory for objects FIFOs.
*/
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
#endif
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES TRUE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK TRUE #define CH_DBG_ENABLE_STACK_CHECK TRUE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -28,6 +28,9 @@
#ifndef HALCONF_H #ifndef HALCONF_H
#define HALCONF_H #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
/** /**
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC TRUE #define HAL_USE_DAC TRUE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -114,13 +117,6 @@
#define HAL_USE_PWM FALSE #define HAL_USE_PWM FALSE
#endif #endif
/**
* @brief Enables the QSPI subsystem.
*/
#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
#define HAL_USE_QSPI FALSE
#endif
/** /**
* @brief Enables the RTC subsystem. * @brief Enables the RTC subsystem.
*/ */
@ -149,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -156,6 +159,13 @@
#define HAL_USE_SPI FALSE #define HAL_USE_SPI FALSE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -177,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -208,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -224,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -284,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -343,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -351,6 +460,14 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/ /*===========================================================================*/
/* UART driver related settings. */ /* UART driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -383,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */ #endif /* HALCONF_H */
/** @} */ /** @} */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -32,6 +32,7 @@
*/ */
#define STM32F3xx_MCUCONF #define STM32F3xx_MCUCONF
#define STM32F303_MCUCONF
/* /*
* HAL driver system settings. * HAL driver system settings.
@ -66,9 +67,28 @@
#define STM32_USB_CLOCK_REQUIRED TRUE #define STM32_USB_CLOCK_REQUIRED TRUE
#define STM32_USBPRE STM32_USBPRE_DIV1P5 #define STM32_USBPRE STM32_USBPRE_DIV1P5
#undef STM32_HSE_BYPASS /*
// #error "oh no" * IRQ system settings.
// #endif */
#define STM32_IRQ_EXTI0_PRIORITY 6
#define STM32_IRQ_EXTI1_PRIORITY 6
#define STM32_IRQ_EXTI2_PRIORITY 6
#define STM32_IRQ_EXTI3_PRIORITY 6
#define STM32_IRQ_EXTI4_PRIORITY 6
#define STM32_IRQ_EXTI5_9_PRIORITY 6
#define STM32_IRQ_EXTI10_15_PRIORITY 6
#define STM32_IRQ_EXTI16_PRIORITY 6
#define STM32_IRQ_EXTI17_PRIORITY 15
#define STM32_IRQ_EXTI18_PRIORITY 6
#define STM32_IRQ_EXTI19_PRIORITY 15
#define STM32_IRQ_EXTI20_PRIORITY 15
#define STM32_IRQ_EXTI21_22_29_PRIORITY 6
#define STM32_IRQ_EXTI30_32_PRIORITY 6
#define STM32_IRQ_EXTI33_PRIORITY 6
#define STM32_IRQ_TIM1_BRK_TIM15_PRIORITY 7
#define STM32_IRQ_TIM1_UP_TIM16_PRIORITY 7
#define STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY 7
#define STM32_IRQ_TIM1_CC_PRIORITY 7
/* /*
* ADC driver system settings. * ADC driver system settings.
@ -114,25 +134,6 @@
#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 #define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 #define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
/*
* EXT driver system settings.
*/
#define STM32_EXT_EXTI0_IRQ_PRIORITY 6
#define STM32_EXT_EXTI1_IRQ_PRIORITY 6
#define STM32_EXT_EXTI2_IRQ_PRIORITY 6
#define STM32_EXT_EXTI3_IRQ_PRIORITY 6
#define STM32_EXT_EXTI4_IRQ_PRIORITY 6
#define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6
#define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6
#define STM32_EXT_EXTI16_IRQ_PRIORITY 6
#define STM32_EXT_EXTI17_IRQ_PRIORITY 6
#define STM32_EXT_EXTI18_IRQ_PRIORITY 6
#define STM32_EXT_EXTI19_IRQ_PRIORITY 6
#define STM32_EXT_EXTI20_IRQ_PRIORITY 6
#define STM32_EXT_EXTI21_22_29_IRQ_PRIORITY 6
#define STM32_EXT_EXTI30_32_IRQ_PRIORITY 6
#define STM32_EXT_EXTI33_IRQ_PRIORITY 6
/* /*
* GPT driver system settings. * GPT driver system settings.
*/ */
@ -143,6 +144,9 @@
#define STM32_GPT_USE_TIM6 TRUE #define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 TRUE #define STM32_GPT_USE_TIM7 TRUE
#define STM32_GPT_USE_TIM8 TRUE #define STM32_GPT_USE_TIM8 TRUE
#define STM32_GPT_USE_TIM15 FALSE
#define STM32_GPT_USE_TIM16 FALSE
#define STM32_GPT_USE_TIM17 FALSE
#define STM32_GPT_TIM1_IRQ_PRIORITY 7 #define STM32_GPT_TIM1_IRQ_PRIORITY 7
#define STM32_GPT_TIM2_IRQ_PRIORITY 7 #define STM32_GPT_TIM2_IRQ_PRIORITY 7
#define STM32_GPT_TIM3_IRQ_PRIORITY 7 #define STM32_GPT_TIM3_IRQ_PRIORITY 7
@ -172,6 +176,7 @@
#define STM32_ICU_USE_TIM3 FALSE #define STM32_ICU_USE_TIM3 FALSE
#define STM32_ICU_USE_TIM4 FALSE #define STM32_ICU_USE_TIM4 FALSE
#define STM32_ICU_USE_TIM8 FALSE #define STM32_ICU_USE_TIM8 FALSE
#define STM32_ICU_USE_TIM15 FALSE
#define STM32_ICU_TIM1_IRQ_PRIORITY 7 #define STM32_ICU_TIM1_IRQ_PRIORITY 7
#define STM32_ICU_TIM2_IRQ_PRIORITY 7 #define STM32_ICU_TIM2_IRQ_PRIORITY 7
#define STM32_ICU_TIM3_IRQ_PRIORITY 7 #define STM32_ICU_TIM3_IRQ_PRIORITY 7
@ -187,12 +192,23 @@
#define STM32_PWM_USE_TIM3 FALSE #define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 FALSE #define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM8 FALSE #define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM15 FALSE
#define STM32_PWM_USE_TIM16 FALSE
#define STM32_PWM_USE_TIM17 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 7 #define STM32_PWM_TIM1_IRQ_PRIORITY 7
#define STM32_PWM_TIM2_IRQ_PRIORITY 7 #define STM32_PWM_TIM2_IRQ_PRIORITY 7
#define STM32_PWM_TIM3_IRQ_PRIORITY 7 #define STM32_PWM_TIM3_IRQ_PRIORITY 7
#define STM32_PWM_TIM4_IRQ_PRIORITY 7 #define STM32_PWM_TIM4_IRQ_PRIORITY 7
#define STM32_PWM_TIM8_IRQ_PRIORITY 7 #define STM32_PWM_TIM8_IRQ_PRIORITY 7
/*
* RTC driver system settings.
*/
#define STM32_RTC_PRESA_VALUE 32
#define STM32_RTC_PRESS_VALUE 1024
#define STM32_RTC_CR_INIT 0
#define STM32_RTC_TAMPCR_INIT 0
/* /*
* SERIAL driver system settings. * SERIAL driver system settings.
*/ */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM TRUE #define CH_CFG_USE_TM TRUE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY TRUE #define CH_CFG_USE_MESSAGES_PRIORITY TRUE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS TRUE #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 TRUE
#endif
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES TRUE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #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 TRUE
#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 TRUE
#endif
/**
* @brief Enables factory for generic buffers.
*/
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
#endif
/**
* @brief Enables factory for semaphores.
*/
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
#define CH_CFG_FACTORY_SEMAPHORES TRUE
#endif
/**
* @brief Enables factory for mailboxes.
*/
#if !defined(CH_CFG_FACTORY_MAILBOXES)
#define CH_CFG_FACTORY_MAILBOXES TRUE
#endif
/**
* @brief Enables factory for objects FIFOs.
*/
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
#endif
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES TRUE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK TRUE #define CH_DBG_ENABLE_STACK_CHECK TRUE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -28,6 +28,9 @@
#ifndef HALCONF_H #ifndef HALCONF_H
#define HALCONF_H #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
/** /**
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC TRUE #define HAL_USE_DAC TRUE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -114,13 +117,6 @@
#define HAL_USE_PWM FALSE #define HAL_USE_PWM FALSE
#endif #endif
/**
* @brief Enables the QSPI subsystem.
*/
#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
#define HAL_USE_QSPI FALSE
#endif
/** /**
* @brief Enables the RTC subsystem. * @brief Enables the RTC subsystem.
*/ */
@ -149,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -156,6 +159,13 @@
#define HAL_USE_SPI FALSE #define HAL_USE_SPI FALSE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -177,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -208,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -224,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -284,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -343,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -351,6 +460,14 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/ /*===========================================================================*/
/* UART driver related settings. */ /* UART driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -383,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */ #endif /* HALCONF_H */
/** @} */ /** @} */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -32,6 +32,7 @@
*/ */
#define STM32F3xx_MCUCONF #define STM32F3xx_MCUCONF
#define STM32F303_MCUCONF
/* /*
* HAL driver system settings. * HAL driver system settings.
@ -66,9 +67,28 @@
#define STM32_USB_CLOCK_REQUIRED TRUE #define STM32_USB_CLOCK_REQUIRED TRUE
#define STM32_USBPRE STM32_USBPRE_DIV1P5 #define STM32_USBPRE STM32_USBPRE_DIV1P5
#undef STM32_HSE_BYPASS /*
// #error "oh no" * IRQ system settings.
// #endif */
#define STM32_IRQ_EXTI0_PRIORITY 6
#define STM32_IRQ_EXTI1_PRIORITY 6
#define STM32_IRQ_EXTI2_PRIORITY 6
#define STM32_IRQ_EXTI3_PRIORITY 6
#define STM32_IRQ_EXTI4_PRIORITY 6
#define STM32_IRQ_EXTI5_9_PRIORITY 6
#define STM32_IRQ_EXTI10_15_PRIORITY 6
#define STM32_IRQ_EXTI16_PRIORITY 6
#define STM32_IRQ_EXTI17_PRIORITY 15
#define STM32_IRQ_EXTI18_PRIORITY 6
#define STM32_IRQ_EXTI19_PRIORITY 15
#define STM32_IRQ_EXTI20_PRIORITY 15
#define STM32_IRQ_EXTI21_22_29_PRIORITY 6
#define STM32_IRQ_EXTI30_32_PRIORITY 6
#define STM32_IRQ_EXTI33_PRIORITY 6
#define STM32_IRQ_TIM1_BRK_TIM15_PRIORITY 7
#define STM32_IRQ_TIM1_UP_TIM16_PRIORITY 7
#define STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY 7
#define STM32_IRQ_TIM1_CC_PRIORITY 7
/* /*
* ADC driver system settings. * ADC driver system settings.
@ -114,25 +134,6 @@
#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 #define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 #define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
/*
* EXT driver system settings.
*/
#define STM32_EXT_EXTI0_IRQ_PRIORITY 6
#define STM32_EXT_EXTI1_IRQ_PRIORITY 6
#define STM32_EXT_EXTI2_IRQ_PRIORITY 6
#define STM32_EXT_EXTI3_IRQ_PRIORITY 6
#define STM32_EXT_EXTI4_IRQ_PRIORITY 6
#define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6
#define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6
#define STM32_EXT_EXTI16_IRQ_PRIORITY 6
#define STM32_EXT_EXTI17_IRQ_PRIORITY 6
#define STM32_EXT_EXTI18_IRQ_PRIORITY 6
#define STM32_EXT_EXTI19_IRQ_PRIORITY 6
#define STM32_EXT_EXTI20_IRQ_PRIORITY 6
#define STM32_EXT_EXTI21_22_29_IRQ_PRIORITY 6
#define STM32_EXT_EXTI30_32_IRQ_PRIORITY 6
#define STM32_EXT_EXTI33_IRQ_PRIORITY 6
/* /*
* GPT driver system settings. * GPT driver system settings.
*/ */
@ -143,6 +144,9 @@
#define STM32_GPT_USE_TIM6 TRUE #define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 TRUE #define STM32_GPT_USE_TIM7 TRUE
#define STM32_GPT_USE_TIM8 TRUE #define STM32_GPT_USE_TIM8 TRUE
#define STM32_GPT_USE_TIM15 FALSE
#define STM32_GPT_USE_TIM16 FALSE
#define STM32_GPT_USE_TIM17 FALSE
#define STM32_GPT_TIM1_IRQ_PRIORITY 7 #define STM32_GPT_TIM1_IRQ_PRIORITY 7
#define STM32_GPT_TIM2_IRQ_PRIORITY 7 #define STM32_GPT_TIM2_IRQ_PRIORITY 7
#define STM32_GPT_TIM3_IRQ_PRIORITY 7 #define STM32_GPT_TIM3_IRQ_PRIORITY 7
@ -172,6 +176,7 @@
#define STM32_ICU_USE_TIM3 FALSE #define STM32_ICU_USE_TIM3 FALSE
#define STM32_ICU_USE_TIM4 FALSE #define STM32_ICU_USE_TIM4 FALSE
#define STM32_ICU_USE_TIM8 FALSE #define STM32_ICU_USE_TIM8 FALSE
#define STM32_ICU_USE_TIM15 FALSE
#define STM32_ICU_TIM1_IRQ_PRIORITY 7 #define STM32_ICU_TIM1_IRQ_PRIORITY 7
#define STM32_ICU_TIM2_IRQ_PRIORITY 7 #define STM32_ICU_TIM2_IRQ_PRIORITY 7
#define STM32_ICU_TIM3_IRQ_PRIORITY 7 #define STM32_ICU_TIM3_IRQ_PRIORITY 7
@ -187,12 +192,23 @@
#define STM32_PWM_USE_TIM3 FALSE #define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 FALSE #define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM8 FALSE #define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM15 FALSE
#define STM32_PWM_USE_TIM16 FALSE
#define STM32_PWM_USE_TIM17 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 7 #define STM32_PWM_TIM1_IRQ_PRIORITY 7
#define STM32_PWM_TIM2_IRQ_PRIORITY 7 #define STM32_PWM_TIM2_IRQ_PRIORITY 7
#define STM32_PWM_TIM3_IRQ_PRIORITY 7 #define STM32_PWM_TIM3_IRQ_PRIORITY 7
#define STM32_PWM_TIM4_IRQ_PRIORITY 7 #define STM32_PWM_TIM4_IRQ_PRIORITY 7
#define STM32_PWM_TIM8_IRQ_PRIORITY 7 #define STM32_PWM_TIM8_IRQ_PRIORITY 7
/*
* RTC driver system settings.
*/
#define STM32_RTC_PRESA_VALUE 32
#define STM32_RTC_PRESS_VALUE 1024
#define STM32_RTC_CR_INIT 0
#define STM32_RTC_TAMPCR_INIT 0
/* /*
* SERIAL driver system settings. * SERIAL driver system settings.
*/ */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 2 #define CH_CFG_ST_TIMEDELTA 2
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM TRUE #define CH_CFG_USE_TM TRUE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY TRUE #define CH_CFG_USE_MESSAGES_PRIORITY TRUE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS TRUE #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 TRUE
#endif
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES TRUE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #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 TRUE
#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 TRUE
#endif
/**
* @brief Enables factory for generic buffers.
*/
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
#endif
/**
* @brief Enables factory for semaphores.
*/
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
#define CH_CFG_FACTORY_SEMAPHORES TRUE
#endif
/**
* @brief Enables factory for mailboxes.
*/
#if !defined(CH_CFG_FACTORY_MAILBOXES)
#define CH_CFG_FACTORY_MAILBOXES TRUE
#endif
/**
* @brief Enables factory for objects FIFOs.
*/
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
#endif
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES TRUE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK TRUE #define CH_DBG_ENABLE_STACK_CHECK TRUE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -28,6 +28,9 @@
#ifndef HALCONF_H #ifndef HALCONF_H
#define HALCONF_H #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
/** /**
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC TRUE #define HAL_USE_DAC TRUE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -114,13 +117,6 @@
#define HAL_USE_PWM FALSE #define HAL_USE_PWM FALSE
#endif #endif
/**
* @brief Enables the QSPI subsystem.
*/
#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
#define HAL_USE_QSPI FALSE
#endif
/** /**
* @brief Enables the RTC subsystem. * @brief Enables the RTC subsystem.
*/ */
@ -149,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -156,6 +159,13 @@
#define HAL_USE_SPI FALSE #define HAL_USE_SPI FALSE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -177,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -208,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -224,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -284,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -343,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -351,6 +460,14 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/ /*===========================================================================*/
/* UART driver related settings. */ /* UART driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -383,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
/*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */ #endif /* HALCONF_H */
/** @} */ /** @} */

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"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -32,6 +32,7 @@
*/ */
#define STM32F3xx_MCUCONF #define STM32F3xx_MCUCONF
#define STM32F303_MCUCONF
/* /*
* HAL driver system settings. * HAL driver system settings.
@ -66,9 +67,28 @@
#define STM32_USB_CLOCK_REQUIRED TRUE #define STM32_USB_CLOCK_REQUIRED TRUE
#define STM32_USBPRE STM32_USBPRE_DIV1P5 #define STM32_USBPRE STM32_USBPRE_DIV1P5
#undef STM32_HSE_BYPASS /*
// #error "oh no" * IRQ system settings.
// #endif */
#define STM32_IRQ_EXTI0_PRIORITY 6
#define STM32_IRQ_EXTI1_PRIORITY 6
#define STM32_IRQ_EXTI2_PRIORITY 6
#define STM32_IRQ_EXTI3_PRIORITY 6
#define STM32_IRQ_EXTI4_PRIORITY 6
#define STM32_IRQ_EXTI5_9_PRIORITY 6
#define STM32_IRQ_EXTI10_15_PRIORITY 6
#define STM32_IRQ_EXTI16_PRIORITY 6
#define STM32_IRQ_EXTI17_PRIORITY 15
#define STM32_IRQ_EXTI18_PRIORITY 6
#define STM32_IRQ_EXTI19_PRIORITY 15
#define STM32_IRQ_EXTI20_PRIORITY 15
#define STM32_IRQ_EXTI21_22_29_PRIORITY 6
#define STM32_IRQ_EXTI30_32_PRIORITY 6
#define STM32_IRQ_EXTI33_PRIORITY 6
#define STM32_IRQ_TIM1_BRK_TIM15_PRIORITY 7
#define STM32_IRQ_TIM1_UP_TIM16_PRIORITY 7
#define STM32_IRQ_TIM1_TRGCO_TIM17_PRIORITY 7
#define STM32_IRQ_TIM1_CC_PRIORITY 7
/* /*
* ADC driver system settings. * ADC driver system settings.
@ -114,25 +134,6 @@
#define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2 #define STM32_DAC_DAC1_CH1_DMA_PRIORITY 2
#define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2 #define STM32_DAC_DAC1_CH2_DMA_PRIORITY 2
/*
* EXT driver system settings.
*/
#define STM32_EXT_EXTI0_IRQ_PRIORITY 6
#define STM32_EXT_EXTI1_IRQ_PRIORITY 6
#define STM32_EXT_EXTI2_IRQ_PRIORITY 6
#define STM32_EXT_EXTI3_IRQ_PRIORITY 6
#define STM32_EXT_EXTI4_IRQ_PRIORITY 6
#define STM32_EXT_EXTI5_9_IRQ_PRIORITY 6
#define STM32_EXT_EXTI10_15_IRQ_PRIORITY 6
#define STM32_EXT_EXTI16_IRQ_PRIORITY 6
#define STM32_EXT_EXTI17_IRQ_PRIORITY 6
#define STM32_EXT_EXTI18_IRQ_PRIORITY 6
#define STM32_EXT_EXTI19_IRQ_PRIORITY 6
#define STM32_EXT_EXTI20_IRQ_PRIORITY 6
#define STM32_EXT_EXTI21_22_29_IRQ_PRIORITY 6
#define STM32_EXT_EXTI30_32_IRQ_PRIORITY 6
#define STM32_EXT_EXTI33_IRQ_PRIORITY 6
/* /*
* GPT driver system settings. * GPT driver system settings.
*/ */
@ -143,6 +144,9 @@
#define STM32_GPT_USE_TIM6 TRUE #define STM32_GPT_USE_TIM6 TRUE
#define STM32_GPT_USE_TIM7 TRUE #define STM32_GPT_USE_TIM7 TRUE
#define STM32_GPT_USE_TIM8 TRUE #define STM32_GPT_USE_TIM8 TRUE
#define STM32_GPT_USE_TIM15 FALSE
#define STM32_GPT_USE_TIM16 FALSE
#define STM32_GPT_USE_TIM17 FALSE
#define STM32_GPT_TIM1_IRQ_PRIORITY 7 #define STM32_GPT_TIM1_IRQ_PRIORITY 7
#define STM32_GPT_TIM2_IRQ_PRIORITY 7 #define STM32_GPT_TIM2_IRQ_PRIORITY 7
#define STM32_GPT_TIM3_IRQ_PRIORITY 7 #define STM32_GPT_TIM3_IRQ_PRIORITY 7
@ -172,6 +176,7 @@
#define STM32_ICU_USE_TIM3 FALSE #define STM32_ICU_USE_TIM3 FALSE
#define STM32_ICU_USE_TIM4 FALSE #define STM32_ICU_USE_TIM4 FALSE
#define STM32_ICU_USE_TIM8 FALSE #define STM32_ICU_USE_TIM8 FALSE
#define STM32_ICU_USE_TIM15 FALSE
#define STM32_ICU_TIM1_IRQ_PRIORITY 7 #define STM32_ICU_TIM1_IRQ_PRIORITY 7
#define STM32_ICU_TIM2_IRQ_PRIORITY 7 #define STM32_ICU_TIM2_IRQ_PRIORITY 7
#define STM32_ICU_TIM3_IRQ_PRIORITY 7 #define STM32_ICU_TIM3_IRQ_PRIORITY 7
@ -187,12 +192,23 @@
#define STM32_PWM_USE_TIM3 FALSE #define STM32_PWM_USE_TIM3 FALSE
#define STM32_PWM_USE_TIM4 FALSE #define STM32_PWM_USE_TIM4 FALSE
#define STM32_PWM_USE_TIM8 FALSE #define STM32_PWM_USE_TIM8 FALSE
#define STM32_PWM_USE_TIM15 FALSE
#define STM32_PWM_USE_TIM16 FALSE
#define STM32_PWM_USE_TIM17 FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY 7 #define STM32_PWM_TIM1_IRQ_PRIORITY 7
#define STM32_PWM_TIM2_IRQ_PRIORITY 7 #define STM32_PWM_TIM2_IRQ_PRIORITY 7
#define STM32_PWM_TIM3_IRQ_PRIORITY 7 #define STM32_PWM_TIM3_IRQ_PRIORITY 7
#define STM32_PWM_TIM4_IRQ_PRIORITY 7 #define STM32_PWM_TIM4_IRQ_PRIORITY 7
#define STM32_PWM_TIM8_IRQ_PRIORITY 7 #define STM32_PWM_TIM8_IRQ_PRIORITY 7
/*
* RTC driver system settings.
*/
#define STM32_RTC_PRESA_VALUE 32
#define STM32_RTC_PRESS_VALUE 1024
#define STM32_RTC_CR_INIT 0
#define STM32_RTC_TAMPCR_INIT 0
/* /*
* SERIAL driver system settings. * SERIAL driver system settings.
*/ */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 0 #define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 0 #define CH_CFG_TIME_QUANTUM 0
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE #define CH_CFG_USE_CONDVARS_TIMEOUT FALSE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS FALSE #define CH_CFG_USE_MEMPOOLS 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
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES FALSE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #define CH_CFG_USE_DYNAMIC 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
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES FALSE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT TRUE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS TRUE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -33,58 +33,53 @@ volatile uint16_t portb_buffer = 0;
static uint32_t switch_buffer = 0; static uint32_t switch_buffer = 0;
// Trigger on negative edge of any of the sense lines. static void pal_cb(void* unused);
static void extcb1(EXTDriver *extp, expchannel_t channel) {
(void)extp; static void enable_input_events(void)
(void)channel; {
palDisablePadEventI(GPIOA, 0);
palDisablePadEventI(GPIOA, 1);
palDisablePadEventI(GPIOA, 2);
palDisablePadEventI(GPIOA, 9);
palDisablePadEventI(GPIOA, 10);
palDisablePadEventI(GPIOB, 12);
palDisablePadEventI(GPIOB, 13);
palDisablePadEventI(GPIOB, 14);
palDisablePadEventI(GPIOB, 15);
palEnablePadEventI(GPIOA, 0, PAL_EVENT_MODE_FALLING_EDGE);
palEnablePadEventI(GPIOA, 1, PAL_EVENT_MODE_FALLING_EDGE);
palEnablePadEventI(GPIOA, 2, PAL_EVENT_MODE_FALLING_EDGE);
palEnablePadEventI(GPIOA, 9, PAL_EVENT_MODE_FALLING_EDGE);
palEnablePadEventI(GPIOA, 10, PAL_EVENT_MODE_FALLING_EDGE);
palEnablePadEventI(GPIOB, 12, PAL_EVENT_MODE_FALLING_EDGE);
palEnablePadEventI(GPIOB, 13, PAL_EVENT_MODE_FALLING_EDGE);
palEnablePadEventI(GPIOB, 14, PAL_EVENT_MODE_FALLING_EDGE);
palEnablePadEventI(GPIOB, 15, PAL_EVENT_MODE_FALLING_EDGE);
palSetPadCallbackI(GPIOA, 0, &pal_cb, 0);
palSetPadCallbackI(GPIOA, 1, &pal_cb, 0);
palSetPadCallbackI(GPIOA, 2, &pal_cb, 0);
palSetPadCallbackI(GPIOA, 9, &pal_cb, 0);
palSetPadCallbackI(GPIOA, 10, &pal_cb, 0);
palSetPadCallbackI(GPIOB, 12, &pal_cb, 0);
palSetPadCallbackI(GPIOB, 13, &pal_cb, 0);
palSetPadCallbackI(GPIOB, 14, &pal_cb, 0);
palSetPadCallbackI(GPIOB, 15, &pal_cb, 0);
}
// Trigger on negative edge of any of the sense lines.
static void pal_cb(void* unused) {
(void)unused;
chSysLockFromISR(); chSysLockFromISR();
porta_buffer = palReadPort(GPIOA); porta_buffer = palReadPort(GPIOA);
portb_buffer = palReadPort(GPIOB); portb_buffer = palReadPort(GPIOB);
//Disable further interrupts that might occur on same button press. //Disable further interrupts that might occur on same button press.
extChannelDisable(&EXTD1,0); enable_input_events();
extChannelDisable(&EXTD1,1);
extChannelDisable(&EXTD1,2);
extChannelDisable(&EXTD1,9);
extChannelDisable(&EXTD1,10);
extChannelDisable(&EXTD1,12);
extChannelDisable(&EXTD1,13);
extChannelDisable(&EXTD1,14);
extChannelDisable(&EXTD1,15);
extChannelEnable(&EXTD1,0);
extChannelEnable(&EXTD1,1);
extChannelEnable(&EXTD1,2);
extChannelEnable(&EXTD1,9);
extChannelEnable(&EXTD1,10);
extChannelEnable(&EXTD1,12);
extChannelEnable(&EXTD1,13);
extChannelEnable(&EXTD1,14);
extChannelEnable(&EXTD1,15);
chSysUnlockFromISR(); chSysUnlockFromISR();
} }
static const EXTConfig extcfg = {
{
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, extcb1 }, //0
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, extcb1 }, //1
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, extcb1 }, //2
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, extcb1 }, //9
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOA, extcb1 }, //10
{EXT_CH_MODE_DISABLED, NULL},
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOB, extcb1 }, //12
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOB, extcb1 }, //13
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOB, extcb1 }, //14
{EXT_CH_MODE_FALLING_EDGE | EXT_CH_MODE_AUTOSTART | EXT_MODE_GPIOB, extcb1 } //15
},
};
void matrix_init(void) { void matrix_init(void) {
//Set I/O as pull-up inputs to read states //Set I/O as pull-up inputs to read states
setPinInputHigh(A0); setPinInputHigh(A0);
@ -115,8 +110,10 @@ void matrix_init(void) {
memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t)); memset(matrix_debouncing, 0, MATRIX_ROWS * sizeof(matrix_row_t));
matrix_init_quantum(); matrix_init_quantum();
//Start interrupt driver
extStart(&EXTD1, &extcfg); osalSysLock();
enable_input_events();
osalSysUnlock();
} }
uint8_t matrix_scan(void) { uint8_t matrix_scan(void) {

View File

@ -229,6 +229,7 @@ void led_set_user(uint8_t usb_led) {
LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT LCTL,LGUI,LALT,MHEN,HANJ, SPC, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT
), ),
#define KC_LT1 LT(1, KC_SPC)
/* /*
* SpaceFN layout * SpaceFN layout
@ -260,7 +261,7 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO, TAB, Q, W, E, R, T, Y, U, I, O, P, LBRC,RBRC, BSLS, DEL, END, PGDN, P7, P8, P9, PPLS, MENU,UNDO,
LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY, LCTL,A, S, D, F, G, H, J, K, L, SCLN,QUOT, NUHS,ENT, P4, P5, P6, PCMM, SLCT,COPY,
LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE, LSFT,NUBS,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RO, RSFT, UP, P1, P2, P3, PEQL, EXEC,PSTE,
LCTL,LGUI,LALT,MHEN,HANJ, FN0, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT LCTL,LGUI,LALT,MHEN,HANJ, LT1, HAEN,HENK,KANA,RALT,RGUI,APP, RCTL, LEFT,DOWN,RGHT, P0, PDOT,PENT, FIND,CUT
), ),
/* 1: SpaceFN /* 1: SpaceFN
@ -288,7 +289,6 @@ const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
}; };
const action_t PROGMEM fn_actions[] = { const action_t PROGMEM fn_actions[] = {
[0] = ACTION_LAYER_TAP_KEY(1, KC_SPACE),
[1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde [1] = ACTION_MODS_KEY(MOD_LSFT, KC_GRV), // tilde
}; };

View File

@ -104,7 +104,7 @@ static GFXINLINE void set_hardware_shutdown(GDisplay* g, bool shutdown) {
static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) { static GFXINLINE void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
(void) g; (void) g;
i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, US2ST(IS31_TIMEOUT)); i2cMasterTransmitTimeout(&I2CD1, IS31_ADDR_DEFAULT, data, length, 0, 0, TIME_US2I(IS31_TIMEOUT));
} }
#endif /* _GDISP_LLD_BOARD_H */ #endif /* _GDISP_LLD_BOARD_H */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -25,10 +25,11 @@
* @{ * @{
*/ */
#ifndef _CHCONF_H_ #ifndef CHCONF_H
#define _CHCONF_H_ #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 0 #define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 20 #define CH_CFG_TIME_QUANTUM 20
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,15 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/**
* @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
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -279,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -291,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -300,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS TRUE #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 TRUE
#endif
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES TRUE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -311,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #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 TRUE
#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 TRUE
#endif
/**
* @brief Enables factory for generic buffers.
*/
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
#endif
/**
* @brief Enables factory for semaphores.
*/
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
#define CH_CFG_FACTORY_SEMAPHORES TRUE
#endif
/**
* @brief Enables factory for mailboxes.
*/
#if !defined(CH_CFG_FACTORY_MAILBOXES)
#define CH_CFG_FACTORY_MAILBOXES TRUE
#endif
/**
* @brief Enables factory for objects FIFOs.
*/
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
#endif
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES TRUE
#endif
/** @} */ /** @} */
@ -327,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -336,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -345,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -355,16 +513,28 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
* @details If enabled then the context switch circular trace buffer is * @details If enabled then the trace buffer is activated.
* activated.
* *
* @note The default is @p FALSE. * @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. * @brief Debug option, stack checks.
@ -376,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -386,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -397,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -408,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -417,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \
@ -429,10 +621,6 @@
/** /**
* @brief Threads finalization hook. * @brief Threads finalization hook.
* @details User finalization code added to the @p chThdExit() API. * @details User finalization code added to the @p chThdExit() API.
*
* @note It is inserted into lock zone.
* @note It is also invoked when the threads simply return in order to
* terminate.
*/ */
#define CH_CFG_THREAD_EXIT_HOOK(tp) { \ #define CH_CFG_THREAD_EXIT_HOOK(tp) { \
/* Add threads finalization code here.*/ \ /* Add threads finalization code here.*/ \
@ -467,6 +655,7 @@
* @note This macro can be used to activate a power saving mode. * @note This macro can be used to activate a power saving mode.
*/ */
#define CH_CFG_IDLE_ENTER_HOOK() { \ #define CH_CFG_IDLE_ENTER_HOOK() { \
/* Idle-enter code here.*/ \
} }
/** /**
@ -476,6 +665,7 @@
* @note This macro can be used to deactivate a power saving mode. * @note This macro can be used to deactivate a power saving mode.
*/ */
#define CH_CFG_IDLE_LEAVE_HOOK() { \ #define CH_CFG_IDLE_LEAVE_HOOK() { \
/* Idle-leave code here.*/ \
} }
/** /**
@ -519,6 +709,6 @@
/* Port-specific settings (override port settings defaulted in chcore.h). */ /* Port-specific settings (override port settings defaulted in chcore.h). */
/*===========================================================================*/ /*===========================================================================*/
#endif /* _CHCONF_H_ */ #endif /* CHCONF_H */
/** @} */ /** @} */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI TRUE #define HAL_USE_SPI TRUE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -15,7 +15,7 @@
*/ */
/** /**
* @file templates/chconf.h * @file rt/templates/chconf.h
* @brief Configuration file template. * @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it * @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings. * contains the application specific kernel settings.
@ -29,6 +29,7 @@
#define CHCONF_H #define CHCONF_H
#define _CHIBIOS_RT_CONF_ #define _CHIBIOS_RT_CONF_
#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/ /*===========================================================================*/
/** /**
@ -41,14 +42,34 @@
* @brief System time counter resolution. * @brief System time counter resolution.
* @note Allowed values are 16 or 32 bits. * @note Allowed values are 16 or 32 bits.
*/ */
#if !defined(CH_CFG_ST_RESOLUTION)
#define CH_CFG_ST_RESOLUTION 32 #define CH_CFG_ST_RESOLUTION 32
#endif
/** /**
* @brief System tick frequency. * @brief System tick frequency.
* @details Frequency of the system timer that drives the system ticks. This * @details Frequency of the system timer that drives the system ticks. This
* setting also defines the system tick time unit. * setting also defines the system tick time unit.
*/ */
#if !defined(CH_CFG_ST_FREQUENCY)
#define CH_CFG_ST_FREQUENCY 100000 #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. * @brief Time delta constant for the tick-less mode.
@ -58,7 +79,9 @@
* The value one is not valid, timeouts are rounded up to * The value one is not valid, timeouts are rounded up to
* this value. * this value.
*/ */
#if !defined(CH_CFG_ST_TIMEDELTA)
#define CH_CFG_ST_TIMEDELTA 0 #define CH_CFG_ST_TIMEDELTA 0
#endif
/** @} */ /** @} */
@ -81,7 +104,9 @@
* @note The round robin preemption is not supported in tickless mode and * @note The round robin preemption is not supported in tickless mode and
* must be set to zero in that case. * must be set to zero in that case.
*/ */
#if !defined(CH_CFG_TIME_QUANTUM)
#define CH_CFG_TIME_QUANTUM 20 #define CH_CFG_TIME_QUANTUM 20
#endif
/** /**
* @brief Managed RAM size. * @brief Managed RAM size.
@ -94,7 +119,9 @@
* provide the @p __heap_base__ and @p __heap_end__ symbols. * provide the @p __heap_base__ and @p __heap_end__ symbols.
* @note Requires @p CH_CFG_USE_MEMCORE. * @note Requires @p CH_CFG_USE_MEMCORE.
*/ */
#if !defined(CH_CFG_MEMCORE_SIZE)
#define CH_CFG_MEMCORE_SIZE 0 #define CH_CFG_MEMCORE_SIZE 0
#endif
/** /**
* @brief Idle thread automatic spawn suppression. * @brief Idle thread automatic spawn suppression.
@ -103,7 +130,9 @@
* function becomes the idle thread and must implement an * function becomes the idle thread and must implement an
* infinite loop. * infinite loop.
*/ */
#if !defined(CH_CFG_NO_IDLE_THREAD)
#define CH_CFG_NO_IDLE_THREAD FALSE #define CH_CFG_NO_IDLE_THREAD FALSE
#endif
/** @} */ /** @} */
@ -122,7 +151,9 @@
* @note This is not related to the compiler optimization options. * @note This is not related to the compiler optimization options.
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_OPTIMIZE_SPEED)
#define CH_CFG_OPTIMIZE_SPEED TRUE #define CH_CFG_OPTIMIZE_SPEED TRUE
#endif
/** @} */ /** @} */
@ -140,7 +171,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_TM)
#define CH_CFG_USE_TM FALSE #define CH_CFG_USE_TM FALSE
#endif
/** /**
* @brief Threads registry APIs. * @brief Threads registry APIs.
@ -148,7 +181,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_REGISTRY)
#define CH_CFG_USE_REGISTRY TRUE #define CH_CFG_USE_REGISTRY TRUE
#endif
/** /**
* @brief Threads synchronization APIs. * @brief Threads synchronization APIs.
@ -157,7 +192,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_WAITEXIT)
#define CH_CFG_USE_WAITEXIT TRUE #define CH_CFG_USE_WAITEXIT TRUE
#endif
/** /**
* @brief Semaphores APIs. * @brief Semaphores APIs.
@ -165,7 +202,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES)
#define CH_CFG_USE_SEMAPHORES TRUE #define CH_CFG_USE_SEMAPHORES TRUE
#endif
/** /**
* @brief Semaphores queuing mode. * @brief Semaphores queuing mode.
@ -176,7 +215,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_SEMAPHORES_PRIORITY)
#define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE #define CH_CFG_USE_SEMAPHORES_PRIORITY FALSE
#endif
/** /**
* @brief Mutexes APIs. * @brief Mutexes APIs.
@ -184,7 +225,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MUTEXES)
#define CH_CFG_USE_MUTEXES TRUE #define CH_CFG_USE_MUTEXES TRUE
#endif
/** /**
* @brief Enables recursive behavior on mutexes. * @brief Enables recursive behavior on mutexes.
@ -194,7 +237,9 @@
* @note The default is @p FALSE. * @note The default is @p FALSE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_MUTEXES_RECURSIVE)
#define CH_CFG_USE_MUTEXES_RECURSIVE FALSE #define CH_CFG_USE_MUTEXES_RECURSIVE FALSE
#endif
/** /**
* @brief Conditional Variables APIs. * @brief Conditional Variables APIs.
@ -204,7 +249,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_MUTEXES. * @note Requires @p CH_CFG_USE_MUTEXES.
*/ */
#if !defined(CH_CFG_USE_CONDVARS)
#define CH_CFG_USE_CONDVARS TRUE #define CH_CFG_USE_CONDVARS TRUE
#endif
/** /**
* @brief Conditional Variables APIs with timeout. * @brief Conditional Variables APIs with timeout.
@ -214,7 +261,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_CONDVARS. * @note Requires @p CH_CFG_USE_CONDVARS.
*/ */
#if !defined(CH_CFG_USE_CONDVARS_TIMEOUT)
#define CH_CFG_USE_CONDVARS_TIMEOUT TRUE #define CH_CFG_USE_CONDVARS_TIMEOUT TRUE
#endif
/** /**
* @brief Events Flags APIs. * @brief Events Flags APIs.
@ -222,7 +271,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_EVENTS)
#define CH_CFG_USE_EVENTS TRUE #define CH_CFG_USE_EVENTS TRUE
#endif
/** /**
* @brief Events Flags APIs with timeout. * @brief Events Flags APIs with timeout.
@ -232,7 +283,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_EVENTS. * @note Requires @p CH_CFG_USE_EVENTS.
*/ */
#if !defined(CH_CFG_USE_EVENTS_TIMEOUT)
#define CH_CFG_USE_EVENTS_TIMEOUT TRUE #define CH_CFG_USE_EVENTS_TIMEOUT TRUE
#endif
/** /**
* @brief Synchronous Messages APIs. * @brief Synchronous Messages APIs.
@ -241,7 +294,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MESSAGES)
#define CH_CFG_USE_MESSAGES TRUE #define CH_CFG_USE_MESSAGES TRUE
#endif
/** /**
* @brief Synchronous Messages queuing mode. * @brief Synchronous Messages queuing mode.
@ -252,7 +307,9 @@
* requirements. * requirements.
* @note Requires @p CH_CFG_USE_MESSAGES. * @note Requires @p CH_CFG_USE_MESSAGES.
*/ */
#if !defined(CH_CFG_USE_MESSAGES_PRIORITY)
#define CH_CFG_USE_MESSAGES_PRIORITY FALSE #define CH_CFG_USE_MESSAGES_PRIORITY FALSE
#endif
/** /**
* @brief Mailboxes APIs. * @brief Mailboxes APIs.
@ -262,7 +319,9 @@
* @note The default is @p TRUE. * @note The default is @p TRUE.
* @note Requires @p CH_CFG_USE_SEMAPHORES. * @note Requires @p CH_CFG_USE_SEMAPHORES.
*/ */
#if !defined(CH_CFG_USE_MAILBOXES)
#define CH_CFG_USE_MAILBOXES TRUE #define CH_CFG_USE_MAILBOXES TRUE
#endif
/** /**
* @brief Core Memory Manager APIs. * @brief Core Memory Manager APIs.
@ -271,7 +330,9 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMCORE)
#define CH_CFG_USE_MEMCORE TRUE #define CH_CFG_USE_MEMCORE TRUE
#endif
/** /**
* @brief Heap Allocator APIs. * @brief Heap Allocator APIs.
@ -283,7 +344,9 @@
* @p CH_CFG_USE_SEMAPHORES. * @p CH_CFG_USE_SEMAPHORES.
* @note Mutexes are recommended. * @note Mutexes are recommended.
*/ */
#if !defined(CH_CFG_USE_HEAP)
#define CH_CFG_USE_HEAP TRUE #define CH_CFG_USE_HEAP TRUE
#endif
/** /**
* @brief Memory Pools Allocator APIs. * @brief Memory Pools Allocator APIs.
@ -292,7 +355,31 @@
* *
* @note The default is @p TRUE. * @note The default is @p TRUE.
*/ */
#if !defined(CH_CFG_USE_MEMPOOLS)
#define CH_CFG_USE_MEMPOOLS TRUE #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 TRUE
#endif
/**
* @brief Pipes APIs.
* @details If enabled then the pipes APIs are included
* in the kernel.
*
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_PIPES)
#define CH_CFG_USE_PIPES TRUE
#endif
/** /**
* @brief Dynamic Threads APIs. * @brief Dynamic Threads APIs.
@ -303,7 +390,80 @@
* @note Requires @p CH_CFG_USE_WAITEXIT. * @note Requires @p CH_CFG_USE_WAITEXIT.
* @note Requires @p CH_CFG_USE_HEAP and/or @p CH_CFG_USE_MEMPOOLS. * @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 #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 TRUE
#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 TRUE
#endif
/**
* @brief Enables factory for generic buffers.
*/
#if !defined(CH_CFG_FACTORY_GENERIC_BUFFERS)
#define CH_CFG_FACTORY_GENERIC_BUFFERS TRUE
#endif
/**
* @brief Enables factory for semaphores.
*/
#if !defined(CH_CFG_FACTORY_SEMAPHORES)
#define CH_CFG_FACTORY_SEMAPHORES TRUE
#endif
/**
* @brief Enables factory for mailboxes.
*/
#if !defined(CH_CFG_FACTORY_MAILBOXES)
#define CH_CFG_FACTORY_MAILBOXES TRUE
#endif
/**
* @brief Enables factory for objects FIFOs.
*/
#if !defined(CH_CFG_FACTORY_OBJ_FIFOS)
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
#endif
/**
* @brief Enables factory for Pipes.
*/
#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
#define CH_CFG_FACTORY_PIPES TRUE
#endif
/** @} */ /** @} */
@ -319,7 +479,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_STATISTICS)
#define CH_DBG_STATISTICS FALSE #define CH_DBG_STATISTICS FALSE
#endif
/** /**
* @brief Debug option, system state check. * @brief Debug option, system state check.
@ -328,7 +490,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_SYSTEM_STATE_CHECK)
#define CH_DBG_SYSTEM_STATE_CHECK FALSE #define CH_DBG_SYSTEM_STATE_CHECK FALSE
#endif
/** /**
* @brief Debug option, parameters checks. * @brief Debug option, parameters checks.
@ -337,7 +501,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_CHECKS)
#define CH_DBG_ENABLE_CHECKS FALSE #define CH_DBG_ENABLE_CHECKS FALSE
#endif
/** /**
* @brief Debug option, consistency checks. * @brief Debug option, consistency checks.
@ -347,7 +513,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_ENABLE_ASSERTS)
#define CH_DBG_ENABLE_ASSERTS FALSE #define CH_DBG_ENABLE_ASSERTS FALSE
#endif
/** /**
* @brief Debug option, trace buffer. * @brief Debug option, trace buffer.
@ -355,14 +523,18 @@
* *
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED. * @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_MASK)
#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED #define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/** /**
* @brief Trace buffer entries. * @brief Trace buffer entries.
* @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is * @note The trace buffer is only allocated if @p CH_DBG_TRACE_MASK is
* different from @p CH_DBG_TRACE_MASK_DISABLED. * different from @p CH_DBG_TRACE_MASK_DISABLED.
*/ */
#if !defined(CH_DBG_TRACE_BUFFER_SIZE)
#define CH_DBG_TRACE_BUFFER_SIZE 128 #define CH_DBG_TRACE_BUFFER_SIZE 128
#endif
/** /**
* @brief Debug option, stack checks. * @brief Debug option, stack checks.
@ -374,7 +546,9 @@
* @note The default failure mode is to halt the system with the global * @note The default failure mode is to halt the system with the global
* @p panic_msg variable set to @p NULL. * @p panic_msg variable set to @p NULL.
*/ */
#if !defined(CH_DBG_ENABLE_STACK_CHECK)
#define CH_DBG_ENABLE_STACK_CHECK FALSE #define CH_DBG_ENABLE_STACK_CHECK FALSE
#endif
/** /**
* @brief Debug option, stacks initialization. * @brief Debug option, stacks initialization.
@ -384,7 +558,9 @@
* *
* @note The default is @p FALSE. * @note The default is @p FALSE.
*/ */
#if !defined(CH_DBG_FILL_THREADS)
#define CH_DBG_FILL_THREADS FALSE #define CH_DBG_FILL_THREADS FALSE
#endif
/** /**
* @brief Debug option, threads profiling. * @brief Debug option, threads profiling.
@ -395,7 +571,9 @@
* @note This debug option is not currently compatible with the * @note This debug option is not currently compatible with the
* tickless mode. * tickless mode.
*/ */
#if !defined(CH_DBG_THREADS_PROFILING)
#define CH_DBG_THREADS_PROFILING FALSE #define CH_DBG_THREADS_PROFILING FALSE
#endif
/** @} */ /** @} */
@ -406,6 +584,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. * @brief Threads descriptor structure extension.
* @details User fields added to the end of the @p thread_t structure. * @details User fields added to the end of the @p thread_t structure.
@ -415,9 +609,9 @@
/** /**
* @brief Threads initialization hook. * @brief Threads initialization hook.
* @details User initialization code added to the @p chThdInit() API. * @details User initialization code added to the @p _thread_init() function.
* *
* @note It is invoked from within @p chThdInit() and implicitly from all * @note It is invoked from within @p _thread_init() and implicitly from all
* the threads creation APIs. * the threads creation APIs.
*/ */
#define CH_CFG_THREAD_INIT_HOOK(tp) { \ #define CH_CFG_THREAD_INIT_HOOK(tp) { \

View File

@ -1,5 +1,5 @@
/* /*
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
@ -25,8 +25,11 @@
* @{ * @{
*/ */
#ifndef _HALCONF_H_ #ifndef HALCONF_H
#define _HALCONF_H_ #define HALCONF_H
#define _CHIBIOS_HAL_CONF_
#define _CHIBIOS_HAL_CONF_VER_7_0_
#include "mcuconf.h" #include "mcuconf.h"
@ -51,6 +54,13 @@
#define HAL_USE_CAN FALSE #define HAL_USE_CAN FALSE
#endif #endif
/**
* @brief Enables the cryptographic subsystem.
*/
#if !defined(HAL_USE_CRY) || defined(__DOXYGEN__)
#define HAL_USE_CRY FALSE
#endif
/** /**
* @brief Enables the DAC subsystem. * @brief Enables the DAC subsystem.
*/ */
@ -58,13 +68,6 @@
#define HAL_USE_DAC FALSE #define HAL_USE_DAC FALSE
#endif #endif
/**
* @brief Enables the EXT subsystem.
*/
#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
#define HAL_USE_EXT FALSE
#endif
/** /**
* @brief Enables the GPT subsystem. * @brief Enables the GPT subsystem.
*/ */
@ -142,6 +145,13 @@
#define HAL_USE_SERIAL_USB FALSE #define HAL_USE_SERIAL_USB FALSE
#endif #endif
/**
* @brief Enables the SIO subsystem.
*/
#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
#define HAL_USE_SIO FALSE
#endif
/** /**
* @brief Enables the SPI subsystem. * @brief Enables the SPI subsystem.
*/ */
@ -149,6 +159,13 @@
#define HAL_USE_SPI FALSE #define HAL_USE_SPI FALSE
#endif #endif
/**
* @brief Enables the TRNG subsystem.
*/
#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
#define HAL_USE_TRNG FALSE
#endif
/** /**
* @brief Enables the UART subsystem. * @brief Enables the UART subsystem.
*/ */
@ -170,6 +187,33 @@
#define HAL_USE_WDG FALSE #define HAL_USE_WDG FALSE
#endif #endif
/**
* @brief Enables the WSPI subsystem.
*/
#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
#define HAL_USE_WSPI FALSE
#endif
/*===========================================================================*/
/* PAL driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
#define PAL_USE_CALLBACKS FALSE
#endif
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
#define PAL_USE_WAIT FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* ADC driver related settings. */ /* ADC driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -201,6 +245,55 @@
#define CAN_USE_SLEEP_MODE TRUE #define CAN_USE_SLEEP_MODE TRUE
#endif #endif
/**
* @brief Enforces the driver to use direct callbacks rather than OSAL events.
*/
#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
#define CAN_ENFORCE_USE_CALLBACKS FALSE
#endif
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
/**
* @brief Enables the SW fall-back of the cryptographic driver.
* @details When enabled, this option, activates a fall-back software
* implementation for algorithms not supported by the underlying
* hardware.
* @note Fall-back implementations may not be present for all algorithms.
*/
#if !defined(HAL_CRY_USE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_USE_FALLBACK FALSE
#endif
/**
* @brief Makes the driver forcibly use the fall-back implementations.
*/
#if !defined(HAL_CRY_ENFORCE_FALLBACK) || defined(__DOXYGEN__)
#define HAL_CRY_ENFORCE_FALLBACK FALSE
#endif
/*===========================================================================*/
/* DAC driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
#define DAC_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define DAC_USE_MUTUAL_EXCLUSION TRUE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* I2C driver related settings. */ /* I2C driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -217,7 +310,7 @@
/*===========================================================================*/ /*===========================================================================*/
/** /**
* @brief Enables an event sources for incoming packets. * @brief Enables the zero-copy API.
*/ */
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__) #if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE #define MAC_USE_ZERO_COPY FALSE
@ -277,6 +370,20 @@
#define SDC_NICE_WAITING TRUE #define SDC_NICE_WAITING TRUE
#endif #endif
/**
* @brief OCR initialization constant for V20 cards.
*/
#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
#define SDC_INIT_OCR_V20 0x50FF8000U
#endif
/**
* @brief OCR initialization constant for non-V20 cards.
*/
#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
#define SDC_INIT_OCR 0x80100000U
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SERIAL driver related settings. */ /* SERIAL driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -294,7 +401,7 @@
* @brief Serial buffers size. * @brief Serial buffers size.
* @details Configuration parameter, you can change the depth of the queue * @details Configuration parameter, you can change the depth of the queue
* buffers depending on the requirements of your application. * buffers depending on the requirements of your application.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 16 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
@ -309,13 +416,21 @@
* @brief Serial over USB buffers size. * @brief Serial over USB buffers size.
* @details Configuration parameter, the buffer size must be a multiple of * @details Configuration parameter, the buffer size must be a multiple of
* the USB data endpoint maximum packet size. * the USB data endpoint maximum packet size.
* @note The default is 64 bytes for both the transmission and receive * @note The default is 256 bytes for both the transmission and receive
* buffers. * buffers.
*/ */
#if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_SIZE 1 #define SERIAL_USB_BUFFERS_SIZE 1
#endif #endif
/**
* @brief Serial over USB number of buffers.
* @note The default is 2 buffers.
*/
#if !defined(SERIAL_USB_BUFFERS_NUMBER) || defined(__DOXYGEN__)
#define SERIAL_USB_BUFFERS_NUMBER 2
#endif
/*===========================================================================*/ /*===========================================================================*/
/* SPI driver related settings. */ /* SPI driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -328,6 +443,15 @@
#define SPI_USE_WAIT TRUE #define SPI_USE_WAIT TRUE
#endif #endif
/**
* @brief Enables circular transfers APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
#define SPI_USE_CIRCULAR FALSE
#endif
/** /**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs. * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space. * @note Disabling this option saves both code and data space.
@ -336,6 +460,34 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE #define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif #endif
/**
* @brief Handling method for SPI CS line.
* @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_WAIT) || defined(__DOXYGEN__)
#define UART_USE_WAIT FALSE
#endif
/**
* @brief Enables the @p uartAcquireBus() and @p uartReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(UART_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define UART_USE_MUTUAL_EXCLUSION FALSE
#endif
/*===========================================================================*/ /*===========================================================================*/
/* USB driver related settings. */ /* USB driver related settings. */
/*===========================================================================*/ /*===========================================================================*/
@ -348,6 +500,26 @@
#define USB_USE_WAIT TRUE #define USB_USE_WAIT TRUE
#endif #endif
#endif /* _HALCONF_H_ */ /*===========================================================================*/
/* WSPI driver related settings. */
/*===========================================================================*/
/**
* @brief Enables synchronous APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
#define WSPI_USE_WAIT TRUE
#endif
/**
* @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define WSPI_USE_MUTUAL_EXCLUSION TRUE
#endif
#endif /* HALCONF_H */
/** @} */ /** @} */

View File

@ -23,7 +23,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BL] = LAYOUT( [_BL] = LAYOUT(
F(12),KC_1,KC_2,KC_3,KC_4,KC_5,KC_6,KC_7,KC_8,KC_9,KC_0,KC_MINS,KC_EQL,KC_BSPC, \ F(12),KC_1,KC_2,KC_3,KC_4,KC_5,KC_6,KC_7,KC_8,KC_9,KC_0,KC_MINS,KC_EQL,KC_BSPC, \
KC_TAB,KC_Q,KC_W,KC_E,KC_R,KC_T,KC_Y,KC_U,KC_I,KC_O,KC_P,KC_LBRC,KC_RBRC,KC_BSLS, \ KC_TAB,KC_Q,KC_W,KC_E,KC_R,KC_T,KC_Y,KC_U,KC_I,KC_O,KC_P,KC_LBRC,KC_RBRC,KC_BSLS, \
F(2),KC_A,KC_S,KC_D,KC_F,KC_G,KC_H,KC_J,KC_K,KC_L,KC_SCLN,KC_QUOT,KC_NO,KC_ENT, \ LT(2, KC_CAPS),KC_A,KC_S,KC_D,KC_F,KC_G,KC_H,KC_J,KC_K,KC_L,KC_SCLN,KC_QUOT,KC_NO,KC_ENT, \
KC_LSFT,KC_NO,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT,KC_SLSH,KC_NO,KC_RSFT, \ KC_LSFT,KC_NO,KC_Z,KC_X,KC_C,KC_V,KC_B,KC_N,KC_M,KC_COMM,KC_DOT,KC_SLSH,KC_NO,KC_RSFT, \
KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_NO,KC_RALT,MO(2),KC_APP,KC_RCTL), KC_LCTL,KC_LGUI,KC_LALT, KC_SPC, KC_NO,KC_RALT,MO(2),KC_APP,KC_RCTL),
@ -107,7 +107,6 @@ enum function_id {
const uint16_t PROGMEM fn_actions[] = { const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TOGGLE(1), // Toggle Arrow Layer overlay [1] = ACTION_LAYER_TOGGLE(1), // Toggle Arrow Layer overlay
[2] = ACTION_LAYER_TAP_KEY(2, KC_CAPS), // Tap to toggle caps lock and hold to activate function layer
[3] = ACTION_LAYER_TOGGLE(3), // Toggle Underglow Layer overlay [3] = ACTION_LAYER_TOGGLE(3), // Toggle Underglow Layer overlay
[4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow [4] = ACTION_FUNCTION(RGBLED_TOGGLE), //Turn on/off underglow
[5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode [5] = ACTION_FUNCTION(RGBLED_STEP_MODE), // Change underglow mode
@ -120,21 +119,6 @@ const uint16_t PROGMEM fn_actions[] = {
[12] = ACTION_FUNCTION(SHIFT_ESC), [12] = ACTION_FUNCTION(SHIFT_ESC),
}; };
const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case 0:
if (record->event.pressed) {
register_code(KC_RSFT);
} else {
unregister_code(KC_RSFT);
}
break;
}
return MACRO_NONE;
};
void matrix_scan_user(void) { void matrix_scan_user(void) {
// Layer LED indicators // Layer LED indicators

View File

@ -0,0 +1,35 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6FD7
#define DEVICE_VER 0x0001
#define MANUFACTURER GON
#define PRODUCT NerD 60
#define DESCRIPTION QMK port for the GON NerD 60 PCB
/* key matrix size */
#define MATRIX_ROWS 10
#define MATRIX_COLS 8
/* backlight */
#define BACKLIGHT_PIN B7
#define BACKLIGHT_LEVELS 3
/* matrix pins */
#define MATRIX_ROW_PINS { B4, E2, F4, F7, F1, F6, C6, F5, D7, C7 }
#define MATRIX_COL_PINS { E6, B0, B1, B2, B3, F0, D0, D5 }
#define UNUSED_PINS
/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

View File

@ -0,0 +1,78 @@
{
"keyboard_name": "GON NerD 60",
"url": "",
"maintainer": "qmk",
"width": 15,
"height": 5,
"layouts": {
"LAYOUT_60": {
"key_count": 64,
"layout": [
{"label":"K80", "x":0, "y":0},
{"label":"K10", "x":1, "y":0},
{"label":"K01", "x":2, "y":0},
{"label":"K11", "x":3, "y":0},
{"label":"K02", "x":4, "y":0},
{"label":"K12", "x":5, "y":0},
{"label":"K03", "x":6, "y":0},
{"label":"K13", "x":7, "y":0},
{"label":"K04", "x":8, "y":0},
{"label":"K14", "x":9, "y":0},
{"label":"K05", "x":10, "y":0},
{"label":"K15", "x":11, "y":0},
{"label":"K06", "x":12, "y":0},
{"label":"K16", "x":13, "y":0, "w":2},
{"label":"K20", "x":0, "y":1, "w":1.5},
{"label":"K30", "x":1.5, "y":1},
{"label":"K21", "x":2.5, "y":1},
{"label":"K31", "x":3.5, "y":1},
{"label":"K22", "x":4.5, "y":1},
{"label":"K32", "x":5.5, "y":1},
{"label":"K23", "x":6.5, "y":1},
{"label":"K33", "x":7.5, "y":1},
{"label":"K24", "x":8.5, "y":1},
{"label":"K34", "x":9.5, "y":1},
{"label":"K25", "x":10.5, "y":1},
{"label":"K35", "x":11.5, "y":1},
{"label":"K26", "x":12.5, "y":1},
{"label":"K36", "x":13.5, "y":1, "w":1.5},
{"label":"K40", "x":0, "y":2, "w":1.75},
{"label":"K41", "x":1.75, "y":2},
{"label":"K51", "x":2.75, "y":2},
{"label":"K42", "x":3.75, "y":2},
{"label":"K52", "x":4.75, "y":2},
{"label":"K43", "x":5.75, "y":2},
{"label":"K53", "x":6.75, "y":2},
{"label":"K44", "x":7.75, "y":2},
{"label":"K54", "x":8.75, "y":2},
{"label":"K45", "x":9.75, "y":2},
{"label":"K55", "x":10.75, "y":2},
{"label":"K46", "x":11.75, "y":2},
{"label":"K17", "x":12.75, "y":2},
{"label":"K56", "x":13.75, "y":2, "w":1.25},
{"label":"K70", "x":0, "y":3, "w":1.25},
{"label":"K97", "x":1.25, "y":3},
{"label":"K61", "x":2.25, "y":3},
{"label":"K71", "x":3.25, "y":3},
{"label":"K62", "x":4.25, "y":3},
{"label":"K72", "x":5.25, "y":3},
{"label":"K63", "x":6.25, "y":3},
{"label":"K73", "x":7.25, "y":3},
{"label":"K64", "x":8.25, "y":3},
{"label":"K74", "x":9.25, "y":3},
{"label":"K65", "x":10.25, "y":3},
{"label":"K75", "x":11.25, "y":3},
{"label":"K66", "x":12.25, "y":3, "w":1.75},
{"label":"K76", "x":14, "y":3},
{"label":"K60", "x":0, "y":4, "w":1.25},
{"label":"K50", "x":1.25, "y":4, "w":1.25},
{"label":"K87", "x":2.5, "y":4, "w":1.25},
{"label":"K07", "x":3.75, "y":4, "w":6.25},
{"label":"K27", "x":10, "y":4, "w":1.25},
{"label":"K37", "x":11.25, "y":4, "w":1.25},
{"label":"K47", "x":12.5, "y":4, "w":1.25},
{"label":"K57", "x":13.75, "y":4, "w":1.25}
]
}
}
}

View File

@ -0,0 +1,20 @@
#include QMK_KEYBOARD_H
// Keymap layers
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_60( /* Base */
KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(1),
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, KC_RGUI, MO(1), KC_RCTL
),
[1] = LAYOUT_60( /* System layer to have access to RESET button */
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
_______, _______, _______, _______, _______, _______, _______, KC_PGUP, KC_UP, KC_PGDN, KC_PSCR, KC_SLCK, KC_PAUS, _______,
_______, _______, _______, _______, _______, _______, KC_HOME, KC_LEFT, KC_DOWN, KC_RGHT, KC_INS, KC_DEL, _______, _______,
_______, _______, KC_APP, _______, _______, _______, _______, KC_END, _______, _______, _______, _______, _______, _______,
RESET, _______, _______, _______, _______, _______, _______, _______
),
};

View File

@ -0,0 +1,3 @@
# The default keymap for GON NerD 60
![keymap](https://raw.githubusercontent.com/noroadsleft/qmk_images/master/keyboards/gon/nerd60/keymaps/default/keymap.png)

View File

@ -1,18 +1,20 @@
# Build Options # Build Options
# change to "no" to disable the options, or define them in the Makefile in # change yes to no to disable
# the appropriate keymap folder that will get included automatically
# #
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = yes # Commands for debug and configuration COMMAND_ENABLE = yes # Commands for debug and configuration
NKRO_ENABLE = yes # Nkey Rollover - if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work # Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
MIDI_ENABLE = no # MIDI controls RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output on port C6 MIDI_ENABLE = no # MIDI support
UNICODE_ENABLE = no # Unicode UNICODE_ENABLE = no # Unicode
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight. AUDIO_ENABLE = no # Audio output on port C6
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend FAUXCLICKY_ENABLE = no # Use buzzer to emulate clicky switches
HD44780_ENABLE = no # Enable support for HD44780 based LCDs

Some files were not shown because too many files have changed in this diff Show More