Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: Intel */ |
Bin Meng | 752a0b0 | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013, Intel Corporation |
| 4 | * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com> |
Bin Meng | 752a0b0 | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
Sughosh Ganu | 6ef1b75 | 2020-12-14 11:52:44 +0530 | [diff] [blame] | 7 | #ifndef __SIGNATURES_H__ |
| 8 | #define __SIGNATURES_H__ |
Bin Meng | 752a0b0 | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 9 | |
Bin Meng | 752a0b0 | 2014-12-12 21:05:28 +0800 | [diff] [blame] | 10 | /** |
| 11 | * Returns a 16-bit signature built from 2 ASCII characters. |
| 12 | * |
| 13 | * This macro returns a 16-bit value built from the two ASCII characters |
| 14 | * specified by A and B. |
| 15 | * |
| 16 | * @A: The first ASCII character. |
| 17 | * @B: The second ASCII character. |
| 18 | * |
| 19 | * @return: A 16-bit value built from the two ASCII characters specified by |
| 20 | * A and B. |
| 21 | */ |
| 22 | #define SIGNATURE_16(A, B) ((A) | (B << 8)) |
| 23 | |
| 24 | /** |
| 25 | * Returns a 32-bit signature built from 4 ASCII characters. |
| 26 | * |
| 27 | * This macro returns a 32-bit value built from the four ASCII characters |
| 28 | * specified by A, B, C, and D. |
| 29 | * |
| 30 | * @A: The first ASCII character. |
| 31 | * @B: The second ASCII character. |
| 32 | * @C: The third ASCII character. |
| 33 | * @D: The fourth ASCII character. |
| 34 | * |
| 35 | * @return: A 32-bit value built from the two ASCII characters specified by |
| 36 | * A, B, C and D. |
| 37 | */ |
| 38 | #define SIGNATURE_32(A, B, C, D) \ |
| 39 | (SIGNATURE_16(A, B) | (SIGNATURE_16(C, D) << 16)) |
| 40 | |
| 41 | /** |
| 42 | * Returns a 64-bit signature built from 8 ASCII characters. |
| 43 | * |
| 44 | * This macro returns a 64-bit value built from the eight ASCII characters |
| 45 | * specified by A, B, C, D, E, F, G,and H. |
| 46 | * |
| 47 | * @A: The first ASCII character. |
| 48 | * @B: The second ASCII character. |
| 49 | * @C: The third ASCII character. |
| 50 | * @D: The fourth ASCII character. |
| 51 | * @E: The fifth ASCII character. |
| 52 | * @F: The sixth ASCII character. |
| 53 | * @G: The seventh ASCII character. |
| 54 | * @H: The eighth ASCII character. |
| 55 | * |
| 56 | * @return: A 64-bit value built from the two ASCII characters specified by |
| 57 | * A, B, C, D, E, F, G and H. |
| 58 | */ |
| 59 | #define SIGNATURE_64(A, B, C, D, E, F, G, H) \ |
| 60 | (SIGNATURE_32(A, B, C, D) | ((u64)(SIGNATURE_32(E, F, G, H)) << 32)) |
| 61 | |
Sughosh Ganu | 6ef1b75 | 2020-12-14 11:52:44 +0530 | [diff] [blame] | 62 | #endif /* __SIGNATURES_H__ */ |