Exemplo n.º 1
0
static int setupHardware( void )
{
	// When using the JTAG debugger the hardware is not always initialised to
	// the correct default state.  This line just ensures that this does not
	// cause all interrupts to be masked at the start.
	AT91C_BASE_AIC->AIC_EOICR = 0;

	// Enable the peripheral clock.
	AT91F_PMC_EnablePeriphClock( AT91C_BASE_PMC, (1 << AT91C_ID_PIOA) |  //Enable Clock for PIO
												(1 << AT91C_ID_IRQ0) |  //Enable Clock for IRQ0
												(1 << AT91C_ID_PWMC) |	//Enable Clock for the PWM controller
												(1 << AT91C_ID_US0)  |  //USART0
												(1 << AT91C_ID_US1)		//USART1
							  );


	// Enable reset-button
	AT91F_RSTSetMode( AT91C_BASE_RSTC , AT91C_RSTC_URSTEN );

	if (!initUsart()) return 0;
	if (!vInitUSBInterface()) return 0;

	init_serial();

	rtc_init();

	InitLoggerHardware();
	return 1;
 }
int cpu_device_init(void)
{
    // When using the JTAG debugger the hardware is not always initialised to
    // the correct default state.  This line just ensures that this does not
    // cause all interrupts to be masked at the start.
    AT91C_BASE_AIC->AIC_EOICR = 0;

    // Enable reset-button
    AT91F_RSTSetMode( AT91C_BASE_RSTC , AT91C_RSTC_URSTEN );
    init_spi_lock();
    return 1;
}