OpenCores
URL https://opencores.org/ocsvn/plasma/plasma/trunk

Subversion Repositories plasma

[/] [plasma/] [trunk/] [kernel/] [rtos.h] - Diff between revs 368 and 400

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 368 Rev 400
Line 20... Line 20...
typedef unsigned short uint16;
typedef unsigned short uint16;
typedef unsigned char  uint8;
typedef unsigned char  uint8;
 
 
// Memory Access
// Memory Access
#ifdef WIN32
#ifdef WIN32
 
   #define _CRT_SECURE_NO_WARNINGS 1
 
   #pragma warning(disable:4996) //atoi()
 
   #include <stdio.h>
 
   #include <stdlib.h>
 
   #include <assert.h>
 
   #define _LIBC
   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
 
 
/***************** LibC ******************/
/***************** LibC ******************/
#if !defined(_LIBC) && !defined(_CTYPE_DEFINED)
 
#define printf     UartPrintf
 
//#define printf     UartPrintfPoll
 
#define scanf      UartScanf
 
#ifndef WIN32
 
   #define malloc(S)  OS_HeapMalloc(NULL, S)
 
   #define free(S)    OS_HeapFree(S)
 
#endif
 
 
 
#ifndef NULL
 
#define NULL (void*)0
 
#endif
 
 
 
#define assert(A) if((A)==0){OS_Assert();UartPrintfCritical("\r\nAssert %s:%d\r\n", __FILE__, __LINE__);}
 
 
 
#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')
Line 56... Line 47...
#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 strcat     strcat2
#define strcat     strcat2
#define strncat    strncat2
#define strncat    strncat2
#define strcmp     strcmp2
#define strcmp     strcmp2
 
#define strstr     strstr2
#define strlen     strlen2
#define strlen     strlen2
#define memcpy     memcpy2
#define memcpy     memcpy2
#define memcmp     memcmp2
#define memcmp     memcmp2
#define memset     memset2
#define memset     memset2
#define abs        abs2
#define abs        abs2
#define atoi       atoi2
 
 
 
char *strcpy(char *dst, const char *src);
char *strcpy(char *dst, const char *src);
char *strncpy(char *dst, const char *src, int count);
char *strncpy(char *dst, const char *src, int count);
char *strcat(char *dst, const char *src);
char *strcat(char *dst, const char *src);
char *strncat(char *dst, const char *src, int count);
char *strncat(char *dst, const char *src, int count);
Line 76... Line 67...
void *memcpy(void *dst, const void *src, unsigned long bytes);
void *memcpy(void *dst, const void *src, unsigned long bytes);
void *memmove(void *dst, const void *src, unsigned long bytes);
void *memmove(void *dst, const void *src, unsigned long bytes);
int   memcmp(const void *cs, const void *ct, unsigned long bytes);
int   memcmp(const void *cs, const void *ct, unsigned long bytes);
void *memset(void *dst, int c, unsigned long bytes);
void *memset(void *dst, int c, unsigned long bytes);
int   abs(int n);
int   abs(int n);
 
 
 
#ifndef _LIBC
 
#define assert(A) if((A)==0){OS_Assert();UartPrintfCritical("\r\nAssert %s:%d\r\n", __FILE__, __LINE__);}
 
#define atoi       atoi2
 
#define printf     UartPrintf
 
//#define printf     UartPrintfPoll
 
#define scanf      UartScanf
 
#define malloc(S)  OS_HeapMalloc(NULL, S)
 
#define free(S)    OS_HeapFree(S)
 
#define NULL       (void*)0
 
 
int   rand(void);
int   rand(void);
void  srand(unsigned int seed);
void  srand(unsigned int seed);
long  strtol(const char *s, char **end, int base);
long  strtol(const char *s, char **end, int base);
int   atoi(const char *s);
int   atoi(const char *s);
char *itoa(int num, char *dst, int base);
char *itoa(int num, char *dst, int base);
 
 
#ifndef NO_ELLIPSIS
#ifndef NO_ELLIPSIS
   int sprintf(char *s, const char *format, ...);
   int sprintf(char *s, const char *format, ...);
   int sscanf(const char *s, const char *format, ...);
   int sscanf(const char *s, const char *format, ...);
