Jinu Joy Thomas | 7726953 | 2019-03-05 19:23:06 +0530 | [diff] [blame] | 1 | #ifndef PLDM_TYPES_H |
| 2 | #define PLDM_TYPES_H |
| 3 | |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 4 | #include <stdint.h> |
| 5 | |
| 6 | typedef union { |
| 7 | uint8_t byte; |
| 8 | struct { |
| 9 | uint8_t bit0 : 1; |
| 10 | uint8_t bit1 : 1; |
| 11 | uint8_t bit2 : 1; |
| 12 | uint8_t bit3 : 1; |
Zahed Hossain | 26b0e57 | 2019-05-23 05:24:50 -0500 | [diff] [blame] | 13 | uint8_t bit4 : 1; |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 14 | uint8_t bit5 : 1; |
| 15 | uint8_t bit6 : 1; |
| 16 | uint8_t bit7 : 1; |
| 17 | } __attribute__((packed)) bits; |
| 18 | } bitfield8_t; |
| 19 | |
| 20 | /** @struct pldm_version |
| 21 | * |
| 22 | * |
| 23 | */ |
| 24 | typedef struct pldm_version { |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 25 | uint8_t alpha; |
Manojkiran Eda | cb45467 | 2022-06-29 11:05:42 +0530 | [diff] [blame^] | 26 | uint8_t update; |
| 27 | uint8_t minor; |
| 28 | uint8_t major; |
Deepak Kodihalli | 97e0bd5 | 2019-02-21 03:54:22 -0600 | [diff] [blame] | 29 | } __attribute__((packed)) ver32_t; |
Jinu Joy Thomas | 7726953 | 2019-03-05 19:23:06 +0530 | [diff] [blame] | 30 | |
Deepak Kodihalli | c6e8fb5 | 2019-05-02 08:35:31 -0500 | [diff] [blame] | 31 | typedef uint8_t bool8_t; |
| 32 | |
Tom Joseph | 0c6d22c | 2019-06-26 09:58:41 +0530 | [diff] [blame] | 33 | typedef union { |
gokulsanker | e1fb7a8 | 2021-04-05 16:09:29 +0530 | [diff] [blame] | 34 | uint16_t value; |
| 35 | struct { |
| 36 | uint8_t bit0 : 1; |
| 37 | uint8_t bit1 : 1; |
| 38 | uint8_t bit2 : 1; |
| 39 | uint8_t bit3 : 1; |
| 40 | uint8_t bit4 : 1; |
| 41 | uint8_t bit5 : 1; |
| 42 | uint8_t bit6 : 1; |
| 43 | uint8_t bit7 : 1; |
| 44 | uint8_t bit8 : 1; |
| 45 | uint8_t bit9 : 1; |
| 46 | uint8_t bit10 : 1; |
| 47 | uint8_t bit11 : 1; |
| 48 | uint8_t bit12 : 1; |
| 49 | uint8_t bit13 : 1; |
| 50 | uint8_t bit14 : 1; |
| 51 | uint8_t bit15 : 1; |
| 52 | } __attribute__((packed)) bits; |
| 53 | } bitfield16_t; |
| 54 | |
| 55 | typedef union { |
Tom Joseph | 0c6d22c | 2019-06-26 09:58:41 +0530 | [diff] [blame] | 56 | uint32_t value; |
| 57 | struct { |
| 58 | uint8_t bit0 : 1; |
| 59 | uint8_t bit1 : 1; |
| 60 | uint8_t bit2 : 1; |
| 61 | uint8_t bit3 : 1; |
| 62 | uint8_t bit4 : 1; |
| 63 | uint8_t bit5 : 1; |
| 64 | uint8_t bit6 : 1; |
| 65 | uint8_t bit7 : 1; |
| 66 | uint8_t bit8 : 1; |
| 67 | uint8_t bit9 : 1; |
| 68 | uint8_t bit10 : 1; |
| 69 | uint8_t bit11 : 1; |
| 70 | uint8_t bit12 : 1; |
| 71 | uint8_t bit13 : 1; |
| 72 | uint8_t bit14 : 1; |
| 73 | uint8_t bit15 : 1; |
| 74 | uint8_t bit16 : 1; |
| 75 | uint8_t bit17 : 1; |
| 76 | uint8_t bit18 : 1; |
| 77 | uint8_t bit19 : 1; |
| 78 | uint8_t bit20 : 1; |
| 79 | uint8_t bit21 : 1; |
| 80 | uint8_t bit22 : 1; |
| 81 | uint8_t bit23 : 1; |
| 82 | uint8_t bit24 : 1; |
| 83 | uint8_t bit25 : 1; |
| 84 | uint8_t bit26 : 1; |
| 85 | uint8_t bit27 : 1; |
| 86 | uint8_t bit28 : 1; |
| 87 | uint8_t bit29 : 1; |
| 88 | uint8_t bit30 : 1; |
| 89 | uint8_t bit31 : 1; |
| 90 | } __attribute__((packed)) bits; |
| 91 | } bitfield32_t; |
| 92 | |
gokulsanker | 94bd234 | 2021-04-27 09:46:02 +0530 | [diff] [blame] | 93 | typedef union { |
| 94 | uint64_t value; |
| 95 | struct { |
| 96 | uint8_t bit0 : 1; |
| 97 | uint8_t bit1 : 1; |
| 98 | uint8_t bit2 : 1; |
| 99 | uint8_t bit3 : 1; |
| 100 | uint8_t bit4 : 1; |
| 101 | uint8_t bit5 : 1; |
| 102 | uint8_t bit6 : 1; |
| 103 | uint8_t bit7 : 1; |
| 104 | uint8_t bit8 : 1; |
| 105 | uint8_t bit9 : 1; |
| 106 | uint8_t bit10 : 1; |
| 107 | uint8_t bit11 : 1; |
| 108 | uint8_t bit12 : 1; |
| 109 | uint8_t bit13 : 1; |
| 110 | uint8_t bit14 : 1; |
| 111 | uint8_t bit15 : 1; |
| 112 | uint8_t bit16 : 1; |
| 113 | uint8_t bit17 : 1; |
| 114 | uint8_t bit18 : 1; |
| 115 | uint8_t bit19 : 1; |
| 116 | uint8_t bit20 : 1; |
| 117 | uint8_t bit21 : 1; |
| 118 | uint8_t bit22 : 1; |
| 119 | uint8_t bit23 : 1; |
| 120 | uint8_t bit24 : 1; |
| 121 | uint8_t bit25 : 1; |
| 122 | uint8_t bit26 : 1; |
| 123 | uint8_t bit27 : 1; |
| 124 | uint8_t bit28 : 1; |
| 125 | uint8_t bit29 : 1; |
| 126 | uint8_t bit30 : 1; |
| 127 | uint8_t bit31 : 1; |
| 128 | uint8_t bit32 : 1; |
| 129 | uint8_t bit33 : 1; |
| 130 | uint8_t bit34 : 1; |
| 131 | uint8_t bit35 : 1; |
| 132 | uint8_t bit36 : 1; |
| 133 | uint8_t bit37 : 1; |
| 134 | uint8_t bit38 : 1; |
| 135 | uint8_t bit39 : 1; |
| 136 | uint8_t bit40 : 1; |
| 137 | uint8_t bit41 : 1; |
| 138 | uint8_t bit42 : 1; |
| 139 | uint8_t bit43 : 1; |
| 140 | uint8_t bit44 : 1; |
| 141 | uint8_t bit45 : 1; |
| 142 | uint8_t bit46 : 1; |
| 143 | uint8_t bit47 : 1; |
| 144 | uint8_t bit48 : 1; |
| 145 | uint8_t bit49 : 1; |
| 146 | uint8_t bit50 : 1; |
| 147 | uint8_t bit51 : 1; |
| 148 | uint8_t bit52 : 1; |
| 149 | uint8_t bit53 : 1; |
| 150 | uint8_t bit54 : 1; |
| 151 | uint8_t bit55 : 1; |
| 152 | uint8_t bit56 : 1; |
| 153 | uint8_t bit57 : 1; |
| 154 | uint8_t bit58 : 1; |
| 155 | uint8_t bit59 : 1; |
| 156 | uint8_t bit60 : 1; |
| 157 | uint8_t bit61 : 1; |
| 158 | uint8_t bit62 : 1; |
| 159 | uint8_t bit63 : 1; |
| 160 | } __attribute__((packed)) bits; |
| 161 | } bitfield64_t; |
| 162 | |
George Liu | 456c9a2 | 2020-01-13 11:36:22 +0800 | [diff] [blame] | 163 | typedef float real32_t; |
| 164 | |
Jinu Joy Thomas | 7726953 | 2019-03-05 19:23:06 +0530 | [diff] [blame] | 165 | #endif /* PLDM_TYPES_H */ |