⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interrupt_watchdog.c

📁 详细介绍了arm7-at91r40008,的开发全过程
💻 C
字号:
//*----------------------------------------------------------------------------
//*      ATMEL Microcontroller Software Support  -  ROUSSET  -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name           : interrupt_timer.c
//* Object              : Timer interrupt management
//*                     : Use LED7 & LED8 for status interrupt
//*
//* 1.0 03/Jan/03 JPP   : Creation
//*----------------------------------------------------------------------------

// Include Standard LIB  files 
#include "../ucos_ii/includes.h"
#include "../../../parts/r40008/reg_r40008.h"
#include "../../../parts/r40008/lib_r40008.h"

extern void at91_watch_dog_interrupt_handler(void);
void extern Tmr_TickISR(void);
//* Global variable
u_int Counter_us;


//*------------------------- Interrupt Function -------------------------------

//*----------------------------------------------------------------------------
//* Function Name       : timer0_c_irq_handler
//* Object              : C handler interrupt function called by the interrupts 
//*                       assembling routine
//* Input Parameters    : <RTC_pt> time rtc descriptor
//* Output Parameters   : increment count_timer0_interrupt
//*----------------------------------------------------------------------------
void watchdog_interrupt(void)
{
    WD_CR = WD_RSTKEY ;
    Counter_us++ ;
}

//*-------------------------- External Function -------------------------------

//*----------------------------------------------------------------------------
//* Function Name       : watchdog_init
//* Object              : Init watchdog
//* Input Parameters    : none
//* Output Parameters   : none
//*----------------------------------------------------------------------------
void watchdog_init ( void )
//* Begin
{
//	at91_watch_dog_init ( &WD_DESC, WD_IRQEN, WD_WDCLKS_MCK8, 0x1000, at91_watch_dog_interrupt_handler );

    // Disable the Watch Dog
    WD_OMR = WD_OKEY ;

    // If Watch Dog initialized to generate an interrupt

        // Initialize the Interrupt Controller
	at91_irq_open (WDI_ID, INTWATCHDOG, AIC_SRCTYPE_INT_EDGE_TRIGGERED, Tmr_TickISR);


    // Store the Clock Mode Register
    WD_CMR = WD_CKEY | (((0xF000 & 0x00004000) >> 12) << 2) | WD_WDCLKS_MCK32 ;
    
    // Store the Overflow Mode Register
    WD_OMR = WD_OKEY | WD_IRQEN | WD_WDEN ;
    
    // Restart the Watchdog
    WD_CR = WD_RSTKEY ;


//* End
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -