- use build in data types
git-svn-id: http://moon:8086/svn/mips@35 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
+152
-152
@@ -25,26 +25,26 @@ extern int paranoia(int argc, char **argv);
|
||||
gpio_if_t gpio_if;
|
||||
|
||||
|
||||
UINT32* pf(void)
|
||||
uint32_t* pf(void)
|
||||
{
|
||||
static UINT32 p;
|
||||
static uint32_t p;
|
||||
|
||||
return &p;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
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)
|
||||
void LoadPic(uint64_t *pScreen, uint32_t screen_nx, uint32_t screen_ny, uint32_t *pImage, uint32_t image_nx, uint32_t image_ny, uint32_t image_scale_x, uint32_t image_scale_y)
|
||||
{
|
||||
|
||||
UINT32 off_x, off_y;
|
||||
UINT32 i, j, black;
|
||||
UINT32 *pScr, *pImg;
|
||||
uint32_t off_x, off_y;
|
||||
uint32_t i, j, black;
|
||||
uint32_t *pScr, *pImg;
|
||||
|
||||
off_x = (screen_nx-(image_scale_x*image_nx))/2;
|
||||
off_y = (screen_ny-(image_scale_y*image_ny))/2;
|
||||
|
||||
black = 0;
|
||||
pScr = (UINT32*)pScreen;
|
||||
pScr = (uint32_t*)pScreen;
|
||||
for (i=0; i < screen_nx*screen_ny; i += 8)
|
||||
{
|
||||
__gfx_block_set_8(pScr, 0);
|
||||
@@ -54,7 +54,7 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage
|
||||
if (!pImage)
|
||||
return;
|
||||
|
||||
pScr = ((UINT32*)pScreen) + screen_nx*off_y + off_x;
|
||||
pScr = ((uint32_t*)pScreen) + screen_nx*off_y + off_x;
|
||||
pImg = pImage;
|
||||
|
||||
for (i=0; i < image_ny*image_nx; i += 8)
|
||||
@@ -65,19 +65,19 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage
|
||||
}
|
||||
|
||||
/*
|
||||
UINT32 off_x, off_y;
|
||||
UINT32 i;
|
||||
UINT32 *pScr;
|
||||
uint32_t off_x, off_y;
|
||||
uint32_t i;
|
||||
uint32_t *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;
|
||||
memset(pScreen, 0, screen_nx*screen_ny*sizeof(uint32_t));
|
||||
pScr = ((uint32_t*)pScreen) + screen_nx*off_y + off_x;
|
||||
|
||||
for (i=0; i < image_ny; i++)
|
||||
{
|
||||
memcpy(pScr, &pImage[i*image_nx], image_nx*sizeof(UINT32));
|
||||
memcpy(pScr, &pImage[i*image_nx], image_nx*sizeof(uint32_t));
|
||||
pScr += screen_nx;
|
||||
}
|
||||
*/
|
||||
@@ -85,10 +85,10 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage
|
||||
|
||||
int IsEndianBig(void)
|
||||
{
|
||||
UINT8 *pBuf;
|
||||
UINT32 word;
|
||||
uint8_t *pBuf;
|
||||
uint32_t word;
|
||||
word = 0x12345678;
|
||||
pBuf = (UINT8*)&word;
|
||||
pBuf = (uint8_t*)&word;
|
||||
if (((*pBuf+0) == 0x12) && (*(pBuf+1) == 0x34) && (*(pBuf+2) == 0x56) && (*(pBuf+3) == 0x78))
|
||||
{
|
||||
return 1;
|
||||
@@ -102,8 +102,8 @@ int IsEndianBig(void)
|
||||
|
||||
void handler3(void)
|
||||
{
|
||||
volatile UINT32 *pUART_stat = (UINT32*)SYS_UART_STAT;
|
||||
volatile UINT32 *pUART_data = (UINT32*)SYS_UART_DATA;
|
||||
volatile uint32_t *pUART_stat = (uint32_t*)SYS_UART_STAT;
|
||||
volatile uint32_t *pUART_data = (uint32_t*)SYS_UART_DATA;
|
||||
|
||||
if((0x10 & *pUART_stat))
|
||||
{
|
||||
@@ -119,9 +119,9 @@ int posx, posy;
|
||||
|
||||
void handler7(void)
|
||||
{
|
||||
UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT;
|
||||
UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL;
|
||||
UINT32 volatile *pTim0_cmp = (UINT32*)SYS_ITIM0_CMP;
|
||||
uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT;
|
||||
uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL;
|
||||
uint32_t volatile *pTim0_cmp = (uint32_t*)SYS_ITIM0_CMP;
|
||||
time_t curr_date;
|
||||
struct tm *pDate;
|
||||
|
||||
@@ -133,12 +133,12 @@ void handler7(void)
|
||||
GFX_restore(&gfx, &box, posx, posy);
|
||||
GFX_show(&gfx);
|
||||
|
||||
posx = (UINT32)rand()%800;
|
||||
posy = (UINT32)rand()%600;
|
||||
posx = (uint32_t)rand()%800;
|
||||
posy = (uint32_t)rand()%600;
|
||||
GFX_frame(&gfx, GFX_FRAME_NOSYNC);
|
||||
GFX_box_draw(&gfx, &box, posx, posy, (UINT32)rand());
|
||||
GFX_box_draw(&gfx, &box, posx, posy, (uint32_t)rand());
|
||||
GFX_show(&gfx);
|
||||
*pTim0_cmp = (UINT32)(rand() & 0x000FFFFF);
|
||||
*pTim0_cmp = (uint32_t)(rand() & 0x000FFFFF);
|
||||
*pTim_ctrl |= 1;
|
||||
}
|
||||
|
||||
@@ -215,10 +215,10 @@ void PrintCPUinfo(void)
|
||||
|
||||
}
|
||||
|
||||
UINT32 uncached_cachemiss_bug(void)
|
||||
uint32_t uncached_cachemiss_bug(void)
|
||||
{
|
||||
UINT32 result;
|
||||
UINT32 pMem[2];
|
||||
uint32_t result;
|
||||
uint32_t pMem[2];
|
||||
|
||||
pMem[0] = 0x12345678;
|
||||
pMem[1] = 0xFFFFFFFF;
|
||||
@@ -246,10 +246,10 @@ UINT32 uncached_cachemiss_bug(void)
|
||||
return result;
|
||||
}
|
||||
|
||||
UINT32 non_aligned_load()
|
||||
uint32_t non_aligned_load()
|
||||
{
|
||||
UINT32 result;
|
||||
UINT32 pMem[3];
|
||||
uint32_t result;
|
||||
uint32_t pMem[3];
|
||||
|
||||
__asm__
|
||||
(
|
||||
@@ -492,11 +492,11 @@ int Test12_MulDiv()
|
||||
int Test13_COP0_Load_Store(void)
|
||||
{
|
||||
int i,size;
|
||||
UINT32 *pSrc32, *pDst32;
|
||||
uint32_t *pSrc32, *pDst32;
|
||||
|
||||
size = 0x2000;
|
||||
pSrc32 = (UINT32*)0xBFC00000;
|
||||
pDst32 = (UINT32*)calloc(size,sizeof(UINT32));
|
||||
pSrc32 = (uint32_t*)0xBFC00000;
|
||||
pDst32 = (uint32_t*)calloc(size,sizeof(uint32_t));
|
||||
for (i=0; i < size/4; i++)
|
||||
{
|
||||
CP0_TR_read_ptr(&pSrc32[i]);
|
||||
@@ -517,11 +517,11 @@ int Test13_COP0_Load_Store(void)
|
||||
int Test14_DCACHE_invalidate(void)
|
||||
{
|
||||
int i,size;
|
||||
UINT32 *pSrc32, *pDst32;
|
||||
uint32_t *pSrc32, *pDst32;
|
||||
|
||||
size = 0x2000;
|
||||
pSrc32 = (UINT32*)0xBFC00000;
|
||||
pDst32 = (UINT32*)calloc(size,sizeof(UINT32));
|
||||
pSrc32 = (uint32_t*)0xBFC00000;
|
||||
pDst32 = (uint32_t*)calloc(size,sizeof(uint32_t));
|
||||
for (i=0; i < size/4; i++)
|
||||
{
|
||||
pDst32[i] = pSrc32[i];
|
||||
@@ -539,7 +539,7 @@ int Test14_DCACHE_invalidate(void)
|
||||
if (i)
|
||||
return TEST14_ERROR;
|
||||
|
||||
pDst32 = (UINT32*)calloc(size,sizeof(UINT32));
|
||||
pDst32 = (uint32_t*)calloc(size,sizeof(uint32_t));
|
||||
for (i=0; i < size/4; i++)
|
||||
{
|
||||
pDst32[i] = pSrc32[i];
|
||||
@@ -566,9 +566,9 @@ int Test15_pi_calc()
|
||||
int i, j, k;
|
||||
int carry = 0;
|
||||
int arr[PI_MAXARR+1];
|
||||
UINT32 int_part, result;
|
||||
UINT16 pi_res[200] = {0};
|
||||
UINT16 pi_ref[200] =
|
||||
uint32_t int_part, result;
|
||||
uint16_t pi_res[200] = {0};
|
||||
uint16_t pi_ref[200] =
|
||||
{
|
||||
3141,5926,5358,9793,2384,6264,3383,2795, 288,4197,1693,9937,5105,8209,7494,4592,3078,1640,6286,2089,9862,8034,8253,4211,
|
||||
7067,9821,4808,6513,2823, 664,7093,8446, 955, 582,2317,2535,9408,1284,8111,7450,2841, 270,1938,5211, 555,9644,6229,4895,
|
||||
@@ -597,12 +597,12 @@ int Test15_pi_calc()
|
||||
}
|
||||
result = carry + sum/PI_SCALE;
|
||||
int_part = PI_SCALE * (result / PI_SCALE);
|
||||
pi_res[k] = (UINT16)(result - int_part);
|
||||
pi_res[k] = (uint16_t)(result - int_part);
|
||||
carry = sum % PI_SCALE;
|
||||
k++;
|
||||
}
|
||||
|
||||
for (k=0; k < sizeof(pi_ref)/sizeof(UINT16); k++)
|
||||
for (k=0; k < sizeof(pi_ref)/sizeof(uint16_t); k++)
|
||||
{
|
||||
printf("%d", pi_res[k]);
|
||||
}
|
||||
@@ -621,27 +621,27 @@ int Test15_pi_calc()
|
||||
int Test16_MemTest(void)
|
||||
{
|
||||
int result, i, j, cnt, size;
|
||||
UINT8 *ram8 = NULL;
|
||||
UINT16 *ram16 = NULL;
|
||||
UINT32 *ram32 = NULL;
|
||||
UINT32 volatile *pFlashIO = (UINT32*)SYS_FLASH_IO;
|
||||
UINT32 volatile *pFlashMem = (UINT32*)SYS_FLASH_MEM;
|
||||
UINT32 volatile *pROM = (UINT32*)0xBFC00000;
|
||||
UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_ADDR;
|
||||
UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST_ADDR;
|
||||
UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX;
|
||||
UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX;
|
||||
UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX;
|
||||
UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY;
|
||||
UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL;
|
||||
UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT;
|
||||
UINT32 volatile *pVGA_moffs_1 = (UINT32*)SYS_VGA_FB_BACK;
|
||||
UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_COLOR;
|
||||
uint8_t *ram8 = NULL;
|
||||
uint16_t *ram16 = NULL;
|
||||
uint32_t *ram32 = NULL;
|
||||
uint32_t volatile *pFlashIO = (uint32_t*)SYS_FLASH_IO;
|
||||
uint32_t volatile *pFlashMem = (uint32_t*)SYS_FLASH_MEM;
|
||||
uint32_t volatile *pROM = (uint32_t*)0xBFC00000;
|
||||
uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_ADDR;
|
||||
uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST_ADDR;
|
||||
uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX;
|
||||
uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX;
|
||||
uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX;
|
||||
uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY;
|
||||
uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL;
|
||||
uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT;
|
||||
uint32_t volatile *pVGA_moffs_1 = (uint32_t*)SYS_VGA_FB_BACK;
|
||||
uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_COLOR;
|
||||
|
||||
|
||||
UINT32 *pSrc32, *pDst32;
|
||||
UINT32 start, end;
|
||||
UINT32 color_cycle[12] = {0x000000FF, 0x00808080, 0x0000FFFF, 0x00808080, 0x0000FF00, 0x00808080, 0x00FFFF00, 0x00808080, 0x00FF0000, 0x00808080, 0x00FF00FF, 0x00808080};
|
||||
uint32_t *pSrc32, *pDst32;
|
||||
uint32_t start, end;
|
||||
uint32_t color_cycle[12] = {0x000000FF, 0x00808080, 0x0000FFFF, 0x00808080, 0x0000FF00, 0x00808080, 0x00FFFF00, 0x00808080, 0x00FF0000, 0x00808080, 0x00FF00FF, 0x00808080};
|
||||
|
||||
// ----------------------------------------------------------
|
||||
// Memtest BEGIN
|
||||
@@ -651,18 +651,18 @@ int Test16_MemTest(void)
|
||||
start = clock();
|
||||
for (j=0; j < TEST_SIZE/SMALL_TEST_SIZE; j++)
|
||||
for (i=0; i < SMALL_TEST_SIZE/4; i++)
|
||||
pSSRAM[i] = (UINT32)i;
|
||||
pSSRAM[i] = (uint32_t)i;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start)));
|
||||
|
||||
PrintBuffer8((UINT8*)pSSRAM, 16, 256);
|
||||
PrintBuffer8((uint8_t*)pSSRAM, 16, 256);
|
||||
|
||||
printf("Verify (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--)
|
||||
if (pSSRAM[i] != (UINT32)i)
|
||||
if (pSSRAM[i] != (uint32_t)i)
|
||||
break;
|
||||
|
||||
end = clock();
|
||||
@@ -673,20 +673,20 @@ int Test16_MemTest(void)
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1000*(end-start)));
|
||||
*/
|
||||
// ----------------------------------------------------------
|
||||
pSrc32 = (UINT32*)calloc(TEST_SIZE/4,sizeof(UINT32));
|
||||
pDst32 = (UINT32*)calloc(TEST_SIZE/4,sizeof(UINT32));
|
||||
pSrc32 = (uint32_t*)calloc(TEST_SIZE/4,sizeof(uint32_t));
|
||||
pDst32 = (uint32_t*)calloc(TEST_SIZE/4,sizeof(uint32_t));
|
||||
|
||||
// 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);
|
||||
memdump((uint8_t*)(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*)pDst32;
|
||||
ram8 = (uint8_t*)pDst32;
|
||||
printf("Zeroize SDRAM (memset)...");
|
||||
start = clock();
|
||||
memset(ram8, 0, TEST_SIZE);
|
||||
@@ -696,34 +696,34 @@ int Test16_MemTest(void)
|
||||
printf("Zeroize SDRAM (8-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE; i++)
|
||||
ram8[i] = (UINT8)0;
|
||||
ram8[i] = (uint8_t)0;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
ram16 = (UINT16*)pDst32;
|
||||
ram16 = (uint16_t*)pDst32;
|
||||
printf("Zeroize SDRAM (16-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE/2; i++)
|
||||
ram16[i] = (UINT16)0;
|
||||
ram16[i] = (uint16_t)0;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
ram32 = (UINT32*)pDst32;
|
||||
ram32 = (uint32_t*)pDst32;
|
||||
printf("Zeroize SDRAM (32-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE/4; i++)
|
||||
ram32[i] = (UINT32)0;
|
||||
ram32[i] = (uint32_t)0;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
ram8 = (UINT8*)pDst32;
|
||||
ram8 = (uint8_t*)pDst32;
|
||||
printf("Write SDRAM (8-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE; i++)
|
||||
ram8[i] = (UINT8)i;
|
||||
ram8[i] = (uint8_t)i;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
@@ -731,7 +731,7 @@ int Test16_MemTest(void)
|
||||
printf("Verify SDRAM (8-Bit access)...");
|
||||
start = clock();
|
||||
for (i=TEST_SIZE-1; i >= 0; i--)
|
||||
if (ram8[i] != (UINT8)i)
|
||||
if (ram8[i] != (uint8_t)i)
|
||||
break;
|
||||
|
||||
end = clock();
|
||||
@@ -744,11 +744,11 @@ int Test16_MemTest(void)
|
||||
else
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
ram16 = (UINT16*)pDst32;
|
||||
ram16 = (uint16_t*)pDst32;
|
||||
printf("Write SDRAM (16-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE/2; i++)
|
||||
ram16[i] = (UINT16)i;
|
||||
ram16[i] = (uint16_t)i;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
@@ -756,7 +756,7 @@ int Test16_MemTest(void)
|
||||
printf("Verify SDRAM (16-Bit access)...");
|
||||
start = clock();
|
||||
for (i=TEST_SIZE/2-1; i >= 0; i--)
|
||||
if (ram16[i] != (UINT16)i)
|
||||
if (ram16[i] != (uint16_t)i)
|
||||
break;
|
||||
|
||||
end = clock();
|
||||
@@ -770,12 +770,12 @@ int Test16_MemTest(void)
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
|
||||
ram32 = (UINT32*)pDst32;
|
||||
ram32 = (uint32_t*)pDst32;
|
||||
printf("Write SDRAM (32-Bit access)...");
|
||||
start = clock();
|
||||
for (i=0; i < TEST_SIZE/4; i++)
|
||||
{
|
||||
ram32[i] = (UINT32)i;
|
||||
ram32[i] = (uint32_t)i;
|
||||
}
|
||||
|
||||
end = clock();
|
||||
@@ -785,7 +785,7 @@ int Test16_MemTest(void)
|
||||
start = clock();
|
||||
for (i=TEST_SIZE/4-1; i >= 0; i--)
|
||||
{
|
||||
if (ram32[i] != (UINT32)i)
|
||||
if (ram32[i] != (uint32_t)i)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -802,11 +802,11 @@ int Test16_MemTest(void)
|
||||
printf("\n");
|
||||
printf("Small data test (size = %d kByte)\n", SMALL_TEST_SIZE/1024);
|
||||
printf("Write SDRAM (32-Bit access)...");
|
||||
ram32 = (UINT32*)pDst32;
|
||||
ram32 = (uint32_t*)pDst32;
|
||||
start = clock();
|
||||
for (j=0; j < TEST_SIZE/SMALL_TEST_SIZE; j++)
|
||||
for (i=0; i < SMALL_TEST_SIZE/4; i++)
|
||||
ram32[i] = (UINT32)i;
|
||||
ram32[i] = (uint32_t)i;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
@@ -817,7 +817,7 @@ int Test16_MemTest(void)
|
||||
start = clock();
|
||||
for (j=0; j < TEST_SIZE/SMALL_TEST_SIZE; j++)
|
||||
for (i=SMALL_TEST_SIZE/4-1; i >= 0; i--)
|
||||
if (ram32[i] != (UINT32)i)
|
||||
if (ram32[i] != (uint32_t)i)
|
||||
break;
|
||||
|
||||
end = clock();
|
||||
@@ -856,7 +856,7 @@ int Test16_MemTest(void)
|
||||
printf("Memcpy() Flash(IO) => SDRAM \n");
|
||||
printf("Copying %d kBytes...", FLASH_SIZE/(1024));
|
||||
start = clock();
|
||||
memcpy(pDst32, (UINT32*)pFlashIO, FLASH_SIZE);
|
||||
memcpy(pDst32, (uint32_t*)pFlashIO, FLASH_SIZE);
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
printf("\n");
|
||||
@@ -864,14 +864,14 @@ int Test16_MemTest(void)
|
||||
printf("Memcpy() Flash(MEM) => SDRAM \n");
|
||||
printf("Copying %d kBytes...", FLASH_SIZE/(1024));
|
||||
start = clock();
|
||||
memcpy(pDst32, (UINT32*)pFlashMem, FLASH_SIZE);
|
||||
memcpy(pDst32, (uint32_t*)pFlashMem, FLASH_SIZE);
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
printf("\n");
|
||||
|
||||
#if 1
|
||||
*pVGA_moffs_0 = (UINT32)pSrc32;
|
||||
*pVGA_moffs_1 = (UINT32)pSrc32;
|
||||
*pVGA_moffs_0 = (uint32_t)pSrc32;
|
||||
*pVGA_moffs_1 = (uint32_t)pSrc32;
|
||||
*pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_FIN_INTEN;
|
||||
*pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_EMPTY_INTEN;
|
||||
|
||||
@@ -879,12 +879,12 @@ int Test16_MemTest(void)
|
||||
{
|
||||
*pVGA_ctrl &= ~(SYS_VGA_BIT_BLIT_OP_CONSTCOL | SYS_VGA_BIT_MSTEN);
|
||||
fprintf(stderr, "Blitter copy %d bytes (scan disabled)...", TEST_SIZE/4);
|
||||
*pVGA_src0 = (UINT32)pSrc32;
|
||||
*pVGA_dst = (UINT32)pDst32;
|
||||
*pVGA_dimx_src0 = (UINT32)0;
|
||||
*pVGA_dimx_dst = (UINT32)0;
|
||||
*pVGA_nx = (UINT32)TEST_SIZE/4;
|
||||
*pVGA_ny = (UINT32)1;
|
||||
*pVGA_src0 = (uint32_t)pSrc32;
|
||||
*pVGA_dst = (uint32_t)pDst32;
|
||||
*pVGA_dimx_src0 = (uint32_t)0;
|
||||
*pVGA_dimx_dst = (uint32_t)0;
|
||||
*pVGA_nx = (uint32_t)TEST_SIZE/4;
|
||||
*pVGA_ny = (uint32_t)1;
|
||||
|
||||
start = clock();
|
||||
for (i=0; i < 10; i++)
|
||||
@@ -898,12 +898,12 @@ int Test16_MemTest(void)
|
||||
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_BLIT_OP_CONSTCOL;
|
||||
fprintf(stderr, "Blitter memset %d bytes (scan disabled)...", TEST_SIZE/4);
|
||||
*pVGA_src0 = (UINT32)pSrc32;
|
||||
*pVGA_dst = (UINT32)pDst32;
|
||||
*pVGA_dimx_src0 = (UINT32)0;
|
||||
*pVGA_dimx_dst = (UINT32)0;
|
||||
*pVGA_nx = (UINT32)TEST_SIZE/4;
|
||||
*pVGA_ny = (UINT32)1;
|
||||
*pVGA_src0 = (uint32_t)pSrc32;
|
||||
*pVGA_dst = (uint32_t)pDst32;
|
||||
*pVGA_dimx_src0 = (uint32_t)0;
|
||||
*pVGA_dimx_dst = (uint32_t)0;
|
||||
*pVGA_nx = (uint32_t)TEST_SIZE/4;
|
||||
*pVGA_ny = (uint32_t)1;
|
||||
|
||||
start = clock();
|
||||
for (i=0; i < 10; i++)
|
||||
@@ -920,12 +920,12 @@ int Test16_MemTest(void)
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_MSTEN;
|
||||
*pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_OP_CONSTCOL;
|
||||
sleep(500);
|
||||
*pVGA_src0 = (UINT32)pSrc32;
|
||||
*pVGA_dst = (UINT32)pDst32;
|
||||
*pVGA_dimx_src0 = (UINT32)0;
|
||||
*pVGA_dimx_dst = (UINT32)0;
|
||||
*pVGA_nx = (UINT32)TEST_SIZE/4;
|
||||
*pVGA_ny = (UINT32)1;
|
||||
*pVGA_src0 = (uint32_t)pSrc32;
|
||||
*pVGA_dst = (uint32_t)pDst32;
|
||||
*pVGA_dimx_src0 = (uint32_t)0;
|
||||
*pVGA_dimx_dst = (uint32_t)0;
|
||||
*pVGA_nx = (uint32_t)TEST_SIZE/4;
|
||||
*pVGA_ny = (uint32_t)1;
|
||||
|
||||
start = clock();
|
||||
for (i=0; i < 10; i++)
|
||||
@@ -939,12 +939,12 @@ int Test16_MemTest(void)
|
||||
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_BLIT_OP_CONSTCOL;
|
||||
fprintf(stderr, "Blitter memset %d bytes (scan enabled)...", TEST_SIZE/4);
|
||||
*pVGA_src0 = (UINT32)pSrc32;
|
||||
*pVGA_dst = (UINT32)pDst32;
|
||||
*pVGA_dimx_src0 = (UINT32)0;
|
||||
*pVGA_dimx_dst = (UINT32)0;
|
||||
*pVGA_nx = (UINT32)TEST_SIZE/4;
|
||||
*pVGA_ny = (UINT32)1;
|
||||
*pVGA_src0 = (uint32_t)pSrc32;
|
||||
*pVGA_dst = (uint32_t)pDst32;
|
||||
*pVGA_dimx_src0 = (uint32_t)0;
|
||||
*pVGA_dimx_dst = (uint32_t)0;
|
||||
*pVGA_nx = (uint32_t)TEST_SIZE/4;
|
||||
*pVGA_ny = (uint32_t)1;
|
||||
|
||||
start = clock();
|
||||
for (i=0; i < 10; i++)
|
||||
@@ -966,7 +966,7 @@ int Test16_MemTest(void)
|
||||
#endif
|
||||
|
||||
size = 0x2000;
|
||||
memcpy(pDst32, (UINT32*)pROM, size);
|
||||
memcpy(pDst32, (uint32_t*)pROM, size);
|
||||
printf("Verify boot ROM...");
|
||||
for (i=size/4-1; i >= 0; i--)
|
||||
if (pDst32[i] != pROM[i])
|
||||
@@ -997,16 +997,16 @@ int Test16_MemTest(void)
|
||||
if (i != FLASH_SIZE/4)
|
||||
{
|
||||
printf("failed\n");
|
||||
memdump((UINT8*)&pFlashIO[i], 0, 16, 256);
|
||||
memdump((UINT8*)&pFlashMem[i], 0, 16, 256);
|
||||
memdump((uint8_t*)&pFlashIO[i], 0, 16, 256);
|
||||
memdump((uint8_t*)&pFlashMem[i], 0, 16, 256);
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("passed\n");
|
||||
}
|
||||
|
||||
// memdump((UINT8*)pSrc32, 0, 16, size);
|
||||
// memdump((UINT8*)0x40000000, 0, 16, 1024);
|
||||
// memdump((uint8_t*)pSrc32, 0, 16, size);
|
||||
// memdump((uint8_t*)0x40000000, 0, 16, 1024);
|
||||
|
||||
// Memtest END
|
||||
// ----------------------------------------------------------
|
||||
@@ -1020,42 +1020,42 @@ int Test16_MemTest(void)
|
||||
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 *pGPIO = (UINT32*)SYS_GPIO_0_DATA;
|
||||
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_cgcol = (UINT32*)SYS_VGA_CGCOL;
|
||||
UINT32 *pFlashPicture = (UINT32*)(SYS_FLASH_MEM + 0x00600000);
|
||||
uint32_t volatile *pUART_baud = (uint32_t*)SYS_UART_BAUD;
|
||||
uint32_t volatile *pUART_stat = (uint32_t*)SYS_UART_STAT;
|
||||
uint32_t volatile *pGPIO = (uint32_t*)SYS_GPIO_0_DATA;
|
||||
uint32_t volatile *pReg_usec = (uint32_t*)SYS_TIMER_USEC;
|
||||
uint32_t volatile *pReg_sec = (uint32_t*)SYS_TIMER_SEC;
|
||||
uint32_t volatile *pSSRAM = (uint32_t*)SYS_SSRAM_IO;
|
||||
uint32_t volatile *pTim_ctrl = (uint32_t*)SYS_ITIM_CTRL;
|
||||
uint32_t volatile *pTim_stat = (uint32_t*)SYS_ITIM_STAT;
|
||||
uint32_t volatile *pTim0_cnt = (uint32_t*)SYS_ITIM0_CNT;
|
||||
uint32_t volatile *pTim0_cmp = (uint32_t*)SYS_ITIM0_CMP;
|
||||
uint32_t volatile *pTim1_cnt = (uint32_t*)SYS_ITIM1_CNT;
|
||||
uint32_t volatile *pTim1_cmp = (uint32_t*)SYS_ITIM1_CMP;
|
||||
uint32_t volatile *pVGA_cgcol = (uint32_t*)SYS_VGA_CGCOL;
|
||||
uint32_t *pFlashPicture = (uint32_t*)(SYS_FLASH_MEM + 0x00600000);
|
||||
|
||||
UINT32 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_ADDR;
|
||||
UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST_ADDR;
|
||||
UINT32 volatile *pVGA_dimx_src0 = (UINT32*)SYS_VGA_BLIT_SRC0_DIMX;
|
||||
UINT32 volatile *pVGA_dimx_dst = (UINT32*)SYS_VGA_BLIT_DST_DIMX;
|
||||
UINT32 volatile *pVGA_nx = (UINT32*)SYS_VGA_BLIT_NX;
|
||||
UINT32 volatile *pVGA_ny = (UINT32*)SYS_VGA_BLIT_NY;
|
||||
UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL;
|
||||
UINT32 volatile *pVGA_moffs_0 = (UINT32*)SYS_VGA_FB_FRONT;
|
||||
UINT32 volatile *pVGA_const_color = (UINT32*)SYS_VGA_BLIT_COLOR;
|
||||
UINT32 screen_res_x, screen_res_y, screen_fps;
|
||||
UINT64 *pBuf64_0, *pBuf64_1;
|
||||
uint32_t volatile *pVGA_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_ADDR;
|
||||
uint32_t volatile *pVGA_dst = (uint32_t*)SYS_VGA_BLIT_DST_ADDR;
|
||||
uint32_t volatile *pVGA_dimx_src0 = (uint32_t*)SYS_VGA_BLIT_SRC0_DIMX;
|
||||
uint32_t volatile *pVGA_dimx_dst = (uint32_t*)SYS_VGA_BLIT_DST_DIMX;
|
||||
uint32_t volatile *pVGA_nx = (uint32_t*)SYS_VGA_BLIT_NX;
|
||||
uint32_t volatile *pVGA_ny = (uint32_t*)SYS_VGA_BLIT_NY;
|
||||
uint32_t volatile *pVGA_ctrl = (uint32_t*)SYS_VGA_CTRL;
|
||||
uint32_t volatile *pVGA_moffs_0 = (uint32_t*)SYS_VGA_FB_FRONT;
|
||||
uint32_t volatile *pVGA_const_color = (uint32_t*)SYS_VGA_BLIT_COLOR;
|
||||
uint32_t screen_res_x, screen_res_y, screen_fps;
|
||||
uint64_t *pBuf64_0, *pBuf64_1;
|
||||
time_t curr_date;
|
||||
struct tm *pDate, date;
|
||||
UINT32 start, end;
|
||||
uint32_t start, end;
|
||||
char sel[80];
|
||||
struct timeval time_sec;
|
||||
UINT32 *pPic;
|
||||
uint32_t *pPic;
|
||||
|
||||
|
||||
pPic = (UINT32*)malloc(800*600*sizeof(UINT32));
|
||||
memcpy(pPic, pFlashPicture, 800*600*sizeof(UINT32));
|
||||
pPic = (uint32_t*)malloc(800*600*sizeof(uint32_t));
|
||||
memcpy(pPic, pFlashPicture, 800*600*sizeof(uint32_t));
|
||||
|
||||
g_cnt = 1;
|
||||
Screen_clr();
|
||||
@@ -1141,9 +1141,9 @@ int main (void)
|
||||
|
||||
Test16_MemTest();
|
||||
|
||||
printf("pf = %08X\n", (UINT32)pf());
|
||||
printf("pf = %08X\n", (uint32_t)pf());
|
||||
*pf() = 0x1234;
|
||||
printf("*pf = %08X\n", (UINT32)*pf());
|
||||
printf("*pf = %08X\n", (uint32_t)*pf());
|
||||
|
||||
box_create(&box, 32, 32);
|
||||
GFX_init(&gfx);
|
||||
@@ -1151,7 +1151,7 @@ int main (void)
|
||||
start = clock();
|
||||
for (i=0; i < 10000; i++)
|
||||
{
|
||||
GFX_box_draw_direct(&gfx, &box, (UINT32)rand()%800, (UINT32)rand()%600, (UINT32)rand());
|
||||
GFX_box_draw_direct(&gfx, &box, (uint32_t)rand()%800, (uint32_t)rand()%600, (uint32_t)rand());
|
||||
}
|
||||
|
||||
end = clock();
|
||||
|
||||
Reference in New Issue
Block a user