diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-08-12 16:05:36 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2014-08-12 16:05:36 +0000 |
commit | 46c0e6255e9d3013ce6308cd1fa494d6550fa80e (patch) | |
tree | 510f5b71e8d02cff493dff4215364dc9517be918 /os/nil/src/nil.c | |
parent | 80284bf64ae30d7c28adc1ff550c7423db53d418 (diff) | |
download | ChibiOS-46c0e6255e9d3013ce6308cd1fa494d6550fa80e.tar.gz ChibiOS-46c0e6255e9d3013ce6308cd1fa494d6550fa80e.tar.bz2 ChibiOS-46c0e6255e9d3013ce6308cd1fa494d6550fa80e.zip |
Added chSysConditionalLock() and chSysConditionalUnlock() functions to RT and NIL. Improved debug documentation.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7166 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/nil/src/nil.c')
-rw-r--r-- | os/nil/src/nil.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/os/nil/src/nil.c b/os/nil/src/nil.c index 3462b735a..48f640b09 100644 --- a/os/nil/src/nil.c +++ b/os/nil/src/nil.c @@ -219,6 +219,32 @@ void chSysTimerHandlerI(void) { }
/**
+ * @brief Conditionally enters the kernel lock state.
+ * @note Can be called without previous knowledge of the current lock state.
+ * The final state is "s-locked".
+ *
+ * @special
+ */
+void chSysConditionalLock(void) {
+
+ if (port_irq_enabled(port_get_irq_status()))
+ chSysLock();
+}
+
+/**
+ * @brief Conditionally leaves the kernel lock state.
+ * @note Can be called without previous knowledge of the current lock state.
+ * The final state is "normal".
+ *
+ * @special
+ */
+void chSysConditionalUnlock(void) {
+
+ if (!port_irq_enabled(port_get_irq_status()))
+ chSysUnlock();
+}
+
+/**
* @brief Returns the execution status and enters a critical zone.
* @details This functions enters into a critical zone and can be called
* from any context. Because its flexibility it is less efficient
|