📄 oem.h
字号:
#ifndef _NBOOT_OEM_H_
#define _NBOOT_OEM_H_
#include <fmdext.h>
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************************
OEM Hardware Functions
**************************************************************************************/
//////////////////////////////////////////////////////////////////////////////////////
// void OEMHardwareEarlyInit(void);
// Param: None
// Return: None
// Remark: This function is called to initialize any platform dependent hardware
// components. This function is called is at the earliest entry point to the
// C_Entry function. At this timethe system is in the following conditions:
// 1. running at user C code.
// 2. serial output/input not initialized at baudrate 38400.
// 3. nandflash system not initialized and not TOC is read out.
// 4. driver_global data structure zeroed
//////////////////////////////////////////////////////////////////////////////////////
void OEMHardwareEarlyInit(void);
//////////////////////////////////////////////////////////////////////////////////////
// void OEMHardwareInit(void);
// Param: None
// Return: None
// Remark: This function is called to initialize any platform dependent hardware
// components. At the time it's called, the system is in the following
// conditions:
// 1. running at user C code.
// 2. serial output/input initialized at baudrate 38400.
// 3. nandflash system initialized and TOC is read out.
// 4. driver_global data structure zeroed with a few member already inited.
//////////////////////////////////////////////////////////////////////////////////////
void OEMHardwareInit(void);
//////////////////////////////////////////////////////////////////////////////////////
// OEMDisplayNbootMenu(void);
// Param: None
// Return: 1: The user wants to display nboot menu.
// 0: The user doesn't want to display nboot menu
// Remark: The oem implements this function to decide whether to allow the nboot
// showing a menu at power up.
// When the system powers up, the nboot code will decide whether to show
// a menu to allow user perform advanced functions. The menu will be shown
// if one of the following functions are true:
// 1. This function returns 1, or
// 2. A bit flag in the TOC data structure is 1.
// A sample implementation in the EVB board checks whehter there is a key is
// pressed down at power up, if yes, then this function returns 1 and the
// nboot menu will be shown. OEMs usually wants to hide the NBOOT menu for
// product and only show it at a specific condition, for example, a couple
// of keys are pressed down simultaneously at power up.
//////////////////////////////////////////////////////////////////////////////////////
int OEMDisplayNbootMenu(void);
//////////////////////////////////////////////////////////////////////////////////////
// OEMRestoreDefaultTOC(void);
// Param: None
// Return: TRUE: User wants to reset TOC to default setting and erase flash.
// FALSE: User wants to use current TOC setting.
// Remark: Since TOC entry stores many information that used by nboot loader, some
// configuration may not be used and cause system can't boot any more. So
// if this happens, user can manual reset toc by press some of hardware key
// to restore to stable/default toc setting which can use full nboot functions
// in debug.
//////////////////////////////////////////////////////////////////////////////////////
BOOL OEMRestoreDefaultTOC(void);
//////////////////////////////////////////////////////////////////////////////////////
// int OEMIsNorBoot(void);
// Param: None
// Return: 0. Nand booting
// 1. Nor booting
// Remark: This function is used to determine whether we are booting from nand or
// nor device. The information is used to correctly initialize the Atlas
// cs[0].
// The Atlas chip has 4 cs (cs[0:3]) signals. They could be used either to
// connect NandFlash devices or to be used as a ROM interface to connect
// to a Nor flash or other peripherals. The system need to set correctly the
// nand_cs bits in the risc_pin_mux register to let the system function
// correctly.
//////////////////////////////////////////////////////////////////////////////////////
int OEMIsNorBoot(void);
//////////////////////////////////////////////////////////////////////////////////////
// int OEMGetNandCs(void);
// Param: None
// Return: The Nand Cs information. The return value should be the result of bit-or
// of the following values:
// 1. OEM_NAND_ON_CS0
// 2. OEM_NAND_ON_CS1
// 3. OEM_NAND_ON_CS2
// 4. OEM_NAND_ON_CS3
// Remark: The OEM must implement this function to correctly specified Nand device
// is POSSIBLY connected on which Atlas cs signals.
// The Atlas chip has 4 cs (cs[0:3]) signals. They could be used either to
// connect NandFlash devices or to be used as a ROM interface to connect
// to other peripherals. The system need to set correctly the nand_cs bits
// in the risc_pin_mux register to let the system function correctly.
// Please note that in the return value, the user MUST unset the
// bits for the CSes that are currently used for ROM interfaced devices.
// Otherwise, those devices may not be able to function normally. However,
// it's OK to set the bits of the CSes that are not connected with anyting.
// The NandFlash code will detect on those CSes to see if there is really
// a Nand device is connected. This leaves the flexibility of the product
// to easily scale the NandFlash without hardware change.
// On the EVB board, the CS1 use for CPLD logic , ethernet, and etc. Thus
// the return value on the EVB board is:
// (OEM_NAND_ON_CS0 | OEM_NAND_ON_CS2 | OEM_NAND_ON_CS3)
//////////////////////////////////////////////////////////////////////////////////////
#define OEM_NAND_ON_CS0 0x1
#define OEM_NAND_ON_CS1 0x2
#define OEM_NAND_ON_CS2 0x4
#define OEM_NAND_ON_CS3 0x8
int OEMGetNandCs(void);
/**************************************************************************************
OEM Address Mapping Functions
**************************************************************************************/
//////////////////////////////////////////////////////////////////////////////////////
// void OEMGetNandXIPInfo (DWORD *dwNandXIPCodePages,
// DWORD *dwNandXIPCopies);
// Param: dwNandXIPCodePages. A pointer to allow you overwrite the default XIP code
// page setting.
// dwNandXIPCopies. A pointer to allow you overwrite the default XIP copy
// setting.
// Return: None
// Remark: If the OEM wants to enhanced functions in the XIP code, he may wants to
// overwrite this function to provide his own settings. Otherwise, this
// function should be left empty to allow using the default values.
//////////////////////////////////////////////////////////////////////////////////////
void OEMGetNandXIPInfo (DWORD *dwNandXIPCodePages,
DWORD *dwNandXIPCopies);
//////////////////////////////////////////////////////////////////////////////////////
//void OEMGetEBootInfo ( DWORD *pdwEBootBlockSize,
// DWORD *pdwEbootLoadAddr,
// DWORD *pdwEbootLaunchAddr);
// Param: pdwEBootBlockSize. A pointer to allow you overwrite the default EBOOT
// block size setting.
// pdwEbootLoadAddr. A pointer to allow you overwrite the default EBOOT
// load address setting.
// pdwEbootLaunchAddr. A pointer to allow you overwrite the default EBOOT
// launch address setting.
// Return: None
// Remark: If the OEM wants to provide his own EBOOT with different address mapping,
// he may wants to overwrite this function to provide his own settings.
// Otherwise, this function should be left empty to allow using the default
// values.
//////////////////////////////////////////////////////////////////////////////////////
void OEMGetEBootInfo ( DWORD *pdwEBootBlockSize,
DWORD *pdwEbootLoadAddr,
DWORD *pdwEbootLaunchAddr);
//////////////////////////////////////////////////////////////////////////////////////
// void OEMGetDMInfo ( DWORD *pdwDMBlockSize,
// DWORD *pdwDMLoadAddr,
// DWORD *pdwDMLaunchAddr);
// Param: pdwDMBlockSize. A pointer to allow you overwrite the default DM
// block size setting.
// pdwDMLoadAddr. A pointer to allow you overwrite the default DM
// load address setting.
// pdwDMLaunchAddr. A pointer to allow you overwrite the default DM
// launch address setting.
// Return: None
// Remark: If the OEM wants to provide his own DM with different address mapping,
// he may wants to overwrite this function to provide his own settings.
// Otherwise, this function should be left empty to allow using the default
// values.
//////////////////////////////////////////////////////////////////////////////////////
void OEMGetDMInfo ( DWORD *pdwDMBlockSize,
DWORD *pdwDMLoadAddr,
DWORD *pdwDMLaunchAddr);
//////////////////////////////////////////////////////////////////////////////////////
// void OEMGetSecureBlockInfo( DWORD* pdwSecureBlockSize );
// Param:
// pdwSecureBlockSize
// A pointer to allow you overwrite the default secure block size setting.
// Return: None
// Remark: OEM can provide his own settings of secure block in this function. Or
// this function should be left empty to use the default values.
//////////////////////////////////////////////////////////////////////////////////////
void OEMGetSecureBlockInfo( DWORD* pdwSecureBlockSize );
/**************************************************************************************
OEM Menu Functions
**************************************************************************************/
//////////////////////////////////////////////////////////////////////////////////////
// void OEMMenuInit(void);
// Param: None
// Return: None
// Remark: The OEMs should initialize the menu data structure before it's being
// displayed. A sample implementation is provided in the oemmenu.c file.
// OEMs should always define a global variable as g_topMenu for the top
// menu. This variable will be referenced in main.cpp.
//////////////////////////////////////////////////////////////////////////////////////
void OEMMenuInit(void);
//////////////////////////////////////////////////////////////////////////////////////
// void OEMWriteLedX (DWORD dwNum);
// Param: dwNum. A number to be shown on the xth LED. The valid value is from 0-16,
// resuliting in displaying '0' - '9', 'A' - 'F', and no display
// respectively.
// Return: None
// Remark: If the OEM can implement up to 16 OEMWriteLedX functions as supported by
// the hardware. On the EVB board, we only have 2 LEDs, so we only implenent
// OEMWriteLed1 and OEMWriteLed2.
//////////////////////////////////////////////////////////////////////////////////////
void OEMWriteLed1 (DWORD dwNum);
void OEMWriteLed2 (DWORD dwNum);
void OEMWriteLed3 (DWORD dwNum);
void OEMWriteLed4 (DWORD dwNum);
void OEMWriteLed5 (DWORD dwNum);
void OEMWriteLed6 (DWORD dwNum);
void OEMWriteLed7 (DWORD dwNum);
void OEMWriteLed8 (DWORD dwNum);
void OEMWriteLed9 (DWORD dwNum);
void OEMWriteLed10 (DWORD dwNum);
void OEMWriteLed11 (DWORD dwNum);
void OEMWriteLed12 (DWORD dwNum);
void OEMWriteLed13 (DWORD dwNum);
void OEMWriteLed14 (DWORD dwNum);
void OEMWriteLed15 (DWORD dwNum);
void OEMWriteLed16 (DWORD dwNum);
//////////////////////////////////////////////////////////////////////////////////////
// void OEMSpecifyTargetImage(DWORD * pdwImgEntry)
// Param: pdwImgEntry. A pointer to the image entry variable that need to be
// specified by the OEM.
// Return: None
// Remark: This functions allows the OEM to specify the target image by a specific
// function. For example, the OEM may want to launch the EBOOT or DM when
// boot up while a special combination of keys are pressed down.
// If there is no such product requirements, leave this function to empty
// so that the pdwImgEntry is unchanged.
//////////////////////////////////////////////////////////////////////////////////////
void OEMSpecifyTargetImage(DWORD * pdwImgEntry);
//////////////////////////////////////////////////////////////////////////////////////
// BOOL OEMNBootCheck(void)
// Param: None
// Return: TRUE to indicate ok for continue booting.
// FALSE when some booting condition is not meet, e.g. low batter.
// Remark: This functions allows the system to check some specific conditions before
// doing cold boot, for example, if the battery level is high enough for
// system booting. If the return value is FALSE, the NBOOT will call
// OEMNbootSleep to perform platform specific functions to enterring sleep.
//////////////////////////////////////////////////////////////////////////////////////
BOOL OEMNBootCheck(void);
// BOOL OEMNBootSleep(void)
// Param: None
// Return: None
// Remark: This functions is called when the OEMNBootCheck returns FALSE. This
// function will perform platform specific operations to sleep the system.
//////////////////////////////////////////////////////////////////////////////////////
void OEMNBootSleep(void);
//////////////////////////////////////////////////////////////////////////////////////
// BOOL OEMGetFlashExtInfo (DWORD dwManuID, DWORD dwDevID, PFlashInfoEx pFlashExtInfo);
// Param:
// dwManuID
// Manufacture Identifier of the NAND flash chip
// dwDevID
// Device Identifier of the NAND flash chip
// pFlashExtInfo
// Pointer to the buffer to keep the extended flash information
// Return: TRUE for success, FALSE on failure.
// Remark: This function is called when a NAND flash chip is not the default supported
// chips by the CSP. If the NAND flash chip is recognized by the BSP supplier,
// the extended flash information is filled the FlashInfo structure.
//////////////////////////////////////////////////////////////////////////////////////
BOOL OEMGetFlashExtInfo (DWORD dwManuID, DWORD dwDevID, PFlashInfoEx pFlashExtInfo);
#ifdef __cplusplus
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -