?? wuisr.c
字號(hào):
/*************************************************************************/
/* */
/* FILE NAME VERSION */
/* */
/* isr.c KS32C5000, KS32C50100 : version 1.0 */
/* */
/* COMPONENT */
/* */
/* */
/* DESCRIPTION */
/* */
/* */
/* AUTHOR */
/* */
/* */
/* DATA STRUCTURES */
/* */
/* */
/* FUNCTIONS */
/* */
/* Interrupt handler */
/* */
/* DEPENDENCIES */
/* */
/* */
/* HISTORY */
/* */
/* NAME DATE REMARKS */
/* */
/* hbahn 09-15-1998 Created initial version 1.0 */
/* in4maker 12-18-1998 Some functions added & updated */
/*************************************************************************/
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include "include\snds.h"
#include "include\isr.h"
#include "include\uart.h"
#include "include\pollio.h"
#include "include\sysconf.h"
//volatile U32 IntOffSet;
U32 IntOffSet;
/***************************************************************/
/* Dummy Function Prototype for Interrupt Service Vector Table */
/***************************************************************/
static void DummyIsr(void) {}
void (*InterruptHandlers[MAXHNDLRS])(void);
void ClrIntStatus(void)
{
INTMASK = 0x3fffff; // All interrupt disabled include global bit
INTPEND = 0x1fffff; // All clear pending
INTMODE = 0x0; // All FIQ mode
/*
* Interrupt Priority Reset value. Need to be changed priority,
* Set interrupt priority register. In this case, Global interrupt
* mask bit must be disabled.
*
*/
//INTPRI0 = 0x03020100;
//INTPRI1 = 0x07060504;
//INTPRI2 = 0x0b0a0908;
//INTPRI3 = 0x0f0e0d0c;
//INTPRI4 = 0x13121110;
//INTPRI5 = 0x00000014;
//INTOFFSET = Read Only Register
}
/******************************************/
/**** Exception Handler Function ****/
/******************************************/
void ISR_UndefHandler(REG32 *adr)
{
//Print("\n** Trap : Undefined Handler\n") ;
}
void ISR_PrefetchHandler(REG32 *adr)
{
//Print("\n** Trap : Prefetch Abort Handler\n") ;
}
void ISR_AbortHandler(REG32 *adr)
{
//Print("\n** Trap : Data Abort Handler\n") ;
}
void ISR_SwiHandler(void)
{
}
void ISR_IrqHandler(void)
{
IntOffSet = (U32)INTOFFSET;
Clear_PendingBit(IntOffSet>>2);
(*InterruptHandlers[IntOffSet>>2])(); // Call interrupt service routine
}
void ISR_FiqHandler(void)
{
IntOffSet = (U32)INTOFFSET;
Clear_PendingBit(IntOffSet>>2) ;
(*InterruptHandlers[IntOffSet>>2])(); // Call interrupt service routine
}
/***********************************************************************/
/* InitIntHandlerTable: Initialize the interrupt handler table */
/* NOTE(S): This should be called during system initialization */
/***********************************************************************/
void InitIntHandlerTable(void)
{
REG32 i;
for (i = 0; i < MAXHNDLRS; i++)
InterruptHandlers[i] = DummyIsr;
}
/*********************************************************/
/* SysSetInterrupt: Setup Interrupt Handler Vector Table */
/*********************************************************/
void SysSetInterrupt(REG32 vector, void (*handler)())
{
InterruptHandlers[vector] = handler;
}
/*********************************************************/
/* InitInterrupt: Initialize Interrupt */
/*********************************************************/
void InitInterrupt(void)
{
ClrIntStatus(); // Clear All interrupt
InitIntHandlerTable() ;
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -