⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iap.c

📁 NXP(原飞利浦)的LPC214X系列ARM上的USB在系统升级的源代码,极力推荐!!开发者主页: http://www.simonqian.com/en/LPCUSBBoot/
💻 C
字号:
#include "iap.h"

U32 IAP_FCCLK;

U32 command[5];			// IAP入口参数缓冲区
U32 result[2];		// IAP出口参数缓冲区

U32 IAP_SelectSector(U8 sectorStart, U8 sectorEnd) {
	command[0] = IAP_CMD_SELECTSECTOR;
	command[1] = sectorStart;
	command[2] = sectorEnd;
	IAP_Entry(command, result);

	return result[0];
}
U32 IAP_RamToFlash(U32 dst, U32 src, U32 num) {
	command[0] = IAP_CMD_RAMTOFLASH;
	command[1] = dst;
	command[2] = src;
	command[3] = num;
	command[4] = (IAP_FCCLK ? IAP_FCCLK : IAP_FCCLK_Default);
	IAP_Entry(command, result);

	return result[0];
}

U32 IAP_EraseSector(U8 sectorStart, U8 sectorEnd) {
	command[0] = IAP_CMD_ERASESECTOR;
	command[1] = sectorStart;
	command[2] = sectorEnd;
	command[3] = (IAP_FCCLK ? IAP_FCCLK : IAP_FCCLK_Default);
	IAP_Entry(command, result);

	return result[0];
}

U32 IAP_BlankCheck(U8 sectorStart, U8 sectorEnd) {
	command[0] = IAP_CMD_BLANKCHECK;
	command[1] = sectorStart;
	command[2] = sectorEnd;
	IAP_Entry(command, result);

	return result[0];
}

U32 IAP_ReadBootID(void) {
	command[0] = IAP_CMD_READBOOTID;
	IAP_Entry(command, result);

	return result[1];
}

U32 IAP_ReadPartID(void) {
	command[0] = IAP_CMD_READPARTID;
	IAP_Entry(command, result);

	return result[1];
}

U32 IAP_Compare(U32 dst, U32 src, U32 num) {
	command[0] = IAP_CMD_COMPARE;
	command[1] = dst;
	command[2] = src;
	command[3] = num;
	IAP_Entry(command, result);

	return result[0];
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -