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

📄 nested_ints.c

📁 A Software Interrupt Priority Scheme for HCS12 Microcontrollers
💻 C
📖 第 1 页 / 共 3 页
字号:
/******************************************************************************
*                                                   COPYRIGHT (c) MOTOROLA 2003
* FILE NAME: nested_ints.c
*
* PURPOSE: Nested interrupts library C file
*
*******************************************************************************
*******************************************************************************
**  THIS CODE IS ONLY INTENDED AS AN EXAMPLE FOR THE METROWERKS COMPILER AND **
**      THE HCS122 EVB AND HAS ONLY BEEN GIVEN A MIMIMUM LEVEL OF TEST.      **
**  IT IS PROVIDED 'AS SEEN' WITH NO GUARANTEES AND NO PROMISE OF SUPPORT.   **
*******************************************************************************
*******************************************************************************
*
* DOCUMENTATION SOURCE: EKB Applications
*
* TARGET DEVICE: MC9S12DP256
*
* COMPILER: Metrowerks                     VERSION: HC12_V2.0
*
* DESCRIPTION: Library file for nested interrupts on HCS12
*
* AUTHOR: Daniel Malik  LOCATION: EKB
*
* UPDATE HISTORY
* REV      AUTHOR      DATE         DESCRIPTION OF CHANGE
* ---      ------      ---------    ---------------------
* 1.0      D.Malik     29/09/03     file generation
*
******************************************************************************/
/*===========================================================================*/
/* Motorola reserves the right to make changes without further notice to any */
/* product herein to improve reliability, function, or design. Motorola does */
/* not assume any  liability arising  out  of the  application or use of any */
/* product,  circuit, or software described herein;  neither  does it convey */
/* any license under its patent rights  nor the  rights of others.  Motorola */
/* products are not designed, intended,  or authorized for use as components */
/* in  systems  intended  for  surgical  implant  into  the  body, or  other */
/* applications intended to support life, or  for any  other application  in */
/* which the failure of the Motorola product  could create a situation where */
/* personal injury or death may occur. Should Buyer purchase or use Motorola */
/* products for any such intended  or unauthorized  application, Buyer shall */
/* indemnify and  hold  Motorola  and its officers, employees, subsidiaries, */
/* affiliates,  and distributors harmless against all claims costs, damages, */
/* and expenses, and reasonable  attorney  fees arising  out of, directly or */
/* indirectly,  any claim of personal injury  or death  associated with such */
/* unintended or unauthorized use, even if such claim alleges that  Motorola */
/* was negligent regarding the  design  or manufacture of the part. Motorola */
/* and the Motorola logo* are registered trademarks of Motorola Ltd.         */
/*****************************************************************************/
/* This file was generated on 01/10/2003, 13:54:15                           */
/*                                                                           */
/* Number of possible interrupt service routines: 64                         */
/* Number of possible interrupt nesting levels:   7                          */
/*                                                                           */
/* - Each interrupt function needs to call INTx_LEVEL_SET(variable_name)     */
/* Where x is number of the interrupt as defined in nested_ints_defs.h       */
/* and variable_name is name of variable into which will the interrupt       */
/* service routine store the current interrupt level                         */
/* - contents of this variable (current interrupt level) needs to be         */
/* preserved within scope of the interrupt service routine                   */
/* - Before returning the interrupt service routine needs to call            */
/* int_level_restore(variable_name) to restore the interrupt level           */
/*                                                                           */
/* nested_ints_defs.h needs to contain interrupt definitions and macro       */
/* ENABLE_INTERRUPTS()                                                       */
/*                                                                           */
/*****************************************************************************/

#include "peripherals.h"
#include "nested_ints_defs.h"
#include "nested_ints.h"

/* Global variable which holds current interrupt level */
/* The interrupt level also needs to be saved in local variables in all the interrupt service routines */
char current_interrupt_level=0;

/* Enables interrupt sources above given interrupt level */
/* To be be used at ends of interrupt service routines */
void int_level_restore(char level) {
   current_interrupt_level=level;
   switch (level) {
      #ifdef NINT_LEVEL1
         case 0:
            #ifdef INT0_1EN
               INT0_1EN
            #endif /* INT0_1EN */
            #ifdef INT1_1EN
               INT1_1EN
            #endif /* INT1_1EN */
            #ifdef INT2_1EN
               INT2_1EN
            #endif /* INT2_1EN */
            #ifdef INT3_1EN
               INT3_1EN
            #endif /* INT3_1EN */
            #ifdef INT4_1EN
               INT4_1EN
            #endif /* INT4_1EN */
            #ifdef INT5_1EN
               INT5_1EN
            #endif /* INT5_1EN */
            #ifdef INT6_1EN
               INT6_1EN
            #endif /* INT6_1EN */
            #ifdef INT7_1EN
               INT7_1EN
            #endif /* INT7_1EN */
            #ifdef INT8_1EN
               INT8_1EN
            #endif /* INT8_1EN */
            #ifdef INT9_1EN
               INT9_1EN
            #endif /* INT9_1EN */
            #ifdef INT10_1EN
               INT10_1EN
            #endif /* INT10_1EN */
            #ifdef INT11_1EN
               INT11_1EN
            #endif /* INT11_1EN */
            #ifdef INT12_1EN
               INT12_1EN
            #endif /* INT12_1EN */
            #ifdef INT13_1EN
               INT13_1EN
            #endif /* INT13_1EN */
            #ifdef INT14_1EN
               INT14_1EN
            #endif /* INT14_1EN */
            #ifdef INT15_1EN
               INT15_1EN
            #endif /* INT15_1EN */
            #ifdef INT16_1EN
               INT16_1EN
            #endif /* INT16_1EN */
            #ifdef INT17_1EN
               INT17_1EN
            #endif /* INT17_1EN */
            #ifdef INT18_1EN
               INT18_1EN
            #endif /* INT18_1EN */
            #ifdef INT19_1EN
               INT19_1EN
            #endif /* INT19_1EN */
            #ifdef INT20_1EN
               INT20_1EN
            #endif /* INT20_1EN */
            #ifdef INT21_1EN
               INT21_1EN
            #endif /* INT21_1EN */
            #ifdef INT22_1EN
               INT22_1EN
            #endif /* INT22_1EN */
            #ifdef INT23_1EN
               INT23_1EN
            #endif /* INT23_1EN */
            #ifdef INT24_1EN
               INT24_1EN
            #endif /* INT24_1EN */
            #ifdef INT25_1EN
               INT25_1EN
            #endif /* INT25_1EN */
            #ifdef INT26_1EN
               INT26_1EN
            #endif /* INT26_1EN */
            #ifdef INT27_1EN
               INT27_1EN
            #endif /* INT27_1EN */
            #ifdef INT28_1EN
               INT28_1EN
            #endif /* INT28_1EN */
            #ifdef INT29_1EN
               INT29_1EN
            #endif /* INT29_1EN */
            #ifdef INT30_1EN
               INT30_1EN
            #endif /* INT30_1EN */
            #ifdef INT31_1EN
               INT31_1EN
            #endif /* INT31_1EN */
            #ifdef INT32_1EN
               INT32_1EN
            #endif /* INT32_1EN */
            #ifdef INT33_1EN
               INT33_1EN
            #endif /* INT33_1EN */
            #ifdef INT34_1EN
               INT34_1EN
            #endif /* INT34_1EN */
            #ifdef INT35_1EN
               INT35_1EN
            #endif /* INT35_1EN */
            #ifdef INT36_1EN
               INT36_1EN
            #endif /* INT36_1EN */
            #ifdef INT37_1EN
               INT37_1EN
            #endif /* INT37_1EN */
            #ifdef INT38_1EN
               INT38_1EN
            #endif /* INT38_1EN */
            #ifdef INT39_1EN
               INT39_1EN
            #endif /* INT39_1EN */
            #ifdef INT40_1EN
               INT40_1EN
            #endif /* INT40_1EN */
            #ifdef INT41_1EN
               INT41_1EN
            #endif /* INT41_1EN */
            #ifdef INT42_1EN
               INT42_1EN
            #endif /* INT42_1EN */
            #ifdef INT43_1EN
               INT43_1EN
            #endif /* INT43_1EN */
            #ifdef INT44_1EN
               INT44_1EN
            #endif /* INT44_1EN */
            #ifdef INT45_1EN
               INT45_1EN
            #endif /* INT45_1EN */
            #ifdef INT46_1EN
               INT46_1EN
            #endif /* INT46_1EN */
            #ifdef INT47_1EN
               INT47_1EN
            #endif /* INT47_1EN */
            #ifdef INT48_1EN
               INT48_1EN
            #endif /* INT48_1EN */
            #ifdef INT49_1EN
               INT49_1EN
            #endif /* INT49_1EN */
            #ifdef INT50_1EN
               INT50_1EN
            #endif /* INT50_1EN */
            #ifdef INT51_1EN
               INT51_1EN
            #endif /* INT51_1EN */
            #ifdef INT52_1EN
               INT52_1EN
            #endif /* INT52_1EN */
            #ifdef INT53_1EN
               INT53_1EN
            #endif /* INT53_1EN */
            #ifdef INT54_1EN
               INT54_1EN
            #endif /* INT54_1EN */
            #ifdef INT55_1EN
               INT55_1EN
            #endif /* INT55_1EN */
            #ifdef INT56_1EN
               INT56_1EN
            #endif /* INT56_1EN */
            #ifdef INT57_1EN
               INT57_1EN
            #endif /* INT57_1EN */
            #ifdef INT58_1EN
               INT58_1EN
            #endif /* INT58_1EN */
            #ifdef INT59_1EN
               INT59_1EN
            #endif /* INT59_1EN */
            #ifdef INT60_1EN
               INT60_1EN
            #endif /* INT60_1EN */
            #ifdef INT61_1EN
               INT61_1EN
            #endif /* INT61_1EN */
            #ifdef INT62_1EN
               INT62_1EN
            #endif /* INT62_1EN */
            #ifdef INT63_1EN
               INT63_1EN
            #endif /* INT63_1EN */
      #endif /* NINT_LEVEL1 */
      #ifdef NINT_LEVEL2
         case 1:
            #ifdef INT0_2EN
               INT0_2EN
            #endif /* INT0_2EN */
            #ifdef INT1_2EN
               INT1_2EN
            #endif /* INT1_2EN */
            #ifdef INT2_2EN
               INT2_2EN
            #endif /* INT2_2EN */
            #ifdef INT3_2EN
               INT3_2EN
            #endif /* INT3_2EN */
            #ifdef INT4_2EN
               INT4_2EN
            #endif /* INT4_2EN */
            #ifdef INT5_2EN
               INT5_2EN
            #endif /* INT5_2EN */
            #ifdef INT6_2EN
               INT6_2EN
            #endif /* INT6_2EN */
            #ifdef INT7_2EN
               INT7_2EN
            #endif /* INT7_2EN */
            #ifdef INT8_2EN
               INT8_2EN
            #endif /* INT8_2EN */
            #ifdef INT9_2EN
               INT9_2EN
            #endif /* INT9_2EN */
            #ifdef INT10_2EN
               INT10_2EN
            #endif /* INT10_2EN */
            #ifdef INT11_2EN
               INT11_2EN
            #endif /* INT11_2EN */
            #ifdef INT12_2EN
               INT12_2EN
            #endif /* INT12_2EN */
            #ifdef INT13_2EN
               INT13_2EN
            #endif /* INT13_2EN */
            #ifdef INT14_2EN
               INT14_2EN
            #endif /* INT14_2EN */
            #ifdef INT15_2EN
               INT15_2EN
            #endif /* INT15_2EN */
            #ifdef INT16_2EN
               INT16_2EN
            #endif /* INT16_2EN */
            #ifdef INT17_2EN
               INT17_2EN
            #endif /* INT17_2EN */
            #ifdef INT18_2EN
               INT18_2EN
            #endif /* INT18_2EN */
            #ifdef INT19_2EN
               INT19_2EN
            #endif /* INT19_2EN */
            #ifdef INT20_2EN
               INT20_2EN
            #endif /* INT20_2EN */
            #ifdef INT21_2EN
               INT21_2EN
            #endif /* INT21_2EN */
            #ifdef INT22_2EN
               INT22_2EN
            #endif /* INT22_2EN */
            #ifdef INT23_2EN
               INT23_2EN
            #endif /* INT23_2EN */
            #ifdef INT24_2EN
               INT24_2EN
            #endif /* INT24_2EN */
            #ifdef INT25_2EN
               INT25_2EN
            #endif /* INT25_2EN */
            #ifdef INT26_2EN
               INT26_2EN
            #endif /* INT26_2EN */
            #ifdef INT27_2EN
               INT27_2EN
            #endif /* INT27_2EN */
            #ifdef INT28_2EN
               INT28_2EN
            #endif /* INT28_2EN */
            #ifdef INT29_2EN
               INT29_2EN
            #endif /* INT29_2EN */
            #ifdef INT30_2EN
               INT30_2EN
            #endif /* INT30_2EN */
            #ifdef INT31_2EN
               INT31_2EN
            #endif /* INT31_2EN */
            #ifdef INT32_2EN
               INT32_2EN
            #endif /* INT32_2EN */
            #ifdef INT33_2EN
               INT33_2EN
            #endif /* INT33_2EN */
            #ifdef INT34_2EN
               INT34_2EN
            #endif /* INT34_2EN */
            #ifdef INT35_2EN
               INT35_2EN
            #endif /* INT35_2EN */
            #ifdef INT36_2EN
               INT36_2EN
            #endif /* INT36_2EN */
            #ifdef INT37_2EN
               INT37_2EN
            #endif /* INT37_2EN */
            #ifdef INT38_2EN
               INT38_2EN
            #endif /* INT38_2EN */
            #ifdef INT39_2EN
               INT39_2EN
            #endif /* INT39_2EN */
            #ifdef INT40_2EN
               INT40_2EN
            #endif /* INT40_2EN */
            #ifdef INT41_2EN
               INT41_2EN
            #endif /* INT41_2EN */
            #ifdef INT42_2EN
               INT42_2EN
            #endif /* INT42_2EN */
            #ifdef INT43_2EN
               INT43_2EN
            #endif /* INT43_2EN */
            #ifdef INT44_2EN
               INT44_2EN
            #endif /* INT44_2EN */
            #ifdef INT45_2EN
               INT45_2EN
            #endif /* INT45_2EN */
            #ifdef INT46_2EN
               INT46_2EN

⌨️ 快捷键说明

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