コード例 #1
0
ファイル: kernel.c プロジェクト: hellbender-os/hellbender-os
void kernel_main() {
  // enter user mode the first time somewhat manually:
  scheduler_run(0);
  --cpu.nested_isr;
  asm volatile ( "jmp isr_to_usermode" );
  __builtin_unreachable();
}
コード例 #2
0
int main()
{
    //initialise the platform itself
	__platform_init();
    //do not initialise the scheduler, this is done by __framework_bootstrap()
    __framework_bootstrap();
    //initialise platform functionality that depends on the framework
    __platform_post_framework_init();
    scheduler_run();
    return 0;
}
コード例 #3
0
ファイル: test3B.c プロジェクト: branstem/OperationAwesome
int main(void)
{
	struct sched_t sched[NUM_LEDS];
	
	init_microcontroller();
	scheduler_fill(sched, 1, 1, 1);
	for (;;)
	{
		scheduler_run(sched);
	}
}
コード例 #4
0
int main(void)
{
	serial_init();
	
	global = 0;
	binToDecDigits(global, disp, 4);
	
    scheduler_init(disp);
	scheduler_addPeriodicTask(task2, 100);
	scheduler_run();
}
コード例 #5
0
ファイル: test4.c プロジェクト: branstem/OperationAwesome
int main(void)
{
	int i, j;
	uint16_t value;
	uint8_t adc_value;  //variable store value from conversion
	struct sched_t sched[NUM_LEDS];
	init_microcontroller();
	for (;;)
	{
		adc_value = read_ADC();
		//if (adc_value > 155)
		if (adc_value > ADC_ZERO + (EPSILON / 2))
		{
			// light blue radially from center
			scheduler_fill(sched, 0, 1, 0);
			scheduler_schedule_color(&sched[0], 0, 0, 1);
			value = ADC_ZERO + EPSILON;
			for (i=1; i<NUM_LEDS && value < 256; i++)
			{
				if (adc_value > value)
					scheduler_schedule_color(&sched[i], 0, 0, 1);
				else
					break;
				value += 10;
			}			
		}			
		else if (adc_value < ADC_ZERO - (EPSILON / 2))
		{
			// light red radially from center
			scheduler_fill(sched, 0, 1, 0);
			scheduler_schedule_color(&sched[0], 1, 0, 0);
			value = ADC_ZERO - EPSILON;
			for (i=1; i<NUM_LEDS && value >= 0; i++)
			{
				if (adc_value < value)
					scheduler_schedule_color(&sched[i], 1, 0, 0);
				else
					break;
				value -= 10;
			}			
		}								
		else
		{
			// at rest. light all green
			scheduler_fill(sched, 0, 1, 0);
		}			
		
		for (i=0; i<10; i++)
			scheduler_run(sched);
	}
	
	return 0;
}
コード例 #6
0
int main (void)
{

    __platform_init();

    __framework_bootstrap();

    //__platform_post_framework_init();

    scheduler_run();

    return 0;
}
コード例 #7
0
int main(void)
{
	binToDecDigits(1234, display, 4);
	
    scheduler_init(display);
	serial_init(onReceive);
	
	scheduler_addPeriodicTask(sendText, 5000);
	
	LCD_Initalize();
	LCD_Command(HD44780_DISPLAY_ONOFF|HD44780_DISPLAY_ON);
	LCD_Text("Ala ma kota!");
	
	scheduler_run();
}
コード例 #8
0
ファイル: scheduler_test.c プロジェクト: yaojiadong/2016_ses
int main(void) {
	button_init(true);
	led_greenInit();
	led_yellowInit();
	led_redInit();//testing
	lcd_init();
	scheduler_init();

//5.2.1:toggle green led every 2s
	taskDescriptor td1; //= (taskDescriptor*) malloc(sizeof(taskDescriptor));
	td1.task = &wrapper_greenToggle;
	//td.param = &;  //void pointer point to void, param is of type void
	td1.expire = 2000;
	td1.period = 2000;
	td1.execute = 0;
	td1.next = NULL;
	scheduler_add(&td1);

//5.2.2: schedule button_checkState
	taskDescriptor td2; //= (taskDescriptor*) malloc(sizeof(taskDescriptor));
	td2.task = &wrapper_button_checkState;
	//td.param = &;  //void pointer point to void, param is of type void
	td2.expire = 0;
	td2.period = 5;
	td2.execute = 0;
	td2.next = NULL;
	scheduler_add(&td2);

//5.2.3: scheduler or button click determines the situation
	button_setJoystickButtonCallback(control_yellow);

//5.2.4 :schedule stopwatch
	fprintf(lcdout, "Please press the rotary button to start the stopwatch");
	button_setRotaryButtonCallback(stopWatch);

	taskDescriptor td5; //= (taskDescriptor*) malloc(sizeof(taskDescriptor));
	td5.task = &calc_time;
	//td5.param = ;  //void pointer point to void, param is of type void
	td5.expire = 0; //immediately run
	td5.period = 100; //0.1s
	td5.execute = 0;
	td5.next = NULL;
	scheduler_add(&td5);

	sei();
	scheduler_run();
	return 1;
}
コード例 #9
0
int main(){
	//BSP_TraceProfilerSetup();
    // Only when using bootloader
	//SCB->VTOR=0x4000;

	//activate VCOM

    //initialise the platform itself
	__platform_init();
    //do not initialise the scheduler, this is done by __framework_bootstrap()
    __framework_bootstrap();
    //initialise platform functionality that depends on the framework
    __platform_post_framework_init();
    scheduler_run();
    return 0;
}
コード例 #10
0
ファイル: main.c プロジェクト: yaojiadong/2016_ses
int main() {

//task 6.1
	pButtonCallback joystickButton = wrapper_pwm;
	button_init(true); //debouncing, timer1 is initialized in this function
	button_setJoystickButtonCallback(joystickButton);

	pwm_init();
	pwm_setDutyCycle(0); //initially motor idle

//task 6.2,6.3
	lcd_init();
	led_yellowInit();
	led_greenInit();
	scheduler_init(); // timer2_start() is called there.
	motorFrequency_init(); //timer 5 and external interrupt settings

	taskDescriptor td1; //= (taskDescriptor*) malloc(sizeof(taskDescriptor));
	td1.task = &display;
//td.param = &;  //void pointer point to void, param is of type void
	td1.expire = 0;
	td1.period = 500; //timer2 INT every 1ms
	td1.execute = 0;
	td1.next = NULL;
	scheduler_add(&td1);

//task6.4
	uart_init(57600); //debugging

	pidData_t pidData;
	pid_Init(P * SCALING_FACTOR, I* SCALING_FACTOR, D *SCALING_FACTOR, &pidData); //set p=0; i=1.5, d=0;
	taskDescriptor td2; //= (taskDescriptor*) malloc(sizeof(taskDescriptor));
	td2.task = &wrapper_pid;
	td2.param = &pidData;  //void pointer point to void, param is of type void
	td2.expire = 0;
	td2.period = 200; //timer2 INT every 1ms
	td2.execute = 0;
	td2.next = NULL;
	scheduler_add(&td2);

	sei();
	scheduler_run();
	return 0;
}
コード例 #11
0
ファイル: main.c プロジェクト: codesofsamar/ATMega128RFA1
int main() {

	/* Initialize the FSM clock */
	clock_init();


	/* Enable global interrupts */
	sei();


	/**
	 * All other necessary peripherals and the scheduler are
	 * initialized in ses_alarm.c
	 */
	for (;;) {
		scheduler_run();
	}
	return 0;
}
コード例 #12
0
int main()
{
	//BSP_TraceProfilerSetup();
    // Only when using bootloader
	//SCB->VTOR=0x4000;

	//activate VCOM
#ifdef PLATFORM_USE_VCOM
	hw_gpio_configure_pin(VCOM_ENABLE, false, gpioModePushPull, 1);
	hw_gpio_set(VCOM_ENABLE);
#endif

    //initialise the platform itself
	__platform_init();
    //do not initialise the scheduler, this is done by __framework_bootstrap()
    __framework_bootstrap();
    //initialise platform functionality that depends on the framework
    __platform_post_framework_init();
    scheduler_run();
    return 0;
}
コード例 #13
0
ファイル: console.c プロジェクト: Haxinos/metasploit
/*
 * Process console commands in a loop
 *
 * I would use the scheduler but allowing the file descriptor to drop
 * into non-blocking mode makes things annoying.
 */
