changed hardcoded, but SYSCLK dependend values to evaluate correctly for the different platforms

This commit is contained in:
Markus Fröschle
2013-11-01 11:23:52 +00:00
parent 8ae034edd2
commit e27a45520f
5 changed files with 46 additions and 15 deletions

View File

@@ -28,6 +28,13 @@
#define _WAIT_H_
#include <bas_types.h>
#if MACHINE_FIREBEE
#include "firebee.h"
#elif MACHINE_M5484LITE
#include "m5484l.h"
#else
//#error unknown machine
#endif /* MACHINE_FIREBEE */
typedef bool (*checker_func)(void);
@@ -39,7 +46,7 @@ extern __inline__ bool waitfor(uint32_t us, checker_func condition) __attribute_
*/
extern __inline__ void wait(uint32_t us)
{
int32_t target = MCF_SLT_SCNT(0) - (us * 132);
int32_t target = MCF_SLT_SCNT(0) - (us * (SYSCLK / 1000));
while (MCF_SLT_SCNT(0) - target > 0);
}
@@ -50,7 +57,7 @@ extern __inline__ void wait(uint32_t us)
*/
extern __inline__ bool waitfor(uint32_t us, checker_func condition)
{
int32_t target = MCF_SLT_SCNT(0) - (us * 132);
int32_t target = MCF_SLT_SCNT(0) - (us * (SYSCLK / 1000));
uint32_t res;
do