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/GlobalDef.h |   44 +++++++++++++++++++++++++++-----------------
 1 files changed, 27 insertions(+), 17 deletions(-)

diff --git a/ComLib/Inc/GlobalDef.h b/ComLib/Inc/GlobalDef.h
index d35b43f..d77f82a 100644
--- a/ComLib/Inc/GlobalDef.h
+++ b/ComLib/Inc/GlobalDef.h
@@ -17,14 +17,24 @@
 
 extern volatile int PendSvCount;
 
+#pragma anon_unions
 typedef struct tagUartStat
 {
 	volatile int SendBytes;
 	volatile int RecvBytes;
-	volatile char bInited;
-	volatile char bSending;
-	volatile char bRecving;
-	volatile char bUseAltRecvBuf;
+	volatile int SentPacket;	
+	union{
+		volatile unsigned char state;
+		struct {
+			volatile unsigned char bInited:1;
+			volatile unsigned char bSending:1;
+			volatile unsigned char bRecving:1;
+			volatile unsigned char bUseAltRecvBuf:1;
+
+		};
+	};
+	volatile unsigned char bPacketRecved;	
+	volatile unsigned char bSendDone;
 	volatile int IRQCount;
 	volatile int RXNECount;
 	volatile int TXECount;	
@@ -32,37 +42,37 @@
 	volatile int OverRunCount;
 	volatile int TcCount;		//Transmit Complete
 	volatile int IdelCount;		//RecvIdel
-	volatile int LostBytes;
+//	volatile int LostBytes;
 	volatile int DMACount;
 	volatile int DMASendLen;
 	volatile int DMARecvLen;
 	stMyQueue QRx;
 	stMyQueue QTx;
-	volatile int SentPacket;
-	volatile int bPacketRecved;
-	volatile int OKPacket;
-	volatile int TimeOutErr;
-	volatile int NotPacketErr;
-	volatile int LengthErr;
-	volatile int BCCerr;
+
+
+//	volatile int OKPacket;
+//	volatile int TimeOutErr;
+//	volatile int NotPacketErr;
+//	volatile int LengthErr;
+//	volatile int BCCerr;
 }stUartStat;
 
 
 extern stUartStat Uart1Stat;
 extern stUartStat Uart2Stat;
 
+#define Uart1RecvBufSize 256
+
 extern unsigned int Uart1Baud;
 extern unsigned int Uart2Baud;
 
-extern unsigned char Uart1RecvBuf1[128];
+extern unsigned char Uart1RecvBuf1[Uart1RecvBufSize];
 extern int Uart1RecvBuf1DataLen;
-//extern unsigned char Uart1RecvBuf2[128];
-//extern int Uart1RecvBuf2DataLen;
+
 
 extern unsigned char Uart2RecvBuf1[128];
 extern int Uart2RecvBuf1DataLen;
-//extern unsigned char Uart2RecvBuf2[128];
-//extern int Uart2RecvBuf2DataLen;
+
 
 extern volatile int Uart1BaudGot;
 extern volatile int Uart1BaudFirstGot;

--
Gitblit v1.9.1