Example #1
0
/**
 * @fn void main(void)
 * @brief eeprom emulation main function entry
 *
 */
void main (void) 
{
	U16 i;
	U8 tmp;
    SFRPAGE_SWITCH()
    ENABLE_VDDMON()
    DISABLE_WDT()
    SFRPAGE_RESTORE()
    eeprom_init();
    for(i = 0;i< EE_SIZE ;i++) {
    	if(eeprom_read_byte(i,&test_buf[i]) == ERROR)
    		goto error;
    }
    for(i = 0;i < 2;i++) {
    	test_buf[i] = i + 0x55;
    	if(eeprom_write_byte(i, test_buf[i]) == ERROR)
    		goto error;
    }
    tmp = 0;
    while(tmp < 50){
        for(i = 2;i< EE_SIZE; i++) {
        	test_buf[i] = i + 1;
        	if(eeprom_write_byte(i, test_buf[i] + tmp) == ERROR)
        		goto error;
        }
        tmp++;
    }
    for(i = 0; i< EE_SIZE; i++) {
    	if(eeprom_read_byte(i,&test_buf[i]) == ERROR)
    		goto error;
    	if((i == 0) || (i == 1)){
    	    if ((test_buf[0] != 0x55) || (test_buf[1] != 0x56))
    	    	goto error;
    	}else{
    		if (test_buf[i] != (i + tmp))
    			goto error;
    	}
    }
    while(1);
error:
	i = 0xDEAD;
	while(1);
}
Example #2
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)

}