FreeCalypso > hg > fc-rfcal-tools
view cmu200/band.c @ 80:b0da2db4e36b
fc-rfcal-txband: basis run implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 15 Jul 2017 21:22:38 +0000 |
parents | e2db512abbee |
children |
line wrap: on
line source
/* * Our band and ARFCN tables and lookup code live here. */ #include <string.h> #include <strings.h> #include "band.h" #include "secaddr.h" struct arfcn_range band850_arfcn_range = {128, 251, 824200, 869200}; struct arfcn_range band900_arfcn_range = { 0, 124, 890000, 935000}; struct arfcn_range band900_arfcn_range_ext = {975, 1023, 880200, 925200}; struct arfcn_range band1800_arfcn_range = {512, 885, 1710200, 1805200}; struct arfcn_range band1900_arfcn_range = {512, 810, 1850200, 1930200}; struct band supported_bands[] = { {"850", SECADDR_GSM850MS_NSIG, &band850_arfcn_range, 0}, {"900", SECADDR_GSM900MS_NSIG, &band900_arfcn_range, &band900_arfcn_range_ext}, {"1800", SECADDR_GSM1800MS_NSIG, &band1800_arfcn_range, 0}, {"1900", SECADDR_GSM1900MS_NSIG, &band1900_arfcn_range, 0}, {0, 0, 0, 0} }; struct band *current_band; find_named_band(srchname) char *srchname; { struct band *band; for (band = supported_bands; band->name; band++) if (!strcmp(band->name, srchname)) break; if (!band->name) return(-1); current_band = band; return(0); } check_arfcn_range(range, arfcn, ulp, dlp) struct arfcn_range *range; unsigned arfcn, *ulp, *dlp; { if (arfcn < range->min) return(-1); if (arfcn > range->max) return(-1); if (ulp) *ulp = range->ul_khz + (arfcn - range->min) * 200; if (dlp) *dlp = range->dl_khz + (arfcn - range->min) * 200; return(0); } verify_arfcn(arfcn, ulp, dlp) unsigned arfcn, *ulp, *dlp; { if (!check_arfcn_range(current_band->arfcn_range, arfcn, ulp, dlp)) return(0); if (current_band->arfcn_range_ext && !check_arfcn_range(current_band->arfcn_range_ext, arfcn, ulp, dlp)) return(0); return(-1); }