📄 global.h
字号:
//#######################################################
// A Global Macro Definition
// EEIC.HUST
// Author Azbo 14/07/2005
// Modify by Azbo 18/07/2005
// Change "x" into "(x)" in Macro,because of the priority of operaers.
// Modify by Azbo 18/07/2005
// Delete IO ports' output '0' in Macro of 'SET_PORT*_OUT'.
// Modify by Azbo 18/07/2005
// Add two Macros for test IO ports.
// Modify by Azbo 25/08/2005
// Add tow Mode:Bus opeartion & Bit opeartion.
// Modify by Azbo 28/08/2005
// Add system-stats and actions definition.
//#######################################################
#ifndef __GLOBAL_h__
#define __GLOBAL_h__
#include <SPCE061V004.H>
//Bit map
#define BIT0 0x0001
#define BIT1 0x0002
#define BIT2 0x0004
#define BIT3 0x0008
#define BIT4 0x0010
#define BIT5 0x0020
#define BIT6 0x0040
#define BIT7 0x0080
#define BIT8 0x0100
#define BIT9 0x0200
#define BIT10 0x0400
#define BIT11 0x0800
#define BIT12 0x1000
#define BIT13 0x2000
#define BIT14 0x4000
#define BIT15 0x8000
//All System Status
#define STAT_IDLE 0x0000
#define STAT_SPEECH 0x0004
#define STAT_MODE 0x0040
#define STAT_DATA 0x0010
#define STAT_ERROR 0x8000
//All Action
#define PRESS_KEY BIT0
#define ACTIVE_ADDR BIT3
#define REV_MSG_OK BIT1
#define REV_MSG_BAD BIT6
#define TIMEOUT_8KHz BIT2
#define SPEECH_S BIT4
#define DATA_S BIT5
#define ERROR BIT15
//Communication Protocal
#define COMM_ADDR 0xB3
#define COMM_SPEECH 0xCC
#define COMM_START 0xD9
#define COMM_STOP 0xF0
#define COMM_DATA 0xC3
//IO Direct Set
#define SET_PORTA_IN(x) do{(*P_IOA_Dir)&=(~(x));(*P_IOA_Attrib)&=(~(x));(*P_IOA_Data)|=(x);}while(0)
#define SET_PORTA_OUT(x) do{(*P_IOA_Dir)|=((x));(*P_IOA_Attrib)|=((x));}while(0)
#define SET_PORTB_IN(x) do{(*P_IOB_Dir)&=(~(x));(*P_IOB_Attrib)&=(~(x));(*P_IOB_Data)|=((x));}while(0)
#define SET_PORTB_OUT(x) do{(*P_IOB_Dir)|=((x));(*P_IOB_Attrib)|=((x));}while(0)
//IO Control
#define SET_PORTA(x) *P_IOA_Data=(*P_IOA_Buffer)|((x))
#define CLR_PORTA(x) *P_IOA_Data=(*P_IOA_Buffer)&(~(x))
#define SET_PORTB(x) *P_IOB_Data=(*P_IOB_Buffer)|((x))
#define CLR_PORTB(x) *P_IOB_Data=(*P_IOB_Buffer)&(~(x))
//IO data test
#define TEST_PORTA(x) (*P_IOA_Data&(x))
#define TEST_PORTB(x) (*P_IOB_Data&(x))
//Bus Interface & Opeartion
#define BUS_DATA 0xFF00
#define BUS_ALE BIT7
#define BUS_READ BIT6
#define BUS_WRITE BIT5
#define INTER_MODE BIT4
#define SetBITMode SET_PORTA(INTER_MODE)
#define SetBUSMode CLR_PORTA(INTER_MODE)
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -