Ejemplo n.º 1
0
Archivo: init.c Proyecto: AEUG/400plus
int my_usrInit(int startType) {
	sysHwInit0();

	bzero(&bss_begin, (&bss_begin - &bss_end));

	sysStartType = startType;
	intVecBaseSet(0);
	cacheLibInit(1, 2);
	excVecInit();
	sysHwInit();
	cacheEnable(0);
	cacheEnable(1);
	classLibInit();
	taskLibInit();

	qInit(&readyQHead,  qPriBMapClassId, &readyQBMap, 0x100);
	qInit(&activeQHead, qFifoClassId);
	qInit(&tickQHead,   qPriListClassId);

	workQInit();

	/* sysMemTop() - returns the LogBuffer address, the buffer is 1.5mb */
	kernelInit(my_usrRoot, 0x4000, &bss_end, sysMemTop(), 0xC00, 0);

	return 0;
}
Ejemplo n.º 2
0
int main (int argc, char *argv[ ], char *envp[ ])

//	main
//
//	main entry-point

	{
	if (!kernelInit())
		{
		printf("error : Unable to initialize Alchemy kernel.\n");
		return 1;
		}

	//	Do it

	{
	ALERROR error;
	CXMLElement *pCmdLine;
	if (error = CreateXMLElementFromCommandLine(argc, argv, &pCmdLine))
		{
		printf("error : Invalid command line.\n");
		kernelCleanUp();
		return 1;
		}

	TransCompiler(pCmdLine);

	delete pCmdLine;
	}

	//	Done

	kernelCleanUp();
	return 0;
	}
Ejemplo n.º 3
0
  virtual void init()
  {
    // Initialize OpenKernel
    kernel = kernelInit();

    // Open window
    mainDisplay = kernel->beginDisplay(0, "Main", true, 200, 150);
    kernel->endDisplay();
    if(mainDisplay == 0)
      return;

    displayChain = kernel->beginDisplayChain();

      kernel->display(mainDisplay, -1.0f, -1.0f, 1.0f, 1.0f);

    kernel->endDisplayChain();

    //(resize screen)
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glViewport(0, 0, 200, 150);
    glFrustum(-1.f, 1.f, -800.0f/600.0f, 800.0f/600.0f, 1.0f, 100.0f);
    glMatrixMode(GL_MODELVIEW);

    glShadeModel(GL_SMOOTH);
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    glClearDepth(1.0f);
    glEnable(GL_DEPTH_TEST);
    glDepthFunc(GL_LEQUAL);
    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
    glFlush();
  }
Ejemplo n.º 4
0
int main(void)
{
        kernelInit();
        initCtrDrv();

        initDriver(DRV_LED);
        initDriver(DRV_LCD);
        initDriver(DRV_BOT);
        initDriver(DRV_ADC);
        initDriver(DRV_SER);
        initDriver(DRV_TIM);
        initDriver(DRV_PWM);
        initDriver(DRV_INT);
        /* initDriver(DRV_PID); */
        /* initDriver(DRV_WDT); */

        /* Add a new process call style:
         * kernelAddProc(ptrFunc func, int stkSize, priorityMode newPrio);
         */
        kernelAddProc((void *) processa_comando,  100, NORMAL);
        kernelAddProc((void *) temperatura,       100, NORMAL);
        kernelAddProc((void *) procRelogio,       100, RTOS);
        kernelAddProc((void *) teclado,           100, NORMAL);
        /* kernelAddProc((void *) pisca_leds,     100, NORMAL); */
        /* kernelAddProc((void *) test_PWM,       100, NORMAL); */

        kernelLoop();
}
Ejemplo n.º 5
0
DWORD WINAPI kernelThreadProc (LPVOID pData)
	{
	THREADCTX *pCtx = (THREADCTX *)pData;

	LPTHREAD_START_ROUTINE pfStart = pCtx->pfStart;
	LPVOID pUserData = pCtx->pData;
	MemFree(pCtx);

	kernelInit();
	DWORD dwResult = pfStart(pUserData);
	kernelCleanUp();

	return dwResult;
	};
Ejemplo n.º 6
0
char *kernelRespond(char *text,char *id)
{	
	if (!kernelInitDone)
	{
		kernelInit();
		kernelInitDone=1;
	}
		

	char *ret=(char *)malloc(65536);
	memset(ret,0,65536);
	string aliceString = Kernel::respond(text,id);		
	sprintf(ret,"%s",aliceString.c_str());
	return ret;		
}
Ejemplo n.º 7
0
int main (int argc, char *argv[ ], char *envp[ ])

//	main
//
//	main entry-point

	{
	if (!kernelInit())
		{
		printf("ERROR: Unable to initialize Alchemy kernel.\n");
		return 1;
		}

	//	Do it

	GrailMain();

	//	Done

	kernelCleanUp();
	return 0;
	}
Ejemplo n.º 8
0
int main(int argc, char *argv[])
	// main
	//
	// Main SDL entry-point
	{
	if (!kernelInit())
		return 0;

	g_kbmap = new bool[SDLK_LAST];
	for (int i = 0; i < SDLK_LAST; i++)
		g_kbmap[i] = false;

	if (CreateMainWindow())
		{
		if (TTF_WasInit())
			TTF_Quit();
		kernelCleanUp();
		delete []g_kbmap;
		return 0;
		}

	atexit(SDL_Quit);

	MainLoop();

	DestroyMainWindow();

	delete []g_kbmap;

	kernelCleanUp();

	SDL_Quit();
	if (TTF_WasInit())
		TTF_Quit();

	return 0;
	}
Ejemplo n.º 9
0
int main (int argc, char *argv[ ], char *envp[ ])

//	main
//
//	main entry-point

	{
	int iResult;

	if (!kernelInit())
		{
		printf("ccshell: Unable to initialize Alchemy kernel.\n");
		return 1;
		}

	//	Do it

	{
	ALERROR error;
	CXMLElement *pCmdLine;
	if (error = CreateXMLElementFromCommandLine(argc, argv, &pCmdLine))
		{
		PrintError(ERR_UNABLE_TO_PARSE_COMMAND_LINE);
		return 1;
		}

	iResult = AlchemyMain(pCmdLine);

	delete pCmdLine;
	}

	//	Done

	kernelCleanUp();
	return iResult;
	}
Ejemplo n.º 10
0
void usrInit
    (
    int startType
    )
    {
    /*
     * This trap will catch improper loading of the data section.
     * We check the magic cookie values to make sure the data section is
     * in the expected memory location. We do not want
     * to proceed further if the data segment is not correct.
     *
     * It should be easy to detect entry into the trap using an ICE, JTAG,
     * or logic analyzer. Without the trap, the processor is likely to run
     * away out of control.
     *
     * Data section misalignment can occur when there is a change in tool
     * chain, build rules, compiler, host utilites,  etc. 
     */

    while (trapValue1 != TRAP_VALUE_1 || trapValue2 != TRAP_VALUE_2)
	{
	/* infinite loop */;
	}
    
#if	(CPU_FAMILY == SPARC)
    excWindowInit ();				/* SPARC window management */
#endif

#ifdef INCLUDE_SYS_HW_INIT_0
    /*
     * Perform any BSP-specific initialisation that must be done before
     * cacheLibInit() is called and/or BSS is cleared.
     */

    SYS_HW_INIT_0 ();
#endif /* INCLUDE_SYS_HW_INIT_0 */

    /* configure data and instruction cache if available and leave disabled */

#ifdef  INCLUDE_CACHE_SUPPORT
    /*
     * SPR 73609:  If a cache is not to be enabled, don't require
     * its mode to be defined.  Instead, default it to disabled.
     */
# if (!defined(USER_D_CACHE_ENABLE) && !defined(USER_D_CACHE_MODE))
#  define USER_D_CACHE_MODE CACHE_DISABLED
# endif	/* !USER_D_CACHE_ENABLE && !USER_D_CACHE_MODE */
# if (!defined(USER_I_CACHE_ENABLE) && !defined(USER_I_CACHE_MODE))
#  define USER_I_CACHE_MODE CACHE_DISABLED
# endif	/* !USER_I_CACHE_ENABLE && !USER_I_CACHE_MODE */

    cacheLibInit (USER_I_CACHE_MODE, USER_D_CACHE_MODE);
#endif  /* INCLUDE_CACHE_SUPPORT */

#if	CPU_FAMILY!=SIMNT && CPU_FAMILY!=SIMSPARCSUNOS && CPU_FAMILY!=SIMHPPA && CPU_FAMILY!=SIMSPARCSOLARIS
    /* don't assume bss variables are zero before this call */

    bzero (edata, end - edata);		/* zero out bss variables */
#endif	/* CPU_FAMILY!=SIMNT && CPU_FAMILY!=SIMSPARCSUNOS && CPU_FAMILY!=SIMHPPA && CPU_FAMILY!=SIMSPARCSOLARIS */

#if (CPU_FAMILY == PPC)
    /*
     * Immediately after clearing the bss, ensure global stdin
     * etc. are ERROR until set to real values.  This is used in
     * target/src/arch/ppc/excArchLib.c to improve diagnosis of
     * exceptions which occur before I/O is set up.
     */
    ioGlobalStdSet (STD_IN,  ERROR);
    ioGlobalStdSet (STD_OUT, ERROR);
    ioGlobalStdSet (STD_ERR, ERROR);
#endif  /* CPU_FAMILY == PPC */

    sysStartType = startType;			/* save type of system start */

    intVecBaseSet ((FUNCPTR *) VEC_BASE_ADRS);	/* set vector base table */

#if (CPU_FAMILY == AM29XXX)
    excSpillFillInit ();			/* am29k stack cache managemt */
#endif

#ifdef  INCLUDE_EXC_HANDLING
# if (CPU_FAMILY == PPC) && defined(INCLUDE_EXC_SHOW)
    /*
     * Do this ahead of excVecInit() to set up _func_excPanicHook, in case
     * the enabling of Machine Check there allows a pending one to occur.
     * excShowInit() will be called again later, harmlessly.
     */
    excShowInit ();
# endif  /* CPU_FAMILY == PPC && defined(INCLUDE_EXC_SHOW) */
    excVecInit ();				/* install exception vectors */
#endif  /* INCLUDE_EXC_HANDLING */

    sysHwInit ();				/* initialize system hardware */

    usrKernelInit ();				/* configure the Wind kernel */

#ifdef INCLUDE_USB 
#   ifdef INCLUDE_OHCI_PCI_INIT
        sysUsbPciOhciInit ();
#   endif
#endif

#ifdef  INCLUDE_CACHE_SUPPORT
#ifdef 	USER_I_CACHE_ENABLE
    cacheEnable (INSTRUCTION_CACHE);		/* enable instruction cache */
#endif	/* USER_I_CACHE_ENABLE */

#ifdef	USER_D_CACHE_ENABLE
    cacheEnable (DATA_CACHE);			/* enable data cache */
#endif 	/* USER_D_CACHE_ENABLE */

#if (CPU == MC68060)
#ifdef 	USER_B_CACHE_ENABLE
    cacheEnable (BRANCH_CACHE);			/* enable branch cache */
#endif	/* USER_B_CACHE_ENABLE */
#endif	/* (CPU == MC68060) */
#endif  /* INCLUDE_CACHE_SUPPORT */

    /* start the kernel specifying usrRoot as the root task */

    kernelInit ((FUNCPTR) usrRoot, ROOT_STACK_SIZE,
		(char *) MEM_POOL_START_ADRS,
		sysMemTop (), ISR_STACK_SIZE, INT_LOCK_LEVEL);
    }