Exemple #1
0
Fichier : api.c Projet : el303/pses
void api_init(void) {
	CILCR_LVL = 0;
	interrupts_init();

	// button
	PIER07_IE0 = 1;
	PIER07_IE1 = 1;
	PIER07 |= 0x0c;
	PUCR07 |= 0x0c;

	Sema = 0;
	vSemaphoreCreateBinary(Sema);

	//Seg_Init();
	Drive_Init();

	//FRAM_Init();

	Us_Init();
	//CarId_Init();
	ADC_Init();
	Battery_Init();
	Linesensor_Init();

	//wirelessInit();

	Serial_Init();

	__EI();
}
Exemple #2
0
void _kmain(struct multiboot_info *mboot) {
	clrscr();

	// This will make sure there's about 4K of space for malloc to use until physical
	// memory management is available for proper virtual memory.
	kprintf("Initialising malloc()...\n");
	dlmalloc_sbrk(0);

	kprintf("Initialising physical memory manager...\n");
	pmem_init(mboot);

	kprintf("Completing virtual memory initialisation...\n");
	vmem_init();

	kprintf("Configuring software and hardware interrupts...\n");
	interrupts_init();

	kprintf("Initialising machine devices...\n");
	init_devices();

	kprintf("Enabling interrupts...\n");
	interrupts_enable();

	kprintf("Startup complete!\n");

	while(1) __asm__ volatile("hlt");
}
int main() {
    init_platform();

    // Initialize the GPIO peripherals.
	XGpio_Initialize(&gpPB, XPAR_PUSH_BUTTONS_5BITS_DEVICE_ID);
	// Set the push button peripheral to be inputs.
	XGpio_SetDataDirection(&gpPB, 1, 0x0000001F);
	// Enable the global GPIO interrupt for push buttons.
	XGpio_InterruptGlobalEnable(&gpPB);
	// Enable all interrupts in the push button peripheral.
	XGpio_InterruptEnable(&gpPB, 0xFFFFFFFF);

    interrupts_init();

    print("made it past interrupts_init\n\r");

    // apparently we don't need to init it, just HardReset
    XAC97_HardReset(XPAR_AXI_AC97_0_BASEADDR);
    XAC97_WriteReg(XPAR_AXI_AC97_0_BASEADDR, AC97_ExtendedAudioStat, 1);
    XAC97_WriteReg(XPAR_AXI_AC97_0_BASEADDR, AC97_PCM_DAC_Rate, AC97_PCM_RATE_11025_HZ);
    XAC97_mSetControl(XPAR_AXI_AC97_0_BASEADDR, AC97_ENABLE_IN_FIFO_INTERRUPT);
    XAC97_WriteReg(XPAR_AXI_AC97_0_BASEADDR, AC97_MasterVol, AC97_VOL_MAX);
    XAC97_WriteReg(XPAR_AXI_AC97_0_BASEADDR, AC97_PCMOutVol, AC97_VOL_MAX);


    while (1);

    cleanup_platform();

    return 0;
}
void MCU_init(void) {

	clocks_init();
	interrupts_init();

	RCC_ClockSecuritySystemCmd(ENABLE);

}
Exemple #5
0
/** Initialize the AXI DMA module.
 */
