Line 26... |
Line 26... |
#pragma warning(disable:4996) //atoi()
|
#pragma warning(disable:4996) //atoi()
|
#include <stdio.h>
|
#include <stdio.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <assert.h>
|
#include <assert.h>
|
#define _LIBC
|
#define _LIBC
|
|
extern void __stdcall Sleep(unsigned long value);
|
uint32 MemoryRead(uint32 Address);
|
uint32 MemoryRead(uint32 Address);
|
void MemoryWrite(uint32 Address, uint32 Value);
|
void MemoryWrite(uint32 Address, uint32 Value);
|
#else
|
#else
|
#define MemoryRead(A) (*(volatile uint32*)(A))
|
#define MemoryRead(A) (*(volatile uint32*)(A))
|
#define MemoryWrite(A,V) *(volatile uint32*)(A)=(V)
|
#define MemoryWrite(A,V) *(volatile uint32*)(A)=(V)
|
#endif
|
#endif
|
|
|
|
/***************** Simulation Functions ******************/
|
|
void OS_InitSimulation(void);
|
|
|
/***************** LibC ******************/
|
/***************** LibC ******************/
|
|
#undef isprint
|
|
#undef isspace
|
|
#undef isdigit
|
|
#undef islower
|
|
#undef isupper
|
|
#undef isalpha
|
|
#undef isalnum
|
#define isprint(c) (' '<=(c)&&(c)<='~')
|
#define isprint(c) (' '<=(c)&&(c)<='~')
|
#define isspace(c) ((c)==' '||(c)=='\t'||(c)=='\n'||(c)=='\r')
|
#define isspace(c) ((c)==' '||(c)=='\t'||(c)=='\n'||(c)=='\r')
|
#define isdigit(c) ('0'<=(c)&&(c)<='9')
|
#define isdigit(c) ('0'<=(c)&&(c)<='9')
|
#define islower(c) ('a'<=(c)&&(c)<='z')
|
#define islower(c) ('a'<=(c)&&(c)<='z')
|
#define isupper(c) ('A'<=(c)&&(c)<='Z')
|
#define isupper(c) ('A'<=(c)&&(c)<='Z')
|
#define isalpha(c) (islower(c)||isupper(c))
|
#define isalpha(c) (islower(c)||isupper(c))
|
#define isalnum(c) (isalpha(c)||isdigit(c))
|
#define isalnum(c) (isalpha(c)||isdigit(c))
|
#undef min
|
#undef min
|
#define min(a,b) ((a)<(b)?(a):(b))
|
#define min(a,b) ((a)<(b)?(a):(b))
|
#define strcpy strcpy2 //don't use intrinsic functions
|
#define strcpy strcpy2 //don't use intrinsic functions
|
|
#define strncpy strncpy2
|
#define strcat strcat2
|
#define strcat strcat2
|
#define strncat strncat2
|
#define strncat strncat2
|
#define strcmp strcmp2
|
#define strcmp strcmp2
|
|
#define strncmp strncmp2
|
#define strstr strstr2
|
#define strstr strstr2
|
#define strlen strlen2
|
#define strlen strlen2
|
#define memcpy memcpy2
|
#define memcpy memcpy2
|
|
#define memmove memmove2
|
#define memcmp memcmp2
|
#define memcmp memcmp2
|
#define memset memset2
|
#define memset memset2
|
#define abs abs2
|
#define abs abs2
|
|
|
char *strcpy(char *dst, const char *src);
|
char *strcpy(char *dst, const char *src);
|
Line 164... |
Line 178... |
void OS_SpinUnlock(uint32 state);
|
void OS_SpinUnlock(uint32 state);
|
#endif
|
#endif
|
|
|
/***************** Thread *****************/
|
/***************** Thread *****************/
|
#ifdef WIN32
|
#ifdef WIN32
|
#define STACK_SIZE_MINIMUM (1024*4)
|
#define STACK_SIZE_MINIMUM (1024*8)
|
#else
|
#else
|
#define STACK_SIZE_MINIMUM (1024*1)
|
#define STACK_SIZE_MINIMUM (1024*1)
|
#endif
|
#endif
|
#define STACK_SIZE_DEFAULT 1024*2
|
#define STACK_SIZE_DEFAULT 1024*2
|
#undef THREAD_PRIORITY_IDLE
|
#undef THREAD_PRIORITY_IDLE
|
Line 189... |
Line 203... |
void OS_ThreadInfoSet(OS_Thread_t *thread, uint32 index, void *info);
|
void OS_ThreadInfoSet(OS_Thread_t *thread, uint32 index, void *info);
|
void *OS_ThreadInfoGet(OS_Thread_t *thread, uint32 index);
|
void *OS_ThreadInfoGet(OS_Thread_t *thread, uint32 index);
|
uint32 OS_ThreadPriorityGet(OS_Thread_t *thread);
|
uint32 OS_ThreadPriorityGet(OS_Thread_t *thread);
|
void OS_ThreadPrioritySet(OS_Thread_t *thread, uint32 priority);
|
void OS_ThreadPrioritySet(OS_Thread_t *thread, uint32 priority);
|
void OS_ThreadProcessId(OS_Thread_t *thread, uint32 processId, OS_Heap_t *heap);
|
void OS_ThreadProcessId(OS_Thread_t *thread, uint32 processId, OS_Heap_t *heap);
|
void OS_ThreadTick(void *arg);
|
|
void OS_ThreadCpuLock(OS_Thread_t *thread, int cpuIndex);
|
void OS_ThreadCpuLock(OS_Thread_t *thread, int cpuIndex);
|
|
|
/***************** Semaphore **************/
|
/***************** Semaphore **************/
|
#define OS_SUCCESS 0
|
#define OS_SUCCESS 0
|
#define OS_ERROR -1
|
#define OS_ERROR -1
|
Line 295... |
Line 308... |
#endif
|
#endif
|
void UartPacketConfig(PacketGetFunc_t packetGetFunc,
|
void UartPacketConfig(PacketGetFunc_t packetGetFunc,
|
int packetSize,
|
int packetSize,
|
OS_MQueue_t *mQueue);
|
OS_MQueue_t *mQueue);
|
void UartPacketSend(uint8 *data, int bytes);
|
void UartPacketSend(uint8 *data, int bytes);
|
#ifdef WIN32
|
int OS_puts(const char *string);
|
#define puts puts2
|
int OS_getch(void);
|
#define getch getch2
|
int OS_kbhit(void);
|
#define kbhit kbhit2
|
|
#endif
|
|
int puts(const char *string);
|
|
int getch(void);
|
|
int kbhit(void);
|
|
void LogWrite(int a);
|
void LogWrite(int a);
|
void LogDump(void);
|
void LogDump(void);
|
void Led(int mask, int value);
|
void Led(int mask, int value);
|
|
|
/***************** Keyboard **************/
|
/***************** Keyboard **************/
|