diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-03-17 10:00:40 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2016-03-17 10:00:40 +0000 |
commit | 4b6e936c8a66da4fc25f35914b0e9b9e66a31359 (patch) | |
tree | 87b2f368ee5635ab6e15df66d439bf79f292c4ee /os/nil | |
parent | 49dac4f825c0d8a29d8641688e6ee08a9137dd74 (diff) | |
download | ChibiOS-4b6e936c8a66da4fc25f35914b0e9b9e66a31359.tar.gz ChibiOS-4b6e936c8a66da4fc25f35914b0e9b9e66a31359.tar.bz2 ChibiOS-4b6e936c8a66da4fc25f35914b0e9b9e66a31359.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9129 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/nil')
-rw-r--r-- | os/nil/include/ch.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/os/nil/include/ch.h b/os/nil/include/ch.h index 419822471..507128186 100644 --- a/os/nil/include/ch.h +++ b/os/nil/include/ch.h @@ -855,6 +855,33 @@ struct nil_system { /** @} */
/**
+ * @name Semaphores macros
+ * @{
+ */
+/**
+ * @brief Data part of a static semaphore initializer.
+ * @details This macro should be used when statically initializing a semaphore
+ * that is part of a bigger structure.
+ *
+ * @param[in] name the name of the semaphore variable
+ * @param[in] n the counter initial value, this value must be
+ * non-negative
+ */
+#define _SEMAPHORE_DATA(name, n) {n}
+
+/**
+ * @brief Static semaphore initializer.
+ * @details Statically initialized semaphores require no explicit
+ * initialization using @p chSemInit().
+ *
+ * @param[in] name the name of the semaphore variable
+ * @param[in] n the counter initial value, this value must be
+ * non-negative
+ */
+#define SEMAPHORE_DECL(name, n) semaphore_t name = _SEMAPHORE_DATA(name, n)
+/** @} */
+
+/**
* @name Macro Functions
* @{
*/
|