diff options
author | Joursoir <chat@joursoir.net> | 2022-03-17 14:14:05 +0300 |
---|---|---|
committer | Joursoir <chat@joursoir.net> | 2022-03-17 14:14:05 +0300 |
commit | 451437855819bd89ca81c923657c3a01018f5119 (patch) | |
tree | db3ad1935ffc3cabf1ae621b05626a7fa11930a8 | |
download | umt-451437855819bd89ca81c923657c3a01018f5119.tar.gz umt-451437855819bd89ca81c923657c3a01018f5119.tar.bz2 umt-451437855819bd89ca81c923657c3a01018f5119.zip |
Initial commit
-rw-r--r-- | CODING-STYLE.md | 184 | ||||
-rw-r--r-- | LICENSE | 49 | ||||
-rw-r--r-- | README.md | 33 |
3 files changed, 266 insertions, 0 deletions
diff --git a/CODING-STYLE.md b/CODING-STYLE.md new file mode 100644 index 0000000..e62b1df --- /dev/null +++ b/CODING-STYLE.md @@ -0,0 +1,184 @@ +# Coding Style + +This is a short document describing the preferred coding style for the UEFI Monitor Test. It is in many ways exactly the same as the EDKII coding style. + +### 1. Indentation + +Indentation are 2 spaces. Having 2-character indentations makes the code don't move too far to the right, and makes it easy to read on a 80-character terminal screen. + +Never use tab characters. Set editor to insert spaces rather than a tab character. + +Correct: + +``` +if (TRUE) { + Print (L"Hello, world!\n"); +} +``` + +Incorrect: + +``` +if (TRUE) { + Print (L"Hello, world!\n"); +} +``` + +### 2. Breaking long lines and strings + +The preferred limit on the length of a single line is 80 characters. If statements longer than 80 columns, then you should break it into sensible chunks + +These same rules are applied to function headers with a long argument list. + +### 3. Placing braces and spaces + +The preferred way is to put the opening brace last on the line, and put the closing brace first: + +``` +if (TRUE) { + Print (L"Hello, world!\n"); +} +``` + +This applies to all non-function statement blocks (if, switch, for, while, do). Always use braces, even when there is only one statement: + +``` +for (Index = 0; Index < MaxVal; Index++) { + FreePool (Buffer[Index]); +} +``` + +However, there is one special case, namely functions. The opening brace should always appear separately on the a new line: + +``` +VOID +SomeFunction ( + VOID + ) +{ + ... +} +``` + +### 4. Naming + +[CamelCase](https://en.wikipedia.org/wiki/Camel_case) used for variables, functions and file names: + +``` +#include "FooFileName.h" +... +VOID SuperFunction ( + ... + UINTN ALocalVariable; + UINTN UefiVersion; +``` + +UPPERCASE used for types and macros: + +``` +#define BOOT_MANAGER_FORMSET_GUID \ + { \ + 0x847bc3fe, 0xb974, 0x446d, {0x94, 0x49, 0x5a, 0xd5, 0x41, 0x2e, 0x99, 0x3b} \ + } + +#define BOOT_MANAGER_FORM_ID 0x1000 + +#define BOOT_MANAGER_CALLBACK_DATA_SIGNATURE SIGNATURE_32 ('B', 'M', 'C', 'B') +``` + +### 5. Use UEFI types + +Never use C types. UEFI has macros for common data types. They are in the file `MdePkg/Include/_Arch_/ProcessorBind.h`. + +Correct: + +``` +INTN ALocalVariable; +UINTN UefiVersion; +VOID *Ptr; +``` + +Incorrect: + +``` +int ALocalVariable; +unsigned int UefiVersion; +void *Ptr; +``` + + +## Examples + +### C file + +``` +/** + Brief and Detailed Descriptions. + + @param[in] Arg1 Description of Arg1. + @param[in] Arg2 Description of Arg2, which is optional. + @param[out] Arg3 Description of Arg3. + @param[in, out] Arg4 Description of Arg4. + + @retval EFI_SUCCESS Description of what EFI_SUCCESS means. + @retval !EFI_SUCCESS Failure. + +**/ +EFI_STATUS +EFIAPI +FooName ( + IN UINTN Arg1, + IN UINTN Arg2 OPTIONAL, + OUT UINTN *Arg3, + IN OUT UINTN *Arg4 + ) +{ + UINTN Local; + UINTN AnotherLocal; + + ... + + for (Local = 0; Local < 5; Local++) { + if (Local == 2) { + Print (L"Local: %d (yes! 2)\n", Local); + } else { + Print (L"Local: %d\n", Local); + } + } + + ... +} +``` + +### H file + +``` +#define FOO_MACRO(a, b) ((a) * (b)) + +#define FOO_CONSTANT 0xcafe + +/** + Brief and Detailed Descriptions. + + @param[in] Arg1 Description of Arg1. + @param[in] Arg2 Description of Arg2, which is optional. + @param[out] Arg3 Description of Arg3. + @param[in, out] Arg4 Description of Arg4. + + @retval EFI_SUCCESS Description of what EFI_SUCCESS means. + @retval !EFI_SUCCESS Failure. + +**/ +EFI_STATUS +EFIAPI +FooName ( + IN UINTN Arg1, + IN UINTN Arg2 OPTIONAL, + OUT UINTN *Arg3, + IN OUT UINTN *Arg4 + ); + +... + +#endif +``` @@ -0,0 +1,49 @@ +Copyright (c) 2022, Aleksandr D. Goncharov (Joursoir). All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +Subject to the terms and conditions of this license, each copyright holder +and contributor hereby grants to those receiving rights under this license +a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable +(except for failure to satisfy the conditions of this license) patent +license to make, have made, use, offer to sell, sell, import, and otherwise +transfer this software, where such license applies only to those patent +claims, already acquired or hereafter acquired, licensable by such copyright +holder or contributor that are necessarily infringed by: + +(a) their Contribution(s) (the licensed copyrights of copyright holders and + non-copyrightable additions of contributors, in source or binary form) + alone; or + +(b) combination of their Contribution(s) with the work of authorship to + which such Contribution(s) was added by such copyright holder or + contributor, if, at the time the Contribution is added, such addition + causes such combination to be necessarily infringed. The patent license + shall not apply to any other combinations which include the + Contribution. + +Except as expressly stated above, no rights or licenses from any copyright +holder or contributor is granted under this license, whether expressly, by +implication, estoppel or otherwise. + +DISCLAIMER + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..6e71f0d --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# UEFI Monitor Test + +A monitor diagnostic and testing tool. It includes several tests that should allow you to diagnose any potential problems with your monitor. The application is based on the [TianoCore EDK II](https://www.tianocore.org/) development environment. Distributed under the BSD-2-Clause Plus Patent License. + +## Tests + +* Solid colors +* Colored lines +* Grayscale +* Mesh field +* Chess board + +## Installation + +Coming soon... + +## Usage + +Move the generated `UefiMonitorTest.efi` to some file system and run it via Uefi Shell: + +``` +Shell> UefiMonitorTest.efi +``` + +The app doesn't currently support command line arguments. + +### Controls + +Coming soon... + +## Screenshots + +Coming soon... |