Files
vhdl/lib/CPUs/MIPS/bsp/examples/test_timer.c
T
jens 191af92d47 Initial version
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@790 cc03376c-175c-47c8-b038-4cd826a8556b
2010-03-13 14:13:53 +00:00

41 lines
621 B
C

#include "libsys.h"
int g_cnt;
void handler7(void)
{
UINT32 *pGPIO0 = (UINT32*)SYS_GPIO0;
UINT32 *pTim_stat = (UINT32*)SYS_ITIM_STAT;
if (*pTim_stat & 1)
{
*pTim_stat = 1;
*pGPIO0 = g_cnt++;
}
}
int main (void)
{
UINT32 *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL;
UINT32 *pTim_stat = (UINT32*)SYS_ITIM_STAT;
UINT32 *pTim_cnt = (UINT32*)SYS_ITIM_CNT;
UINT32 *pTim_cmp = (UINT32*)SYS_ITIM_CMP;
UINT32 *pGPIO0 = (UINT32*)SYS_GPIO0;
g_cnt = 1;
*pGPIO0 = 0;
interrupt_register(7, handler7);
interrupt_enable(7);
*pTim_cnt = 0;
*pTim_cmp = 2000;
*pTim_stat = 1;
*pTim_ctrl = 3;
while(1);
return 0;
}