void axi_dma_init(void)
{
#if ZYNQ7000_AXI_DMA_USE_AXI_DMA0 == TRUE
  #if ZYNQ7000_AXI_DMA0_MM2S_PRESENT == TRUE
    AXIDMADriver1.mm2s_driver.axi_dma_dir = &AXI_DMA0->MM2S;
    AXIDMADriver1.mm2s_driver.irq_id = IRQ_ID_AXI_DMA0_MM2S;
    AXIDMADriver1.mm2s_driver.irq_priority = ZYNQ7000_AXI_DMA0_MM2S_IRQ_PRIORITY;
    AXIDMADriver1.mm2s_driver.callback = 0;
    interrupts_init(&AXIDMADriver1.mm2s_driver);
  #else
    AXIDMADriver1.mm2s_driver.axi_dma_dir = 0;
  #endif

  #if ZYNQ7000_AXI_DMA0_S2MM_PRESENT == TRUE
    AXIDMADriver1.s2mm_driver.axi_dma_dir = &AXI_DMA0->S2MM;
    AXIDMADriver1.s2mm_driver.irq_id = IRQ_ID_AXI_DMA0_S2MM;
    AXIDMADriver1.s2mm_driver.irq_priority = ZYNQ7000_AXI_DMA0_S2MM_IRQ_PRIORITY;
    AXIDMADriver1.s2mm_driver.callback = 0;
    interrupts_init(&AXIDMADriver1.s2mm_driver);
  #else
    AXIDMADriver1.mm2s_driver.axi_dma_dir = 0;
  #endif
#endif

#if ZYNQ7000_AXI_DMA_USE_AXI_DMA1 == TRUE
  #if ZYNQ7000_AXI_DMA1_MM2S_PRESENT == TRUE
    AXIDMADriver2.mm2s_driver.axi_dma_dir = &AXI_DMA1->MM2S;
    AXIDMADriver2.mm2s_driver.irq_id = IRQ_ID_AXI_DMA1_MM2S;
    AXIDMADriver2.mm2s_driver.irq_priority = ZYNQ7000_AXI_DMA1_MM2S_IRQ_PRIORITY;
    AXIDMADriver2.mm2s_driver.callback = 0;
    interrupts_init(&AXIDMADriver2.mm2s_driver);
  #else
    AXIDMADriver2.mm2s_driver.axi_dma_dir = 0;
  #endif

  #if ZYNQ7000_AXI_DMA1_S2MM_PRESENT == TRUE
    AXIDMADriver2.s2mm_driver.axi_dma_dir = &AXI_DMA1->S2MM;
    AXIDMADriver2.s2mm_driver.irq_id = IRQ_ID_AXI_DMA1_S2MM;
    AXIDMADriver2.s2mm_driver.irq_priority = ZYNQ7000_AXI_DMA1_S2MM_IRQ_PRIORITY;
    AXIDMADriver2.s2mm_driver.callback = 0;
    interrupts_init(&AXIDMADriver2.s2mm_driver);
  #else
    AXIDMADriver2.s2mm_driver.axi_dma_dir = 0;
  #endif
#endif
}
Exemple #6
0
/**
 * Name         : board_init
 *
 * Synopsis     : void board_init(void)
 *
 * Description  : Call all the initialization functions
 * 
 */
void board_init(void)
{
	clock_init		(); // in init.c
	interrupts_init	();	// in init.c	
	memory_init		();	// in memory.c
	dma_init		(); // in memory.c
	timers_init		();	// in init.c
	usart_init		();	// in init.c
	io_init			();	// in init.c
}
Exemple #7
0
/**
 * Name         : board_init
 *
 * Synopsis     : void board_init(void)
 *
 * Description  : Call all the initialization functions
 * 
 */
void board_init(void)
{

	//clock_init		();
	interrupts_init	();
	memory_init		();
	dma_init		();
	usart_init		();
	timers_init		();
	io_init			();
	cdhib_init		();
}
Exemple #8
0
void initSystem(void) {

    OSCCON = 0x70;      //16 MHz Clock

    __delay_us(1);

    initPorts();
    rs232_init();
    config_init();
    pocsagPhy_init();
    interrupts_init();

}
Exemple #9
0
void supervision_init(void)
{
	//fprintf(log_get(), "supervision: init\n");
	#ifndef DEBUG
	//iprintf("supervision: init\n");
	#endif

	memorymap_init();
	gpu_init();
	timer_init();
	/*sound_init();*/
	interrupts_init();
}
Exemple #10
0
void kmain(void)
{
	clear_screen();
	kprintf("Entered kmain\n");
	kprintf("KERNEL ALL LO: 0x%x\n", &__KERNEL_ALL_LO);
	kprintf("KERNEL ALL HI: 0x%x\n", &__KERNEL_ALL_HI);

	memory_init();
	interrupts_init();

	__asm__("sti");

	while(1) { __asm__("hlt"); }
}
Exemple #11
0
//Init/Res/Term
void intc_init()
{
    //INTC ICR 0xFFD00000 0x1FD00000 16 0x0000 0x0000 Held Held Pclk
    sh4_rio_reg(INTC,INTC_ICR_addr,RIO_DATA,16);

    //INTC IPRA 0xFFD00004 0x1FD00004 16 0x0000 0x0000 Held Held Pclk
    sh4_rio_reg(INTC,INTC_IPRA_addr,RIO_WF,16,0,&write_INTC_IPRA);

    //INTC IPRB 0xFFD00008 0x1FD00008 16 0x0000 0x0000 Held Held Pclk
    sh4_rio_reg(INTC,INTC_IPRB_addr,RIO_WF,16,0,&write_INTC_IPRB);

    //INTC IPRC 0xFFD0000C 0x1FD0000C 16 0x0000 0x0000 Held Held Pclk
    sh4_rio_reg(INTC,INTC_IPRC_addr,RIO_WF,16,0,&write_INTC_IPRC);

    interrupts_init();
}
Exemple #12
0
void main()
{
	init_serial();
	clean();
	printk("Scipio_a & Ngotru_t - Kernel Programming II\n\n");
	
	init_flat_gdt();
	interrupts_init();

	printk("\nTest send interrupts 9 ...   ");
	__asm__ volatile ("int $0x9");
	printk("\n");

	while (1);
	return ;
}
Exemple #13
0
/*
 * Finalize boot-time hw initialization
 */
