📄 shell_api.h
字号:
/************************************************************************
*
* shell_api.h
*
* Shell module definitions
*
* The user may choose to define the following symbols
*
*
* ######################################################################
*
* Copyright (c) 1999-2000 MIPS Technologies, Inc. All rights reserved.
*
* Unpublished rights reserved under the Copyright Laws of the United States of
* America.
*
* This document contains information that is proprietary to MIPS Technologies,
* Inc. ("MIPS Technologies"). Any copying, modifying or use of this information
* (in whole or in part) which is not expressly permitted in writing by MIPS
* Technologies or a contractually-authorized third party is strictly
* prohibited. At a minimum, this information is protected under unfair
* competition laws and the expression of the information contained herein is
* protected under federal copyright laws. Violations thereof may result in
* criminal penalties and fines.
* MIPS Technologies or any contractually-authorized third party reserves the
* right to change the information contained in this document to improve
* function, design or otherwise. MIPS Technologies does not assume any
* liability arising out of the application or use of this information. Any
* license under patent rights or any other intellectual property rights owned
* by MIPS Technologies or third parties shall be conveyed by MIPS Technologies
* or any contractually-authorized third party in a separate license agreement
* between the parties.
* The information contained in this document constitutes one or more of the
* following: commercial computer software, commercial computer software
* documentation or other commercial items. If the user of this information, or
* any related documentation of any kind, including related technical data or
* manuals, is an agency, department, or other entity of the United States
* government ("Government"), the use, duplication, reproduction, release,
* modification, disclosure, or transfer of this information, or any related
* documentation of any kind, is restricted in accordance with Federal
* Acquisition Regulation 12.212 for civilian agencies and Defense Federal
* Acquisition Regulation Supplement 227.7202 for military agencies. The use of
* this information by the Government is further restricted in accordance with
* the terms of the license agreement(s) and/or applicable contract terms and
* conditions covering this information from MIPS Technologies or any
* contractually-authorized third party.
*
************************************************************************/
#ifndef SHELL_API_H
#define SHELL_API_H
#ifndef _ASSEMBLER_
/************************************************************************
* Include files
************************************************************************/
#include <sysdefs.h>
#include <syserror.h>
#include <excep_api.h>
#include <syscon_api.h>
/************************************************************************
* Definitions
*************************************************************************/
#define DEFAULT_PROMPT "YAMON"
/* Monitor maximum lines per screen and maximum chars per line */
#define MON_DEF_LINEMAX 24
#define MON_DEF_LINEWIDTH 79
/* Shell command definitions */
#define MON_FUNC( name ) UINT32 name(UINT32 argc, char **argv)
typedef UINT32 (*t_func)(UINT32 argc, char **argv);
typedef struct
{
char *option; /* Name of option */
char *descr; /* Description of option */
}
t_cmd_option;
typedef struct
{
char *name; /* Name of commands */
t_func func; /* Function implementing cmd */
char *syntax; /* Syntax of command */
char *descr; /* Detailed description of cmd */
t_cmd_option *options; /* Command options */
UINT32 option_count; /* Number of options */
bool secret; /* if TRUE, help will ignore */
}
t_cmd;
#define SHELL_PUTS( s ) shell_puts( s, 0 )
#define SHELL_PUTS_INDENT( s, indent ) shell_puts( s, indent )
#define SHELL_PUTC( c ) shell_putc( c, 0 )
#define SHELL_PUTC_INDENT( c, indent ) shell_putc( c, indent )
#define SHELL_DISABLE_MORE shell_setmore( FALSE )
#define SHELL_ENABLE_MORE shell_setmore( TRUE )
/* Error codes */
typedef enum shell_error_ids
{
SHELL_ERROR_SYNTAX = ERROR_SHELL,
SHELL_ERROR_OPTION,
SHELL_ERROR_PARSE_UNKNOWN_ENV,
SHELL_ERROR_PARSE_MISSING_QUOTE,
SHELL_ERROR_PARSE_ARGCOUNT,
SHELL_ERROR_PARSE_LONG_TOKEN,
SHELL_ERROR_PARSE_LONG_LINE,
SHELL_ERROR_PARSE_LONG_ENV,
SHELL_ERROR_ALIGN,
SHELL_ERROR_TLB,
SHELL_ERROR_TLB_WP,
SHELL_ERROR_TLB_INDEX,
SHELL_ERROR_TLB_PAGESIZE,
SHELL_ERROR_TLB_ASID,
SHELL_ERROR_TLB_GLOBAL,
SHELL_ERROR_TLB_C,
SHELL_ERROR_TLB_D,
SHELL_ERROR_TLB_V,
SHELL_ERROR_OVERFLOW,
SHELL_ERROR_COMMAND_NOT_FOUND,
SHELL_ERROR_NOT_FOUND,
SHELL_ERROR_AMBIVALENT,
SHELL_ERROR_ARGV,
SHELL_ERROR_FAILED,
SHELL_ERROR_ADDRESS,
SHELL_ERROR_ADDRESS_UNKNOWN,
SHELL_ERROR_RAM_RANGE,
SHELL_ERROR_LOAD,
SHELL_ERROR_BOOTPROT,
SHELL_ERROR_PORT,
SHELL_ERROR_IP,
SHELL_ERROR_FILENAME,
SHELL_ERROR_VAR_FLASH,
SHELL_ERROR_VAR_VALUE,
SHELL_ERROR_DATA_WIDTH,
SHELL_ERROR_UNKNOWN_CP0_REG,
SHELL_ERROR_RO_CP0_REG,
SHELL_ERROR_ILLEGAL_CACHE_CFG,
SHELL_ERROR_BAUDRATE,
SHELL_ERROR_CONTROL_C_DETECTED,
SHELL_ERROR_STRUCTURE,
SHELL_ERROR_ILLEGAL_MSG
} t_shell_error_ids;
/************************************************************************
* Public variables
************************************************************************/
/* If error code is returned to shell, this pointer may be set to a
* string describing the error and possibly a hint.
*/
extern char *shell_error_data;
extern char *shell_error_hint;
/************************************************************************
* Public functions
************************************************************************/
/************************************************************************
*
* shell_setup
* Description :
* -------------
*
* Register commands and start shell
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
shell_setup(void);
/************************************************************************
*
* shell_register_cmd
* Description :
* -------------
*
* Register a command for the shell (commands must be setup before
* starting shell)
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
shell_register_cmd(
t_cmd *cmd ); /* Command to be registered */
/************************************************************************
*
* shell_arch
* Description :
* -------------
*
* Platform specific setup of shell
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
shell_arch(void);
/************************************************************************
*
* shell_arch_dma
* Description :
* -------------
*
* Platform specific handling of DMA (enable/disable)
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
shell_arch_dma(
bool enable ); /* TRUE -> Enable DMA devices */
/************************************************************************
*
* shell_arch_info
* Description :
* -------------
*
* Platform specific decoding of REVISION register
*
* Return values :
* ---------------
*
* TRUE : No ctrl-c detected, FALSE : ctrl-c detected
*
************************************************************************/
bool
shell_arch_info(
UINT32 indent );
/************************************************************************
*
* shell_puts
* Description :
* -------------
*
* Print string to stdout
*
* Return values :
* ---------------
*
* TRUE -> Ctrl^C was pressed
*
************************************************************************/
bool
shell_puts(
char *string,
UINT32 indent );
/************************************************************************
*
* shell_putc
* Description :
* -------------
*
* Print char to stdout
*
* Return values :
* ---------------
*
* TRUE -> Ctrl^C was pressed
*
************************************************************************/
bool
shell_putc(
char ch,
UINT32 indent );
/************************************************************************
*
* shell_setmore
* Description :
* -------------
*
* Enable/disable 'more' control from shell_puts and shell_putc
*
* Return values :
* ---------------
*
* None
*
************************************************************************/
void
shell_setmore(
bool enable_more );
/************************************************************************
*
* shell_print_dot
* Description :
* -------------
*
* Print dot on screen
*
* Return values :
* ---------------
*
* void
*
************************************************************************/
bool
shell_print_dot(
UINT32 *count );
/***** Shell commands ****/
t_cmd *shell_scpu_init(bool cache, bool mmu);
t_cmd *shell_cache_init(void);
t_cmd *shell_cksum_init(void);
t_cmd *shell_compare_init(void);
t_cmd *shell_copy_init(void);
t_cmd *shell_cp0_init(void);
t_cmd *shell_date_init(void);
t_cmd *shell_dis_init(void);
t_cmd *shell_dump_init(void);
t_cmd *shell_dump_dot_init(void);
t_cmd *shell_dump_sdb_init(void);
t_cmd *shell_echo_init(void);
t_cmd *shell_edit_init(void);
t_cmd *shell_erase_init(void);
t_cmd *shell_erase_sdb_init(void);
t_cmd *shell_fill_init(void);
t_cmd *shell_flush_init(void);
t_cmd *shell_gdb_init(void);
t_cmd *shell_go_init(void);
t_cmd *shell_info_sdb_init(void);
t_cmd *shell_load_init(void);
t_cmd *shell_loaddata_init(void);
t_cmd *shell_load_sdb_init(void);
t_cmd *shell_off_init(void);
t_cmd *shell_pcicfg_init(void);
t_cmd *shell_ping_init(void);
t_cmd *shell_port_init(void);
t_cmd *shell_reset_init(void);
t_cmd *shell_search_init(void);
t_cmd *shell_setenv_init(void);
t_cmd *shell_sleep_init(void);
t_cmd *shell_stty_init(void);
t_cmd *shell_stty_sdb_init(void);
t_cmd *shell_test_init(void);
t_cmd *shell_test_sdb_init(void);
t_cmd *shell_tlb_init(void);
t_cmd *shell_unsetenv_init(void);
t_cmd *shell_ss_init(void);
/* Shell info command is special */
t_cmd *
shell_info_init(
bool pci, /* TRUE -> Board supports PCI */
bool isa, /* TRUE -> Board supports ISA bus */
bool lan, /* TRUE -> Board supports Ethernet */
bool eeprom ); /* TRUE -> Boards supports EEPROM */
/* Shell help command is special */
t_cmd *
shell_help_init(
t_cmd **cmd,
UINT32 cmd_count );
#endif /* #ifndef _ASSEMBLER_ */
/* Vector table address */
#define SHELL_VECTOR_ADDR 0x80001000
/* Shell table function codes */
#define SHELL_FUNC_EXIT_CODE 0
#define SHELL_FUNC_PRINT_COUNT_CODE 1
#define SHELL_FUNC_PRINT_CODE 2
#define SHELL_FUNC_FLUSH_CODE 3
#define SHELL_FUNC_REGISTER_CPU_ISR_CODE 4
#define SHELL_FUNC_DEREGISTER_CPU_ISR_CODE 5
#define SHELL_FUNC_REGISTER_IC_ISR_CODE 6
#define SHELL_FUNC_DEREGISTER_IC_ISR_CODE 7
#define SHELL_FUNC_REGISTER_ESR_CODE 8
#define SHELL_FUNC_DEREGISTER_ESR_CODE 9
#define SHELL_FUNC_GETCHAR_CODE 10
#define SHELL_FUNC_SYSCON_READ_CODE 11
#define SHELL_FUNC_COUNT (SHELL_FUNC_SYSCON_READ_CODE + 1)
#endif /* #ifndef SHELL_API_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -