Exemple #1
0
/*
 * Starts all the other tasks, then starts the scheduler. 
 */
int main( void )
{
	xTaskHandle hdl1,hdl2,hdl3 = 0;
	int c = 'p';

	/* Setup the hardware for use with the Beableboard. */
	prvSetupHardware();


	memdump_32(0x4020ffc0, 64);

	printf("\nIn Main, please press a key\n");
	c = getc();
	printf("Your input %c\n", c);



int i;
	xTaskCreate(critical, ( signed char * ) "CRITICAL PRIORITY",256, (void *) NULL, 5, &hdl1);
	xTaskCreate(Scheduler, ( signed char * ) "Scheduler",256, (void *) NULL, 3, &hdl2);
	xTaskCreate(idle, ( signed char * ) "idle",256, (void *) NULL, 1, &hdl3);

	for(i=0;i<10;i++)
	xTaskCreateRT(real_time,(signed char *)i,256,i,2,(i+1)*1000,&handles[i]);	//create the real time tasks and schedule
	


	if(hdl2 == 0 || hdl1 ==0 || hdl3 == 0)	//i assume task creation always succeeds
	{
		printf("Task creation failed\n");
		return -1;
	}


	/* Now all the tasks have been stared - start the scheduler.
	 * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
	 * Te processor MUST be in supervisor mode when vTaskStartScheduler is called.
	 * The demo applications included in the the FreeRTOS.og download swith to supervisor
	 * mode prior to main being called. If you are not using one of these demo application
	 * projects then ensure Supervisor mode is used here */
	/* Should never reach here! */

	printf("Start FreeRTOS ...\n");

	vTaskStartScheduler();
	return 0;
}
/*
 * Starts all the other tasks, then starts the scheduler.
 */
int main(void *x)
{
    EFI_STATUS Status;
    uint16_t temp;
    uint32_t len;
    uefi_services = (EFI_RUNTIME_SERVICES*)x;
    xTaskHandle hdl = 0;
    int c = 'p';
    len = sizeof(uint16_t);

    temp = 80;
    Status = uefi_services->GetVariable((CHAR16*)var_name, &rtos_var, NULL, (UINTN*)&len, (UINTN*)&temp);
    printf("\nGetvariable value:%d\n", temp);


    /* Setup the hardware for use with the Beableboard. */
    prvSetupHardware();
    memdump_32(0x4020ffc0, 64);


    if (EFI_ERROR (Status)) {
        temp = 32;
    }

	printf("\nIn Main, please press a key\n");
	c = getc();
	printf("Your input %c\n", c);

	xTaskCreate(HelloWorld1, ( signed char * ) "HelloWorld1",
				configMINIMAL_STACK_SIZE, (void *) NULL, 1, &hdl);

	if(hdl == 0)
	{
		printf("Hello world 1 creation failed");
	}

	xTaskCreate(HelloWorld2, ( signed char * ) "HelloWorld2",
				configMINIMAL_STACK_SIZE, (void *) NULL, 1, &hdl);

	if(hdl == 0)
	{
		printf("Hello world 2 creation failed");
	}

	xTaskCreate(FlashLED1, ( signed char * ) "FlashLED1",
				configMINIMAL_STACK_SIZE, (void *) NULL, 1, &hdl);

	if(hdl == 0)
	{
		printf("Flash LED 1 creation failed");
	}

	xTaskCreate(FlashLED2, ( signed char * ) "FlashLED2",
				configMINIMAL_STACK_SIZE, (void *) NULL, 1, &hdl);

	if(hdl == 0)
	{
		printf("Flash LED 2 creation failed");
	}

	/* Now all the tasks have been stared - start the scheduler.
	 * NOTE : Tasks run in system mode and the scheduler runs in Supervisor mode.
	 * Te processor MUST be in supervisor mode when vTaskStartScheduler is called.
	 * The demo applications included in the the FreeRTOS.og download swith to supervisor
	 * mode prior to main being called. If you are not using one of these demo application
	 * projects then ensure Supervisor mode is used here */
	/* Should never reach here! */

	printf("Start FreeRTOS ...\n");

	vTaskStartScheduler();
	return 0;
}