yezi_wyf
驱动牛犊
驱动牛犊
  • 注册日期2004-04-20
  • 最后登录2009-05-25
  • 粉丝0
  • 关注0
  • 积分3分
  • 威望30点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1369回复:0

高分求救:linux下驱动s3c2410的定时器问题

楼主#
更多 发布于:2004-05-23 14:35
CPU :S3C2410 ,linux,定时器的一个问题
定时器时钟不工作

# include \"asm-arm/arch-s3c2410/S3C2410.h\"
# include \"asm-arm/arch-s3c2410/hardware.h\"

void delayus(int i)
{
int j=0;  

    TCFG0  = ( TCFG0 & 0x000ff ) | 0x10000;    
    printk(\"<1> TCFG0= 0x%08lx\\n\", TCFG0);            
    //Dead zone=1,Prescaler1=0,
    TCFG1  = ( TCFG1 & 0x0fff ) | 0x0000;   //MUX3=1/2
    printk(\"<1> TCFG1= 0x%08lx\\n\", TCFG1);
  
    TCON   = (TCON  & 0x0ffff)| 0x20000;
    TCNTB3 = ( TCNTB3 & ~(0xffff) )| 6;  
    printk(\"<1> TCNTB3= 0x%08lx\\n\", TCNTB3);
    
    //(1/(PCLK/(Prescaler+1)/divider) * count(Max 65535) = Timer clock (Frequency)
    //(1/(60MHz/1/2))   *  6 =  2 us ( 0.5MHZ)
    TCMPB3 = 6 - 3;
    printk(\"<1> TCMPB3= 0x%08lx\\n\", TCMPB3);
    TCON   = (TCON  & 0x0ffff)| 0x10000;
    printk(\"<1> TCNTO3= 0x%08lx\\n\", TCNTO3);
    printk(\"TCON = 0x%08lx\\n\", TCON);
        //Timer 3:0011: not auto  reload, Inverter off, Manual update, start, Dead zone disable
    for(j=0;j<i;j++)
     {
     while (TCNTO3!=0)
        printk(\"<1> TCNTO3= 0x%08lx\\n\", TCNTO3);
     printk(\"<1>j = 0x%04x\\n\", j);
     TCON   = (TCON  & 0x0ffff ) | 0x20000;  
   //printk(\"TCON = 0x%08lx\\n\", TCON);
   //Manual update,clear the manual set mask
     TCNTB3 = TCNTB3 & ~(0xffff) | 6;
     TCMPB3 = 6 - 3;
     TCON   = (TCON  & 0x0ffff)| 0x10000;
  //   printk(\"TCON = 0x%08lx\\n\", TCON);
    }    
    TCON   = (TCON & 0x0ffff ) | 0x00000 ;    
   //Timer 3:0001: not auto  reload, Inverter off, Manual update, stop, Dead zone disable
}

游客

返回顶部