From f23670b728189b4549091d355e38218b31c0a0ad Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 21 Aug 2011 13:19:48 +0000 Subject: Added I-class function checks to HAL APIs. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3244 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/adc.c | 6 ++++-- os/hal/src/gpt.c | 10 ++++++++++ os/hal/src/icu.c | 4 ++++ os/hal/src/serial.c | 2 ++ os/hal/src/uart.c | 10 ++++++---- os/hal/src/usb.c | 22 ++++++++++++++++++++++ 6 files changed, 48 insertions(+), 6 deletions(-) (limited to 'os/hal/src') diff --git a/os/hal/src/adc.c b/os/hal/src/adc.c index 4843ca90b..f2bf4eadd 100644 --- a/os/hal/src/adc.c +++ b/os/hal/src/adc.c @@ -176,13 +176,14 @@ void adcStartConversionI(ADCDriver *adcp, adcsample_t *samples, size_t depth) { + chDbgCheckClassI(); chDbgCheck((adcp != NULL) && (grpp != NULL) && (samples != NULL) && ((depth == 1) || ((depth & 1) == 0)), "adcStartConversionI"); - chDbgAssert((adcp->state == ADC_READY) || (adcp->state == ADC_COMPLETE), "adcStartConversionI(), #1", "not ready"); + adcp->samples = samples; adcp->depth = depth; adcp->grpp = grpp; @@ -229,12 +230,13 @@ void adcStopConversion(ADCDriver *adcp) { */ void adcStopConversionI(ADCDriver *adcp) { + chDbgCheckClassI(); chDbgCheck(adcp != NULL, "adcStopConversionI"); - chDbgAssert((adcp->state == ADC_READY) || (adcp->state == ADC_ACTIVE) || (adcp->state == ADC_COMPLETE), "adcStopConversionI(), #1", "invalid state"); + if (adcp->state != ADC_READY) { adc_lld_stop_conversion(adcp); adcp->grpp = NULL; diff --git a/os/hal/src/gpt.c b/os/hal/src/gpt.c index e90a8911a..5f424453d 100644 --- a/os/hal/src/gpt.c +++ b/os/hal/src/gpt.c @@ -137,8 +137,11 @@ void gptStartContinuous(GPTDriver *gptp, gptcnt_t interval) { */ void gptStartContinuousI(GPTDriver *gptp, gptcnt_t interval) { + chDbgCheckClassI(); + chDbgCheck(gptp != NULL, "gptStartContinuousI"); chDbgAssert(gptp->state == GPT_READY, "gptStartContinuousI(), #1", "invalid state"); + gptp->state = GPT_CONTINUOUS; gpt_lld_start_timer(gptp, interval); } @@ -168,8 +171,11 @@ void gptStartOneShot(GPTDriver *gptp, gptcnt_t interval) { */ void gptStartOneShotI(GPTDriver *gptp, gptcnt_t interval) { + chDbgCheckClassI(); + chDbgCheck(gptp != NULL, "gptStartOneShotI"); chDbgAssert(gptp->state == GPT_READY, "gptStartOneShotI(), #1", "invalid state"); + gptp->state = GPT_ONESHOT; gpt_lld_start_timer(gptp, interval); } @@ -197,9 +203,12 @@ void gptStopTimer(GPTDriver *gptp) { */ void gptStopTimerI(GPTDriver *gptp) { + chDbgCheckClassI(); + chDbgCheck(gptp != NULL, "gptStopTimerI"); chDbgAssert((gptp->state == GPT_READY) || (gptp->state == GPT_CONTINUOUS) || (gptp->state == GPT_ONESHOT), "gptStopTimerI(), #1", "invalid state"); + gptp->state = GPT_READY; gpt_lld_stop_timer(gptp); } @@ -220,6 +229,7 @@ void gptPolledDelay(GPTDriver *gptp, gptcnt_t interval) { chDbgAssert(gptp->state == GPT_READY, "gptPolledDelay(), #1", "invalid state"); + gptp->state = GPT_ONESHOT; gpt_lld_polled_delay(gptp, interval); } diff --git a/os/hal/src/icu.c b/os/hal/src/icu.c index 3be67448e..79d38798e 100644 --- a/os/hal/src/icu.c +++ b/os/hal/src/icu.c @@ -121,6 +121,8 @@ void icuStop(ICUDriver *icup) { */ void icuEnable(ICUDriver *icup) { + chDbgCheck(icup != NULL, "icuEnable"); + chSysLock(); chDbgAssert(icup->state == ICU_READY, "icuEnable(), #1", "invalid state"); icu_lld_enable(icup); @@ -137,6 +139,8 @@ void icuEnable(ICUDriver *icup) { */ void icuDisable(ICUDriver *icup) { + chDbgCheck(icup != NULL, "icuDisable"); + chSysLock(); chDbgAssert((icup->state == ICU_READY) || (icup->state == ICU_WAITING) || (icup->state == ICU_ACTIVE) || (icup->state == ICU_IDLE), diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c index 414689aac..03b74be54 100644 --- a/os/hal/src/serial.c +++ b/os/hal/src/serial.c @@ -207,6 +207,7 @@ void sdStop(SerialDriver *sdp) { */ void sdIncomingDataI(SerialDriver *sdp, uint8_t b) { + chDbgCheckClassI(); chDbgCheck(sdp != NULL, "sdIncomingDataI"); if (chIQIsEmptyI(&sdp->iqueue)) @@ -233,6 +234,7 @@ void sdIncomingDataI(SerialDriver *sdp, uint8_t b) { msg_t sdRequestDataI(SerialDriver *sdp) { msg_t b; + chDbgCheckClassI(); chDbgCheck(sdp != NULL, "sdRequestDataI"); b = chOQGetI(&sdp->oqueue); diff --git a/os/hal/src/uart.c b/os/hal/src/uart.c index 05fdbb168..372a3ad02 100644 --- a/os/hal/src/uart.c +++ b/os/hal/src/uart.c @@ -161,12 +161,13 @@ void uartStartSend(UARTDriver *uartp, size_t n, const void *txbuf) { */ void uartStartSendI(UARTDriver *uartp, size_t n, const void *txbuf) { + chDbgCheckClassI(); chDbgCheck((uartp != NULL) && (n > 0) && (txbuf != NULL), "uartStartSendI"); - chDbgAssert((uartp->state == UART_READY) && (uartp->txstate != UART_TX_ACTIVE), "uartStartSendI(), #1", "not active"); + uart_lld_start_send(uartp, n, txbuf); uartp->txstate = UART_TX_ACTIVE; } @@ -216,8 +217,8 @@ size_t uartStopSend(UARTDriver *uartp) { */ size_t uartStopSendI(UARTDriver *uartp) { + chDbgCheckClassI(); chDbgCheck(uartp != NULL, "uartStopSendI"); - chDbgAssert(uartp->state == UART_READY, "uartStopSendI(), #1", "not active"); if (uartp->txstate == UART_TX_ACTIVE) { @@ -267,9 +268,9 @@ void uartStartReceive(UARTDriver *uartp, size_t n, void *rxbuf) { */ void uartStartReceiveI(UARTDriver *uartp, size_t n, void *rxbuf) { + chDbgCheckClassI(); chDbgCheck((uartp != NULL) && (n > 0) && (rxbuf != NULL), "uartStartReceiveI"); - chDbgAssert((uartp->state == UART_READY) && (uartp->rxstate == UART_RX_IDLE), "uartStartReceiveI(), #1", "not active"); @@ -322,8 +323,9 @@ size_t uartStopReceive(UARTDriver *uartp) { * @iclass */ size_t uartStopReceiveI(UARTDriver *uartp) { - chDbgCheck(uartp != NULL, "uartStopReceiveI"); + chDbgCheckClassI(); + chDbgCheck(uartp != NULL, "uartStopReceiveI"); chDbgAssert(uartp->state == UART_READY, "uartStopReceiveI(), #1", "not active"); diff --git a/os/hal/src/usb.c b/os/hal/src/usb.c index 484590f3b..8493b6f41 100644 --- a/os/hal/src/usb.c +++ b/os/hal/src/usb.c @@ -301,6 +301,8 @@ void usbStop(USBDriver *usbp) { void usbInitEndpointI(USBDriver *usbp, usbep_t ep, const USBEndpointConfig *epcp) { + chDbgCheckClassI(); + chDbgCheck((usbp != NULL) && (epcp != NULL), "usbInitEndpointI"); chDbgAssert(usbp->state == USB_ACTIVE, "usbEnableEndpointI(), #1", "invalid state"); chDbgAssert(usbp->epc[ep] != NULL, @@ -331,6 +333,8 @@ void usbInitEndpointI(USBDriver *usbp, usbep_t ep, void usbDisableEndpointsI(USBDriver *usbp) { unsigned i; + chDbgCheckClassI(); + chDbgCheck(usbp != NULL, "usbDisableEndpointsI"); chDbgAssert(usbp->state == USB_SELECTED, "usbDisableEndpointsI(), #1", "invalid state"); @@ -364,6 +368,9 @@ void usbDisableEndpointsI(USBDriver *usbp) { size_t usbReadPacketI(USBDriver *usbp, usbep_t ep, uint8_t *buf, size_t n) { + chDbgCheckClassI(); + chDbgCheck((usbp != NULL) && (buf != NULL), "usbReadPacketI"); + if (usbGetReceiveStatusI(usbp, ep)) return USB_ENDPOINT_BUSY; @@ -391,6 +398,9 @@ size_t usbReadPacketI(USBDriver *usbp, usbep_t ep, size_t usbWritePacketI(USBDriver *usbp, usbep_t ep, const uint8_t *buf, size_t n) { + chDbgCheckClassI(); + chDbgCheck((usbp != NULL) && (buf != NULL), "usbWritePacketI"); + if (usbGetTransmitStatusI(usbp, ep)) return USB_ENDPOINT_BUSY; @@ -419,6 +429,9 @@ size_t usbWritePacketI(USBDriver *usbp, usbep_t ep, bool_t usbStartReceiveI(USBDriver *usbp, usbep_t ep, uint8_t *buf, size_t n) { + chDbgCheckClassI(); + chDbgCheck((usbp != NULL) && (buf != NULL), "usbStartReceiveI"); + if (usbGetReceiveStatusI(usbp, ep)) return TRUE; @@ -447,6 +460,9 @@ bool_t usbStartReceiveI(USBDriver *usbp, usbep_t ep, bool_t usbStartTransmitI(USBDriver *usbp, usbep_t ep, const uint8_t *buf, size_t n) { + chDbgCheckClassI(); + chDbgCheck((usbp != NULL) && (buf != NULL), "usbStartTransmitI"); + if (usbGetTransmitStatusI(usbp, ep)) return TRUE; @@ -468,6 +484,9 @@ bool_t usbStartTransmitI(USBDriver *usbp, usbep_t ep, */ bool_t usbStallReceiveI(USBDriver *usbp, usbep_t ep) { + chDbgCheckClassI(); + chDbgCheck(usbp != NULL, "usbStallReceiveI"); + if (usbGetReceiveStatusI(usbp, ep)) return TRUE; @@ -488,6 +507,9 @@ bool_t usbStallReceiveI(USBDriver *usbp, usbep_t ep) { */ bool_t usbStallTransmitI(USBDriver *usbp, usbep_t ep) { + chDbgCheckClassI(); + chDbgCheck(usbp != NULL, "usbStallTransmitI"); + if (usbGetTransmitStatusI(usbp, ep)) return TRUE; -- cgit v1.2.3 From 718dc5084f7719f91eaacfc99e8c7de654eb2ad8 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 23 Aug 2011 13:36:25 +0000 Subject: HAL documentation improvements. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3252 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/sdc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'os/hal/src') diff --git a/os/hal/src/sdc.c b/os/hal/src/sdc.c index 59d7db005..6bdaa2b5a 100644 --- a/os/hal/src/sdc.c +++ b/os/hal/src/sdc.c @@ -54,7 +54,7 @@ * * @notapi */ -bool_t sdc_wait_for_transfer_state(SDCDriver *sdcp) { +bool_t _sdc_wait_for_transfer_state(SDCDriver *sdcp) { uint32_t resp[1]; while (TRUE) { @@ -314,7 +314,7 @@ bool_t sdcDisconnect(SDCDriver *sdcp) { chSysUnlock(); /* Waits for eventual pending operations completion.*/ - if (sdc_wait_for_transfer_state(sdcp)) + if (_sdc_wait_for_transfer_state(sdcp)) return TRUE; /* Card clock stopped.*/ -- cgit v1.2.3 From fe0093f795b6c88db8f12e2f7e45e11355fc3340 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Fri, 26 Aug 2011 13:47:22 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3254 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/adc.c | 4 ++++ os/hal/src/can.c | 4 ++++ os/hal/src/gpt.c | 4 ++++ os/hal/src/hal.c | 4 ++++ os/hal/src/i2c.c | 4 ++++ os/hal/src/icu.c | 4 ++++ os/hal/src/mac.c | 4 ++++ os/hal/src/mmc_spi.c | 4 ++++ os/hal/src/pal.c | 4 ++++ os/hal/src/pwm.c | 4 ++++ os/hal/src/sdc.c | 4 ++++ os/hal/src/serial.c | 4 ++++ os/hal/src/serial_usb.c | 4 ++++ os/hal/src/spi.c | 4 ++++ os/hal/src/uart.c | 4 ++++ os/hal/src/usb.c | 4 ++++ 16 files changed, 64 insertions(+) (limited to 'os/hal/src') diff --git a/os/hal/src/adc.c b/os/hal/src/adc.c index f2bf4eadd..c375818a6 100644 --- a/os/hal/src/adc.c +++ b/os/hal/src/adc.c @@ -31,6 +31,10 @@ #if HAL_USE_ADC || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/can.c b/os/hal/src/can.c index f9a827c4e..e888c2ae7 100644 --- a/os/hal/src/can.c +++ b/os/hal/src/can.c @@ -31,6 +31,10 @@ #if HAL_USE_CAN || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/gpt.c b/os/hal/src/gpt.c index 5f424453d..c677f5284 100644 --- a/os/hal/src/gpt.c +++ b/os/hal/src/gpt.c @@ -31,6 +31,10 @@ #if HAL_USE_GPT || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/hal.c b/os/hal/src/hal.c index 1a15988f5..ef7d7af8b 100644 --- a/os/hal/src/hal.c +++ b/os/hal/src/hal.c @@ -29,6 +29,10 @@ #include "ch.h" #include "hal.h" +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/i2c.c b/os/hal/src/i2c.c index 86bfc16f6..260dcbb17 100644 --- a/os/hal/src/i2c.c +++ b/os/hal/src/i2c.c @@ -31,6 +31,10 @@ #if HAL_USE_I2C || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/icu.c b/os/hal/src/icu.c index 79d38798e..c73ea5106 100644 --- a/os/hal/src/icu.c +++ b/os/hal/src/icu.c @@ -31,6 +31,10 @@ #if HAL_USE_ICU || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/mac.c b/os/hal/src/mac.c index 4d6a9b2cd..0f1c47576 100644 --- a/os/hal/src/mac.c +++ b/os/hal/src/mac.c @@ -33,6 +33,10 @@ #if HAL_USE_MAC || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/mmc_spi.c b/os/hal/src/mmc_spi.c index e6dcf9287..34d111c2d 100644 --- a/os/hal/src/mmc_spi.c +++ b/os/hal/src/mmc_spi.c @@ -31,6 +31,10 @@ #if HAL_USE_MMC_SPI || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/pal.c b/os/hal/src/pal.c index 10e57e284..afb5c6b40 100644 --- a/os/hal/src/pal.c +++ b/os/hal/src/pal.c @@ -31,6 +31,10 @@ #if HAL_USE_PAL || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/pwm.c b/os/hal/src/pwm.c index e7dd6b64c..588b3df5c 100644 --- a/os/hal/src/pwm.c +++ b/os/hal/src/pwm.c @@ -31,6 +31,10 @@ #if HAL_USE_PWM || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/sdc.c b/os/hal/src/sdc.c index 6bdaa2b5a..758edf8d8 100644 --- a/os/hal/src/sdc.c +++ b/os/hal/src/sdc.c @@ -31,6 +31,10 @@ #if HAL_USE_SDC || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c index 03b74be54..d962bcdcd 100644 --- a/os/hal/src/serial.c +++ b/os/hal/src/serial.c @@ -31,6 +31,10 @@ #if HAL_USE_SERIAL || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/serial_usb.c b/os/hal/src/serial_usb.c index 3f53d7df0..d9c25ecdf 100644 --- a/os/hal/src/serial_usb.c +++ b/os/hal/src/serial_usb.c @@ -33,6 +33,10 @@ #if HAL_USE_SERIAL_USB || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/spi.c b/os/hal/src/spi.c index aaf0115eb..b91b44507 100644 --- a/os/hal/src/spi.c +++ b/os/hal/src/spi.c @@ -31,6 +31,10 @@ #if HAL_USE_SPI || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/uart.c b/os/hal/src/uart.c index 372a3ad02..ed28ecb3b 100644 --- a/os/hal/src/uart.c +++ b/os/hal/src/uart.c @@ -31,6 +31,10 @@ #if HAL_USE_UART || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ diff --git a/os/hal/src/usb.c b/os/hal/src/usb.c index 8493b6f41..44a772ab1 100644 --- a/os/hal/src/usb.c +++ b/os/hal/src/usb.c @@ -34,6 +34,10 @@ #if HAL_USE_USB || defined(__DOXYGEN__) +/*===========================================================================*/ +/* Driver local definitions. */ +/*===========================================================================*/ + /*===========================================================================*/ /* Driver exported variables. */ /*===========================================================================*/ -- cgit v1.2.3 From 339cbbd60e7c45bb21758cdfe264e8e1c78d4fd5 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 28 Aug 2011 12:55:02 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3260 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/serial_usb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'os/hal/src') diff --git a/os/hal/src/serial_usb.c b/os/hal/src/serial_usb.c index d9c25ecdf..237d8e027 100644 --- a/os/hal/src/serial_usb.c +++ b/os/hal/src/serial_usb.c @@ -124,7 +124,7 @@ static void inotify(GenericQueue *qp) { emptied, then a whole packet is loaded in the queue.*/ if (chIQIsEmptyI(&sdup->iqueue)) { - n = usbReadPacketI(sdup->config->usbp, DATA_AVAILABLE_EP, + n = usbReadPacketI(sdup->config->usbp, USB_CDC_DATA_AVAILABLE_EP, sdup->iqueue.q_buffer, SERIAL_USB_BUFFERS_SIZE); if (n != USB_ENDPOINT_BUSY) { chIOAddFlagsI(sdup, IO_INPUT_AVAILABLE); @@ -146,7 +146,7 @@ static void onotify(GenericQueue *qp) { /* If there is any data in the output queue then it is sent within a single packet and the queue is emptied.*/ n = chOQGetFullI(&sdup->oqueue); - w = usbWritePacketI(sdup->config->usbp, DATA_REQUEST_EP, + w = usbWritePacketI(sdup->config->usbp, USB_CDC_DATA_REQUEST_EP, sdup->oqueue.q_buffer, n); if (w != USB_ENDPOINT_BUSY) { chIOAddFlagsI(sdup, IO_OUTPUT_EMPTY); @@ -211,10 +211,10 @@ void sduStart(SerialUSBDriver *sdup, const SerialUSBConfig *config) { "sduStart(), #1", "invalid state"); sdup->config = config; - usbStart(config->usbp, &config->usb_config); config->usbp->param = sdup; sdup->state = SDU_READY; chSysUnlock(); + usbStart(config->usbp, &config->usb_config); } /** -- cgit v1.2.3 From 76f8d18aaf60c6d916a799ba3d8b09815da979b2 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sun, 28 Aug 2011 12:57:21 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3261 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/src/serial_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'os/hal/src') diff --git a/os/hal/src/serial_usb.c b/os/hal/src/serial_usb.c index 237d8e027..16822502a 100644 --- a/os/hal/src/serial_usb.c +++ b/os/hal/src/serial_usb.c @@ -234,9 +234,9 @@ void sduStop(SerialUSBDriver *sdup) { chDbgAssert((sdup->state == SDU_STOP) || (sdup->state == SDU_READY), "sduStop(), #1", "invalid state"); - usbStop(sdup->config->usbp); sdup->state = SDU_STOP; chSysUnlock(); + usbStop(sdup->config->usbp); } /** -- cgit v1.2.3