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

📄 globals.h

📁 关于XD256的应用实例,用于汽车电子开发之用
💻 H
字号:
/*****************************************************
 globals.h - declaration of shared data structures
 -----------------------------------------------------
   Copyright (c) Metrowerks, Basel, Switzerland
               All rights reserved
 -----------------------------------------------------
 These data structures are used by both, the XGATE
 and the HCS12 cores to exchange data. 
 
 Varaibles are defined in one of the these files:
 - globals.c  		  for HCS12 address space
 - globals.cxgate		for XGATE address space
 
 As long these variables do NOT contain addresses
 (pointers), they can be defined in either of these 
 two files. However, if a variable contains pointers,
 it has to be defined in the in the corresponding file.
               
Note: pointers defined in the shared RAM are unique to 
      the core and cannot be shared. 
 *****************************************************/

#ifndef __GLOBALS_H_ 
#define __GLOBALS_H_ 

#include <stdtypes.h>

#pragma DATA_SEG  SHARED_DATA  /* allocate all the variables in a shared section */

#ifdef __MWERKS__
  #define ISR interrupt
  #define inline inline
  #define far @far
  #define ineeprom
  #define AT(A)
#else
  #define ISR @interrupt
  #define inline @inline
  #define far @far
  #define ineeprom @eeprom
  #define AT(A) @A
#endif

#define noErr 0
#define false 0
#define true 1
typedef unsigned char Boolean;

#define ScreenBuffSize 1024


/* VFD Variables */

typedef struct {
                uchar *GBuffer;
                uchar *VFDBuffer;
                uchar *AByte;
                uchar *DByte;
                uchar *ADByte;
                uchar *BCByte;

               } XFormType;

typedef struct {
                uchar *ScreenBuffP;
                uchar *GridDataP;
                uint  BuffIndex;
                uchar GridIndex;
                uchar ColumnByteCount;
                uchar GridByteCount;
                uchar BK12State;
                uchar BKGState;
                
               } VFDDataType; 

typedef struct {                
                int  transfering;
                uint y;							 /* progress in scan lines */
                
               } STDataType;

extern VFDDataType VFData;
extern STDataType STData;

extern uchar GBuffer[ScreenBuffSize];		   /* logical grafic buffer (horizontal scan lines) */
extern uchar ScreenBuff[ScreenBuffSize];   /* physical scsreen buffer (double vertical scan lines) */
extern uchar GridData[8];

/* GDIC Variables */

typedef union {
               uint  w[1];
               uchar b[2];
              } GDICCmdType;

typedef struct {
                GDICCmdType GDICCmd;
                uchar GDICCmdState;
                uchar CmdByteIndex;	  /* index into the command buffer */
                uint  FuelPosition; 	/* current position of the left small gauge */
                uint  SpeedPosition;  /* current position of the left large gauge */
                uint  RPMPosition; 	  /* current position of the right large gauge */
                uint  CoolPosition; 	/* current position of the right small gauge */
                int   DemoPosition;   /* current position in demo mode */
                uchar filler;         /* for correct alignment */
                uchar UpDnFlag;				/* move direction in demo mode */
                
              } GDICDataType;

extern GDICDataType GDICData;

/* Switch/LED data */

#define LSwitch  0x01
#define RSwitch  0x08
#define UpSwitch 0x02
#define DnSwitch 0x04
#define HBSwitch 0x10
#define FGSwitch 0x20

#define UpState   0
#define DBDnState 1
#define DnState   2
#define DBUpState 3

typedef struct {
                uchar SwMask;
                uchar CurState;
                uchar LastState;
                uchar PortData;
                uchar BlinkTime;
                uchar filler;     /* for proper alignment */

               } SwLEDDataType;

extern SwLEDDataType SwLEDData;

/* latency measurement */
extern uint newTime, oldTime, maxDt;

/* CAN Variables */

extern uint  CANMsgID;
extern uchar CANDataLen;
extern uchar CANMsgData[];

/* operatin modes */
extern uchar CalibrationPhase;
extern uchar CarSimulation;
extern uchar BMPTfrByXG;

#pragma DATA_SEG  DEFAULT

#endif

⌨️ 快捷键说明

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