/** ****************************************************************************** * @file : KBus.h * @brief : Header for KBus.c file. * This file contains the common defines of the application. ****************************************************************************** */ #include "KBusDefine.h" #include "KMachine.h" #ifndef __KBUS_H__ #define __KBUS_H__ #define KBUS_VER (0x104) //#define SYN_PREFIX 1 typedef unsigned char uchar; extern unsigned char bKBusMaster,bKBusSlave,bKBusRepeater;; extern unsigned char PacketBuf1[MaxPacketLength]; extern unsigned char PacketBuf2[MaxPacketLength]; extern unsigned char BufferIn[16]; extern unsigned char BufferOut[16]; extern unsigned char nStationID; extern unsigned char nChilds; extern int ChildStat[16]; extern unsigned char nCurPollId; extern unsigned char nSeq; extern volatile unsigned char KBusMasterRecved; extern volatile unsigned char KBusMasterRecvOK; extern volatile unsigned char KBusSlaveRecved; extern unsigned int KBusSendTimeuS; extern volatile int KBusRecvTimeuS; extern int KBusDelayuS; extern int KBusMaxDelayuS; extern volatile unsigned int nSlaveTick; extern stChnStat KBusChnStats[8]; /* static inline char KWInit(int nPortNum) { }; static inline char KWStart(int nPortNum) { }; static inline char KWGetClientNum(int nPortNum) { }; static inline char KWGetClientInfo(int nPortNum, int nClientId) { }; static inline char KWGetClientInCount(int nPortNum,int nClientId) {}; static inline char KWisSafeState(int nPortNum) { }; static inline char KWisRunState(int nPortNum) { }; static inline char KWGetState(int nPortNum) { }; static inline char KWChangeState(int nPortNum, int nNewState){ }; */ unsigned char KBusBCC(void * pData, int nSize); // /* Make a Packet and return Packet Length */ int KBusMakePacket(pKBPacket p1,uchar Src, uchar Dst, uchar nType, uchar nStatus, uchar DataLen, void *pData ); /* */ int KBusCheckPacket(int nChn, pKBPacket p1, int len1); /* */ int KBusParsePacket(int nChn, pKBPacket p1, int Len1); /* int InitMachine(stMachineConfig * pConfig); int SetConfig(void ); int StartConfig(void); int SetMasterConfig(void); int StartPolling(void); int ReadData(void); int WriteData(void); int GetStat(void); */ int KBusRepeaterFunc(int nChn); int KBusMasterFunc(int nChn); int KBusSlaveFunc(int nChn); #endif /* __KBUS_H__ */