- better - more sphisticated
Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@616 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -13,12 +13,33 @@
|
||||
#define TEST13_ERROR (ERROR | 0x13)
|
||||
#define TEST14_ERROR (ERROR | 0x14)
|
||||
#define TEST15_ERROR (ERROR | 0x15)
|
||||
#define TEST16_ERROR (ERROR | 0x16)
|
||||
|
||||
#define PIC_NX 800
|
||||
#define PIC_NY 600
|
||||
|
||||
char buffer[16384];
|
||||
int g_i;
|
||||
|
||||
extern int paranoia(int argc, char **argv);
|
||||
|
||||
int IsEndianBig(void)
|
||||
{
|
||||
UINT8 *pBuf;
|
||||
UINT32 word;
|
||||
word = 0x12345678;
|
||||
pBuf = (UINT8*)&word;
|
||||
if (((*pBuf+0) == 0x12) && (*(pBuf+1) == 0x34) && (*(pBuf+2) == 0x56) && (*(pBuf+3) == 0x78))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (((*pBuf+0) == 0x78) && (*(pBuf+1) == 0x56) && (*(pBuf+2) == 0x34) && (*(pBuf+3) == 0x12))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void handler3(void)
|
||||
{
|
||||
volatile UINT32 *pUART_stat = (UINT32*)sys_uart_stat;
|
||||
@@ -85,6 +106,7 @@ void PrintCPUinfo(void)
|
||||
{
|
||||
int result, rev_id;
|
||||
int cache_size, cache_line;
|
||||
int eb;
|
||||
|
||||
char *cpu_type_str[7] = {"invalid", "R2000", "R3000", "R6000", "R4000", "reserved", "R6000A"};
|
||||
|
||||
@@ -108,7 +130,14 @@ void PrintCPUinfo(void)
|
||||
else
|
||||
printf("Unknown");
|
||||
|
||||
printf("\n");
|
||||
eb = IsEndianBig();
|
||||
if (eb)
|
||||
printf(" [Big-endian]\n");
|
||||
if (!eb)
|
||||
printf(" [Little-endian]\n");
|
||||
if (eb < 0)
|
||||
printf(" [Unknown endian]\n");
|
||||
|
||||
cache_size = (result >> 16) & 7;
|
||||
cache_line = (result >> 19) & 7;
|
||||
printf("I-Cache : %d kBytes (%d Bytes per line)\n", 4*(int)pow(2.0, (double)(8+cache_size))/1024, 4*(int)pow(2.0, (double)(cache_line)));
|
||||
@@ -119,6 +148,24 @@ void PrintCPUinfo(void)
|
||||
|
||||
}
|
||||
|
||||
int non_aligned_load(UINT32* pMem)
|
||||
{
|
||||
UINT32 result;
|
||||
__asm__
|
||||
(
|
||||
"li $t0, 0x01234567\n"
|
||||
"li $t1, 0x89ABCDEF\n"
|
||||
"sw $t0, 0(%[pMem])\n"
|
||||
"sw $t1, 64(%[pMem])\n"
|
||||
"li %[val], 0x55555555\n"
|
||||
"lw %[val], 0(%[pMem])\n"
|
||||
"lwl %[val], 65(%[pMem])\n"
|
||||
: [val] "=r" (result)
|
||||
: [pMem] "r" (pMem)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
int Test10_LoadStore()
|
||||
{
|
||||
int *buf, i, result, data, err;
|
||||
@@ -240,7 +287,21 @@ int Test10_LoadStore()
|
||||
err = NO_ERROR;
|
||||
break;
|
||||
}
|
||||
err = TEST10_ERROR;
|
||||
data = non_aligned_load(buf);
|
||||
if (0 == IsEndianBig())
|
||||
{
|
||||
if (0xCDEF4567 == data)
|
||||
err = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0xABCDEF67 == data)
|
||||
err = 0;
|
||||
}
|
||||
|
||||
free(buf);
|
||||
|
||||
return err;
|
||||
|
||||
}
|
||||
@@ -446,56 +507,19 @@ int Test15_pi_calc()
|
||||
|
||||
#define TEST_SIZE (16*1024*1024) // Bytes
|
||||
#define SMALL_TEST_SIZE (8192) // Bytes
|
||||
int main (void)
|
||||
#define FLASH_SIZE (8*1024*1024) // Bytes
|
||||
|
||||
int Test16_MemTest(void)
|
||||
{
|
||||
int result, i, j, cnt, size;
|
||||
UINT32 volatile *pUART_baud = (UINT32*)sys_uart_baud;
|
||||
UINT32 volatile *pReg = (UINT32*)sys_led_port;
|
||||
UINT32 volatile *pReg_usec = (UINT32*)sys_timer_usec;
|
||||
UINT32 volatile *pReg_sec = (UINT32*)sys_timer_sec;
|
||||
UINT32 volatile *pSSRAM = (UINT32*)sys_ssram_io;
|
||||
UINT32 volatile *pTim_ctrl = (UINT32*)sys_itim_ctrl;
|
||||
UINT32 volatile *pTim_stat = (UINT32*)sys_itim_stat;
|
||||
UINT32 volatile *pTim0_cnt = (UINT32*)sys_itim0_cnt;
|
||||
UINT32 volatile *pTim0_cmp = (UINT32*)sys_itim0_cmp;
|
||||
UINT32 volatile *pTim1_cnt = (UINT32*)sys_itim1_cnt;
|
||||
UINT32 volatile *pTim1_cmp = (UINT32*)sys_itim1_cmp;
|
||||
|
||||
g_cnt = 1;
|
||||
|
||||
srand(clock());
|
||||
|
||||
*pTim0_cnt = 0;
|
||||
*pTim1_cnt = 0;
|
||||
*pTim0_cmp = (UINT32)(rand() & 0x3FF);
|
||||
*pTim1_cmp = 100000000;
|
||||
*pTim_stat = (1 << 2) | (1 << 0);
|
||||
*pTim_ctrl = (3 << 2);
|
||||
|
||||
time_t curr_date;
|
||||
struct tm *pDate, date;
|
||||
UINT32 start, end;
|
||||
char sel[80];
|
||||
struct timeval time_sec;
|
||||
|
||||
UINT8 *ram8 = NULL;
|
||||
UINT16 *ram16 = NULL;
|
||||
UINT32 *ram32 = NULL;
|
||||
UINT32 volatile *pFlashIO = (UINT32*)sys_flash_io;
|
||||
UINT32 volatile *pFlashMem = (UINT32*)sys_flash_mem;
|
||||
|
||||
UINT32 *pSrc32, *pDst32;
|
||||
|
||||
// *pUART_baud = 1;
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
PrintCPUinfo();
|
||||
|
||||
g_i = 0;
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
interrupt_register(3, handler3);
|
||||
fprintf(stderr, "UART interrupt registered.\n");
|
||||
|
||||
interrupt_register(7, handler7);
|
||||
fprintf(stderr, "Timer interrupt registered.\n");
|
||||
UINT32 start, end;
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// Memtest BEGIN
|
||||
@@ -528,11 +552,17 @@ int main (void)
|
||||
*/
|
||||
// ----------------------------------------------------------
|
||||
// Memtest BEGIN
|
||||
printf("Dump first 16 bytes of flash blocks\n");
|
||||
for (i=0; i < FLASH_SIZE; i += 0x40000)
|
||||
memdump((UINT8*)(pFlashIO+i/4), 0, 16, 16);
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("SDRAM Memory Test\n");
|
||||
printf("Test size %d kByte\n\n", TEST_SIZE/1024);
|
||||
|
||||
ram8 = (UINT8*)calloc(TEST_SIZE,sizeof(UINT8));
|
||||
printf("Zeroize Memory (memset)...");
|
||||
printf("Zeroize SDRAM (memset)...");
|
||||
start = clock();
|
||||
memset(ram8, 0, TEST_SIZE);
|
||||
end = clock();
|
||||
@@ -541,7 +571,7 @@ int main (void)
|
||||
free(ram8);
|
||||
|
||||
ram8 = (UINT8*)calloc(TEST_SIZE,sizeof(UINT8));
|
||||
printf("Zeroize Memory (8-Bit access)...");
|
||||
printf("Zeroize SDRAM (8-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE; i++)
|
||||
ram8[i] = (UINT8)0;
|
||||
@@ -552,7 +582,7 @@ int main (void)
|
||||
free(ram8);
|
||||
|
||||
ram16 = (UINT16*)calloc(TEST_SIZE/2,sizeof(UINT16));
|
||||
printf("Zeroize Memory (16-Bit access)...");
|
||||
printf("Zeroize SDRAM (16-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE/2; i++)
|
||||
ram16[i] = (UINT16)0;
|
||||
@@ -563,7 +593,7 @@ int main (void)
|
||||
free(ram16);
|
||||
|
||||
ram32 = (UINT32*)calloc(TEST_SIZE/4,sizeof(UINT32));
|
||||
printf("Zeroize Memory (32-Bit access)...");
|
||||
printf("Zeroize SDRAM (32-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE/4; i++)
|
||||
ram32[i] = (UINT32)0;
|
||||
@@ -574,7 +604,7 @@ int main (void)
|
||||
free(ram32);
|
||||
|
||||
ram8 = (UINT8*)calloc(TEST_SIZE,sizeof(UINT8));
|
||||
printf("Write (8-Bit access)...");
|
||||
printf("Write SDRAM (8-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE; i++)
|
||||
ram8[i] = (UINT8)i;
|
||||
@@ -582,7 +612,7 @@ int main (void)
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start)));
|
||||
|
||||
printf("Verify (8-Bit access)...");
|
||||
printf("Verify SDRAM (8-Bit access)...");
|
||||
start = clock();
|
||||
for (i=TEST_SIZE-1; i >= 0; i--)
|
||||
if (ram8[i] != (UINT8)i)
|
||||
@@ -591,14 +621,17 @@ int main (void)
|
||||
end = clock();
|
||||
i++;
|
||||
if (i)
|
||||
{
|
||||
printf("failed\r\n");
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
else
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start)));
|
||||
|
||||
free(ram8);
|
||||
|
||||
ram16 = (UINT16*)calloc(TEST_SIZE/2,sizeof(UINT16));
|
||||
printf("Write (16-Bit access)...");
|
||||
printf("Write SDRAM (16-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE/2; i++)
|
||||
ram16[i] = (UINT16)i;
|
||||
@@ -606,7 +639,7 @@ int main (void)
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start)));
|
||||
|
||||
printf("Verify (16-Bit access)...");
|
||||
printf("Verify SDRAM (16-Bit access)...");
|
||||
start = clock();
|
||||
for (i=TEST_SIZE/2-1; i >= 0; i--)
|
||||
if (ram16[i] != (UINT16)i)
|
||||
@@ -615,7 +648,10 @@ int main (void)
|
||||
end = clock();
|
||||
i++;
|
||||
if (i)
|
||||
{
|
||||
printf("failed\r\n");
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
else
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start)));
|
||||
|
||||
@@ -623,7 +659,7 @@ int main (void)
|
||||
free(ram16);
|
||||
|
||||
ram32 = (UINT32*)calloc(TEST_SIZE/4,sizeof(UINT32));
|
||||
printf("Write (32-Bit access)...");
|
||||
printf("Write SDRAM (32-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE/4; i++)
|
||||
{
|
||||
@@ -633,7 +669,7 @@ int main (void)
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start)));
|
||||
|
||||
printf("Verify (32-Bit access)...");
|
||||
printf("Verify SDRAM (32-Bit access)...");
|
||||
start = clock();
|
||||
for (i=TEST_SIZE/4-1; i >= 0; i--)
|
||||
{
|
||||
@@ -644,15 +680,18 @@ int main (void)
|
||||
end = clock();
|
||||
i++;
|
||||
if (i)
|
||||
{
|
||||
printf("failed\r\n");
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
else
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start)));
|
||||
|
||||
free(ram32);
|
||||
|
||||
printf("Small data test\r\n");
|
||||
printf("Test size %d kByte\n\n", SMALL_TEST_SIZE/1024);
|
||||
printf("Write (32-Bit access)...");
|
||||
printf("\n");
|
||||
printf("Small data test (size = %d kByte)\n", SMALL_TEST_SIZE/1024);
|
||||
printf("Write SDRAM (32-Bit access)...");
|
||||
ram32 = (UINT32*)calloc(SMALL_TEST_SIZE/4,sizeof(UINT32));
|
||||
start = clock();
|
||||
for (j=0; j < TEST_SIZE/SMALL_TEST_SIZE; j++)
|
||||
@@ -664,7 +703,7 @@ int main (void)
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Verify
|
||||
printf("Verify (32-Bit access)...");
|
||||
printf("Verify SDRAM (32-Bit access)...");
|
||||
start = clock();
|
||||
for (j=0; j < TEST_SIZE/SMALL_TEST_SIZE; j++)
|
||||
for (i=SMALL_TEST_SIZE/4-1; i >= 0; i--)
|
||||
@@ -674,97 +713,237 @@ int main (void)
|
||||
end = clock();
|
||||
i++;
|
||||
if (i)
|
||||
{
|
||||
printf("failed\r\n");
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
else
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start)));
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
free(ram32);
|
||||
printf("\n");
|
||||
|
||||
printf("Memcpy() Test \n");
|
||||
pSrc32 = (UINT32*)calloc(TEST_SIZE/8,sizeof(UINT32));
|
||||
pDst32 = (UINT32*)calloc(TEST_SIZE/8,sizeof(UINT32));
|
||||
pSrc32 = (UINT32*)calloc(TEST_SIZE/4,sizeof(UINT32));
|
||||
pDst32 = (UINT32*)calloc(TEST_SIZE/4,sizeof(UINT32));
|
||||
|
||||
printf("Memcpy() SDRAM => SDRAM\n");
|
||||
printf("Copying %d kBytes...", TEST_SIZE/(2*1024));
|
||||
start = clock();
|
||||
memcpy(pDst32, pSrc32, TEST_SIZE/2);
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(2*1000*(end-start)));
|
||||
printf("\n");
|
||||
|
||||
printf("Memcpy() Flash(IO) => SDRAM \n");
|
||||
printf("Copying %d kBytes...", FLASH_SIZE/(1024));
|
||||
start = clock();
|
||||
memcpy(pDst32, pFlashIO, FLASH_SIZE);
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)FLASH_SIZE/(1000*(end-start)));
|
||||
printf("\n");
|
||||
|
||||
printf("Memcpy() Flash(MEM) => SDRAM \n");
|
||||
printf("Copying %d kBytes...", FLASH_SIZE/(1024));
|
||||
start = clock();
|
||||
memcpy(pDst32, pFlashMem, FLASH_SIZE);
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)FLASH_SIZE/(1000*(end-start)));
|
||||
printf("\n");
|
||||
|
||||
free(pSrc32);
|
||||
free(pDst32);
|
||||
|
||||
printf("Boot code read \n");
|
||||
size = 0x2000;
|
||||
pSrc32 = (UINT32*)0xBFC00000;
|
||||
pDst32 = (UINT32*)calloc(size,sizeof(UINT32));
|
||||
memcpy(pDst32, pSrc32, size);
|
||||
printf("Verify Boot code...");
|
||||
printf("Verify boot ROM...");
|
||||
for (i=size/4-1; i >= 0; i--)
|
||||
if (pDst32[i] != pSrc32[i])
|
||||
break;
|
||||
i++;
|
||||
if (i)
|
||||
{
|
||||
printf("failed\r\n");
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
else
|
||||
printf("passed\r\n");
|
||||
|
||||
free(pDst32);
|
||||
|
||||
memdump((UINT8*)pSrc32, 0, 16, size);
|
||||
memdump((UINT8*)0x40000000, 0, 16, 1024);
|
||||
printf("Verify FLASH(IO) <=> FLASH(MEM)...");
|
||||
if (!memcmp(pFlashIO, pFlashMem, FLASH_SIZE))
|
||||
printf("passed\r\n");
|
||||
else
|
||||
{
|
||||
printf("failed\r\n");
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
|
||||
// memdump((UINT8*)pSrc32, 0, 16, size);
|
||||
// memdump((UINT8*)0x40000000, 0, 16, 1024);
|
||||
|
||||
// Memtest END
|
||||
// ----------------------------------------------------------
|
||||
sputs("\r\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define SCREEN_X screen_res_x
|
||||
#define SCREEN_Y screen_res_y
|
||||
|
||||
#define PIC_SCALE_X 1
|
||||
#define PIC_SCALE_Y 1
|
||||
#define OFFSET_X ((SCREEN_X-(SCALE_X*PIC_NX))/2)
|
||||
#define OFFSET_Y ((SCREEN_Y-(SCALE_Y*PIC_NY))/2)
|
||||
|
||||
void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage, UINT32 image_nx, UINT32 image_ny, UINT32 image_scale_x, UINT32 image_scale_y)
|
||||
{
|
||||
UINT32 off_x, off_y;
|
||||
UINT32 i;
|
||||
UINT32 *pScr;
|
||||
|
||||
off_x = (screen_nx-(image_scale_x*image_nx))/2;
|
||||
off_y = (screen_ny-(image_scale_y*image_ny))/2;
|
||||
|
||||
memset(pScreen, 0, screen_nx*screen_ny*sizeof(UINT32));
|
||||
pScr = ((UINT32*)pScreen) + screen_nx*off_y + off_x;
|
||||
|
||||
for (i=0; i < image_ny; i++)
|
||||
{
|
||||
memcpy(pScr, &pImage[i*image_nx], image_nx*sizeof(UINT32));
|
||||
pScr += screen_nx;
|
||||
}
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
int result, i, j, cnt, size;
|
||||
UINT32 volatile *pUART_baud = (UINT32*)sys_uart_baud;
|
||||
UINT32 volatile *pUART_stat = (UINT32*)sys_uart_stat;
|
||||
UINT32 volatile *pReg = (UINT32*)sys_led_port;
|
||||
UINT32 volatile *pReg_usec = (UINT32*)sys_timer_usec;
|
||||
UINT32 volatile *pReg_sec = (UINT32*)sys_timer_sec;
|
||||
UINT32 volatile *pSSRAM = (UINT32*)sys_ssram_io;
|
||||
UINT32 volatile *pTim_ctrl = (UINT32*)sys_itim_ctrl;
|
||||
UINT32 volatile *pTim_stat = (UINT32*)sys_itim_stat;
|
||||
UINT32 volatile *pTim0_cnt = (UINT32*)sys_itim0_cnt;
|
||||
UINT32 volatile *pTim0_cmp = (UINT32*)sys_itim0_cmp;
|
||||
UINT32 volatile *pTim1_cnt = (UINT32*)sys_itim1_cnt;
|
||||
UINT32 volatile *pTim1_cmp = (UINT32*)sys_itim1_cmp;
|
||||
UINT32 volatile *pVGA_ctrl = (UINT32*)sys_vga_ctrl;
|
||||
UINT32 volatile *pVGA_moffs = (UINT32*)sys_vga_moffs;
|
||||
UINT32 volatile *pVGA_resx = (UINT32*)sys_vga_resx;
|
||||
UINT32 volatile *pVGA_resy = (UINT32*)sys_vga_resy;
|
||||
UINT32 volatile *pVGA_fps = (UINT32*)sys_vga_fps;
|
||||
UINT32 volatile *pVGA_cgcol = (UINT32*)sys_vga_cgcol;
|
||||
UINT32 volatile *pFlashPicture = (UINT32*)(sys_flash_mem + 0x00600000);
|
||||
UINT32 screen_res_x, screen_res_y, screen_fps;
|
||||
UINT64 *pBuf64;
|
||||
time_t curr_date;
|
||||
struct tm *pDate, date;
|
||||
UINT32 start, end;
|
||||
char sel[80];
|
||||
struct timeval time_sec;
|
||||
|
||||
|
||||
g_cnt = 1;
|
||||
screen_fps = *pVGA_fps;
|
||||
screen_res_x = *pVGA_resx;
|
||||
screen_res_y = *pVGA_resy;
|
||||
|
||||
*pVGA_cgcol = 0x00C0C0C0;
|
||||
*pVGA_ctrl &= ~sys_vga_bit_msten;
|
||||
cg_clr_screen();
|
||||
|
||||
pBuf64 = (UINT64*)malloc(screen_res_x*screen_res_y*sizeof(UINT32));
|
||||
|
||||
*pVGA_moffs = (UINT32)pBuf64;
|
||||
|
||||
*pTim0_cnt = 0;
|
||||
*pTim1_cnt = 0;
|
||||
*pTim0_cmp = (UINT32)(rand() & 0x3FF);
|
||||
*pTim1_cmp = 100000000;
|
||||
*pTim_stat = (1 << 2) | (1 << 0);
|
||||
*pTim_ctrl = (3 << 2);
|
||||
|
||||
// *pUART_baud = 1;
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
PrintCPUinfo();
|
||||
|
||||
g_i = 0;
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
interrupt_register(3, handler3);
|
||||
fprintf(stderr, "UART interrupt registered.\n");
|
||||
|
||||
interrupt_register(7, handler7);
|
||||
fprintf(stderr, "Timer interrupt registered.\n");
|
||||
|
||||
printf("\n");
|
||||
|
||||
LoadPic(pBuf64, screen_res_x, screen_res_y, pFlashPicture, PIC_NX, PIC_NY, 1, 1);
|
||||
|
||||
*pVGA_ctrl |= sys_vga_bit_msten;
|
||||
|
||||
printf("VGA status = %08X\n", *pVGA_ctrl);
|
||||
printf("VGA screen = %d x %d @ %d fps\n", screen_res_x, screen_res_y, screen_fps);
|
||||
|
||||
printf("Aktuelles Datum\n");
|
||||
curr_date = time(NULL);
|
||||
pDate = gmtime(&curr_date);
|
||||
puts(asctime(pDate));
|
||||
printf("Datum und Uhrzeit setzen? [j/N]: ");
|
||||
scanf("%s", sel);
|
||||
if (toupper(sel[0]) == 'J')
|
||||
|
||||
if (curr_date < 2)
|
||||
{
|
||||
do
|
||||
printf("Datum und Uhrzeit setzen? [j/N]: ");
|
||||
scanf("%s", sel);
|
||||
if (toupper(sel[0]) == 'J')
|
||||
{
|
||||
printf("Datum\n");
|
||||
printf("Jahr : ");
|
||||
scanf("%d", &date.tm_year);
|
||||
printf("Monat : ");
|
||||
scanf("%d", &date.tm_mon);
|
||||
printf("Tag : ");
|
||||
scanf("%d", &date.tm_mday);
|
||||
do
|
||||
{
|
||||
printf("Datum\n");
|
||||
printf("Jahr : ");
|
||||
scanf("%d", &date.tm_year);
|
||||
printf("Monat : ");
|
||||
scanf("%d", &date.tm_mon);
|
||||
printf("Tag : ");
|
||||
scanf("%d", &date.tm_mday);
|
||||
|
||||
printf("Uhrzeit\n");
|
||||
printf("Stunde : ");
|
||||
scanf("%d", &date.tm_hour);
|
||||
printf("Minute : ");
|
||||
scanf("%d", &date.tm_min);
|
||||
printf("Sekunde : ");
|
||||
scanf("%d", &date.tm_sec);
|
||||
printf("Uhrzeit\n");
|
||||
printf("Stunde : ");
|
||||
scanf("%d", &date.tm_hour);
|
||||
printf("Minute : ");
|
||||
scanf("%d", &date.tm_min);
|
||||
printf("Sekunde : ");
|
||||
scanf("%d", &date.tm_sec);
|
||||
|
||||
date.tm_year -= 1900;
|
||||
date.tm_mon -= 1;
|
||||
time_sec.tv_sec = mktime(&date);
|
||||
time_sec.tv_usec = 0;
|
||||
settimeofday(&time_sec, NULL);
|
||||
date.tm_year -= 1900;
|
||||
date.tm_mon -= 1;
|
||||
time_sec.tv_sec = mktime(&date);
|
||||
time_sec.tv_usec = 0;
|
||||
settimeofday(&time_sec, NULL);
|
||||
|
||||
printf("Datum\n");
|
||||
curr_date = time(NULL);
|
||||
pDate = gmtime(&curr_date);
|
||||
puts(asctime(pDate));
|
||||
printf("\nOK? [J/n]: ");
|
||||
scanf("%s", sel);
|
||||
printf("sel=%d\n", (int)sel[0]);
|
||||
printf("Datum\n");
|
||||
curr_date = time(NULL);
|
||||
pDate = gmtime(&curr_date);
|
||||
puts(asctime(pDate));
|
||||
printf("\nOK? [J/n]: ");
|
||||
scanf("%s", sel);
|
||||
printf("sel=%d\n", (int)sel[0]);
|
||||
|
||||
|
||||
} while(toupper(sel[0]) == 'N');
|
||||
} while(toupper(sel[0]) == 'N');
|
||||
}
|
||||
}
|
||||
|
||||
interrupt_enable(7);
|
||||
interrupt_enable(3);
|
||||
*pTim_ctrl |= 3;
|
||||
*pUART_stat |= (1 << 6);
|
||||
srand(clock());
|
||||
|
||||
cnt = 0;
|
||||
while (1)
|
||||
@@ -834,6 +1013,14 @@ int main (void)
|
||||
paranoia(1, NULL);
|
||||
printf("passed\n\n");
|
||||
|
||||
printf("-------------------------------------------\n");
|
||||
printf("-- Mem Test -------------------------------\n");
|
||||
printf("-------------------------------------------\n");
|
||||
result = Test16_MemTest();
|
||||
if (IS_ERROR(result))
|
||||
break;
|
||||
printf("passed\n\n");
|
||||
|
||||
printf("Iteration %d: Passed\n", cnt);
|
||||
curr_date = time(NULL);
|
||||
pDate = gmtime(&curr_date);
|
||||
|
||||
Reference in New Issue
Block a user