- initial import
git-svn-id: http://moon:8086/svn/mips@1 a8ebac50-d88d-4704-bea3-6648445a41b3
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
#include "libsys.h"
|
||||
|
||||
|
||||
void handler(void)
|
||||
{
|
||||
volatile UINT32 *pGPIO0 = (UINT32*)SYS_GPIO_0_BASE;
|
||||
volatile UINT32 *pTim_stat = (UINT32*)SYS_ITIM_STAT;
|
||||
volatile UINT32 *pTim_cmp = (UINT32*)SYS_ITIM0_CMP;
|
||||
if (*pTim_stat & 1)
|
||||
{
|
||||
(*pTim_cmp)++;
|
||||
(*pGPIO0)++;
|
||||
|
||||
*pTim_stat = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
volatile UINT32 *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL;
|
||||
volatile UINT32 *pTim_stat = (UINT32*)SYS_ITIM_STAT;
|
||||
volatile UINT32 *pTim_cnt = (UINT32*)SYS_ITIM0_CNT;
|
||||
volatile UINT32 *pTim_cmp = (UINT32*)SYS_ITIM0_CMP;
|
||||
volatile UINT32 *pGPIO0 = (UINT32*)SYS_GPIO_0_BASE;
|
||||
|
||||
*pGPIO0 = 1;
|
||||
|
||||
interrupt_register(SYS_INT_TIMER, handler);
|
||||
interrupt_enable(SYS_INT_TIMER);
|
||||
|
||||
*pTim_cnt = 0;
|
||||
*pTim_cmp = 1999;
|
||||
*pTim_stat = 1;
|
||||
*pTim_ctrl = 3;
|
||||
|
||||
while(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user