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

📄 2410loader.c.bak

📁 S3C2410 For Wince5.0 NAND Flash 启动的源代码
💻 BAK
字号:
//
// 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.
--*/
/************************************************
 * NAME    : 2410loader.C			*
 * DESC    : 					*
 * History : 2002.02.25 ver 0.0			*
************************************************/

#include <stdlib.h>
#include <string.h>
#include "option.h"
#include "def.h"
#include "2410addr.h"
#include "2410lib.h"
#include "2410slib.h"
#include "2410addr.h"
#include "nand.h"
#include "loader.h"

#define EBOOT_ADDR (0x30038000)
//
// Globals
//

DWORD ReadImageFromNand(DWORD dwEntry);

void Main(void)
{
    DWORD 	err; //, t0 = 0;
    
    //	By default, we launch image CE image. If you want to launch
    //	Eboot, you need to hold down APP4 button (sw803) when it boots.
    DWORD	dwEntry = EBOOT_ADDR;

    MMU_EnableICache();

    Uart_Init();

    NF_Init();
    NF_ReadID();

    Uart_SendString("\ndwEntry is ");
    Uart_SendDWORD(dwEntry, TRUE);

    // Hardcoded to fetch TOC descriptor dwEntry
    err = ReadImageFromNand(dwEntry);

    if (ERR_SUCCESS == err) 
    {
        Launch(EBOOT_ADDR);
        err = ERR_JUMP_FAILED;
    }

    Uart_SendString("\nBoot ERROR:");
    Uart_SendDWORD(err, TRUE);
    while (1);
}


// -----------------------------------------------------------------------------
//  ReadImageFromNand:
//      Reads nk.nb0 off NAND
//      Returns ERR_Xxx
// -----------------------------------------------------------------------------

DWORD ReadImageFromNand(DWORD dwEntry)
{
    DWORD i;
    BYTE buf[512];

#define RESERVED_BOOT_BLOCKS        0x1 //(NBOOT_BLOCK_SIZE)

    for(i=0;i<0x40000/512;i++)
    {
	 if ( !FMD_ReadSector(i+RESERVED_BOOT_BLOCKS*32,(LPBYTE)dwEntry,NULL, 1))
            return ERR_DISK_OP_FAIL1;
	dwEntry+=512;
    }

    return ERR_SUCCESS;
}

⌨️ 快捷键说明

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