diff options
-rw-r--r-- | firmware/export/system.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h index 1205e9360b..09efbeeda4 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h | |||
@@ -155,6 +155,28 @@ static inline int set_irq_level(int level) | |||
155 | return oldlevel; | 155 | return oldlevel; |
156 | } | 156 | } |
157 | 157 | ||
158 | static inline unsigned short SWAB16(unsigned short value) | ||
159 | /* | ||
160 | result[15..8] = value[ 7..0]; | ||
161 | result[ 7..0] = value[15..8]; | ||
162 | */ | ||
163 | { | ||
164 | return (value >> 8) | (value << 8); | ||
165 | } | ||
166 | |||
167 | static inline unsigned long SWAB32(unsigned long value) | ||
168 | /* | ||
169 | result[31..24] = value[ 7.. 0]; | ||
170 | result[23..16] = value[15.. 8]; | ||
171 | result[15.. 8] = value[23..16]; | ||
172 | result[ 7.. 0] = value[31..24]; | ||
173 | */ | ||
174 | { | ||
175 | unsigned short hi = SWAB16(value >> 16); | ||
176 | unsigned short lo = SWAB16(value & 0xffff); | ||
177 | return (lo << 16) | hi; | ||
178 | } | ||
179 | |||
158 | #endif | 180 | #endif |
159 | #endif | 181 | #endif |
160 | 182 | ||