📄 hidef.h
字号:
/*****************************************************
hidef.h - ANSI-C library: machine dependent stuff
----------------------------------------------------
Copyright (c) Metrowerks, Basel, Switzerland
All rights reserved
Do not modify!
*****************************************************/
#ifndef _H_HIDEF_
#define _H_HIDEF_
#ifdef __cplusplus
extern "C" {
#endif
/**** Version for MC68HC12 */
//#include "default.sgm" //jiangjianchun modified
#ifdef __BANKED__
#define __MEDIUM__
#endif
#include "stdtypes.h"
#include "stddef.h"
#include "start12.h"
#define CLOCKS_PER_SEC 4000000 /* has to be user defined */
#pragma NO_STRING_CONSTR /* allow '#' in HLI below */
#define HALT asm(" CLRB");asm(" SWI")
#define HALTX(x) {/*lint -e522 */ asm(" LDAB x"); asm(" SWI"); /*lint +e522 */}
#define HALT_AND_QUIT HALTX(#32)
#define EnableInterrupts asm(" CLI")
#define DisableInterrupts asm(" SEI")
/* COP macros */
#if defined(_HCS12) || defined(HCS12) || defined(__HCS12__)
#define _COPCTL_ADR (0x34+0x08)
#define _COP_RST_ADR (0x34+0x0B) /* ARMCOP */
#else
#define _COPCTL_ADR 0x16
#define _COP_RST_ADR 0x17
#endif
/* Note COPCTL is write once. */
#define _ENABLE_COP(period) ((*(volatile unsigned char*)_COPCTL_ADR)= (period)) /* Note: 7 longest posible COP duration. 0 == COP disabled. */
#define _ENABLE_COP_X() _ENABLE_COP(7) /* as long as possible */
#define _DISABLE_COP() _ENABLE_COP(0x00) /* COP is disabled if period is 0 */
#define _FEED_COP() ((*(volatile unsigned char*)_COP_RST_ADR)= 0x55,(*(volatile unsigned char*)_COP_RST_ADR)= 0xAA)
#if __STDC__ && 0
/* with strict ANSI, the far/near keywords are not allowed */
#define far
#define near
#endif
//struct _tagStartup _startupData;
//#define INIT_SP_FROM_STARTUP_DESC() asm("LDS _startupData.stackOffset")
// This is my highest stack offset. you can change this. - Hansol Park.
#define INIT_SP_FROM_STARTUP_DESC() asm("LDS #0x1327")
/*-------------------- tabled functions used with options -ot -oilib=g ----------------*/
/* 1 << char */
extern const unsigned char _PowOfTwo_8[8];
/* 1 << int */
extern const unsigned short _PowOfTwo_16[16];
/* 1L << long */
extern const unsigned long _PowOfTwo_32[32];
/* PIC support for runtime library. Generate all calls PIC, if option is present */
#ifdef __PIC__
#define __PIC_JSR(dest) asm("JSR dest,pcr")
#define __PIC_JMP(dest) asm("JMP dest,pcr")
#else
#define __PIC_JSR(dest) asm("JSR dest")
#define __PIC_JMP(dest) asm("JMP dest")
#endif
#ifdef __cplusplus
}
#endif
#endif
/*****************************************************/
/* end hidef.h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -