aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2015-11-01 10:56:12 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2015-11-01 10:56:12 +0000
commitca59ce3238108443bf04729f717f9c37d3472937 (patch)
treece0ed5bac16f8ffa0164958f4067396c2c2e84cd
parent61509a21dee90992110a310734db5744a1c01b45 (diff)
downloadChibiOS-ca59ce3238108443bf04729f717f9c37d3472937.tar.gz
ChibiOS-ca59ce3238108443bf04729f717f9c37d3472937.tar.bz2
ChibiOS-ca59ce3238108443bf04729f717f9c37d3472937.zip
Fixed bug #659.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8415 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/include/serial.h26
-rw-r--r--os/hal/src/serial.c49
-rw-r--r--readme.txt2
-rw-r--r--testhal/STM32/STM32L1xx/DAC/debug/STM32L1xx-DAC (OpenOCD, Flash and Run).launch2
4 files changed, 54 insertions, 25 deletions
diff --git a/os/hal/include/serial.h b/os/hal/include/serial.h
index 23dc7efc6..de5c911c0 100644
--- a/os/hal/include/serial.h
+++ b/os/hal/include/serial.h
@@ -132,30 +132,6 @@ struct SerialDriver {
* @{
*/
/**
- * @brief Direct output check on a @p SerialDriver.
- * @note This function bypasses the indirect access to the channel and
- * checks directly the output queue. This is faster but cannot
- * be used to check different channels implementations.
- *
- * @deprecated
- *
- * @api
- */
-#define sdPutWouldBlock(sdp) oqIsFullI(&(sdp)->oqueue)
-
-/**
- * @brief Direct input check on a @p SerialDriver.
- * @note This function bypasses the indirect access to the channel and
- * checks directly the input queue. This is faster but cannot
- * be used to check different channels implementations.
- *
- * @deprecated
- *
- * @api
- */
-#define sdGetWouldBlock(sdp) iqIsEmptyI(&(sdp)->iqueue)
-
-/**
* @brief Direct write to a @p SerialDriver.
* @note This function bypasses the indirect access to the channel and
* writes directly on the output queue. This is faster but cannot
@@ -297,6 +273,8 @@ extern "C" {
void sdStop(SerialDriver *sdp);
void sdIncomingDataI(SerialDriver *sdp, uint8_t b);
msg_t sdRequestDataI(SerialDriver *sdp);
+ bool sdPutWouldBlock(SerialDriver *sdp);
+ bool sdGetWouldBlock(SerialDriver *sdp);
#ifdef __cplusplus
}
#endif
diff --git a/os/hal/src/serial.c b/os/hal/src/serial.c
index 4b3111412..609e5a348 100644
--- a/os/hal/src/serial.c
+++ b/os/hal/src/serial.c
@@ -234,6 +234,55 @@ msg_t sdRequestDataI(SerialDriver *sdp) {
return b;
}
+/**
+ * @brief Direct output check on a @p SerialDriver.
+ * @note This function bypasses the indirect access to the channel and
+ * checks directly the output queue. This is faster but cannot
+ * be used to check different channels implementations.
+ *
+ * @param[in] sdp pointer to a @p SerialDriver structure
+ * @return The queue status.
+ * @retval false if the next write operation would not block.
+ * @retval true if the next write operation would block.
+ *
+ * @deprecated
+ *
+ * @api
+ */
+bool sdPutWouldBlock(SerialDriver *sdp) {
+ bool b;
+
+ osalSysLock();
+ b = oqIsFullI(&sdp->oqueue);
+ osalSysUnlock();
+
+ return b;
+}
+
+/**
+ * @brief Direct input check on a @p SerialDriver.
+ * @note This function bypasses the indirect access to the channel and
+ * checks directly the input queue. This is faster but cannot
+ * be used to check different channels implementations.
+ *
+ * @return The queue status.
+ * @retval false if the next write operation would not block.
+ * @retval true if the next write operation would block.
+ *
+ * @deprecated
+ *
+ * @api
+ */
+bool sdGetWouldBlock(SerialDriver *sdp) {
+ bool b;
+
+ osalSysLock();
+ b = iqIsEmptyI(&sdp->iqueue);
+ osalSysUnlock();
+
+ return b;
+}
+
#endif /* HAL_USE_SERIAL == TRUE */
/** @} */
diff --git a/readme.txt b/readme.txt
index 2fc0a9407..0907abdf9 100644
--- a/readme.txt
+++ b/readme.txt
@@ -126,6 +126,8 @@
- HAL: Updated STM32F0xx headers to STM32CubeF0 version 1.3.0. Added support
for STM32F030xC, STM32F070x6, STM32F070xB, STM32F091xC,
STM32F098xx devices.
+- HAL: Fixed invalid class type for sdPutWouldBlock() and sdGetWouldBlock()
+ functions (bug #659)(backported to 3.0.3 and 2.6.10).
- HAL: Fixed STM32F0xx HAL missing MCOPRE support (bug #658).
- HAL: Fixed STM32L1xx HAL errors in comments (bug #657)(backported
to 3.0.3 and 2.6.10).
diff --git a/testhal/STM32/STM32L1xx/DAC/debug/STM32L1xx-DAC (OpenOCD, Flash and Run).launch b/testhal/STM32/STM32L1xx/DAC/debug/STM32L1xx-DAC (OpenOCD, Flash and Run).launch
index 0cfeec8c9..8890f2176 100644
--- a/testhal/STM32/STM32L1xx/DAC/debug/STM32L1xx-DAC (OpenOCD, Flash and Run).launch
+++ b/testhal/STM32/STM32L1xx/DAC/debug/STM32L1xx-DAC (OpenOCD, Flash and Run).launch
@@ -33,7 +33,7 @@
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_REGISTER_GROUPS" value=""/>
-<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;CR2-adc-adcp-adc_lld_start_conversion-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;CR2-adc-null-port_wait_for_interrupt-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;cr2-adc_lld_start_conversion-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
+<stringAttribute key="org.eclipse.cdt.launch.FORMAT" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&lt;contentList&gt;&lt;content id=&quot;cr2-adc_lld_start_conversion-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;CR2-adc-null-port_wait_for_interrupt-(format)&quot; val=&quot;4&quot;/&gt;&lt;content id=&quot;CR2-adc-adcp-adc_lld_start_conversion-(format)&quot; val=&quot;4&quot;/&gt;&lt;/contentList&gt;"/>
<stringAttribute key="org.eclipse.cdt.launch.GLOBAL_VARIABLES" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;globalVariableList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.MEMORY_BLOCKS" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;memoryBlockExpressionList/&gt;&#13;&#10;"/>
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="./build/ch.elf"/>