//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code. If
// you did not accept the terms of the license agreement, you are not
// authorized to use this sample source code. For the terms of the license,
// please see the license agreement between you and Microsoft or, if applicable,
// see the LICENSE.RTF on your install media or the root of your tools installation.
// THE SAMPLE SOURCE CODE IS PROVIDED "AS IS", WITH NO WARRANTIES OR INDEMNITIES.
//
//------------------------------------------------------------------------------
//
//  File: loader.h
//
//  This file contains definitions specific to the bootloader.
//
#ifndef _LOADER_H_
#define _LOADER_H_

#include <blcommon.h>
#include <halether.h>
#include <image_cfg.h>
#include <oal_kitl.h>

//------------------------------------------------------------------------------
// Defines
//
#define EBOOT_VERSION_MAJOR             6
#define EBOOT_VERSION_MINOR             3

#define EBOOT_TOTAL_RAM_SIZE            0x100000  // see eboot.bib to compute size
#define EBOOT_FLASHBLOCK_CACHE_START    ((UINT32) OALPAtoVA(PLATO_BASE_PA_SDRAM, FALSE) + EBOOT_TOTAL_RAM_SIZE)


//------------------------------------------------------------------------------
// External functions
//
extern void InitDebugSerial(UINT32 DbgSerPhysAddr);
extern void SpinForever(void);

extern DWORD OEMEthGetSecs(void);

extern UINT32 InitSpecifiedEthDevice(OAL_KITL_ARGS *pKITLArgs, UINT32 EthDevice);

//------------------------------------------------------------------------------
// Structure definitions. 
//
// The EBOOT_CFG structure holds a variety of configuration parameters.
// When adding new parameters, make sure that the size of the structure in bytes is 
// an integral number of DWORDS.  Pad the structure if necessary.
#define EBOOT_CFG_MAGIC_NUMBER                0x01020304
typedef struct
{
    DWORD autoDownloadImage;
    DWORD IP;
    DWORD subnetMask;
    DWORD numBootMe;
    DWORD delay;
    DWORD DHCPEnable;
    DWORD KITLEnabled;
    DWORD dwPhysStart;
    DWORD dwPhysLen;
    DWORD dwLaunchAddr;
    DWORD dwDbgSerPhysAddr;
    DWORD RNDISDefault;
    WORD  RNDISMac[4];
    DWORD ConfigMagicNumber;
} EBOOT_CFG, *PEBOOT_CFG;

//------------------------------------------------------------------------------
// Enumerated type definitions. 
//
typedef enum
{
    ETH_DEVICE_USB
} ETH_DEVICE_TYPE;

typedef enum
{
    IMAGE_TYPE_RAMIMAGE,
    IMAGE_TYPE_FLASHIMAGE,
    IMAGE_TYPE_BOOTLOADER,
    IMAGE_TYPE_MDOCLDR
} IMAGE_TYPE, *PIMAGE_TYPE;
//------------------------------------------------------------------------------

#endif  // _LOADER_H_.

