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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [kernel/] [rtos_test.c] - Diff between revs 400 and 402

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

Rev 400 Rev 402
Line 398... Line 398...
   }
   }
}
}
#endif
#endif
 
 
//******************************************************************
//******************************************************************
 
#if OS_CPU_COUNT > 1
 
int SpinDone;
 
void ThreadSpin(void *arg)
 
{
 
   int i;
 
   int j = 0;
 
   unsigned int timeStart = OS_ThreadTime();
 
 
 
   for(i = 0; i < 0x10000000; ++i)
 
   {
 
      j += i;
 
      if(OS_ThreadTime() - timeStart > 400)
 
         break;
 
      if((i & 0xfffff) == 0)
 
         printf("[%d] ", (int)arg);
 
   }
 
   printf("done[%d].\n", (int)arg);
 
   ++SpinDone;
 
}
 
 
 
void TestSpin(void)
 
{
 
   int i;
 
   SpinDone = 0;
 
   for(i = 0; i < OS_CPU_COUNT; ++i)
 
      OS_ThreadCreate("Spin", ThreadSpin, (void*)i, 50+i, 0);
 
   for(i = 0; i < 100 && SpinDone < OS_CPU_COUNT; ++i)
 
      OS_ThreadSleep(1);
 
}
 
#endif
 
 
 
//******************************************************************
#ifndef WIN32
#ifndef WIN32
static void MySyscall(void *arg)
static void MySyscall(void *arg)
{
{
   uint32 *stack = arg;
   uint32 *stack = arg;
   stack[STACK_EPC] += 4;  //skip over SYSCALL
   stack[STACK_EPC] += 4;  //skip over SYSCALL
Line 512... Line 544...
#endif
#endif
#ifdef WIN32
#ifdef WIN32
      case 'm': TestMathFull(); break;
      case 'm': TestMathFull(); break;
#endif
#endif
      case 'g': printf("Global=%d\n", ++Global); break;
      case 'g': printf("Global=%d\n", ++Global); break;
 
#if OS_CPU_COUNT > 1
 
      case 's': TestSpin(); break;
 
#endif
      default:
      default:
         printf("E");
         printf("E");
         display = 0;
         display = 0;
         for(i = 0; i < 30; ++i)
         for(i = 0; i < 30; ++i)
         {
         {
            while(kbhit())
            while(OS_kbhit())
               ch = UartRead();
               ch = UartRead();
            OS_ThreadSleep(1);
            OS_ThreadSleep(1);
         }
         }
         break;
         break;
      }
      }

powered by: WebSVN 2.1.0

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