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

📄 ks_diag.c

📁 MICREL 网卡驱动 FOR CE 5.0
💻 C
📖 第 1 页 / 共 5 页
字号:
/* ---------------------------------------------------------------------------
          Copyright (c) 2003-2004 Micrel, Inc.  All rights reserved.
   ---------------------------------------------------------------------------

   ks884xDiag.c - This file includes SCORs for diagnosis

   Modification History:
   PCD   06/13/05  0.1.9    Added CLI for QC test.
   PCD   08/25/04           Created file.
   ---------------------------------------------------------------------------
*/

#if !defined( DEF_LINUX )  &&  !defined( KS_ARM )
#include <stdlib.h>
#include <string.h>
#endif
#include "hardware.h"
#ifdef DEF_VXWORKS
#include "ioLib.h"
#ifdef KS_PCI_BUS
#include "ks884xEnd.h"
#endif
#ifdef KS_ISA_BUS
#include "ks884xEnd_shBus.h"
#endif
#endif

#undef CLI_DEBUG

/* if define it, then separate CLI command's argv by SPACE, otherwise, by ',' */
#ifdef KS_QC_TEST
#undef  SEPARATE_CLI_ARGV_BYSPACE       /* for QC test: SEPARATE CLI ARGV BY ',' */
#else
#define SEPARATE_CLI_ARGV_BYSPACE       /* normal: SEPARATE CLI ARGV BY SPACE  */
#endif

#define DELAY_IN_nMS_TO_CHECK      5    /* delay in ms unit to check if we received packet */


#define MIN_BANK_NUM            0
#define MAX_BANK_NUM           63
#define MIN_REGADDR_OFFSET      0
#ifdef KS_ISA_BUS
#define MAX_REGADDR_OFFSET     15
#elif KS_PCI_BUS
#define MAX_REGADDR_OFFSET     0x0554
#define MAX_DWORD_OFFSET       0x0200
#endif


#define MSG_ERROR_PREFIX        "ERROR: "
#define SPACE                   " "

#define BUFFER_COUNT            6
#define BUFFER_LENGTH           (2 * 1024)

static unsigned char FAR * apbBuffer[ BUFFER_COUNT ] =
{
   (unsigned char *) 0,
   (unsigned char *) 0
} ;
unsigned char packetBuf[ BUFFER_COUNT ][BUFFER_LENGTH];

extern UCHAR TestPacket[];


#define LINKMD_INFO_COUNT       10
unsigned long tempBuf[ LINKMD_INFO_COUNT ];
unsigned char FAR tempStrBuf[ (LINKMD_INFO_COUNT + 1) * sizeof (unsigned long) ];


const char FAR *hwHelpMsgStr[] =
{
#ifndef DEF_VXWORKS
#ifdef KS_ISA_BUS
/*  0 */  "BankNum    = { 0 ..     3f }   -- Bank number."NEWLINE,
/*  1 */  "RegNum     = { 0 ..      f }   -- Register number."NEWLINE,
#else
/*  0 */  "BankNum    = { 0           }   -- Dummy Bank number."NEWLINE,
/*  1 */  "RegNum     = { 0 ..   0554 }   -- Register number."NEWLINE,
#endif
/*  2 */  "RegData    = { 0 ..   ffff }   -- Register data to write."NEWLINE,
/*  3 */  "Width      = { 1 ..   2, 4 }   -- Register data width to read\\write (1:in BYTE, 2:in WORD, 4:in LONG)."NEWLINE,
/*  4 */  "BitMask    = { 0 ..   0001 }   -- Mask defining bit pattern field."NEWLINE,
/*  5 */  "BitPat     = { 0 ..   0001 }   -- Bit pattern to check for."NEWLINE,
/*  6 */  "BufNum     = { 0 ..      5 }   -- Debug buffer number."NEWLINE,
/*  7 */  "BufOffset  = { 0 ..    7ff }   -- Debug buffer offset."NEWLINE,
/*  8 */  "Len        = { 1 ..    800 }   -- Debug buffer length."NEWLINE,
#ifdef M16C_62P
/*  9 */  "WData      = { 0 ..     ff }   -- Buffer data to write (e.g. FF 00 01 0A)."NEWLINE,
#else
/*  9 */  "WData      = { \"0 ..   ff\" }  -- Buffer data to write (e.g. \"FF 00 01 0A\")."NEWLINE,
#endif
/* 10 */  "FData      = { 0 ..     ff }   -- Buffer data to fill."NEWLINE,
/* 11 */  "BufInc     = { 0 ..     ff }   -- Buffer data to fill by increasing count."NEWLINE,
/* 12 */  "Repeat     = { 0 ..      n }   -- Repeat times."NEWLINE,
/* 13 */  "Port       = { 0 ..      3 }   -- Port number(0-by lookup, 1-direct to port1, 2-direct to port2, 3-direct to port1 and 2)"NEWLINE,
/* 14 */  "SameBuf    = { 0 ..      1 }   -- 1 - use same buffer to Tx, 0 - continuous next buffer to Tx."NEWLINE,
/* 15 */  "TimeOut    = { 0 ..      n }   -- Time in ms to wait before giving up "NEWLINE,
/* 16 */  "Index      = { 0 ..      n }   -- Table index. "NEWLINE,
/* 17 */  "Count      = { 0 ..      n }   -- Number of table entry items (max Count: mac1-8, mac2-1024, vlan-6, mib-102). "NEWLINE,
/* 18 */  "RegDataH   = { 0 ..ffffffff}   -- Table Update Write Data Register High (bit_63 ~ bit_32). "NEWLINE,
/* 19 */  "RegDataL   = { 0 ..ffffffff}   -- Table Update Write Data Register Low  (bit_31 ~ bit_0 ). "NEWLINE,
/* 20 */  "DumpFlag   = { 0 ..      1 }   -- 1 - Start dumpping packet, 0 - Stop dummping packet."NEWLINE,
/* 21 */  "Delay      = { 0 ..     ff }   -- Delay ms between continous transmit packets."NEWLINE,
/* 22 */  "Table = {mac1,mac2,vlan,mib}   -- Table identifier (mac1=static MAC, mac2=dynamic MAC)"NEWLINE,
#ifdef KS_PCI_BUS
/* 23 */  "BusNo      = { 0 ..      n }   -- PCI bus number."NEWLINE,
/* 24 */  "DevNo      = { 0 ..      n }   -- PCI device number."NEWLINE,
/* 25 */  "FuncNo     = { 0 ..      n }   -- PCI function number."NEWLINE,
/* 26 */  "RegNo      = { 0 ..      n }   -- PCI register number."NEWLINE,
#endif /* #ifdef KS_PCI_BUS */

#else  /* vxWorks Shell command */
/*  0 */  "BankNum    = { 0              }  -- Dummy Bank number."NEWLINE,
/*  1 */  "RegNum     = { 0 ..    0x0554 }  -- Register number."NEWLINE
/*  2 */  "RegData    = { 0 ..0xffffffff }  -- Register data to write."NEWLINE,
/*  3 */  "Width      = { 1 ..      2, 4 }  -- Register data width to read\\write (1:in BYTE, 2:in WORD, 4:in LONG)."NEWLINE,
/*  4 */  "BitMask    = { 0 ..0x00000001 }  -- Mask defining bit pattern field. "NEWLINE,
/*  5 */  "BitPat     = { 0 ..0x00000001 }  -- Bit pattern to check for. "NEWLINE,
/*  6 */  "BufNum     = { 0 ..         5 }  -- Debug buffer number."NEWLINE,
/*  7 */  "BufOffset  = { 0 ..     0x7ff }  -- Debug buffer offset."NEWLINE,
/*  8 */  "Len        = { 1 ..     0x800 }  -- Debug buffer length "NEWLINE,
/*  9 */  "WData      = { \"0 ..      ff\" }  -- Buffer data to write (e.g. \"FF 00 01 0A\")."NEWLINE,
/* 10 */  "FData      = { 0 ..      0xff }  -- Buffer data to fill."NEWLINE,
/* 11 */  "BufInc     = { 0 ..         1 }  -- Buffer data to fill by increasing count."NEWLINE,
/* 12 */  "Repeat     = { 0 ..         n }  -- Repeat times."NEWLINE,
/* 13 */  "Port       = { 0 ..         3 }  -- Port number(0-by lookup, 1-direct to port1, 2-direct to port2, 3-direct to port1 and 2)"NEWLINE,
/* 14 */  "SameBuf    = { 0 ..         1 }  -- 1 - use same buffer to Tx, 0 - continuous next buffer to Tx."NEWLINE,
/* 15 */  "TimeOut    = { 0 ..         n }  -- Time in ms to wait before giving up "NEWLINE,
/* 16 */  "Index      = { 0 ..         n }  -- Table index. "NEWLINE,
/* 17 */  "Count      = { 0 ..         n }  -- Number of table entry items (max Count: mac1-8, mac2-1024, vlan-6, mib-102). "NEWLINE,
/* 18 */  "RegDataH   = { 0 ..0xffffffff }  -- Table Update Write Data Register High (bit_63 ~ bit_32). "NEWLINE,
/* 19 */  "RegDataL   = { 0 ..0xffffffff }  -- Table Update Write Data Register Low  (bit_31 ~ bit_0 ). "NEWLINE,
/* 20 */  "DumpFlag   = { 0 ..         1 }  -- 1 - Start dumpping packet, 0 - Stop dummping packet."NEWLINE,
/* 21 */  "Delay      = { 0 ..      0xff }  -- Delay ms between continous transmit packets."NEWLINE,
/* 22 */  "Table = {\"mac1\",\"mac2\",\"vlan\",\"mib\"}  -- Table identifier (mac1=static MAC, mac2=dynamic MAC)"NEWLINE,
#ifdef KS_PCI_BUS
/* 23 */  "BusNum     = { 0 ..         n }  -- PCI bus number."NEWLINE,
/* 24 */  "DevNum     = { 0 ..         n }  -- PCI device number."NEWLINE,
/* 25 */  "FuncNum    = { 0 ..         n }  -- PCI function number."NEWLINE,
/* 26 */  "RegNum     = { 0 ..         n }  -- PCI register number."NEWLINE,
#endif /* #ifdef KS_PCI_BUS */

#endif  /* #ifndef DEF_VXWORKS */

/*    */  " "NEWLINE,
#if defined (SEPARATE_CLI_ARGV_BYSPACE) && !defined (DEF_VXWORKS)
/*    */  "hwhelp                                              -- Display help message."NEWLINE,
/*    */  "hwread       BankNum  RegNum    Width               -- Read ks884X register."NEWLINE,
/*    */  "hwwrite      BankNum  RegNum    RegData  Width      -- Modify ks884X register."NEWLINE,
/*    */  "hwpoll       BankNum  RegNum BitMask BitPat TimeOut -- Poll register bit if it match bit pattern."NEWLINE,
/*    */  "hwbufread    BufNum   BufOffset Len                 -- Display contents of debug buffer."NEWLINE,
/*    */  "hwbufwrite   BufNum   BufOffset WData [...]         -- Write data to debug buffer."NEWLINE,
/*    */  "hwbuffill    BufNum   BufOffset FData  BufInc  Len  -- Fill data to debug buffer."NEWLINE,
/*    */  "hwbuftx      Port BufNum Len Repeat SameBuf Delay   -- Tx packet from debug buffer to ks884X."NEWLINE,
/*    */  "hwbufrx      BufNum   TimeOut                       -- Rx packet from ks884X and store in debug buffer(start at BufNum)."NEWLINE,
/*    */  "hwtableread  Table Index   Count                    -- Read ks884X table data register."NEWLINE,
/*    */  "hwtablewrite Table Index   RegDataH  RegDataL       -- Write ks884X table data register. "NEWLINE,
/*    */  "hwtableshow  Table Index   Count                    -- Show ks884X table."NEWLINE,
/*    */  "hwclearmib   Port                                   -- Clear software MIB counter database (clear all if Port=4)."NEWLINE,
/*    */  "hwdumptx     DumpFlag                               -- Start/Stop dumpping transmit packet data."NEWLINE,
/*    */  "hwdumprx     DumpFlag                               -- Start/Stop dumpping receive packet data."NEWLINE,
/*    */  "hwreset      TimeOut                                -- Reset the device."NEWLINE,
#ifdef DEF_KS8842
/*    */  "hwrepeat     Flag                                   -- Enable/Disable Repeater mode (1 - Enable, 0 - Disable)."NEWLINE,
#endif /* #ifdef DEF_KS8842 */
#ifdef DEF_KS8841
#ifdef KS_ISA_BUS
/*    */  "hwrxthres    FData                                  -- Set Early Receive Threshold (in unit of 64-byte)."NEWLINE,
/*    */  "hwtxthres    FData                                  -- Set Early Transmit Threshold (in unit of 64-byte)."NEWLINE,
/*    */  "hwearly      Flag                                   -- Enable/Disable Early Transmit/Receive (1 - Enable, 0 - Disable)."NEWLINE,
#endif /* #ifdef KS_ISA_BUS */
#endif /* #ifdef DEF_KS8841 */
/*    */  "hwmagic                                             -- Enable Wake-on-LAN by receiving magic packet."NEWLINE,
/*    */  "hwwolframe   FrameNum  CRC  ByteMask                -- Enable Wake-on-LAN by receiving wake-up frame (FrameNum:0~3, ByteMask:0~63)."NEWLINE,
/*    */  "hwclearpme                                          -- Clear PME_Staus to deassert PMEN pin."NEWLINE,
#ifdef KS_PCI_BUS
/*    */  "hwpciread    BusNum DevNum FuncNum RegNum           -- Read PCI Configuration Space register."NEWLINE,
/*    */  "hwpciwrite   BusNum DevNum FuncNum RegNum RegData   -- Modify PCI Configuration Space register."NEWLINE,
#endif /* #ifdef KS_PCI_BUS */
/*    */  "hwtestcable  Port                                   -- Ethernet cable diagnostics."NEWLINE,
/*    */  "hwgetlink    Port                                   -- Get Link status."NEWLINE,
/*    */  "hwsetlink    Port  Data                             -- Set Link speed."NEWLINE,
/*    */  "hwgetmac                                            -- Get device MAC address."NEWLINE,
/*    */  "hwgetip                                             -- Get device IP address."NEWLINE,
/*    */  "hwgettxcnt1                                         -- Get driver port 1 total transmit packets counters."NEWLINE,
/*    */  "hwgettxcnt2                                         -- Get driver port 2 total transmit packets counters."NEWLINE,
/*    */  "hwgetrxcnt1                                         -- Get driver port 1 total received packets counters."NEWLINE,
/*    */  "hwgetrxcnt2                                         -- Get driver port 2 total received packets counters."NEWLINE,
/*    */  "hwtxarp      Port  Repeat  MAC  IP                  -- Tx ARP request packet to ks884X."NEWLINE,
#ifdef KS_QC_TEST
/*    */  "qctxtest     Port  Repeat                           -- QC Tx fix packets from debug buffers to ks884X."NEWLINE,
/*    */  "qcgetmib     Port  MibIndex                         -- QC Get device port MIB counter."NEWLINE,
/*    */  "qcgetcable   Port                                   -- QC Get device port LinkMD cable status."NEWLINE,
/*    */  "qcecho       Flag                                   -- Enable/Disable echo received character to screen (1-Enable, 0-Disable)."NEWLINE,
#endif
#else  /* vxWorks Shell command */
/*    */  "hwhelp                                              -- Display help message."NEWLINE,
/*    */  "hwread       BankNum, RegNum,   Width               -- Read ks884X register."NEWLINE,
/*    */  "hwwrite      BankNum, RegNum,   RegData,  Width     -- Modify ks884X register."NEWLINE,
/*    */  "hwpoll       BankNum, RegNum,BitMask,BitPat,TimeOut -- Poll register bit if it match bit pattern."NEWLINE,
/*    */  "hwbufread    BufNum,  BufOffset,Len                 -- Display contents of debug buffer."NEWLINE,
/*    */  "hwbufwrite   BufNum,  BufOffset,WData [...]         -- Write data to debug buffer (maximum length is 64)."NEWLINE,
/*    */  "hwbuffill    BufNum,  BufOffset,FData, BufInc, Len  -- Fill data to debug buffer."NEWLINE,
/*    */  "hwbuftx      Port,BufNum,Len,Repeat,SameBuf,Delay   -- Tx packet from debug buffer to ks884X."NEWLINE,
/*    */  "hwbufrx      BufNum,  TimeOut                       -- Rx packet from ks884X and store in debug buffer(start at BufNum)."NEWLINE,
/*    */  "hwtableread  Table,Index,  Count                    -- Read ks884X table data register."NEWLINE,
/*    */  "hwtablewrite Table,Index,  RegDataH, RegDataL       -- Write ks884X table data register. "NEWLINE,
/*    */  "hwtableshow  Table,Index,  Count, 1                 -- Show ks884X table."NEWLINE,
/*    */  "hwclearmib   Port                                   -- Clear software MIB counter database (clear all if Port=4)."NEWLINE,
/*    */  "hwdumptx     DumpFlag                               -- Start/Stop dumpping transmit packet data."NEWLINE,
/*    */  "hwdumprx     DumpFlag                               -- Start/Stop dumpping receive packet data."NEWLINE,
/*    */  "hwloopback   Flag                                   -- Start/Stop loopback received packet data to transmit."NEWLINE,
/*    */  "hwreset      TimeOut                                -- Reset the device."NEWLINE,
#ifdef DEF_KS8842
/*    */  "hwrepeat     Flag                                   -- Enable/Disable Repeater mode (1 - Enable, 0 - Disable)."NEWLINE,
#endif /* #ifdef DEF_KS8842 */
#ifdef DEF_KS8841
#ifdef KS_ISA_BUS
/*    */  "hwrxthres    FData                                  -- Set Early Receive Threshold (in unit of 64-byte)."NEWLINE,
/*    */  "hwtxthres    FData                                  -- Set Early Transmit Threshold (in unit of 64-byte)."NEWLINE,
/*    */  "hwearly      Flag                                   -- Enable/Disable Early Transmit/Receive (1 - Enable, 0 - Disable)."NEWLINE,
#endif /* #ifdef KS_ISA_BUS */
#endif /* #ifdef DEF_KS8841 */
/*    */  "hwmagic                                             -- Enable Wake-on-LAN by receiving magic packet."NEWLINE,
/*    */  "hwwolframe   FrameNum, CRC, ByteMask                -- Enable Wake-on-LAN by receiving wake-up frame (FrameNum:0~3, ByteMask:0~63)."NEWLINE,
/*    */  "hwclearpme                                          -- Clear PME_Staus to deassert PMEN pin."NEWLINE,
#ifdef KS_PCI_BUS
/*    */  "hwpciread    BusNum,DevNum,FuncNum,RegNum           -- Read PCI Configuration Space register."NEWLINE,
/*    */  "hwpciwrite   BusNum,DevNum,FuncNum,RegNum, RegData  -- Modify PCI Configuration Space register."NEWLINE,
#endif /* #ifdef KS_PCI_BUS */
/*    */  "hwtestcable  Port                                   -- Ethernet cable diagnostics."NEWLINE,
/*    */  "hwgetlink    Port                                   -- Get Link status."NEWLINE,
/*    */  "hwsetlink    Port, Data                             -- Set Link speed."NEWLINE,
/*    */  "hwgetmac                                            -- Get device MAC address."NEWLINE,
/*    */  "hwgetip                                             -- Get device IP address."NEWLINE,
/*    */  "hwgettxcnt1                                         -- Get driver port 1 total transmit packets counters."NEWLINE,
/*    */  "hwgettxcnt2                                         -- Get driver port 2 total transmit packets counters."NEWLINE,
/*    */  "hwgetrxcnt1                                         -- Get driver port 1 total received packets counters."NEWLINE,
/*    */  "hwgetrxcnt2                                         -- Get driver port 2 total received packets counters."NEWLINE,
/*    */  "hwtxarp      Port, Repeat, MAC, IP                  -- Tx ARP request packet to ks884X."NEWLINE,
#ifdef KS_QC_TEST
/*    */  "qctxtest     Port, Repeat                           -- QC Tx fix packets from debug buffers to ks884X."NEWLINE,
/*    */  "qcgetmib     Port, MibIndex                         -- QC Get device port MIB counter."NEWLINE,
/*    */  "qcgetcable   Port                                   -- QC Get device port LinkMD cable status."NEWLINE,
/*    */  "qcecho       Flag                                   -- Enable/Disable echo received character to screen (1-Enable, 0-Disable)."NEWLINE,
#endif

#endif /* #ifdef SEPARATE_CLI_ARGV_BYSPACE */
	      ""
};


const char * fdbStatusStr[] =
{
/*  0 */  "valid    ",
/*  1 */  "invalid  ",
/*  2 */  "learned  ",
/*  3 */  "static   ",
	      ""
};

#ifdef M16C_62P

extern PHARDWARE  phw;

extern UINT8  eth_pkt_hdr_rx_buf[];
extern UINT8  eth_pkt_rx_buf[];
extern struct ethernet_frame received_frame;
extern UINT8  fEcho;	        /* TRUE to echo received character to screen, FALSE, otherwise. */

extern char FAR * strtok_p(char FAR *, const char FAR *, char FAR **);
extern UINT8  ksSendFrame ( UINT8 *, UINT16, ULONG );
extern void wol_lcd_off ();

#endif /* #ifdef M16C_62P */

#ifdef _EZ80L92

extern PHARDWARE  phw;

extern SYSCALL send_packet ( EMACFRAME *, int );
extern UINT8  ksSendFrame ( UINT8 *, UINT16 );
extern SYSCALL ksPollReceive ( EMACFRAME * );
extern SYSCALL ksPollStart ( void );
extern SYSCALL ksPollStop ( void );

#endif /* #ifdef _EZ80L92 */

#ifdef DEF_VXWORKS

extern int	 consoleFd;		/* fd of initial console device */
extern char    ksIpAddress[];

