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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [kernel/] [rtos.c] - Diff between revs 223 and 233

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

Rev 223 Rev 233
Line 62... Line 62...
   THREAD_READY   = 1,
   THREAD_READY   = 1,
   THREAD_RUNNING = 2
   THREAD_RUNNING = 2
} OS_ThreadState_e;
} OS_ThreadState_e;
 
 
struct OS_Thread_s {
struct OS_Thread_s {
   const char *name;
   const char *name;         //Name of thread
   OS_ThreadState_e state;
   OS_ThreadState_e state;   //Pending, ready, or running
   int cpuIndex;
   int cpuIndex;             //Which CPU is running the thread
   int cpuLock;
   int cpuLock;              //Lock the thread to a specific CPU
   jmp_buf env;
   jmp_buf env;              //Registers saved during context swap
   OS_FuncPtr_t funcPtr;
   OS_FuncPtr_t funcPtr;     //First function called
   void *arg;
   void *arg;                //Argument to first function called
   uint32 priority;
   uint32 priority;          //Priority of thread (0=low, 255=high)
   uint32 ticksTimeout;
   uint32 ticksTimeout;      //Tick value when semaphore pend times out
   void *info;
   void *info;               //User storage
   OS_Semaphore_t *semaphorePending;
   OS_Semaphore_t *semaphorePending;  //Semaphore thread is blocked on
   int returnCode;
   int returnCode;           //Return value from semaphore pend
   uint32 spinLocks;
   uint32 spinLocks;         //Recursion depth of spin locks
   uint32 processId;
   uint32 processId;         //Process ID if using MMU
   OS_Heap_t *heap;
   OS_Heap_t *heap;          //Heap used if no heap specified
   struct OS_Thread_s *next, *prev;
   struct OS_Thread_s *next; //Linked list of threads by priority
   struct OS_Thread_s *nextTimeout, *prevTimeout;
   struct OS_Thread_s *prev;
   uint32 magic[1];
   struct OS_Thread_s *nextTimeout; //Linked list of threads by timeout
 
   struct OS_Thread_s *prevTimeout;
 
   uint32 magic[1];          //Bottom of stack to detect stack overflow
};
};
//typedef struct OS_Thread_s OS_Thread_t;
//typedef struct OS_Thread_s OS_Thread_t;
 
 
struct OS_Semaphore_s {
struct OS_Semaphore_s {
   const char *name;
   const char *name;
Line 1489... Line 1491...
 
 
 
 
/************** WIN32 Support *************/
/************** WIN32 Support *************/
#ifdef WIN32
#ifdef WIN32
//Support RTOS inside Windows
//Support RTOS inside Windows
 
#undef kbhit
 
#undef getch
 
#undef putch
extern int kbhit();
extern int kbhit();
extern int getch(void);
extern int getch(void);
extern int putch(int);
extern int putch(int);
extern void __stdcall Sleep(unsigned long value);
extern void __stdcall Sleep(unsigned long value);
 
 

powered by: WebSVN 2.1.0

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