TestCpuFrequency: Convert to EDK-II codestyle
#include <Library/OcCpuLib.h>
#include <Library/DebugLib.h>
-#include <sys/time.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <stdlib.h>
-
typedef struct FREQUENCY_TEST_ {
UINT64 FrequencyHz;
UINT16 FrequencyMHz;
CONST CHAR8 *Model;
} FREQUENCY_TEST;
-int main() {
STATIC FREQUENCY_TEST mTests[] = {
{ 3506084610 /* Hz */, 3500 /* MHz, Raw 3506 MHz */, "i7 4770K" },
{ 3324999575 /* Hz */, 3330 /* MHz, Raw 3325 MHz */, "Xeon X5680" },
@@ -40,21 +33,26 @@ int main() {
{ 2389242546 /* Hz */, 2400 /* MHz, Raw 2389 MHz */, "C2D P8600" },
};
- int code = 0;
+int main() {
+ int RetVal;
+ UINT16 Read;
+ UINTN Index;
+
+ RetVal = 0;
- for (size_t i = 0; i < sizeof(mTests)/sizeof(mTests[0]); ++i) {
- UINT16 Read = OcCpuFrequencyToDisplayFrequency (mTests[i].FrequencyHz);
- if (Read != mTests[i].FrequencyMHz) {
+ for (Index = 0; Index < ARRAY_SIZE (mTests); ++Index) {
+ Read = OcCpuFrequencyToDisplayFrequency (mTests[Index].FrequencyHz);
+ if (Read != mTests[Index].FrequencyMHz) {
DEBUG ((
DEBUG_WARN,
"Frequency %04u instead if %04u for %a\n",
Read,
- mTests[i].FrequencyMHz,
- mTests[i].Model
+ mTests[Index].FrequencyMHz,
+ mTests[Index].Model
));
- code = 1;
+ RetVal = 1;
}
}
- return code;
+ return RetVal;
}
