主题 : 实验了6410看门狗裸机中断 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 39247
精华: 2
发帖: 51
金钱: 355 两
威望: 71 点
综合积分: 142 分
注册时间: 2011-03-07
最后登录: 2015-05-31
楼主  发表于: 2011-05-14 16:34

 实验了6410看门狗裸机中断

1、startup.s

    INCLUDE     s3c6410.inc
    INCLUDE     image_cfg.inc
    INCLUDE     MemParam_mDDR.inc

    IMPORT      xmain                    ; C entrypoint for Steppingstone loader.
    PRESERVE8
   AREA Init, CODE, READONLY
   ENTRY
        mrc p15,0,r0,c1,c0,0
        orr r0,r0,#(1<<24)
        mcr p15,0,r0,c1,c0,0
                        
        b        xmain
        END

2、main.c
#include "s3c6410_addr.h"
#include "interrupt.h"
#include "utils.h"

static volatile long count = 1;
void __irq watchdog_isr(void)
{
    Uart_Printf("watchdog interrupt is occurred %d times\n", count);
    count++;
    rWTCLRINT &= 0x1;//一定要注意要清楚中断
    INTC_ClearVectAddr();
}

void watchdog_test(void)
{
    INTC_SetIntISR(INT_WDT, watchdog_isr);
    rWTCON = (100 << 8) | (3 << 3);
    rWTDAT = 5000;
    rWTCNT = 5000;
    rWTCON &= ~(3);
    rWTCON |= (1 << 5) | (1 << 2);
    INTC_Enable(INT_WDT);
    while(1);
}

void xmain(void)
{
    Uart_Init();
    Uart_Printf("watchdog testing\n");
    watchdog_test();
}

不明白文件组织的请看我的另一个贴子:http://www.aiothome.net/read.php?tid-12309.html
级别: 新手上路
UID: 65474
精华: 0
发帖: 14
金钱: 70 两
威望: 14 点
综合积分: 28 分
注册时间: 2012-03-19
最后登录: 2012-06-07
1楼  发表于: 2012-03-20 10:59
谢谢楼主分享