#endif /* #ifdef DEF_VXWORKS */


#if defined( _WIN32 )  ||  defined( DEF_LINUX )  ||  defined( KS_ARM )
extern PHARDWARE phw;

#define UINT8  unsigned char
#endif

#if defined( KS_ARM )
#include "util.h"
#endif


#ifdef KS_ISA_BUS
extern void  SwitchReadTableAllword_ISA(PHARDWARE, int, USHORT, PUSHORT, PULONG, PULONG );
extern void  SwitchWriteTableQword_ISA (PHARDWARE, int, USHORT, ULONG,  ULONG );
#else
extern void  SwitchReadTableAllword_PCI(PHARDWARE, int, USHORT, PUSHORT, PULONG, PULONG );
extern void  SwitchWriteTableQword_PCI (PHARDWARE, int, USHORT, ULONG,  ULONG );
#endif



/* externally visible functions. */
int   hwhelp ( void );
int   hwread ( unsigned char, unsigned long, unsigned char );
int   hwwrite ( unsigned char, unsigned long, unsigned long, unsigned char );
int   hwpoll ( unsigned char, unsigned long, unsigned long, unsigned long, unsigned long );
int   hwbufread ( unsigned long, unsigned long, unsigned long );
int   hwbufwrite ( unsigned long, unsigned long, unsigned char FAR * );
int   hwbuffill ( unsigned char, unsigned long, unsigned long, unsigned long, unsigned long );
int   hwbuftx ( unsigned long, unsigned long, unsigned long, unsigned long, BOOLEAN, unsigned long );
int   hwbufrx ( unsigned long, unsigned long );
int   hwtableread ( char FAR *, unsigned long, unsigned long );
int   hwtablewrite ( char FAR *, unsigned long, unsigned long, unsigned long );
int   hwtableshow ( char FAR *, unsigned long, unsigned long, BOOLEAN );
int   hwclearmib ( unsigned long );
int   hwdumptx ( unsigned long );
int   hwdumprx ( unsigned long );
int   hwloopback ( unsigned long );
int   hwrepeat ( unsigned long );
int   hwreset ( unsigned long );
int   hwtestcable ( unsigned long );
int   hwgetlink ( unsigned long );
int   hwsetlink ( unsigned long, unsigned long );
int   hwgetmac ( void );
int   hwgetip ( void );
int   hwgettxcnt1 ( void );
int   hwgettxcnt2 ( void );
int   hwgetrxcnt1 ( void );
int   hwgetrxcnt2 ( void );
int   hwtxarp ( unsigned long, unsigned long, unsigned char FAR *, unsigned char FAR * );
int   hwrxthres ( unsigned long );
int   hwtxthres ( unsigned long );
int   hwearly ( unsigned long );
int   hwmagic ( void );
int   hwwolframe ( unsigned long, unsigned long, unsigned char );
int   hwclearpme ( void );

