From 498fc6a7754150fcc07bf7a68d787d8d70244ea3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Sun, 18 Nov 2012 07:39:33 +0000 Subject: [PATCH] return from busy-waiting after a certain time --- BaS_gcc/sources/BaS.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BaS_gcc/sources/BaS.c b/BaS_gcc/sources/BaS.c index 5f65485..a311673 100644 --- a/BaS_gcc/sources/BaS.c +++ b/BaS_gcc/sources/BaS.c @@ -34,6 +34,9 @@ extern uint8_t _EMUTOS[]; extern uint8_t _EMUTOS_SIZE[]; #define EMUTOS_SIZE ((uint32_t)_EMUTOS_SIZE) /* size of EmuTOS, in bytes */ +/* + * check if it is possible to transfer data to PIC + */ static inline bool pic_txready(void) { if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY) @@ -42,6 +45,9 @@ static inline bool pic_txready(void) return FALSE; } +/* + * check if it is possible to receive data from PIC + */ static inline bool pic_rxready(void) { if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY) @@ -54,10 +60,8 @@ void write_pic_byte(uint8_t value) { /* Wait until the tramsmitter is ready or 1000us are passed */ waitfor(1000, pic_txready); - //while (!(MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY)); /* Transmit the byte */ - //MCF_PSC3_PSCTB_8BIT = value; // This define is actually 32-bit *(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT) = value; // Really 8-bit } @@ -67,7 +71,6 @@ uint8_t read_pic_byte(void) waitfor(1000, pic_rxready); /* Return the received byte */ - //return MCF_PSC3_PSCRB_8BIT; // This define is actually 32-bit return *(volatile uint8_t*)(&MCF_PSC3_PSCTB_8BIT); // Really 8-bit }