# HG changeset patch
# User Mychaela Falconia <falcon@freecalypso.org>
# Date 1718666719 0
# Node ID aee13079db3c3ee7a0496ba2fbff6d3999d17c33
# Parent  aaf4dec8bee0e4ed81e41a1ddd883fbb17b9c2bd
libgsmhr1: implement SID reset

diff -r aaf4dec8bee0 -r aee13079db3c libgsmhr1/Makefile
--- a/libgsmhr1/Makefile	Mon Jun 17 23:14:19 2024 +0000
+++ b/libgsmhr1/Makefile	Mon Jun 17 23:25:19 2024 +0000
@@ -1,5 +1,5 @@
-OBJS=	pack_frame.o rtp_in.o sid_detect.o twts002_in.o twts002_out.o \
-	unpack_frame.o
+OBJS=	pack_frame.o rtp_in.o sid_detect.o sid_reset.o twts002_in.o \
+	twts002_out.o unpack_frame.o
 HDRS=	tw_gsmhr.h
 LIB=	libgsmhr1.a
 
diff -r aaf4dec8bee0 -r aee13079db3c libgsmhr1/sid_reset.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmhr1/sid_reset.c	Mon Jun 17 23:25:19 2024 +0000
@@ -0,0 +1,15 @@
+/*
+ * The function in this module implements reset of HRv1 SID codeword,
+ * for rejuvenating SID frames that may have been corrupted, but were still
+ * accepted as valid SID.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include "tw_gsmhr.h"
+
+void gsmhr_ts101318_set_sid_codeword(uint8_t *payload)
+{
+	payload[4] |= 0x7F;
+	memset(payload + 5, 0xFF, 9);
+}