diff options
Diffstat (limited to 'os')
30 files changed, 144 insertions, 212 deletions
diff --git a/os/hal/osal/chibios/osal.c b/os/hal/osal/chibios/osal.c index 8b0398538..65912ce7e 100644 --- a/os/hal/osal/chibios/osal.c +++ b/os/hal/osal/chibios/osal.c @@ -96,7 +96,7 @@ void osalSysHalt(const char *reason) { */
msg_t osalThreadSuspendS(thread_reference_t *trp) {
- chDbgAssert(*trp == NULL, "osalThreadSuspendS(), #1", "not NULL");
+ chDbgAssert(*trp == NULL, "not NULL");
*trp = (thread_reference_t)chThdSelf();
chSchGoSleepS(CH_STATE_SUSPENDED);
@@ -118,7 +118,7 @@ void osalThreadResumeI(thread_reference_t *trp, msg_t msg) { if (*trp != NULL) {
chDbgAssert((*trp)->p_state == CH_STATE_SUSPENDED,
- "osalThreadResumeI(), #1", "not THD_STATE_SUSPENDED");
+ "not THD_STATE_SUSPENDED");
(*trp)->p_u.rdymsg = msg;
chSchReadyI((thread_t *)*trp);
@@ -141,8 +141,7 @@ void osalThreadResumeS(thread_reference_t *trp, msg_t msg) { if (*trp != NULL) {
thread_t *tp = (thread_t *)*trp;
- chDbgAssert(tp->p_state == CH_STATE_SUSPENDED,
- "osalThreadResumeS(), #1", "not THD_STATE_SUSPENDED");
+ chDbgAssert(tp->p_state == CH_STATE_SUSPENDED, "not THD_STATE_SUSPENDED");
*trp = NULL;
chSchWakeupS(tp, msg);
diff --git a/os/hal/osal/chibios/osal.h b/os/hal/osal/chibios/osal.h index 726782d8b..fa48f3aa6 100644 --- a/os/hal/osal/chibios/osal.h +++ b/os/hal/osal/chibios/osal.h @@ -188,8 +188,8 @@ typedef struct { /**
* @brief Condition assertion.
- * @details If the condition check fails then the OSAL panics with the
- * specified message and halts.
+ * @details If the condition check fails then the OSAL panics with a
+ * message and halts.
* @note The condition is tested only if the @p OSAL_ENABLE_ASSERTIONS
* switch is enabled.
* @note The convention for the message is the following:<br>
@@ -198,12 +198,11 @@ typedef struct { * comment in the code about the assertion.
*
* @param[in] c the condition to be verified to be true
- * @param[in] msg the text message
* @param[in] remark a remark string
*
* @api
*/
-#define osalDbgAssert(c, msg, remark) chDbgAssert(c, msg, remark)
+#define osalDbgAssert(c, remark) chDbgAssert(c, remark)
/**
* @brief Function parameters check.
@@ -215,7 +214,7 @@ typedef struct { *
* @api
*/
-#define osalDbgCheck(c) chDbgCheck(c, __FUNCTION__)
+#define osalDbgCheck(c) chDbgCheck(c)
/**
* @brief I-Class state check.
diff --git a/os/hal/platforms/STM32/SPIv2/spi_lld.c b/os/hal/platforms/STM32/SPIv2/spi_lld.c index 712d824f6..3cbcc0fc0 100644 --- a/os/hal/platforms/STM32/SPIv2/spi_lld.c +++ b/os/hal/platforms/STM32/SPIv2/spi_lld.c @@ -221,12 +221,12 @@ void spi_lld_start(SPIDriver *spip) { STM32_SPI_SPI1_IRQ_PRIORITY,
(stm32_dmaisr_t)spi_lld_serve_rx_interrupt,
(void *)spip);
- osalDbgAssert(!b, "spi_lld_start(), #1", "stream already allocated");
+ osalDbgAssert(!b, "stream already allocated");
b = dmaStreamAllocate(spip->dmatx,
STM32_SPI_SPI1_IRQ_PRIORITY,
(stm32_dmaisr_t)spi_lld_serve_tx_interrupt,
(void *)spip);
- osalDbgAssert(!b, "spi_lld_start(), #2", "stream already allocated");
+ osalDbgAssert(!b, "stream already allocated");
rccEnableSPI1(FALSE);
}
#endif
@@ -237,12 +237,12 @@ void spi_lld_start(SPIDriver *spip) { STM32_SPI_SPI2_IRQ_PRIORITY,
(stm32_dmaisr_t)spi_lld_serve_rx_interrupt,
(void *)spip);
- osalDbgAssert(!b, "spi_lld_start(), #3", "stream already allocated");
+ osalDbgAssert(!b, "stream already allocated");
b = dmaStreamAllocate(spip->dmatx,
STM32_SPI_SPI2_IRQ_PRIORITY,
(stm32_dmaisr_t)spi_lld_serve_tx_interrupt,
(void *)spip);
- osalDbgAssert(!b, "spi_lld_start(), #4", "stream already allocated");
+ osalDbgAssert(!b, "stream already allocated");
rccEnableSPI2(FALSE);
}
#endif
@@ -253,12 +253,12 @@ void spi_lld_start(SPIDriver *spip) { STM32_SPI_SPI3_IRQ_PRIORITY,
(stm32_dmaisr_t)spi_lld_serve_rx_interrupt,
(void *)spip);
- osalDbgAssert(!b, "spi_lld_start(), #5", "stream already allocated");
+ osalDbgAssert(!b, "stream already allocated");
b = dmaStreamAllocate(spip->dmatx,
STM32_SPI_SPI3_IRQ_PRIORITY,
(stm32_dmaisr_t)spi_lld_serve_tx_interrupt,
(void *)spip);
- osalDbgAssert(!b, "spi_lld_start(), #6", "stream already allocated");
+ osalDbgAssert(!b, "stream already allocated");
rccEnableSPI3(FALSE);
}
#endif
diff --git a/os/hal/platforms/STM32/can_lld.c b/os/hal/platforms/STM32/can_lld.c index 2febf5bc9..a53a8fe27 100644 --- a/os/hal/platforms/STM32/can_lld.c +++ b/os/hal/platforms/STM32/can_lld.c @@ -404,8 +404,7 @@ void can_lld_start(CANDriver *canp) { #if STM32_CAN_USE_CAN2
if (&CAND2 == canp) {
- osalDbgAssert(CAND1.state != CAN_STOP,
- "can_lld_start(), #1", "CAN1 must be started");
+ osalDbgAssert(CAND1.state != CAN_STOP, "CAN1 must be started");
nvicEnableVector(STM32_CAN2_TX_NUMBER, STM32_CAN_CAN2_IRQ_PRIORITY);
nvicEnableVector(STM32_CAN2_RX0_NUMBER, STM32_CAN_CAN2_IRQ_PRIORITY);
@@ -447,8 +446,7 @@ void can_lld_stop(CANDriver *canp) { if (&CAND1 == canp) {
#if STM32_CAN_USE_CAN2
- osalDbgAssert(CAND2.state == CAN_STOP,
- "can_lld_stop(), #1", "CAN2 must be stopped");
+ osalDbgAssert(CAND2.state == CAN_STOP, "CAN2 must be stopped");
#endif
CAN1->MCR = 0x00010002; /* Register reset value. */
@@ -690,12 +688,10 @@ void canSTM32SetFilters(uint32_t can2sb, uint32_t num, const CANFilter *cfp) { (num < STM32_CAN_MAX_FILTERS));
#if STM32_CAN_USE_CAN1
- osalDbgAssert(CAND1.state == CAN_STOP,
- "canSTM32SetFilters(), #1", "invalid state");
+ osalDbgAssert(CAND1.state == CAN_STOP, "invalid state");
#endif
#if STM32_CAN_USE_CAN2
- osalDbgAssert(CAND2.state == CAN_STOP,
- "canSTM32SetFilters(), #2", "invalid state");
+ osalDbgAssert(CAND2.state == CAN_STOP, "invalid state");
#endif
can_lld_set_filters(can2sb, num, cfp);
diff --git a/os/hal/platforms/STM32/icu_lld.c b/os/hal/platforms/STM32/icu_lld.c index 149231aa3..73699c637 100644 --- a/os/hal/platforms/STM32/icu_lld.c +++ b/os/hal/platforms/STM32/icu_lld.c @@ -392,7 +392,7 @@ void icu_lld_start(ICUDriver *icup) { osalDbgAssert((icup->config->channel == ICU_CHANNEL_1) ||
(icup->config->channel == ICU_CHANNEL_2),
- "icu_lld_start(), #1", "invalid input");
+ "invalid input");
if (icup->state == ICU_STOP) {
/* Clock activation and timer reset.*/
@@ -469,7 +469,7 @@ void icu_lld_start(ICUDriver *icup) { psc = (icup->clock / icup->config->frequency) - 1;
osalDbgAssert((psc <= 0xFFFF) &&
((psc + 1) * icup->config->frequency) == icup->clock,
- "icu_lld_start(), #1", "invalid frequency");
+ "invalid frequency");
icup->tim->PSC = (uint16_t)psc;
icup->tim->ARR = 0xFFFF;
diff --git a/os/hal/platforms/STM32/pwm_lld.c b/os/hal/platforms/STM32/pwm_lld.c index a8850924f..c3109beee 100644 --- a/os/hal/platforms/STM32/pwm_lld.c +++ b/os/hal/platforms/STM32/pwm_lld.c @@ -488,9 +488,9 @@ void pwm_lld_start(PWMDriver *pwmp) { /* Timer configuration.*/
psc = (pwmp->clock / pwmp->config->frequency) - 1;
- chDbgAssert((psc <= 0xFFFF) &&
- ((psc + 1) * pwmp->config->frequency) == pwmp->clock,
- "pwm_lld_start(), #1", "invalid frequency");
+ osalDbgAssert((psc <= 0xFFFF) &&
+ ((psc + 1) * pwmp->config->frequency) == pwmp->clock,
+ "invalid frequency");
pwmp->tim->PSC = (uint16_t)psc;
pwmp->tim->ARR = (uint16_t)(pwmp->period - 1);
pwmp->tim->CR2 = pwmp->config->cr2;
diff --git a/os/hal/platforms/STM32F30x/adc_lld.c b/os/hal/platforms/STM32F30x/adc_lld.c index 768420c52..d516cf21b 100644 --- a/os/hal/platforms/STM32F30x/adc_lld.c +++ b/os/hal/platforms/STM32F30x/adc_lld.c @@ -147,14 +147,12 @@ static void adc_lld_analog_off(ADCDriver *adcp) { */
static void adc_lld_calibrate(ADCDriver *adcp) {
- osalDbgAssert(adcp->adcm->CR == ADC_CR_ADVREGEN_0, "adc_lld_calibrate(), #1",
- "invalid register state");
+ osalDbgAssert(adcp->adcm->CR == ADC_CR_ADVREGEN_0, "invalid register state");
adcp->adcm->CR |= ADC_CR_ADCAL;
while ((adcp->adcm->CR & ADC_CR_ADCAL) != 0)
;
#if STM32_ADC_DUAL_MODE
- osalDbgAssert(adcp->adcs->CR == ADC_CR_ADVREGEN_0, "adc_lld_calibrate(), #2",
- "invalid register state");
+ osalDbgAssert(adcp->adcs->CR == ADC_CR_ADVREGEN_0, "invalid register state");
adcp->adcs->CR |= ADC_CR_ADCAL;
while ((adcp->adcs->CR & ADC_CR_ADCAL) != 0)
;
@@ -377,7 +375,7 @@ void adc_lld_start(ADCDriver *adcp) { STM32_ADC_ADC12_DMA_IRQ_PRIORITY,
(stm32_dmaisr_t)adc_lld_serve_dma_interrupt,
(void *)adcp);
- osalDbgAssert(!b, "adc_lld_start(), #1", "stream already allocated");
+ osalDbgAssert(!b, "stream already allocated");
rccEnableADC12(FALSE);
}
#endif /* STM32_ADC_USE_ADC1 */
@@ -389,7 +387,7 @@ void adc_lld_start(ADCDriver *adcp) { STM32_ADC_ADC34_DMA_IRQ_PRIORITY,
(stm32_dmaisr_t)adc_lld_serve_dma_interrupt,
(void *)adcp);
- osalDbgAssert(!b, "adc_lld_start(), #2", "stream already allocated");
+ osalDbgAssert(!b, "stream already allocated");
rccEnableADC34(FALSE);
}
#endif /* STM32_ADC_USE_ADC2 */
@@ -459,7 +457,6 @@ void adc_lld_start_conversion(ADCDriver *adcp) { const ADCConversionGroup *grpp = adcp->grpp;
osalDbgAssert(!STM32_ADC_DUAL_MODE || ((grpp->num_channels & 1) == 0),
- "adc_lld_start_conversion(), #1",
"odd number of channels in dual mode");
/* Calculating control registers values.*/
diff --git a/os/hal/platforms/STM32F30x/stm32_dma.c b/os/hal/platforms/STM32F30x/stm32_dma.c index 430a9f667..eb73f1b37 100644 --- a/os/hal/platforms/STM32F30x/stm32_dma.c +++ b/os/hal/platforms/STM32F30x/stm32_dma.c @@ -427,7 +427,7 @@ void dmaStreamRelease(const stm32_dma_stream_t *dmastp) { /* Check if the streams is not taken.*/
osalDbgAssert((dma_streams_mask & (1 << dmastp->selfindex)) != 0,
- "dmaStreamRelease(), #1", "not allocated");
+ "not allocated");
/* Disables the associated IRQ vector.*/
nvicDisableVector(dmastp->vector);
diff --git a/os/hal/src/adc.c b/os/hal/src/adc.c index ccc11574a..e6d8d8075 100644 --- a/os/hal/src/adc.c +++ b/os/hal/src/adc.c @@ -102,7 +102,7 @@ void adcStart(ADCDriver *adcp, const ADCConfig *config) { osalSysLock();
osalDbgAssert((adcp->state == ADC_STOP) || (adcp->state == ADC_READY),
- "adcStart(), #1", "invalid state");
+ "invalid state");
adcp->config = config;
adc_lld_start(adcp);
adcp->state = ADC_READY;
@@ -122,7 +122,7 @@ void adcStop(ADCDriver *adcp) { osalSysLock();
osalDbgAssert((adcp->state == ADC_STOP) || (adcp->state == ADC_READY),
- "adcStop(), #1", "invalid state");
+ "invalid state");
adc_lld_stop(adcp);
adcp->state = ADC_STOP;
osalSysUnlock();
@@ -183,7 +183,7 @@ void adcStartConversionI(ADCDriver *adcp, osalDbgAssert((adcp->state == ADC_READY) ||
(adcp->state == ADC_COMPLETE) ||
(adcp->state == ADC_ERROR),
- "adcStartConversionI(), #1", "not ready");
+ "not ready");
adcp->samples = samples;
adcp->depth = depth;
@@ -207,9 +207,8 @@ void adcStopConversion(ADCDriver *adcp) { osalDbgCheck(adcp != NULL);
osalSysLock();
- osalDbgAssert((adcp->state == ADC_READY) ||
- (adcp->state == ADC_ACTIVE),
- "adcStopConversion(), #1", "invalid state");
+ osalDbgAssert((adcp->state == ADC_READY) || (adcp->state == ADC_ACTIVE),
+ "invalid state");
if (adcp->state != ADC_READY) {
adc_lld_stop_conversion(adcp);
adcp->grpp = NULL;
@@ -236,7 +235,7 @@ void adcStopConversionI(ADCDriver *adcp) { osalDbgAssert((adcp->state == ADC_READY) ||
(adcp->state == ADC_ACTIVE) ||
(adcp->state == ADC_COMPLETE),
- "adcStopConversionI(), #1", "invalid state");
+ "invalid state");
if (adcp->state != ADC_READY) {
adc_lld_stop_conversion(adcp);
@@ -277,7 +276,7 @@ msg_t adcConvert(ADCDriver *adcp, msg_t msg;
osalSysLock();
- osalDbgAssert(adcp->thread == NULL, "adcConvert(), #1", "already waiting");
+ osalDbgAssert(adcp->thread == NULL, "already waiting");
adcStartConversionI(adcp, grpp, samples, depth);
msg = osalThreadSuspendS(&adcp->thread);
osalSysUnlock();
diff --git a/os/hal/src/can.c b/os/hal/src/can.c index 9a352ddd1..ed5c43f87 100644 --- a/os/hal/src/can.c +++ b/os/hal/src/can.c @@ -104,7 +104,7 @@ void canStart(CANDriver *canp, const CANConfig *config) { osalDbgAssert((canp->state == CAN_STOP) ||
(canp->state == CAN_STARTING) ||
(canp->state == CAN_READY),
- "canStart(), #1", "invalid state");
+ "invalid state");
while (canp->state == CAN_STARTING)
osalThreadSleepS(1);
if (canp->state == CAN_STOP) {
@@ -128,7 +128,7 @@ void canStop(CANDriver *canp) { osalSysLock();
osalDbgAssert((canp->state == CAN_STOP) || (canp->state == CAN_READY),
- "canStop(), #1", "invalid state");
+ "invalid state");
can_lld_stop(canp);
canp->state = CAN_STOP;
osalQueueWakeupAllI(&canp->rxqueue, MSG_RESET);
@@ -168,7 +168,7 @@ msg_t canTransmit(CANDriver *canp, osalSysLock();
osalDbgAssert((canp->state == CAN_READY) || (canp->state == CAN_SLEEP),
- "canTransmit(), #1", "invalid state");
+ "invalid state");
while ((canp->state == CAN_SLEEP) || !can_lld_is_tx_empty(canp, mailbox)) {
msg_t msg = osalQueueGoSleepTimeoutS(&canp->txqueue, timeout);
if (msg != MSG_OK) {
@@ -213,7 +213,7 @@ msg_t canReceive(CANDriver *canp, osalSysLock();
osalDbgAssert((canp->state == CAN_READY) || (canp->state == CAN_SLEEP),
- "canReceive(), #1", "invalid state");
+ "invalid state");
while ((canp->state == CAN_SLEEP) || !can_lld_is_rx_nonempty(canp, mailbox)) {
msg_t msg = osalQueueGoSleepTimeoutS(&canp->rxqueue, timeout);
if (msg != MSG_OK) {
@@ -245,7 +245,7 @@ void canSleep(CANDriver *canp) { osalSysLock();
osalDbgAssert((canp->state == CAN_READY) || (canp->state == CAN_SLEEP),
- "canSleep(), #1", "invalid state");
+ "invalid state");
if (canp->state == CAN_READY) {
can_lld_sleep(canp);
canp->state = CAN_SLEEP;
@@ -268,7 +268,7 @@ void canWakeup(CANDriver *canp) { osalSysLock();
osalDbgAssert((canp->state == CAN_READY) || (canp->state == CAN_SLEEP),
- "canWakeup(), #1", "invalid state");
+ "invalid state");
if (canp->state == CAN_SLEEP) {
can_lld_wakeup(canp);
canp->state = CAN_READY;
diff --git a/os/hal/src/icu.c b/os/hal/src/icu.c index 401c0e04c..291b6df9a 100644 --- a/os/hal/src/icu.c +++ b/os/hal/src/icu.c @@ -89,7 +89,7 @@ void icuStart(ICUDriver *icup, const ICUConfig *config) { osalSysLock();
osalDbgAssert((icup->state == ICU_STOP) || (icup->state == ICU_READY),
- "icuStart(), #1", "invalid state");
+ "invalid state");
icup->config = config;
icu_lld_start(icup);
icup->state = ICU_READY;
@@ -109,7 +109,7 @@ void icuStop(ICUDriver *icup) { osalSysLock();
osalDbgAssert((icup->state == ICU_STOP) || (icup->state == ICU_READY),
- "icuStop(), #1", "invalid state");
+ "invalid state");
icu_lld_stop(icup);
icup->state = ICU_STOP;
osalSysUnlock();
@@ -127,7 +127,7 @@ void icuEnable(ICUDriver *icup) { osalDbgCheck(icup != NULL);
osalSysLock();
- osalDbgAssert(icup->state == ICU_READY, "icuEnable(), #1", "invalid state");
+ osalDbgAssert(icup->state == ICU_READY, "invalid state");
icu_lld_enable(icup);
icup->state = ICU_WAITING;
osalSysUnlock();
@@ -147,7 +147,7 @@ void icuDisable(ICUDriver *icup) { osalSysLock();
osalDbgAssert((icup->state == ICU_READY) || (icup->state == ICU_WAITING) ||
(icup->state == ICU_ACTIVE) || (icup->state == ICU_IDLE),
- "icuDisable(), #1", "invalid state");
+ "invalid state");
icu_lld_disable(icup);
icup->state = ICU_READY;
osalSysUnlock();
diff --git a/os/hal/src/pwm.c b/os/hal/src/pwm.c index bde512176..dfbe32df3 100644 --- a/os/hal/src/pwm.c +++ b/os/hal/src/pwm.c @@ -94,7 +94,7 @@ void pwmStart(PWMDriver *pwmp, const PWMConfig *config) { osalSysLock();
osalDbgAssert((pwmp->state == PWM_STOP) || (pwmp->state == PWM_READY),
- "pwmStart(), #1", "invalid state");
+ "invalid state");
pwmp->config = config;
pwmp->period = config->period;
pwm_lld_start(pwmp);
@@ -115,7 +115,7 @@ void pwmStop(PWMDriver *pwmp) { osalSysLock();
osalDbgAssert((pwmp->state == PWM_STOP) || (pwmp->state == PWM_READY),
- "pwmStop(), #1", "invalid state");
+ "invalid state");
pwm_lld_stop(pwmp);
pwmp->state = PWM_STOP;
osalSysUnlock();
@@ -141,8 +141,7 @@ void pwmChangePeriod(PWMDriver *pwmp, pwmcnt_t period) { osalDbgCheck(pwmp != NULL);
osalSysLock();
- osalDbgAssert(pwmp->state == PWM_READY,
- "pwmChangePeriod(), #1", "invalid state");
+ osalDbgAssert(pwmp->state == PWM_READY, "invalid state");
pwmChangePeriodI(pwmp, period);
osalSysUnlock();
}
@@ -168,8 +167,7 @@ void pwmEnableChannel(PWMDriver *pwmp, osalDbgCheck((pwmp != NULL) && (channel < PWM_CHANNELS));
osalSysLock();
- osalDbgAssert(pwmp->state == PWM_READY,
- "pwmEnableChannel(), #1", "not ready");
+ osalDbgAssert(pwmp->state == PWM_READY, "not ready");
pwm_lld_enable_channel(pwmp, channel, width);
osalSysUnlock();
}
@@ -193,8 +191,7 @@ void pwmDisableChannel(PWMDriver *pwmp, pwmchannel_t channel) { osalDbgCheck((pwmp != NULL) && (channel < PWM_CHANNELS));
osalSysLock();
- osalDbgAssert(pwmp->state == PWM_READY,
- "pwmDisableChannel(), #1", "not ready");
+ osalDbgAssert(pwmp->state == PWM_READY, "not ready");
pwm_lld_disable_channel(pwmp, channel);
osalSysUnlock();
}
diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c index 0b9d5b41d..4b1fd17d5 100644 --- a/os/hal/src/serial.c +++ b/os/hal/src/serial.c @@ -154,7 +154,7 @@ void sdStart(SerialDriver *sdp, const SerialConfig *config) { osalSysLock();
osalDbgAssert((sdp->state == SD_STOP) || (sdp->state == SD_READY),
- "sdStart(), #1", "invalid state");
+ "invalid state");
sd_lld_start(sdp, config);
sdp->state = SD_READY;
osalSysUnlock();
@@ -175,7 +175,7 @@ void sdStop(SerialDriver *sdp) { osalSysLock();
osalDbgAssert((sdp->state == SD_STOP) || (sdp->state == SD_READY),
- "sdStop(), #1", "invalid state");
+ "invalid state");
sd_lld_stop(sdp);
sdp->state = SD_STOP;
oqResetI(&sdp->oqueue);
diff --git a/os/hal/src/spi.c b/os/hal/src/spi.c index cd7124bd3..f47ed0527 100644 --- a/os/hal/src/spi.c +++ b/os/hal/src/spi.c @@ -98,7 +98,7 @@ void spiStart(SPIDriver *spip, const SPIConfig *config) { osalSysLock();
osalDbgAssert((spip->state == SPI_STOP) || (spip->state == SPI_READY),
- "spiStart(), #1", "invalid state");
+ "invalid state");
spip->config = config;
spi_lld_start(spip);
spip->state = SPI_READY;
@@ -120,7 +120,7 @@ void spiStop(SPIDriver *spip) { osalSysLock();
osalDbgAssert((spip->state == SPI_STOP) || (spip->state == SPI_READY),
- "spiStop(), #1", "invalid state");
+ "invalid state");
spi_lld_stop(spip);
spip->state = SPI_STOP;
osalSysUnlock();
@@ -138,7 +138,7 @@ void spiSelect(SPIDriver *spip) { osalDbgCheck(spip != NULL);
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY, "spiSelect(), #1", "not ready");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
spiSelectI(spip);
osalSysUnlock();
}
@@ -156,7 +156,7 @@ void spiUnselect(SPIDriver *spip) { osalDbgCheck(spip != NULL);
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY, "spiUnselect(), #1", "not ready");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
spiUnselectI(spip);
osalSysUnlock();
}
@@ -179,7 +179,7 @@ void spiStartIgnore(SPIDriver *spip, size_t n) { osalDbgCheck((spip != NULL) && (n > 0));
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY, "spiStartIgnore(), #1", "not ready");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
spiStartIgnoreI(spip, n);
osalSysUnlock();
}
@@ -207,8 +207,7 @@ void spiStartExchange(SPIDriver *spip, size_t n, osalDbgCheck((spip != NULL) && (n > 0) && (rxbuf != NULL) && (txbuf != NULL));
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY,
- "spiStartExchange(), #1", "not ready");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
spiStartExchangeI(spip, n, txbuf, rxbuf);
osalSysUnlock();
}
@@ -233,7 +232,7 @@ void spiStartSend(SPIDriver *spip, size_t n, const void *txbuf) { osalDbgCheck((spip != NULL) && (n > 0) && (txbuf != NULL));
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY, "spiStartSend(), #1", "not ready");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
spiStartSendI(spip, n, txbuf);
osalSysUnlock();
}
@@ -258,8 +257,7 @@ void spiStartReceive(SPIDriver *spip, size_t n, void *rxbuf) { osalDbgCheck((spip != NULL) && (n > 0) && (rxbuf != NULL));
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY,
- "spiStartReceive(), #1", "not ready");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
spiStartReceiveI(spip, n, rxbuf);
osalSysUnlock();
}
@@ -284,10 +282,8 @@ void spiIgnore(SPIDriver *spip, size_t n) { osalDbgCheck((spip != NULL) && (n > 0));
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY,
- "spiIgnore(), #1", "not ready");
- osalDbgAssert(spip->config->end_cb == NULL,
- "spiIgnore(), #2", "has callback");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
+ osalDbgAssert(spip->config->end_cb == NULL, "has callback");
spiStartIgnoreI(spip, n);
_spi_wait_s(spip);
osalSysUnlock();
@@ -318,9 +314,8 @@ void spiExchange(SPIDriver *spip, size_t n, (rxbuf != NULL) && (txbuf != NULL));
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY, "spiExchange(), #1", "not ready");
- osalDbgAssert(spip->config->end_cb == NULL,
- "spiExchange(), #2", "has callback");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
+ osalDbgAssert(spip->config->end_cb == NULL, "has callback");
spiStartExchangeI(spip, n, txbuf, rxbuf);
_spi_wait_s(spip);
osalSysUnlock();
@@ -347,10 +342,8 @@ void spiSend(SPIDriver *spip, size_t n, const void *txbuf) { osalDbgCheck((spip != NULL) && (n > 0) && (txbuf != NULL));
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY,
- "spiSend(), #1", "not ready");
- osalDbgAssert(spip->config->end_cb == NULL,
- "spiSend(), #2", "has callback");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
+ osalDbgAssert(spip->config->end_cb == NULL, "has callback");
spiStartSendI(spip, n, txbuf);
_spi_wait_s(spip);
osalSysUnlock();
@@ -377,10 +370,8 @@ void spiReceive(SPIDriver *spip, size_t n, void *rxbuf) { osalDbgCheck((spip != NULL) && (n > 0) && (rxbuf != NULL));
osalSysLock();
- osalDbgAssert(spip->state == SPI_READY,
- "spiReceive(), #1", "not ready");
- osalDbgAssert(spip->config->end_cb == NULL,
- "spiReceive(), #2", "has callback");
+ osalDbgAssert(spip->state == SPI_READY, "not ready");
+ osalDbgAssert(spip->config->end_cb == NULL, "has callback");
spiStartReceiveI(spip, n, rxbuf);
_spi_wait_s(spip);
osalSysUnlock();
diff --git a/os/kernel/include/chdebug.h b/os/kernel/include/chdebug.h index 0f4083c84..836645f07 100644 --- a/os/kernel/include/chdebug.h +++ b/os/kernel/include/chdebug.h @@ -177,49 +177,43 @@ typedef struct { * is specified in @p chconf.h else the macro does nothing.
*
* @param[in] c the condition to be verified to be true
- * @param[in] func the undecorated function name
*
* @api
*/
#if !defined(chDbgCheck)
-#define chDbgCheck(c, func) { \
+#define chDbgCheck(c) { \
if (!(c)) \
- chDbgPanic(__QUOTE_THIS(func)"()"); \
+ chDbgPanic("C:"__QUOTE_THIS(__FUNCTION__)":"__QUOTE_THIS(__LINE__)); \
}
#endif /* !defined(chDbgCheck) */
#else /* !CH_DBG_ENABLE_CHECKS */
-#define chDbgCheck(c, func) { \
- (void)(c), (void)__QUOTE_THIS(func)"()"; \
-}
+#define chDbgCheck(c) {(void)(c);}
#endif /* !CH_DBG_ENABLE_CHECKS */
#if CH_DBG_ENABLE_ASSERTS || defined(__DOXYGEN__)
/**
* @brief Condition assertion.
- * @details If the condition check fails then the kernel panics with the
- * specified message and halts.
+ * @details If the condition check fails then the kernel panics with a
+ * message and halts.
* @note The condition is tested only if the @p CH_DBG_ENABLE_ASSERTS switch
* is specified in @p chconf.h else the macro does nothing.
- * @note The convention for the message is the following:<br>
- * @<function_name@>(), #@<assert_number@>
* @note The remark string is not currently used except for putting a
* comment in the code about the assertion.
*
* @param[in] c the condition to be verified to be true
- * @param[in] m the text message
* @param[in] r a remark string
*
* @api
*/
#if !defined(chDbgAssert)
-#define chDbgAssert(c, m, r) { \
+#define chDbgAssert(c, r) { \
if (!(c)) \
- chDbgPanic(m); \
+ chDbgPanic("A:"__QUOTE_THIS(__FUNCTION__)":"__QUOTE_THIS(__LINE__)); \
}
#endif /* !defined(chDbgAssert) */
#else /* !CH_DBG_ENABLE_ASSERTS */
-#define chDbgAssert(c, m, r) {(void)(c);}
+#define chDbgAssert(c, r) {(void)(c);}
#endif /* !CH_DBG_ENABLE_ASSERTS */
/** @} */
diff --git a/os/kernel/ports/ARMCMx/devices/STM32F30x/systick.h b/os/kernel/ports/ARMCMx/devices/STM32F30x/systick.h index 3b143780d..bf73c1a37 100644 --- a/os/kernel/ports/ARMCMx/devices/STM32F30x/systick.h +++ b/os/kernel/ports/ARMCMx/devices/STM32F30x/systick.h @@ -80,9 +80,7 @@ static inline systime_t port_timer_get_time(void) { */
static inline void port_timer_start_alarm(systime_t time) {
- chDbgAssert((TIM2->DIER & 2) == 0,
- "port_timer_start_alarm(), #1",
- "already started");
+ chDbgAssert((TIM2->DIER & 2) == 0, "already started");
TIM2->CCR1 = time;
TIM2->SR = 0;
@@ -96,9 +94,7 @@ static inline void port_timer_start_alarm(systime_t time) { */
static inline void port_timer_stop_alarm(void) {
- chDbgAssert((TIM2->DIER & 2) != 0,
- "port_timer_stop_alarm(), #1",
- "not started");
+ chDbgAssert((TIM2->DIER & 2) != 0, "not started");
TIM2->DIER = 0;
}
@@ -112,9 +108,7 @@ static inline void port_timer_stop_alarm(void) { */
static inline void port_timer_set_alarm(systime_t time) {
- chDbgAssert((TIM2->DIER & 2) != 0,
- "port_timer_set_alarm(), #1",
- "not started");
+ chDbgAssert((TIM2->DIER & 2) != 0, "not started");
TIM2->CCR1 = time;
}
@@ -128,9 +122,7 @@ static inline void port_timer_set_alarm(systime_t time) { */
static inline systime_t port_timer_get_alarm(void) {
- chDbgAssert((TIM2->DIER & 2) != 0,
- "port_timer_get_alarm(), #1",
- "not started");
+ chDbgAssert((TIM2->DIER & 2) != 0, "not started");
return TIM2->CCR1;
}
diff --git a/os/kernel/src/chcond.c b/os/kernel/src/chcond.c index 49e1f891e..94fd8e81c 100644 --- a/os/kernel/src/chcond.c +++ b/os/kernel/src/chcond.c @@ -75,7 +75,7 @@ */
void chCondObjectInit(condition_variable_t *cp) {
- chDbgCheck(cp != NULL, "chCondInit");
+ chDbgCheck(cp != NULL);
queue_init(&cp->c_queue);
}
@@ -89,7 +89,7 @@ void chCondObjectInit(condition_variable_t *cp) { */
void chCondSignal(condition_variable_t *cp) {
- chDbgCheck(cp != NULL, "chCondSignal");
+ chDbgCheck(cp != NULL);
chSysLock();
if (queue_notempty(&cp->c_queue))
@@ -111,7 +111,7 @@ void chCondSignal(condition_variable_t *cp) { void chCondSignalI(condition_variable_t *cp) {
chDbgCheckClassI();
- chDbgCheck(cp != NULL, "chCondSignalI");
+ chDbgCheck(cp != NULL);
if (queue_notempty(&cp->c_queue))
chSchReadyI(queue_fifo_remove(&cp->c_queue))->p_u.rdymsg = RDY_OK;
@@ -146,7 +146,7 @@ void chCondBroadcast(condition_variable_t *cp) { void chCondBroadcastI(condition_variable_t *cp) {
chDbgCheckClassI();
- chDbgCheck(cp != NULL, "chCondBroadcastI");
+ chDbgCheck(cp != NULL);
/* Empties the condition variable queue and inserts all the threads into the
ready list in FIFO order. The wakeup message is set to @p RDY_RESET in
@@ -204,10 +204,8 @@ msg_t chCondWaitS(condition_variable_t *cp) { msg_t msg;
chDbgCheckClassS();
- chDbgCheck(cp != NULL, "chCondWaitS");
- chDbgAssert(ctp->p_mtxlist != NULL,
- "chCondWaitS(), #1",
- "not owning a mutex");
+ chDbgCheck(cp != NULL);
+ chDbgAssert(ctp->p_mtxlist != NULL, "not owning a mutex");
mp = chMtxUnlockS();
ctp->p_u.wtobjp = cp;
@@ -289,10 +287,8 @@ msg_t chCondWaitTimeoutS(condition_variable_t *cp, systime_t time) { msg_t msg;
chDbgCheckClassS();
- chDbgCheck((cp != NULL) && (time != TIME_IMMEDIATE), "chCondWaitTimeoutS");
- chDbgAssert(currp->p_mtxlist != NULL,
- "chCondWaitTimeoutS(), #1",
- "not owning a mutex");
+ chDbgCheck((cp != NULL) && (time != TIME_IMMEDIATE));
+ chDbgAssert(currp->p_mtxlist != NULL, "not owning a mutex");
mp = chMtxUnlockS();
currp->p_u.wtobjp = cp;
diff --git a/os/kernel/src/chdynamic.c b/os/kernel/src/chdynamic.c index 86e37df14..5f174eda7 100644 --- a/os/kernel/src/chdynamic.c +++ b/os/kernel/src/chdynamic.c @@ -69,7 +69,7 @@ thread_t *chThdAddRef(thread_t *tp) {
chSysLock();
- chDbgAssert(tp->p_refs < 255, "chThdAddRef(), #1", "too many references");
+ chDbgAssert(tp->p_refs < 255, "too many references");
tp->p_refs++;
chSysUnlock();
return tp;
@@ -92,7 +92,7 @@ void chThdRelease(thread_t *tp) { trefs_t refs;
chSysLock();
- chDbgAssert(tp->p_refs > 0, "chThdRelease(), #1", "not referenced");
+ chDbgAssert(tp->p_refs > 0, "not referenced");
refs = --tp->p_refs;
chSysUnlock();
@@ -198,7 +198,7 @@ thread_t *chThdCreateFromMemoryPool(memory_pool_t *mp, tprio_t prio, void *wsp;
thread_t *tp;
- chDbgCheck(mp != NULL, "chThdCreateFromMemoryPool");
+ chDbgCheck(mp != NULL);
wsp = chPoolAlloc(mp);
if (wsp == NULL)
diff --git a/os/kernel/src/chevents.c b/os/kernel/src/chevents.c index d95730f7c..04b0e6fb8 100644 --- a/os/kernel/src/chevents.c +++ b/os/kernel/src/chevents.c @@ -104,7 +104,7 @@ void chEvtRegisterMask(event_source_t *esp, event_listener_t *elp,
eventmask_t mask) {
- chDbgCheck((esp != NULL) && (elp != NULL), "chEvtRegisterMask");
+ chDbgCheck((esp != NULL) && (elp != NULL));
chSysLock();
elp->el_next = esp->es_next;
@@ -131,7 +131,7 @@ void chEvtRegisterMask(event_source_t *esp, void chEvtUnregister(event_source_t *esp, event_listener_t *elp) {
event_listener_t *p;
- chDbgCheck((esp != NULL) && (elp != NULL), "chEvtUnregister");
+ chDbgCheck((esp != NULL) && (elp != NULL));
p = (event_listener_t *)esp;
chSysLock();
@@ -205,7 +205,7 @@ void chEvtBroadcastFlagsI(event_source_t *esp, eventflags_t flags) { event_listener_t *elp;
chDbgCheckClassI();
- chDbgCheck(esp != NULL, "chEvtBroadcastMaskI");
+ chDbgCheck(esp != NULL);
elp = esp->es_next;
while (elp != (event_listener_t *)esp) {
@@ -248,7 +248,7 @@ eventflags_t chEvtGetAndClearFlags(event_listener_t *elp) { */
void chEvtSignal(thread_t *tp, eventmask_t mask) {
- chDbgCheck(tp != NULL, "chEvtSignal");
+ chDbgCheck(tp != NULL);
chSysLock();
chEvtSignalI(tp, mask);
@@ -271,7 +271,7 @@ void chEvtSignal(thread_t *tp, eventmask_t mask) { void chEvtSignalI(thread_t *tp, eventmask_t mask) {
chDbgCheckClassI();
- chDbgCheck(tp != NULL, "chEvtSignalI");
+ chDbgCheck(tp != NULL);
tp->p_epending |= mask;
/* Test on the AND/OR conditions wait states.*/
@@ -335,14 +335,12 @@ eventflags_t chEvtGetAndClearFlagsI(event_listener_t *elp) { void chEvtDispatch(const evhandler_t *handlers, eventmask_t mask) {
eventid_t eid;
- chDbgCheck(handlers != NULL, "chEvtDispatch");
+ chDbgCheck(handlers != NULL);
eid = 0;
while (mask) {
if (mask & EVENT_MASK(eid)) {
- chDbgAssert(handlers[eid] != NULL,
- "chEvtDispatch(), #1",
- "null handler");
+ chDbgAssert(handlers[eid] != NULL, "null handler");
mask &= ~EVENT_MASK(eid);
handlers[eid](eid);
}
diff --git a/os/kernel/src/chheap.c b/os/kernel/src/chheap.c index c2732376e..abda4ff10 100644 --- a/os/kernel/src/chheap.c +++ b/os/kernel/src/chheap.c @@ -108,7 +108,7 @@ void _heap_init(void) { void chHeapObjectInit(memory_heap_t *heapp, void *buf, size_t size) {
union heap_header *hp;
- chDbgCheck(MEM_IS_ALIGNED(buf) && MEM_IS_ALIGNED(size), "chHeapInit");
+ chDbgCheck(MEM_IS_ALIGNED(buf) && MEM_IS_ALIGNED(size));
heapp->h_provider = (memgetfunc_t)NULL;
heapp->h_free.h.u.next = hp = buf;
@@ -204,7 +204,7 @@ void chHeapFree(void *p) { union heap_header *qp, *hp;
memory_heap_t *heapp;
- chDbgCheck(p != NULL, "chHeapFree");
+ chDbgCheck(p != NULL);
hp = (union heap_header *)p - 1;
heapp = hp->h.u.heap;
@@ -212,9 +212,7 @@ void chHeapFree(void *p) { H_LOCK(heapp);
while (true) {
- chDbgAssert((hp < qp) || (hp >= LIMIT(qp)),
- "chHeapFree(), #1",
- "within free block");
+ chDbgAssert((hp < qp) || (hp >= LIMIT(qp)), "within free block");
if (((qp == &heapp->h_free) || (hp > qp)) &&
((qp->h.u.next == NULL) || (hp < qp->h.u.next))) {
diff --git a/os/kernel/src/chmboxes.c b/os/kernel/src/chmboxes.c index 2a6e6fae8..003c779ec 100644 --- a/os/kernel/src/chmboxes.c +++ b/os/kernel/src/chmboxes.c @@ -86,7 +86,7 @@ */
void chMBObjectInit(mailbox_t *mbp, msg_t *buf, cnt_t n) {
- chDbgCheck((mbp != NULL) && (buf != NULL) && (n > 0), "chMBInit");
+ chDbgCheck((mbp != NULL) && (buf != NULL) && (n > 0));
mbp->mb_buffer = mbp->mb_wrptr = mbp->mb_rdptr = buf;
mbp->mb_top = &buf[n];
@@ -105,7 +105,7 @@ void chMBObjectInit(mailbox_t *mbp, msg_t *buf, cnt_t n) { */
void chMBReset(mailbox_t *mbp) {
- chDbgCheck(mbp != NULL, "chMBReset");
+ chDbgCheck(mbp != NULL);
chSysLock();
mbp->mb_wrptr = mbp->mb_rdptr = mbp->mb_buffer;
@@ -166,7 +166,7 @@ msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t time) { msg_t rdymsg;
chDbgCheckClassS();
- chDbgCheck(mbp != NULL, "chMBPostS");
+ chDbgCheck(mbp != NULL);
rdymsg = chSemWaitTimeoutS(&mbp->mb_emptysem, time);
if (rdymsg == RDY_OK) {
@@ -196,7 +196,7 @@ msg_t chMBPostS(mailbox_t *mbp, msg_t msg, systime_t time) { msg_t chMBPostI(mailbox_t *mbp, msg_t msg) {
chDbgCheckClassI();
- chDbgCheck(mbp != NULL, "chMBPostI");
+ chDbgCheck(mbp != NULL);
if (chSemGetCounterI(&mbp->mb_emptysem) <= 0)
return RDY_TIMEOUT;
@@ -259,7 +259,7 @@ msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t time) { msg_t rdymsg;
chDbgCheckClassS();
- chDbgCheck(mbp != NULL, "chMBPostAheadS");
+ chDbgCheck(mbp != NULL);
rdymsg = chSemWaitTimeoutS(&mbp->mb_emptysem, time);
if (rdymsg == RDY_OK) {
@@ -289,7 +289,7 @@ msg_t chMBPostAheadS(mailbox_t *mbp, msg_t msg, systime_t time) { msg_t chMBPostAheadI(mailbox_t *mbp, msg_t msg) {
chDbgCheckClassI();
- chDbgCheck(mbp != NULL, "chMBPostAheadI");
+ chDbgCheck(mbp != NULL);
if (chSemGetCounterI(&mbp->mb_emptysem) <= 0)
return RDY_TIMEOUT;
@@ -352,7 +352,7 @@ msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t time) { msg_t rdymsg;
chDbgCheckClassS();
- chDbgCheck((mbp != NULL) && (msgp != NULL), "chMBFetchS");
+ chDbgCheck((mbp != NULL) && (msgp != NULL));
rdymsg = chSemWaitTimeoutS(&mbp->mb_fullsem, time);
if (rdymsg == RDY_OK) {
@@ -382,7 +382,7 @@ msg_t chMBFetchS(mailbox_t *mbp, msg_t *msgp, systime_t time) { msg_t chMBFetchI(mailbox_t *mbp, msg_t *msgp) {
chDbgCheckClassI();
- chDbgCheck((mbp != NULL) && (msgp != NULL), "chMBFetchI");
+ chDbgCheck((mbp != NULL) && (msgp != NULL));
if (chSemGetCounterI(&mbp->mb_fullsem) <= 0)
return RDY_TIMEOUT;
diff --git a/os/kernel/src/chmempools.c b/os/kernel/src/chmempools.c index 6d84b557e..d92ea7517 100644 --- a/os/kernel/src/chmempools.c +++ b/os/kernel/src/chmempools.c @@ -75,7 +75,7 @@ */
void chPoolObjectInit(memory_pool_t *mp, size_t size, memgetfunc_t provider) {
- chDbgCheck((mp != NULL) && (size >= sizeof(void *)), "chPoolInit");
+ chDbgCheck((mp != NULL) && (size >= sizeof(void *)));
mp->mp_next = NULL;
mp->mp_object_size = size;
@@ -97,7 +97,7 @@ void chPoolObjectInit(memory_pool_t *mp, size_t size, memgetfunc_t provider) { */
void chPoolLoadArray(memory_pool_t *mp, void *p, size_t n) {
- chDbgCheck((mp != NULL) && (n != 0), "chPoolLoadArray");
+ chDbgCheck((mp != NULL) && (n != 0));
while (n) {
chPoolAdd(mp, p);
@@ -120,7 +120,7 @@ void *chPoolAllocI(memory_pool_t *mp) { void *objp;
chDbgCheckClassI();
- chDbgCheck(mp != NULL, "chPoolAllocI");
+ chDbgCheck(mp != NULL);
if ((objp = mp->mp_next) != NULL)
mp->mp_next = mp->mp_next->ph_next;
@@ -164,7 +164,7 @@ void chPoolFreeI(memory_pool_t *mp, void *objp) { struct pool_header *php = objp;
chDbgCheckClassI();
- chDbgCheck((mp != NULL) && (objp != NULL), "chPoolFreeI");
+ chDbgCheck((mp != NULL) && (objp != NULL));
php->ph_next = mp->mp_next;
mp->mp_next = php;
diff --git a/os/kernel/src/chmsg.c b/os/kernel/src/chmsg.c index 1e99cce3f..335b46c61 100644 --- a/os/kernel/src/chmsg.c +++ b/os/kernel/src/chmsg.c @@ -88,7 +88,7 @@ msg_t chMsgSend(thread_t *tp, msg_t msg) {
thread_t *ctp = currp;
- chDbgCheck(tp != NULL, "chMsgSend");
+ chDbgCheck(tp != NULL);
chSysLock();
ctp->p_msg = msg;
@@ -141,8 +141,7 @@ thread_t *chMsgWait(void) { void chMsgRelease(thread_t *tp, msg_t msg) {
chSysLock();
- chDbgAssert(tp->p_state == CH_STATE_SNDMSG,
- "chMsgRelease(), #1", "invalid state");
+ chDbgAssert(tp->p_state == CH_STATE_SNDMSG, "invalid state");
chMsgReleaseS(tp, msg);
chSysUnlock();
}
diff --git a/os/kernel/src/chmtx.c b/os/kernel/src/chmtx.c index 5f7bdfb8d..0eb02e2b5 100644 --- a/os/kernel/src/chmtx.c +++ b/os/kernel/src/chmtx.c @@ -98,7 +98,7 @@ */
void chMtxObjectInit(mutex_t *mp) {
- chDbgCheck(mp != NULL, "chMtxInit");
+ chDbgCheck(mp != NULL);
queue_init(&mp->m_queue);
mp->m_owner = NULL;
@@ -135,7 +135,7 @@ void chMtxLockS(mutex_t *mp) { thread_t *ctp = currp;
chDbgCheckClassS();
- chDbgCheck(mp != NULL, "chMtxLockS");
+ chDbgCheck(mp != NULL);
/* Is the mutex already locked? */
if (mp->m_owner != NULL) {
@@ -194,8 +194,8 @@ void chMtxLockS(mutex_t *mp) { /* It is assumed that the thread performing the unlock operation assigns
the mutex to this thread.*/
- chDbgAssert(mp->m_owner == ctp, "chMtxLockS(), #1", "not owner");
- chDbgAssert(ctp->p_mtxlist == mp, "chMtxLockS(), #2", "not owned");
+ chDbgAssert(mp->m_owner == ctp, "not owner");
+ chDbgAssert(ctp->p_mtxlist == mp, "not owned");
}
else {
/* It was not owned, inserted in the owned mutexes list.*/
@@ -253,7 +253,7 @@ bool chMtxTryLock(mutex_t *mp) { bool chMtxTryLockS(mutex_t *mp) {
chDbgCheckClassS();
- chDbgCheck(mp != NULL, "chMtxTryLockS");
+ chDbgCheck(mp != NULL);
if (mp->m_owner != NULL)
return false;
@@ -280,12 +280,8 @@ mutex_t *chMtxUnlock(void) { chSysLock();
- chDbgAssert(ctp->p_mtxlist != NULL,
- "chMtxUnlock(), #1",
- "owned mutexes list empty");
- chDbgAssert(ctp->p_mtxlist->m_owner == ctp,
- "chMtxUnlock(), #2",
- "ownership failure");
+ chDbgAssert(ctp->p_mtxlist != NULL, "owned mutexes list empty");
+ chDbgAssert(ctp->p_mtxlist->m_owner == ctp, "ownership failure");
/* Removes the top mutex from the thread's owned mutexes list and marks it
as not owned.*/
@@ -344,12 +340,8 @@ mutex_t *chMtxUnlockS(void) { mutex_t *ump, *mp;
chDbgCheckClassS();
- chDbgAssert(ctp->p_mtxlist != NULL,
- "chMtxUnlockS(), #1",
- "owned mutexes list empty");
- chDbgAssert(ctp->p_mtxlist->m_owner == ctp,
- "chMtxUnlockS(), #2",
- "ownership failure");
+ chDbgAssert(ctp->p_mtxlist != NULL, "owned mutexes list empty");
+ chDbgAssert(ctp->p_mtxlist->m_owner == ctp, "ownership failure");
/* Removes the top mutex from the owned mutexes list and marks it as not
owned.*/
diff --git a/os/kernel/src/chqueues.c b/os/kernel/src/chqueues.c index 7cbc63f50..679d69337 100644 --- a/os/kernel/src/chqueues.c +++ b/os/kernel/src/chqueues.c @@ -245,7 +245,7 @@ size_t chIQReadTimeout(input_queue_t *iqp, uint8_t *bp, qnotify_t nfy = iqp->q_notify;
size_t r = 0;
- chDbgCheck(n > 0, "chIQReadTimeout");
+ chDbgCheck(n > 0);
chSysLock();
while (true) {
@@ -425,7 +425,7 @@ size_t chOQWriteTimeout(output_queue_t *oqp, const uint8_t *bp, qnotify_t nfy = oqp->q_notify;
size_t w = 0;
- chDbgCheck(n > 0, "chOQWriteTimeout");
+ chDbgCheck(n > 0);
chSysLock();
while (true) {
diff --git a/os/kernel/src/chregistry.c b/os/kernel/src/chregistry.c index b0d241fee..685d0c109 100644 --- a/os/kernel/src/chregistry.c +++ b/os/kernel/src/chregistry.c @@ -159,8 +159,7 @@ thread_t *chRegNextThread(thread_t *tp) { ntp = NULL;
#if CH_CFG_USE_DYNAMIC
else {
- chDbgAssert(ntp->p_refs < 255, "chRegNextThread(), #1",
- "too many references");
+ chDbgAssert(ntp->p_refs < 255, "too many references");
ntp->p_refs++;
}
#endif
diff --git a/os/kernel/src/chschd.c b/os/kernel/src/chschd.c index 53a14dac7..615008589 100644 --- a/os/kernel/src/chschd.c +++ b/os/kernel/src/chschd.c @@ -91,7 +91,6 @@ thread_t *chSchReadyI(thread_t *tp) { /* Integrity checks.*/
chDbgAssert((tp->p_state != CH_STATE_READY) &&
(tp->p_state != CH_STATE_FINAL),
- "chSchReadyI(), #1",
"invalid state");
tp->p_state = CH_STATE_READY;
diff --git a/os/kernel/src/chsem.c b/os/kernel/src/chsem.c index d25b93822..388e50bc6 100644 --- a/os/kernel/src/chsem.c +++ b/os/kernel/src/chsem.c @@ -98,7 +98,7 @@ */
void chSemObjectInit(semaphore_t *sp, cnt_t n) {
- chDbgCheck((sp != NULL) && (n >= 0), "chSemInit");
+ chDbgCheck((sp != NULL) && (n >= 0));
queue_init(&sp->s_queue);
sp->s_cnt = n;
@@ -150,10 +150,9 @@ void chSemResetI(semaphore_t *sp, cnt_t n) { cnt_t cnt;
chDbgCheckClassI();
- chDbgCheck((sp != NULL) && (n >= 0), "chSemResetI");
+ chDbgCheck((sp != NULL) && (n >= 0));
chDbgAssert(((sp->s_cnt >= 0) && queue_isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && queue_notempty(&sp->s_queue)),
- "chSemResetI(), #1",
"inconsistent semaphore");
cnt = sp->s_cnt;
@@ -198,10 +197,9 @@ msg_t chSemWait(semaphore_t *sp) { msg_t chSemWaitS(semaphore_t *sp) {
chDbgCheckClassS();
- chDbgCheck(sp != NULL, "chSemWaitS");
+ chDbgCheck(sp != NULL);
chDbgAssert(((sp->s_cnt >= 0) && queue_isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && queue_notempty(&sp->s_queue)),
- "chSemWaitS(), #1",
"inconsistent semaphore");
if (--sp->s_cnt < 0) {
@@ -263,10 +261,9 @@ msg_t chSemWaitTimeout(semaphore_t *sp, systime_t time) { msg_t chSemWaitTimeoutS(semaphore_t *sp, systime_t time) {
chDbgCheckClassS();
- chDbgCheck(sp != NULL, "chSemWaitTimeoutS");
+ chDbgCheck(sp != NULL);
chDbgAssert(((sp->s_cnt >= 0) && queue_isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && queue_notempty(&sp->s_queue)),
- "chSemWaitTimeoutS(), #1",
"inconsistent semaphore");
if (--sp->s_cnt < 0) {
@@ -290,10 +287,9 @@ msg_t chSemWaitTimeoutS(semaphore_t *sp, systime_t time) { */
void chSemSignal(semaphore_t *sp) {
- chDbgCheck(sp != NULL, "chSemSignal");
+ chDbgCheck(sp != NULL);
chDbgAssert(((sp->s_cnt >= 0) && queue_isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && queue_notempty(&sp->s_queue)),
- "chSemSignal(), #1",
"inconsistent semaphore");
chSysLock();
@@ -316,10 +312,9 @@ void chSemSignal(semaphore_t *sp) { void chSemSignalI(semaphore_t *sp) {
chDbgCheckClassI();
- chDbgCheck(sp != NULL, "chSemSignalI");
+ chDbgCheck(sp != NULL);
chDbgAssert(((sp->s_cnt >= 0) && queue_isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && queue_notempty(&sp->s_queue)),
- "chSemSignalI(), #1",
"inconsistent semaphore");
if (++sp->s_cnt <= 0) {
@@ -347,10 +342,9 @@ void chSemSignalI(semaphore_t *sp) { void chSemAddCounterI(semaphore_t *sp, cnt_t n) {
chDbgCheckClassI();
- chDbgCheck((sp != NULL) && (n > 0), "chSemAddCounterI");
+ chDbgCheck((sp != NULL) && (n > 0));
chDbgAssert(((sp->s_cnt >= 0) && queue_isempty(&sp->s_queue)) ||
((sp->s_cnt < 0) && queue_notempty(&sp->s_queue)),
- "chSemAddCounterI(), #1",
"inconsistent semaphore");
while (n > 0) {
@@ -376,14 +370,12 @@ void chSemAddCounterI(semaphore_t *sp, cnt_t n) { msg_t chSemSignalWait(semaphore_t *sps, semaphore_t *spw) {
msg_t msg;
- chDbgCheck((sps != NULL) && (spw != NULL), "chSemSignalWait");
+ chDbgCheck((sps != NULL) && (spw != NULL));
chDbgAssert(((sps->s_cnt >= 0) && queue_isempty(&sps->s_queue)) ||
((sps->s_cnt < 0) && queue_notempty(&sps->s_queue)),
- "chSemSignalWait(), #1",
"inconsistent semaphore");
chDbgAssert(((spw->s_cnt >= 0) && queue_isempty(&spw->s_queue)) ||
((spw->s_cnt < 0) && queue_notempty(&spw->s_queue)),
- "chSemSignalWait(), #2",
"inconsistent semaphore");
chSysLock();
diff --git a/os/kernel/src/chthreads.c b/os/kernel/src/chthreads.c index a18e82005..073b6eed7 100644 --- a/os/kernel/src/chthreads.c +++ b/os/kernel/src/chthreads.c @@ -183,8 +183,7 @@ thread_t *chThdCreateI(void *wsp, size_t size, chDbgCheckClassI();
chDbgCheck((wsp != NULL) && (size >= THD_WA_SIZE(0)) &&
- (prio <= HIGHPRIO) && (pf != NULL),
- "chThdCreateI");
+ (prio <= HIGHPRIO) && (pf != NULL));
SETUP_CONTEXT(wsp, size, pf, arg);
return _thread_init(tp, prio);
}
@@ -238,7 +237,7 @@ thread_t *chThdCreateStatic(void *wsp, size_t size, tprio_t chThdSetPriority(tprio_t newprio) {
tprio_t oldprio;
- chDbgCheck(newprio <= HIGHPRIO, "chThdSetPriority");
+ chDbgCheck(newprio <= HIGHPRIO);
chSysLock();
#if CH_CFG_USE_MUTEXES
@@ -272,7 +271,6 @@ thread_t *chThdResume(thread_t *tp) { chSysLock();
chDbgAssert(tp->p_state == CH_STATE_SUSPENDED,
- "chThdResume(), #1",
"thread not in CH_STATE_SUSPENDED state");
chSchWakeupS(tp, RDY_OK);
chSysUnlock();
@@ -312,7 +310,7 @@ void chThdTerminate(thread_t *tp) { */
void chThdSleep(systime_t time) {
- chDbgCheck(time != TIME_IMMEDIATE, "chThdSleep");
+ chDbgCheck(time != TIME_IMMEDIATE);
chSysLock();
chThdSleepS(time);
@@ -403,7 +401,7 @@ void chThdExitS(msg_t msg) { #endif
chSchGoSleepS(CH_STATE_FINAL);
/* The thread never returns here.*/
- chDbgAssert(false, "chThdExitS(), #1", "zombies apocalypse");
+ chDbgAssert(false, "zombies apocalypse");
}
#if CH_CFG_USE_WAITEXIT || defined(__DOXYGEN__)
@@ -441,12 +439,12 @@ void chThdExitS(msg_t msg) { msg_t chThdWait(thread_t *tp) {
msg_t msg;
- chDbgCheck(tp != NULL, "chThdWait");
+ chDbgCheck(tp != NULL);
chSysLock();
- chDbgAssert(tp != currp, "chThdWait(), #1", "waiting self");
+ chDbgAssert(tp != currp, "waiting self");
#if CH_CFG_USE_DYNAMIC
- chDbgAssert(tp->p_refs > 0, "chThdWait(), #2", "not referenced");
+ chDbgAssert(tp->p_refs > 0, "not referenced");
#endif
if (tp->p_state != CH_STATE_FINAL) {
list_insert(currp, &tp->p_waiting);
diff --git a/os/kernel/src/chvt.c b/os/kernel/src/chvt.c index 6fa4dd582..3f1559ac4 100644 --- a/os/kernel/src/chvt.c +++ b/os/kernel/src/chvt.c @@ -118,8 +118,7 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay, virtual_timer_t *p;
chDbgCheckClassI();
- chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (delay != TIME_IMMEDIATE),
- "chVTDoSetI");
+ chDbgCheck((vtp != NULL) && (vtfunc != NULL) && (delay != TIME_IMMEDIATE));
vtp->vt_par = par;
vtp->vt_func = vtfunc;
@@ -181,10 +180,8 @@ void chVTDoSetI(virtual_timer_t *vtp, systime_t delay, void chVTDoResetI(virtual_timer_t *vtp) {
chDbgCheckClassI();
- chDbgCheck(vtp != NULL, "chVTDoResetI");
- chDbgAssert(vtp->vt_func != NULL,
- "chVTDoResetI(), #1",
- "timer not set or already triggered");
+ chDbgCheck(vtp != NULL);
+ chDbgAssert(vtp->vt_func != NULL, "timer not set or already triggered");
/* Removing the element from the delta list.*/
vtp->vt_next->vt_delta += vtp->vt_delta;
|