Exemple #1
0
/*! \brief Main function. Execution starts here.
 */
int main(void)
{
	irq_initialize_vectors();
	cpu_irq_enable();

	// Initialize the sleep manager
	sleepmgr_init();

	sysclk_init();
	board_init();
	ui_init();
	ui_powerdown();

	memories_initialization();

	// Start USB stack to authorize VBus monitoring
	udc_start();

	// The main loop manages only the power mode
	// because the USB management is done by interrupt
	while (true) {

		if (main_b_msc_enable) {
			if (!udi_msc_process_trans()) {
				sleepmgr_enter_sleep();
			}
		}else{
			sleepmgr_enter_sleep();
		}
	}
}
Exemple #2
0
static void run_usb_msc_test(const struct test_case *test)
{
	memories_initialization();

	// Start USB stack to authorize VBus monitoring
	udc_start();

	if (!udc_include_vbus_monitoring()) {
		// VBUS monitoring is not available on this product
		// thereby VBUS has to be considered as present
		main_vbus_action(true);
	}

	// The main loop manages only the power mode
	// because the USB management is done by interrupt
	while (!main_b_msc_read) {

		if (main_b_msc_enumerated) {
			if (!udi_msc_process_trans()) {
				sleepmgr_enter_sleep();
			}
		}else{
			sleepmgr_enter_sleep();
		}
	}
	test_assert_true(test, main_b_msc_enumerated, "MSC enumeration fails");

	udc_stop();
}
Exemple #3
0
/*! \brief Main function. Execution starts here.
 */
int main(void)
{
	irq_initialize_vectors();
	cpu_irq_enable();

	// Initialize the sleep manager
	sleepmgr_init();

	sysclk_init();
	board_init();
	ui_init();
	ui_powerdown();

	ctrl_access_init(); // Required with FreeRTOS
	memories_initialization();

	// Create a semaphore to manage the memories data transfer
	vSemaphoreCreateBinary(main_trans_semphr);
	Assert( main_trans_semphr != NULL );
	
	// Start USB stack to authorize VBus monitoring
	udc_start();
	
	// Create a task to process data transfer
	xTaskCreate(main_memories_trans_task,
			((const signed portCHAR *)"DATA TRANSFER"),
#if defined(CONF_BOARD_NAND)
			3072/sizeof(portSTACK_TYPE), // NF require large stack
#else
			256,
#endif
			NULL,
			tskIDLE_PRIORITY + 1,
			NULL);

	// Uncomment the following line, if you want FreeRTOS to always run 
	// when USB cable is unplugged.
	//  IDLE is the sleep level required by the Timer counter used by FreeRTOS.
	// sleepmgr_lock_mode(SLEEPMGR_IDLE);

	// Start OS scheduler
	vTaskStartScheduler();
	return 0;
}
Exemple #4
0
/**
 *  \brief Application entry point for FatFS example.
 */
int main(void)
{
	uint32_t disk_dev_num;

	const usart_serial_options_t usart_serial_options = {
		.baudrate   = CONF_TEST_BAUDRATE,
		.paritytype = CONF_TEST_PARITY,
#if !SAM
		.charlength = CONF_TEST_CHARLENGTH,
		.stopbits   = CONF_TEST_STOPBITS,
#endif
	};
	/* Initialize the system */
	sysclk_init();
	board_init();

#if XMEGA
	rtc_init();
#endif

#if SAM
	sysclk_enable_peripheral_clock(CONSOLE_UART_ID);
#endif
	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);

	/* Intialize the memory device */
	memories_initialization();

	/* Output example information */
	puts(STRING_HEADER);

	for (disk_dev_num = 0; disk_dev_num < get_nb_lun(); disk_dev_num++) {
		if (run_fatfs_test(disk_dev_num)) {
			printf("-I- DISK %d Test passed !\n\r\n\r", disk_dev_num);
		} else {
			printf("-F- DISK %d Test Failed !\n\r\n\r", disk_dev_num);
		}
	}

	while (1) {
		/* Do nothing */
	}
}
Exemple #5
0
/*! \brief Main function. Execution starts here.
 */
int main(void)
{
	//uint8_t i = 0;
	uint16_t temp_crc;
	irq_initialize_vectors();
	cpu_irq_enable();

	// Initialize the sleep manager
	sleepmgr_init();

	sysclk_init();
	board_init();

	ui_init();
	ui_powerdown();

	memories_initialization();

	// Initialize LCD
	et024006_Init( FOSC0, FOSC0 );
	gpio_set_gpio_pin(ET024006DHU_BL_PIN);
	
	//et024006_PrintConsole("Welcome Eric", BLACK, -1);
	//clear_lcd
	et024006_DrawFilledRect(1, 1, ET024006_WIDTH, ET024006_HEIGHT, BLACK);
	
	// Initialize AES module
	aes_task();

	// Start TC
	tc_task();

	Init_System_Status();
	// Initialize crc for fast calculations
	crcInit();
		
	// Read the stored values from the flash
	Load_stored_values();
	//i = sizeof(stored_values_t) - sizeof(uint16_t);
	temp_crc = crcFast((const uint8_t *)&Stored_values_ram, 192);
	//temp_crc1 = crcFast("123456789", 9);
	if (temp_crc == Stored_values_ram.block_crc)
	{
		stSystemStatus.stored_value_crc_status = 1;
	}
	//Stored_values_ram.salt[5] = 0x4d68ab23;
	
	//Update_stored_values();
	// Start USB stack to authorize VBus monitoring
	udc_start();

	if (!udc_include_vbus_monitoring()) {
		// VBUS monitoring is not available on this product
		// thereby VBUS has to be considered as present
		main_vbus_action(true);
	}

	// The main loop manages only the power mode
	// because the USB management is done by interrupt
	while (true)
	{
		if (main_b_msc_enable)
		{
			if (!udi_msc_process_trans())
			{
				sleepmgr_enter_sleep();
			}
		}
		else
		{
			sleepmgr_enter_sleep();
		}
		//main_process_mode();
	}
}