1 // SPDX-License-Identifier: MIT
4 void pack_hdmi_infoframe(struct packed_hdmi_infoframe *packed_frame,
5 u8 *raw_frame, ssize_t len)
11 u32 subpack1_high = 0;
15 * "When in doubt, use brute force."
20 * We presume that no valid frame is longer than 17
21 * octets, including header... And truncate to that
25 subpack1_high = (raw_frame[16] << 16);
28 subpack1_high |= (raw_frame[15] << 8);
31 subpack1_high |= raw_frame[14];
34 subpack1_low = (raw_frame[13] << 24);
37 subpack1_low |= (raw_frame[12] << 16);
40 subpack1_low |= (raw_frame[11] << 8);
43 subpack1_low |= raw_frame[10];
46 subpack0_high = (raw_frame[9] << 16);
49 subpack0_high |= (raw_frame[8] << 8);
52 subpack0_high |= raw_frame[7];
55 subpack0_low = (raw_frame[6] << 24);
58 subpack0_low |= (raw_frame[5] << 16);
61 subpack0_low |= (raw_frame[4] << 8);
64 subpack0_low |= raw_frame[3];
67 header = (raw_frame[2] << 16);
70 header |= (raw_frame[1] << 8);
73 header |= raw_frame[0];
79 packed_frame->header = header;
80 packed_frame->subpack0_low = subpack0_low;
81 packed_frame->subpack0_high = subpack0_high;
82 packed_frame->subpack1_low = subpack1_low;
83 packed_frame->subpack1_high = subpack1_high;