2019-12-02 15:45:02 -08:00
|
|
|
/** @file
|
|
|
|
|
A minimal command-line shell.
|
|
|
|
|
|
2020-05-04 14:53:08 -07:00
|
|
|
Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
|
2019-12-02 15:45:02 -08:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
#ifndef _SHELLLIB_H_
|
|
|
|
|
#define _SHELLLIB_H_
|
|
|
|
|
|
|
|
|
|
#include <PiPei.h>
|
|
|
|
|
#include <Library/BaseLib.h>
|
2020-05-04 14:53:08 -07:00
|
|
|
#include <Library/ConsoleOutLib.h>
|
|
|
|
|
|
|
|
|
|
#define ShellPrint ConsolePrintUnicode
|
2019-12-02 15:45:02 -08:00
|
|
|
|
2019-12-17 15:55:19 -08:00
|
|
|
typedef struct {
|
|
|
|
|
LIST_ENTRY CommandEntryList;
|
|
|
|
|
CHAR16 *CommandLineHist;
|
|
|
|
|
INTN CommandLineIdx;
|
|
|
|
|
UINTN CommandLineMaxLen;
|
|
|
|
|
BOOLEAN ShouldExit;
|
|
|
|
|
} SHELL;
|
2019-12-02 15:45:02 -08:00
|
|
|
|
|
|
|
|
typedef EFI_STATUS (EFIAPI *SHELL_COMMAND_ENTRY_FUNC) (SHELL *Shell, UINTN Argc, CHAR16 *Argv[]);
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
CONST CHAR16 *Name;
|
|
|
|
|
CONST CHAR16 *Desc;
|
|
|
|
|
SHELL_COMMAND_ENTRY_FUNC Entry;
|
|
|
|
|
} SHELL_COMMAND;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Begin a run-time interactive shell.
|
|
|
|
|
|
|
|
|
|
@param[in] Timeout seconds to wait for input before returning (0 for no timeout)
|
|
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
EFI_STATUS
|
|
|
|
|
EFIAPI
|
|
|
|
|
Shell (
|
|
|
|
|
IN UINTN Timeout
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Register a Shell Command
|
|
|
|
|
|
2019-12-17 18:48:02 -08:00
|
|
|
@param[in] Shell Shell Context
|
2019-12-02 15:45:02 -08:00
|
|
|
@param[in] ShellCommand A Shell Command to be registered
|
|
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES
|
|
|
|
|
**/
|
|
|
|
|
EFI_STATUS
|
|
|
|
|
EFIAPI
|
|
|
|
|
ShellCommandRegister (
|
2019-12-17 18:48:02 -08:00
|
|
|
IN SHELL *Shell,
|
2019-12-02 15:45:02 -08:00
|
|
|
IN CONST SHELL_COMMAND *ShellCommand
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
#endif
|