76 #if defined(__IAR_SYSTEMS_ICC__)
77 #define LOCATE_ATX(x) _Pragma(#x)
78 #define LOCATE_ATXX(x) LOCATE_ATX(location=x)
79 #define LOCATE_AT(x) LOCATE_ATXX(x)
80 #define WEAK_SYMBOL __weak
81 #elif defined(__ARMCC_VERSION)
82 #define LOCATE_AT(x) __attribute__((at(x)))
83 #define WEAK_SYMBOL __attribute__((weak))
84 #elif (defined(__CODE_RED))
85 #define LOCATE_ATX(x) __attribute__((section(".shmem_"#x ",\"aw\",%nobits@")))
86 #define LOCATE_AT(x) LOCATE_ATX(x)
87 #define WEAK_SYMBOL __attribute__((weak))
89 #error "Unsupported Compiler/Tool-Chain!"
92 #ifdef BOARD_HITEX_EVA_18504350
93 #define debugstr(str) board_uart_out_string(str)
95 #define debugstr(str) DEBUGSTR(str)
99 #define NUM_SECTORS 2048
105 #define START_SECTOR 32
108 #define BUFFER_SIZE (NUM_SECTORS * MMC_SECTOR_SIZE)
123 static uint32_t wr_ticks[NUM_ITER];
127 static int32_t tot_secs;
151 if (
final == curr)
return;
153 if ((
final < 0) && (curr > 0)) {
172 NVIC_ClearPendingIRQ(SDIO_IRQn);
175 NVIC_EnableIRQ(SDIO_IRQn);
218 Buff_Wr[i] = i + value;
222 #ifdef BOARD_HITEX_EVA_18504350
224 static void board_uart_debug_init(
void)
236 static void board_uart_out_ch(
char ch)
242 static void board_uart_out_string(
char *str)
244 while (*str !=
'\0') {
245 board_uart_out_ch(*str++);
253 static char debugBuf[64];
254 uint64_t tot_sum_rd, tot_sum_wr;
255 uint32_t i, rd_ave, wr_ave, rd_time, wr_time;
259 debugstr(
"\r\n=====================\r\n");
260 debugstr(
"SDMMC Measurements \r\n");
261 debugstr(
"=====================\r\n");
262 sprintf(debugBuf,
"No. of Iterations: %u \r\n",
NUM_ITER);
264 sprintf(debugBuf,
"No. of Sectors for R/W: %u \r\n",
NUM_SECTORS);
270 tot_sum_rd = tot_sum_wr = 0;
272 tot_sum_rd += rd_ticks[i];
273 tot_sum_wr += wr_ticks[i];
277 sprintf(debugBuf,
"CPU Speed: %lu.%lu MHz\r\n", clk, (
SystemCoreClock / 10000) - (clk * 100));
279 sprintf(debugBuf,
"Ave Ticks for Read: %u \r\n", rd_ave);
281 sprintf(debugBuf,
"Aver Ticks for Write: %u \r\n", wr_ave);
283 rd_time = (rd_ave /
clk);
284 wr_time = (wr_ave /
clk);
285 sprintf(debugBuf,
"READ: Ave Time: %u usecs Ave Speed : %u KB/sec\r\n", rd_time, ((NUM_SECTORS *
MMC_SECTOR_SIZE * 1000)/rd_time));
287 sprintf(debugBuf,
"WRITE:Ave Time: %u usecs Ave Speed : %u KB/sec \r\n", wr_time, ((NUM_SECTORS * MMC_SECTOR_SIZE * 1000)/wr_time));
308 NVIC_DisableIRQ(SDIO_IRQn);
319 int32_t act_read, act_written;
323 static char debugBuf[64];
327 #ifdef BOARD_HITEX_EVA_18504350
328 board_uart_debug_init();
332 NVIC_DisableIRQ(SDIO_IRQn);
337 debugstr(
"\r\n==============================\r\n");
338 debugstr(
"SDMMC CARD measurement demo\r\n");
339 debugstr(
"==============================\r\n");
342 NVIC_DisableIRQ(SDIO_IRQn);
347 debugstr(
"\r\nWait till SD/MMC card inserted...\r\n");
349 debugstr(
"\r\nSD/MMC Card inserted...\r\n");
358 debugstr(
"SD/MMC Card enumeration failed! ..\r\n");
365 debugstr(
"SDMMC Card is write protected!, so tests can not continue..\r\n");
374 debugstr(
"Out of range parameters! ..\r\n");
381 debugstr(
"\r\nTaking back up of card.. \r\n");
384 debugstr(
"Taking back up of card failed!.. \r\n");
398 if(act_written == 0) {
399 sprintf(debugBuf,
"WriteBlocks failed for Iter: %u! \r\n", ite_cnt);
404 if(end_time < start_time) {
408 wr_ticks[ite_cnt] = end_time - start_time;
416 sprintf(debugBuf,
"ReadBlocks failed for Iter: %u! \r\n", ite_cnt);
421 if(end_time < start_time) {
425 rd_ticks[ite_cnt] = end_time - start_time;
431 if(Buff_Rd[i] != Buff_Wr[i])
433 sprintf(debugBuf,
"Data mismacth: ind: %u Rd: 0x%x Wr: 0x%x \r\n", i, Buff_Rd[i], Buff_Wr[i]);
447 debugstr(
"\r\nRestoring the contents of SDMMC card... \r\n");
449 if(act_written == 0) {
450 debugstr(
"Restoring contents failed!.. \r\n");
454 debugstr(
"\r\n========================================\r\n");
455 debugstr(
"SDMMC CARD measurement demo completed\r\n");
456 debugstr(
"========================================\r\n");