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

📄 ex_funcs.c

📁 mpc564 时钟中断 时钟中断
💻 C
字号:
/**************************************************************************/
/* FILE NAME: ex_funcs.c                      COPYRIGHT (c) MOTOROLA 1999 */
/* VERSION: 1.3rtc                                All Rights Reserved     */
/*                                                                        */
/* DESCRIPTION:                                                           */
/* This file contains empty exception routines that are referenced by     */
/* the exception table file ex_tbl.s or ex_tblc.s. The reset exception    */
/* _start is not in this file, it is normally in crt0.s or crt0etas.s     */
/*========================================================================*/
/* COMPILER: Diab Data        VERSION: 4.3g                               */
/* AUTHOR: Jeff Loeliger/Steve Mihalik/Randy Dees                         */
/*                                                                        */
/* HISTORY                                                                */
/* REV      AUTHOR      DATE       DESCRIPTION OF CHANGE                  */
/* ---   -----------  ---------    ---------------------                  */
/* 1.0   J. Loeliger  14/Jan/98    Initial version of function.           */
/* 1.1   J. Loeliger   8/Apr/98    Added reserved routine.                */
/* 1.2   J. Loeliger  22/Apr/98    Fixed #pragma interrupt syntax.        */
/* 1.3   J. Loeliger  12/Jan/98    Replaced #pragma with INTERRUPT to     */
/*                                 make file generic for other compilers. */
/* 1.3rtc R. Dees     03/july/2002 adapt from header files, AN2109, and   */
/*                           set up for MIOS interupts. Add exception     */
/*                           debug to flash LEDs if exception occurs.     */
/*                           decrementer exception flashs fast, others    */
/*                           flash LEDs for each type of exception        */
/* 1.3.1 G. Jackson   16/Aug/02    Write a version for a TPU,             */
/*                                 TSM function.                          */
/**************************************************************************/

#include "m_common.h"
#include "mpc565.h"

#define IRQ0 0x80000000
#define LEVEL0 0x40000000
#define IRQ1 0x20000000
#define LEVEL1 0x10000000
#define IRQ2 0x08000000
#define LEVEL2 0x04000000
#define IRQ3 0x02000000
#define LEVEL3 0x01000000
#define IRQ4 0x00800000
#define LEVEL4 0x00400000
#define IRQ5 0x00200000
#define LEVEL5 0x00100000
#define IRQ6 0x00080000
#define LEVEL6 0x00040000
#define IRQ7 0x00020000
#define LEVEL7 0x00010000


/* for reserved exception blink both on and off */ 
INTERRUPT void reserved (void)
{
}  

/* Machine check exception is at 0x200 blink twice */ 
INTERRUPT void machine_check_exception (void)
{
}

/* Data Access exception is at 0x300 blink 3 times */ 
INTERRUPT void data_access_exception (void)
{
}

/* Instruction Access exception is at 0x400 blink 4 times */ 
INTERRUPT void instruct_access_exception (void)
{
}

