From 9aed5d7e7b3c7bf09da712e9c272ece401a7acc9 Mon Sep 17 00:00:00 2001 From: QuakeGod <QuakeGod@sina.com> Date: 星期一, 25 十一月 2024 14:51:23 +0800 Subject: [PATCH] add UltraSonic and MultiWireLess --- ComLib/Inc/KBus.h | 730 ++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 557 insertions(+), 173 deletions(-) diff --git a/ComLib/Inc/KBus.h b/ComLib/Inc/KBus.h index 1edbc0a..0849ced 100644 --- a/ComLib/Inc/KBus.h +++ b/ComLib/Inc/KBus.h @@ -5,6 +5,8 @@ * This file contains the common defines of the application. ****************************************************************************** */ +#include "KBusDefine.h" + #include "KMachine.h" #ifndef __KBUS_H__ @@ -12,25 +14,97 @@ #define KBUS_VER (0x104) +#define MAX_CLIENT 16 //最大支持子机数量 + +#define KBUS_WAIT_TIME_OUT1 5 // 0.1mS ticks. +#define KBUS_WAIT_TIME_OUT2 8 // 0.1mS ticks. + +#define KBUS_SLAVE_TIME_OUT 500 // 0.1ms ticks + //#define SYN_PREFIX 1 - typedef unsigned char uchar; +typedef volatile unsigned char vuchar; +typedef unsigned short ushort; -extern unsigned char bKBusMaster,bKBusSlave,bKBusRepeater;; +enum enKBusStationType // KBus工作类型 +{ + KBNone = 0, // 0,未定义 + KBusMaster = 1, // 1,主机 + KBusSlave = 2, // 2,子机 + KBusRepeater = 3, // 3,转发器,中继器 +}; // diagnosis - enum enKBusStats { - KBusStatIdel, - KBusStatConfig, - KBusStatRunning, - KBusStat + KBusStatUnInited, // 未初始化状态 + KBusStatInited, // 已初始化状态 + KBusStatConfig, // 已配置状态 + KBusStatReady, // 就绪状态 + KBusStatRunning, // 运行状态 + KBusStatIdel, // 暂停状态 + KBusStatSafe, // 安全状态 + KBusStatError, // 错误状态 +}; +/* +enum enKBusStage +{ + KBusStageInit, + KBusStageFindChild, + KBusStageConfigChild, + KBusStagePoll, + +}; +*/ +typedef enum +{ + KBusRunStepBroadCastCfg, + KBusRunStepTimeSync, + KBusRunStepTimeSyncWait, + KBusRunStepMultiDataPoll, + KBusRunStepMultiDataPollWait, + KBusRunStepUniDataPoll, + KBusRunStepUniDataPollWait, + KBusRunStepUniDataTranster, + KBusRunStepUniDataTransterWait, + +}enKBusRunStep; + +enum { + KB_SYN = 0x55, + KBStartSign='%', + KBEndSign=0x0D, + KBMaxPacketLength=148, }; enum enCMDs { - cmdNone = '0', //Nothing + + cmdNone = 0x00, //Nothing + + cmdQuery = 0x01, //Query basic Info + cmdQueryRply = 0x81, //Query Info Reply + + cmdSetCfg = 0x02, // Set Configuration + cmdSetCfgRply = 0x82, // Set Configuration Response + + cmdToRunMode = 0x03, + cmdToRunModeRply = 0x83, + + cmdBroadCastCfg = 0x04, // + + cmdMuExchgData = 0x05, // + cmdMuExchgDataRply = 0x85, // + + cmdToSafeMode = 0x06, + + cmdHeartBeat = 0x07, // + cmdReHeartBeat = 0x87, // + + + cmdRemoteReq = 0x1B, + cmdRemoteReqReply = cmdRemoteReq|0x80, // + cmdPing = '1', //Ping cmdPingReply = '2', //PingReply cmdRead = '3', //Read @@ -40,7 +114,7 @@ cmdGetVersion = '7', //GetVersion cmdVerInfo = '8', //VersionReply - cmdExChgData='A', //ExChangeDate, = Wirte + Read + cmdUniExChgData='A', //ExChangeData, = Wirte + Read cmdExChgDataReply, //ExchangeData Reply cmdSyncRead='a', //SyncRead @@ -49,70 +123,80 @@ cmdSyncTime, //SyncTime }; -enum { - SYN = 0x55, - StartSign='%', - EndSign=0x0D, - MaxPacketLength=128, -}; -extern unsigned char PacketBuf1[MaxPacketLength]; -extern unsigned char PacketBuf2[MaxPacketLength]; - -typedef struct tagKBusRunStat -{ - unsigned char bMaster; - unsigned char nStationID; - unsigned char nChildren; - unsigned char nCurPollId; - unsigned char nSeq; - - unsigned char bMasterRecved; - unsigned char bMasterRecvOK; - unsigned char bSlaveRecved; - unsigned int nSendTimeuS; - -}stKBusRunStat , * pstKBusRunStat; - -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; - -typedef struct tagVerInfo +typedef struct tagVerInfo // KBus 版本信息 { unsigned char nMainVer; unsigned char nSubVer; }stVerInfo; -typedef struct tagMachineState -{ - unsigned char Addr; - unsigned char state; - unsigned char InStartAddrBit; - unsigned char OutStartAddrBit; - unsigned char InDWStartAddrByte; - unsigned char OutDWStartAddrByte; -}ClientState; - -typedef struct tagMasterStat +typedef struct tagMasterStat // KBus 主机状态? { unsigned int CycleTime; } stMasterStat; +typedef struct tagDeviceInfo // KBus 子机基本信息 +{ + unsigned short DeviceType; // 子机类型 + unsigned short DeviceVer; // 子机版本 + unsigned char InBitCount; // 输入开关量数量 + unsigned char OutBitCount; // 输出开关量数量 + unsigned char ExInBitCount; // 扩展的输入开关量数量 + unsigned char ExOutBitCount; // 扩展的输出开关量数量 + unsigned char DWStartAddr; // 输出数据字数 + unsigned char OutDWCount; // 输出数据字数 + unsigned char AIWCount; // 输入模拟量通道(字)数 // 16位为一个字(通道) + unsigned char AQWCount; // 输出模拟量通道(字)数 // 16位为一个字(通道) +// unsigned char AIBits; // 每通道位数 // 16位以下 +// unsigned char AQbits; // 每通道位数 // 16位以下 + + +}stDeviceInfo; + +typedef struct tagExDeviceInfo // 子机扩展信息 +{ + unsigned short DeviceType; // 子机类型 + unsigned short DeviceVer; // 子机版本 + + unsigned char UID[12]; // 12字节 UUID + unsigned char Name[16]; // 16字节 名称 +// stVerInfo ClientVer; + unsigned char InBitCount; + unsigned char OutBitCount; + unsigned char ExInBitCount; // 扩展的输入开关量数量 + unsigned char ExOutBitCount; // 扩展的输出开关量数量 + unsigned char DWStartAddr; + unsigned char OutDWCount; + unsigned char AIWCount; + unsigned char AQWCount; +// unsigned char AIBits; +// unsigned char AQbits; + + +}stExDeviceInfo; + +enum enKBusConfigStat +{ + KBusUnConfiged = 0, + KBusDefaultConfiged =1, + KBusConfiged = 2, +}; + +typedef struct tagClientCfg // 子机配置 +{ + unsigned char Addr; // 子机地址 + unsigned char Configed; // 是否已配置 + unsigned char bOnline; //当前在线状态 + unsigned char InStartAddrBit; //输入起始位地址 + unsigned char OutStartAddrBit; //输出起始位地址 + unsigned char AIWStartAddrByte; //模拟入起始字地址 + unsigned char AQWStartAddrByte; //模拟出起始字地址 + unsigned char DIWStartAddrByte; //数据入起始字地址 + unsigned char DOWStartAddrByte; //数据出起始字地址 + unsigned char KeepOut; //Keep Output when comm err; +}stClientCfg; + +/* typedef struct ServerStatus { unsigned char Addr; @@ -122,29 +206,383 @@ unsigned short output[16]; }stServerStatus,*pServerStatus; - -typedef struct tagClientCfg +*/ +typedef struct tagMachineState // 本机状态 { - unsigned int KeepOut; //Keep Output when comm err; - -}stClientCfg; + unsigned char Addr; // 地址 + unsigned char state; //状态 + unsigned char InStartAddrBit; //输入起始位地址 + unsigned char OutStartAddrBit; //输出起始位地址 + unsigned char InDWStartAddrByte; //字输入起始字地址 + unsigned char OutDWStartAddrByte; //字输出起始字地址 +}ClientState; -struct ClientInfo -{ - stVerInfo ClientVer; - unsigned char nType; - unsigned char nGroup; - unsigned char InPutCount; - unsigned char OutPutCount; - unsigned char InDWCount; - unsigned char OutDWCount; - unsigned char bOnline; -}; + #pragma anon_unions typedef struct tagChnStat { - unsigned int Stat; + union{ + unsigned char MStat; + struct{ + unsigned char bOnline:1; + unsigned char bErr1:1; + unsigned char bErr2:1; + unsigned char bReq:1; + }; + }; + unsigned char SStat; + unsigned short SendPackets; + unsigned short RecvPackets; + unsigned short LastSentTimeTick; + unsigned short LostPackets; + unsigned short CtnLstPkts; + unsigned short MaxCtnLstPkts; + unsigned short NotPkgErr; + unsigned short PkgLenErr; + unsigned short BCCErr; + unsigned short TimeOutErr; + unsigned short Delay; + unsigned short MaxDelay; + unsigned short SendTimeInterval; + union + { + unsigned short ClientDatas[10]; + struct { + unsigned short ClientRecvPkts; // + unsigned short ClientSendPkts; // + unsigned short ClientNotPktErr; // + unsigned short ClientMisIdPkts; // +// unsigned int ClientNoEndErr; // + unsigned short ClientPkgLenErr; // + unsigned short ClientBccErr; // + unsigned short ClientTimeOutErr; // + }; + }; +} stChnStat; + + +typedef struct tagSlaveStat +{ + unsigned int nSlaveTick; +} stSlaveStat; + +typedef struct ServerClientListElement +{ + unsigned char Addr; + unsigned char Status; + unsigned char Father; + unsigned char Childs; + +} stServerClientListElement; + +typedef struct ServerClientList +{ + unsigned char Addr; +}stServerClientList,*pServerClientList; + +typedef struct tagMachineConfig +{ + int bKBusMaster; + int nAddr; +}stMachineConfig; + +/* +typedef struct ClientStatus +{ + unsigned char Addr; + unsigned char Status; + unsigned char Father; + unsigned char Childs; + unsigned short Input[16]; + unsigned short DT[128]; + unsigned short output[16]; + +}stChnStatus,*pClientStatus; +*/ + +typedef struct tagStatusDef +{ + unsigned char nSeq:2; //序列号 + unsigned char :2; + unsigned char nErr1:1; + unsigned char nErr2:1; + unsigned char bReq:1; + +}stStatus; + +typedef union tagUnStatusDef +{ + unsigned char nStatus; + stStatus; +}unStatus; + +typedef struct tagKBPacket +{ + unsigned char Sign; //起始标记 + unsigned char DstHost; //目标地址 + unsigned char SrcAddr; //源地址 + unsigned char nCMD; //命令 + union{ + unsigned char nStatus; //状态+序列号 + struct{ + unsigned char nSeq:2; //序列号 + unsigned char :2; + unsigned char nErr1:1; //错误1 + unsigned char nErr2:1; //错误2 + unsigned char bReq:1; // + }; + }; + unsigned char DataLen; //数据载荷长度 不包括头部5个字节,不包括尾部BCC。 + unsigned char data[1]; //数据载荷,最末尾是BCC,数据长度为0时,实际也有一个数据。 +}stKBPacket,* pKBPacket; + +typedef struct tagKBInfoBlockV1 +{ + unsigned short nDeviceType; + unsigned short nProgVer; + + unsigned char InBitCount; + unsigned char OutBitCount; + + unsigned char AICount; + unsigned char AIBits; + unsigned char AQCount; + unsigned char AQbits; + + unsigned char InDWCount; + unsigned char OutDWCount; + +}stKBInfoBlockV1, *pKBInfoBlockV1; + +enum eResult +{ + S_OK =0, + S_ERR=1, + S_TIMEOUT=2 + +} ; + +/* +typedef struct tagKBPacketV10 +{ + unsigned char Sign; //起始标记 + unsigned char DstHost; //目标地址 + unsigned char SrcAddr; //源地址 + unsigned char nCMD; //命令 + union{ + unsigned char nStatus; //状态+序列号 + struct{ + unsigned char nSeq:2; //序列号 + unsigned char :2; + unsigned char nErr1:1; + unsigned char nErr2:1; + + }; + }; + unsigned char DataLen; //数据载荷长度 不包括头部5个字节,不包括尾部BCC。 + unsigned char data[1]; //数据载荷,最末尾是BCC,数据长度为0时,实际也有一个数据。 +}stKBPacketV10,* pKBPacketV10; + +typedef struct tagKBPacketV20 +{ + unsigned char Sign; //起始标记 + unsigned char DstHost; //目标地址 + unsigned char SrcAddr; //源地址 + unsigned char nCMD; //命令 + union{ + unsigned char nStatus; //状态+序列号 + struct{ + unsigned char nSeq:2; //序列号 + unsigned char :2; + unsigned char nErr1:1; + unsigned char nErr2:1; + + }; + }; + unsigned char DataLen; //数据载荷长度 不包括头部5个字节,不包括尾部BCC。 + unsigned char data[1]; //数据载荷,最末尾是BCC,数据长度为0时,实际也有一个数据。 +}stKBPacketV20,* pKBPacketV20; +*/ + +enum enumCallBackEvent +{ + KBusEvNone = 0, + KBusEvCreate = 1, + KBusEvConnected = 2, + KBusEvDisConnected = 3, + KBusEvClosed = 4, + KBusEvStateChange =5, + KBusEvTimeSync=6, + KBusEvDataUpdate =7, + KBusEvCmdResponse = 8, + +}; + +typedef int (*KBusSendPktFuncDef) (uchar * pBuf, int nLen); // SendPacket CallBack func for KBus + +typedef void *(*KBusEvCBFuncDef) (void * , int nEvent, void *, int); //callback func ,prama s is void *,void *,int; return void *; + +typedef int (*KBusSvCBFuncDef) (void *, int nSvType, int ,void *, int); //Service Req callback func ,param is int ,int, int, void *,int; return int; + +/* +typedef struct tagKBusRunStat +{ + unsigned char bMaster; // 是否主机 + unsigned char nStationID; // 子机地址 + unsigned char nChildren; // 子机数量 + unsigned char nCurPollId; // 当前轮询到的子机 地址。 + unsigned char nSeq; // 包序列号 + + unsigned char bMasterRecved; // 状态, 主机已接收到返回的数据包 + unsigned char bMasterRecvOK; // 状态, 主机接收到的返回的数据包正确 + unsigned char bSlaveRecved; // 状态, 子机接受到数据包。 + unsigned int nSendTimeuS; // 数据包发出时刻。 + +}stKBusRunStat , * pstKBusRunStat; +*/ + +#pragma anon_unions +typedef struct tagKBusDef // KBus 工作内存 +{ +///* + union { + uchar nConfig; + struct { + uchar bMaster:1; //KBus, 是否主机 + uchar bSlave:1; //KBus, 是否子机 + uchar bRepeater:1; //KBus, 是否转发器,中继器 + }; + }; +// */ +/* + uchar bMaster; //KBus, 是否主机 + uchar bSlave; //KBus, 是否子机 + uchar bRepeater; //KBus, 是否转发器,中继器 +*/ + + uchar nStationId; //KBus 站号 + vuchar MyStat; //KBus, 状态机状态 + vuchar nRunStep; //KBus, 运行步 + vuchar nSeq; //KBus, 包序列号 + + vuchar bMasterSent; // 状态 主机已发送 + vuchar bMasterRecved; // 状态 主机已接收 回包 + vuchar bMasterRecvOK; // 状态 主机接收回包正确 + vuchar bSlaveRecved; // 状态 子机已接收包 + + vuchar nChildCount; // 子机数量 + uchar nCurPollId; // 当前轮询子机 号 + ushort ErrStat; + ushort RunStat; + + uchar bReq; //运行系统请求中 + uchar nReqSvrId; //请求号 + uchar nReqChildId; //请求的子机号 + uchar nReqParam; //请求的参数 + ushort nReqReCount; // + + uchar nReqDataHdr[4]; + uchar pReqDatas[140]; + uchar nReqDataOff; + uchar nReqDataLen; + + + + int SendTimeTick; // 发包时刻 + int RecvTimeTick; // 收包时刻 + int DelayTick; // 包循环延迟 + int nMaxDelayTick; // 最大包循环延迟 + int LastCircleStartTime; //=0; + int CircleTime; //=0; + + int nSlaveTick; // 子机时间 tick + +// int ThisuS; + //volatile unsigned int nSlaveTick; //=0; + + int Clk3; //=0; + int SendTime,Latancy,LatancyClk,SendClk; + + //volatile int nCount2; //=0; + int TimeOutCount; //=0; + + + stPortDef KBusPort; + KBusSendPktFuncDef KBusSendPacket; // 发送数据包函数指针 + KBusEvCBFuncDef KBusEvCBFunc; // 事件回调函数指针 + KMSvCBDef KBusSvCBFunc; // 服务请求回调指针 + + stDeviceInfo* pMyDeviceInfo; + + uchar RetryCount; // 重试次数 + uchar nTimeOutCount; // 超时计数 + vuchar step; // 当前步骤 + uchar ChildStat[MAX_CLIENT]; // 子机状态(们) + + + uchar CurXBitAddr; // 已分配 X 位 地址 + uchar CurYBitAddr; // 已分配 Y 位 地址 + uchar CurAIWAddr; // 已分配 模拟量入 字 地址 + uchar CurAQWAddr; // 已分配 模拟量出 字 地址 + uchar CurDIWAddr; // 已分配 数据入 字 地址 + uchar CurDOWAddr; // 已分配 数据出 字 地址 + + uchar MyYStartBitAddress; // 本机 起始 Y 位地址 + uchar MyAQWStartWordAddress; // 本机 起始 模拟量 出 字 地址 + uchar MyDWStartWordAddress; // 本机 起始 数据出 字 地址 + + stDeviceInfo DeviceInfos[MAX_CLIENT]; // 子机信息(们) + stClientCfg ClientCfg[MAX_CLIENT]; // 子机配置(们) + stChnStat KBusChnStats[MAX_CLIENT]; + + +// uchar bKBusEvCBFuncSet; // 事件回调函数是否已经设置 +// uchar bKBusSvCBFuncSet; // 事件回调函数是否已经设置 + +// uchar PacketBuf1[KBMaxPacketLength]; + uchar PacketBuf2[KBMaxPacketLength]; + + + unsigned char Datas[128]; + volatile int PacketLength; // = 0; + + unsigned char KBusDiagnosis; // =1; // Kbus 诊断模式 + unsigned char KBusSnapPos; // = 0; // 抓取 Kbus 包 + +// unsigned char nStationID; //=0; +// unsigned char nChilds; + //int ChildStat[16]; + // unsigned char nCurPollId; //=0; + // unsigned char nSeq; //=0; + unsigned char nClientDataIndex; //=0; + +}stKBusDef,*pstKBusDef; + + +typedef struct tagKBusMem +{ + union{ + ushort WLX[16]; + uchar WLXB[32]; + }; + union{ + ushort WLY[16]; + uchar WLYB[32]; + }; + ushort AIW[16]; + ushort AOW[16]; + ushort DIW[16]; + ushort DOW[16]; +}stKBusMem, *pstKBusMem; + +extern stKBusMem KBusMem; + +/* +typedef struct tagKBusDiag +{ + + int Stat; unsigned int SendPackets; unsigned int RecvPackets; unsigned int LastSentTimeuS; @@ -171,110 +609,58 @@ unsigned int ClientBccErr; // unsigned int ClientTimeOutErr; // }; - }; -} stChnStat; - -extern stChnStat KBusChnStats[8]; - -typedef struct tagSlaveStat -{ - unsigned int nSlaveTick; -} stSlaveStat; - - -typedef struct ServerClientListElement -{ - unsigned char Addr; - unsigned char Status; - unsigned char Father; - unsigned char Childs; + }; -} stServerClientListElement; - -typedef struct ServerClientList -{ - unsigned char Addr; -}stServerClientList,*pServerClientList; -/* -typedef struct ClientStatus -{ - unsigned char Addr; - unsigned char Status; - unsigned char Father; - unsigned char Childs; - unsigned short Input[16]; - unsigned short DT[128]; - unsigned short output[16]; - -}stChnStatus,*pClientStatus; +}stKBusDiag, *pstKBusDiag; */ -typedef void *(*CBFuncDef) (void*, void *, int); //callback func ,prama s is void *,void *,int; return void *; -enum enumCallBackEvent -{ - evNone = 0, - evCreate = 1, - evConnected = 2, - evDisConnected = 3, - evClosed = 4, -}; -typedef struct tagStatusDef -{ - unsigned char nSeq:2; //搴忓垪鍙� - unsigned char :2; - unsigned char nErr1:1; - unsigned char nErr2:1; -}stStatus; -typedef union tagUnStatusDef -{ - unsigned char nStatus; - stStatus; -}unStatus; +int KBusInit(stKBusDef * pKBus, KBusSendPktFuncDef KBusSendPacket, int bMaster, int nChildCount); -typedef struct tagKBPacket - { - unsigned char Sign; //璧峰鏍囪 - unsigned char DstHost; //鐩爣鍦板潃 - unsigned char SrcAddr; //婧愬湴鍧� - unsigned char nCMD; //鍛戒护 - union{ - unsigned char nStatus; //鐘舵��+搴忓垪鍙� - struct{ - unsigned char nSeq:2; //搴忓垪鍙� - unsigned char :2; - unsigned char nErr1:1; - unsigned char nErr2:1; - - }; - }; - unsigned char PacketLen; //鏁版嵁杞借嵎闀垮害 涓嶅寘鎷ご閮�5涓瓧鑺傦紝涓嶅寘鎷熬閮˙CC銆� - unsigned char data[1]; //鏁版嵁杞借嵎,鏈�鏈熬鏄疊CC锛屾暟鎹暱搴︿负0鏃讹紝瀹為檯涔熸湁涓�涓暟鎹�� - }stKBPacket,* pKBPacket; +int KBusInitMaster(stKBusDef * pKBus, KBusSendPktFuncDef KBusSendPacket, int nChildCount); +int KBusInitSlave(stKBusDef * pKBus, KBusSendPktFuncDef KBusSendPacket, int nStationId, stDeviceInfo *pClientInfo); -enum eResult -{ - S_OK =0, - S_ERR=1, - S_TIMEOUT=2 +int KBusLoadSavedConfig(stKBusDef * pKBus); +int KBusSetEvCallBackFunc(stKBusDef * pKBus, KBusEvCBFuncDef CBFunc); // Set Event CallBack function +int KBusSetSvCallBackFunc(stKBusDef * pKBus, KMSvCBDef CBFunc); // Set ServiceReq CallBack Function +int KBusMakeDefaultClildInfo(stKBusDef * pKBus, int nChild); +int KBusReqService (stKBusDef * pKBus, int ReqId, int nParam1, int nParam2, void **pData, unsigned short * len1); -} ; +int KBusStart(stKBusDef * pKBus) ; +int KBusStop(stKBusDef * pKBus) ; +int KBusDataPoll(stKBusDef * pKBus); -unsigned char KBusBCC(void * pData, int nSize); -// +int KBusLoopProcess(stKBusDef * pKBus); +int KBusMasterFunc(stKBusDef * pKBus); +int KBusSlaveFunc(stKBusDef * pKBus); +int KBusRepeaterFunc(stKBusDef * pKBus); + /* 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 KBusCheckPacket(stKBusDef * pKBus, pKBPacket p1, int len1); /* */ -int KBusParsePacket(int nChn, pKBPacket p1, int Len1); -typedef struct tagMachineConfig -{ - int bKBusMaster; - int nAddr; -}stMachineConfig; +int KBusParsePacket(stKBusDef * pKBus, pKBPacket p1, int Len1); + +int KBusPacketSendDone(stKBusDef * pKBus); +/* +static inline char KBGetClientNum(int nChn) { }; +static inline char KBGetClientInfo(int nChn, int nClientId) { }; +static inline char KBGetClientIOCount(int nChn,int nClientId) {}; +int KBGetClientStatus(int nChn); + +static inline char KBisSafeState(int nPortNum) { }; +static inline char KBisRunState(int nPortNum) { }; +static inline char KBGetState(int nPortNum) { }; +static inline char KBChangeState(int nPortNum, int nNewState){ }; +*/ + +unsigned char KBusBCC(void * pData, int nSize); +// +int KBusSlaveRunRemoteReq(stKBusDef * pKBus, int nReqSvrId, unsigned char * pData , int Len1); + /* int InitMachine(stMachineConfig * pConfig); @@ -292,9 +678,7 @@ int GetStat(void); */ -int KBusRepeaterFunc(int nChn); -int KBusMasterFunc(int nChn); -int KBusSlaveFunc(int nChn); + #endif /* __KBUS_H__ */ -- Gitblit v1.9.1