[work_queue] Configure stack size and priority via KConfig (#25406)

This commit is contained in:
Niklas Hauser
2025-08-12 22:54:35 +01:00
committed by GitHub
parent f161a32c55
commit 5f5984b9b8
3 changed files with 354 additions and 35 deletions
@@ -34,6 +34,7 @@
#pragma once
#include <stdint.h>
#include <px4_boardconfig.h>
namespace px4
{
@@ -48,52 +49,55 @@ struct wq_config_t {
namespace wq_configurations
{
static constexpr wq_config_t rate_ctrl{"wq:rate_ctrl", 3150, 0}; // PX4 inner loop highest priority
// All values are now configured via KConfig options.
// The CONFIG_ macros are generated by the build system.
static constexpr wq_config_t rate_ctrl{"wq:rate_ctrl", CONFIG_WQ_RATE_CTRL_STACKSIZE, (int8_t)CONFIG_WQ_RATE_CTRL_PRIORITY};
static constexpr wq_config_t SPI0{"wq:SPI0", 2392, -1};
static constexpr wq_config_t SPI1{"wq:SPI1", 2392, -2};
static constexpr wq_config_t SPI2{"wq:SPI2", 2392, -3};
static constexpr wq_config_t SPI3{"wq:SPI3", 2392, -4};
static constexpr wq_config_t SPI4{"wq:SPI4", 2392, -5};
static constexpr wq_config_t SPI5{"wq:SPI5", 2392, -6};
static constexpr wq_config_t SPI6{"wq:SPI6", 2392, -7};
static constexpr wq_config_t SPI0{"wq:SPI0", CONFIG_WQ_SPI_STACKSIZE, (int8_t)CONFIG_WQ_SPI0_PRIORITY};
static constexpr wq_config_t SPI1{"wq:SPI1", CONFIG_WQ_SPI_STACKSIZE, (int8_t)CONFIG_WQ_SPI1_PRIORITY};
static constexpr wq_config_t SPI2{"wq:SPI2", CONFIG_WQ_SPI_STACKSIZE, (int8_t)CONFIG_WQ_SPI2_PRIORITY};
static constexpr wq_config_t SPI3{"wq:SPI3", CONFIG_WQ_SPI_STACKSIZE, (int8_t)CONFIG_WQ_SPI3_PRIORITY};
static constexpr wq_config_t SPI4{"wq:SPI4", CONFIG_WQ_SPI_STACKSIZE, (int8_t)CONFIG_WQ_SPI4_PRIORITY};
static constexpr wq_config_t SPI5{"wq:SPI5", CONFIG_WQ_SPI_STACKSIZE, (int8_t)CONFIG_WQ_SPI5_PRIORITY};
static constexpr wq_config_t SPI6{"wq:SPI6", CONFIG_WQ_SPI_STACKSIZE, (int8_t)CONFIG_WQ_SPI6_PRIORITY};
static constexpr wq_config_t I2C0{"wq:I2C0", 2336, -8};
static constexpr wq_config_t I2C1{"wq:I2C1", 2336, -9};
static constexpr wq_config_t I2C2{"wq:I2C2", 2336, -10};
static constexpr wq_config_t I2C3{"wq:I2C3", 2336, -11};
static constexpr wq_config_t I2C4{"wq:I2C4", 2336, -12};
static constexpr wq_config_t I2C0{"wq:I2C0", CONFIG_WQ_I2C_STACKSIZE, (int8_t)CONFIG_WQ_I2C0_PRIORITY};
static constexpr wq_config_t I2C1{"wq:I2C1", CONFIG_WQ_I2C_STACKSIZE, (int8_t)CONFIG_WQ_I2C1_PRIORITY};
static constexpr wq_config_t I2C2{"wq:I2C2", CONFIG_WQ_I2C_STACKSIZE, (int8_t)CONFIG_WQ_I2C2_PRIORITY};
static constexpr wq_config_t I2C3{"wq:I2C3", CONFIG_WQ_I2C_STACKSIZE, (int8_t)CONFIG_WQ_I2C3_PRIORITY};
static constexpr wq_config_t I2C4{"wq:I2C4", CONFIG_WQ_I2C_STACKSIZE, (int8_t)CONFIG_WQ_I2C4_PRIORITY};
// PX4 att/pos controllers, highest priority after sensors.
static constexpr wq_config_t nav_and_controllers{"wq:nav_and_controllers", 2240, -13};
static constexpr wq_config_t nav_and_controllers{"wq:nav_and_controllers", CONFIG_WQ_NAV_AND_CONTROLLERS_STACKSIZE, (int8_t)CONFIG_WQ_NAV_AND_CONTROLLERS_PRIORITY};
static constexpr wq_config_t INS0{"wq:INS0", 6000, -14};
static constexpr wq_config_t INS1{"wq:INS1", 6000, -15};
static constexpr wq_config_t INS2{"wq:INS2", 6000, -16};
static constexpr wq_config_t INS3{"wq:INS3", 6000, -17};
static constexpr wq_config_t INS0{"wq:INS0", CONFIG_WQ_INS_STACKSIZE, (int8_t)CONFIG_WQ_INS0_PRIORITY};
static constexpr wq_config_t INS1{"wq:INS1", CONFIG_WQ_INS_STACKSIZE, (int8_t)CONFIG_WQ_INS1_PRIORITY};
static constexpr wq_config_t INS2{"wq:INS2", CONFIG_WQ_INS_STACKSIZE, (int8_t)CONFIG_WQ_INS2_PRIORITY};
static constexpr wq_config_t INS3{"wq:INS3", CONFIG_WQ_INS_STACKSIZE, (int8_t)CONFIG_WQ_INS3_PRIORITY};
static constexpr wq_config_t hp_default{"wq:hp_default", 2800, -18};
static constexpr wq_config_t hp_default{"wq:hp_default", CONFIG_WQ_HP_DEFAULT_STACKSIZE, (int8_t)CONFIG_WQ_HP_DEFAULT_PRIORITY};
static constexpr wq_config_t uavcan{"wq:uavcan", 3624, -19};
static constexpr wq_config_t uavcan{"wq:uavcan", CONFIG_WQ_UAVCAN_STACKSIZE, (int8_t)CONFIG_WQ_UAVCAN_PRIORITY};
static constexpr wq_config_t ttyS0{"wq:ttyS0", 1728, -21};
static constexpr wq_config_t ttyS1{"wq:ttyS1", 1728, -22};
static constexpr wq_config_t ttyS2{"wq:ttyS2", 1728, -23};
static constexpr wq_config_t ttyS3{"wq:ttyS3", 1728, -24};
static constexpr wq_config_t ttyS4{"wq:ttyS4", 1728, -25};
static constexpr wq_config_t ttyS5{"wq:ttyS5", 1728, -26};
static constexpr wq_config_t ttyS6{"wq:ttyS6", 1728, -27};
static constexpr wq_config_t ttyS7{"wq:ttyS7", 1728, -28};
static constexpr wq_config_t ttyS8{"wq:ttyS8", 1728, -29};
static constexpr wq_config_t ttyS9{"wq:ttyS9", 1728, -30};
static constexpr wq_config_t ttyACM0{"wq:ttyACM0", 1728, -31};
static constexpr wq_config_t ttyUnknown{"wq:ttyUnknown", 1728, -32};
static constexpr wq_config_t ttyS0{"wq:ttyS0", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S0_PRIORITY};
static constexpr wq_config_t ttyS1{"wq:ttyS1", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S1_PRIORITY};
static constexpr wq_config_t ttyS2{"wq:ttyS2", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S2_PRIORITY};
static constexpr wq_config_t ttyS3{"wq:ttyS3", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S3_PRIORITY};
static constexpr wq_config_t ttyS4{"wq:ttyS4", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S4_PRIORITY};
static constexpr wq_config_t ttyS5{"wq:ttyS5", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S5_PRIORITY};
static constexpr wq_config_t ttyS6{"wq:ttyS6", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S6_PRIORITY};
static constexpr wq_config_t ttyS7{"wq:ttyS7", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S7_PRIORITY};
static constexpr wq_config_t ttyS8{"wq:ttyS8", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S8_PRIORITY};
static constexpr wq_config_t ttyS9{"wq:ttyS9", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_S9_PRIORITY};
static constexpr wq_config_t ttyACM0{"wq:ttyACM0", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_ACM0_PRIORITY};
static constexpr wq_config_t ttyUnknown{"wq:ttyUnknown", CONFIG_WQ_TTY_STACKSIZE, (int8_t)CONFIG_WQ_TTY_UNKNOWN_PRIORITY};
static constexpr wq_config_t lp_default{"wq:lp_default", 3500, -50};
static constexpr wq_config_t lp_default{"wq:lp_default", CONFIG_WQ_LP_DEFAULT_STACKSIZE, (int8_t)CONFIG_WQ_LP_DEFAULT_PRIORITY};
static constexpr wq_config_t test1{"wq:test1", 2000, 0};
static constexpr wq_config_t test2{"wq:test2", 2000, 0};
} // namespace wq_configurations
/**