/** @file
Main file for SerMode shell Debug1 function.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include "UefiShellDebug1CommandsLib.h"
#include <Library/ShellLib.h>
#include <Protocol/SerialIo.h>
/**
Display information about a serial device by it's handle.
If HandleValid is FALSE, do all devices.
@param[in] HandleIdx The handle index for the device.
@param[in] HandleValid TRUE if HandleIdx is valid.
@retval SHELL_INVALID_PARAMETER A parameter was invalid.
@retval SHELL_SUCCESS The operation was successful.
**/
)
{
Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles);
return SHELL_INVALID_PARAMETER;
}
if (HandleValid) {
continue;
}
}
case DefaultParity:
Parity = 'D';
break;
case NoParity:
Parity = 'N';
break;
case EvenParity:
Parity = 'E';
break;
case OddParity:
Parity = 'O';
break;
case MarkParity:
Parity = 'M';
break;
case SpaceParity:
Parity = 'S';
break;
default:
Parity = 'U';
}
case DefaultStopBits:
StopBits = L"Default";
break;
case OneStopBit:
StopBits = L"1";
break;
case TwoStopBits:
StopBits = L"2";
break;
case OneFiveStopBits:
StopBits = L"1.5";
break;
default:
StopBits = L"Unknown";
}
-1,
-1,
NULL,
);
} else {
break;
}
if (HandleValid) {
break;
}
}
}
}
return ShellStatus;
}
/**
Function for 'sermode' command.
@param[in] ImageHandle Handle to the Image (NULL if Internal).
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
**/
)
{
HandleIdx = 0;
NoHandles = 0;
Index = 0;
} else {
}
} else {
} else {
goto Done;
}
} else {
goto Done;
}
} else {
BaudRate = 0;
}
} else {
switch(Temp[0]){
case 'd':
case 'D':
break;
case 'n':
case 'N':
break;
case 'e':
case 'E':
Parity = EvenParity;
break;
case 'o':
case 'O':
break;
case 'm':
case 'M':
Parity = MarkParity;
break;
case 's':
case 'S':
break;
default:
goto Done;
}
}
} else {
//
// make sure this is some number not in the list below.
//
DataBits = 0;
}
switch (DataBits) {
case 4:
case 7:
case 8:
break;
default:
goto Done;
}
switch (Value) {
case 0:
break;
case 1:
break;
case 2:
break;
case 15:
break;
default:
goto Done;
}
Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles);
goto Done;
}
continue;
}
);
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_FAIL), gShellDebug1HiiHandle, ConvertHandleToHandleIndex(Handles[Index]), Status);
} else {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_HANDLE), gShellDebug1HiiHandle, ConvertHandleToHandleIndex(Handles[Index]));
}
break;
}
}
}
}
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_BAD_HANDLE), gShellDebug1HiiHandle, HandleIdx);
}
Done:
}
}
return ShellStatus;
}