uint32_t gppic_probe(device_t *dev, void *config) { /* local vars */ int i; /* create info_t structure: */ info_t *info = (info_t *) kmalloc(sizeof(info_t)); dev->drvreg = (uint32_t) info; if (info == NULL) return ENOMEM; /* print something */ printk("PIC device driver is loading...\n"); /* store data: */ info->picreg = (uint32_t *) dev->resources.list[0].data.mem.base; /* Initialize IRQs: */ for (i = 0; i < 8; i++) irq_setup(i, dev); /* Enable IRQ system: */ enable_irq_system(); /* finally enable PIC */ *info->picreg = 1; /* done */ return ESUCCESS; }
void __init init_IRQ(void) { extern void __init init_generic_irq(void); init_generic_irq(); irq_setup(); }
void __init init_IRQ(void) { /* Invoke board-specific irq setup */ irq_setup(); #ifdef CONFIG_REMOTE_DEBUG extern void breakpoint(void); extern void set_debug_traps(void); extern void rs_kgdb_hook(void); rs_kgdb_hook(); clear_cp0_status(STATUSF_IP2); clear_cp0_status(STATUSF_IP3); clear_cp0_status(STATUSF_IP4); clear_cp0_status(STATUSF_IP5); clear_cp0_status(STATUSF_IP6); clear_cp0_status(STATUSF_IP7); printk("Wait for gdb client connection ...\n"); set_debug_traps(); set_cp0_status(STATUSF_IP2); set_cp0_status(STATUSF_IP3); set_cp0_status(STATUSF_IP4); set_cp0_status(STATUSF_IP5); set_cp0_status(STATUSF_IP6); set_cp0_status(STATUSF_IP7); breakpoint(); #endif }
/*********************************************************** * Name: * main * Description: * Start Function of the Kernel * Parameter: * ReturnValue: * EXIT_SUCCESS * **********************************************************/ void main() { /* Global Descriptor Table setup */ gdt_setup(); /* Interrupt Descriptor Table setup */ idt_setup(); /* Setup Interrupts */ irq_setup(); /* Setup Empty Devices */ device_setup(); /* Initialize Video Device -> Device does not send Interrupts */ initializeDevice(0,(char *)0xB8000,DEVICE_VIDEO,NULL,IRQ_EMPTY); /* Initialize Keyboard Handler */ initializeDevice(1,NULL,DEVICE_KEYBOARD,irq_keyboard_handler,IRQ_KEYBOARD); /* set Video Device for Console */ setVideoDevice(getDevice(0,DEVICE_VIDEO)); /* Initialize the Character Buffer */ initLineBuffer(); /* Clear Screen on Video Device */ clear_screen(); /* Printing OS Headers */ printf("\t\t-------------------------\n", C437_GREEN); printf("\t\tWELLCOME TO "OS_NAME"\n", C437_GREEN); printf("\t\t-------------------------\n", C437_GREEN); printf("\t\t"OS_NAME" version "OS_VERSION", Copyright (C) 2012 Simon Sommer\n", C437_CYAN); printf("\t\t"OS_NAME" comes with ABSOLUTELY NO WARRANTY.\n", C437_CYAN); printf("\t\tThis is free software, and you are\n", C437_CYAN); printf("\t\twelcome to redistribute it under certain conditions.\n", C437_CYAN); /* Enable Full 4GB Memory */ enableA20(); printf("\t\tA20 GATE ACTIVATED\n", C437_GREEN); /* Gives Feedback of previus done Tasks */ printf("\t\tGDT SETUP DONE\n", C437_GREEN); printf("\t\tIDT SETUP DONE\n", C437_GREEN); printf("\t\tIRQ SETUP DONE\n", C437_GREEN); /* Enable Iterrupts */ __asm__ __volatile__ ("sti"); printf("\t\tINTERRUPTS ENABLED\n", C437_GREEN); while(1); /* TODO: Malloc and Free Debug and Final Test */ }
void setup_interrupts(void) { if(!idt_setup()) puts("Error while setting up IDT"); else if(!isrs_setup()) puts("Error while setting up ISRs"); else if(!irq_setup()) puts("Error while setting up IRQs"); else if(!timer_setup()) puts("Error while setting up timer"); else puts("interruptions setup correctly"); }
void __init init_IRQ(void) { #ifdef CONFIG_REMOTE_DEBUG extern void breakpoint(void); extern void set_debug_traps(void); printk("Wait for gdb client connection ...\n"); set_debug_traps(); breakpoint(); #endif /* Invoke board-specific irq setup */ irq_setup(); }
int main() { gdt_setup(); idt_setup(); isr_setup(); init_video(); irq_setup(); __asm__ __volatile__ ("sti"); timer_setup(); keyboard_setup(); puts(" Welcome to TIK! \n"); for (;;); return 0; }
/* * C runtime initialization. * This will be called from rom_startup.s */ void rom_startup(void) { void (*lmt_app_entry)(void) = (void *)LMT_APP_ADDR; extern uint32_t __bss_start[]; extern uint32_t __data_vma[]; extern uint32_t __data_lma[]; extern uint32_t __data_size[]; extern uint32_t __bss_end[]; /* Zero out bss */ memset(__bss_start, 0x00, (uint32_t)__bss_end - (uint32_t)__bss_start); /* Copy initialised variables */ memcpy(__data_vma, __data_lma, (size_t)__data_size); power_setup(); clock_setup(); boot_sense_jtag_probe(); /* Interrupt initialisation */ irq_setup(); idt_init(); boot_aon_handle_spurious_irq(); #if (DEBUG) qm_int_vector_request(QM_X86_DOUBLE_FAULT_INT, double_fault_isr); #endif soc_boot_init_interrupt_controller(); __asm__ __volatile__("sti"); #if (ENABLE_FIRMWARE_MANAGER) fm_hook(); #endif /* ENABLE_FIRMWARE_MANAGER */ /* * Execute application on Lakemont, provided that the application has * been * programmed. */ /* Execute application, provided that it has been programmed. */ if (0xffffffff != *(uint32_t *)LMT_APP_ADDR) { lmt_app_entry(); } soc_boot_sleep(); }
void __init init_IRQ(void) { #ifdef CONFIG_KGDB extern void breakpoint(void); extern void set_debug_traps(void); printk("Wait for gdb client connection ...\n"); set_debug_traps(); breakpoint(); #endif /* set up default irq controller */ init_generic_irq(); /* invoke board-specific irq setup */ irq_setup(); }
int main(void) { u8 channel_array[16]; rcc_clock_setup_in_hse_12mhz_out_72mhz(); gpio_setup(); usart_setup(); timer_setup(); irq_setup(); adc_setup(); gpio_set(GPIOA, GPIO8); /* LED1 on */ gpio_set(GPIOC, GPIO15); /* LED2 on */ /* Send a message on USART1. */ usart_send_blocking(USART2, 's'); usart_send_blocking(USART2, 't'); usart_send_blocking(USART2, 'm'); usart_send_blocking(USART2, '\r'); usart_send_blocking(USART2, '\n'); /* Select the channel we want to convert. 16=temperature_sensor. */ channel_array[0] = 16; /* Set the injected sequence here, with number of channels */ adc_set_injected_sequence(ADC1, 1, channel_array); /* Continously convert and poll the temperature ADC. */ while (1) { /* * Since sampling is triggered by the timer and copying the value * out of the data register is handled by the interrupt routine, * we just need to print the value and toggle the LED. It may be useful * to buffer the adc values in some cases. */ /* * That's actually not the real temperature - you have to compute it * as described in the datasheet. */ my_usart_print_int(USART2, temperature); gpio_toggle(GPIOA, GPIO8); /* LED2 on */ } return 0; }
int main(void) { rcc_clock_setup_in_hse_12mhz_out_72mhz(); gpio_setup(); usart_setup(); timer_setup(); irq_setup(); adc_setup(); gpio_set(GPIOA, GPIO8); /* LED1 off */ gpio_set(GPIOC, GPIO15); /* LED5 off */ /* Send a message on USART1. */ usart_send_blocking(USART2, 's'); usart_send_blocking(USART2, 't'); usart_send_blocking(USART2, 'm'); usart_send_blocking(USART2, '\r'); usart_send_blocking(USART2, '\n'); /* Moved the channel selection and sequence init to adc_setup() */ /* Continously convert and poll the temperature ADC. */ while (1) { /* * Since sampling is triggered by the timer and copying the values * out of the data registers is handled by the interrupt routine, * we just need to print the values and toggle the LED. It may be useful * to buffer the adc values in some cases. */ my_usart_print_int(USART2, temperature); usart_send_blocking(USART2, ' '); my_usart_print_int(USART2, v_refint); usart_send_blocking(USART2, ' '); my_usart_print_int(USART2, lisam_adc1); usart_send_blocking(USART2, ' '); my_usart_print_int(USART2, lisam_adc2); usart_send_blocking(USART2, '\r'); gpio_toggle(GPIOA, GPIO8); /* LED2 on */ } return 0; }
void __init init_IRQ(void) { int flags; // printk("\nfile %s cp0 status %x\n",__FILE__,read_c0_status()); flags = read_c0_status(); flags |= CAUSEF_IP4|CAUSEF_IP3|CAUSEF_IP5|0xfc00; write_c0_status(flags); //printk("\nfile %s cp0 status %x\n",__FILE__,read_c0_status()); #ifdef CONFIG_REMOTE_DEBUG extern void breakpoint(void); extern void set_debug_traps(void); printk("Wait for gdb client connection ...\n"); set_debug_traps(); breakpoint(); #endif /* Invoke board-specific irq setup */ irq_setup(); }
int main(void) { int i; clock_setup(); gpio_setup(); irq_setup(); /* Blink the LEDs (PC6 and PC7) on the board. */ while (1) { gpio_toggle(LED1_PORT, LED1_PIN); gpio_toggle(LED2_PORT, LED2_PIN); /* gpio_toggle(LED3_PORT, LED3_PIN); */ /* gpio_toggle(LED4_PORT, LED4_PIN); */ for (i = 0; i < 8000000; i++) /* Wait a bit. */ __asm__("nop"); } return 0; }
void boot() { //Initialise display and print message video_text_cls(); video_text_puttext("KAOS version 1\nDeveloped by Karl Hobley.\n\nCopyleft (C) 2011 Karl Hobley.\nKAOS is released under the GPLv3 Licence.\n\nBuild date: "__DATE__" "__TIME__"\n\n\n\n"); //Setup kernel video_text_puttext("Loading GDT "); gdt_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading IDT "); idt_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading ISR "); isr_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading IRQ "); irq_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Enabling Interrupts "); __asm__ __volatile__("sti"); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading Timer "); timer_setup(); video_text_puttext("[ DONE ]\n"); video_text_puttext("Loading Keyboard "); keyboard_setup(); video_text_puttext("[ DONE ]\n"); //Test panic volatile int a = 1; volatile int b = 0; volatile int c = a / b; }
int main(void) { int i; clock_setup(); gpio_setup(); irq_setup(); /* Blink each color of the RGB LED in order. */ while (1) { /* * Flash the Red diode */ gpio_set(RGB_PORT, LED_R); delay(); /* Wait a bit. */ gpio_clear(RGB_PORT, LED_R); delay(); /* Wait a bit. */ /* * Flash the Green diode */ gpio_set(RGB_PORT, LED_G); delay(); /* Wait a bit. */ gpio_clear(RGB_PORT, LED_G); delay(); /* Wait a bit. */ /* * Flash the Blue diode */ gpio_set(RGB_PORT, LED_B); delay(); /* Wait a bit. */ gpio_clear(RGB_PORT, LED_B); delay(); /* Wait a bit. */ } return 0; }
void __init arch_init_irq(void) { irq_setup(); }