//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.
Module Name:
main.c
Abstract:
Ethernet boot loader main module. This file contains the C main
for the boot loader. NOTE: The firmware "entry" point (the real
entry point is _EntryPoint in init assembler file.
The Windows CE boot loader is the code that is executed on a Windows CE
development system at power-on reset and loads the Windows CE
operating system. The boot loader also provides code that monitors
the behavior of a Windows CE platform between the time the boot loader
starts running and the time the full operating system debugger is
available. Windows CE OEMs are supplied with sample boot loader code
that runs on a particular development platform and CPU.
Functions:
Notes:
--*/
#include <windows.h>
#include <pcireg.h>
#include <ethdbg.h>
#include <drv_glob.h>
#include <nkintr.h>
#include <pehdr.h>
#include <romldr.h>
#include <blcommon.h>
#include <bootpart.h>
#include <kitlprot.h>
#include "s2410.h"
#include "loader.h"
#include "fmd.h"
#include "cfnand.h"
#include "warning.h"
typedef struct _vivi_parm{
UCHAR ip[4];
ULONG mask;
UCHAR mac[8];
unsigned int flashStart;
unsigned int partLen;
unsigned int downAddr;
unsigned int jumpAddr;
int bootSource;
int deploy;
int kerDBG;
int bpageCount;
unsigned int bpages[1];
}vivi_parm;
#define EBOOT 0
#define VIVI_PARM_ADDRESS 0x8c138000
PDRIVER_GLOBALS pDriverGlobals = ((PDRIVER_GLOBALS) DRIVER_GLOBALS_PHYSICAL_MEMORY_START);
// Some global definitions
#ifdef SIMULATOR
void CleanExit(DWORD dwExitCode);
#define SPIN_FOREVER CleanExit(41);
#else
#define SPIN_FOREVER {while(TRUE);}
#endif
//
// Global variables
//
BOOLEAN g_bDownloadImage = TRUE;
BOOLEAN g_bWaitForConnect;
DWORD g_dwImageStartBlock;
DWORD g_ImageType;
DWORD g_dwMinImageStart;
MultiBINInfo g_BINRegionInfo;
BOOL g_bBootMediaExist = FALSE;
vivi_parm *pViviParm = VIVI_PARM_ADDRESS;
unsigned int bpageCount = 0;
unsigned int *pbpage = NULL;
int downloadFromNand = 0;
int writeToNand = 0;
#pragma pack(1)
// N.B: only uses 1 sector for now.
UCHAR g_TOC[SECTOR_SIZE];
#pragma pack()
const PTOC g_pTOC = (PTOC)&g_TOC;
PBOOT_CFG g_pBootCfg;
DWORD g_dwTocEntry;
#ifdef DEBUG
DWORD EdbgDebugZone = 0;//ZONE_WARNING|ZONE_INIT; //ZONE_DHCP;
#endif
// External functions
extern void InitClock();
extern DWORD OEMAddressTable[];
void Launch();
void BootloaderMain (void);
BOOL InitEthDevice(PBOOT_CFG pBootCfg);
static void SetDelay();
static void SetCS8900MACAddress();
// Function prototypes
static BOOL GetUserIPAddr (EDBG_ADDR *pMyAddr, LPDWORD pdwSubnetMask);
static BOOL SetUDID ();
#define LAST_LAUNCH_ADDR_VALID 0xBADBEEF6
// Local util function
//
DWORD
ToPhysicalAddr(DWORD add)
{
DWORD padd = add;
DWORD * pt = OEMAddressTable;
DWORD vir_start;
DWORD vir_end;
DWORD phy_start;
DWORD sz;
EdbgOutputDebugString("+ToPhysicalAddr:0x%x\r\n", add);
do
{
vir_start = *pt++;
phy_start = *pt++;
sz = *pt++;
if (vir_start == 0 && phy_start == 0 && sz == 0) break;
vir_end = vir_start + sz * (1024 * 1024);
if (add >= vir_start && add < vir_end)
{
padd = add - vir_start + phy_start;
break;
}
} while (1);
EdbgOutputDebugString("-ToPhysicalAddr:0x%x\r\n", padd);
return padd;
}
// util function that should really be in blcommon
//
static void
itoa10(
int n,
char s[]
)
{
int i = 0;
// Get absolute value of number
unsigned int val = (unsigned int)((n < 0) ? -n : n);
// Extract digits in reverse order
do {
s[i++] = (val % 10) + '0';
} while (val /= 10);
// Add sign if number negative
if (n < 0) s[i++] = '-';
s[i--] = '\0';
// Reverse string
for (n = 0; n < i; n++, i--) {
char swap = s[n];
s[n] = s[i];
s[i] = swap;
}
}
static void
CreateDeviceName(
EDBG_ADDR *pMyAddr,
char *szBuf
)
{
strcpy(szBuf,PLATFORM_STRING);
szBuf += strlen(szBuf);
itoa10(((pMyAddr->wMAC[2]>>8) | ((pMyAddr->wMAC[2] & 0x00ff) << 8)), szBuf);
}
#ifdef TODO
// This routine programs the serial EEPROM and sets the
// Ethernet Address to 00 50 F2 08 NN NN (N=Debug board number).
static void SetSerialNumber(USHORT dbgBoardSerialNumber) {
USHORT i;
EdbgOutputDebugString("SetSerialNumber: %u \r\n", dbgBoardSerialNumber);
if ((dbgBoardSerialNumber <0) || (dbgBoardSerialNumber > 32000)) {
EdbgOutputDebugString("Error Serial Number between 0 and 32000\n");
}
for (i=0;i<16;i+=2) {
// Set all switch Areas to the same
SMCWriteEEPROM((UINT16)(0x0+i), 0xB0);
SMCWriteEEPROM((UINT16)(0x1+i), 0x1866);
}
for (i=16;i<0x20;i++) {
SMCWriteEEPROM(i,0x0);
}
// Avenger is 00-50-F2-03-XX-XX
// Trango is 00-50-F2-08-XX-XX
// Catfish is 00-50-F2-08-XX-XX ??
SMCWriteEEPROM(0x20, 0x5000); // Is 00-50-??-??-??-??
SMCWriteEEPROM(0x21, 0x08F2); // Is ??-??-F2-08-??-??
SMCWriteEEPROM(0x22, htons((UINT16)(dbgBoardSerialNumber)));
SMCWriteEEPROM(0x23, 0x389D);
SMCWriteEEPROM(0x24, 0x4595);
SMCWriteEEPROM(0x25, 0xFFFF);
SMCWriteEEPROM(0x26, 0x00FC);
SMCWriteEEPROM(0x27, 0x0000);
SMCWriteEEPROM(0x28, 0x5765);
SMCWriteEEPROM(0x29, 0x2776);
SMCWriteEEPROM(0x2A, 0x6520);
SMCWriteEEPROM(0x2B, 0x7374);
SMCWriteEEPROM(0x2C, 0x696C);
SMCWriteEEPROM(0x2D, 0x6C20);
SMCWriteEEPROM(0x2E, 0x676F);
SMCWriteEEPROM(0x2F, 0x7420);
}
#endif
//
// Functions called from blcommon
//
/*
@func BOOL | OEMVerifyMemory | Verify that the memory to be used by the downloaded BIN file is valid. This function also decides whether the image is the
bootloader or not based on its address (this information is used later when deciding how to store the image in flash).
@rdesc TRUE = Address specified is valid memory, FALSE = Address specified is *not* valid memory.
@comm
@xref
*/
BOOL OEMVerifyMemory(DWORD dwStartAddr, DWORD dwLength)
{
RETAILMSG(1, (TEXT("OEMVerifyMemory: StartAddr: 0x%x, Length:0x%x \r\n"), dwStartAddr, dwLength));
// Is the image being downloaded the bootloader?
if ((dwStartAddr >= EBOOT_STORE_ADDRESS) &&
((dwStartAddr + dwLength - 1) < (EBOOT_STORE_ADDRESS + EBOOT_STORE_MAX_LENGTH)))
{
RETAILMSG(1, (TEXT("Downloading Bootloader image\r\n")));
g_ImageType = IMAGE_TYPE_LOADER; // Bootloader image.
return TRUE;
}
// if it's MXIP don't test address to allow PPC images using funky addresses in their .BIN regions
else if ( g_BINRegionInfo.dwNumRegions > 1 )
{
RETAILMSG(1, (TEXT("Downloading %d regions of MXIP image\r\n"), g_BINRegionInfo.dwNumRegions));
// 1st region is RAMIMAGE, remaining are MXIP
g_ImageType = IMAGE_TYPE_RAMIMAGE | IMAGE_
没有合适的资源?快使用搜索试试~ 我知道了~
eboot.rar_2410 wince 5.0_eboot S3C24_wince 5.0 ebo_wince5.0 _wi
共71个文件
obj:24个
c:18个
s:6个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 65 浏览量
2022-09-19
14:12:35
上传
评论
收藏 257KB RAR 举报
温馨提示
ARM9 S3C2410 wince5.0 eboot source code
资源推荐
资源详情
资源评论
收起资源包目录
eboot.rar (71个子文件)
www.pudn.com.txt 218B
eboot
bin
EBOOT.nb0 88KB
dnw.ini 115B
tocblock1 512B
fmd.cpp 42KB
ether.c 5KB
ARM
UTIL.S 2KB
FW.S 460B
CACHE.S 972B
OEMBOOT.H 1KB
MMU.S 6KB
nand.s 669B
OEMBOOT.C 1KB
time.c 7KB
time.c.ori 3KB
flash.c 4KB
main.c 49KB
obj
ARMV4I
retail
time.obj 9KB
mmu.obj 757B
_objects.mac 412B
fw.obj 3KB
main.obj 62KB
ether.obj 14KB
ecc.obj 8KB
flash.obj 11KB
oemboot.obj 11KB
nand.obj 807B
fmd.obj 71KB
util.obj 313B
ARMV4
retail
time.obj 10KB
mmu.obj 757B
_objects.mac 473B
fw.obj 3KB
format.obj 16KB
blcommon.obj 25KB
main.obj 37KB
ether.obj 14KB
ecc.obj 8KB
flash.obj 11KB
oemboot.obj 11KB
nand.obj 807B
fmd.obj 75KB
util.obj 313B
Build.log 25KB
ecc.c 486B
Build.wrn 3KB
signimage.c 7KB
makefile 663B
sim
blcommon
contents.oak 145B
signimage.c 7KB
makefile 664B
blcommon.c 17KB
format.c 12KB
sources 1KB
DIRS 126B
sources.cmn 63B
main
fmd.cpp 441B
flash.c 26B
main.c 25B
ecc.c 489B
makefile 250B
nand.s 673B
timer.c 46B
debug.c 43B
simulator.c 9KB
sources 1KB
blcommon.c 19KB
format.c 12KB
sources 2KB
makefile.inc 1KB
BOOT.BIB 2KB
共 71 条
- 1
资源评论
寒泊
- 粉丝: 74
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功