removed bw_idx from srslte_cell_t

master
Ismael Gomez 8 years ago
parent 0d6651001b
commit 4c3e64d224

@ -158,7 +158,6 @@ typedef enum {
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t nof_prb; uint32_t nof_prb;
uint32_t nof_ports; uint32_t nof_ports;
uint32_t bw_idx;
uint32_t id; uint32_t id;
srslte_cp_t cp; srslte_cp_t cp;
srslte_phich_length_t phich_length; srslte_phich_length_t phich_length;
@ -246,8 +245,12 @@ SRSLTE_API char *srslte_mod_string(srslte_mod_t mod);
SRSLTE_API uint32_t srslte_mod_bits_x_symbol(srslte_mod_t mod); SRSLTE_API uint32_t srslte_mod_bits_x_symbol(srslte_mod_t mod);
SRSLTE_API int srslte_band_get_band(uint32_t earfcn);
SRSLTE_API float srslte_band_fd(uint32_t earfcn); SRSLTE_API float srslte_band_fd(uint32_t earfcn);
SRSLTE_API float srslte_band_fu(uint32_t earfcn);
SRSLTE_API int srslte_band_get_fd_band(uint32_t band, SRSLTE_API int srslte_band_get_fd_band(uint32_t band,
srslte_earfcn_t *earfcn, srslte_earfcn_t *earfcn,
int earfcn_start, int earfcn_start,

@ -372,39 +372,40 @@ struct lte_band {
float fd_low_mhz; float fd_low_mhz;
uint32_t earfcn_offset; uint32_t earfcn_offset;
uint32_t earfcn_max; uint32_t earfcn_max;
float duplex_mhz;
enum band_geographical_area area; enum band_geographical_area area;
}; };
struct lte_band lte_bands[SRSLTE_NOF_LTE_BANDS] = { struct lte_band lte_bands[SRSLTE_NOF_LTE_BANDS] = {
{1, 2110, 0, 599, SRSLTE_BAND_GEO_AREA_ALL}, {1, 2110, 0, 599, 190, SRSLTE_BAND_GEO_AREA_ALL},
{2, 1930, 600, 1199, SRSLTE_BAND_GEO_AREA_NAR}, {2, 1930, 600, 1199, 80, SRSLTE_BAND_GEO_AREA_NAR},
{3, 1805, 1200, 1949, SRSLTE_BAND_GEO_AREA_ALL}, {3, 1805, 1200, 1949, 95, SRSLTE_BAND_GEO_AREA_ALL},
{4, 2110, 1950, 2399, SRSLTE_BAND_GEO_AREA_NAR}, {4, 2110, 1950, 2399, 400, SRSLTE_BAND_GEO_AREA_NAR},
{5, 869, 2400, 2649, SRSLTE_BAND_GEO_AREA_NAR}, {5, 869, 2400, 2649, 45, SRSLTE_BAND_GEO_AREA_NAR},
{6, 875, 2650, 2749, SRSLTE_BAND_GEO_AREA_APAC}, {6, 875, 2650, 2749, 45, SRSLTE_BAND_GEO_AREA_APAC},
{7, 2620, 2750, 3449, SRSLTE_BAND_GEO_AREA_EMEA}, {7, 2620, 2750, 3449, 120, SRSLTE_BAND_GEO_AREA_EMEA},
{8, 925, 3450, 3799, SRSLTE_BAND_GEO_AREA_ALL}, {8, 925, 3450, 3799, 45, SRSLTE_BAND_GEO_AREA_ALL},
{9, 1844.9, 3800, 4149, SRSLTE_BAND_GEO_AREA_APAC}, {9, 1844.9, 3800, 4149, 95, SRSLTE_BAND_GEO_AREA_APAC},
{10, 2110, 4150, 4749, SRSLTE_BAND_GEO_AREA_NAR}, {10, 2110, 4150, 4749, 400, SRSLTE_BAND_GEO_AREA_NAR},
{11, 1475.9, 4750, 4949, SRSLTE_BAND_GEO_AREA_JAPAN}, {11, 1475.9, 4750, 4949, 48, SRSLTE_BAND_GEO_AREA_JAPAN},
{12, 729, 5010, 5179, SRSLTE_BAND_GEO_AREA_NAR}, {12, 729, 5010, 5179, 30, SRSLTE_BAND_GEO_AREA_NAR},
{13, 746, 5180, 5279, SRSLTE_BAND_GEO_AREA_NAR}, {13, 746, 5180, 5279, -31, SRSLTE_BAND_GEO_AREA_NAR},
{14, 758, 5280, 5379, SRSLTE_BAND_GEO_AREA_NAR}, {14, 758, 5280, 5379, -30, SRSLTE_BAND_GEO_AREA_NAR},
{17, 734, 5730, 5849, SRSLTE_BAND_GEO_AREA_NAR}, {17, 734, 5730, 5849, 30, SRSLTE_BAND_GEO_AREA_NAR},
{18, 860, 5850, 5999, SRSLTE_BAND_GEO_AREA_JAPAN}, {18, 860, 5850, 5999, 45, SRSLTE_BAND_GEO_AREA_JAPAN},
{19, 875, 6000, 6149, SRSLTE_BAND_GEO_AREA_JAPAN}, {19, 875, 6000, 6149, 45, SRSLTE_BAND_GEO_AREA_JAPAN},
{20, 791, 6150, 6449, SRSLTE_BAND_GEO_AREA_EMEA}, {20, 791, 6150, 6449, -41, SRSLTE_BAND_GEO_AREA_EMEA},
{21, 1495.9, 6450, 6599, SRSLTE_BAND_GEO_AREA_JAPAN}, {21, 1495.9, 6450, 6599, 48, SRSLTE_BAND_GEO_AREA_JAPAN},
{22, 3500, 6600, 7399, SRSLTE_BAND_GEO_AREA_NA}, {22, 3500, 6600, 7399, 100, SRSLTE_BAND_GEO_AREA_NA},
{23, 2180, 7500, 7699, SRSLTE_BAND_GEO_AREA_NAR}, {23, 2180, 7500, 7699, 180, SRSLTE_BAND_GEO_AREA_NAR},
{24, 1525, 7700, 8039, SRSLTE_BAND_GEO_AREA_NAR}, {24, 1525, 7700, 8039, -101.5, SRSLTE_BAND_GEO_AREA_NAR},
{25, 1930, 8040, 8689, SRSLTE_BAND_GEO_AREA_NAR}, {25, 1930, 8040, 8689, 80, SRSLTE_BAND_GEO_AREA_NAR},
{26, 859, 8690, 9039, SRSLTE_BAND_GEO_AREA_NAR}, {26, 859, 8690, 9039, 45, SRSLTE_BAND_GEO_AREA_NAR},
{27, 852, 9040, 9209, SRSLTE_BAND_GEO_AREA_NAR}, {27, 852, 9040, 9209, 45, SRSLTE_BAND_GEO_AREA_NAR},
{28, 758, 9210, 9659, SRSLTE_BAND_GEO_AREA_APAC}, {28, 758, 9210, 9659, 55, SRSLTE_BAND_GEO_AREA_APAC},
{29, 717, 9660, 9769, SRSLTE_BAND_GEO_AREA_NAR}, {29, 717, 9660, 9769, 0, SRSLTE_BAND_GEO_AREA_NAR},
{30, 2350, 9770, 9869, SRSLTE_BAND_GEO_AREA_NAR}, {30, 2350, 9770, 9869, 45, SRSLTE_BAND_GEO_AREA_NAR},
{31, 462.5, 9870, 9919, SRSLTE_BAND_GEO_AREA_CALA} {31, 462.5, 9870, 9919, 10, SRSLTE_BAND_GEO_AREA_CALA}
}; };
#define EOF_BAND 9919 #define EOF_BAND 9919
@ -429,7 +430,7 @@ float get_fd(struct lte_band *band, uint32_t earfcn) {
} }
} }
float srslte_band_fd(uint32_t earfcn) { int srslte_band_get_band(uint32_t earfcn) {
uint32_t i; uint32_t i;
i=0; i=0;
while(i < SRSLTE_NOF_LTE_BANDS && lte_bands[i].earfcn_offset<earfcn) { while(i < SRSLTE_NOF_LTE_BANDS && lte_bands[i].earfcn_offset<earfcn) {
@ -437,11 +438,28 @@ float srslte_band_fd(uint32_t earfcn) {
} }
if (i == SRSLTE_NOF_LTE_BANDS) { if (i == SRSLTE_NOF_LTE_BANDS) {
fprintf(stderr, "Error: EARFCN %d not found\n", earfcn); fprintf(stderr, "Error: EARFCN %d not found\n", earfcn);
return -1.0; return -1;
}
return lte_bands[i].band;
}
float srslte_band_fd(uint32_t earfcn) {
uint32_t i = SRSLTE_NOF_LTE_BANDS-1;
while(i > 0 && lte_bands[i].earfcn_offset>earfcn) {
i--;
} }
return get_fd(&lte_bands[i], earfcn); return get_fd(&lte_bands[i], earfcn);
} }
float srslte_band_fu(uint32_t earfcn) {
uint32_t i = SRSLTE_NOF_LTE_BANDS-1;
while(i > 0 && lte_bands[i].earfcn_offset>earfcn) {
i--;
}
return get_fd(&lte_bands[i], earfcn) - lte_bands[i].duplex_mhz;
}
int srslte_band_get_fd_band_all(uint32_t band, srslte_earfcn_t *earfcn, uint32_t max_elems) { int srslte_band_get_fd_band_all(uint32_t band, srslte_earfcn_t *earfcn, uint32_t max_elems) {
return srslte_band_get_fd_band(band, earfcn, -1, -1, max_elems); return srslte_band_get_fd_band(band, earfcn, -1, -1, max_elems);
} }

@ -250,8 +250,8 @@ void srslte_pbch_free(srslte_pbch_t *q) {
void srslte_pbch_mib_unpack(uint8_t *msg, srslte_cell_t *cell, uint32_t *sfn) { void srslte_pbch_mib_unpack(uint8_t *msg, srslte_cell_t *cell, uint32_t *sfn) {
int phich_res; int phich_res;
cell->bw_idx = srslte_bit_pack(&msg, 3); uint32_t bw_idx = srslte_bit_pack(&msg, 3);
switch (cell->bw_idx) { switch (bw_idx) {
case 0: case 0:
cell->nof_prb = 6; cell->nof_prb = 6;
break; break;
@ -259,7 +259,7 @@ void srslte_pbch_mib_unpack(uint8_t *msg, srslte_cell_t *cell, uint32_t *sfn) {
cell->nof_prb = 15; cell->nof_prb = 15;
break; break;
default: default:
cell->nof_prb = (cell->bw_idx - 1) * 25; cell->nof_prb = (bw_idx - 1) * 25;
break; break;
} }
if (*msg) { if (*msg) {

Loading…
Cancel
Save