summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-06-05 15:38:36 +0100
committerLeah Rowe <leah@libreboot.org>2023-06-05 15:38:36 +0100
commitf2822db9dd1e7787fe4209f5795d9595d435fecf (patch)
treef5df98b29dbb3a7d0bd66d97064e2441bbc78301 /util
parent334bfedfd4917f6b76e5dac919698ac9bb213af1 (diff)
util/spkmodem-recv: make ringpos a global variable
there's no point passing it as argument to a function. it's used across more than one function, so make it global Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r--util/spkmodem_recv/spkmodem-recv.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c
index bb73f999..923694e8 100644
--- a/util/spkmodem_recv/spkmodem-recv.c
+++ b/util/spkmodem_recv/spkmodem-recv.c
@@ -23,12 +23,12 @@
#define reset_char() ascii = 0, ascii_bit = 7
signed short frame[2 * SAMPLES_PER_FRAME], pulse[2 * SAMPLES_PER_FRAME];
-int debug, freq_data, freq_separator, sample_count, ascii_bit = 7;
+int ringpos, debug, freq_data, freq_separator, sample_count, ascii_bit = 7;
char ascii = 0;
void handle_audio(void);
void fetch_sample(void);
-void read_frame(int ringpos);
+void read_frame(void);
int set_ascii_bit(void);
void print_char(void);
void print_stats(void);
@@ -75,14 +75,13 @@ handle_audio(void)
void
fetch_sample(void)
{
- static int ringpos = 0;
freq_data -= pulse[ringpos];
freq_data += pulse[(ringpos + SAMPLES_PER_FRAME)
% (2 * SAMPLES_PER_FRAME)];
freq_separator -= pulse[(ringpos + SAMPLES_PER_FRAME)
% (2 * SAMPLES_PER_FRAME)];
- read_frame(ringpos);
+ read_frame();
if ((pulse[ringpos] = (abs(frame[ringpos]) > THRESHOLD) ? 1 : 0))
++freq_separator;
++ringpos;
@@ -91,7 +90,7 @@ fetch_sample(void)
}
void
-read_frame(int ringpos)
+read_frame(void)
{
if ((fread(frame + ringpos, 1, sizeof(frame[0]), stdin)
!= sizeof(frame[0])) || (ferror(stdin) != 0))