📄 util.h
字号:
#ifndef __UTIL_H#define __UTIL_H//#include <test_functions.h>//#include <triggers.h>/******************************************************************************InterruptsThe following macros and defines greatly simplify using interrupt and exception handlers. It also basically ensures that interrupt patterns are portable between the cpu16 and cpu32. This allows use of the Whitesmith's hc16 toolset extensions to simplify creating interrupt handlers.Portability to and from the RCE is a more difficult matter.One notable exception is the berr exception. On the cpu32, upon return from the exception, the cpu retries the operation that caused a bus error. On the cpu16, execution continues with the next instruction. On the RCE, some exceptions may cause retries. This is yet to be determined. *******************************************************************************//****************************************************************************** * * Function: Interrupt handler macros INTERRUPT_FXN This is the return type of an interrupt function. INTERRUPT_RTN This is a macro which "does the right thing" to return from an interrupt. * * Parameters: * * Returns: * * Notes: use:INTERRUPT_FXN interrupt_handler( void ){ INTERRUPT_RTN;} *****************************************************************************/#define INTERRUPT_FXN void #define INTERRUPT_RTN /****************************************************************************** * * Function: Interrupt Installer (Installs the named function in the interrupt table as the handler for the interrupt. * * Parameters: UINT16 VectorNum The entry in the Interrupt table to fill INTERRUPT_FXN (*Fxn)() The new interrupt handler function. * * Returns: * * Notes: Example Call: InstallInterruptHandler( BUSERR, bus_error_handler ); where the following function has been defined: INTERRUPT_FXN bus_error_handler()Exception handling routines require the following code to allow the programto continue with code execution after an exception has been encountered andhandled. INTERRUPT_FXN exception_handler( void ) { ... INTERRUPT_RTN; } *****************************************************************************/extern void (* volatile custom_handler[256])(void); #define InstallInterruptHandler( VectorNum, Fxn ) \do{ \ custom_handler[ (VectorNum) ] = (Fxn); \}while(0) \/* end macro *//******************************************************************************stuff for miscellaneous*******************************************************************************///#define ASM( str ) asm( str ) #define ASM asm#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -