Ejemplo n.º 1
0
/** Initialise flash, disable watchdog, set up clocks.  This and any
    functions it calls must be for the C runtime startup to
    work.  */
void 
mcu_init (void)
{
    irq_id_t id;
    int i;

    EFC0->EEFC_FMR = EEFC_FMR_FWS (5);

    /* Disable all interrupts to be sure when debugging.  */
    for (i = 0; i < 8; i++)
        NVIC->ICER[i] = ~0;

    mcu_reset_enable ();

    /* Reduce the number of wait states for the flash memory.  */
    mcu_flash_init ();

    mcu_watchdog_disable ();

    mcu_clock_init ();

#if 0
    /* Enable protect mode.  */
    AIC->AIC_DCR |= AIC_DCR_PROT;
    /* Use MATRIX_WPMR ?  */
#endif

    irq_global_enable ();
}
Ejemplo n.º 2
0
/**
 * @brief Initializer MCU during start-up
 */
void mcu_init(void)
{
    mcu_clock_init();

    /* Enable SRAM Data Retention */
    DRTRAM0 = _BV(ENDRT);
    DRTRAM1 = _BV(ENDRT);
    DRTRAM2 = _BV(ENDRT);
    DRTRAM3 = _BV(ENDRT);
}
Ejemplo n.º 3
0
void
mcu_power_mode_normal (void)
{
#if 0
    /* TODO.  */
    /* Switch voltage regulator to normal mode.  */
    VREG->VREG_MR &= ~AT91C_VREG_PSTDBY;

#endif

    mcu_clock_init ();
}
Ejemplo n.º 4
0
/**
 * @brief Initialization of PAL
 *
 * This function initializes the PAL.
 * This includes selecting the proper system clock source, initializing the
 * GPIOs, the interface to the transceiver, and the timers.
 *
 * @return MAC_SUCCESS if PAL initialization is successful, FAILURE otherwise
 */
retval_t pal_init(void)
{
    mcu_clock_init();
    gpio_init();
    trx_interface_init();
#ifdef CW_SUPPORTED
    TST_INIT();
#endif
    timer_init();
	
	 __watchdog_reset();
	/* Clear WDRF in MCUSR */
		MCUSR &= ~(1<<WDRF);
		/* Write logical one to WDCE and WDE */
		/* Keep old prescaler setting to prevent unintentional time-out
		*/
		WDTCSR |= (1<<WDCE) | (1<<WDE);
		/* Turn off WDT */
		WDTCSR = 0x00;
	

    return MAC_SUCCESS;
}