#endif
#endif
#ifdef INCLUDE_DUMP
#ifdef INCLUDE_DUMP
Line 118... Line 121...
   time_t mktime(struct tm *tp);
   time_t mktime(struct tm *tp);
   void gmtime_r(const time_t *tp, struct tm *out);
   void gmtime_r(const time_t *tp, struct tm *out);
   void gmtimeDst(time_t dstTimeIn, time_t dstTimeOut);
   void gmtimeDst(time_t dstTimeIn, time_t dstTimeOut);
   void gmtimeDstSet(time_t *tp, time_t *dstTimeIn, time_t *dstTimeOut);
   void gmtimeDstSet(time_t *tp, time_t *dstTimeIn, time_t *dstTimeOut);
#endif
#endif
#define _LIBC
 
#endif //_LIBC
#endif //_LIBC
 
 
/***************** Assembly **************/
/***************** Assembly **************/
typedef uint32 jmp_buf[20];
typedef uint32 jmp_buf[20];
extern uint32 OS_AsmInterruptEnable(uint32 state);
extern uint32 OS_AsmInterruptEnable(uint32 state);
extern void OS_AsmInterruptInit(void);
extern void OS_AsmInterruptInit(void);
extern int setjmp(jmp_buf env);
extern int setjmp(jmp_buf env);
extern void longjmp(jmp_buf env, int val);
extern void longjmp(jmp_buf env, int val);
extern uint32 OS_AsmMult(uint32 a, uint32 b, unsigned long *hi);
extern uint32 OS_AsmMult(uint32 a, uint32 b, unsigned long *hi);
extern void *OS_Syscall();
extern void *OS_Syscall(uint32 value);
 
 
/***************** Heap ******************/
/***************** Heap ******************/
#define HEAP_USER    (void*)0
#define HEAP_USER    (void*)0
#define HEAP_SYSTEM  (void*)1
#define HEAP_SYSTEM  (void*)1
#define HEAP_SMALL   (void*)2
#define HEAP_SMALL   (void*)2
Line 222... Line 224...
void OS_MQueueDelete(OS_MQueue_t *mQueue);
void OS_MQueueDelete(OS_MQueue_t *mQueue);
int OS_MQueueSend(OS_MQueue_t *mQueue, void *message);
int OS_MQueueSend(OS_MQueue_t *mQueue, void *message);
int OS_MQueueGet(OS_MQueue_t *mQueue, void *message, int ticks);
int OS_MQueueGet(OS_MQueue_t *mQueue, void *message, int ticks);
 
 
/***************** Job ********************/
/***************** Job ********************/
void OS_Job(void (*funcPtr)(), void *arg0, void *arg1, void *arg2);
typedef void (*JobFunc_t)(void *a0, void *a1, void *a2);
 
void OS_Job(JobFunc_t funcPtr, void *arg0, void *arg1, void *arg2);
 
 
/***************** Timer ******************/
/***************** Timer ******************/
typedef struct OS_Timer_s OS_Timer_t;
typedef struct OS_Timer_s OS_Timer_t;
typedef void (*OS_TimerFuncPtr_t)(OS_Timer_t *timer, uint32 info);
typedef void (*OS_TimerFuncPtr_t)(OS_Timer_t *timer, uint32 info);
OS_Timer_t *OS_TimerCreate(const char *name, OS_MQueue_t *mQueue, uint32 info);
OS_Timer_t *OS_TimerCreate(const char *name, OS_MQueue_t *mQueue, uint32 info);
Line 270... Line 273...
                          uint32 physicalAddress,
                          uint32 physicalAddress,
                          uint32 size,
                          uint32 size,
                          uint32 writable);
                          uint32 writable);
OS_Process_t *OS_MMUProcessCreate(OS_Process_t *process);
OS_Process_t *OS_MMUProcessCreate(OS_Process_t *process);
void OS_MMUProcessDelete(OS_Process_t *process);
void OS_MMUProcessDelete(OS_Process_t *process);
void OS_MMUUartPrintf();
void OS_MMUUartPrintf(void);
void OS_MMUUartScanf();
void OS_MMUUartScanf(void);
void OS_MMUUartPrintfCritical();
void OS_MMUUartPrintfCritical(void);
 
 
/***************** UART ******************/
/***************** UART ******************/
typedef uint8* (*PacketGetFunc_t)(void);
typedef uint8* (*PacketGetFunc_t)(void);
void UartInit(void);
void UartInit(void);
void UartWrite(int ch);
void UartWrite(int ch);

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.