📄 mx21_aitc.c
字号:
/**********************************************************************
*
* (C) COPYRIGHT 2004 FREESCALE, INC.
* ALL RIGHTS RESERVED
*
*
* Group/Division: WMSG/MMDO
*
* Description :
*
* Related Specifications:
*
* Errata:
*
* File Name: MX21_AITC.c
* Revision Number: 0.1
* Author(s): Sharad Kumar
* Date created: 30Apr2004
* Revision History:
* Date Rev Description
* ---- --- -----------
* 30Apr2004 0.1 First Draft
*
**********************************************************************/
#include "MX21_AITC.h"
void
AITC_MaskIRQLevel(uint32_t maskLevel)
{
AITC_NIMASK.bits.NIMASK = maskLevel;
}
//---------------------------------------------------
// enable an interrupt source using
// the INTENNUM register
//---------------------------------------------------
void
AITC_EnableIntSource(uint32_t intNum)
{
AITC_INTENNUM.bits.ENNUM = intNum;
}
//---------------------------------------------------
// disable an interrupt source using
// the INTDISNUM register
//---------------------------------------------------
void
AITC_DisableIntSource(uint32_t intNum)
{
AITC_INTDISNUM.bits.DISNUM = intNum;
}
void
AITC_SetINTCNTL(uint32_t vector)
{
AITC_INTCNTL.all = vector;
}
//---------------------------------------------------
// clear select bits of the INTCTL register
//---------------------------------------------------
void
AITC_ClrINTCNTL(uint32_t vector)
{
AITC_INTCNTL.all = vector;
}
//---------------------------------------------------
// This function specifies whether a normal or a fast
// interrupt is generated for each of the interrupt lines
//---------------------------------------------------
void
AITC_SetIntType(uint32_t intNum,
uint8_t type)
{
// interrupt type by default is IRQ
uint32_t _inttype = AITC_SETIRQ;
// determine if interrupt
// type is FIQ
if (AITC_IS_FIQ == type)
{
_inttype = AITC_SETFIQ;
}
// write the correct interrupt
// type to the respective bit
// value
switch(intNum)
{
case 0:
AITC_INTTYPEL.bits.INT0 = _inttype;
break;
case 1:
AITC_INTTYPEL.bits.INT1 = _inttype;
break;
case 2:
AITC_INTTYPEL.bits.INT2 = _inttype;
break;
case 3:
AITC_INTTYPEL.bits.INT3 = _inttype;
break;
case 4:
AITC_INTTYPEL.bits.INT4 = _inttype;
break;
case 5:
AITC_INTTYPEL.bits.INT5 = _inttype;
break;
case 6:
AITC_INTTYPEL.bits.INT6 = _inttype;
break;
case 7:
AITC_INTTYPEL.bits.INT7 = _inttype;
break;
case 8:
AITC_INTTYPEL.bits.INT8 = _inttype;
break;
case 9:
AITC_INTTYPEL.bits.INT9 = _inttype;
break;
case 10:
AITC_INTTYPEL.bits.INT10 = _inttype;
break;
case 11:
AITC_INTTYPEL.bits.INT11 = _inttype;
break;
case 12:
AITC_INTTYPEL.bits.INT12 = _inttype;
break;
case 13:
AITC_INTTYPEL.bits.INT13 = _inttype;
break;
case 14:
AITC_INTTYPEL.bits.INT14 = _inttype;
break;
case 15:
AITC_INTTYPEL.bits.INT15 = _inttype;
break;
case 16:
AITC_INTTYPEL.bits.INT16 = _inttype;
break;
case 17:
AITC_INTTYPEL.bits.INT17 = _inttype;
break;
case 18:
AITC_INTTYPEL.bits.INT18 = _inttype;
break;
case 19:
AITC_INTTYPEL.bits.INT19 = _inttype;
break;
case 20:
AITC_INTTYPEL.bits.INT20 = _inttype;
break;
case 21:
AITC_INTTYPEL.bits.INT21 = _inttype;
break;
case 22:
AITC_INTTYPEL.bits.INT22 = _inttype;
break;
case 23:
AITC_INTTYPEL.bits.INT23 = _inttype;
break;
case 24:
AITC_INTTYPEL.bits.INT24 = _inttype;
break;
case 25:
AITC_INTTYPEL.bits.INT25 = _inttype;
break;
case 26:
AITC_INTTYPEL.bits.INT26 = _inttype;
break;
case 27:
AITC_INTTYPEL.bits.INT27 = _inttype;
break;
case 28:
AITC_INTTYPEL.bits.INT28 = _inttype;
break;
case 29:
AITC_INTTYPEL.bits.INT29 = _inttype;
break;
case 30:
AITC_INTTYPEL.bits.INT30 = _inttype;
break;
case 31:
AITC_INTTYPEL.bits.INT31 = _inttype;
break;
case 32:
AITC_INTTYPEH.bits.INT32 = _inttype;
break;
case 33:
AITC_INTTYPEH.bits.INT33 = _inttype;
break;
case 34:
AITC_INTTYPEH.bits.INT34 = _inttype;
break;
case 35:
AITC_INTTYPEH.bits.INT35 = _inttype;
break;
case 36:
AITC_INTTYPEH.bits.INT36 = _inttype;
break;
case 37:
AITC_INTTYPEH.bits.INT37 = _inttype;
break;
case 38:
AITC_INTTYPEH.bits.INT38 = _inttype;
break;
case 39:
AITC_INTTYPEH.bits.INT39 = _inttype;
break;
case 40:
AITC_INTTYPEH.bits.INT40 = _inttype;
break;
case 41:
AITC_INTTYPEH.bits.INT41 = _inttype;
break;
case 42:
AITC_INTTYPEH.bits.INT42 = _inttype;
break;
case 43:
AITC_INTTYPEH.bits.INT43 = _inttype;
break;
case 44:
AITC_INTTYPEH.bits.INT44 = _inttype;
break;
case 45:
AITC_INTTYPEH.bits.INT45 = _inttype;
break;
case 46:
AITC_INTTYPEH.bits.INT46 = _inttype;
break;
case 47:
AITC_INTTYPEH.bits.INT47 = _inttype;
break;
case 48:
AITC_INTTYPEH.bits.INT48 = _inttype;
break;
case 49:
AITC_INTTYPEH.bits.INT49 = _inttype;
break;
case 50:
AITC_INTTYPEH.bits.INT50 = _inttype;
break;
case 51:
AITC_INTTYPEH.bits.INT51 = _inttype;
break;
case 52:
AITC_INTTYPEH.bits.INT52 = _inttype;
break;
case 53:
AITC_INTTYPEH.bits.INT53 = _inttype;
break;
case 54:
AITC_INTTYPEH.bits.INT54 = _inttype;
break;
case 55:
AITC_INTTYPEH.bits.INT55 = _inttype;
break;
case 56:
AITC_INTTYPEH.bits.INT56 = _inttype;
break;
case 57:
AITC_INTTYPEH.bits.INT57 = _inttype;
break;
case 58:
AITC_INTTYPEH.bits.INT58 = _inttype;
break;
case 59:
AITC_INTTYPEH.bits.INT59 = _inttype;
break;
case 60:
AITC_INTTYPEH.bits.INT60 = _inttype;
break;
case 61:
AITC_INTTYPEH.bits.INT61 = _inttype;
break;
case 62:
AITC_INTTYPEH.bits.INT62 = _inttype;
break;
case 63:
AITC_INTTYPEH.bits.INT63 = _inttype;
break;
}
return;
}
//---------------------------------------------------
// This function is used to establish prioirity for
// each of the 64 interrupts lines of the AITC.
//---------------------------------------------------
void
AITC_SetIrqPriority(uint8_t intNum, // interrupt number
uint8_t PriLevel) // priority
{
uint32_t _level;
_level = PriLevel;
// set the appropriate priority in the
// nibble associated with each of the
// interrupt lines in the AITC_NIPRIORITYx
// registers.
switch(intNum)
{
case 63:
AITC_NIPRIORITY7.bits.INT63 = PriLevel;
break;
case 62:
AITC_NIPRIORITY7.bits.INT62 = PriLevel;
break;
case 61:
AITC_NIPRIORITY7.bits.INT61 = PriLevel;
break;
case 60:
AITC_NIPRIORITY7.bits.INT60 = PriLevel;
break;
case 59:
AITC_NIPRIORITY7.bits.INT59 = PriLevel;
break;
case 58:
AITC_NIPRIORITY7.bits.INT58 = PriLevel;
break;
case 57:
AITC_NIPRIORITY7.bits.INT57 = PriLevel;
break;
case 56:
AITC_NIPRIORITY7.bits.INT56 = PriLevel;
break;
case 55:
AITC_NIPRIORITY6.bits.INT55 = PriLevel;
break;
case 54:
AITC_NIPRIORITY6.bits.INT54 = PriLevel;
break;
case 53:
AITC_NIPRIORITY6.bits.INT53 = PriLevel;
break;
case 52:
AITC_NIPRIORITY6.bits.INT52 = PriLevel;
break;
case 51:
AITC_NIPRIORITY6.bits.INT51 = PriLevel;
break;
case 50:
AITC_NIPRIORITY6.bits.INT50 = PriLevel;
break;
case 49:
AITC_NIPRIORITY6.bits.INT49 = PriLevel;
break;
case 48:
AITC_NIPRIORITY6.bits.INT48 = PriLevel;
break;
case 47:
AITC_NIPRIORITY5.bits.INT47 = PriLevel;
break;
case 46:
AITC_NIPRIORITY5.bits.INT46 = PriLevel;
break;
case 45:
AITC_NIPRIORITY5.bits.INT45 = PriLevel;
break;
case 44:
AITC_NIPRIORITY5.bits.INT44 = PriLevel;
break;
case 43:
AITC_NIPRIORITY5.bits.INT43 = PriLevel;
break;
case 42:
AITC_NIPRIORITY5.bits.INT42 = PriLevel;
break;
case 41:
AITC_NIPRIORITY5.bits.INT41 = PriLevel;
break;
case 40:
AITC_NIPRIORITY5.bits.INT40 = PriLevel;
break;
case 39:
AITC_NIPRIORITY4.bits.INT39 = PriLevel;
break;
case 38:
AITC_NIPRIORITY4.bits.INT38 = PriLevel;
break;
case 37:
AITC_NIPRIORITY4.bits.INT37 = PriLevel;
break;
case 36:
AITC_NIPRIORITY4.bits.INT36 = PriLevel;
break;
case 35:
AITC_NIPRIORITY4.bits.INT35 = PriLevel;
break;
case 34:
AITC_NIPRIORITY4.bits.INT34 = PriLevel;
break;
case 33:
AITC_NIPRIORITY4.bits.INT33 = PriLevel;
break;
case 32:
AITC_NIPRIORITY4.bits.INT32 = PriLevel;
break;
case 31:
AITC_NIPRIORITY3.bits.INT31 = PriLevel;
break;
case 30:
AITC_NIPRIORITY3.bits.INT30 = PriLevel;
break;
case 29:
AITC_NIPRIORITY3.bits.INT29 = PriLevel;
break;
case 28:
AITC_NIPRIORITY3.bits.INT28 = PriLevel;
break;
case 27:
AITC_NIPRIORITY3.bits.INT27 = PriLevel;
break;
case 26:
AITC_NIPRIORITY3.bits.INT26 = PriLevel;
break;
case 25:
AITC_NIPRIORITY3.bits.INT25 = PriLevel;
break;
case 24:
AITC_NIPRIORITY3.bits.INT24 = PriLevel;
break;
case 23:
AITC_NIPRIORITY2.bits.INT23 = PriLevel;
break;
case 22:
AITC_NIPRIORITY2.bits.INT22 = PriLevel;
break;
case 21:
AITC_NIPRIORITY2.bits.INT21 = PriLevel;
break;
case 20:
AITC_NIPRIORITY2.bits.INT20 = PriLevel;
break;
case 19:
AITC_NIPRIORITY2.bits.INT19 = PriLevel;
break;
case 18:
AITC_NIPRIORITY2.bits.INT18 = PriLevel;
break;
case 17:
AITC_NIPRIORITY2.bits.INT17 = PriLevel;
break;
case 16:
AITC_NIPRIORITY2.bits.INT16 = PriLevel;
break;
case 15:
AITC_NIPRIORITY1.bits.INT15 = PriLevel;
break;
case 14:
AITC_NIPRIORITY1.bits.INT14 = PriLevel;
break;
case 13:
AITC_NIPRIORITY1.bits.INT13 = PriLevel;
break;
case 12:
AITC_NIPRIORITY1.bits.INT12 = PriLevel;
break;
case 11:
AITC_NIPRIORITY1.bits.INT11 = PriLevel;
break;
case 10:
AITC_NIPRIORITY1.bits.INT10 = PriLevel;
break;
case 9:
AITC_NIPRIORITY1.bits.INT9 = PriLevel;
break;
case 8:
AITC_NIPRIORITY1.bits.INT8 = PriLevel;
break;
case 7:
AITC_NIPRIORITY0.bits.INT7 = PriLevel;
break;
case 6:
AITC_NIPRIORITY0.bits.INT6 = PriLevel;
break;
case 5:
AITC_NIPRIORITY0.bits.INT5 = PriLevel;
break;
case 4:
AITC_NIPRIORITY0.bits.INT4 = PriLevel;
break;
case 3:
AITC_NIPRIORITY0.bits.INT3 = PriLevel;
break;
case 2:
AITC_NIPRIORITY0.bits.INT2 = PriLevel;
break;
case 1:
AITC_NIPRIORITY0.bits.INT1 = PriLevel;
break;
case 0:
AITC_NIPRIORITY0.bits.INT0 = PriLevel;
break;
default:
break;
}
} // end SetIrqPriority
//---------------------------------------------------
// This function is used for forcing the interrupt line
// based on directly writing to the AITC_INTFRCL or the
// AITC_INTFRCH registers.
//---------------------------------------------------
void
AITC_ForceOneInt(uint32_t intNum) // interrupt number
{
uint32_t _intbit;
_intbit = 1;
switch(intNum)
{
case 63:
AITC_INTFRCH.bits.INT63 = _intbit;
break;
case 62:
AITC_INTFRCH.bits.INT62 = _intbit;
break;
case 61:
AITC_INTFRCH.bits.INT61 = _intbit;
break;
case 60:
AITC_INTFRCH.bits.INT60 = _intbit;
break;
case 59:
AITC_INTFRCH.bits.INT59 = _intbit;
break;
case 58:
AITC_INTFRCH.bits.INT58 = _intbit;
break;
case 57:
AITC_INTFRCH.bits.INT57 = _intbit;
break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -