osmo_e1f.c: Fix CRC4 insertion
When encoding the CRC bit for Frame number 0 and 8 in the multiframe,
we must first move the CRC4 into those of the last SMF.
Change-Id: I088741fc4528f33b3b989ada0e21957456deedb6
diff --git a/software/obsolete/osmo_e1f.c b/software/obsolete/osmo_e1f.c
index cbcd0db..a4cadb2 100644
--- a/software/obsolete/osmo_e1f.c
+++ b/software/obsolete/osmo_e1f.c
@@ -208,6 +208,12 @@
{
uint8_t ret = 0;
+ /* re-set CRC4 at start of sub-multiframe */
+ if (e1i->tx.frame_nr == 0 || e1i->tx.frame_nr == 8) {
+ e1i->tx.crc4_last_smf = e1i->tx.crc4;
+ e1i->tx.crc4 = 0;
+ }
+
/* according to Table 5B/G.704 - CRC-4 multiframe structure */
if ((e1i->tx.frame_nr % 2) == 0) {
/* FAS */
@@ -236,12 +242,6 @@
ret |= 0x20;
}
- /* re-set CRC4 at start of sub-multiframe */
- if (e1i->tx.frame_nr == 0 || e1i->tx.frame_nr == 8) {
- e1i->tx.crc4_last_smf = e1i->tx.crc4;
- e1i->tx.crc4 = 0;
- }
-
/* increment frame number modulo 16 */
e1i->tx.frame_nr = (e1i->tx.frame_nr + 1) % 16;