diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-10-12 19:25:00 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-10-12 19:25:00 +0000 |
commit | f49c8de5b2d1a4e35bef8daa2a923f751d6e17b3 (patch) | |
tree | 9d75f360ff6e01a61038d1d2b5402f21b0ab34f9 /os/hal | |
parent | eaaf043cdab72623a15c957f44496b7bd0bd9873 (diff) | |
download | ChibiOS-f49c8de5b2d1a4e35bef8daa2a923f751d6e17b3.tar.gz ChibiOS-f49c8de5b2d1a4e35bef8daa2a923f751d6e17b3.tar.bz2 ChibiOS-f49c8de5b2d1a4e35bef8daa2a923f751d6e17b3.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2252 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal')
-rw-r--r-- | os/hal/hal.dox | 6 | ||||
-rw-r--r-- | os/hal/include/spi.h | 73 |
2 files changed, 41 insertions, 38 deletions
diff --git a/os/hal/hal.dox b/os/hal/hal.dox index 45d133014..4fbbccf3f 100644 --- a/os/hal/hal.dox +++ b/os/hal/hal.dox @@ -334,7 +334,8 @@ stop -> stop [label="\nadcStop()"];
ready -> active [label="\nadcStartConversion() (async)\nadcConvert() (sync)"];
active -> ready [label="\nadcStopConversion()\nsync return"];
- active -> complete [label="\nasync callback\n>acg_endcb<"];
+ active -> active [label="\nasync callback (half buffer)\nasync callback (full buffer circular)\n>acg_endcb<"];
+ active -> complete [label="\nasync callback (full buffer)\n>acg_endcb<"];
complete -> active [label="\nadcStartConversionI()\nthen\ncallback return()"];
complete -> ready [label="\nadcStopConversionI()\nthen\ncallback return"];
}
@@ -359,7 +360,8 @@ stop -> stop [label="\nadcStop()"];
ready -> active [label="\nadcStartConversion() (async)\nadcConvert() (sync)"];
active -> ready [label="\nadcStopConversion()\nsync return"];
- active -> complete [label="\nasync callback\n>acg_endcb<"];
+ active -> active [label="\nasync callback (half buffer)\nasync callback (full buffer circular)\n>acg_endcb<"];
+ active -> complete [label="\nasync callback (full buffer)\n>acg_endcb<"];
complete -> active [label="\nadcStartConversionI()\nthen\ncallback return()"];
complete -> ready [label="\nadcStopConversionI()\nthen\ncallback return"];
}
diff --git a/os/hal/include/spi.h b/os/hal/include/spi.h index fbd26c207..ed8ba8de0 100644 --- a/os/hal/include/spi.h +++ b/os/hal/include/spi.h @@ -188,39 +188,6 @@ typedef enum { #if SPI_USE_WAIT || defined(__DOXYGEN__)
/**
- * @brief Common ISR code.
- * @details This code handles the portable part of the ISR code:
- * - Callback invocation.
- * - Waiting thread wakeup, if any.
- * - Driver state transitions.
- * .
- * @note This macro is meant to be used in the low level drivers
- * implementation only.
- *
- * @param[in] spip pointer to the @p SPIDriver object
- *
- * @notapi
- */
-#define _spi_isr_code(spip) { \
- if (spip->spd_config->spc_endcb) { \
- spip->spd_state = SPI_COMPLETE; \
- spip->spd_config->spc_endcb(spip); \
- if (spip->spd_state == SPI_COMPLETE) \
- spip->spd_state = SPI_READY; \
- } \
- else { \
- spip->spd_state = SPI_READY; \
- chSysLockFromIsr(); \
- if ((spip)->spd_thread != NULL) { \
- Thread *tp = (spip)->spd_thread; \
- (spip)->spd_thread = NULL; \
- chSchReadyI(tp); \
- } \
- chSysUnlockFromIsr(); \
- } \
-}
-
-/**
* @brief Waits for operation completion.
* @details This function waits for the driver to complete the current
* operation.
@@ -238,8 +205,42 @@ typedef enum { (spip)->spd_thread = chThdSelf(); \
chSchGoSleepS(THD_STATE_SUSPENDED); \
}
+
+/**
+ * @brief Wakes up the waiting thread. + *
+ * @param[in] spip pointer to the @p SPIDriver object
+ *
+ * @notapi
+ */
+#define _spi_wakeup(spip) { \
+ chSysLockFromIsr(); \
+ if ((spip)->spd_thread != NULL) { \
+ Thread *tp = (spip)->spd_thread; \
+ (spip)->spd_thread = NULL; \
+ chSchReadyI(tp); \
+ } \
+ chSysUnlockFromIsr(); \
+}
#else /* !SPI_USE_WAIT */
+#define _spi_wakeup(spip)
+#define _spi_wait(spip)
+#endif /* !SPI_USE_WAIT */
+/**
+ * @brief Common ISR code.
+ * @details This code handles the portable part of the ISR code:
+ * - Callback invocation.
+ * - Waiting thread wakeup, if any.
+ * - Driver state transitions.
+ * .
+ * @note This macro is meant to be used in the low level drivers
+ * implementation only.
+ *
+ * @param[in] spip pointer to the @p SPIDriver object
+ *
+ * @notapi
+ */
#define _spi_isr_code(spip) { \
if (spip->spd_config->spc_endcb) { \
spip->spd_state = SPI_COMPLETE; \
@@ -247,12 +248,12 @@ typedef enum { if (spip->spd_state == SPI_COMPLETE) \
spip->spd_state = SPI_READY; \
} \
- else \
+ else { \
spip->spd_state = SPI_READY; \
+ _spi_wakeup(spip); \
+ } \
}
-#endif /* !SPI_USE_WAIT */
-
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
|