1 /** @file
2 
3   Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
4 
5   This program and the accompanying materials
6   are licensed and made available under the terms and conditions of the BSD License
7   which accompanies this distribution.  The full text of the license may be found at
8   http://opensource.org/licenses/bsd-license.php
9 
10   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 
16 #ifndef __EBL_ADD_COMMAND_H__
17 #define __EBL_ADD_COMMAND_H__
18 
19 
20 
21 //
22 // Protocol GUID
23 //
24 // AEDA2428-9A22-4637-9B21-545E28FBB829
25 
26 #define EBL_ADD_COMMAND_PROTOCOL_GUID \
27   { 0xaeda2428, 0x9a22, 0x4637, { 0x9b, 0x21, 0x54, 0x5e, 0x28, 0xfb, 0xb8, 0x29 } }
28 
29 
30 typedef struct _EBL_ADD_COMMAND_PROTOCOL  EBL_ADD_COMMAND_PROTOCOL;
31 
32 typedef
33 EFI_STATUS
34 (EFIAPI *EBL_COMMMAND) (
35   IN UINTN  Argc,
36   IN CHAR8  **Argv
37   );
38 
39 typedef struct {
40   CHAR8           *Name;
41   CHAR8           *HelpSummary;
42   CHAR8           *Help;
43   EBL_COMMMAND    Command;
44 } EBL_COMMAND_TABLE;
45 
46 
47 /**
48   Add a single command table entry.
49 
50   @param EntryArray     Pointer EBL_COMMAND_TABLE of the command that is being added
51 
52 **/
53 typedef
54 VOID
55 (EFIAPI *EBL_ADD_COMMAND) (
56   IN const EBL_COMMAND_TABLE   *Entry
57   );
58 
59 
60 /**
61   Add a multiple command table entry.
62 
63   @param EntryArray     Pointer EBL_COMMAND_TABLE of the commands that are being added
64 
65   @param ArrayCount     Number of commands in the EntryArray.
66 
67 **/
68 typedef
69 VOID
70 (EFIAPI *EBL_ADD_COMMANDS) (
71   IN const EBL_COMMAND_TABLE   *EntryArray,
72   IN UINTN                     ArrayCount
73   );
74 
75 
76 typedef
77 VOID
78 (EFIAPI *EBL_GET_CHAR_CALL_BACK) (
79   IN  UINTN   ElapsedTime
80   );
81 
82 /**
83   Return a keypress or optionally timeout if a timeout value was passed in.
84   An optional callback function is called every second when waiting for a
85   timeout.
86 
87   @param  Key           EFI Key information returned
88   @param  TimeoutInSec  Number of seconds to wait to timeout
89   @param  CallBack      Callback called every second during the timeout wait
90 
91   @return EFI_SUCCESS  Key was returned
92   @return EFI_TIMEOUT  If the TimoutInSec expired
93 
94 **/
95 typedef
96 EFI_STATUS
97 (EFIAPI *EBL_GET_CHAR_KEY) (
98   IN OUT EFI_INPUT_KEY            *Key,
99   IN     UINTN                    TimeoutInSec,
100   IN     EBL_GET_CHAR_CALL_BACK   CallBack   OPTIONAL
101   );
102 
103 
104 /**
105   This routine is used prevent command output data from scrolling off the end
106   of the screen. The global gPageBreak is used to turn on or off this feature.
107   If the CurrentRow is near the end of the screen pause and print out a prompt
108   If the use hits Q to quit return TRUE else for any other key return FALSE.
109   PrefixNewline is used to figure out if a newline is needed before the prompt
110   string. This depends on the last print done before calling this function.
111   CurrentRow is updated by one on a call or set back to zero if a prompt is
112   needed.
113 
114   @param  CurrentRow  Used to figure out if its the end of the page and updated
115   @param  PrefixNewline  Did previous print issue a newline
116 
117   @return TRUE if Q was hit to quit, FALSE in all other cases.
118 
119 **/
120 typedef
121 BOOLEAN
122 (EFIAPI *EBL_ANY_KEY_CONTINUE_Q_QUIT) (
123   IN  UINTN   *CurrentRow,
124   IN  BOOLEAN PrefixNewline
125   );
126 
127 
128 
129 struct _EBL_ADD_COMMAND_PROTOCOL {
130   EBL_ADD_COMMAND     AddCommand;
131   EBL_ADD_COMMANDS    AddCommands;
132 
133   // Commands to reuse EBL infrastructure
134   EBL_GET_CHAR_KEY            EblGetCharKey;
135   EBL_ANY_KEY_CONTINUE_Q_QUIT EblAnyKeyToContinueQtoQuit;
136 };
137 
138 extern EFI_GUID gEfiEblAddCommandProtocolGuid;
139 
140 #endif
141 
142 
143