1 /*
2 * demod_eia.c
3 *
4 * Copyright (C) 2013
5 * Elias Oenal (EliasOenal@gmail.com)
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22 #define SAMPLE_RATE 22050
23 #define PHINC(x) ((x)*0x10000/SAMPLE_RATE)
24
25 #include "multimon.h"
26
27 static const unsigned int eia_freq[16] = {
28 PHINC(600), PHINC(741), PHINC(882), PHINC(1023),
29 PHINC(1164), PHINC(1305), PHINC(1446), PHINC(1587),
30 PHINC(1728), PHINC(1869), PHINC(2151), PHINC(2433),
31 PHINC(2010), PHINC(2292), PHINC(459), PHINC(1091)
32 };
33
34 /* ---------------------------------------------------------------------- */
35
eia_init(struct demod_state * s)36 static void eia_init(struct demod_state *s)
37 {
38 selcall_init(s);
39 }
40
eia_deinit(struct demod_state * s)41 static void eia_deinit(struct demod_state *s)
42 {
43 selcall_deinit(s);
44 }
45
eia_demod(struct demod_state * s,buffer_t buffer,int length)46 static void eia_demod(struct demod_state *s, buffer_t buffer, int length)
47 {
48 selcall_demod(s, buffer.fbuffer, length, eia_freq, demod_eia.name);
49 }
50
51 const struct demod_param demod_eia = {
52 "EIA", true, SAMPLE_RATE, 0, eia_init, eia_demod, eia_deinit
53 };
54
55
56
57