-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix determining intermediate frequency for C-band LNBs
Closes #1146
- Loading branch information
Showing
4 changed files
with
108 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ else | |
endif | ||
|
||
SOURCES=\ | ||
test_adapter.c \ | ||
test_opts.c \ | ||
test_ca.c \ | ||
test_pmt.c \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright (C) 2014-2022 Catalin Toda <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
* USA | ||
* | ||
*/ | ||
#define _GNU_SOURCE | ||
|
||
#include "adapter.h" | ||
#include "minisatip.h" | ||
#include "utils.h" | ||
#include "utils/testing.h" | ||
|
||
#include <string.h> | ||
#include <linux/dvb/frontend.h> | ||
|
||
int test_get_lnb_hiband() { | ||
return 0; | ||
} | ||
|
||
int test_get_lnb_int_freq_universal() { | ||
transponder tp; | ||
diseqc diseqc_param = { | ||
.lnb_low = 9750000, | ||
.lnb_high = 10600000, | ||
.lnb_switch = 11700000 | ||
}; | ||
|
||
tp.freq = 10778000; | ||
int freq = get_lnb_int_freq(&tp, &diseqc_param); | ||
ASSERT(freq == 1028000, "Universal LNB IF parsed incorrectly"); | ||
|
||
tp.freq = 12322000; | ||
freq = get_lnb_int_freq(&tp, &diseqc_param); | ||
ASSERT(freq == 1722000, "Universal LNB IF parsed incorrectly"); | ||
|
||
return 0; | ||
} | ||
|
||
int test_get_lnb_int_freq_kuband() { | ||
transponder tp; | ||
diseqc diseqc_param = { | ||
.lnb_low = 10750000, | ||
.lnb_high = 0, | ||
.lnb_switch = 0, | ||
}; | ||
|
||
tp.freq = 12267000; | ||
int freq = get_lnb_int_freq(&tp, &diseqc_param); | ||
ASSERT(freq == 1517000, "Ku-band LNB IF parsed incorrectly"); | ||
|
||
return 0; | ||
} | ||
|
||
int test_get_lnb_int_freq_cband() { | ||
transponder tp; | ||
diseqc diseqc_param = { | ||
.lnb_low = 5150000, | ||
.lnb_high = 0, | ||
.lnb_switch = 0 | ||
}; | ||
|
||
tp.freq = 3773000; | ||
int freq = get_lnb_int_freq(&tp, &diseqc_param); | ||
ASSERT(freq == 1377000, "C-band LNB IF parsed incorrectly"); | ||
|
||
// Should also work with low = high = switch | ||
diseqc_param.lnb_high = diseqc_param.lnb_switch = 5150000; | ||
freq = get_lnb_int_freq(&tp, &diseqc_param); | ||
ASSERT(freq == 1377000, "C-band LNB IF parsed incorrectly"); | ||
|
||
return 0; | ||
} | ||
|
||
int main() { | ||
opts.log = 1; | ||
opts.debug = 255; | ||
strcpy(thread_info[thread_index].thread_name, "test_adapter"); | ||
|
||
TEST_FUNC(test_get_lnb_hiband(), "test test_get_lnb_hiband with universal LNB parameters"); | ||
TEST_FUNC(test_get_lnb_int_freq_universal(), "test get_lnb_int_freq with universal LNB parameters"); | ||
TEST_FUNC(test_get_lnb_int_freq_kuband(), "test get_lnb_int_freq with typical Ku-band linear LNB parameters"); | ||
TEST_FUNC(test_get_lnb_int_freq_cband(), "test get_lnb_int_freq with C-band LNB parameters"); | ||
|
||
return 0; | ||
} |