void __init mach_start()
{
	/* + means of output */
	early_console_init();

	/* + x86 segmentation */
	init_root_tss();

	/* + irq handlers */
        interrupts_init();

	/* + cpu traps */
	trap_init();

	/* + hw timer */
        timer_init();
}
Exemple #14
0
int kmain(void* UNUSED(mbd), unsigned int UNUSED(magic))
{
    cpu_init();					//set up GDT
    idt_install();				//set up IDT
	interrupts_init();			//set up callback table
	pic_init();					//set up PIC

    print_clear();
    print_string_static("Hello... I'm a C Kernel!1!!\nAnd I have a PIC and PIT intialized.\n");
    
	interrupts_enable();
	interrupts_registerHandler(IRQ_TIMER, timerHandler);
	pit_init(50);
	pic_unmask_irq(IRQ_TIMER);
    
	for(;;);
    return 0;
}
Exemple #15
0
void kernel_main(uint32_t arg)
{
    volatile int gdb = 1;
	serial_init();

    printf("            |      ___|  \n");
    printf("  __|  _ \\  |  _ \\ __ \\  \n");
    printf("\\__ \\ (   | | (   |  ) | \n");
    printf("____/\\___/ _|\\___/____/  \n");

    if (!gdb) printk("looping for gdb\n");
    while ( gdb == 0 ); 

    /* needs to be very early as it clears the bss */
    mem_init((struct multiboot_info *)((uint64_t)arg));

    interrupts_init();
    /* ocaml needs floating point */
    sse_enable();
    time_init();

    pci_enumerate();

    interrupts_enable();

#if 0
    gdb = 0;
    gdb = 10/gdb;
#endif

    blk_test();
    sleep_test();

    for(;;)
        ping_serve();  /* does things if network packet comes in */

    printf("Kernel done. \nGoodbye!\n");
    kernel_hang();
}
Exemple #16
0
void kmain(){
  cli("kmain()");

  clear_screen();
  kprintln("KERNEL STARTED");
    
  if(mb_magic != 0x2BADB002){
    /* Something went not according to specs. Print an error */
    /* message and halt, but do *not* rely on the multiboot */
    /* data structure. */
    kprint("ERROR: Invalid multiboot magic number: ");
    kprintln_uint32(mb_magic);
    return;
  }

  kutil_init();
  kprintln("kutil initialised");

  memory_init();
  kprintln("memory initialised");

  interrupts_init();
  add_interrupt_handler(0x80, (uint32_t) interrupt_handler);  
  kprintln("interrupts initialised");

  processes_init();
  kprintln("processes initialised");

  clear_screen();

  add_process(&print_A);
  add_process(&print_B);

  //check_process_stack();

  sti("kmain()");
  halt();
}
Exemple #17
0
void arch_initialize(void)
{
	gdt_init();
	interrupts_init();
	mm_init();
}