add support for GSM-R-900

Signed-off-by: Steve Markgraf <steve@steve-m.de>
This commit is contained in:
Steve Markgraf 2012-10-09 01:26:26 +02:00
parent c3366bda71
commit bcb8173578
3 changed files with 37 additions and 5 deletions

View file

@ -38,6 +38,9 @@ const char *bi_to_str(int bi) {
case GSM_850:
return "GSM-850";
case GSM_R_900:
return "GSM-R-900";
case GSM_900:
return "GSM-900";
@ -61,6 +64,9 @@ int str_to_bi(char *s) {
if(!strcmp(s, "GSM850") || !strcmp(s, "GSM-850") || !strcmp(s, "850"))
return GSM_850;
if(!strcmp(s, "GSM-R") || !strcmp(s, "R-GSM"))
return GSM_R_900;
if(!strcmp(s, "GSM900") || !strcmp(s, "GSM-900") || !strcmp(s, "900"))
return GSM_900;
@ -99,9 +105,13 @@ double arfcn_to_freq(int n, int *bi) {
*bi = GSM_E_900;
return 935e6;
}
if((975 <= n) && (n <= 1023)) {
if(bi)
*bi = GSM_E_900;
if((955 <= n) && (n <= 1023)) {
if(bi) {
if (975 <= n)
*bi = GSM_E_900;
else
*bi = GSM_R_900;
}
return 890.0e6 + 0.2e6 * (n - 1024) + 45.0e6;
}
@ -141,6 +151,12 @@ int freq_to_arfcn(double freq, int *bi) {
return (int)((freq - 869.2e6) / 0.2e6) + 128;
}
if((921.2e6 <= freq) && (freq <= 925.0e6)) {
if(bi)
*bi = GSM_R_900;
return (int)((freq - 935e6) / 0.2e6) + 1024;
}
if((935.2e6 <= freq) && (freq <= 959.8e6)) {
if(bi)
*bi = GSM_900;
@ -181,6 +197,9 @@ int first_chan(int bi) {
case GSM_850:
return 128;
case GSM_R_900:
return 955;
case GSM_900:
return 1;
@ -211,6 +230,13 @@ int next_chan_loop(int chan, int bi) {
return 128;
return -1;
case GSM_R_900:
if((955 <= chan) && (chan < 974))
return chan + 1;
if(chan == 974)
return 955;
return -1;
case GSM_900:
if((1 <= chan) && (chan < 124))
return chan + 1;
@ -259,6 +285,11 @@ int next_chan(int chan, int bi) {
return chan + 1;
return -1;
case GSM_R_900:
if((955 <= chan) && (chan < 974))
return chan + 1;
return -1;
case GSM_900:
if((1 <= chan) && (chan < 124))
return chan + 1;

View file

@ -28,6 +28,7 @@
enum {
BI_NOT_DEFINED,
GSM_850,
GSM_R_900,
GSM_900,
GSM_E_900,
DCS_1800,

View file

@ -77,10 +77,10 @@ void usage(char *prog) {
printf("\t\t%s <-f frequency | -c channel> [options]\n", basename(prog));
printf("\n");
printf("Where options are:\n");
printf("\t-s\tband to scan (GSM850, GSM900, EGSM, DCS, PCS)\n");
printf("\t-s\tband to scan (GSM850, GSM-R, GSM900, EGSM, DCS, PCS)\n");
printf("\t-f\tfrequency of nearby GSM base station\n");
printf("\t-c\tchannel of nearby GSM base station\n");
printf("\t-b\tband indicator (GSM850, GSM900, EGSM, DCS, PCS)\n");
printf("\t-b\tband indicator (GSM850, GSM-R, GSM900, EGSM, DCS, PCS)\n");
printf("\t-g\tgain in dB\n");
printf("\t-d\trtl-sdr device index\n");
printf("\t-e\tinitial frequency error in ppm\n");