aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include/spi.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-25 18:32:45 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-11-25 18:32:45 +0000
commitc852dcb3c960198f49c5fdd8619a6d5d581d9136 (patch)
tree18da29976692bb47392618d38484c7cebbabdffb /os/hal/include/spi.h
parentd973c3f25a6ab56e12b9f858b0692ec4297d84c9 (diff)
downloadChibiOS-c852dcb3c960198f49c5fdd8619a6d5d581d9136.tar.gz
ChibiOS-c852dcb3c960198f49c5fdd8619a6d5d581d9136.tar.bz2
ChibiOS-c852dcb3c960198f49c5fdd8619a6d5d581d9136.zip
Improved ADC and SPI driver models.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2426 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/include/spi.h')
-rw-r--r--os/hal/include/spi.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/os/hal/include/spi.h b/os/hal/include/spi.h
index 93aba4980..a563b262c 100644
--- a/os/hal/include/spi.h
+++ b/os/hal/include/spi.h
@@ -214,7 +214,7 @@ typedef enum {
*
* @notapi
*/
-#define _spi_wait(spip) { \
+#define _spi_wait_s(spip) { \
chDbgAssert((spip)->spd_thread == NULL, \
"_spi_wait(), #1", "already waiting"); \
(spip)->spd_thread = chThdSelf(); \
@@ -228,18 +228,18 @@ typedef enum {
*
* @notapi
*/
-#define _spi_wakeup(spip) { \
- chSysLockFromIsr(); \
+#define _spi_wakeup_isr(spip) { \
if ((spip)->spd_thread != NULL) { \
Thread *tp = (spip)->spd_thread; \
(spip)->spd_thread = NULL; \
+ chSysLockFromIsr(); \
chSchReadyI(tp); \
+ chSysUnlockFromIsr(); \
} \
- chSysUnlockFromIsr(); \
}
#else /* !SPI_USE_WAIT */
-#define _spi_wakeup(spip)
-#define _spi_wait(spip)
+#define _spi_wait_s(spip)
+#define _spi_wakeup_isr(spip)
#endif /* !SPI_USE_WAIT */
/**
@@ -261,11 +261,8 @@ typedef enum {
(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; \
- _spi_wakeup(spip); \
+ (spip)->spd_state = SPI_READY; \
+ _spi_wakeup_isr(spip); \
} \
}