?? bpdialog.c
字號:
/* @(#) pSOSystem PowerPC/V2.2.2*/
/***********************************************************************/
/* */
/* MODULE: bsps/ads8xx/src/bpdialog.c */
/* DATE: 98/07/03 */
/* AUTHOR: Shan Zhengguang */
/* PURPOSE: This file contains functions needed by dialog.c to */
/* control, getting, printing, modifying and storing any */
/* hardware parameters need. */
/* MODIFIED BY: */
/* DATE NAME PURPOSE */
/* 98/07/03 ShanZG Create this file */
/* */
/* */
/* */
/* */
/*---------------------------------------------------------------------*/
/* */
/* Copyright 1998 - 1999, ZHONGXING TELECOM CO.,LTD. */
/* ALL RIGHTS RESERVED */
/* */
/* */
/*---------------------------------------------------------------------*/
/* */
/* The only hardware-specific parameter for this board is the */
/* 3 low-order bytes of the Ethernet address. */
/* */
/***********************************************************************/
#include "../bsp.h"
#include <bspfuncs.h>
#include <apdialog.h>
#include "board.h"
#include "sysVars.h"
extern const struct BspParms BspDefaults;
/*---------------------------------------------------------------------*/
/* The Ethernet address is used by the LAN driver (lan.c). Even */
/* NOTE: The dialog only allows the user to set the low-order part of */
/* the address, we set up the whole address in this module so that the */
/* LAN driver can use it. */
/*---------------------------------------------------------------------*/
unsigned char EthernetAddress[6];
/***********************************************************************/
/* BspGetdefaults: Place a copy of the structure containing the */
/* default values for the hardware-specific dialog parameters in */
/* ParamStruct */
/* */
/* INPUTS: void *ParamStruct */
/* */
/***********************************************************************/
void BspGetdefaults (void *ParmStruct)
{
ULONG temp=GetDefaultIP();
*((struct BspParms *)ParmStruct) = BspDefaults;
(*((struct BspParms *)ParmStruct)).Eth03=(temp&0xff0000)/0x10000;
(*((struct BspParms *)ParmStruct)).Eth04=(temp&0xff00)/0x100;
(*((struct BspParms *)ParmStruct)).Eth05=temp&0xff;
SysVars.Lan1IP=temp;
}
/***********************************************************************/
/* BspPrint: Print out the current values of the hardware_specific */
/* dialog parameters. */
/* */
/* INPUTS: *ParmStruct pointer to hardware parameters. */
/* */
/***********************************************************************/
void BspPrint (void *ParmStruct, void (*PrintRoutine) (char *format, ...))
{
UCHAR CpuRev;
struct BspParms *bp = (struct BspParms *)ParmStruct;
/*---------------------------------------------------------------------*/
/* Print out the hardware-specific parameters */
/*---------------------------------------------------------------------*/
PrintRoutine("HARDWARE PARAMETERS:\n");
CpuRev = BspCpuRev();
PrintRoutine(" MPC8xx (Rev %01d.%01d) CPU running at %dMhz with %dM ram\n",
(CpuRev & 0xF0) >> 4, CpuRev & 0x0F, BspCpuClkRate(),
RamSize()/(1024*1024));
PrintRoutine(" This board's Ethernet hardware address is 08:00:3E:%X:%X:%X\n",
bp->Eth03, bp->Eth04, bp->Eth05);
}
/***********************************************************************/
/* BspModify: This function conducts a hardware-specific dialog to */
/* modify the parameters contained in *ParmStruct. */
/* */
/* INPUTS: *ParmStruct pointer to hardware parameters. */
/* */
/* void(*PromptRoutine) function to use for prompting */
/* void(*PrintRoutine) function to use for printing */
/* */
/***********************************************************************/
void BspModify (void *ParmStruct,
void(*PrintRoutine)(char *format, ...),
void(*PromptRoutine)(char *prompt, PARM_TYPE ptype, void *paramptr))
{
struct BspParms *bp = (struct BspParms *)ParmStruct;
ULONG answer;
/*---------------------------------------------------------------------*/
/* Board-dependent parameters. */
/*---------------------------------------------------------------------*/
PrintRoutine("\nHARDWARE PARAMETERS:\n");
/*---------------------------------------------------------------------*/
/* Ethernet hardware address */
/*---------------------------------------------------------------------*/
answer = 0;
PromptRoutine("Do you want to change the board's Ethernet address?",
FLAG, &answer);
if (answer)
{
PrintRoutine(" Bytes 0 through 2 are always 08:00:3E\n");
answer = (ULONG) bp->Eth03;
PromptRoutine(" What should byte 3 be?", HEX, &answer);
bp->Eth03 = (UCHAR) answer;
answer = (ULONG) bp->Eth04;
PromptRoutine(" What should byte 4 be?", HEX, &answer);
bp->Eth04 = (UCHAR) answer;
answer = (ULONG) bp->Eth05;
PromptRoutine(" What should byte 5 be?", HEX, &answer);
bp->Eth05 = (UCHAR) answer;
}
}
/***********************************************************************/
/* BspUse: This function will take the bsp parameters that have been */
/* decided on and use them to set the bsp. */
/* */
/* INPUTS: *ParmStruct pointer to hardware parameters. */
/* */
/* RETURNS: VOID */
/* */
/***********************************************************************/
void BspUse (void *ParmStruct)
{
struct BspParms *bp;
bp = (struct BspParms *)ParmStruct;
EthernetAddress[0] = 0x08;
EthernetAddress[1] = 0x00;
EthernetAddress[2] = 0x3E;
EthernetAddress[3] = bp->Eth03;
EthernetAddress[4] = bp->Eth04;
EthernetAddress[5] = bp->Eth05;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -