From 842bb64195f958b050867c50db66fc0aa413dafb Mon Sep 17 00:00:00 2001 From: QuakeGod <quakegod@sina.com> Date: 星期六, 27 七月 2024 10:42:56 +0800 Subject: [PATCH] KBus upgrade --- ComLib/Inc/KLink.h | 35 ++++++++++++++++++++++++++++------- 1 files changed, 28 insertions(+), 7 deletions(-) diff --git a/ComLib/Inc/KLink.h b/ComLib/Inc/KLink.h index bf67273..36f63c6 100644 --- a/ComLib/Inc/KLink.h +++ b/ComLib/Inc/KLink.h @@ -31,7 +31,7 @@ enum {KLSignStart='%', //0x25 KLSignReply='U', //0x55 KLSignEnd=0x0D, - KLMaxPacketLength=64, + KLMaxPacketLength=256, }; enum enKLCMDs { @@ -60,11 +60,15 @@ KLCmdChkPass, KLCmdSetPass, KLCmdEraseAll, - KLCmdReadProgram, - KLCmdStartProgram, - KLCmdWriteProgram, - KLCmdFinishProgram, - + KLCmdReadPLCProgram, + KLCmdStartPLCProgram, + KLCmdWritePLCProgram, + KLCmdFinishPLCProgram, + KLCmdReadPLCAnno, + KLCmdStartPLCAnno, + KLCmdWritePLCAnno, + KLCmdFinishPLCAnno, + KLCmdRead1Bit = 0x21, //ReadSingleBit KLCmdWrite1Bit = 0x22, //WriteSingleBit KLCmdReadBits = 0x23, //ReadBits n = 1 - 8 @@ -116,6 +120,12 @@ KLCmdMD, KLCmdMG, + KLCmdWriteFirmware, + KLCmdWriteFirmInfo, + KLCmdGetPortInfo, + KLCmdGetPortChnInfo, + KLCmdGetPortChildInfo, + KLCmdPortRemoteReq, KLCmdErrRply=0xEE, //ERRORReply }; @@ -128,7 +138,7 @@ KLInfoTypeEventLogCount = 3, }; -extern unsigned char KLPacketBuf1[256]; +//extern unsigned char KLPacketBuf1[256]; extern unsigned char KLPacketBuf2[256]; extern unsigned char KLBufferIn[16]; @@ -140,6 +150,11 @@ extern int KLThisuS; extern int KLRecvTimeuS; +//PendReq 鐘舵�� + //0, 娌℃湁 + //1, 鎵ц涓� + //2, 鎴愬姛瀹屾垚 + //3, 澶辫触 #pragma anon_unions typedef union tagKLStatDef { @@ -148,6 +163,7 @@ UCHAR nSEQ : 4; UCHAR HasExt : 1; UCHAR HasErr : 1; + UCHAR PendReqStat : 2; }; }unKLStat, *pKLStat; /* @@ -223,6 +239,8 @@ }stKLPacket,* pKLPacket; */ +int KLinkInit(int ); + unsigned char KLBCC(const void * pData, int nSize); // @@ -236,6 +254,9 @@ /* */ int KLParsePacket(int nChn, void * pBuf1, int Len1); +typedef void *(*KLinkEvCBDef) (int nChn, int nEvent, void *, int); //Event callback func ,prama s is void *,void *,int; return void *; +typedef int (*KLinkSvCBDef) (int nChn, int nSvType, int ,void *, int); //Service Req callback func ,param is int ,int, int, void *,int; return int; + //int ReadData(void); //int WriteData(void); -- Gitblit v1.9.1