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

📄 viccontrol.h

📁 基于ARM7下的2100系列得uc-osII的工程模板!
💻 H
字号:
/****************************************Copyright (c)**************************************************
**                               Guangzhou ZHIYUAN electronics Co.,LTD.
**                                     
**                                 http://www.embedtools.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name:			vicControl.h
** Last modified Date:  2007-07-09
** Last Version:		1.00
** Descriptions:		VIC_Control 软中断函数接口
**------------------------------------------------------------------------------------------------------
** Created by:			LinEnqiang
** Created date:		2007-07-06
** Version:				1.00
** Descriptions:		The original version
**------------------------------------------------------------------------------------------------------
** Modified by:			
** Modified date:		
** Version:				
** Descriptions:
********************************************************************************************************/
#ifndef _VIC_CONTROL_H_
#define _VIC_CONTROL_H_

#ifdef __cplusplus
extern "C" {
#endif
/*********************************************************************************************************
  兼容定义,以后不要使用
*********************************************************************************************************/
#define VIC_Config				VIC_IRQ_CFG
#define pVIC_Config				PVIC_IRQ_CFG

#define SetVICIRQ				vicIrqFuncSet
#define FreeVICIRQ				vicIrqFuncClr
#define ReEnableVICIRQ			vicIrqEnable
#define DisableVICIRQ			vicIrqDisable
#define GetVICIRQState			vicIrqStatusGet
#define SetVICFIQ				vicFiqSet
#define FreeVICFIQ				vicFiqClr
#define SetDefIRQFunction       DefIrqFuncSet
#define EnableDefIRQ			DefIrqEnable
#define DisableDefIRQ			DefIrqDisable
#define EnableSoftInt			SoftIntEnable
#define DisableSoftInt			SoftIntDisable

/*********************************************************************************************************
  VIC配置信息定义
*********************************************************************************************************/
struct vic_irq_cfg {
    INT32U      ulChannel;                                              /*  通道                        */
    INT32U      ulPri;                                                  /*  优先级                      */
    INT32U      ulFunctionAddr;                                         /*  ISR地址                     */
    INT32U      ulEnable;                                               /*  使能标识                    */
};

typedef struct vic_irq_cfg      VIC_IRQ_CFG;
typedef struct vic_irq_cfg     *PVIC_IRQ_CFG;

/*********************************************************************************************************
** Function name:           swiHandle
** Descriptions:            SWI函数声明
** input parameters:        iHandle: 用于区分功能
**                          其他:    根据功能决定
** output parameters:       根据功能决定
** Returned value:          根据功能决定
*********************************************************************************************************/
__swi(0x01) unsigned int swiHandle (int iHandle, unsigned int, unsigned int, unsigned int);

/*********************************************************************************************************
** Function name:           vicIrqFuncSet
** Descriptions:            设置所选外设的中断优先级、中断服务函数地址,并使能中断
** input parameters:        uiChannel:  外设对应的中断通道号
**                          uiPri:      中断优先级
**                          uiFuncAddr: 中断服务函数地址
** output parameters:       none
** Returned value:          1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int vicIrqFuncSet (unsigned int uiChannel,
                                     unsigned int uiPri,
                                     unsigned int uiFuncAddr)
{
    return swiHandle(0x100, uiChannel, uiPri, uiFuncAddr);
}

/*********************************************************************************************************
** Function name:           vicIrqFuncClr
** Descriptions:            清除所选外设的IRQ资源
** input parameters:        uiChannel:  外设对应的中断通道号
** output parameters:       none
** Returned value:          1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int vicIrqFuncClr (unsigned int uiChannel)
{
    return swiHandle(0x101, uiChannel ,0 ,0);
}

/*********************************************************************************************************
** Function name:           vicIrqEnable
** Descriptions:            使能相应外设的中断
** input parameters:        uiChannel:  外设对应的中断通道号
** output parameters:       none
** Returned value:          1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int vicIrqEnable (unsigned int uiChannel)
{
    return swiHandle(0x102, uiChannel, 0, 0);
}

/*********************************************************************************************************
** Function name:           vicIrqDisable
** Descriptions:            禁止相应外设的中断
** input parameters:        uiChannel:  外设对应的中断通道号
** output parameters:       none
** Returned value:          1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int vicIrqDisable (unsigned int uiChannel)
{
    return swiHandle(0x103, uiChannel, 0, 0);
}

/*********************************************************************************************************
** Function name:           vicIrqStatusGet
** Descriptions:            获取所选外设的中断通道号、优先级、中断服务函数地址及中断使能状态
** input parameters:        uiChannel:  外设对应的中断通道号
** output parameters:       pvicInfo:   配置信息
** Returned value:          1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int vicIrqStatusGet (unsigned int uiChannel, PVIC_IRQ_CFG pvicInfo)
{
    return swiHandle(0x104, uiChannel, (unsigned int)pvicInfo, 0);
}

/*********************************************************************************************************
** Function name:           vicFiqSet
** Descriptions:            设置并使能所选中断通道号为FIQ中断
** input parameters:        uiChannel:  外设对应的中断通道号
** output parameters:       none
** Returned value:          1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int vicFiqSet (unsigned int uiChannel)
{
    return swiHandle(0x105, uiChannel, 0, 0);
}
  
/*********************************************************************************************************
** Function name:           vicFiqClr
** Descriptions:            清除所选中断通道号的FIQ中断
** input parameters:        uiChannel:  外设对应的中断通道号
** output parameters:       none
** Returned value:          1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int vicFiqClr (unsigned int uiChannel)
{
    return swiHandle(0x106, uiChannel, 0, 0);
}

/*********************************************************************************************************
** Function name:			DefIrqFuncSet
** Descriptions:			设置非向量中断服务程序地址
** input parameters:		uiFuncAddr  :中断服务程序(普通C语言函数)
** output parameters:       none
** Returned value:			1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int DefIrqFuncSet(unsigned int uiFuncAddr)
{
	return swiHandle(0x107, uiFuncAddr, 0, 0);
}

/*********************************************************************************************************
** Function name:			DefIrqEnable
** Descriptions:			使能所选中断通道号的非向量中断
** input parameters:		uiChannel  	:外设对应的中断通道号
** output parameters:       none
** Returned value:			1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int  DefIrqEnable(unsigned int uiChannel)
{
	return swiHandle(0x108, uiChannel, 0, 0);
}
/*********************************************************************************************************
** Function name:			DefIrqDisable
** Descriptions:			释放所选中断通道号的非向量中断
** input parameters:		uiChannel    	:外设对应的中断通道号
** output parameters:       none
** Returned value:			1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int  DefIrqDisable(unsigned int uiChannel)
{
	return swiHandle(0x109, uiChannel, 0, 0);
}
/*********************************************************************************************************
** Function name:			SoftIntEnable
** Descriptions:			使能所选中断通道号的向量软中断
** input parameters:		uiChannel    	:外设对应的中断通道号
** output parameters:       none
** Returned value:			1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int  SoftIntEnable(unsigned int uiChannel)
{
	return swiHandle(0x10A, uiChannel, 0, 0);
}
/*********************************************************************************************************
** Function name:			SoftIntDisable
** Descriptions:			禁止所选中断通道号的向量软中断
** input parameters:		uiChannel    	:外设对应的中断通道号
** output parameters:       none
** Returned value:			1:          成功
**                          0:          失败
*********************************************************************************************************/
__inline unsigned int  SoftIntDisable(unsigned int uiChannel)
{
	return swiHandle(0x10B, uiChannel, 0, 0);
}

/*********************************************************************************************************
  允许中断嵌套宏定义
*********************************************************************************************************/
#define		OS_ENABLE_NESTING		OS_EXIT_CRITICAL
#define		OS_DISABLE_NESTING		OS_ENTER_CRITICAL

#ifdef __cplusplus
}
#endif                                                                  /*  __cplusplus                 */

#endif                                                                  /*  __TARGET_H                  */
/*********************************************************************************************************
  END FILE
*********************************************************************************************************/

⌨️ 快捷键说明

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