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

Subversion Repositories plasma

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

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

Rev 218 Rev 223
Line 997... Line 997...
   return 0;
   return 0;
}
}
 
 
 
 
 
 
 
/***************** Jobs *******************/
 
/******************************************/
 
typedef void (*JobFunc_t)();
 
static OS_MQueue_t *jobQueue;
 
static OS_Thread_t *jobThread;
 
 
 
static void JobThread(void *arg)
 
{
 
   uint32 message[4];
 
   JobFunc_t funcPtr;
 
   (void)arg;
 
   for(;;)
 
   {
 
      OS_MQueueGet(jobQueue, message, OS_WAIT_FOREVER);
 
      funcPtr = (JobFunc_t)message[0];
 
      funcPtr(message[1], message[2], message[3]);
 
   }
 
}
 
 
 
 
 
/******************************************/
 
void OS_Job(void (*funcPtr)(), void *arg0, void *arg1, void *arg2)
 
{
 
   uint32 message[4];
 
   int rc;
 
 
 
   if(jobThread == NULL)
 
   {
 
      jobQueue = OS_MQueueCreate("job", 100, 16);
 
      jobThread = OS_ThreadCreate("job", JobThread, NULL, 150, 4000);
 
   }
 
   message[0] = (uint32)funcPtr;
 
   message[1] = (uint32)arg0;
 
   message[2] = (uint32)arg1;
 
   message[3] = (uint32)arg2;
 
   do
 
   {
 
      rc = OS_MQueueSend(jobQueue, message);
 
      if(rc)
 
         OS_ThreadSleep(1);
 
   } while(rc);
 
}
 
 
 
 
/***************** Timer ******************/
/***************** Timer ******************/
/******************************************/
/******************************************/
static void OS_TimerThread(void *arg)
static void OS_TimerThread(void *arg)
{
{
   uint32 timeNow;
   uint32 timeNow;
Line 1521... Line 1565...
   //Remaining space after program in 1MB external RAM
   //Remaining space after program in 1MB external RAM
   OS_Init((uint32*)programEnd,
   OS_Init((uint32*)programEnd,
           RAM_EXTERNAL_BASE + RAM_EXTERNAL_SIZE - programEnd);
           RAM_EXTERNAL_BASE + RAM_EXTERNAL_SIZE - programEnd);
#endif
#endif
   UartInit();
   UartInit();
   OS_ThreadCreate("Main", MainThread, NULL, 100, 64000);
   OS_ThreadCreate("Main", MainThread, NULL, 100, 4000);
   OS_Start();
   OS_Start();
   return 0;
   return 0;
}
}
#endif
#endif
 
 

powered by: WebSVN 2.1.0

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