int   hwpciread ( unsigned long, unsigned long, unsigned long, unsigned long );
int   hwpciwrite( unsigned long, unsigned long, unsigned long, unsigned long, unsigned long );


/* this section are for FAB QC testing only */

#ifdef KS_QC_TEST

int   qctxtest ( unsigned long, unsigned long );
int   qcgetmib ( unsigned long, unsigned long );
int   qcgetcable ( unsigned long );
int   qcecho ( unsigned long );

#endif


void  usagDisplay ( unsigned short );
void  unknownDisplay ( void );

/* local functions. */
static void  DisplayErrRetMsg( unsigned long );
static unsigned char isValidBank ( unsigned long );
static unsigned char isValidRegAddr ( unsigned long );
static unsigned char BufferInit ( void );
static void  formatPortToStr ( unsigned char, unsigned char, char * );
static int   TableNameXlat ( char FAR *, unsigned long * );
static void  strToMac ( unsigned char FAR *, unsigned char FAR * );
static void  strToIp ( unsigned char FAR *, unsigned char FAR * );
static void  macDisplayTitle ( unsigned long );
static void  showMibTable ( PHARDWARE );
static void  showTableEntry (unsigned long,
                             unsigned long,
                             unsigned char,
                             unsigned short,
                             unsigned char *,
                             unsigned char,
                             BOOLEAN,
                             BOOLEAN,
                             unsigned char,
                             unsigned long );
#ifdef DEF_VXWORKS
static void  hwbuftx_vxWorks ( unsigned long, unsigned long, unsigned long, unsigned long, BOOLEAN, unsigned long );
static unsigned long hwbufrx_vxWorks ( unsigned long, long );
#endif /* DEF_VXWORKS */

#ifdef M16C_62P
static void  hwbuftx_M16C ( unsigned long, unsigned long, unsigned long, unsigned long, BOOLEAN, unsigned long );
static unsigned long hwbuftr_M16C ( unsigned long, long );
#endif /* M16C_62P */

#ifdef _EZ80L92
static void  hwbuftx_EZ80L92 ( unsigned long, unsigned long, unsigned long, unsigned long, BOOLEAN, unsigned long );
static unsigned long hwbufrx_EZ80L92 ( unsigned long, long );
#endif /* _EZ80L92 */




/*****************************************************************/

/*****************************************************************
*
* Command: hwhelp
*
* Format: "hwhelp "
*
******************************************************************/
int hwhelp
(
)
{
   int i=0;
   char FAR ** pbMsg = (char FAR **)hwHelpMsgStr;


   while (*pbMsg[i])
      DBG_PRINT( "%s", (char FAR *)pbMsg[i++] );

   DBG_PRINT( NEWLINE );

   return (TRUE);
}

int hwread2
(
   unsigned char   BankNum,
   unsigned long   RegAddr,
   unsigned char   Width
)
{
#ifdef DEF_VXWORKS

⌨️ 快捷键说明

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