//*********************************************************************** //** Function: Main //** Description: Entry point of user code //** Parameters: None //** Returns: None //*********************************************************************** void main() { uint8_t radio_id=0; psx_map psx_data; Init_mcu(); Init_Dig_IO(); init_sci(); init_spi_norm(); radio_channel = get_radio_channel(); init_radio(); init_psx(); RED_LED_ON; GREEN_LED_OFF; send_msg("\033[2J\033[HBootstrap successful. AW60 ready...\r\n\r\n"); send_msg("Schools Challenge Robot\r\n"); send_msg("=======================\r\n"); send_msg("Wireless chipset status: "); if(radio_get_id() == 0x07) send_msg("Pass\r\n\r\n"); else{ send_msg("Fail - Please contact vendor for repair\r\n"); for(;;); } send_msg("Ready...\r\n"); for(;;){ send_msg("Getting PSX status\r\n"); /* Get PSX status */ psx_get_stat(&psx_data); send_msg("Sending data\r\n"); /* Send data */ packet_tx(&psx_data, sizeof(psx_data)); send_msg("Waiting...\r\n\r\n"); /* Wait for 100ms */ delay_ms(100); } }
void entry(struct Multiboot_Info_dec * old_mbinfo) { // This function is entered into by the kernel header // which sets up some basic tables for use and passes on // the multiboot info structure struct Multiboot_Info_dec mbinfo; #ifdef DEBUG U8 * screen = (U8 *)0xB8000; U16 i; // Clear the screen so debug messages are more visible for (i = 0; i < 160; i+=2) { screen[i] = ' '; screen[i+1] = 0x17; } for (i = 160; i < 7840; i+=2) { screen[i] = ' '; screen[i+1] = 0x07; } dprint("\t\t\tThe Poseidon Project Kernel.\n\n"); dprint("The Poseidon Project (c) Copyright 1998, 1999 John Barker\n"); dprint("All rights reserved. 32 bit message based real time operating system.\n\n"); #endif // Copy the old table to a local one for safe keeping // because once memory is initialized the old one may be wiped memcpy(&mbinfo,old_mbinfo,sizeof(struct Multiboot_Info_dec)); // Set up the exception traps init_traps(); // Allocate the irq routines init_irqs(); // Initialize memory management so we can use kmalloc and other // memory based functions init_mm(&mbinfo); // Initialize the object manager so we can start using it init_obj(); // Initialize the module/driver interface so modules can be loaded init_mdi(); // Set up the clocks and timers init_time(); // Set up tables and data for the executive init_executive(); // Initialize IPC and message buffers for all objects init_ipc(); // Initialize the system calls (system call interface) init_sci(); // Load all the modules passed to us at boot time, one of these // should be init or main load_modules(&mbinfo); // Start the executive scheduler, will boot the init module start_executive(); // The idle function - just loop, should be run in user mode idle(); }