📄 nand.h
字号:
//
// 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.
--*/
#ifndef __NAND_H__
#define __NAND_H__
#define VIRTUAL_TO_PHYSICAL(va) ((va) - 0x8C000000 + 0xC0000000)
typedef DWORD SECTOR_ADDR;
typedef PDWORD PSECTOR_ADDR;
typedef enum _FLASH_TYPE { NAND, NOR } FLASH_TYPE;
typedef struct _FlashInfo
{
FLASH_TYPE flashType;
DWORD dwNumBlocks;
DWORD dwBytesPerBlock;
WORD wSectorsPerBlock;
WORD wDataBytesPerSector;
}FlashInfo, *PFlashInfo;
typedef struct _SectorInfo
{
DWORD dwReserved1; // Reserved - used by FAL
BYTE bOEMReserved; // For use by OEM
BYTE bBadBlock; // Indicates if block is BAD
WORD wReserved2; // Reserved - used by FAL
DWORD dwReserved3[6];
}SectorInfo, *PSectorInfo;
BOOL
FMD_ReadSector(
SECTOR_ADDR startSectorAddr,
LPBYTE pSectorBuff,
PSectorInfo pSectorInfoBuff,
DWORD dwNumSectors
);
void FMD_Init(void);
typedef struct ROMHDR {
ULONG dllfirst; // first DLL address
ULONG dlllast; // last DLL address
ULONG physfirst; // first physical address
ULONG physlast; // highest physical address
ULONG nummods; // number of TOCentry's
ULONG ulRAMStart; // start of RAM
ULONG ulRAMFree; // start of RAM free space
ULONG ulRAMEnd; // end of RAM
ULONG ulCopyEntries; // number of copy section entries
ULONG ulCopyOffset; // offset to copy section
ULONG ulProfileLen; // length of PROFentries RAM
ULONG ulProfileOffset; // offset to PROFentries
ULONG numfiles; // number of FILES
ULONG ulKernelFlags; // optional kernel flags from ROMFLAGS .bib config option
ULONG ulFSRamPercent; // Percentage of RAM used for filesystem
// from FSRAMPERCENT .bib config option
// byte 0 = #4K chunks/Mbyte of RAM for filesystem 0-2Mbytes 0-255
// byte 1 = #4K chunks/Mbyte of RAM for filesystem 2-4Mbytes 0-255
// byte 2 = #4K chunks/Mbyte of RAM for filesystem 4-6Mbytes 0-255
// byte 3 = #4K chunks/Mbyte of RAM for filesystem > 6Mbytes 0-255
ULONG ulDrivglobStart; // device driver global starting address
ULONG ulDrivglobLen; // device driver global length
USHORT usCPUType; // CPU (machine) Type
USHORT usMiscFlags; // Miscellaneous flags
PVOID pExtensions; // pointer to ROM Header extensions
ULONG ulTrackingStart; // tracking memory starting address
ULONG ulTrackingLen; // tracking memory ending address
} ROMHDR, *PROMHDR;
#define ERR_SUCCESS 0
#define ERR_DISK_OP_FAIL1 1
#define ERR_DISK_OP_FAIL2 2
#define ERR_INVALID_BOOT_SECTOR 3
#define ERR_INVALID_LOAD_ADDR 4
#define ERR_GEN_FAILURE 5
#define ERR_INVALID_PARAMETER 6
#define ERR_JUMP_FAILED 7
#define ERR_INVALID_TOC 8
#define ERR_INVALID_FILE_TYPE 9
#define ERR_MEDIA_CORRUPTED 10
#if !defined (EXTERN_C)
#if !defined (__cplusplus)
#define EXTERN_C extern
#else /* !defined (__cplusplus) */
#define EXTERN_C extern "C"
#endif /* !defined (__cplusplus) */
#endif /* !defined (EXTERN_C) */
EXTERN_C BOOL NandLocateBlocks(void);
EXTERN_C BOOL NandWriteToc(void);
EXTERN_C BOOL NandWriteCurImg(void);
EXTERN_C BOOL NandEraseAll(void);
EXTERN_C BOOL NandIsOEMReservedBlock(DWORD dwBlock);
EXTERN_C int TOC_Reset (unsigned int wParam);
EXTERN_C void FMDDirectReadMode(void);
#endif /*__NAND_H__*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -