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

📄 intr.c

📁 Real-Time Digital Signal Processing Implementations, Applications, and Experiments with the TMS320C
💻 C
字号:
/******************************************************************/
/* intr.c V0.00                                                   */
/* Copyright (c) Texas Instruments , Incorporated  1997           */
/******************************************************************/
/******************************************************************/
/* Define temp location for storing interrupt vector locations    */
/******************************************************************/
#include "intr.h"

#pragma CODE_SECTION(hook_interrupt, "DRV5510");
#pragma CODE_SECTION(unhook_interrupt, "DRV5510");


extern interrupt void _intr_handler();
extern int _vectors;	 //Start label of vector table

void hook_interrupt(unsigned int trap, Ip func)
{
	unsigned long _branch = 0x6a00ul;
	unsigned long _func = (unsigned long)func;
	unsigned long *_addr = (unsigned long *)(((unsigned long)&_vectors + (trap * 0x8)) >> 1);

	*_addr = (_branch << 16) | _func;
}

void unhook_interrupt(unsigned int trap)
{
	unsigned long _branch = 0x6a00ul;
	unsigned long _func = (unsigned long)_intr_handler;
	unsigned long *_addr = (unsigned long *)(((unsigned long)&_vectors + (trap * 0x8)) >> 1);

	*_addr = (_branch << 16) | _func;
}

⌨️ 快捷键说明

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