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

---
 Ext_FPx/Src/BoardType.c |   93 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 93 insertions(+), 0 deletions(-)

diff --git a/Ext_FPx/Src/BoardType.c b/Ext_FPx/Src/BoardType.c
index e69de29..d92901f 100644
--- a/Ext_FPx/Src/BoardType.c
+++ b/Ext_FPx/Src/BoardType.c
@@ -0,0 +1,93 @@
+#include "BoardType.h"
+#include "KMachine.h"
+#include "KBus.h"
+
+#define  APP_ADDR			  		0x08001000  //应用程序首地址定义
+#define  APPINFOBLOCK_ADDR  		(APP_ADDR + 0x100)  //程序信息块 地址
+#define  INFOBLOCK_ADDR  		(APP_ADDR + 0x1000)  //信息块 地址
+
+#define  APP_START_ADDR 					IROM1_START_ADDRESS
+extern int Region$$Table$$Limit;
+
+#define MAKE_VER(x,y) ((x<<8)|y)
+#define APP_VER MAKE_VER(1,16)
+
+const stAppInfoBlock AppInfoBlock __attribute__((at(APPINFOBLOCK_ADDR))) =
+{
+	0xAA55,			// StartSign
+	0x0301,			// BlockType
+	sizeof(stAppInfoBlock),		//BlockSize
+	0,													// Pad,
+	APP_VER,								//AppVer						
+	(BOARD_TYPE<<8) + BOARD_VER,				//AppDevice;
+	0x1000,								//AppSize;
+	0x0C00,								//AppDataSize;
+	APP_ADDR,						//nAppStartAddr
+	(int)&Region$$Table$$Limit,						//nBtldr_NewAppInfoAddr
+	0x08009000,						//nBtldr_NewAppAddr
+	0xCCCC,								//crc16;
+	0xAA55								//EndSign;	
+	
+};
+
+
+const stKMInfoBlock KMInfoBlock __attribute__((at(INFOBLOCK_ADDR))) =
+{
+//	sizeof(stKMInfoBlock),
+	(BOARD_TYPE<<8) + BOARD_VER,			//nDeviceType 	BOARD_VER,			//nDevieVer
+	APP_VER,			//ProgVer
+	0x0102,			//KLinkVer
+	KBUS_VER,			//KBusVer
+//	0x0100,			//KNetVer
+//	0x0100,			//KWLVer
+	
+	4,					//nCapacity1	?K
+	1,					//nCapacity2	?k
+	
+	DINPUT,					//nDInput;
+	DOUTPUT,				//nDOutput
+	
+	0,					//nAInput
+	0,					//nAOutput
+	0,					//nHInput
+	0,					//nHOutput
+	0,					//nExt1;
+	0,					//nExt2;
+	0,					//nLogSize;
+	3,					//nPorts;
+	0,					//nManSize;
+	0,					//nAbility;
+	6,					//nSwitchBits;
+};
+
+const stDeviceInfo MyDeviceInfo={
+		
+		(BOARD_TYPE<<8) + BOARD_VER,			//nDeviceTypeVer //	unsigned short ClientType;		// 子机类型
+		APP_VER,			//ProgVer					//	unsigned short ClientVer;			// 子机版本
+
+		DINPUT,												//	unsigned char InBitCount;			// 输入开关量数量
+		DOUTPUT,											//	unsigned char OutBitCount;		// 输出开关量数量
+		0,								//	unsigned char InDWCount;			// 输入数据字数
+		0,								//	unsigned char OutDWCount;			// 输出数据字数
+		0,								//	unsigned char AIWCount;				// 输入模拟量通道(字)数	// 16位为一个字(通道)
+		0,								//	unsigned char AQWCount;				// 输出模拟量通道(字)数	// 16位为一个字(通道)
+//	0,								//	unsigned char AIBits;					//  每通道位数		// 16位以下
+//	0,								//	unsigned char AQbits;					//	每通道位数		// 16位以下
+};
+
+const stExDeviceInfo MyExDeviceInfo ={
+		(BOARD_TYPE<<8) + BOARD_VER,			//nDeviceTypeVer //	unsigned short ClientType;		// 子机类型
+		APP_VER,			//ProgVer					//	unsigned short ClientVer;			// 子机版本
+
+		DINPUT,												//	unsigned char InBitCount;			// 输入开关量数量
+		DOUTPUT,											//	unsigned char OutBitCount;		// 输出开关量数量
+		0,								//	unsigned char InDWCount;			// 输入数据字数
+		0,								//	unsigned char OutDWCount;			// 输出数据字数	
+		0,								//	unsigned char AIWCount;				// 输入模拟量通道(字)数	// 16位为一个字(通道)
+		0,								//	unsigned char AQWCount;				// 输出模拟量通道(字)数	// 16位为一个字(通道)
+//	0,								//	unsigned char AIBits;					//  每通道位数		// 16位以下
+//	0,								//	unsigned char AQbits;					//	每通道位数		// 16位以下
+
+};
+
+

--
Gitblit v1.9.1