Renamed old to new
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@701 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -6,25 +6,75 @@
|
||||
#include <sys/times.h>
|
||||
#include <sys/time.h>
|
||||
#include "libsys.h"
|
||||
#include "mips_gfx.h"
|
||||
|
||||
#define TEST10_ERROR (ERROR | 0x10)
|
||||
#define TEST11_ERROR (ERROR | 0x11)
|
||||
#define TEST12_ERROR (ERROR | 0x12)
|
||||
#define TEST13_ERROR (ERROR | 0x13)
|
||||
#define TEST14_ERROR (ERROR | 0x14)
|
||||
#define TEST15_ERROR (ERROR | 0x15)
|
||||
#define TEST16_ERROR (ERROR | 0x16)
|
||||
#define TEST10_ERROR (ERROR | 0x1000)
|
||||
#define TEST11_ERROR (ERROR | 0x1100)
|
||||
#define TEST12_ERROR (ERROR | 0x1200)
|
||||
#define TEST13_ERROR (ERROR | 0x1300)
|
||||
#define TEST14_ERROR (ERROR | 0x1400)
|
||||
#define TEST15_ERROR (ERROR | 0x1500)
|
||||
#define TEST16_ERROR (ERROR | 0x1600)
|
||||
|
||||
#define PIC_NX 800
|
||||
#define PIC_NY 600
|
||||
|
||||
char buffer[16384];
|
||||
int g_i;
|
||||
|
||||
extern int paranoia(int argc, char **argv);
|
||||
|
||||
UINT32* pf(void)
|
||||
{
|
||||
static UINT32 p;
|
||||
|
||||
return &p;
|
||||
}
|
||||
|
||||
volatile UINT32 _g_blitter_rdy;
|
||||
void ISR_blitter_rdy(void)
|
||||
{
|
||||
UINT32 volatile *pVGA_ctrl = (UINT32*)SYS_VGA_CTRL;
|
||||
|
||||
if (*pVGA_ctrl & SYS_VGA_BIT_BLIT_FIN)
|
||||
{
|
||||
putchar('.');
|
||||
// Ack
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_BLIT_ACK;
|
||||
_g_blitter_rdy = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
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, j, black;
|
||||
UINT32 *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;
|
||||
for (i=0; i < screen_nx*screen_ny; i += 8)
|
||||
{
|
||||
__gfx_block_set_8(pScr, 0);
|
||||
pScr += 8;
|
||||
}
|
||||
|
||||
if (!pImage)
|
||||
return;
|
||||
|
||||
pScr = ((UINT32*)pScreen) + screen_nx*off_y + off_x;
|
||||
pImg = pImage;
|
||||
|
||||
for (i=0; i < image_ny*image_nx; i += 8)
|
||||
{
|
||||
__gfx_block_copy_8(pScr, pImg);
|
||||
pScr += 8;
|
||||
pImg += 8;
|
||||
}
|
||||
|
||||
/*
|
||||
UINT32 off_x, off_y;
|
||||
UINT32 i;
|
||||
UINT32 *pScr;
|
||||
@@ -40,128 +90,7 @@ void LoadPic(UINT64 *pScreen, UINT32 screen_nx, UINT32 screen_ny, UINT32 *pImage
|
||||
memcpy(pScr, &pImage[i*image_nx], image_nx*sizeof(UINT32));
|
||||
pScr += screen_nx;
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct _sbox_t
|
||||
{
|
||||
UINT32 w, h;
|
||||
UINT32 x, y;
|
||||
UINT32 *pSave;
|
||||
} box_t;
|
||||
|
||||
typedef struct _sgfx_t
|
||||
{
|
||||
UINT32 w, h;
|
||||
UINT32 *pFB;
|
||||
} gfx_t;
|
||||
|
||||
void GFX_init(gfx_t *pObj)
|
||||
{
|
||||
UINT32 volatile *pVGA_moffs = (UINT32*)SYS_VGA_MOFFS;
|
||||
UINT32 volatile *pVGA_resx = (UINT32*)SYS_VGA_RESX;
|
||||
UINT32 volatile *pVGA_resy = (UINT32*)SYS_VGA_RESY;
|
||||
|
||||
pObj->pFB = (UINT32*)*pVGA_moffs;
|
||||
pObj->w = *pVGA_resx;
|
||||
pObj->h = *pVGA_resy;
|
||||
}
|
||||
|
||||
void GFX_box_create(box_t *pObj, UINT32 w, UINT32 h)
|
||||
{
|
||||
pObj->pSave = NULL;
|
||||
pObj->w = w;
|
||||
pObj->h = h;
|
||||
pObj->x = -1;
|
||||
pObj->y = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
void GFX_restore(gfx_t *pObj, box_t *pBox)
|
||||
{
|
||||
if (!pBox->pSave)
|
||||
{
|
||||
malloc(w*h*sizeof(UINT32));
|
||||
|
||||
if (!((xmax-xmin)%8))
|
||||
{
|
||||
i = 0;
|
||||
for (y=ymin; y < ymax; y += pObj->w)
|
||||
{
|
||||
|
||||
for (x=xmin; x < xmax; x += 8)
|
||||
{
|
||||
pBox->pSave[i+0] = pObj->pFB[x + y + 0];
|
||||
pBox->pSave[i+1] = pObj->pFB[x + y + 1];
|
||||
pBox->pSave[i+2] = pObj->pFB[x + y + 2];
|
||||
pBox->pSave[i+3] = pObj->pFB[x + y + 3];
|
||||
pBox->pSave[i+4] = pObj->pFB[x + y + 4];
|
||||
pBox->pSave[i+5] = pObj->pFB[x + y + 5];
|
||||
pBox->pSave[i+6] = pObj->pFB[x + y + 6];
|
||||
pBox->pSave[i+7] = pObj->pFB[x + y + 7];
|
||||
}
|
||||
i += 8;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
i = 0;
|
||||
for (y=ymin; y < ymax; y += pObj->w)
|
||||
{
|
||||
for (x=xmin; x < xmax; x++)
|
||||
{
|
||||
pBox->pSave[i++] = pObj->pFB[x + y];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void GFX_box_draw(gfx_t *pObj, box_t *pBox, UINT32 posx, UINT32 posy, UINT32 color)
|
||||
{
|
||||
UINT32 xmin, xmax, ymin, ymax, x, y, i;
|
||||
|
||||
xmin = posx;
|
||||
xmax = pBox->w + posx;
|
||||
if (xmax > pObj->w)
|
||||
xmax = pObj->w;
|
||||
|
||||
|
||||
ymin = pObj->w*posy;
|
||||
ymax = pBox->h + posy;
|
||||
if (ymax > pObj->h)
|
||||
ymax = pObj->h;
|
||||
|
||||
ymax *= pObj->w;
|
||||
|
||||
if (!((xmax-xmin)%8))
|
||||
{
|
||||
for (y=ymin; y < ymax; y += pObj->w)
|
||||
{
|
||||
|
||||
for (x=xmin; x < xmax; x += 8)
|
||||
{
|
||||
pObj->pFB[x + y + 0] = color;
|
||||
pObj->pFB[x + y + 1] = color;
|
||||
pObj->pFB[x + y + 2] = color;
|
||||
pObj->pFB[x + y + 3] = color;
|
||||
pObj->pFB[x + y + 4] = color;
|
||||
pObj->pFB[x + y + 5] = color;
|
||||
pObj->pFB[x + y + 6] = color;
|
||||
pObj->pFB[x + y + 7] = color;
|
||||
}
|
||||
i += 8;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
for (y=ymin; y < ymax; y += pObj->w)
|
||||
{
|
||||
for (x=xmin; x < xmax; x++)
|
||||
{
|
||||
pObj->pFB[x + y] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int IsEndianBig(void)
|
||||
@@ -185,13 +114,10 @@ void handler3(void)
|
||||
{
|
||||
volatile UINT32 *pUART_stat = (UINT32*)SYS_UART_STAT;
|
||||
volatile UINT32 *pUART_data = (UINT32*)SYS_UART_DATA;
|
||||
volatile UINT32 *pLED = (UINT32*)SYS_LED_PORT;
|
||||
|
||||
while((0x10 & *pUART_stat))
|
||||
if((0x10 & *pUART_stat))
|
||||
{
|
||||
buffer[g_i] = (char)*pUART_data;
|
||||
_putchar(0, buffer[g_i]);
|
||||
g_i = (g_i+1)%sizeof(buffer);
|
||||
_putchar(0, (char)*pUART_data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -199,6 +125,7 @@ void handler3(void)
|
||||
int g_cnt;
|
||||
box_t box;
|
||||
gfx_t gfx;
|
||||
int posx, posy;
|
||||
|
||||
void handler7(void)
|
||||
{
|
||||
@@ -217,7 +144,15 @@ void handler7(void)
|
||||
{
|
||||
*pTim_stat = 1;
|
||||
*pGPIO0 = g_cnt++;
|
||||
GFX_box_draw(&gfx, &box, (UINT32)rand()%800, (UINT32)rand()%600, (UINT32)rand());
|
||||
GFX_frame(&gfx, GFX_FRAME_NOSYNC);
|
||||
GFX_restore(&gfx, &box, posx, posy);
|
||||
GFX_show(&gfx);
|
||||
|
||||
posx = (UINT32)rand()%800;
|
||||
posy = (UINT32)rand()%600;
|
||||
GFX_frame(&gfx, GFX_FRAME_NOSYNC);
|
||||
GFX_box_draw(&gfx, &box, posx, posy, (UINT32)rand());
|
||||
GFX_show(&gfx);
|
||||
}
|
||||
|
||||
if (*pTim_stat & 4)
|
||||
@@ -293,22 +228,68 @@ void PrintCPUinfo(void)
|
||||
|
||||
}
|
||||
|
||||
int non_aligned_load(UINT32* pMem)
|
||||
UINT32 uncached_cachemiss_bug(void)
|
||||
{
|
||||
UINT32 result;
|
||||
UINT32 pMem[2];
|
||||
|
||||
pMem[0] = 0x12345678;
|
||||
pMem[1] = 0xFFFFFFFF;
|
||||
|
||||
__asm__
|
||||
(
|
||||
"cop0 34\n"
|
||||
"lui $s0, 0xA000\n"
|
||||
"lw $a0, 48($s0)\n"
|
||||
"or $s1, $a0, $0\n"
|
||||
"or $a2, $0, $0\n"
|
||||
"addiu $a2, 0x7F00\n"
|
||||
"sw $a2, 48($s0)\n"
|
||||
// "lw $a1, 0(%[pMem])\n"
|
||||
"lw $a0, 48($s0)\n"
|
||||
"lw $a2, 4(%[pMem])\n"
|
||||
"lw $a1, 0(%[pMem])\n"
|
||||
"nop\n"
|
||||
"sw $s1, 48($s0)\n"
|
||||
"or %[val], $a0, $0\n"
|
||||
: [val] "=r" (result)
|
||||
: [pMem] "r" (pMem)
|
||||
: "a0", "a1", "a2", "s0", "s1"
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
UINT32 non_aligned_load()
|
||||
{
|
||||
UINT32 result;
|
||||
UINT32 pMem[3];
|
||||
|
||||
__asm__
|
||||
(
|
||||
"li $t0, 0x01234567\n"
|
||||
"li $t1, 0x89ABCDEF\n"
|
||||
"sw $t0, 0(%[pMem])\n"
|
||||
"sw $t1, 64(%[pMem])\n"
|
||||
"sw $t1, 4(%[pMem])\n"
|
||||
"li %[val], 0x55555555\n"
|
||||
"lw %[val], 0(%[pMem])\n"
|
||||
"lwl %[val], 65(%[pMem])\n"
|
||||
"lwl %[val], 5(%[pMem])\n"
|
||||
: [val] "=r" (result)
|
||||
: [pMem] "r" (pMem)
|
||||
: "t0", "t1"
|
||||
);
|
||||
return result;
|
||||
|
||||
if (0 == IsEndianBig())
|
||||
{
|
||||
if (0xCDEF4567 != result)
|
||||
return ERROR;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0xABCDEF67 != result)
|
||||
return ERROR;
|
||||
}
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int Test10_LoadStore()
|
||||
@@ -432,22 +413,18 @@ 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;
|
||||
if (IS_ERROR(err))
|
||||
return err;
|
||||
|
||||
if (IS_ERROR(non_aligned_load()))
|
||||
return TEST10_ERROR | 1;
|
||||
|
||||
if (IS_ERROR(uncached_cachemiss_bug()))
|
||||
return TEST10_ERROR | 2;
|
||||
|
||||
return NO_ERROR;
|
||||
|
||||
}
|
||||
|
||||
@@ -663,6 +640,15 @@ int Test16_MemTest(void)
|
||||
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;
|
||||
UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST;
|
||||
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 *pSrc32, *pDst32;
|
||||
UINT32 start, end;
|
||||
@@ -715,7 +701,7 @@ int Test16_MemTest(void)
|
||||
start = clock();
|
||||
memset(ram8, 0, TEST_SIZE);
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
printf("Zeroize SDRAM (8-Bit access)...");
|
||||
start = clock();
|
||||
@@ -723,7 +709,7 @@ int Test16_MemTest(void)
|
||||
ram8[i] = (UINT8)0;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
ram16 = (UINT16*)pDst32;
|
||||
printf("Zeroize SDRAM (16-Bit access)...");
|
||||
@@ -732,7 +718,7 @@ int Test16_MemTest(void)
|
||||
ram16[i] = (UINT16)0;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
ram32 = (UINT32*)pDst32;
|
||||
printf("Zeroize SDRAM (32-Bit access)...");
|
||||
@@ -741,7 +727,7 @@ int Test16_MemTest(void)
|
||||
ram32[i] = (UINT32)0;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
ram8 = (UINT8*)pDst32;
|
||||
printf("Write SDRAM (8-Bit access)...");
|
||||
@@ -750,7 +736,7 @@ int Test16_MemTest(void)
|
||||
ram8[i] = (UINT8)i;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
printf("Verify SDRAM (8-Bit access)...");
|
||||
start = clock();
|
||||
@@ -766,7 +752,7 @@ int Test16_MemTest(void)
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
else
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
ram16 = (UINT16*)pDst32;
|
||||
printf("Write SDRAM (16-Bit access)...");
|
||||
@@ -775,7 +761,7 @@ int Test16_MemTest(void)
|
||||
ram16[i] = (UINT16)i;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
printf("Verify SDRAM (16-Bit access)...");
|
||||
start = clock();
|
||||
@@ -791,7 +777,7 @@ int Test16_MemTest(void)
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
else
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
|
||||
ram32 = (UINT32*)pDst32;
|
||||
@@ -803,7 +789,7 @@ int Test16_MemTest(void)
|
||||
}
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
printf("Verify SDRAM (32-Bit access)...");
|
||||
start = clock();
|
||||
@@ -821,7 +807,7 @@ int Test16_MemTest(void)
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
else
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
printf("\n");
|
||||
printf("Small data test (size = %d kByte)\n", SMALL_TEST_SIZE/1024);
|
||||
@@ -833,7 +819,7 @@ int Test16_MemTest(void)
|
||||
ram32[i] = (UINT32)i;
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
// Verify
|
||||
@@ -852,7 +838,7 @@ int Test16_MemTest(void)
|
||||
return TEST16_ERROR;
|
||||
}
|
||||
else
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("passed (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
for (i=1024; i < 4*65536; i *= 2)
|
||||
{
|
||||
@@ -862,7 +848,17 @@ int Test16_MemTest(void)
|
||||
memcpy(pDst32, pSrc32, i);
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
}
|
||||
for (i=1024; i < 4*65536; i *= 2)
|
||||
{
|
||||
printf("__gfx_copy_32() (%d kByte)...", i/1024);
|
||||
start = clock();
|
||||
for (j=0; j < TEST_SIZE/i; j++)
|
||||
__gfx_copy_32(pDst32, pSrc32, i/32);
|
||||
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
printf("\n");
|
||||
@@ -870,21 +866,67 @@ int Test16_MemTest(void)
|
||||
printf("Memcpy() Flash(IO) => SDRAM \n");
|
||||
printf("Copying %d kBytes...", FLASH_SIZE/(1024));
|
||||
start = clock();
|
||||
memcpy(pDst32, pFlashIO, FLASH_SIZE);
|
||||
memcpy(pDst32, (UINT32*)pFlashIO, FLASH_SIZE);
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)FLASH_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
printf("\n");
|
||||
|
||||
printf("Memcpy() Flash(MEM) => SDRAM \n");
|
||||
printf("Copying %d kBytes...", FLASH_SIZE/(1024));
|
||||
start = clock();
|
||||
memcpy(pDst32, pFlashMem, FLASH_SIZE);
|
||||
memcpy(pDst32, (UINT32*)pFlashMem, FLASH_SIZE);
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)FLASH_SIZE/(1024*(end-start)));
|
||||
printf("done (%.2f MByte/s)\n", (double)TEST_SIZE/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
printf("\n");
|
||||
|
||||
interrupt_register(5, (void*)ISR_blitter_rdy);
|
||||
interrupt_enable(5);
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_BLIT_FIN_INTEN;
|
||||
printf("Blitter speed test (scan disabled)...");
|
||||
*pVGA_src0 = (UINT32)pSrc32;
|
||||
*pVGA_dst = (UINT32)pDst32;
|
||||
*pVGA_dimx_src0 = (UINT32)0;
|
||||
*pVGA_dimx_dst = (UINT32)0;
|
||||
*pVGA_nx = (UINT32)TEST_SIZE/4 - 1;
|
||||
*pVGA_ny = (UINT32)0;
|
||||
|
||||
start = clock();
|
||||
for (i=0; i < 10; i++)
|
||||
{
|
||||
_g_blitter_rdy = 0;
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_BLIT_REQ;
|
||||
while (!_g_blitter_rdy);
|
||||
}
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)(10*TEST_SIZE)/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
printf("\n");
|
||||
|
||||
printf("Blitter speed test (scan enabled)...");
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_MSTEN;
|
||||
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 - 1;
|
||||
*pVGA_ny = (UINT32)0;
|
||||
|
||||
start = clock();
|
||||
for (i=0; i < 10; i++)
|
||||
{
|
||||
_g_blitter_rdy = 0;
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_BLIT_REQ;
|
||||
while (!_g_blitter_rdy);
|
||||
}
|
||||
end = clock();
|
||||
printf("done (%.2f MByte/s)\n", (double)(10*TEST_SIZE)/(1024*1024*(double)(end-start)/CLOCKS_PER_SEC));
|
||||
printf("\n");
|
||||
*pVGA_ctrl &= ~SYS_VGA_BIT_MSTEN;
|
||||
*pVGA_ctrl &= ~SYS_VGA_BIT_BLIT_FIN_INTEN;
|
||||
interrupt_disable(5);
|
||||
|
||||
size = 0x2000;
|
||||
memcpy(pDst32, pROM, size);
|
||||
memcpy(pDst32, (UINT32*)pROM, size);
|
||||
printf("Verify boot ROM...");
|
||||
for (i=size/4-1; i >= 0; i--)
|
||||
if (pDst32[i] != pROM[i])
|
||||
@@ -899,7 +941,7 @@ int Test16_MemTest(void)
|
||||
printf("passed\r\n");
|
||||
|
||||
printf("Verify FLASH(IO) <=> FLASH(MEM)...");
|
||||
if (!memcmp(pFlashIO, pFlashMem, FLASH_SIZE))
|
||||
if (!memcmp((UINT32*)pFlashIO, (UINT32*)pFlashMem, FLASH_SIZE))
|
||||
printf("passed\r\n");
|
||||
else
|
||||
{
|
||||
@@ -919,14 +961,6 @@ int Test16_MemTest(void)
|
||||
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)
|
||||
|
||||
int main (void)
|
||||
{
|
||||
int result, i, j, cnt, size;
|
||||
@@ -942,15 +976,20 @@ int main (void)
|
||||
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 volatile *pVGA_src0 = (UINT32*)SYS_VGA_BLIT_SRC0;
|
||||
UINT32 volatile *pVGA_dst = (UINT32*)SYS_VGA_BLIT_DST;
|
||||
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 screen_res_x, screen_res_y, screen_fps;
|
||||
UINT64 *pBuf64;
|
||||
UINT64 *pBuf64_0, *pBuf64_1;
|
||||
time_t curr_date;
|
||||
struct tm *pDate, date;
|
||||
UINT32 start, end;
|
||||
@@ -959,22 +998,13 @@ int main (void)
|
||||
|
||||
|
||||
g_cnt = 1;
|
||||
screen_fps = *pVGA_fps;
|
||||
screen_res_x = *pVGA_resx;
|
||||
screen_res_y = *pVGA_resy;
|
||||
|
||||
*pVGA_cgcol = 0x00FFFFFF;
|
||||
*pVGA_ctrl &= ~SYS_VGA_BIT_MSTEN;
|
||||
Screen_clr();
|
||||
|
||||
|
||||
pBuf64 = (UINT64*)malloc(screen_res_x*screen_res_y*sizeof(UINT32));
|
||||
|
||||
*pVGA_moffs = (UINT32)pBuf64;
|
||||
*pVGA_cgcol = 0x00FFFFFF;
|
||||
|
||||
*pTim0_cnt = 0;
|
||||
*pTim1_cnt = 0;
|
||||
*pTim0_cmp = 0x2000 + (UINT32)(rand() & 0x7FFF);
|
||||
*pTim0_cmp = 0x4000;
|
||||
*pTim1_cmp = 100000000;
|
||||
*pTim_stat = (1 << 2) | (1 << 0);
|
||||
*pTim_ctrl = (3 << 2);
|
||||
@@ -984,23 +1014,16 @@ int main (void)
|
||||
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");
|
||||
|
||||
calibrate_delay();
|
||||
|
||||
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);
|
||||
@@ -1048,21 +1071,68 @@ int main (void)
|
||||
} while(toupper(sel[0]) == 'N');
|
||||
}
|
||||
}
|
||||
srand(clock());
|
||||
*pReg = uncached_cachemiss_bug();
|
||||
Test16_MemTest();
|
||||
GFX_box_create(&box, 32, 32);
|
||||
|
||||
printf("pf = %08X\n", (UINT32)pf());
|
||||
*pf() = 0x1234;
|
||||
printf("*pf = %08X\n", (UINT32)*pf());
|
||||
|
||||
box_create(&box, 32, 32);
|
||||
GFX_init(&gfx);
|
||||
|
||||
start = clock();
|
||||
for (i=0; i < 10000; i++)
|
||||
GFX_box_draw(&gfx, &box, (UINT32)rand()%800, (UINT32)rand()%600, (UINT32)rand());
|
||||
for (i=0; i < 100000; i++)
|
||||
{
|
||||
GFX_box_draw_direct(&gfx, &box, (UINT32)rand()%800, (UINT32)rand()%600, (UINT32)rand());
|
||||
}
|
||||
|
||||
end = clock();
|
||||
printf("Fillrate %f rect/s\n", 10000.f/((float)(end-start)/CLOCKS_PER_SEC));
|
||||
printf("Fillrate %f rect/s\n", (float)i/((float)(end-start)/CLOCKS_PER_SEC));
|
||||
sleep(2000);
|
||||
|
||||
GFX_frame(&gfx, GFX_FRAME_SYNC);
|
||||
GFX_set_background(&gfx, pFlashPicture, 800, 600, 1, 1);
|
||||
posx = posy = 0;
|
||||
GFX_show(&gfx);
|
||||
|
||||
// while(1)
|
||||
{
|
||||
// Blitter test
|
||||
fprintf(stderr, "Blit start\n");
|
||||
*pVGA_src0 = (UINT32)*pFlashPicture;
|
||||
*pVGA_dst = (UINT32)*pVGA_moffs_0;
|
||||
*pVGA_dimx_src0 = (UINT32)4*800;
|
||||
*pVGA_dimx_dst = (UINT32)4*800;
|
||||
*pVGA_nx = (UINT32)800 - 1;
|
||||
*pVGA_ny = (UINT32)600 - 1;
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_BLIT_REQ;
|
||||
while (*pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY);
|
||||
|
||||
fprintf(stderr, "Blit end\n");
|
||||
sleep(250);
|
||||
|
||||
// Blitter test
|
||||
fprintf(stderr, "Blit start\n");
|
||||
*pVGA_src0 = (UINT32)gfx.pBG;
|
||||
*pVGA_dst = (UINT32)*pVGA_moffs_0;
|
||||
*pVGA_dimx_src0 = (UINT32)4*800;
|
||||
*pVGA_dimx_dst = (UINT32)4*800;
|
||||
*pVGA_nx = (UINT32)800 - 1;
|
||||
*pVGA_ny = (UINT32)600 - 1;
|
||||
*pVGA_ctrl |= SYS_VGA_BIT_BLIT_REQ;
|
||||
while (*pVGA_ctrl & SYS_VGA_BIT_BLIT_BSY);
|
||||
|
||||
fprintf(stderr, "Blit end\n");
|
||||
sleep(1000);
|
||||
}
|
||||
|
||||
|
||||
interrupt_enable(7);
|
||||
interrupt_enable(3);
|
||||
*pTim_ctrl |= 3;
|
||||
*pUART_stat |= (1 << 6);
|
||||
srand(clock());
|
||||
|
||||
cnt = 0;
|
||||
while (1)
|
||||
@@ -1145,7 +1215,7 @@ int main (void)
|
||||
pDate = gmtime(&curr_date);
|
||||
puts(asctime(pDate));
|
||||
cnt++;
|
||||
*pTim0_cmp = 0x2000 + (UINT32)(rand() & 0x7FFF);
|
||||
*pTim0_cmp = 0x4000 + (UINT32)(rand() & 0x00FFFFFF);
|
||||
*pTim_ctrl |= 1;
|
||||
|
||||
// printf("V=%.17e\n", pow((double)cnt-1, (double)cnt));
|
||||
|
||||
Reference in New Issue
Block a user