add endianness check to spkmodem-recv

a bit dirty. should handle this at runtime.

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe
2026-03-12 18:35:22 +00:00
parent f7fc5b1651
commit 9375ecc6a4
+8 -1
View File
@@ -7,7 +7,7 @@
* and decodes them. This is a special type of interface provided
* by coreboot and GRUB, for computers that lack serial ports.
*
* Usage example:
* Usage example (NOTE: little endian!):
* parec --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv
*
* Originally provided by GNU GRUB, this version is a heavily
@@ -51,6 +51,13 @@
#define READ_BUF 4096
/* TODO: handle this at runtime instead (bswap) */
#if defined(__BYTE_ORDER__)
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#error "spkmodem-recv requires little-endian samples"
#endif
#endif
struct decoder_state {
signed short frame[MAX_SAMPLES];
unsigned char pulse[MAX_SAMPLES];