/* Handler for External (to the RCPU core) Interupts */
INTERRUPT void external_interrupt (void)
{
UINT32 int_value = 0 ;		/* Start with null value */

	asm (" mtspr EID, r0 ");  	/* Set MSR.RI - now recoverable */

	int_value = USIU.SIPEND.R ;	/* Get SIPEND Value */
	
	while (int_value != 0)
	 {				/* Loop until all ints handled */
	if (int_value&IRQ0)
	 {
		int_value &= ~IRQ0 ;
	 }
	else if (int_value&LEVEL0)
	 {
		int_value &= ~LEVEL0 ;
	 }
	else if (int_value&IRQ1)
	 {
		int_value &= ~IRQ1 ;
	 }
	else if (int_value&LEVEL1)
	 {
		int_value &= ~LEVEL1 ;
	 }
	else if (int_value&IRQ2)
	 {
		int_value &= ~IRQ2 ;
	 }
	else if (int_value&LEVEL2)
	 { 
                Ext_Isr();      /* Call TPU TSM interrupt handler */
		int_value &= ~LEVEL2 ;  /* Clear the level 2 interrupt    */
	 }
	else if (int_value&IRQ3)
	 {
		int_value &= ~IRQ3 ;
	 }
	else if (int_value&LEVEL3)
	 {
		int_value &= ~LEVEL3 ;
	 }
	else if (int_value&IRQ4)
	 {
		int_value &= ~IRQ4 ;
	 }
	else if (int_value&LEVEL4)
	 {
		int_value &= ~LEVEL4 ;
	 }
	else if (int_value&IRQ5)
	 {
		int_value &= ~IRQ5 ;
	 }
	else if (int_value&LEVEL5)
	 {
	/*	MIOS_Int() ;	 */       	/* Call MIOS C interrupt handler */
		int_value &= ~LEVEL5 ;
	 }
	else if (int_value&IRQ6)
	 {
		int_value &= ~IRQ6 ;
	 }
	else if (int_value&LEVEL6)
	 {
		int_value &= ~LEVEL6 ;
	 }
	else if (int_value&IRQ7)
	 {
		int_value &= ~IRQ7 ;
	 }
	else if (int_value&LEVEL7)
	 {
		int_value &= ~LEVEL7 ;
	 }
	else
	 {					/* ERROR STATE */ 
	 }
	} 						   
	asm (" mtspr NRI, r0 ");  	/* Clear MSR.RI - now irrecoverable */
}

/* Alignment exception is at 0x600  */ 
INTERRUPT void alignment_exception (void)
{
}

/* Program exception is at 0x700  */ 
INTERRUPT void program_exception (void)
{
}

/* Floating Point Unavailable exception is at 0x800  */ 
INTERRUPT void fp_unavailable_exception (void)
{
}

/* Decrementer exception is at 0x900  */ 
INTERRUPT void decrementer_exception (void)
{
}

/* System Call exception is at 0xC00  */ 
INTERRUPT void system_call_exception (void)
{
}

/* Trace exception is at 0xD00  */ 
INTERRUPT void trace_exception (void)
{
}

/* Floating Point Assist exception is at 0xE00 */
INTERRUPT void fp_assist_exception (void)
{
}

/* Software Emulation exception is at 0x1000 */
INTERRUPT void software_emulation_exception (void)
{
}

/* InstructionProtection exception is at 0x1300 */
INTERRUPT void instruction_protection_exception (void)
{
}

/* Data Protection exception is at 0x1400 */
INTERRUPT void data_protection_exception (void)
{
}

/* Data Breakpoint exception is at 0x1C00 */
INTERRUPT void data_breakpoint (void)
{
}

/* Instruction Breakpoint exception is at 0x1D00 */
INTERRUPT void instruct_breakpoint (void)
{
}

/* Maskable External Breakpoint exception is at 0x1E00 */
INTERRUPT void maskable_external_breakpoint (void)
{
}

/* Nonmaskable external Breakpoint exception is at 0x1F00 */
INTERRUPT void nonmaskable_external_breakpoint (void)
{
}

/*********************************************************************
 *
 * Copyright:
 *	MOTOROLA, INC. All Rights Reserved.  
 *  You are hereby granted a copyright license to use, modify, and
 *  distribute the SOFTWARE so long as this entire notice is
 *  retained without alteration in any modified and/or redistributed
 *  versions, and that such modified versions are clearly identified
 *  as such. No licenses are granted by implication, estoppel or
 *  otherwise under any patents or trademarks of Motorola, Inc. This 
 *  software is provided on an "AS IS" basis and without warranty.
 *
 *  To the maximum extent permitted by applicable law, MOTOROLA 
 *  DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED, INCLUDING 
 *  IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
 *  PURPOSE AND ANY WARRANTY AGAINST INFRINGEMENT WITH REGARD TO THE 
 *  SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF) AND ANY 
 *  ACCOMPANYING WRITTEN MATERIALS.
 * 
 *  To the maximum extent permitted by applicable law, IN NO EVENT
 *  SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING 
 *  WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS 
 *  INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR OTHER PECUNIARY
 *  LOSS) ARISING OF THE USE OR INABILITY TO USE THE SOFTWARE.   
 * 
 *  Motorola assumes no responsibility for the maintenance and support
 *  of this software
 ********************************************************************/

⌨️ 快捷键说明

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