Example #1
0
void hardware_init (void){
  init_IO();
  /**
   * @brief set watchdog timer
   * we use hardware fuse bit to enforce watchdog is always on
   * and ask timer to reset watchdog
   * Set up the longest watchdog here
   */
  //! Ram - From the AVR datasheet, the typical watchdog reset interval is 1.9 seconds at 3V Vcc for the max. prescalar value
  //  __asm__ __volatile__ ("wdr");
  //  WDTCR = (1 << WDCE) | (1 << WDE);                             //! Ram - Start the timed sequence required to change the watchdog pre-scaler values
  //  WDTCR = (1 << WDE) | (1 << WDP2) | (1 << WDP1) | (1 << WDP0); //! Ram - Set the pre-scalar values (Must be done within 4 clock cycles) (compiler must pre-compute const ?)

  //! component level init
  //! we do led initialization in sos_watchdog_processing
  systime_init();
  
  // SYSTEM TIMER
  timer_hardware_init(DEFAULT_INTERVAL, DEFAULT_SCALE);

#ifdef USE_UART1
  SET_FLASH_SELECT_DD_OUT();
  SET_FLASH_OUT_DD_OUT();
  SET_FLASH_CLK_DD_OUT();
  SET_FLASH_SELECT();
#endif

  // UART
  uart_system_init();
#ifndef NO_SOS_UART
  //! Initalize uart comm channel
  sos_uart_init();
#endif

  // I2C
  i2c_system_init();
#ifndef NO_SOS_I2C
  //! Initalize i2c comm channel
  sos_i2c_init();
  //! Initialize the I2C Comm Manager
  // Ram - Assuming that it is turned on
  // by default with the SOS_I2C component
  sos_i2c_mgr_init(); 
#endif


  // ADC
  adc_proc_init();

#ifndef SOS_EMU
//  radio_init(NON_BEACONED_PAN);
//hubert:  use mac_init for vmac
mac_init();
#endif
}
Example #2
0
//-------------------------------------------------------------------------
// MAIN
//-------------------------------------------------------------------------
int main(void)
{
	oscc_init();							// Oscillator
	PSSR = (PSSR_RDH | PSSR_PH);   			// Reenable the GPIO buffers (needed out of reset)
	//SOS_SET_PIN_DIRECTIONS();				// GPIO
	DVFS_SwitchCoreFreq(104, 104);			// Switch to 104MHz mode
	//DVFS_SwitchCoreFreq(13, 13);			// Switch to 13MHz mode
	memory_init();							// SDRAM
	mmu_init();								// MMU
	//gpio_init();							// GPIO Interrupts
	//wdt_init();							// WATCHDOG
	PXA27XGPIOInt_init();
	pmic_init();
	led_init();								// LEDS
	//systime_init();						// LOCAL TIME
	timer_hardware_init(
		DEFAULT_INTERVAL, DEFAULT_SCALE);	// SYSTEM TIMER
	sos_main(SOS_BOOT_NORMAL);
	return 0;
}
Example #3
0
//-------------------------------------------------------------------------
// FUNCTION DECLARATION
//-------------------------------------------------------------------------
void hardware_init(void){

  // Starting the evaluation
  EVAL_START();

  // LEDS
  led_init();

  // SYSTEM TIMER
  timer_hardware_init(DEFAULT_INTERVAL, DEFAULT_SCALE);

  // UART
  ker_push_current_pid(KER_UART_PID);
  uart_system_init();
  ker_pop_current_pid();
#ifndef NO_SOS_UART
  //! Initalize uart comm channel
  ker_push_current_pid(KER_UART_PID);
  sos_uart_init();
  ker_pop_current_pid();
#endif
}
Example #4
0
//-------------------------------------------------------------------------
// FUNCTION DECLARATION
//-------------------------------------------------------------------------
void hardware_init(void) {
    init_IO();

    // WATCHDOG SETUP FOR AVR
#ifndef DISABLE_WDT
    /*
     * Hardware Fuse Bit ensures WDT is always ON
     * The following timed sequence sets up a WDT
     * with the longest timeout period.
     */
    __asm__ __volatile__ ("wdr");
    WDTCR = (1 << WDCE) | (1 << WDE);
    WDTCR = (1 << WDE) | (1 << WDP2) | (1 << WDP1) | (1 << WDP0);
#else
    /*
     * WDT may need to be disabled during debugging etc.
     * You must also unset the WDT fuse.  If it is set it
     * is not possible to disable the WDT in software.
     * Setting the fuses to ff9fff will allow it to be disabled.
     */

    __asm__ __volatile__ ("wdr");
    WDTCR = (1 << WDCE) | (1 << WDE);
    WDTCR = 0;
#endif //DISABLE_MICA2_WDT

    // LEDS
    // We do led initialization in sos_watchdog_processing

    // LOCAL TIME
    systime_init();

    // SYSTEM TIMER
    timer_hardware_init(DEFAULT_INTERVAL, DEFAULT_SCALE);

    // UART
#ifdef USE_UART1
    SET_FLASH_SELECT_DD_OUT();
    SET_FLASH_SELECT();
#endif
    uart_system_init();
#ifndef NO_SOS_UART
    //! Initalize uart comm channel
    sos_uart_init();
#endif

    // I2C
    // always initalize the i2c system
    i2c_system_init();
#ifndef NO_SOS_I2C
    //! Initalize i2c comm channel
    sos_i2c_init();
    //! Initialize the I2C Comm Manager
    // Ram - Assuming that it is turned on
    // by default with the SOS_I2C component
    sos_i2c_mgr_init();
#endif

    // ADC
    adc_proc_init();

    // RADIO
#ifndef SOS_EMU
    cc1k_radio_init();
#ifndef DISABLE_RADIO
    cc1k_radio_start();
#ifdef RADIO_XMIT_POWER
    cc1k_cnt_SetRFPower(RADIO_XMIT_POWER);
#endif//RADIO_XMIT_POWER
#else
    cc1k_radio_stop();
#endif//DISABLE_RADIO
#endif//SOS_EMU

    // EXTERNAL FLASH
#ifndef USE_UART1
    exflash_init();
#endif


    // MICA2 PERIPHERALS (Optional)
#ifdef SOS_MICA2_PERIPHERAL
    mica2_peripheral_init();
#endif

    //TODO: We may want to move this out of the mica2 hardware (Roy)
    one_wire_init();

}
Example #5
0
//-------------------------------------------------------------------------
// FUNCTION DECLARATION
//-------------------------------------------------------------------------
void hardware_init(void){
	init_IO();

	// WATCHDOG SETUP FOR MSP430
	// After PUC, watchdog is enabled by default
	// with a timeout of 32 ms. Till we support
	// watchdog, we will simply disable it
	DISABLE_WDT();

	// CLOCK SUBSYSTEM
	clock_hal_init();

	// LEDS
	led_init();

	// HARDWARE TIMERS
	timerb_hal_init();

	// SYSTEM TIMER
	timer_hardware_init(DEFAULT_INTERVAL);

	// UART
	uart_hardware_init();
	uart_system_init();
#ifndef NO_SOS_UART
	//! Initialize uart comm channel
	sos_uart_init();
#endif

	// I2C
	//! Limited I2C support for the ARL deployment
#ifdef NEW_SENSING_API
#ifdef TMOTE_INVENT_SENSOR_BOARD
	invent_sensor_init();
#endif
#endif

	// SPI
	spi_hardware_init();

	// RADIO
	//#ifndef NO_SOS_RADIO
	//	cc2420_hardware_init();
	mac_init();
	//#endif

	// ADC
#ifdef NEW_SENSING_API
	adc_driver_init();
#else
	adc_proc_init();
#endif

	// Interrupt controller
	interrupt_init();

	// SHT1x chip communication controller
#ifdef NEW_SENSING_API
#ifdef TMOTE_SENSOR_BOARD
	sht1x_comm_init();
#endif
#endif

	// Ram - I dont know which flash this is ?
	//  init_flash();



	// EXTERNAL FLASH
	// Currently there is no support

	// MSP430 PERIPHERALS (Optional)

}