diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-08-30 13:34:37 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2017-08-30 13:34:37 +0000 |
commit | 92fe1a35249b1723419405dc2939d19ea940d9db (patch) | |
tree | a28121a73d16bb9e0bd4489ece09adc1eae07ac1 /os/hal/include | |
parent | ab5f8476e10b816d3636e0d68451c5def9369445 (diff) | |
download | ChibiOS-92fe1a35249b1723419405dc2939d19ea940d9db.tar.gz ChibiOS-92fe1a35249b1723419405dc2939d19ea940d9db.tar.bz2 ChibiOS-92fe1a35249b1723419405dc2939d19ea940d9db.zip |
PAL callbacks implementation for STM32, not complete yet.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10507 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include')
-rw-r--r-- | os/hal/include/hal_pal.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/os/hal/include/hal_pal.h b/os/hal/include/hal_pal.h index 4369305c4..6e305340e 100644 --- a/os/hal/include/hal_pal.h +++ b/os/hal/include/hal_pal.h @@ -126,6 +126,14 @@ */
typedef void (*palcallback_t)(void *arg);
+/**
+ * @brief Type of a PAL event record.
+ */
+typedef struct {
+ palcallback_t cb;
+ void *arg;
+} palevent_t;
+
#include "hal_pal_lld.h"
/**
@@ -203,6 +211,52 @@ typedef struct { IOBus name = _IOBUS_DATA(name, port, width, offset)
/**
+ * @name Low level driver helper macros
+ * @{
+ */
+/**
+ * @brief Common ISR code.
+ * @note This macro is meant to be used in the low level drivers
+ * implementation only.
+ *
+ * @param[in] e event index
+ *
+ * @notapi
+ */
+#define _pal_isr_code(e) _pal_events[e].cb(_pal_events[e].arg)
+
+/**
+ * @brief PAL event setup.
+ * @note This macro is meant to be used in the low level drivers
+ * implementation only.
+ *
+ * @param[in] e event index
+ * @param[in] c callback pointer
+ * @param[in] a callback argument
+ *
+ * @notapi
+ */
+#define _pal_set_event(e, c, a) { \
+ _pal_events[e].cb = c; \
+ _pal_events[e].arg = a; \
+}
+
+/**
+ * @brief PAL event clear.
+ * @note This macro is meant to be used in the low level drivers
+ * implementation only.
+ *
+ * @param[in] e event index
+ *
+ * @notapi
+ */
+#define _pal_clear_event(e) { \
+ _pal_events[e].cb = NULL; \
+ _pal_events[e].arg = NULL; \
+}
+/** @} */
+
+/**
* @name Macro Functions
* @{
*/
|