Exemplo n.º 1
0
/*
 * User's entry point.
 */
int main(void) {

    /* Initialisations  */
    printf("dma.c: main()\n");

    /* Installs IRQ handler */
#if defined(__TARGET_CPU_CORTEX_M3)
    install_handler((handler_t) irq_handler, (uint32_t *) 0x8);
#else   /* Assumes --cpu=6 or equivalent */
    setup_irq_stack();
    install_handler((handler_t) irq_handler, (uint32_t *) 0x18);
#endif

    /* Enables IRQ */
    __enable_irq();

    /* Initialize globals */
    end_transfer = 0;

    /* Single transfer */
    run();

#if defined(USE_WFI)
    /* Wait for interrupts */
    __wfi();
#endif
    exit(EXIT_SUCCESS);
    return EXIT_SUCCESS;
}
Exemplo n.º 2
0
int kmain(int argc, char** argv, uint32_t table)
{
	app_startup(); /* bss is valid after this point */
	global_data = table;

	/* Add your code here */
	unsigned int *user_stack_ptr;
	
	/*
	 * set up the custom swi ad irq handler by hijacking the existing swi handling
	 * infrastructure
	 */
	if(install_handler((unsigned int *)SWI_VECTOR_ADDR, (void *)s_handler) < 0){
		printf("\n KERNEL MAIN: installation of custom SWI handler failed");
		return 0xbadc0de;
}
	
	if(install_handler((unsigned int *)IRQ_VECTOR_ADDR, (void *)i_handler) < 0){
		printf("\n KERNEL MAIN: installation of custom IRQ handler failed");
		return 0xbadc0de;
}

	/*
	 * init the IRQ related registers
	 */
	init_irq_regs();	
	
	/*
	 * setup IRQ stack
	 */
	setup_irq_stack(irq_stack + IRQ_STACK_SIZE - sizeof(long));

	/*
	 * init the timer driver
	 */
	init_timer_driver();

	/*
	 * setup the user stack with command line args
	 */
	user_stack_ptr = setup_user_stack(argc, argv);

	/*
	 * launch the user task
	 */
	launch_user_app(user_stack_ptr);

	/*
	 * this is the point we will return to during the exit syscall
	 * from here, we return to uboot
	 */
    return (get_kernel_r0()); 
	return 0;
}