main.c 1.61 KB
#include <os.h>
#include <rmon.h>
#include "ostime.h"

char	bootStack[STACKSIZE];

static void	idle(void *);
static void	main(void *);

static OSThread	idleThread;
static char	idleThreadStack[STACKSIZE];

static OSThread	mainThread;
static char	mainThreadStack[STACKSIZE];

static OSThread	rmonThread;
static char	rmonThreadStack[RMON_STACKSIZE];

int pif(void);

boot(void)
{
    int *pr;
    
    osInitialize();
    osCreateThread(&mainThread, 1, main, (void *)0, mainThreadStack+STACKSIZE,
		  10);
    osStartThread(&mainThread);
}

static void
main(void *arg)
{
    int totalFailures = 0;
    int i;

    /*
     * Create idle thread
     */
    osCreateThread(&idleThread, 3, idle, (void *)0, idleThreadStack+STACKSIZE,
		  0);
    osStartThread(&idleThread);

    /* Start VI manager */
    osCreateViManager((OSPri)OS_PRIORITY_VIMGR);


    /*
     * Create rmon thread
     */
    osCreateThread(&rmonThread, 0, rmonMain, (void *)0,
		rmonThreadStack+RMON_STACKSIZE, OS_PRIORITY_RMON);
    osStartThread(&rmonThread);

    /*
     * Tests are ordered so that succeeding tests
     * use functionality verified by preceding tests.
    */
    rmonPrintf("pif\n");
    totalFailures += pif();          /* interval controller tests */
    rmonPrintf("timer1\n");
    totalFailures += timer1();          /* interval timer tests */
    rmonPrintf("timer2\n");
    totalFailures += timer2();          /* interval timer tests */
    rmonPrintf("timer3\n");
    totalFailures += timer3();          /* interval timer tests */
    rmonPrintf("controller: total number of failures: %d\n", totalFailures);
}

static void
idle(void *arg)
{
	for(;;);
}