fixed doubly definition of wait_() routines
This commit is contained in:
@@ -29,9 +29,7 @@
|
|||||||
#define BAS_TYPES_H_
|
#define BAS_TYPES_H_
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
typedef int bool;
|
#include <stdbool.h>
|
||||||
#define TRUE 1
|
|
||||||
#define FALSE 0
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -29,10 +29,10 @@
|
|||||||
|
|
||||||
#include <bas_types.h>
|
#include <bas_types.h>
|
||||||
|
|
||||||
typedef uint32_t (*checker_func)(void);
|
typedef bool (*checker_func)(void);
|
||||||
|
|
||||||
extern __inline__ void wait(uint32_t) __attribute__((always_inline));
|
extern __inline__ void wait(uint32_t) __attribute__((always_inline));
|
||||||
extern __inline__ uint32_t waitfor(uint32_t us, checker_func condition) __attribute__((always_inline));
|
extern __inline__ bool waitfor(uint32_t us, checker_func condition) __attribute__((always_inline));
|
||||||
/*
|
/*
|
||||||
* wait for the specified number of us on slice timer 0. Replaces the original routines that had
|
* wait for the specified number of us on slice timer 0. Replaces the original routines that had
|
||||||
* the number of useconds to wait for hardcoded in their name.
|
* the number of useconds to wait for hardcoded in their name.
|
||||||
@@ -48,7 +48,7 @@ extern __inline__ void wait(uint32_t us)
|
|||||||
* the same as above, with a checker function which gets called while
|
* the same as above, with a checker function which gets called while
|
||||||
* busy waiting and allows for an early return if it returns true
|
* busy waiting and allows for an early return if it returns true
|
||||||
*/
|
*/
|
||||||
extern __inline__ uint32_t waitfor(uint32_t us, checker_func condition)
|
extern __inline__ bool waitfor(uint32_t us, checker_func condition)
|
||||||
{
|
{
|
||||||
uint32_t target = MCF_SLT_SCNT(0) - (us * 132);
|
uint32_t target = MCF_SLT_SCNT(0) - (us * 132);
|
||||||
uint32_t res;
|
uint32_t res;
|
||||||
@@ -58,6 +58,6 @@ extern __inline__ uint32_t waitfor(uint32_t us, checker_func condition)
|
|||||||
if ((res = (*condition)()))
|
if ((res = (*condition)()))
|
||||||
return res;
|
return res;
|
||||||
} while (MCF_SLT_SCNT(0) > target);
|
} while (MCF_SLT_SCNT(0) > target);
|
||||||
return 0;
|
return false;
|
||||||
}
|
}
|
||||||
#endif /* _WAIT_H_ */
|
#endif /* _WAIT_H_ */
|
||||||
|
|||||||
@@ -56,23 +56,23 @@ extern uint8_t _EMUTOS_SIZE[];
|
|||||||
/*
|
/*
|
||||||
* check if it is possible to transfer data to PIC
|
* check if it is possible to transfer data to PIC
|
||||||
*/
|
*/
|
||||||
static inline uint32_t pic_txready(void)
|
static inline bool pic_txready(void)
|
||||||
{
|
{
|
||||||
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY)
|
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_TXRDY)
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
return FALSE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check if it is possible to receive data from PIC
|
* check if it is possible to receive data from PIC
|
||||||
*/
|
*/
|
||||||
static inline uint32_t pic_rxready(void)
|
static inline bool pic_rxready(void)
|
||||||
{
|
{
|
||||||
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY)
|
if (MCF_PSC3_PSCSR & MCF_PSC_PSCSR_RXRDY)
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void write_pic_byte(uint8_t value)
|
void write_pic_byte(uint8_t value)
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ static void xmit_spi_multi(const uint8_t *buff, uint32_t btx)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static uint32_t card_ready(void)
|
static bool card_ready(void)
|
||||||
{
|
{
|
||||||
uint8_t d;
|
uint8_t d;
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "sysinit.h"
|
#include "sysinit.h"
|
||||||
#include "bas_printf.h"
|
#include "bas_printf.h"
|
||||||
#include "bas_types.h"
|
#include "bas_types.h"
|
||||||
|
#include "wait.h"
|
||||||
|
|
||||||
extern void xprintf_before_copy(const char *fmt, ...);
|
extern void xprintf_before_copy(const char *fmt, ...);
|
||||||
#define xprintf xprintf_before_copy
|
#define xprintf xprintf_before_copy
|
||||||
@@ -41,32 +42,6 @@ extern void flush_and_invalidate_caches_before_copy(void);
|
|||||||
|
|
||||||
extern volatile long _VRAM; /* start address of video ram from linker script */
|
extern volatile long _VRAM; /* start address of video ram from linker script */
|
||||||
|
|
||||||
/*
|
|
||||||
* wait for the specified number of us on slice timer 0. Replaces the original routines that had
|
|
||||||
* the number of useconds to wait for hardcoded in their name.
|
|
||||||
*/
|
|
||||||
inline __attribute__((always_inline)) void wait(uint32_t us)
|
|
||||||
{
|
|
||||||
uint32_t target = MCF_SLT_SCNT(0) - (us * 132);
|
|
||||||
|
|
||||||
while (MCF_SLT_SCNT(0) > target);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* the same as above, with a checker function which gets called while
|
|
||||||
* busy waiting and allows for an early return if it returns true
|
|
||||||
*/
|
|
||||||
inline __attribute__((always_inline)) bool waitfor(uint32_t us, int (*condition)(void))
|
|
||||||
{
|
|
||||||
uint32_t target = MCF_SLT_SCNT(0) - (us * 132);
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if ((*condition)())
|
|
||||||
return TRUE;
|
|
||||||
} while (MCF_SLT_SCNT(0) > target);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* init SLICE TIMER 0
|
* init SLICE TIMER 0
|
||||||
* all = 32.538 sec = 30.736mHz
|
* all = 32.538 sec = 30.736mHz
|
||||||
@@ -519,9 +494,9 @@ void test_upd720101(void)
|
|||||||
static bool i2c_transfer_finished(void)
|
static bool i2c_transfer_finished(void)
|
||||||
{
|
{
|
||||||
if (MCF_I2C_I2SR & MCF_I2C_I2SR_IIF)
|
if (MCF_I2C_I2SR & MCF_I2C_I2SR_IIF)
|
||||||
return TRUE;
|
return true;
|
||||||
|
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wait_i2c_transfer_finished(void)
|
static void wait_i2c_transfer_finished(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user