From 828d914304e29f5d8202df87393ce6744e528fdd Mon Sep 17 00:00:00 2001 From: QuakeGod <QuakeGod@sina.com> Date: 星期三, 01 二月 2023 11:59:04 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/klink' into kNet --- Inc/KBus.h | 43 +++++++++++++++++++------------------------ 1 files changed, 19 insertions(+), 24 deletions(-) diff --git a/Inc/KBus.h b/Inc/KBus.h index 69341b0..0bee8da 100644 --- a/Inc/KBus.h +++ b/Inc/KBus.h @@ -11,7 +11,7 @@ #define __KBUS_H__ typedef unsigned char uchar; -extern unsigned char bMaster,bSlave,bRepeater; +extern unsigned char bKBusMaster,bKBusSlave,bKBusRepeater;; enum enCMDs { cmdNone = '0', //Nothing @@ -144,7 +144,7 @@ }; } stChnStat; -extern stChnStat ChnStats[9]; +extern stChnStat ChnStats[8]; typedef struct tagSlaveStat { @@ -190,13 +190,13 @@ typedef struct tagPacket { - unsigned char Sign; //起始标记 - unsigned char DstHost; //目标地址 - unsigned char SrcAddr; //源地址 - unsigned char nCMD; //命令 - unsigned char nSEQ; //序列号 - unsigned char PacketLen; //数据载荷长度 不包括头部5个字节,不包括尾部BCC。 - unsigned char data[1]; //数据载荷,最末尾是BCC,数据长度为0时,实际也有一个数据。 + unsigned char Sign; //璧峰鏍囪 + unsigned char DstHost; //鐩爣鍦板潃 + unsigned char SrcAddr; //婧愬湴鍧� + unsigned char nCMD; //鍛戒护 + unsigned char nSEQ; //搴忓垪鍙� + unsigned char PacketLen; //鏁版嵁杞借嵎闀垮害 涓嶅寘鎷ご閮�5涓瓧鑺傦紝涓嶅寘鎷熬閮˙CC銆� + unsigned char data[1]; //鏁版嵁杞借嵎,鏈�鏈熬鏄疊CC锛屾暟鎹暱搴︿负0鏃讹紝瀹為檯涔熸湁涓�涓暟鎹�� }stPacket,* pPacket; enum eResult @@ -207,26 +207,22 @@ } ; -int RepeaterFunc(int nChn); -int MasterFunc(int nChn); -int SlaveFunc(int nChn); - -unsigned char BCC(void * pData, int nSize); +unsigned char KBusBCC(void * pData, int nSize); // /* Make a Packet and return Packet Length */ -int MakePacket(pPacket p1,uchar Src, uchar Dst, uchar nType, uchar nSEQ, uchar DataLen, void *pData ); +int KBusMakePacket(pPacket p1,uchar Src, uchar Dst, uchar nType, uchar nSEQ, uchar DataLen, void *pData ); /* */ -int CheckPacket(int nChn, pPacket p1, int len1); +int KBusCheckPacket(int nChn, pPacket p1, int len1); /* */ -int ParsePacket(int nChn, pPacket p1, int Len1); +int KBusParsePacket(int nChn, pPacket p1, int Len1); typedef struct tagMachineConfig { - int bMaster; + int bKBusMaster; int nAddr; }stMachineConfig; - +/* int InitMachine(stMachineConfig * pConfig); int SetConfig(void ); @@ -242,11 +238,10 @@ int WriteData(void); int GetStat(void); - - - - - +*/ +int KBusRepeaterFunc(int nChn); +int KBusMasterFunc(int nChn); +int KBusSlaveFunc(int nChn); #endif /* __KBUS_H__ */ -- Gitblit v1.9.1