VOID console_process_commands(Remote *remote)
{
	SOCKET fd = remote_get_fd(remote);
	struct timeval tv;
	fd_set fdread;
	LONG r;

	console_write_prompt();

	// Execute the scheduler in a loop
	while (1)
	{
		FD_ZERO(&fdread);
		FD_SET(fd, &fdread);

		tv.tv_sec  = 0;
		tv.tv_usec = 100;

		if ((r = select(fd + 1, &fdread, NULL, NULL, &tv)) > 0)
		{
			LONG bytes = 0;

			ioctlsocket(fd, FIONREAD, &bytes);

			if (bytes == 0)
			{
				console_write_output(
						"\n"
						"Connection reset by peer.\n");
				break;
			}

			command_process_remote(remote, NULL);
		}
		else if (r < 0)
			break;

		scheduler_run(remote, 0);
	}
}
コード例 #14
0
ファイル: server_setup.c プロジェクト: lizard007/msf3
/*
 * Monitor for requests and local waitable items in the scheduler
 */
static DWORD monitor_loop(Remote *remote)
{
	DWORD hres = ERROR_SUCCESS;
	SOCKET fd = remote_get_fd(remote);
	fd_set fdread;
    
	/*
	 * Read data locally and remotely
	 */
	while (1)
	{
		struct timeval tv;
		LONG data;

		FD_ZERO(&fdread);
		FD_SET(fd, &fdread);

		tv.tv_sec  = 0;
		tv.tv_usec = 100;

		data = select(fd + 1, &fdread, NULL, NULL, &tv);

		if (data > 0)
		{
			if ((hres = command_process_remote(remote, NULL)) != ERROR_SUCCESS)
				break;
		}
		else if (data < 0)
			break;

		// Process local scheduler items
		scheduler_run(remote, 0);
	}

	return hres;
}
コード例 #15
0
void global_scheduler_context_switch()
{
    gptimer_clear(GPTIMER_SCHEDULER);
    scheduler_run(global_scheduler);
}