?? example_28xwatchdog.c
字號(hào):
//
// TMDX ALPHA RELEASE
// Intended for product evaluation purposes
//
//###########################################################################
//
// FILE: Example_28xWatchdog.c
//
// TITLE: DSP28 Watchdog interrupt test program.
//
// ASSUMPTIONS:
//
// This program requires the DSP28 header files. To compile the
// program as is, it should reside in the DSP28/examples/watchdog
// sub-directory.
//
// As supplied, this project is configured for "boot to H0" operation.
//
// DESCRIPTION:
// This program exercises the watchdog on the F2812/F2810 parts.
//
// First the watchdog is connected to the WAKEINT interrupt of the
// PIE block. The code is then put into an infinite loop.
//
// The user can select to feed the watchdog key register or not
// by commenting one line of code in the infinite loop.
//
// If the watchdog key register is fed by the KickDog function
// then the WAKEINT interrupt is not taken. If the key register
// is not fed by the KickDog function then WAKEINT will be taken.
//
// Watch Variables:
// LoopCount for the number of times through the infinite loop
// WakeCount for the number of times through WAKEINT
//
//###########################################################################
//
// Ver | dd mmm yyyy | Who | Description of changes
// =====|=============|======|===============================================
// 0.57| 29 May 2002 | L.H. | Initial Release
//###########################################################################
// Step 0. Include required header files
// DSP28_Device.h: device specific definitions #include statements for
// all of the peripheral .h definition files.
// DSP28_Example.h is specific for the given example.
#include "DSP28_Device.h"
// Prototype statements for functions found within this file.
interrupt void wakeint_isr(void);
// Global variable for this example
Uint32 WakeCount;
Uint32 LoopCount;
void main(void)
{
// Step 1. Initialize System Control registers, PLL, WatchDog, Clocks to default state:
// For this example, this function is found in Example_WatchdogSysCtrl.c
InitSysCtrl();
// Step 2. Select GPIO for the device or for the specific application:
// This function is found in the DSP28_Gpio.c file.
// InitGpio(); // Not required for this example
// Step 3. Initialize PIE vector table:
// The PIE vector table is initialized with pointers to shell Interrupt
// Service Routines (ISR). The shell routines are found in DSP28_DefaultIsr.c.
// Insert user specific ISR code in the appropriate shell ISR routine in
// the DSP28_DefaultIsr.c file.
// Disable and clear all CPU interrupts:
DINT;
IER = 0x0000;
IFR = 0x0000;
// Initialize Pie Control Registers To Default State:
// This function is found in the DSP28_PieCtrl.c file.
InitPieCtrl();
// Initialize the PIE Vector Table To a Known State:
// This function is found in DSP28_PieVect.c.
// This function populates the PIE vector table with pointers
// to the shell ISR functions found in DSP28_DefaultIsr.c.
InitPieVectTable();
// Step 4. Initialize all the Device Peripherals to a known state:
// This function is found in DSP28_InitPeripherals.c
// InitPeripherals(); // Not required for this example.
// Step 5. User specific functions, Reassign vectors (optional), Enable Interrupts:
// Reassign the PIE vector for WAKEINT to point to a different ISR then
// the shell routine found in DSP28_DefaultIsr.c.
// This is done if the user does not want to use the shell ISR routine
// but instead wants to use their own ISR. This step is optional:
EALLOW; // This is needed to write to EALLOW protected registers
PieVectTable.WAKEINT = &wakeint_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
// Include application specific functions. This is for this example:
// Enable INT1 which is connected to WAKEINT:
IER |= M_INT1;
// Enable WAKEINT in the PIE: Group 1 interrupt 8
PieCtrlRegs.PIEIER1.bit.INTx8 = 1;
// Connect the watchdog to the WAKEINT interrupt of the PIE
// Write to the whole SCSR register to avoid clearing WDOVERRIDE bit
EALLOW;
SysCtrlRegs.SCSR.all = BIT1;
EDIS;
// Clear the counters
WakeCount = 0; // Count interrupts
LoopCount = 0; // Count times through idle loop
// Enable global Interrupts and higher priority real-time debug events:
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
// Step 6. IDLE loop. Just sit and loop forever (optional):
for(;;)
{
LoopCount++;
// Uncomment KickDog to just loop here
// Comment KickDog to take the WAKEINT instead
// KickDog();
}
}
// Step 7. Insert all local Interrupt Service Routines (ISRs) and functions here:
// If local ISRs are used, reassign vector addresses in vector table as
// shown in Step 5
interrupt void wakeint_isr(void)
{
WakeCount++;
// Acknowledge this interrupt to get more from group 1
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1;
}
//===========================================================================
// No more.
//===========================================================================
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -