コード例 #1
0
/**
 * \brief main function. Do the Fibonacci calculation with and without
 * PicoCache and print the calculation time to the UART console.
 */
int main(void)
{
	/* Initialize the SAM system */
	sysclk_init();
	board_init();

	/* Initialize the console uart */
	configure_console();

	/* Output example information */
	printf("-- FLASHCALW Example3 --\r\n");
	printf("-- %s\n\r", BOARD_NAME);
	printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);

	/* Intialize time tick utilities */
	time_tick_init(sysclk_get_cpu_hz());

	/* Calculate the Fibonacci without PicoCache */
	flash_picocache_example(
		"Fibonacci calculation without PicoCache at 48MHz",
		false);

	/* Calculate the Fibonacci with PicoCache */
	flash_picocache_example(
		"Fibonacci calculation with PicoCache at 48MHz",
		true);

	puts("From now on, System is running at 12MHz\r");
	puts("Please check the power consumption\r");
	printf("Push %s to continue\r\n", BUTTON_0_NAME);
	wait_for_pushbutton();
	sysclk_set_prescalers(2, 0, 0, 0, 0);
	reconfigure_com_port();

	flashcalw_set_wait_state(0);
	/* Calculate the Fibonacci without PicoCache */
	flash_picocache_example(
		"Fibonacci calculation without PicoCache at 12MHz",
		false);

	puts("Please check the power consumption\r");
	printf("Push %s to continue\r\n", BUTTON_0_NAME);
	wait_for_pushbutton();

	/* Calculate the Fibonacci with PicoCache */
	flash_picocache_example(
		"Fibonacci calculation with PicoCache at 12MHz",
		true);

	puts("End");

	while (true) {
	}
}
コード例 #2
0
ファイル: example.c プロジェクト: marekr/asf
/**
 * \brief Application entry point.
 *
 * \return Unused (ANSI-C compatibility).
 */
int main(void)
{
	uint8_t slot = 0;
	sd_mmc_err_t err;

	system_init();
	delay_init();
	cdc_uart_init();

	irq_initialize_vectors();
	cpu_irq_enable();

	time_tick_init();

	// Initialize SD MMC stack
	sd_mmc_init();

	printf("\x0C\n\r-- SD/MMC Card Example --\n\r");
	printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);
	while (1) {
		if (slot == sd_mmc_nb_slot()) {
			slot = 0;
		}
		printf("Please plug an SD/MMC card in slot %d.\n\r", slot+1);

		// Wait for a card and ready
		do {
			err = sd_mmc_check(slot);
			if ((SD_MMC_ERR_NO_CARD != err)
					&& (SD_MMC_INIT_ONGOING != err)
					&& (SD_MMC_OK != err)) {
				printf("Card install FAILED\n\r");
				printf("Please unplug and re-plug the card.\n\r");
				while (SD_MMC_ERR_NO_CARD != sd_mmc_check(slot)) {
				}
			}
		} while (SD_MMC_OK != err);
	
		// Display basic card information
		main_display_info_card(slot);
	
		/* Test the card */
		if (sd_mmc_get_type(slot) & (CARD_TYPE_SD | CARD_TYPE_MMC)) {
			// SD/MMC Card R/W
			main_test_memory(slot);
		}	

		printf("Test finished, please unplugged the card.\n\r");
		while (SD_MMC_OK == sd_mmc_check(slot)) {
		}
		slot++;
	}
}
コード例 #3
0
ファイル: example.c プロジェクト: Dewb/mod
/**
 * \brief Application entry point.
 *
 * \return Unused (ANSI-C compatibility).
 */
int main(void)
{
	uint8_t slot = 0;
	sd_mmc_err_t err;

	const usart_serial_options_t usart_serial_options = {
		.baudrate   = CONF_TEST_BAUDRATE,
		.charlength = CONF_TEST_CHARLENGTH,
		.paritytype = CONF_TEST_PARITY,
		.stopbits   = CONF_TEST_STOPBITS,
	};

	irq_initialize_vectors();
	cpu_irq_enable();

	sysclk_init();
	board_init();
	stdio_serial_init(CONF_TEST_USART, &usart_serial_options);

	time_tick_init();

	// Initialize SD MMC stack
	sd_mmc_init();

	printf("\x0C\n\r-- SD/MMC/SDIO Card Example --\n\r");
	printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__);
	while (1) {
		if (slot == sd_mmc_nb_slot()) {
			slot = 0;
		}
		printf("Please plug an SD, MMC or SDIO card in slot %d.\n\r", slot+1);

		// Wait for a card and ready
		do {
			err = sd_mmc_check(slot);
			if ((SD_MMC_ERR_NO_CARD != err)
					&& (SD_MMC_INIT_ONGOING != err)
					&& (SD_MMC_OK != err)) {
				printf("Card install FAILED\n\r");
				printf("Please unplug and re-plug the card.\n\r");
				while (SD_MMC_ERR_NO_CARD != sd_mmc_check(slot)) {
				}
			}
		} while (SD_MMC_OK != err);
	
		// Display basic card information
		main_display_info_card(slot);
	
		/* Test the card */
		if (sd_mmc_get_type(slot) & CARD_TYPE_SDIO) {
			// Test CIA of SDIO card
			main_test_sdio(slot);
		}
		if (sd_mmc_get_type(slot) & (CARD_TYPE_SD | CARD_TYPE_MMC)) {
			// SD/MMC Card R/W
			main_test_memory(slot);
		}	

		printf("Test finished, please unplugged the card.\n\r");
		while (SD_MMC_OK == sd_mmc_check(slot)) {
		}
		slot++;
	}
}