mirror of https://github.com/acidanthera/audk.git
MdeModulePkg/DriverSampleDxe: Add a sample case
Add the sample case for orderedlist to get standard default value from Callback function. Cc: Liming Gao <liming.gao@intel.com> Cc: Eric Dong <eric.dong@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Eric Dong <eric.dong@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
parent
7f36d62918
commit
622ce64508
|
@ -68,6 +68,48 @@ HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath1 = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Set value of a data element in an Array by its Index.
|
||||||
|
|
||||||
|
@param Array The data array.
|
||||||
|
@param Type Type of the data in this array.
|
||||||
|
@param Index Zero based index for data in this array.
|
||||||
|
@param Value The value to be set.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
SetArrayData (
|
||||||
|
IN VOID *Array,
|
||||||
|
IN UINT8 Type,
|
||||||
|
IN UINTN Index,
|
||||||
|
IN UINT64 Value
|
||||||
|
)
|
||||||
|
{
|
||||||
|
|
||||||
|
ASSERT (Array != NULL);
|
||||||
|
|
||||||
|
switch (Type) {
|
||||||
|
case EFI_IFR_TYPE_NUM_SIZE_8:
|
||||||
|
*(((UINT8 *) Array) + Index) = (UINT8) Value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_IFR_TYPE_NUM_SIZE_16:
|
||||||
|
*(((UINT16 *) Array) + Index) = (UINT16) Value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_IFR_TYPE_NUM_SIZE_32:
|
||||||
|
*(((UINT32 *) Array) + Index) = (UINT32) Value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case EFI_IFR_TYPE_NUM_SIZE_64:
|
||||||
|
*(((UINT64 *) Array) + Index) = (UINT64) Value;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add empty function for event process function.
|
Add empty function for event process function.
|
||||||
|
|
||||||
|
@ -1283,7 +1325,9 @@ DriverCallback (
|
||||||
EFI_STRING Results;
|
EFI_STRING Results;
|
||||||
UINT32 ProgressErr;
|
UINT32 ProgressErr;
|
||||||
CHAR16 *TmpStr;
|
CHAR16 *TmpStr;
|
||||||
|
UINTN Index;
|
||||||
|
UINT64 BufferValue;
|
||||||
|
|
||||||
if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE))||
|
if (((Value == NULL) && (Action != EFI_BROWSER_ACTION_FORM_OPEN) && (Action != EFI_BROWSER_ACTION_FORM_CLOSE))||
|
||||||
(ActionRequest == NULL)) {
|
(ActionRequest == NULL)) {
|
||||||
return EFI_INVALID_PARAMETER;
|
return EFI_INVALID_PARAMETER;
|
||||||
|
@ -1293,6 +1337,7 @@ DriverCallback (
|
||||||
FormId = 0;
|
FormId = 0;
|
||||||
ProgressErr = 0;
|
ProgressErr = 0;
|
||||||
Status = EFI_SUCCESS;
|
Status = EFI_SUCCESS;
|
||||||
|
BufferValue = 3;
|
||||||
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
PrivateData = DRIVER_SAMPLE_PRIVATE_FROM_THIS (This);
|
||||||
|
|
||||||
switch (Action) {
|
switch (Action) {
|
||||||
|
@ -1470,6 +1515,12 @@ DriverCallback (
|
||||||
Value->u8 = DEFAULT_CLASS_STANDARD_VALUE;
|
Value->u8 = DEFAULT_CLASS_STANDARD_VALUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 0x1252:
|
||||||
|
for (Index = 0; Index < 3; Index ++) {
|
||||||
|
SetArrayData (Value, EFI_IFR_TYPE_NUM_SIZE_8, Index, BufferValue--);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Status = EFI_UNSUPPORTED;
|
Status = EFI_UNSUPPORTED;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -69,6 +69,7 @@ typedef struct {
|
||||||
EFI_HII_TIME Time;
|
EFI_HII_TIME Time;
|
||||||
UINT8 RefreshGuidCount;
|
UINT8 RefreshGuidCount;
|
||||||
UINT8 Match2;
|
UINT8 Match2;
|
||||||
|
UINT8 GetDefaultValueFromCallBackForOrderedList[3];
|
||||||
} DRIVER_SAMPLE_CONFIGURATION;
|
} DRIVER_SAMPLE_CONFIGURATION;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
//
|
//
|
||||||
// Sample Setup formset.
|
// Sample Setup formset.
|
||||||
//
|
//
|
||||||
// Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
|
// Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
// This program and the accompanying materials
|
// This program and the accompanying materials
|
||||||
// are licensed and made available under the terms and conditions of the BSD License
|
// 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
|
// which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -434,6 +434,17 @@ formset
|
||||||
step = 1,
|
step = 1,
|
||||||
default = 18,
|
default = 18,
|
||||||
endnumeric;
|
endnumeric;
|
||||||
|
|
||||||
|
orderedlist
|
||||||
|
varid = MyIfrNVData.GetDefaultValueFromCallBackForOrderedList,
|
||||||
|
questionid = 0x1252,
|
||||||
|
prompt = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_PROMPT),
|
||||||
|
help = STRING_TOKEN(STR_DEFAULT_VALUE_FROM_CALLBACK_HELP),
|
||||||
|
flags = INTERACTIVE,
|
||||||
|
option text = STRING_TOKEN(STR_ONE_OF_TEXT1), value = 1, flags = 0;
|
||||||
|
option text = STRING_TOKEN(STR_ONE_OF_TEXT2), value = 2, flags = 0;
|
||||||
|
option text = STRING_TOKEN(STR_ONE_OF_TEXT3), value = 3, flags = 0;
|
||||||
|
endlist;
|
||||||
|
|
||||||
resetbutton
|
resetbutton
|
||||||
defaultstore = MyStandardDefault,
|
defaultstore = MyStandardDefault,
|
||||||
|
|
Loading…
Reference in New Issue