void a_main(int parameter) { /* //Place these as necessary to display output if not already doing so inside the RTOS //initialize pins DDRB |= (1<<PB1); //pin 52 DDRB |= (1<<PB2); //pin 51 DDRB |= (1<<PB3); //pin 50 PORTB |= (1<<PB1); //pin 52 on PORTB |= (1<<PB2); //pin 51 on PORTB |= (1<<PB3); //pin 50 on PORTB &= ~(1<<PB1); //pin 52 off PORTB &= ~(1<<PB2); //pin 51 off PORTB &= ~(1<<PB3); //pin 50 off */ mut = Mutex_Init(); evt = Event_Init(); Task_Create(Task_P1, 1, 0); Task_Create(Task_P2, 2, 0); pid = Task_Create(Task_P3, 3, 0); }
void a_main() { DDRB = 0xF0; PORTB = 0x00; blink_increment = Event_Init(); //1. Start Task_2 Task_Create(Task_2, 0, 0); }
void a_main(){ DDRB = 0xF0; PORTB = 0x00; mut = Mutex_Init(); evt = Event_Init(); _delay_ms(4000); Task_Create(Task_P1, 1, 0); Task_Create(Task_P2, 2, 0); Task_Create(Task_P3, 3, 0); Task_Create(Task_P4, 10, 0); }
void a_main(){ DDRA |= (1<<PA0); DDRA |= (1<<PA1); DDRA |= (1<<PA2); DDRA |= (1<<PA3); PORTA &= ~(1<<PA0); PORTA &= ~(1<<PA1); PORTA &= ~(1<<PA2); PORTA &= ~(1<<PA3); e=Event_Init(); Task_Create(Ping,1,0); Task_Create(Pong,1,0); Task_Terminate(); }
int main(int argc, char *argv[]) { motor_t rightMotor = { &PORTB, &DDRB, PORTB7, // PWM &PORTC, &DDRC, PORTC1, // Direction &OCR0A // Top value }; motor_t leftMotor = { &PORTD, &DDRD, PORTD0, // PWM &PORTB, &DDRB, PORTB0, // Direction &OCR0B // Top value }; //uint8_t sonarDistance = 0; cli(); NO_CLK_PRESCALE(); //uart_init(); radio_init(HOV1_ADDRESS, RECEIVE_MODE); sonar_init(); motorInit(&rightMotor); motorInit(&leftMotor); pwmInit(); sei(); stop = Event_Init(); sendPing(); while(!receivedInit); Task_Create((void*)(&motor_task),0, PERIODIC, MOTOR); Task_Create((void*)(&fire_sonar),0, PERIODIC, FIRE); Task_Create((void*)(&listen_sonar),0,PERIODIC, LISTEN); Task_Create((void*)(&sendRadio),0,PERIODIC, RADIO); Task_Create((void*)(&stopSystem), 0,SYSTEM, STOP); setMotorDirection(&rightMotor, FORWARD); setMotorDirection(&leftMotor, FORWARD); return 0; }
int main(void) { /* setup the test */ uart_init(); uart_write((uint8_t*)"\r\nSTART\r\n", 9); set_test(3); print_event = Event_Init(); Task_Create(generic_task, 1, RR, A); Task_Create(generic_task, 2, RR, B); Task_Create(generic_task, 3, RR, C); Task_Create(generic_task, 4, RR, D); Task_Create(generic_task, 5, RR, E); Task_Create(generic_task, 6, RR, F); Event_Wait(print_event); print_trace(); }
int main(void) { /* setup the test */ uart_init(); uart_write((uint8_t*)"\r\nSTART\r\n", 9); set_test(2); print_event = Event_Init(); Task_Create(generic_task, A, PERIODIC, A); Task_Create(generic_task, B, PERIODIC, B); Task_Create(generic_task, C, PERIODIC, C); Task_Create(generic_task, D, PERIODIC, D); Task_Create(generic_task, E, PERIODIC, E); Task_Create(generic_task, F, PERIODIC, F); Event_Wait(print_event); print_trace(); }
void a_main() { mut = Mutex_Init(); evt = Event_Init(); Task_Create(Task_P1, 1, 0); Task_Create(Task_P2, 2, 0); Task_Create(Task_P3, 3, 0); Task_Create(Idle, 10, 0); disable_LED(PORTL0); disable_LED(PORTL2); disable_LED(PORTL5); disable_LED(PORTL6); enable_LED(PORTL0); disable_LED(PORTL0); Task_Terminate(); }
int main(void) { int ret; void *frame_buffer = NULL; GXRModeObj *rmode = NULL; /* The game's boot loader is statically loaded at 0x81200000, so we'd better * not start mallocing there! */ SYS_SetArena1Hi((void *)0x81200000); /* initialise all subsystems */ if (!Event_Init(&main_event_fat_loaded)) goto exit_error; if (!Apploader_Init()) goto exit_error; if (!Module_Init()) goto exit_error; if (!Search_Init()) goto exit_error; /* main thread is UI, so set thread prior to UI */ LWP_SetThreadPriority(LWP_GetSelf(), THREAD_PRIO_UI); /* configure the video */ VIDEO_Init(); rmode = VIDEO_GetPreferredMode(NULL); frame_buffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode)); if (!frame_buffer) goto exit_error; console_init( frame_buffer, 20, 20, rmode->fbWidth, rmode->xfbHeight, rmode->fbWidth * VI_DISPLAY_PIX_SZ); /* spawn lots of worker threads to do stuff */ if (!Apploader_RunBackground()) goto exit_error; if (!Module_RunBackground()) goto exit_error; if (!Search_RunBackground()) goto exit_error; VIDEO_Configure(rmode); VIDEO_SetNextFramebuffer(frame_buffer); VIDEO_SetBlack(false); VIDEO_Flush(); VIDEO_WaitVSync(); if (rmode->viTVMode & VI_NON_INTERLACE) VIDEO_WaitVSync(); /* display the welcome message */ printf("\x1b[2;0H"); printf("BrainSlug Wii v%x.%02x.%04x" #ifndef NDEBUG " DEBUG build" #endif "\n", BSLUG_VERSION_MAJOR(BSLUG_LOADER_VERSION), BSLUG_VERSION_MINOR(BSLUG_LOADER_VERSION), BSLUG_VERSION_REVISION(BSLUG_LOADER_VERSION)); printf(" by Chadderz\n\n"); if (!__io_wiisd.startup() || !__io_wiisd.isInserted()) { printf("Please insert an SD card.\n\n"); do { __io_wiisd.shutdown(); } while (!__io_wiisd.startup() || !__io_wiisd.isInserted()); } __io_wiisd.shutdown(); if (!fatMountSimple("sd", &__io_wiisd)) { fprintf(stderr, "Could not mount SD card.\n"); goto exit_error; } Event_Trigger(&main_event_fat_loaded); printf("Waiting for game disk...\n"); Event_Wait(&apploader_event_disk_id); printf("Game ID: %.4s\n", os0->disc.gamename); printf("Loading modules...\n"); Event_Wait(&module_event_list_loaded); if (module_list_count == 0) { printf("No valid modules found!\n"); } else { size_t module; printf( "%u module%s found.\n", module_list_count, module_list_count > 1 ? "s" : ""); for (module = 0; module < module_list_count; module++) { printf( "\t%s %s by %s (", module_list[module]->name, module_list[module]->version, module_list[module]->author); Main_PrintSize(module_list[module]->size); puts(")."); } Main_PrintSize(module_list_size); puts(" total."); } Event_Wait(&apploader_event_complete); Event_Wait(&module_event_complete); fatUnmount("sd"); __io_wiisd.shutdown(); if (module_has_error) { printf("\nPress RESET to exit.\n"); goto exit_error; } if (apploader_game_entry_fn == NULL) { fprintf(stderr, "Error... entry point is NULL.\n"); } else { if (module_has_info || search_has_info) { printf("\nPress RESET to launch game.\n"); while (!SYS_ResetButtonDown()) VIDEO_WaitVSync(); while (SYS_ResetButtonDown()) VIDEO_WaitVSync(); } SYS_ResetSystem(SYS_SHUTDOWN, 0, 0); apploader_game_entry_fn(); } ret = 0; goto exit; exit_error: ret = -1; exit: while (!SYS_ResetButtonDown()) VIDEO_WaitVSync(); while (SYS_ResetButtonDown()) VIDEO_WaitVSync(); VIDEO_SetBlack(true); VIDEO_Flush(); VIDEO_WaitVSync(); free(frame_buffer); exit(ret); return ret; }