- added timer stuff
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@466 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -43,13 +43,14 @@ void handler7(void)
|
||||
{
|
||||
UINT32 volatile *pGPIO0 = (UINT32*)sys_gpio0;
|
||||
UINT32 volatile *pTim_stat = (UINT32*)sys_itim_stat;
|
||||
UINT32 volatile *pTim_cmp = (UINT32*)sys_itim_cmp;
|
||||
UINT32 volatile *pTim_ctrl = (UINT32*)sys_itim_ctrl;
|
||||
if (*pTim_cmp < 0x200)
|
||||
UINT32 volatile *pTim0_cmp = (UINT32*)sys_itim0_cmp;
|
||||
time_t curr_date;
|
||||
struct tm *pDate;
|
||||
|
||||
if (*pTim0_cmp < 0x200)
|
||||
{
|
||||
// *pTim_ctrl &= ~1;
|
||||
*pTim_cmp = 0x200;
|
||||
// printf("pTim_cmp = %8.8X\n", *pTim_cmp);
|
||||
*pTim0_cmp = 0x200;
|
||||
}
|
||||
if (*pTim_stat & 1)
|
||||
{
|
||||
@@ -57,6 +58,13 @@ void handler7(void)
|
||||
*pGPIO0 = g_cnt++;
|
||||
}
|
||||
|
||||
if (*pTim_stat & 4)
|
||||
{
|
||||
*pTim_stat = 4;
|
||||
curr_date = time(NULL);
|
||||
pDate = gmtime(&curr_date);
|
||||
fprintf(stderr, "%s", asctime(pDate));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -452,17 +460,22 @@ int main (void)
|
||||
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 *pTim_cnt = (UINT32*)sys_itim_cnt;
|
||||
UINT32 volatile *pTim_cmp = (UINT32*)sys_itim_cmp;
|
||||
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());
|
||||
|
||||
*pTim_cnt = 0;
|
||||
*pTim_cmp = (UINT32)(rand() & 0x3FF);
|
||||
*pTim_stat = 1;
|
||||
*pTim_ctrl = 3;
|
||||
*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;
|
||||
@@ -703,6 +716,7 @@ int main (void)
|
||||
free(pDst32);
|
||||
|
||||
memdump((UINT8*)pSrc32, 0, 16, size);
|
||||
memdump((UINT8*)0x40000000, 0, 16, 1024);
|
||||
|
||||
// Memtest END
|
||||
// ----------------------------------------------------------
|
||||
@@ -752,8 +766,10 @@ int main (void)
|
||||
} while(toupper(sel[0]) == 'N');
|
||||
}
|
||||
|
||||
interrupt_enable(3);
|
||||
interrupt_enable(7);
|
||||
interrupt_enable(3);
|
||||
*pTim_ctrl |= 3;
|
||||
|
||||
cnt = 0;
|
||||
while (1)
|
||||
{
|
||||
@@ -827,7 +843,7 @@ int main (void)
|
||||
pDate = gmtime(&curr_date);
|
||||
puts(asctime(pDate));
|
||||
cnt++;
|
||||
*pTim_cmp = (UINT32)(rand() & 0x3FF);
|
||||
*pTim0_cmp = (UINT32)(rand() & 0x3FF);
|
||||
*pTim_ctrl |= 1;
|
||||
|
||||
// printf("V=%.17e\n", pow((double)cnt-1, (double)cnt));
|
||||
|
||||
Reference in New Issue
Block a user