int main(int argc, char** argv) { pic_setup(); volatile int i=0; int div=100 ; int gate1=300; int gate2=1000; int t1 = gate1; int t2 = gate2-t1; while (1) { sound(300,30); sound(150,45); } while (1) { DEBUG_LED = 1; for (i=0; i<t1; i+=1) { __delay_us(1); } DEBUG_LED = 0; for (i=0; i<t2; i+=1) { __delay_us(1); } t1+=div; t2-=div; if (t1>gate2 || t1<gate1) { div=-div;; } } return (EXIT_SUCCESS); }
static void platform_hardware_setup(void) { // Enable CPU caching setcr0(getcr0() & ~(CR0_CD|CR0_NW)); // Make sure legacy DMA isn't running. dma_setup(); // Init base pc hardware. pic_setup(); mathcp_setup(); timer_setup(); clock_setup(); // Platform specific setup qemu_platform_setup(); coreboot_platform_setup(); }
static void platform_hardware_setup(void) { // Make sure legacy DMA isn't running. dma_setup(); // Init base pc hardware. pic_setup(); thread_setup(); mathcp_setup(); // Platform specific setup qemu_platform_setup(); coreboot_platform_setup(); // Setup timers and periodic clock interrupt timer_setup(); clock_setup(); // Initialize TPM tpm_setup(); }
// Main setup code. static void maininit(void) { // Setup romfile items. qemu_cfg_romfile_setup(); coreboot_cbfs_setup(); // Setup ivt/bda/ebda init_ivt(); init_bda(); // Init base pc hardware. pic_setup(); timer_setup(); mathcp_setup(); // Initialize pci pci_setup(); smm_init(); // Initialize mtrr mtrr_setup(); // Setup Xen hypercalls xen_init_hypercalls(); // Initialize internal tables boot_setup(); // Start hardware initialization (if optionrom threading) if (CONFIG_THREADS && CONFIG_THREAD_OPTIONROMS) init_hw(); // Find and initialize other cpus smp_probe(); // Setup interfaces that option roms may need bios32_setup(); pmm_setup(); pnp_setup(); kbd_setup(); mouse_setup(); init_bios_tables(); // Run vga option rom vga_setup(); // Do hardware initialization (if running synchronously) if (!CONFIG_THREADS || !CONFIG_THREAD_OPTIONROMS) { init_hw(); wait_threads(); } // Run option roms optionrom_setup(); // Run BCVs and show optional boot menu boot_prep(); // Finalize data structures before boot cdemu_setup(); pmm_finalize(); malloc_finalize(); memmap_finalize(); // Setup bios checksum. BiosChecksum -= checksum((u8*)BUILD_BIOS_ADDR, BUILD_BIOS_SIZE); // Write protect bios memory. make_bios_readonly(); // Invoke int 19 to start boot process. startBoot(); }
void main_bsp(void) { // Print header screen_write("Hydrogen v0.2b - http://github.com/farok/H2", 0, 0); screen_write("Copyright (c) 2012 by Lukas Heidemann", 0, 1); screen_write("-------------------------------------------------", 0, 2); // Load the IDT idt_load(idt_address, IDT_LENGTH); idt_setup_loader(); // Initialize Hydrogen info tables and parse the multiboot tables info_init(); multiboot_parse(); // Setup the heap heap_init(); // Now parse the ACPI tables and analyze the IO APICs acpi_parse(); ioapic_analyze(); // Find, check and load the kernel binary kernel_find(); kernel_check(); elf64_load(kernel_binary); kernel_analyze(); // Initialize interrupt controllers lapic_detect(); lapic_setup(); ioapic_setup_loader(); pic_setup(); // Calibrate the LAPIC timer lapic_timer_calibrate(); // Boot APs info_cpu[lapic_id()].flags |= HY_INFO_CPU_FLAG_BSP; smp_setup(); // Setup IDT and IOAPIC according to kernel header idt_setup_kernel(); ioapic_setup_kernel(); // Setup fast syscall support syscall_init(); // Setup mapping kernel_map_info(); kernel_map_stack(); kernel_map_idt(); kernel_map_gdt(); // Set free address info_root->free_paddr = (heap_top + 0xFFF) & ~0xFFF; // Lower main entry barrier and jump to the kernel entry point main_entry_barrier = 0; kernel_enter_bsp(); }