2018-09-13 16:11:07 -07:00
|
|
|
/** @file
|
|
|
|
|
A minimal command-line shell.
|
|
|
|
|
|
2019-07-22 22:28:20 -07:00
|
|
|
Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
|
2019-06-12 18:01:09 -07:00
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
2018-09-13 16:11:07 -07:00
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
#ifndef _SHELLLIB_H_
|
|
|
|
|
#define _SHELLLIB_H_
|
|
|
|
|
|
|
|
|
|
#include <PiPei.h>
|
|
|
|
|
#include <Library/BaseLib.h>
|
|
|
|
|
|
|
|
|
|
#define MAX_COMMAND_LINE_LEN 256
|
|
|
|
|
|
|
|
|
|
typedef struct _SHELL SHELL;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
struct _SHELL {
|
|
|
|
|
BOOLEAN ShouldExit;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Begin a run-time interactive shell.
|
|
|
|
|
|
|
|
|
|
@param[in] Commands command list (may be NULL for default commands)
|
|
|
|
|
@param[in] Timeout seconds to wait for input before returning (0 for no timeout)
|
|
|
|
|
|
|
|
|
|
@retval EFI_SUCCESS
|
|
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
EFI_STATUS
|
|
|
|
|
EFIAPI
|
|
|
|
|
Shell (
|
|
|
|
|
IN CONST SHELL_COMMAND **Commands,
|
|
|
|
|
IN UINTN Timeout
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
Prints a message to the serial port.
|
|
|
|
|
|
|
|
|
|
If Format is NULL, then ASSERT().
|
|
|
|
|
|
|
|
|
|
@param Format Format string for the message to print.
|
|
|
|
|
@param ... Variable argument list whose contents are accessed
|
|
|
|
|
based on the format string specified by Format.
|
|
|
|
|
|
2018-10-25 15:09:40 -07:00
|
|
|
@retval Number of characters written
|
|
|
|
|
|
2018-09-13 16:11:07 -07:00
|
|
|
**/
|
2018-10-25 15:09:40 -07:00
|
|
|
UINTN
|
2018-09-13 16:11:07 -07:00
|
|
|
EFIAPI
|
|
|
|
|
ShellPrint (
|
|
|
|
|
IN CONST CHAR16 *Format,
|
|
|
|
|
...
|
|
|
|
|
);
|
|
|
|
|
|
2019-07-22 22:28:20 -07:00
|
|
|
/**
|
|
|
|
|
Register a Shell Command
|
2018-09-13 16:11:07 -07:00
|
|
|
|
2019-07-22 22:28:20 -07:00
|
|
|
@param[in] ShellCommand A Shell Command to be registered
|
2018-09-13 16:11:07 -07:00
|
|
|
|
2019-07-22 22:28:20 -07:00
|
|
|
@retval EFI_SUCCESS
|
|
|
|
|
@retval EFI_OUT_OF_RESOURCES
|
|
|
|
|
**/
|
|
|
|
|
EFI_STATUS
|
|
|
|
|
EFIAPI
|
|
|
|
|
ShellCommandRegister (
|
|
|
|
|
IN CONST SHELL_COMMAND *ShellCommand
|
|
|
|
|
);
|
2018-09-13 16:11:07 -07:00
|
|
|
|
|
|
|
|
#endif
|