/****************************************************************************
**
**  Name:  CPUCLI.H
**
**  Description:
**      CLI entry point prototypes.
**
**  Status:  PRELIMINARY
**
**  $Log:   S:/tbird/arcppc/cpu/cpucli.h_v  $
** 
**    Rev 1.6   02 Jul 1997 13:22:52   cjchen
** 
**    Rev 1.5   02 Jul 1997 11:21:40   cjchen
** add usedFlag to REGISTER_ENTRY structure
** 
**    Rev 1.4   18 Mar 1997 15:33:30   kevin
** moved RC definition to cpurc.h
** 
**    Rev 1.3   11 Mar 1997 18:03:18   kevin
** modified parameters of getstockregnames()
** 
**    Rev 1.2   11 Mar 1997 09:34:12   kevin
** added GetStockRegisterNames()
** 
**    Rev 1.1   11 Feb 1997 11:37:14   kevin
** PowerPC
** 
**    Rev 1.0   17 Jan 1997 09:12:08   kevin
** Initial revision.
** 
**    Rev 1.0   03 Jun 1996 11:16:48   gene
** Initial revision.
** 
**    Rev 1.0   07 Sep 1995 10:10:40   gene
** Initial revision.
** 
**    Rev 1.6   25 Jun 1993 14:59:52   mindy
** 
**    Rev 1.5   17 Jun 1993 15:39:14   mindy
** Added register pair typedef
** 
**    Rev 1.4   30 Mar 1993 08:27:02   ernie
** 1. Added prototype for BuildTables() and InitCpuServer().
** 2. Removed unused defines.
** 3. General cleanup.
** 
**    Rev 1.3   14 Jul 1992 11:34:06   courtney
** Defines for processor tables.
** 
**    Rev 1.3   18 May 1992 08:47:38   mindy
** had to bump timeout value WAY to prevent timeout
** 
**    Rev 1.2   13 May 1992 09:04:36   nghia
** Added SendMessageToCli() for global reference.
** 
**    Rev 1.1   17 Apr 1992 16:21:56   nghia
** Added include from BKPTEXEC library for GetEmulationStatus().
** 
**    Rev 1.0   28 Feb 1992 12:05:26   nghia
** Initial revision.
**
**  $Header:   S:/tbird/arcppc/cpu/cpucli.h_v   1.6   02 Jul 1997 13:22:52   cjchen  $
**
**  Copyright (C) 1991-2 Microtek International.  All rights reserved.
**
*****************************************************************************/
#define _CPUCLI_

                       /****************************
                        *                          *
                        *       INCLUDE FILES      *
                        *                          *
                        ****************************/
#ifndef _BASEWIND_
#include "basewind.h"
#endif
#ifndef _CPU_
#include "cpu.h"
#endif
                       /****************************
                        *                          *
                        *        DEFINITIONS       *
                        *                          *
                        ****************************/
typedef struct {
   S8   assertedChar;
   S8   negatedChar;
   BOOLEAN displayAsChar;
   U32  mask;
   U16  shift;
} FLAG_TABLE;

/* Register Table Entry */
typedef struct {
   S8 regName[MAX_REGNAME];        /* name of register */
   U8 regWidth;        /* number of bit in register */
   U8 fwRegOrder;
   U8 numberOfFlags;   /* 0 indicates display in numeric format */
   U8 presenterLine;
   FLAG_TABLE *flagTable;
   U8 usedFlag;
//   DESCRIPTOR  sdDesc;          /* sharedata descriptor */
} REGISTER_ENTRY;

typedef S8 REGNAME[MAX_REGNAME];        /* name of register */

/* Register Table for SelReg dialog box */
typedef struct {
   S8 regName[MAX_REGNAME];        /* name of register */
   S8 allInfo[MAX_REGNAME+15];
   S16 order;
} STOCK_REGISTER;

typedef struct {
   S16 regId;
   S16 order;
} VIEW_REGISTER;

typedef struct {
   S8          signalName[MAX_SIGNAME];     /* signal name */
   DESCRIPTOR  sdDesc;          /* signal descriptor */
} SIGNAL_ENTRY;

/* Register Pair Table Entry */
typedef REG_ID REGISTER_PAIR_ENTRY[2];

                       /****************************
                        *                          *
                        *        PROTOTYPES        *
                        *                          *
                        ****************************/
#ifdef __cplusplus
extern "C" {
#endif

/**************************************************************************
**
** InitCServer
**
** Description: Initialize the commands for the Cpu Server.
**
** Parameters:
**    input:
**       cliHandle:  CLI Server Handle
**       dllHandle:  DLL Handle.
**
**    output:
**       return a 1 to indicate success
**
***************************************************************************/
RETCODE EXPORT InitCServer(HANDLE cliHandle, HANDLE dllHandle) ;


/***************************************************************************
**
**  CpuCliRegister
**
**  Status:  PRELIMINARY
**
**  description:
**     Cli interface to the register display, modify, init, enable/disable
**     group.
**
**
**  input:
**     <none>
**
**  output:
**     message:
**        register value(get register).
**     <none> : register modify, init.
**
*****************************************************************************/
RETCODE EXPORT  CpuCliRegister(LPSTR cmdString, U32 argc, U32 argv[]) ;

/***************************************************************************
**
**  CpuCliSignals
**
**  Status:  PRELIMINARY
**
**  description:
**     Cli interface to the signals display
**
**  input:
**     <none>
**
**  output:
**     message:
**        signals value(get signals).
**     <none> : signals modify
**
*****************************************************************************/
RETCODE EXPORT  CpuCliSignal(LPSTR cmdString, U32 argc, U32 argv[]) ;

/***************************************************************************
**
**  CpuCliResetCPU
**
**  Status:  PRELIMINARY
**
**  description:
**     Cli interface to reset the CPU
**
**  input:
**     none.
**
**  output:
**     none.
**
*****************************************************************************/
RETCODE EXPORT  CpuCliResetCPU(LPSTR cmdString, U32 argc, U32 argv[]);

/***************************************************************************
**
**  CpuCliFindRegName
**
**  Status:  PRELIMINARY
**
**  description:
**     Cli interface to find a register name by it numeric id.
**
**  input:
**     none.
**
**  output:
**     none.
**
*****************************************************************************/
RETCODE EXPORT  CpuCliFindRegName(LPSTR cmdString, U32 argc, U32 argv[]);

/****************************************************************************
**
**  SendMessageToCli.
**
**  Status:  TESTED
**
**  Description:
**     Send a text message to the CLI server.
**
**  Parameters:
**     input:
**        msgPtr        Message to be sent
**     output:
**        none
**
*****************************************************************************/
RETCODE SendMessageToCli(LPSTR msgPtr);

/****************************************************************************
**
**  BuildTables
**
**  Description:
**     Initialize register and signal description tables from config file
**
**  Parameters:
**        none
**
*****************************************************************************/
RETCODE EXPORT BuildTables(BOOL bRebuild);

/****************************************************************************
**
**  InitCpuServer
**
**  Description:
**     Initialize cpu server (other than cli-related stuff)
**
**  Parameters:
**        none
**
*****************************************************************************/
RETCODE EXPORT InitCpuServer(VOID);

/****************************************************************************
**
**  GetStockRegNames
**
**  Description:
**     Get names of all stock registers
**
**  Parameters:
**        number of stock registers
**
*****************************************************************************/
RETCODE GetStockRegNames(U16* uNumReg);

#ifdef __cplusplus
}
#endif

/******************************** E O F ***********************************/
