aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
Diffstat (limited to 'os')
-rw-r--r--os/hal/include/adc.h6
-rw-r--r--os/hal/include/pwm.h7
-rw-r--r--os/hal/platforms/STM32/adc_lld.c10
-rw-r--r--os/hal/platforms/STM32/adc_lld.h26
-rw-r--r--os/hal/platforms/STM32/pwm_lld.c18
-rw-r--r--os/hal/platforms/STM32/pwm_lld.h20
-rw-r--r--os/hal/platforms/STM32/stm32_dma.c13
-rw-r--r--os/hal/platforms/STM32/uart_lld.h3
-rw-r--r--os/hal/src/adc.c14
-rw-r--r--os/hal/templates/adc_lld.h26
-rw-r--r--os/hal/templates/i2c_lld.h13
-rw-r--r--os/hal/templates/pwm_lld.h34
-rw-r--r--os/hal/templates/uart_lld.h13
-rw-r--r--os/kernel/include/chmboxes.h4
14 files changed, 131 insertions, 76 deletions
diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h
index 8a2af908e..7549ea515 100644
--- a/os/hal/include/adc.h
+++ b/os/hal/include/adc.h
@@ -88,13 +88,11 @@ extern "C" {
bool_t adcStartConversion(ADCDriver *adcp,
const ADCConversionGroup *grpp,
adcsample_t *samples,
- size_t depth,
- adccallback_t callback);
+ size_t depth);
bool_t adcStartConversionI(ADCDriver *adcp,
const ADCConversionGroup *grpp,
adcsample_t *samples,
- size_t depth,
- adccallback_t callback);
+ size_t depth);
void adcStopConversion(ADCDriver *adcp);
void adcStopConversionI(ADCDriver *adcp);
#if ADC_USE_WAIT
diff --git a/os/hal/include/pwm.h b/os/hal/include/pwm.h
index 12fe2b6ad..c0cea6c2b 100644
--- a/os/hal/include/pwm.h
+++ b/os/hal/include/pwm.h
@@ -65,13 +65,6 @@ typedef enum {
PWM_OUTPUT_ACTIVE_LOW = 2 /**< @brief Idle is logic level 1. */
} pwmmode_t;
-/**
- * @brief PWM notification callback type.
- *
- * @param[in] active current channel output state
- */
-typedef void (*pwmcallback_t)(void);
-
#include "pwm_lld.h"
/*===========================================================================*/
diff --git a/os/hal/platforms/STM32/adc_lld.c b/os/hal/platforms/STM32/adc_lld.c
index 7c7657a5c..c6db10346 100644
--- a/os/hal/platforms/STM32/adc_lld.c
+++ b/os/hal/platforms/STM32/adc_lld.c
@@ -66,9 +66,9 @@ CH_IRQ_HANDLER(DMA1_Ch1_IRQHandler) {
dmaClearChannel(STM32_DMA1, STM32_DMA_CHANNEL_1);
if ((isr & DMA_ISR_HTIF1) != 0) {
/* Half transfer processing.*/
- if (ADCD1.ad_callback != NULL) {
+ if (ADCD1.ad_grpp->acg_callback != NULL) {
/* Invokes the callback passing the 1st half of the buffer.*/
- ADCD1.ad_callback(ADCD1.ad_samples, ADCD1.ad_depth / 2);
+ ADCD1.ad_grpp->acg_callback(&ADCD1, ADCD1.ad_samples, ADCD1.ad_depth / 2);
}
}
if ((isr & DMA_ISR_TCIF1) != 0) {
@@ -85,15 +85,15 @@ CH_IRQ_HANDLER(DMA1_Ch1_IRQHandler) {
#endif
}
/* Callback handling.*/
- if (ADCD1.ad_callback != NULL) {
+ if (ADCD1.ad_grpp->acg_callback != NULL) {
if (ADCD1.ad_depth > 1) {
/* Invokes the callback passing the 2nd half of the buffer.*/
size_t half = ADCD1.ad_depth / 2;
- ADCD1.ad_callback(ADCD1.ad_samples + half, half);
+ ADCD1.ad_grpp->acg_callback(&ADCD1, ADCD1.ad_samples + half, half);
}
else {
/* Invokes the callback passing the whole buffer.*/
- ADCD1.ad_callback(ADCD1.ad_samples, ADCD1.ad_depth);
+ ADCD1.ad_grpp->acg_callback(&ADCD1, ADCD1.ad_samples, ADCD1.ad_depth);
}
}
}
diff --git a/os/hal/platforms/STM32/adc_lld.h b/os/hal/platforms/STM32/adc_lld.h
index 7fe219706..a72ce67f3 100644
--- a/os/hal/platforms/STM32/adc_lld.h
+++ b/os/hal/platforms/STM32/adc_lld.h
@@ -115,12 +115,19 @@ typedef uint16_t adcsample_t;
typedef uint16_t adc_channels_num_t;
/**
+ * @brief Type of a structure representing an ADC driver.
+ */
+typedef struct ADCDriver ADCDriver;
+
+/**
* @brief ADC notification callback type.
*
+ * @param[in] adcp pointer to the @p ADCDriver object triggering the
+ * callback
* @param[in] buffer pointer to the most recent samples data
* @param[in] n number of buffer rows available starting from @p buffer
*/
-typedef void (*adccallback_t)(adcsample_t *buffer, size_t n);
+typedef void (*adccallback_t)(ADCDriver *adcp, adcsample_t *buffer, size_t n);
/**
* @brief Conversion group configuration structure.
@@ -139,6 +146,10 @@ typedef struct {
* @brief Number of the analog channels belonging to the conversion group.
*/
adc_channels_num_t acg_num_channels;
+ /**
+ * @brief Callback function associated to the group or @p NULL.
+ */
+ adccallback_t acg_callback;
/* End of the mandatory fields.*/
/**
* @brief ADC CR1 register initialization data.
@@ -185,7 +196,7 @@ typedef struct {
/**
* @brief Structure representing an ADC driver.
*/
-typedef struct {
+struct ADCDriver {
/**
* @brief Driver state.
*/
@@ -195,10 +206,6 @@ typedef struct {
*/
const ADCConfig *ad_config;
/**
- * @brief Current callback function or @p NULL.
- */
- adccallback_t ad_callback;
- /**
* @brief Current samples buffer pointer or @p NULL.
*/
adcsample_t *ad_samples;
@@ -210,12 +217,15 @@ typedef struct {
* @brief Current conversion group pointer or @p NULL.
*/
const ADCConversionGroup *ad_grpp;
-#if ADC_USE_WAIT
+#if ADC_USE_WAIT || defined(__DOXYGEN__)
/**
* @brief Synchronization semaphore.
*/
Semaphore ad_sem;
#endif
+#if defined(ADC_DRIVER_EXT_FIELDS)
+ ADC_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
/**
* @brief Pointer to the ADCx registers block.
@@ -229,7 +239,7 @@ typedef struct {
* @brief DMA CCR register bit mask.
*/
uint32_t ad_dmaccr;
-} ADCDriver;
+};
/*===========================================================================*/
/* Driver macros. */
diff --git a/os/hal/platforms/STM32/pwm_lld.c b/os/hal/platforms/STM32/pwm_lld.c
index eeb1282bd..6355c0d34 100644
--- a/os/hal/platforms/STM32/pwm_lld.c
+++ b/os/hal/platforms/STM32/pwm_lld.c
@@ -106,13 +106,13 @@ static void serve_interrupt(PWMDriver *pwmp) {
pwmp->pd_tim->SR = ~(TIM_SR_CC1IF | TIM_SR_CC2IF | TIM_SR_CC3IF |
TIM_SR_CC4IF | TIM_SR_UIF);
if ((sr & TIM_SR_CC1IF) != 0)
- pwmp->pd_config->pc_channels[0].pcc_callback();
+ pwmp->pd_config->pc_channels[0].pcc_callback(pwmp);
if ((sr & TIM_SR_CC2IF) != 0)
- pwmp->pd_config->pc_channels[1].pcc_callback();
+ pwmp->pd_config->pc_channels[1].pcc_callback(pwmp);
if ((sr & TIM_SR_CC3IF) != 0)
- pwmp->pd_config->pc_channels[2].pcc_callback();
+ pwmp->pd_config->pc_channels[2].pcc_callback(pwmp);
if ((sr & TIM_SR_CC4IF) != 0)
- pwmp->pd_config->pc_channels[3].pcc_callback();
+ pwmp->pd_config->pc_channels[3].pcc_callback(pwmp);
if ((sr & TIM_SR_UIF) != 0)
pwmp->pd_config->pc_callback();
}
@@ -136,7 +136,7 @@ CH_IRQ_HANDLER(TIM1_UP_IRQHandler) {
CH_IRQ_PROLOGUE();
TIM1->SR = ~TIM_SR_UIF;
- PWMD1.pd_config->pc_callback();
+ PWMD1.pd_config->pc_callback(&PWMD1);
CH_IRQ_EPILOGUE();
}
@@ -157,13 +157,13 @@ CH_IRQ_HANDLER(TIM1_CC_IRQHandler) {
sr = TIM1->SR & TIM1->DIER;
TIM1->SR = ~(TIM_SR_CC1IF | TIM_SR_CC2IF | TIM_SR_CC3IF | TIM_SR_CC4IF);
if ((sr & TIM_SR_CC1IF) != 0)
- PWMD1.pd_config->pc_channels[0].pcc_callback();
+ PWMD1.pd_config->pc_channels[0].pcc_callback(&PWMD1);
if ((sr & TIM_SR_CC2IF) != 0)
- PWMD1.pd_config->pc_channels[1].pcc_callback();
+ PWMD1.pd_config->pc_channels[1].pcc_callback(&PWMD1);
if ((sr & TIM_SR_CC3IF) != 0)
- PWMD1.pd_config->pc_channels[2].pcc_callback();
+ PWMD1.pd_config->pc_channels[2].pcc_callback(&PWMD1);
if ((sr & TIM_SR_CC4IF) != 0)
- PWMD1.pd_config->pc_channels[3].pcc_callback();
+ PWMD1.pd_config->pc_channels[3].pcc_callback(&PWMD1);
CH_IRQ_EPILOGUE();
}
diff --git a/os/hal/platforms/STM32/pwm_lld.h b/os/hal/platforms/STM32/pwm_lld.h
index 79606654d..b86ab1a8f 100644
--- a/os/hal/platforms/STM32/pwm_lld.h
+++ b/os/hal/platforms/STM32/pwm_lld.h
@@ -136,6 +136,18 @@ typedef uint8_t pwmchannel_t;
typedef uint16_t pwmcnt_t;
/**
+ * @brief Type of a structure representing an PWM driver.
+ */
+typedef struct PWMDriver PWMDriver;
+
+/**
+ * @brief PWM notification callback type.
+ *
+ * @param[in] pwmp pointer to a @p PWMDriver object
+ */
+typedef void (*pwmcallback_t)(PWMDriver *pwmp);
+
+/**
* @brief PWM driver channel configuration structure.
* @note It could be empty on some architectures.
*/
@@ -155,7 +167,6 @@ typedef struct {
/**
* @brief PWM driver configuration structure.
- * @note It could be empty on some architectures.
*/
typedef struct {
/**
@@ -187,7 +198,7 @@ typedef struct {
/**
* @brief Structure representing a PWM driver.
*/
-typedef struct {
+struct PWMDriver {
/**
* @brief Driver state.
*/
@@ -196,6 +207,9 @@ typedef struct {
* @brief Current driver configuration data.
*/
const PWMConfig *pd_config;
+#if defined(PWM_DRIVER_EXT_FIELDS)
+ PWM_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
/**
* @brief Bit mask of the enabled channels.
@@ -205,7 +219,7 @@ typedef struct {
* @brief Pointer to the TIMx registers block.
*/
TIM_TypeDef *pd_tim;
-} PWMDriver;
+};
/*===========================================================================*/
/* Driver macros. */
diff --git a/os/hal/platforms/STM32/stm32_dma.c b/os/hal/platforms/STM32/stm32_dma.c
index 995e33a12..bcdcf0fb7 100644
--- a/os/hal/platforms/STM32/stm32_dma.c
+++ b/os/hal/platforms/STM32/stm32_dma.c
@@ -18,8 +18,9 @@
*/
/**
- * @file stm32_dma.c
- * @brief STM32 DMA helper driver code.
+ * @file stm32_dma.c
+ * @brief STM32 DMA helper driver code.
+ *
* @addtogroup STM32_DMA
* @{
*/
@@ -53,7 +54,7 @@ static cnt_t dmacnt2;
/*===========================================================================*/
/**
- * @brief STM32 DMA helper initialization.
+ * @brief STM32 DMA helper initialization.
*
* @init
*/
@@ -73,9 +74,9 @@ void dmaInit(void) {
}
/**
- * @brief Enables the specified DMA controller clock.
+ * @brief Enables the specified DMA controller clock.
*
- * @param[in] dma the DMA controller id
+ * @param[in] dma the DMA controller id
*
* @api
*/
@@ -102,7 +103,7 @@ void dmaEnable(uint32_t dma) {
/**
* @brief Disables the specified DMA controller clock.
*
- * @param[in] dma the DMA controller id
+ * @param[in] dma the DMA controller id
*
* @api
*/
diff --git a/os/hal/platforms/STM32/uart_lld.h b/os/hal/platforms/STM32/uart_lld.h
index d030c2970..7cac040ce 100644
--- a/os/hal/platforms/STM32/uart_lld.h
+++ b/os/hal/platforms/STM32/uart_lld.h
@@ -233,6 +233,9 @@ struct UARTDriver {
uartrxstate_t ud_rxstate;
/** @brief UART driver status flags.*/
uartflags_t ud_flags;
+#if defined(UART_DRIVER_EXT_FIELDS)
+ UART_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
/** @brief Pointer to the USART registers block.*/
USART_TypeDef *ud_usart;
diff --git a/os/hal/src/adc.c b/os/hal/src/adc.c
index 4983199ce..1d407d927 100644
--- a/os/hal/src/adc.c
+++ b/os/hal/src/adc.c
@@ -67,7 +67,6 @@ void adcObjectInit(ADCDriver *adcp) {
adcp->ad_state = ADC_STOP;
adcp->ad_config = NULL;
- adcp->ad_callback = NULL;
adcp->ad_samples = NULL;
adcp->ad_depth = 0;
adcp->ad_grpp = NULL;
@@ -142,8 +141,6 @@ void adcStop(ADCDriver *adcp) {
* @param[out] samples pointer to the samples buffer
* @param[in] depth buffer depth (matrix rows number). The buffer depth
* must be one or an even number.
- * @param[in] callback pointer to the conversion callback function, this
- * parameter can be @p NULL if a callback is not required
* @return The operation status.
* @retval FALSE the conversion has been started.
* @retval TRUE the driver is busy, conversion not started.
@@ -153,12 +150,11 @@ void adcStop(ADCDriver *adcp) {
bool_t adcStartConversion(ADCDriver *adcp,
const ADCConversionGroup *grpp,
adcsample_t *samples,
- size_t depth,
- adccallback_t callback) {
+ size_t depth) {
bool_t result;
chSysLock();
- result = adcStartConversionI(adcp, grpp, samples, depth, callback);
+ result = adcStartConversionI(adcp, grpp, samples, depth);
chSysUnlock();
return result;
}
@@ -187,8 +183,6 @@ bool_t adcStartConversion(ADCDriver *adcp,
* @param[out] samples pointer to the samples buffer
* @param[in] depth buffer depth (matrix rows number). The buffer depth
* must be one or an even number.
- * @param[in] callback pointer to the conversion callback function, this
- * parameter can be @p NULL if a callback is not required
* @return The operation status.
* @retval FALSE the conversion has been started.
* @retval TRUE the driver is busy, conversion not started.
@@ -198,8 +192,7 @@ bool_t adcStartConversion(ADCDriver *adcp,
bool_t adcStartConversionI(ADCDriver *adcp,
const ADCConversionGroup *grpp,
adcsample_t *samples,
- size_t depth,
- adccallback_t callback) {
+ size_t depth) {
chDbgCheck((adcp != NULL) && (grpp != NULL) && (samples != NULL) &&
((depth == 1) || ((depth & 1) == 0)),
@@ -212,7 +205,6 @@ bool_t adcStartConversionI(ADCDriver *adcp,
"invalid state");
if (adcp->ad_state == ADC_RUNNING)
return TRUE;
- adcp->ad_callback = callback;
adcp->ad_samples = samples;
adcp->ad_depth = depth;
adcp->ad_grpp = grpp;
diff --git a/os/hal/templates/adc_lld.h b/os/hal/templates/adc_lld.h
index 6486abb37..2b2e8dd58 100644
--- a/os/hal/templates/adc_lld.h
+++ b/os/hal/templates/adc_lld.h
@@ -61,12 +61,19 @@ typedef uint16_t adcsample_t;
typedef uint16_t adc_channels_num_t;
/**
+ * @brief Type of a structure representing an ADC driver.
+ */
+typedef struct ADCDriver ADCDriver;
+
+/**
* @brief ADC notification callback type.
*
+ * @param[in] adcp pointer to the @p ADCDriver object triggering the
+ * callback
* @param[in] buffer pointer to the most recent samples data
* @param[in] n number of buffer rows available starting from @p buffer
*/
-typedef void (*adccallback_t)(adcsample_t *buffer, size_t n);
+typedef void (*adccallback_t)(ADCDriver *adcp, adcsample_t *buffer, size_t n);
/**
* @brief Conversion group configuration structure.
@@ -84,6 +91,10 @@ typedef struct {
* @brief Number of the analog channels belonging to the conversion group.
*/
adc_channels_num_t acg_num_channels;
+ /**
+ * @brief Callback function associated to the group or @p NULL.
+ */
+ adccallback_t acg_callback;
/* End of the mandatory fields.*/
} ADCConversionGroup;
@@ -102,7 +113,7 @@ typedef struct {
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
*/
-typedef struct {
+struct ADCDriver {
/**
* @brief Driver state.
*/
@@ -112,10 +123,6 @@ typedef struct {
*/
const ADCConfig *ad_config;
/**
- * @brief Current callback function or @p NULL.
- */
- adccallback_t ad_callback;
- /**
* @brief Current samples buffer pointer or @p NULL.
*/
adcsample_t *ad_samples;
@@ -127,14 +134,17 @@ typedef struct {
* @brief Current conversion group pointer or @p NULL.
*/
const ADCConversionGroup *ad_grpp;
-#if ADC_USE_WAIT
+#if ADC_USE_WAIT || defined(__DOXYGEN__)
/**
* @brief Synchronization semaphore.
*/
Semaphore ad_sem;
#endif
+#if defined(ADC_DRIVER_EXT_FIELDS)
+ ADC_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
-} ADCDriver;
+};
/*===========================================================================*/
/* Driver macros. */
diff --git a/os/hal/templates/i2c_lld.h b/os/hal/templates/i2c_lld.h
index 77c67cc07..bf7a64082 100644
--- a/os/hal/templates/i2c_lld.h
+++ b/os/hal/templates/i2c_lld.h
@@ -46,6 +46,12 @@
/* Driver data structures and types. */
/*===========================================================================*/
+
+/**
+ * @brief Type of a structure representing an I2C driver.
+ */
+typedef struct I2CDriver I2CDriver;
+
/**
* @brief I2C completion callback type.
*
@@ -70,15 +76,18 @@ typedef struct {
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
*/
-typedef struct {
+struct I2CDriver {
/** @brief Driver state.*/
i2cstate_t id_state;
/** @brief Current configuration data.*/
const I2CConfig *id_config;
/** @brief Current callback.*/
i2ccallback_t id_callback;
+#if defined(I2C_DRIVER_EXT_FIELDS)
+ I2C_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
-} I2CDriver;
+};
/*===========================================================================*/
/* Driver macros. */
diff --git a/os/hal/templates/pwm_lld.h b/os/hal/templates/pwm_lld.h
index b74582d9d..6d499d791 100644
--- a/os/hal/templates/pwm_lld.h
+++ b/os/hal/templates/pwm_lld.h
@@ -62,13 +62,34 @@ typedef uint8_t pwmchannel_t;
typedef uint16_t pwmcnt_t;
/**
+ * @brief Type of a structure representing an PWM driver.
+ */
+typedef struct PWMDriver PWMDriver;
+
+/**
+ * @brief PWM notification callback type.
+ *
+ * @param[in] pwmp pointer to a @p PWMDriver object
+ */
+typedef void (*pwmcallback_t)(PWMDriver *pwmp);
+
+/**
* @brief Driver configuration structure.
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
- * @note It could be empty on some architectures.
*/
typedef struct {
-
+ /**
+ * @brief Periodic callback pointer.
+ * @note This callback is invoked on PWM counter reset. If set to
+ * @p NULL then the callback is disabled.
+ */
+ pwmcallback_t pc_callback;
+ /**
+ * @brief Channels configurations.
+ */
+ PWMChannelConfig pc_channels[PWM_CHANNELS];
+ /* End of the mandatory fields.*/
} PWMConfig;
/**
@@ -76,7 +97,7 @@ typedef struct {
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
*/
-typedef struct {
+struct PWMDriver {
/**
* @brief Driver state.
*/
@@ -85,8 +106,11 @@ typedef struct {
* @brief Current configuration data.
*/
const PWMConfig *pd_config;
+#if defined(PWM_DRIVER_EXT_FIELDS)
+ PWM_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
-} PWMDriver;
+};
/*===========================================================================*/
/* Driver macros. */
@@ -103,8 +127,6 @@ extern "C" {
void pwm_lld_start(PWMDriver *pwmp);
void pwm_lld_stop(PWMDriver *pwmp);
bool_t pwm_lld_is_enabled(PWMDriver *pwmp, pwmchannel_t channel);
- void pwm_lld_set_callback(PWMDriver *pwmp, pwmchannel_t channel,
- pwmedge_t edge, pwmcallback_t callback);
void pwm_lld_enable_channel(PWMDriver *pwmp,
pwmchannel_t channel,
pwmcnt_t width);
diff --git a/os/hal/templates/uart_lld.h b/os/hal/templates/uart_lld.h
index ba55d723b..4b80633dc 100644
--- a/os/hal/templates/uart_lld.h
+++ b/os/hal/templates/uart_lld.h
@@ -52,9 +52,7 @@
typedef uint32_t uartflags_t;
/**
- * @brief Structure representing an UART driver.
- * @note Implementations may extend this structure to contain more,
- * architecture dependent, fields.
+ * @brief Type of structure representing an UART driver.
*/
typedef struct UARTDriver UARTDriver;
@@ -68,7 +66,8 @@ typedef void (*uartcb_t)(UARTDriver *uartp);
/**
* @brief Character received UART notification callback type.
*
- * @param[in] uartp pointer to the @p UARTDriver object
+ * @param[in] uartp pointer to the @p UARTDriver object triggering the
+ * callback
* @param[in] c received character
*/
typedef void (*uartccb_t)(UARTDriver *uartp, uint16_t c);
@@ -76,7 +75,8 @@ typedef void (*uartccb_t)(UARTDriver *uartp, uint16_t c);
/**
* @brief Receive error UART notification callback type.
*
- * @param[in] uartp pointer to the @p UARTDriver object
+ * @param[in] uartp pointer to the @p UARTDriver object triggering the
+ * callback
* @param[in] e receive error mask
*/
typedef void (*uartecb_t)(UARTDriver *uartp, uartflags_t e);
@@ -122,6 +122,9 @@ struct UARTDriver {
* @brief Current configuration data.
*/
const UARTConfig *ud_config;
+#if defined(UART_DRIVER_EXT_FIELDS)
+ UART_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
};
diff --git a/os/kernel/include/chmboxes.h b/os/kernel/include/chmboxes.h
index 964952c23..608fcf91e 100644
--- a/os/kernel/include/chmboxes.h
+++ b/os/kernel/include/chmboxes.h
@@ -93,7 +93,7 @@ extern "C" {
#define chMBGetFreeCountI(mbp) chSemGetCounterI(&(mbp)->mb_emptysem)
/**
- * @brief Returns the number of queued messages into a mailbox.
+ * @brief Returns the number of used message slots into a mailbox.
* @note Can be invoked in any system state but if invoked out of a locked
* state then the returned value may change after reading.
* @note The returned value can be less than zero when there are waiting
@@ -104,7 +104,7 @@ extern "C" {
*
* @iclass
*/
-#define chMBGetFullCountI(mbp) chSemGetCounterI(&(mbp)->mb_fullsem)
+#define chMBGetUsedCountI(mbp) chSemGetCounterI(&(mbp)->mb_fullsem)
/**
* @brief Returns the next message in the queue without removing it.