From 1adfc16e1de51f4e9e7da3da039f30a611c53565 Mon Sep 17 00:00:00 2001 From: ismagom Date: Fri, 17 Oct 2014 20:44:01 +0200 Subject: [PATCH] Changed char for bits to uint8_t --- cmake/modules/CheckFunctionExists.c | 6 +-- lte/phy/examples/cell_measurement.c | 4 +- lte/phy/examples/hl_example.c | 2 +- lte/phy/examples/ll_example.c | 2 +- lte/phy/examples/pdsch_enodeb.c | 4 +- lte/phy/examples/pdsch_ue.c | 2 +- lte/phy/include/liblte/phy/common/sequence.h | 2 +- lte/phy/include/liblte/phy/fec/convcoder.h | 6 +-- lte/phy/include/liblte/phy/fec/crc.h | 10 ++-- lte/phy/include/liblte/phy/fec/rm_conv.h | 6 +-- lte/phy/include/liblte/phy/fec/rm_turbo.h | 8 ++-- lte/phy/include/liblte/phy/fec/turbocoder.h | 2 +- lte/phy/include/liblte/phy/fec/turbodecoder.h | 4 +- lte/phy/include/liblte/phy/fec/viterbi.h | 14 +++--- lte/phy/include/liblte/phy/io/binsource.h | 12 ++--- lte/phy/include/liblte/phy/modem/demod_hard.h | 4 +- lte/phy/include/liblte/phy/modem/mod.h | 4 +- lte/phy/include/liblte/phy/phch/dci.h | 2 +- lte/phy/include/liblte/phy/phch/pbch.h | 6 +-- lte/phy/include/liblte/phy/phch/pcfich.h | 2 +- lte/phy/include/liblte/phy/phch/pdcch.h | 2 +- lte/phy/include/liblte/phy/phch/pdsch.h | 8 ++-- lte/phy/include/liblte/phy/phch/phich.h | 6 +-- .../liblte/phy/scrambling/scrambling.h | 6 +-- lte/phy/include/liblte/phy/ue/ue_celldetect.h | 2 +- lte/phy/include/liblte/phy/ue/ue_dl.h | 2 +- lte/phy/include/liblte/phy/utils/bit.h | 8 ++-- lte/phy/include/liblte/phy/utils/pack.h | 9 +++- lte/phy/include/liblte/phy/utils/vector.h | 10 ++-- lte/phy/lib/ch_estimation/src/refsignal.c | 2 +- .../lib/ch_estimation/test/chest_test_ul.c | 2 +- lte/phy/lib/common/src/sequence.c | 2 +- lte/phy/lib/fec/src/convcoder.c | 4 +- lte/phy/lib/fec/src/crc.c | 24 +++++----- lte/phy/lib/fec/src/rm_conv.c | 4 +- lte/phy/lib/fec/src/rm_turbo.c | 2 +- lte/phy/lib/fec/src/tc_interl_umts.c | 2 +- lte/phy/lib/fec/src/turbocoder.c | 8 ++-- lte/phy/lib/fec/src/turbodecoder.c | 4 +- lte/phy/lib/fec/src/viterbi.c | 16 +++---- lte/phy/lib/fec/src/viterbi37.h | 4 +- lte/phy/lib/fec/src/viterbi37_port.c | 8 ++-- lte/phy/lib/fec/src/viterbi39.h | 2 +- lte/phy/lib/fec/src/viterbi39_port.c | 8 ++-- lte/phy/lib/fec/test/crc_test.c | 14 +++--- lte/phy/lib/fec/test/crc_test.h | 8 ++-- lte/phy/lib/fec/test/rm_conv_test.c | 6 +-- lte/phy/lib/fec/test/rm_turbo_test.c | 8 ++-- lte/phy/lib/fec/test/turbocoder_test.c | 14 +++--- lte/phy/lib/fec/test/turbocoder_test.h | 8 ++-- lte/phy/lib/fec/test/viterbi_test.c | 18 +++---- lte/phy/lib/fec/test/viterbi_test.h | 4 +- lte/phy/lib/io/src/binsource.c | 8 ++-- lte/phy/lib/modem/src/demod_hard.c | 2 +- lte/phy/lib/modem/src/hard_demod_lte.c | 16 +++---- lte/phy/lib/modem/src/hard_demod_lte.h | 8 ++-- lte/phy/lib/modem/src/mod.c | 4 +- lte/phy/lib/modem/test/modem_test.c | 6 +-- lte/phy/lib/modem/test/soft_demod_test.c | 6 +-- lte/phy/lib/phch/src/dci.c | 16 +++---- lte/phy/lib/phch/src/pbch.c | 18 +++---- lte/phy/lib/phch/src/pcfich.c | 8 ++-- lte/phy/lib/phch/src/pdcch.c | 16 +++---- lte/phy/lib/phch/src/pdsch.c | 48 +++++++++---------- lte/phy/lib/phch/src/phich.c | 12 ++--- lte/phy/lib/phch/src/regs.c | 2 +- lte/phy/lib/phch/test/dci_unpacking.c | 4 +- lte/phy/lib/phch/test/pdsch_file_test.c | 2 +- lte/phy/lib/phch/test/pdsch_test.c | 4 +- lte/phy/lib/phch/test/phich_file_test.c | 2 +- lte/phy/lib/phch/test/phich_test.c | 2 +- lte/phy/lib/scrambling/src/scrambling.c | 6 +-- lte/phy/lib/scrambling/test/scrambling_test.c | 6 +-- lte/phy/lib/ue/src/ue_celldetect.c | 2 +- lte/phy/lib/ue/src/ue_dl.c | 2 +- lte/phy/lib/ue/src/ue_sync.c | 2 +- lte/phy/lib/utils/src/bit.c | 12 ++--- lte/phy/lib/utils/src/dft.c | 8 ++-- lte/phy/lib/utils/src/mux.c | 10 ++-- lte/phy/lib/utils/src/pack.c | 8 ++-- lte/phy/lib/utils/src/vector.c | 10 ++-- lte/rrc/asn/INTEGER.c | 2 +- lte/rrc/asn/per_support.c | 2 +- lte/rrc/asn/xer_decoder.c | 2 +- 84 files changed, 294 insertions(+), 289 deletions(-) diff --git a/cmake/modules/CheckFunctionExists.c b/cmake/modules/CheckFunctionExists.c index 9fdea2866..1fbdf9c53 100644 --- a/cmake/modules/CheckFunctionExists.c +++ b/cmake/modules/CheckFunctionExists.c @@ -1,12 +1,12 @@ #ifdef CHECK_FUNCTION_EXISTS -char CHECK_FUNCTION_EXISTS(); +uint8_t CHECK_FUNCTION_EXISTS(); #ifdef __CLASSIC_C__ int main(){ int ac; - char*av[]; + uint8_t*av[]; #else -int main(int ac, char*av[]){ +int main(int ac, uint8_t*av[]){ #endif float ac2 = sqrtf(rand()); diff --git a/lte/phy/examples/cell_measurement.c b/lte/phy/examples/cell_measurement.c index 1e2baf724..4e01b0262 100644 --- a/lte/phy/examples/cell_measurement.c +++ b/lte/phy/examples/cell_measurement.c @@ -105,7 +105,7 @@ void parse_args(prog_args_t *args, int argc, char **argv) { /**********************************************************************/ /* TODO: Do something with the output data */ -char data[10000]; +uint8_t data[10000]; int cuhd_recv_wrapper(void *h, void *data, uint32_t nsamples) { DEBUG(" ---- Receive %d samples ---- \n", nsamples); @@ -167,7 +167,7 @@ int main(int argc, char **argv) { int sf_re = SF_LEN_RE(cell.nof_prb, cell.cp); cf_t *sf_symbols = vec_malloc(sf_re * sizeof(cf_t)); - unsigned int nframes=0; + uint32_t nframes=0; /* Main loop */ while (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1) { diff --git a/lte/phy/examples/hl_example.c b/lte/phy/examples/hl_example.c index 2d0aa1734..1e5541265 100644 --- a/lte/phy/examples/hl_example.c +++ b/lte/phy/examples/hl_example.c @@ -103,7 +103,7 @@ int main(int argc, char **argv) { demod_soft_work(&demod_s); /* hard decision for soft demodulation */ - char* tmp = malloc(nbits); + uint8_t* tmp = malloc(nbits); for (int i=0;i0?1:0; } diff --git a/lte/phy/examples/ll_example.c b/lte/phy/examples/ll_example.c index fc9fec359..e5e1b023e 100644 --- a/lte/phy/examples/ll_example.c +++ b/lte/phy/examples/ll_example.c @@ -33,7 +33,7 @@ int main(int argc, char **argv) { binsource_t bs; - char* output; + uint8_t* output; binsource_init(&bs); binsource_seed_time(&bs); diff --git a/lte/phy/examples/pdsch_enodeb.c b/lte/phy/examples/pdsch_enodeb.c index b0b9ffc95..2e1660e54 100644 --- a/lte/phy/examples/pdsch_enodeb.c +++ b/lte/phy/examples/pdsch_enodeb.c @@ -241,7 +241,7 @@ int main(int argc, char **argv) { ra_prb_t prb_alloc; refsignal_t refs[NSLOTS_X_FRAME]; int i, n; - char *data; + uint8_t *data; cf_t *sf_symbols[MAX_PORTS]; dci_msg_t dci_msg; dci_location_t locations[NSUBFRAMES_X_FRAME][10]; @@ -315,7 +315,7 @@ int main(int argc, char **argv) { pdcch_ue_locations(&pdcch, locations[i], 10, i, cfi, 1234); } - data = malloc(sizeof(char) * ra_dl.mcs.tbs); + data = malloc(sizeof(uint8_t) * ra_dl.mcs.tbs); if (!data) { perror("malloc"); exit(-1); diff --git a/lte/phy/examples/pdsch_ue.c b/lte/phy/examples/pdsch_ue.c index 07d3dae32..f1949ad50 100644 --- a/lte/phy/examples/pdsch_ue.c +++ b/lte/phy/examples/pdsch_ue.c @@ -159,7 +159,7 @@ void sigintHandler(int x) { } /* TODO: Do something with the output data */ -char data[10000]; +uint8_t data[10000]; extern float mean_exec_time; diff --git a/lte/phy/include/liblte/phy/common/sequence.h b/lte/phy/include/liblte/phy/common/sequence.h index a3dae142b..183d5cddc 100644 --- a/lte/phy/include/liblte/phy/common/sequence.h +++ b/lte/phy/include/liblte/phy/common/sequence.h @@ -32,7 +32,7 @@ #include "liblte/phy/common/phy_common.h" typedef struct LIBLTE_API { - char *c; + uint8_t *c; uint32_t len; } sequence_t; diff --git a/lte/phy/include/liblte/phy/fec/convcoder.h b/lte/phy/include/liblte/phy/fec/convcoder.h index 38dd5857d..0c1a9481e 100644 --- a/lte/phy/include/liblte/phy/fec/convcoder.h +++ b/lte/phy/include/liblte/phy/fec/convcoder.h @@ -40,7 +40,7 @@ typedef struct LIBLTE_API { bool tail_biting; }convcoder_t; -LIBLTE_API int convcoder_encode(convcoder_t *q, char *input, char *output, uint32_t frame_length); +LIBLTE_API int convcoder_encode(convcoder_t *q, uint8_t *input, uint8_t *output, uint32_t frame_length); /* High-level API */ @@ -55,9 +55,9 @@ typedef struct LIBLTE_API { int generator_2; int frame_length; } ctrl_in; - char *input; + uint8_t *input; int in_len; - char *output; + uint8_t *output; int out_len; }convcoder_hl; diff --git a/lte/phy/include/liblte/phy/fec/crc.h b/lte/phy/include/liblte/phy/fec/crc.h index e9d148a52..54f9ede4d 100644 --- a/lte/phy/include/liblte/phy/fec/crc.h +++ b/lte/phy/include/liblte/phy/fec/crc.h @@ -34,18 +34,18 @@ typedef struct LIBLTE_API { unsigned long table[256]; - unsigned char byte; + uint8_t byte; int polynom; int order; unsigned long crcinit; unsigned long crcmask; unsigned long crchighbit; - unsigned int crc_out; + uint32_t crc_out; } crc_t; -LIBLTE_API int crc_init(crc_t *h, unsigned int crc_poly, int crc_order); +LIBLTE_API int crc_init(crc_t *h, uint32_t crc_poly, int crc_order); LIBLTE_API int crc_set_init(crc_t *h, unsigned long crc_init_value); -LIBLTE_API void crc_attach(crc_t *h, char *data, int len); -LIBLTE_API uint32_t crc_checksum(crc_t *h, char *data, int len); +LIBLTE_API void crc_attach(crc_t *h, uint8_t *data, int len); +LIBLTE_API uint32_t crc_checksum(crc_t *h, uint8_t *data, int len); #endif diff --git a/lte/phy/include/liblte/phy/fec/rm_conv.h b/lte/phy/include/liblte/phy/fec/rm_conv.h index 6a37177b0..102d04640 100644 --- a/lte/phy/include/liblte/phy/fec/rm_conv.h +++ b/lte/phy/include/liblte/phy/fec/rm_conv.h @@ -33,9 +33,9 @@ #define RX_NULL 10000 #define TX_NULL 80 -LIBLTE_API int rm_conv_tx(char *input, +LIBLTE_API int rm_conv_tx(uint8_t *input, uint32_t in_len, - char *output, + uint8_t *output, uint32_t out_len); LIBLTE_API int rm_conv_rx(float *input, @@ -49,7 +49,7 @@ typedef struct struct rm_conv_init { int direction; } init; - void *input; // input type may be char or float depending on hard + void *input; // input type may be uint8_t or float depending on hard int in_len; struct rm_conv_ctrl_in { int E; diff --git a/lte/phy/include/liblte/phy/fec/rm_turbo.h b/lte/phy/include/liblte/phy/fec/rm_turbo.h index 0b5fad70e..d8550517d 100644 --- a/lte/phy/include/liblte/phy/fec/rm_turbo.h +++ b/lte/phy/include/liblte/phy/fec/rm_turbo.h @@ -41,11 +41,11 @@ #include "liblte/config.h" -LIBLTE_API int rm_turbo_tx(char *w_buff, +LIBLTE_API int rm_turbo_tx(uint8_t *w_buff, uint32_t buff_len, - char *input, + uint8_t *input, uint32_t in_len, - char *output, + uint8_t *output, uint32_t out_len, uint32_t rv_idx); @@ -63,7 +63,7 @@ typedef struct LIBLTE_API { struct rm_turbo_init { int direction; } init; - void *input; // input type may be char or float depending on hard + void *input; // input type may be uint8_t or float depending on hard int in_len; struct rm_turbo_ctrl_in { int E; diff --git a/lte/phy/include/liblte/phy/fec/turbocoder.h b/lte/phy/include/liblte/phy/fec/turbocoder.h index af272e223..e78eaf85e 100644 --- a/lte/phy/include/liblte/phy/fec/turbocoder.h +++ b/lte/phy/include/liblte/phy/fec/turbocoder.h @@ -43,7 +43,7 @@ typedef struct LIBLTE_API { LIBLTE_API int tcod_init(tcod_t *h, uint32_t max_long_cb); LIBLTE_API void tcod_free(tcod_t *h); -LIBLTE_API int tcod_encode(tcod_t *h, char *input, char *output, uint32_t long_cb); +LIBLTE_API int tcod_encode(tcod_t *h, uint8_t *input, uint8_t *output, uint32_t long_cb); #endif diff --git a/lte/phy/include/liblte/phy/fec/turbodecoder.h b/lte/phy/include/liblte/phy/fec/turbodecoder.h index 178f51956..9f4b9ea6c 100644 --- a/lte/phy/include/liblte/phy/fec/turbodecoder.h +++ b/lte/phy/include/liblte/phy/fec/turbodecoder.h @@ -80,12 +80,12 @@ LIBLTE_API void tdec_iteration(tdec_t * h, uint32_t long_cb); LIBLTE_API void tdec_decision(tdec_t * h, - char *output, + uint8_t *output, uint32_t long_cb); LIBLTE_API void tdec_run_all(tdec_t * h, llr_t * input, - char *output, + uint8_t *output, uint32_t nof_iterations, uint32_t long_cb); diff --git a/lte/phy/include/liblte/phy/fec/viterbi.h b/lte/phy/include/liblte/phy/fec/viterbi.h index a94c58e19..e3d8a9f59 100644 --- a/lte/phy/include/liblte/phy/fec/viterbi.h +++ b/lte/phy/include/liblte/phy/fec/viterbi.h @@ -40,13 +40,13 @@ typedef struct LIBLTE_API{ void *ptr; uint32_t R; uint32_t K; - unsigned int framebits; + uint32_t framebits; bool tail_biting; uint32_t poly[3]; - int (*decode) (void*, uint8_t*, char*, uint32_t); + int (*decode) (void*, uint8_t*, uint8_t*, uint32_t); void (*free) (void*); - unsigned char *tmp; - unsigned char *symbols_uc; + uint8_t *tmp; + uint8_t *symbols_uc; }viterbi_t; LIBLTE_API int viterbi_init(viterbi_t *q, @@ -59,12 +59,12 @@ LIBLTE_API void viterbi_free(viterbi_t *q); LIBLTE_API int viterbi_decode_f(viterbi_t *q, float *symbols, - char *data, + uint8_t *data, uint32_t frame_length); LIBLTE_API int viterbi_decode_uc(viterbi_t *q, uint8_t *symbols, - char *data, + uint8_t *data, uint32_t frame_length); @@ -82,7 +82,7 @@ typedef struct LIBLTE_API{ } init; float *input; int in_len; - char *output; + uint8_t *output; int out_len; }viterbi_hl; diff --git a/lte/phy/include/liblte/phy/io/binsource.h b/lte/phy/include/liblte/phy/io/binsource.h index 7e5a06ddf..475d6c221 100644 --- a/lte/phy/include/liblte/phy/io/binsource.h +++ b/lte/phy/include/liblte/phy/io/binsource.h @@ -35,7 +35,7 @@ /* Low-level API */ typedef struct LIBLTE_API{ - unsigned int seed; + uint32_t seed; uint32_t *seq_buff; int seq_buff_nwords; int seq_cache_nbits; @@ -44,23 +44,23 @@ typedef struct LIBLTE_API{ LIBLTE_API void binsource_init(binsource_t* q); LIBLTE_API void binsource_free(binsource_t* q); -LIBLTE_API void binsource_seed_set(binsource_t* q, unsigned int seed); +LIBLTE_API void binsource_seed_set(binsource_t* q, uint32_t seed); LIBLTE_API void binsource_seed_time(binsource_t *q); LIBLTE_API int binsource_cache_gen(binsource_t* q, int nbits); -LIBLTE_API void binsource_cache_cpy(binsource_t* q, char *bits, int nbits); -LIBLTE_API int binsource_generate(binsource_t* q, char *bits, int nbits); +LIBLTE_API void binsource_cache_cpy(binsource_t* q, uint8_t *bits, int nbits); +LIBLTE_API int binsource_generate(binsource_t* q, uint8_t *bits, int nbits); /* High-level API */ typedef struct LIBLTE_API { binsource_t obj; struct binsource_init { int cache_seq_nbits; // If non-zero, generates random bits on init - unsigned int seed; // If non-zero, uses as random seed, otherwise local time is used. + uint32_t seed; // If non-zero, uses as random seed, otherwise local time is used. } init; struct binsource_ctrl_in { int nbits; // Number of bits to generate } ctrl_in; - char* output; + uint8_t* output; int out_len; }binsource_hl; diff --git a/lte/phy/include/liblte/phy/modem/demod_hard.h b/lte/phy/include/liblte/phy/modem/demod_hard.h index 51f5b6c53..d10a230c3 100644 --- a/lte/phy/include/liblte/phy/modem/demod_hard.h +++ b/lte/phy/include/liblte/phy/modem/demod_hard.h @@ -44,7 +44,7 @@ typedef struct LIBLTE_API { LIBLTE_API void demod_hard_init(demod_hard_t* q); LIBLTE_API void demod_hard_table_set(demod_hard_t* q, lte_mod_t mod); -LIBLTE_API int demod_hard_demodulate(demod_hard_t* q, cf_t* symbols, char *bits, uint32_t nsymbols); +LIBLTE_API int demod_hard_demodulate(demod_hard_t* q, cf_t* symbols, uint8_t *bits, uint32_t nsymbols); @@ -58,7 +58,7 @@ typedef struct LIBLTE_API { cf_t* input; int in_len; - char* output; + uint8_t* output; int out_len; }demod_hard_hl; diff --git a/lte/phy/include/liblte/phy/modem/mod.h b/lte/phy/include/liblte/phy/modem/mod.h index 8ee5defc8..c8c64ad43 100644 --- a/lte/phy/include/liblte/phy/modem/mod.h +++ b/lte/phy/include/liblte/phy/modem/mod.h @@ -37,7 +37,7 @@ typedef _Complex float cf_t; -LIBLTE_API int mod_modulate(modem_table_t* table, const char *bits, cf_t* symbols, uint32_t nbits); +LIBLTE_API int mod_modulate(modem_table_t* table, const uint8_t *bits, cf_t* symbols, uint32_t nbits); /* High-level API */ typedef struct LIBLTE_API { @@ -46,7 +46,7 @@ typedef struct LIBLTE_API { lte_mod_t std; // symbol mapping standard (see modem_table.h) } init; - const char* input; + const uint8_t* input; int in_len; cf_t* output; diff --git a/lte/phy/include/liblte/phy/phch/dci.h b/lte/phy/include/liblte/phy/phch/dci.h index be57914c0..66e166571 100644 --- a/lte/phy/include/liblte/phy/phch/dci.h +++ b/lte/phy/include/liblte/phy/phch/dci.h @@ -67,7 +67,7 @@ typedef struct LIBLTE_API { } dci_location_t; typedef struct LIBLTE_API { - char data[DCI_MAX_BITS]; + uint8_t data[DCI_MAX_BITS]; uint32_t nof_bits; } dci_msg_t; diff --git a/lte/phy/include/liblte/phy/phch/pbch.h b/lte/phy/include/liblte/phy/phch/pbch.h index e8a79b513..22b7bb106 100644 --- a/lte/phy/include/liblte/phy/phch/pbch.h +++ b/lte/phy/include/liblte/phy/phch/pbch.h @@ -68,9 +68,9 @@ typedef struct LIBLTE_API { float *pbch_llr; float *temp; float *pbch_rm_f; - char *pbch_rm_b; - char *data; - char *data_enc; + uint8_t *pbch_rm_b; + uint8_t *data; + uint8_t *data_enc; uint32_t frame_idx; diff --git a/lte/phy/include/liblte/phy/phch/pcfich.h b/lte/phy/include/liblte/phy/phch/pcfich.h index 80ad465f9..cbbf84bf1 100644 --- a/lte/phy/include/liblte/phy/phch/pcfich.h +++ b/lte/phy/include/liblte/phy/phch/pcfich.h @@ -58,7 +58,7 @@ typedef struct LIBLTE_API { cf_t pcfich_d[PCFICH_RE]; /* bit message */ - char data[PCFICH_CFI_LEN]; + uint8_t data[PCFICH_CFI_LEN]; /* tx & rx objects */ modem_table_t mod; diff --git a/lte/phy/include/liblte/phy/phch/pdcch.h b/lte/phy/include/liblte/phy/phch/pdcch.h index f15dd1519..d854dacf4 100644 --- a/lte/phy/include/liblte/phy/phch/pdcch.h +++ b/lte/phy/include/liblte/phy/phch/pdcch.h @@ -65,7 +65,7 @@ typedef struct LIBLTE_API { cf_t *pdcch_symbols[MAX_PORTS]; cf_t *pdcch_x[MAX_PORTS]; cf_t *pdcch_d; - char *pdcch_e; + uint8_t *pdcch_e; float *pdcch_llr; /* tx & rx objects */ diff --git a/lte/phy/include/liblte/phy/phch/pdsch.h b/lte/phy/include/liblte/phy/phch/pdsch.h index 173837b98..fc7b4b0c9 100644 --- a/lte/phy/include/liblte/phy/phch/pdsch.h +++ b/lte/phy/include/liblte/phy/phch/pdsch.h @@ -55,7 +55,7 @@ typedef struct LIBLTE_API { uint32_t max_cb; uint32_t w_buff_size; float **pdsch_w_buff_f; - char **pdsch_w_buff_c; + uint8_t **pdsch_w_buff_c; struct cb_segm { uint32_t F; @@ -85,7 +85,7 @@ typedef struct LIBLTE_API { cf_t *pdsch_symbols[MAX_PORTS]; cf_t *pdsch_x[MAX_PORTS]; cf_t *pdsch_d; - char *cb_in; + uint8_t *cb_in; void *cb_out; void *pdsch_e; @@ -117,7 +117,7 @@ LIBLTE_API int pdsch_harq_setup(pdsch_harq_t *p, LIBLTE_API void pdsch_harq_free(pdsch_harq_t *p); LIBLTE_API int pdsch_encode(pdsch_t *q, - char *data, + uint8_t *data, cf_t *sf_symbols[MAX_PORTS], uint32_t nsubframe, pdsch_harq_t *harq_process, @@ -126,7 +126,7 @@ LIBLTE_API int pdsch_encode(pdsch_t *q, LIBLTE_API int pdsch_decode(pdsch_t *q, cf_t *sf_symbols, cf_t *ce[MAX_PORTS], - char *data, + uint8_t *data, uint32_t nsubframe, pdsch_harq_t *harq_process, uint32_t rv_idx); diff --git a/lte/phy/include/liblte/phy/phch/phich.h b/lte/phy/include/liblte/phy/phch/phich.h index dbe68dfea..845794e97 100644 --- a/lte/phy/include/liblte/phy/phch/phich.h +++ b/lte/phy/include/liblte/phy/phch/phich.h @@ -69,7 +69,7 @@ typedef struct LIBLTE_API { cf_t phich_z[PHICH_NBITS]; /* bit message */ - char data[PHICH_NBITS]; + uint8_t data[PHICH_NBITS]; /* tx & rx objects */ modem_table_t mod; @@ -90,11 +90,11 @@ LIBLTE_API int phich_decode(phich_t *q, uint32_t ngroup, uint32_t nseq, uint32_t nsubframe, - char *ack, + uint8_t *ack, uint32_t *distance); LIBLTE_API int phich_encode(phich_t *q, - char ack, + uint8_t ack, uint32_t ngroup, uint32_t nseq, uint32_t nsubframe, diff --git a/lte/phy/include/liblte/phy/scrambling/scrambling.h b/lte/phy/include/liblte/phy/scrambling/scrambling.h index 0a1323bef..70e1560d3 100644 --- a/lte/phy/include/liblte/phy/scrambling/scrambling.h +++ b/lte/phy/include/liblte/phy/scrambling/scrambling.h @@ -36,8 +36,8 @@ typedef _Complex float cf_t; /* Scrambling has no state */ -LIBLTE_API void scrambling_b(sequence_t *s, char *data); -LIBLTE_API void scrambling_b_offset(sequence_t *s, char *data, int offset, int len); +LIBLTE_API void scrambling_b(sequence_t *s, uint8_t *data); +LIBLTE_API void scrambling_b_offset(sequence_t *s, uint8_t *data, int offset, int len); LIBLTE_API void scrambling_f(sequence_t *s, float *data); LIBLTE_API void scrambling_f_offset(sequence_t *s, float *data, int offset, int len); @@ -71,7 +71,7 @@ typedef struct LIBLTE_API { int channel; int nof_symbols; // 7 normal 6 extended } init; - void *input; // input type may be char or float depending on hard + void *input; // input type may be uint8_t or float depending on hard int in_len; struct scrambling_ctrl_in { int subframe; diff --git a/lte/phy/include/liblte/phy/ue/ue_celldetect.h b/lte/phy/include/liblte/phy/ue/ue_celldetect.h index 3478ee02f..46984274d 100644 --- a/lte/phy/include/liblte/phy/ue/ue_celldetect.h +++ b/lte/phy/include/liblte/phy/ue/ue_celldetect.h @@ -88,7 +88,7 @@ typedef struct LIBLTE_API { uint32_t current_nof_total; uint32_t *mode_ntimes; - char *mode_counted; + uint8_t *mode_counted; ue_celldetect_result_t *candidates; } ue_celldetect_t; diff --git a/lte/phy/include/liblte/phy/ue/ue_dl.h b/lte/phy/include/liblte/phy/ue/ue_dl.h index e38d0ebf0..c60e49ae4 100644 --- a/lte/phy/include/liblte/phy/ue/ue_dl.h +++ b/lte/phy/include/liblte/phy/ue/ue_dl.h @@ -92,7 +92,7 @@ LIBLTE_API void ue_dl_free(ue_dl_t *q); LIBLTE_API int ue_dl_decode(ue_dl_t *q, cf_t *sf_buffer, - char *data, + uint8_t *data, uint32_t sf_idx, uint16_t rnti); diff --git a/lte/phy/include/liblte/phy/utils/bit.h b/lte/phy/include/liblte/phy/utils/bit.h index acfdbce3c..3100ccf95 100644 --- a/lte/phy/include/liblte/phy/utils/bit.h +++ b/lte/phy/include/liblte/phy/utils/bit.h @@ -34,10 +34,10 @@ #include "liblte/config.h" -LIBLTE_API uint32_t bit_unpack(char **bits, int nof_bits); -LIBLTE_API void bit_pack(uint32_t value, char **bits, int nof_bits); -LIBLTE_API void bit_fprint(FILE *stream, char *bits, int nof_bits); -LIBLTE_API unsigned int bit_diff(char *x, char *y, int nbits); +LIBLTE_API uint32_t bit_unpack(uint8_t **bits, int nof_bits); +LIBLTE_API void bit_pack(uint32_t value, uint8_t **bits, int nof_bits); +LIBLTE_API void bit_fprint(FILE *stream, uint8_t *bits, int nof_bits); +LIBLTE_API uint32_t bit_diff(uint8_t *x, uint8_t *y, int nbits); LIBLTE_API uint32_t bit_count(uint32_t n); #endif // BIT_ diff --git a/lte/phy/include/liblte/phy/utils/pack.h b/lte/phy/include/liblte/phy/utils/pack.h index cae0be966..73a5f9678 100644 --- a/lte/phy/include/liblte/phy/utils/pack.h +++ b/lte/phy/include/liblte/phy/utils/pack.h @@ -30,8 +30,13 @@ #define PACK_ #include "liblte/config.h" +#include -LIBLTE_API unsigned int unpack_bits(char **bits, int nof_bits); -LIBLTE_API void pack_bits(unsigned int value, char **bits, int nof_bits); +LIBLTE_API uint32_t unpack_bits(uint8_t **bits, + int nof_bits); + +LIBLTE_API void pack_bits(uint32_t value, + uint8_t **bits, + int nof_bits); #endif // PACK_ diff --git a/lte/phy/include/liblte/phy/utils/vector.h b/lte/phy/include/liblte/phy/utils/vector.h index a0e89471a..1bb679a53 100644 --- a/lte/phy/include/liblte/phy/utils/vector.h +++ b/lte/phy/include/liblte/phy/utils/vector.h @@ -53,15 +53,15 @@ LIBLTE_API void *vec_realloc(void *ptr, uint32_t old_size, uint32_t new_size); /* print vectors */ LIBLTE_API void vec_fprint_c(FILE *stream, cf_t *x, uint32_t len); LIBLTE_API void vec_fprint_f(FILE *stream, float *x, uint32_t len); -LIBLTE_API void vec_fprint_b(FILE *stream, char *x, uint32_t len); +LIBLTE_API void vec_fprint_b(FILE *stream, uint8_t *x, uint32_t len); LIBLTE_API void vec_fprint_i(FILE *stream, int *x, uint32_t len); -LIBLTE_API void vec_fprint_hex(FILE *stream, char *x, uint32_t len); +LIBLTE_API void vec_fprint_hex(FILE *stream, uint8_t *x, uint32_t len); /* Saves a vector to a file */ LIBLTE_API void vec_save_file(char *filename, void *buffer, uint32_t len); /* sum two vectors */ -LIBLTE_API void vec_sum_ch(char *x, char *y, char *z, uint32_t len); +LIBLTE_API void vec_sum_ch(uint8_t *x, uint8_t *y, char *z, uint32_t len); LIBLTE_API void vec_sum_ccc(cf_t *x, cf_t *y, cf_t *z, uint32_t len); /* substract two vectors z=x-y */ @@ -107,8 +107,8 @@ LIBLTE_API float vec_avg_power_cf(cf_t *x, uint32_t len); LIBLTE_API uint32_t vec_max_fi(float *x, uint32_t len); LIBLTE_API uint32_t vec_max_abs_ci(cf_t *x, uint32_t len); -/* quantify vector of floats and convert to unsigned char */ -LIBLTE_API void vec_quant_fuc(float *in, unsigned char *out, float gain, float offset, float clip, uint32_t len); +/* quantify vector of floats and convert to uint8_t */ +LIBLTE_API void vec_quant_fuc(float *in, uint8_t *out, float gain, float offset, float clip, uint32_t len); /* magnitude of each vector element */ LIBLTE_API void vec_abs_cf(cf_t *x, float *abs, uint32_t len); diff --git a/lte/phy/lib/ch_estimation/src/refsignal.c b/lte/phy/lib/ch_estimation/src/refsignal.c index bec652743..2002eb47a 100644 --- a/lte/phy/lib/ch_estimation/src/refsignal.c +++ b/lte/phy/lib/ch_estimation/src/refsignal.c @@ -238,7 +238,7 @@ int rs_sequence(ref_t * refs, uint32_t len, float alpha, uint32_t ns, uint32_t c } } if (len >= 3 * RE_X_RB) { - uint32_t n_sz; + uint32_t n_sz=0; uint32_t q; float q_hat; /* get largest prime n_zcc); } if (!q->c) { - q->c = malloc(len * sizeof(char)); + q->c = malloc(len * sizeof(uint8_t)); if (!q->c) { return LIBLTE_ERROR; } diff --git a/lte/phy/lib/fec/src/convcoder.c b/lte/phy/lib/fec/src/convcoder.c index 2153327ac..d62507f87 100644 --- a/lte/phy/lib/fec/src/convcoder.c +++ b/lte/phy/lib/fec/src/convcoder.c @@ -34,7 +34,7 @@ #include "liblte/phy/fec/convcoder.h" #include "parity.h" -int convcoder_encode(convcoder_t *q, char *input, char *output, uint32_t frame_length) { +int convcoder_encode(convcoder_t *q, uint8_t *input, uint8_t *output, uint32_t frame_length) { uint32_t sr; uint32_t i,j; uint32_t len = q->tail_biting ? frame_length : (frame_length + q->K - 1); @@ -53,7 +53,7 @@ int convcoder_encode(convcoder_t *q, char *input, char *output, uint32_t frame_l sr = 0; } for (i = 0; i < len; i++) { - char bit = (i < frame_length) ? (input[i] & 1) : 0; + uint8_t bit = (i < frame_length) ? (input[i] & 1) : 0; sr = (sr << 1) | bit; for (j=0;jR;j++) { output[q->R * i + j] = parity(sr & q->poly[j]); diff --git a/lte/phy/lib/fec/src/crc.c b/lte/phy/lib/fec/src/crc.c index c286c2f63..d252c6598 100644 --- a/lte/phy/lib/fec/src/crc.c +++ b/lte/phy/lib/fec/src/crc.c @@ -54,14 +54,14 @@ unsigned long crctable(crc_t *h) { // Polynom order 8, 16, 24 or 32 only. int ord = h->order - 8; unsigned long crc = h->crcinit; - unsigned char byte = h->byte; + uint8_t byte = h->byte; crc = (crc << 8) ^ h->table[((crc >> (ord)) & 0xff) ^ byte]; h->crcinit = crc; return (crc & h->crcmask); } -unsigned long reversecrcbit(unsigned int crc, int nbits, crc_t *h) { +unsigned long reversecrcbit(uint32_t crc, int nbits, crc_t *h) { unsigned long m, rmask = 0x1; @@ -84,7 +84,7 @@ int crc_set_init(crc_t *crc_par, unsigned long crc_init_value) { return 0; } -int crc_init(crc_t *h, unsigned int crc_poly, int crc_order) { +int crc_init(crc_t *h, uint32_t crc_poly, int crc_order) { // Set crc working default parameters h->polynom = crc_poly; @@ -114,10 +114,10 @@ int crc_init(crc_t *h, unsigned int crc_poly, int crc_order) { return 0; } -uint32_t crc_checksum(crc_t *h, char *data, int len) { +uint32_t crc_checksum(crc_t *h, uint8_t *data, int len) { int i, k, len8, res8, a = 0; - unsigned int crc = 0; - char *pter; + uint32_t crc = 0; + uint8_t *pter; crc_set_init(h, 0); @@ -130,14 +130,14 @@ uint32_t crc_checksum(crc_t *h, char *data, int len) { // Calculate CRC for (i = 0; i < len8 + a; i++) { - pter = (char *) (data + 8 * i); + pter = (uint8_t *) (data + 8 * i); if (i == len8) { h->byte = 0x00; for (k = 0; k < res8; k++) { - h->byte |= ((unsigned char) *(pter + k)) << (7 - k); + h->byte |= ((uint8_t) *(pter + k)) << (7 - k); } } else { - h->byte = (unsigned char) (unpack_bits(&pter, 8) & 0xFF); + h->byte = (uint8_t) (unpack_bits(&pter, 8) & 0xFF); } crc = crctable(h); } @@ -155,11 +155,11 @@ uint32_t crc_checksum(crc_t *h, char *data, int len) { /** Appends crc_order checksum bits to the buffer data. * The buffer data must be len + crc_order bytes */ -void crc_attach(crc_t *h, char *data, int len) { - unsigned int checksum = crc_checksum(h, data, len); +void crc_attach(crc_t *h, uint8_t *data, int len) { + uint32_t checksum = crc_checksum(h, data, len); // Add CRC - char *ptr = &data[len]; + uint8_t *ptr = &data[len]; pack_bits(checksum, &ptr, h->order); } diff --git a/lte/phy/lib/fec/src/rm_conv.c b/lte/phy/lib/fec/src/rm_conv.c index 0c10c9a0d..e01e81876 100644 --- a/lte/phy/lib/fec/src/rm_conv.c +++ b/lte/phy/lib/fec/src/rm_conv.c @@ -40,9 +40,9 @@ uint8_t RM_PERM_CC_INV[NCOLS] = { 16, 0, 24, 8, 20, 4, 28, 12, 18, 2, 26, 10, 22, 6, 30, 14, 17, 1, 25, 9, 21, 5, 29, 13, 19, 3, 27, 11, 23, 7, 31, 15 }; -int rm_conv_tx(char *input, uint32_t in_len, char *output, uint32_t out_len) { +int rm_conv_tx(uint8_t *input, uint32_t in_len, uint8_t *output, uint32_t out_len) { - char tmp[3 * NCOLS * NROWS_MAX]; + uint8_t tmp[3 * NCOLS * NROWS_MAX]; int nrows, ndummy, K_p; int i, j, k, s; diff --git a/lte/phy/lib/fec/src/rm_turbo.c b/lte/phy/lib/fec/src/rm_turbo.c index ae52d9593..742726717 100644 --- a/lte/phy/lib/fec/src/rm_turbo.c +++ b/lte/phy/lib/fec/src/rm_turbo.c @@ -53,7 +53,7 @@ uint8_t RM_PERM_TC[NCOLS] = { 0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, * * TODO: Soft buffer size limitation according to UE category */ -int rm_turbo_tx(char *w_buff, uint32_t w_buff_len, char *input, uint32_t in_len, char *output, +int rm_turbo_tx(uint8_t *w_buff, uint32_t w_buff_len, uint8_t *input, uint32_t in_len, uint8_t *output, uint32_t out_len, uint32_t rv_idx) { int ndummy, kidx; diff --git a/lte/phy/lib/fec/src/tc_interl_umts.c b/lte/phy/lib/fec/src/tc_interl_umts.c index 931749347..25e4d620a 100644 --- a/lte/phy/lib/fec/src/tc_interl_umts.c +++ b/lte/phy/lib/fec/src/tc_interl_umts.c @@ -50,7 +50,7 @@ const unsigned short table_p[52] = { 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257 }; -const unsigned char table_v[52] = { 3, 2, 2, 3, 2, 5, 2, 3, 2, 6, 3, 5, 2, 2, 2, +const uint8_t table_v[52] = { 3, 2, 2, 3, 2, 5, 2, 3, 2, 6, 3, 5, 2, 2, 2, 2, 7, 5, 3, 2, 3, 5, 2, 5, 2, 6, 3, 3, 2, 3, 2, 2, 6, 5, 2, 5, 2, 2, 2, 19, 5, 2, 3, 2, 3, 2, 6, 3, 7, 7, 6, 3 }; diff --git a/lte/phy/lib/fec/src/turbocoder.c b/lte/phy/lib/fec/src/turbocoder.c index 7483601d9..882d8081f 100644 --- a/lte/phy/lib/fec/src/turbocoder.c +++ b/lte/phy/lib/fec/src/turbocoder.c @@ -47,12 +47,12 @@ void tcod_free(tcod_t *h) { h->max_long_cb = 0; } -int tcod_encode(tcod_t *h, char *input, char *output, uint32_t long_cb) { +int tcod_encode(tcod_t *h, uint8_t *input, uint8_t *output, uint32_t long_cb) { - char reg1_0, reg1_1, reg1_2, reg2_0, reg2_1, reg2_2; + uint8_t reg1_0, reg1_1, reg1_2, reg2_0, reg2_1, reg2_2; uint32_t i, k = 0, j; - char bit; - char in, out; + uint8_t bit; + uint8_t in, out; uint32_t *per; if (long_cb > h->max_long_cb) { diff --git a/lte/phy/lib/fec/src/turbodecoder.c b/lte/phy/lib/fec/src/turbodecoder.c index 171eefde3..262bace7f 100644 --- a/lte/phy/lib/fec/src/turbodecoder.c +++ b/lte/phy/lib/fec/src/turbodecoder.c @@ -317,7 +317,7 @@ int tdec_reset(tdec_t * h, uint32_t long_cb) return tc_interl_LTE_gen(&h->interleaver, long_cb); } -void tdec_decision(tdec_t * h, char *output, uint32_t long_cb) +void tdec_decision(tdec_t * h, uint8_t *output, uint32_t long_cb) { uint32_t i; for (i = 0; i < long_cb; i++) { @@ -325,7 +325,7 @@ void tdec_decision(tdec_t * h, char *output, uint32_t long_cb) } } -void tdec_run_all(tdec_t * h, llr_t * input, char *output, +void tdec_run_all(tdec_t * h, llr_t * input, uint8_t *output, uint32_t nof_iterations, uint32_t long_cb) { uint32_t iter = 0; diff --git a/lte/phy/lib/fec/src/viterbi.c b/lte/phy/lib/fec/src/viterbi.c index b9fb2b0ec..cf6b506ce 100644 --- a/lte/phy/lib/fec/src/viterbi.c +++ b/lte/phy/lib/fec/src/viterbi.c @@ -40,7 +40,7 @@ #define DEB 0 -int decode37(void *o, uint8_t *symbols, char *data, uint32_t frame_length) { +int decode37(void *o, uint8_t *symbols, uint8_t *data, uint32_t frame_length) { viterbi_t *q = o; uint32_t i; @@ -57,7 +57,7 @@ int decode37(void *o, uint8_t *symbols, char *data, uint32_t frame_length) { /* Decode block */ if (q->tail_biting) { - memcpy(q->tmp, symbols, 3 * frame_length * sizeof(char)); + memcpy(q->tmp, symbols, 3 * frame_length * sizeof(uint8_t)); for (i = 0; i < 3 * (q->K - 1); i++) { q->tmp[i + 3 * frame_length] = q->tmp[i]; } @@ -75,7 +75,7 @@ int decode37(void *o, uint8_t *symbols, char *data, uint32_t frame_length) { return q->framebits; } -int decode39(void *o, uint8_t *symbols, char *data, uint32_t frame_length) { +int decode39(void *o, uint8_t *symbols, uint8_t *data, uint32_t frame_length) { viterbi_t *q = o; if (frame_length > q->framebits) { @@ -122,13 +122,13 @@ int init37(viterbi_t *q, uint32_t poly[3], uint32_t framebits, bool tail_biting) q->tail_biting = tail_biting; q->decode = decode37; q->free = free37; - q->symbols_uc = malloc(3 * (q->framebits + q->K - 1) * sizeof(char)); + q->symbols_uc = malloc(3 * (q->framebits + q->K - 1) * sizeof(uint8_t)); if (!q->symbols_uc) { perror("malloc"); return -1; } if (q->tail_biting) { - q->tmp = malloc(3 * (q->framebits + q->K - 1) * sizeof(char)); + q->tmp = malloc(3 * (q->framebits + q->K - 1) * sizeof(uint8_t)); if (!q->tmp) { perror("malloc"); free37(q); @@ -159,7 +159,7 @@ int init39(viterbi_t *q, uint32_t poly[3], uint32_t framebits, bool tail_biting) "Error: Tailbitting not supported in 1/3 K=9 decoder\n"); return -1; } - q->symbols_uc = malloc(3 * (q->framebits + q->K - 1) * sizeof(char)); + q->symbols_uc = malloc(3 * (q->framebits + q->K - 1) * sizeof(uint8_t)); if (!q->symbols_uc) { perror("malloc"); return -1; @@ -193,7 +193,7 @@ void viterbi_free(viterbi_t *q) { } /* symbols are real-valued */ -int viterbi_decode_f(viterbi_t *q, float *symbols, char *data, uint32_t frame_length) { +int viterbi_decode_f(viterbi_t *q, float *symbols, uint8_t *data, uint32_t frame_length) { uint32_t len; if (frame_length > q->framebits) { fprintf(stderr, "Initialized decoder for max frame length %d bits\n", @@ -209,7 +209,7 @@ int viterbi_decode_f(viterbi_t *q, float *symbols, char *data, uint32_t frame_le return q->decode(q, q->symbols_uc, data, frame_length); } -int viterbi_decode_uc(viterbi_t *q, uint8_t *symbols, char *data, +int viterbi_decode_uc(viterbi_t *q, uint8_t *symbols, uint8_t *data, uint32_t frame_length) { return q->decode(q, symbols, data, frame_length); } diff --git a/lte/phy/lib/fec/src/viterbi37.h b/lte/phy/lib/fec/src/viterbi37.h index 7bacca2c8..2e5bc4e58 100644 --- a/lte/phy/lib/fec/src/viterbi37.h +++ b/lte/phy/lib/fec/src/viterbi37.h @@ -34,13 +34,13 @@ int init_viterbi37_port(void *p, uint32_t starting_state); int chainback_viterbi37_port(void *p, - char *data, + uint8_t *data, uint32_t nbits, uint32_t endstate); void delete_viterbi37_port(void *p); int update_viterbi37_blk_port(void *p, - unsigned char *syms, + uint8_t *syms, uint32_t nbits, uint32_t *best_state); diff --git a/lte/phy/lib/fec/src/viterbi37_port.c b/lte/phy/lib/fec/src/viterbi37_port.c index 09dfa4bdc..37070268a 100644 --- a/lte/phy/lib/fec/src/viterbi37_port.c +++ b/lte/phy/lib/fec/src/viterbi37_port.c @@ -12,14 +12,14 @@ #include typedef union { - unsigned int w[64]; + uint32_t w[64]; } metric_t; typedef union { unsigned long w[2]; } decision_t; static union { - unsigned char c[128]; + uint8_t c[128]; } Branchtab37[3]; /* State info for instance of Viterbi decoder */ @@ -83,7 +83,7 @@ void *create_viterbi37_port(uint32_t polys[3], uint32_t len) { } /* Viterbi chainback */ -int chainback_viterbi37_port(void *p, char *data, /* Decoded output data */ +int chainback_viterbi37_port(void *p, uint8_t *data, /* Decoded output data */ uint32_t nbits, /* Number of data bits */ uint32_t endstate) { /* Terminal encoder state */ struct v37 *vp = p; @@ -127,7 +127,7 @@ void delete_viterbi37_port(void *p) { /* C-language butterfly */ #define BFLY(i) {\ -unsigned int metric,m0,m1,decision;\ +uint32_t metric,m0,m1,decision;\ metric = (Branchtab37[0].c[i] ^ sym0) + (Branchtab37[1].c[i] ^ sym1) + \ (Branchtab37[2].c[i] ^ sym2);\ m0 = vp->old_metrics->w[i] + metric;\ diff --git a/lte/phy/lib/fec/src/viterbi39.h b/lte/phy/lib/fec/src/viterbi39.h index 09a3280cf..8c36b3429 100644 --- a/lte/phy/lib/fec/src/viterbi39.h +++ b/lte/phy/lib/fec/src/viterbi39.h @@ -34,7 +34,7 @@ int init_viterbi39_port(void *p, uint32_t starting_state); int chainback_viterbi39_port(void *p, - char *data, /* Decoded output data */ + uint8_t *data, /* Decoded output data */ uint32_t nbits, /* Number of data bits */ uint32_t endstate); diff --git a/lte/phy/lib/fec/src/viterbi39_port.c b/lte/phy/lib/fec/src/viterbi39_port.c index 1d87b2c4a..c039f5d88 100644 --- a/lte/phy/lib/fec/src/viterbi39_port.c +++ b/lte/phy/lib/fec/src/viterbi39_port.c @@ -10,14 +10,14 @@ #include "parity.h" typedef union { - unsigned int w[256]; + uint32_t w[256]; } metric_t; typedef union { unsigned long w[8]; } decision_t; static union { - unsigned char c[128]; + uint8_t c[128]; } Branchtab39[3]; /* State info for instance of Viterbi decoder */ @@ -79,7 +79,7 @@ void *create_viterbi39_port(uint32_t polys[3], uint32_t len) { } /* Viterbi chainback */ -int chainback_viterbi39_port(void *p, char *data, /* Decoded output data */ +int chainback_viterbi39_port(void *p, uint8_t *data, /* Decoded output data */ uint32_t nbits, /* Number of data bits */ uint32_t endstate) { /* Terminal encoder state */ struct v39 *vp = p; @@ -121,7 +121,7 @@ void delete_viterbi39_port(void *p) { /* C-language butterfly */ #define BFLY(i) {\ -unsigned int metric,m0,m1,decision;\ +uint32_t metric,m0,m1,decision;\ metric = (Branchtab39[0].c[i] ^ sym0) + (Branchtab39[1].c[i] ^ sym1) + \ (Branchtab39[2].c[i] ^ sym2);\ m0 = vp->old_metrics->w[i] + metric;\ diff --git a/lte/phy/lib/fec/test/crc_test.c b/lte/phy/lib/fec/test/crc_test.c index 476bad1b3..5f53c5f87 100644 --- a/lte/phy/lib/fec/test/crc_test.c +++ b/lte/phy/lib/fec/test/crc_test.c @@ -37,8 +37,8 @@ #include "crc_test.h" int num_bits = 5001, crc_length = 24; -unsigned int crc_poly = 0x1864CFB; -unsigned int seed = 1; +uint32_t crc_poly = 0x1864CFB; +uint32_t seed = 1; void usage(char *prog) { printf("Usage: %s [nlps]\n", prog); @@ -59,10 +59,10 @@ void parse_args(int argc, char **argv) { crc_length = atoi(argv[optind]); break; case 'p': - crc_poly = (unsigned int) strtoul(argv[optind], NULL, 16); + crc_poly = (uint32_t) strtoul(argv[optind], NULL, 16); break; case 's': - seed = (unsigned int) strtoul(argv[optind], NULL, 0); + seed = (uint32_t) strtoul(argv[optind], NULL, 0); break; default: usage(argv[0]); @@ -73,13 +73,13 @@ void parse_args(int argc, char **argv) { int main(int argc, char **argv) { int i; - char *data; - unsigned int crc_word, expected_word; + uint8_t *data; + uint32_t crc_word, expected_word; crc_t crc_p; parse_args(argc, argv); - data = malloc(sizeof(char) * (num_bits + crc_length * 2)); + data = malloc(sizeof(uint8_t) * (num_bits + crc_length * 2)); if (!data) { perror("malloc"); exit(-1); diff --git a/lte/phy/lib/fec/test/crc_test.h b/lte/phy/lib/fec/test/crc_test.h index 152e77e5c..40b48979d 100644 --- a/lte/phy/lib/fec/test/crc_test.h +++ b/lte/phy/lib/fec/test/crc_test.h @@ -32,9 +32,9 @@ typedef struct { int n; int l; - unsigned int p; - unsigned int s; - unsigned int word; + uint32_t p; + uint32_t s; + uint32_t word; }expected_word_t; @@ -48,7 +48,7 @@ static expected_word_t expected_words[] = { {-1, -1, 0, 0, 0} }; -int get_expected_word(int n, int l, unsigned int p, unsigned int s, unsigned int *word) { +int get_expected_word(int n, int l, uint32_t p, unsigned int s, unsigned int *word) { int i; i=0; while(expected_words[i].n != -1) { diff --git a/lte/phy/lib/fec/test/rm_conv_test.c b/lte/phy/lib/fec/test/rm_conv_test.c index 84910527b..09ffc2b01 100644 --- a/lte/phy/lib/fec/test/rm_conv_test.c +++ b/lte/phy/lib/fec/test/rm_conv_test.c @@ -69,18 +69,18 @@ void parse_args(int argc, char **argv) { int main(int argc, char **argv) { int i; - char *bits, *rm_bits; + uint8_t *bits, *rm_bits; float *rm_symbols, *unrm_symbols; int nof_errors; parse_args(argc, argv); - bits = malloc(sizeof(char) * nof_tx_bits); + bits = malloc(sizeof(uint8_t) * nof_tx_bits); if (!bits) { perror("malloc"); exit(-1); } - rm_bits = malloc(sizeof(char) * nof_rx_bits); + rm_bits = malloc(sizeof(uint8_t) * nof_rx_bits); if (!rm_bits) { perror("malloc"); exit(-1); diff --git a/lte/phy/lib/fec/test/rm_turbo_test.c b/lte/phy/lib/fec/test/rm_turbo_test.c index 42db72696..8397361a8 100644 --- a/lte/phy/lib/fec/test/rm_turbo_test.c +++ b/lte/phy/lib/fec/test/rm_turbo_test.c @@ -73,23 +73,23 @@ void parse_args(int argc, char **argv) { int main(int argc, char **argv) { int i; - char *bits, *rm_bits, *w_buff_c; + uint8_t *bits, *rm_bits, *w_buff_c; float *rm_symbols, *unrm_symbols, *w_buff_f; int nof_errors; parse_args(argc, argv); - bits = malloc(sizeof(char) * nof_tx_bits); + bits = malloc(sizeof(uint8_t) * nof_tx_bits); if (!bits) { perror("malloc"); exit(-1); } - w_buff_c = malloc(sizeof(char) * nof_tx_bits * 10); + w_buff_c = malloc(sizeof(uint8_t) * nof_tx_bits * 10); if (!w_buff_c) { perror("malloc"); exit(-1); } - rm_bits = malloc(sizeof(char) * nof_rx_bits); + rm_bits = malloc(sizeof(uint8_t) * nof_rx_bits); if (!rm_bits) { perror("malloc"); exit(-1); diff --git a/lte/phy/lib/fec/test/turbocoder_test.c b/lte/phy/lib/fec/test/turbocoder_test.c index fb0fabc85..2fcea3fb2 100644 --- a/lte/phy/lib/fec/test/turbocoder_test.c +++ b/lte/phy/lib/fec/test/turbocoder_test.c @@ -90,7 +90,7 @@ void parse_args(int argc, char **argv) { ebno_db = atof(argv[optind]); break; case 's': - seed = (unsigned int) strtoul(argv[optind], NULL, 0); + seed = (uint32_t) strtoul(argv[optind], NULL, 0); break; case 'v': verbose++; @@ -129,8 +129,8 @@ void output_matlab(float ber[MAX_ITERATIONS][SNR_POINTS], int snr_points) { int main(int argc, char **argv) { uint32_t frame_cnt; float *llr; - unsigned char *llr_c; - char *data_tx, *data_rx, *symbols; + uint8_t *llr_c; + uint8_t *data_tx, *data_rx, *symbols; uint32_t i, j; float var[SNR_POINTS]; uint32_t snr_points; @@ -162,19 +162,19 @@ int main(int argc, char **argv) { printf(" EbNo: %.2f\n", ebno_db); } - data_tx = malloc(frame_length * sizeof(char)); + data_tx = malloc(frame_length * sizeof(uint8_t)); if (!data_tx) { perror("malloc"); exit(-1); } - data_rx = malloc(frame_length * sizeof(char)); + data_rx = malloc(frame_length * sizeof(uint8_t)); if (!data_rx) { perror("malloc"); exit(-1); } - symbols = malloc(coded_length * sizeof(char)); + symbols = malloc(coded_length * sizeof(uint8_t)); if (!symbols) { perror("malloc"); exit(-1); @@ -184,7 +184,7 @@ int main(int argc, char **argv) { perror("malloc"); exit(-1); } - llr_c = malloc(coded_length * sizeof(char)); + llr_c = malloc(coded_length * sizeof(uint8_t)); if (!llr_c) { perror("malloc"); exit(-1); diff --git a/lte/phy/lib/fec/test/turbocoder_test.h b/lte/phy/lib/fec/test/turbocoder_test.h index b0b64ded1..3ec91ed27 100644 --- a/lte/phy/lib/fec/test/turbocoder_test.h +++ b/lte/phy/lib/fec/test/turbocoder_test.h @@ -29,7 +29,7 @@ typedef struct { int n; - unsigned int s; + uint32_t s; int iterations; int len; float ebno; @@ -55,7 +55,7 @@ static expected_errors_t expected_errors[] = { }; -int get_expected_errors(int n, unsigned int s, int iterations, int len, float ebno) { +int get_expected_errors(int n, uint32_t s, int iterations, int len, float ebno) { int i; i = 0; while (expected_errors[i].n != -1) { @@ -78,7 +78,7 @@ int get_expected_errors(int n, unsigned int s, int iterations, int len, float eb const int known_data_errors[4] = {47, 18, 0, 0}; #define KNOWN_DATA_LEN 504 -const char known_data[KNOWN_DATA_LEN] = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, +const uint8_t known_data[KNOWN_DATA_LEN] = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, @@ -101,7 +101,7 @@ const char known_data[KNOWN_DATA_LEN] = { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1 }; -const char known_data_encoded[3 * KNOWN_DATA_LEN + 12] = { 0, 0, 0, 0, 0, 1, 1, +const uint8_t known_data_encoded[3 * KNOWN_DATA_LEN + 12] = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, diff --git a/lte/phy/lib/fec/test/viterbi_test.c b/lte/phy/lib/fec/test/viterbi_test.c index 7354e3c28..c1803e52e 100644 --- a/lte/phy/lib/fec/test/viterbi_test.c +++ b/lte/phy/lib/fec/test/viterbi_test.c @@ -41,7 +41,7 @@ typedef _Complex float cf_t; int frame_length = 1000, nof_frames = 128; float ebno_db = 100.0; -unsigned int seed = 0; +uint32_t seed = 0; bool tail_biting = false; int K = -1; @@ -76,7 +76,7 @@ void parse_args(int argc, char **argv) { ebno_db = atof(argv[optind]); break; case 's': - seed = (unsigned int) strtoul(argv[optind], NULL, 0); + seed = (uint32_t) strtoul(argv[optind], NULL, 0); break; case 't': tail_biting = true; @@ -122,13 +122,13 @@ void output_matlab(float ber[NTYPES][SNR_POINTS], int snr_points, int main(int argc, char **argv) { int frame_cnt; float *llr; - unsigned char *llr_c; - char *data_tx, *data_rx[NTYPES], *symbols; + uint8_t *llr_c; + uint8_t *data_tx, *data_rx[NTYPES], *symbols; int i, j; float var[SNR_POINTS], varunc[SNR_POINTS]; int snr_points; float ber[NTYPES][SNR_POINTS]; - unsigned int errors[NTYPES]; + uint32_t errors[NTYPES]; viterbi_type_t viterbi_type[NCODS]; viterbi_t dec[NCODS]; convcoder_t cod[NCODS]; @@ -200,21 +200,21 @@ int main(int argc, char **argv) { printf(" EbNo: %.2f\n", ebno_db); } - data_tx = malloc(frame_length * sizeof(char)); + data_tx = malloc(frame_length * sizeof(uint8_t)); if (!data_tx) { perror("malloc"); exit(-1); } for (i = 0; i < NTYPES; i++) { - data_rx[i] = malloc(frame_length * sizeof(char)); + data_rx[i] = malloc(frame_length * sizeof(uint8_t)); if (!data_rx[i]) { perror("malloc"); exit(-1); } } - symbols = malloc(max_coded_length * sizeof(char)); + symbols = malloc(max_coded_length * sizeof(uint8_t)); if (!symbols) { perror("malloc"); exit(-1); @@ -224,7 +224,7 @@ int main(int argc, char **argv) { perror("malloc"); exit(-1); } - llr_c = malloc(2 * max_coded_length * sizeof(char)); + llr_c = malloc(2 * max_coded_length * sizeof(uint8_t)); if (!llr_c) { perror("malloc"); exit(-1); diff --git a/lte/phy/lib/fec/test/viterbi_test.h b/lte/phy/lib/fec/test/viterbi_test.h index b01d4b03a..c54c0c132 100644 --- a/lte/phy/lib/fec/test/viterbi_test.h +++ b/lte/phy/lib/fec/test/viterbi_test.h @@ -29,7 +29,7 @@ typedef struct { int n; - unsigned int s; + uint32_t s; int len; int k; bool tail; @@ -52,7 +52,7 @@ static expected_errors_t expected_errors[] = { {-1, -1, -1, -1, true, -1.0, -1} }; -int get_expected_errors(int n, unsigned int s, int len, int k, bool tail, float ebno) { +int get_expected_errors(int n, uint32_t s, int len, int k, bool tail, float ebno) { int i; i=0; while(expected_errors[i].n != -1) { diff --git a/lte/phy/lib/io/src/binsource.c b/lte/phy/lib/io/src/binsource.c index 962cd3c04..f4cd3043e 100644 --- a/lte/phy/lib/io/src/binsource.c +++ b/lte/phy/lib/io/src/binsource.c @@ -77,7 +77,7 @@ void binsource_free(binsource_t* q) { /** * Sets a new seed */ -void binsource_seed_set(binsource_t* q, unsigned int seed) { +void binsource_seed_set(binsource_t* q, uint32_t seed) { q->seed = seed; } @@ -102,7 +102,7 @@ int binsource_cache_gen(binsource_t* q, int nbits) { return 0; } -static int int_2_bits(uint32_t* src, char* dst, int nbits) { +static int int_2_bits(uint32_t* src, uint8_t* dst, int nbits) { int n; n=nbits/32; for (int i=0;iseq_cache_rp += int_2_bits(&q->seq_buff[q->seq_cache_rp],bits,nbits); } @@ -123,7 +123,7 @@ void binsource_cache_cpy(binsource_t* q, char *bits, int nbits) { * Stores in the bits buffer a sequence of nbits pseudo-random bits. * Overwrites the bits generated using binsource_cache_gen. */ -int binsource_generate(binsource_t* q, char *bits, int nbits) { +int binsource_generate(binsource_t* q, uint8_t *bits, int nbits) { if (gen_seq_buff(q,DIV(nbits,32))) { return -1; diff --git a/lte/phy/lib/modem/src/demod_hard.c b/lte/phy/lib/modem/src/demod_hard.c index a3b306e0b..75a170a89 100644 --- a/lte/phy/lib/modem/src/demod_hard.c +++ b/lte/phy/lib/modem/src/demod_hard.c @@ -41,7 +41,7 @@ void demod_hard_table_set(demod_hard_t* q, lte_mod_t mod) { q->mod = mod; } -int demod_hard_demodulate(demod_hard_t* q, cf_t* symbols, char *bits, uint32_t nsymbols) { +int demod_hard_demodulate(demod_hard_t* q, cf_t* symbols, uint8_t *bits, uint32_t nsymbols) { int nbits=-1; switch(q->mod) { diff --git a/lte/phy/lib/modem/src/hard_demod_lte.c b/lte/phy/lib/modem/src/hard_demod_lte.c index f841f3ac7..94176acd1 100644 --- a/lte/phy/lib/modem/src/hard_demod_lte.c +++ b/lte/phy/lib/modem/src/hard_demod_lte.c @@ -43,11 +43,11 @@ *---------> I *1 | * \param in input symbols (_Complex float) - * \param out output symbols (chars) + * \param out output symbols (uint8_ts) * \param N Number of input symbols * \param modulation Modulation type */ -inline void hard_bpsk_demod(const cf_t* in, char* out, uint32_t N) +inline void hard_bpsk_demod(const cf_t* in, uint8_t* out, uint32_t N) { uint32_t s; @@ -78,11 +78,11 @@ inline void hard_bpsk_demod(const cf_t* in, char* out, uint32_t N) *11 | 01 * * \param in input symbols (_Complex float) - * \param out output symbols (chars) + * \param out output symbols (uint8_ts) * \param N Number of input symbols * \param modulation Modulation type */ -inline void hard_qpsk_demod(const cf_t* in, char* out, uint32_t N) +inline void hard_qpsk_demod(const cf_t* in, uint8_t* out, uint32_t N) { uint32_t s; @@ -112,11 +112,11 @@ inline void hard_qpsk_demod(const cf_t* in, char* out, uint32_t N) * 1111 1101 | 0101 0111 * * \param in input symbols (_Complex float) - * \param out output symbols (chars) + * \param out output symbols (uint8_ts) * \param N Number of input symbols * \param modulation Modulation type */ -inline void hard_qam16_demod(const cf_t* in, char* out, uint32_t N) +inline void hard_qam16_demod(const cf_t* in, uint8_t* out, uint32_t N) { uint32_t s; @@ -154,11 +154,11 @@ inline void hard_qam16_demod(const cf_t* in, char* out, uint32_t N) * see [3GPP TS 36.211 version 10.5.0 Release 10, Section 7.1.4] * * \param in input symbols (_Complex float) - * \param out output symbols (chars) + * \param out output symbols (uint8_ts) * \param N Number of input symbols * \param modulation Modulation type */ -inline void hard_qam64_demod(const cf_t* in, char* out, uint32_t N) +inline void hard_qam64_demod(const cf_t* in, uint8_t* out, uint32_t N) { uint32_t s; diff --git a/lte/phy/lib/modem/src/hard_demod_lte.h b/lte/phy/lib/modem/src/hard_demod_lte.h index 49741c659..e655f1cc9 100644 --- a/lte/phy/lib/modem/src/hard_demod_lte.h +++ b/lte/phy/lib/modem/src/hard_demod_lte.h @@ -35,17 +35,17 @@ #define QAM64_THRESHOLD_3 6/sqrt(42) void hard_bpsk_demod(const cf_t* in, - char* out, + uint8_t* out, uint32_t N); void hard_qpsk_demod(const cf_t* in, - char* out, + uint8_t* out, uint32_t N); void hard_qam16_demod(const cf_t* in, - char* out, + uint8_t* out, uint32_t N); void hard_qam64_demod(const cf_t* in, - char* out, + uint8_t* out, uint32_t N); diff --git a/lte/phy/lib/modem/src/mod.c b/lte/phy/lib/modem/src/mod.c index ef6a600e7..6bfc6a6c4 100644 --- a/lte/phy/lib/modem/src/mod.c +++ b/lte/phy/lib/modem/src/mod.c @@ -35,9 +35,9 @@ /** Low-level API */ -int mod_modulate(modem_table_t* q, const char *bits, cf_t* symbols, uint32_t nbits) { +int mod_modulate(modem_table_t* q, const uint8_t *bits, cf_t* symbols, uint32_t nbits) { uint32_t i,j,idx; - char *b_ptr=(char*) bits; + uint8_t *b_ptr=(uint8_t*) bits; j=0; for (i=0;inbits_x_symbol) { idx = bit_unpack(&b_ptr,q->nbits_x_symbol); diff --git a/lte/phy/lib/modem/test/modem_test.c b/lte/phy/lib/modem/test/modem_test.c index 97c97ff17..b163ddf03 100644 --- a/lte/phy/lib/modem/test/modem_test.c +++ b/lte/phy/lib/modem/test/modem_test.c @@ -97,7 +97,7 @@ int main(int argc, char **argv) { modem_table_t mod; demod_hard_t demod_hard; demod_soft_t demod_soft; - char *input, *output; + uint8_t *input, *output; cf_t *symbols; float *llr; @@ -129,12 +129,12 @@ int main(int argc, char **argv) { } /* allocate buffers */ - input = malloc(sizeof(char) * num_bits); + input = malloc(sizeof(uint8_t) * num_bits); if (!input) { perror("malloc"); exit(-1); } - output = malloc(sizeof(char) * num_bits); + output = malloc(sizeof(uint8_t) * num_bits); if (!output) { perror("malloc"); exit(-1); diff --git a/lte/phy/lib/modem/test/soft_demod_test.c b/lte/phy/lib/modem/test/soft_demod_test.c index 5849f4693..0a11231be 100644 --- a/lte/phy/lib/modem/test/soft_demod_test.c +++ b/lte/phy/lib/modem/test/soft_demod_test.c @@ -110,7 +110,7 @@ int main(int argc, char **argv) { int i; modem_table_t mod; demod_soft_t demod_soft; - char *input, *output; + uint8_t *input, *output; cf_t *symbols; float *llr_exact, *llr_approx; @@ -131,12 +131,12 @@ int main(int argc, char **argv) { /* allocate buffers */ - input = malloc(sizeof(char) * num_bits); + input = malloc(sizeof(uint8_t) * num_bits); if (!input) { perror("malloc"); exit(-1); } - output = malloc(sizeof(char) * num_bits); + output = malloc(sizeof(uint8_t) * num_bits); if (!output) { perror("malloc"); exit(-1); diff --git a/lte/phy/lib/phch/src/dci.c b/lte/phy/lib/phch/src/dci.c index 5d57a28ab..62542fdb0 100644 --- a/lte/phy/lib/phch/src/dci.c +++ b/lte/phy/lib/phch/src/dci.c @@ -207,7 +207,7 @@ uint32_t dci_format_sizeof(dci_format_t format, uint32_t nof_prb) { int dci_format0_pack(ra_pusch_t *data, dci_msg_t *msg, uint32_t nof_prb) { /* pack bits */ - char *y = msg->data; + uint8_t *y = msg->data; uint32_t n_ul_hop; *y++ = 0; // format differentiation @@ -269,7 +269,7 @@ int dci_format0_pack(ra_pusch_t *data, dci_msg_t *msg, uint32_t nof_prb) { int dci_format0_unpack(dci_msg_t *msg, ra_pusch_t *data, uint32_t nof_prb) { /* pack bits */ - char *y = msg->data; + uint8_t *y = msg->data; uint32_t n_ul_hop; /* Make sure it's a Format0 message */ @@ -338,7 +338,7 @@ int dci_format0_unpack(dci_msg_t *msg, ra_pusch_t *data, uint32_t nof_prb) { int dci_format1_pack(ra_pdsch_t *data, dci_msg_t *msg, uint32_t nof_prb) { /* pack bits */ - char *y = msg->data; + uint8_t *y = msg->data; if (nof_prb > 10) { *y++ = data->alloc_type; @@ -391,7 +391,7 @@ int dci_format1_pack(ra_pdsch_t *data, dci_msg_t *msg, uint32_t nof_prb) { int dci_format1_unpack(dci_msg_t *msg, ra_pdsch_t *data, uint32_t nof_prb) { /* pack bits */ - char *y = msg->data; + uint8_t *y = msg->data; /* Make sure it's a Format1 message */ if (msg->nof_bits != dci_format_sizeof(Format1, nof_prb)) { @@ -451,7 +451,7 @@ int dci_format1As_pack(ra_pdsch_t *data, dci_msg_t *msg, uint32_t nof_prb, bool crc_is_crnti) { /* pack bits */ - char *y = msg->data; + uint8_t *y = msg->data; *y++ = 1; // format differentiation @@ -537,7 +537,7 @@ int dci_format1As_unpack(dci_msg_t *msg, ra_pdsch_t *data, uint32_t nof_prb, bool crc_is_crnti) { /* pack bits */ - char *y = msg->data; + uint8_t *y = msg->data; /* Make sure it's a Format0 message */ if (msg->nof_bits != dci_format_sizeof(Format1A, nof_prb)) { @@ -614,7 +614,7 @@ int dci_format1As_unpack(dci_msg_t *msg, ra_pdsch_t *data, uint32_t nof_prb, int dci_format1Cs_pack(ra_pdsch_t *data, dci_msg_t *msg, uint32_t nof_prb) { /* pack bits */ - char *y = msg->data; + uint8_t *y = msg->data; if (data->alloc_type != alloc_type2 || data->type2_alloc.mode != t2_dist) { fprintf(stderr, @@ -665,7 +665,7 @@ int dci_format1Cs_unpack(dci_msg_t *msg, ra_pdsch_t *data, uint32_t nof_prb) { uint32_t L_p, RB_p; /* pack bits */ - char *y = msg->data; + uint8_t *y = msg->data; if (msg->nof_bits != dci_format_sizeof(Format1C, nof_prb)) { fprintf(stderr, "Invalid message length for format 1C\n"); diff --git a/lte/phy/lib/phch/src/pbch.c b/lte/phy/lib/phch/src/pbch.c index d2f5ca450..beab9976f 100644 --- a/lte/phy/lib/phch/src/pbch.c +++ b/lte/phy/lib/phch/src/pbch.c @@ -41,7 +41,7 @@ #include "liblte/phy/utils/vector.h" #include "liblte/phy/utils/debug.h" -const char crc_mask[4][16] = { +const uint8_t crc_mask[4][16] = { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 } }; @@ -193,11 +193,11 @@ int pbch_init(pbch_t *q, lte_cell_t cell) { if (!q->pbch_rm_b) { goto clean; } - q->data = malloc(sizeof(char) * 40); + q->data = malloc(sizeof(uint8_t) * 40); if (!q->data) { goto clean; } - q->data_enc = malloc(sizeof(char) * 120); + q->data_enc = malloc(sizeof(uint8_t) * 120); if (!q->data_enc) { goto clean; } @@ -252,7 +252,7 @@ void pbch_free(pbch_t *q) { /** Unpacks MIB from PBCH message. * msg buffer must be 24 byte length at least */ -void pbch_mib_unpack(char *msg, pbch_mib_t *mib) { +void pbch_mib_unpack(uint8_t *msg, pbch_mib_t *mib) { int bw, phich_res; bw = bit_unpack(&msg, 3); @@ -295,7 +295,7 @@ void pbch_mib_unpack(char *msg, pbch_mib_t *mib) { /** Unpacks MIB from PBCH message. * msg buffer must be 24 byte length at least */ -void pbch_mib_pack(pbch_mib_t *mib, char *msg) { +void pbch_mib_pack(pbch_mib_t *mib, uint8_t *msg) { int bw, phich_res = 0; bzero(msg, 24); @@ -359,7 +359,7 @@ void pbch_decode_reset(pbch_t *q) { q->frame_idx = 0; } -void crc_set_mask(char *data, int nof_ports) { +void crc_set_mask(uint8_t *data, int nof_ports) { int i; for (i = 0; i < 16; i++) { data[24 + i] = (data[24 + i] + crc_mask[nof_ports - 1][i]) % 2; @@ -373,9 +373,9 @@ void crc_set_mask(char *data, int nof_ports) { * * Returns 0 if the data is correct, -1 otherwise */ -uint32_t pbch_crc_check(pbch_t *q, char *bits, uint32_t nof_ports) { - char data[40]; - memcpy(data, bits, 40 * sizeof(char)); +uint32_t pbch_crc_check(pbch_t *q, uint8_t *bits, uint32_t nof_ports) { + uint8_t data[40]; + memcpy(data, bits, 40 * sizeof(uint8_t)); crc_set_mask(data, nof_ports); int ret = crc_checksum(&q->crc, data, 40); if (ret == 0) { diff --git a/lte/phy/lib/phch/src/pcfich.c b/lte/phy/lib/phch/src/pcfich.c index f65d3394e..8a783c104 100644 --- a/lte/phy/lib/phch/src/pcfich.c +++ b/lte/phy/lib/phch/src/pcfich.c @@ -42,7 +42,7 @@ #include "liblte/phy/utils/debug.h" // Table 5.3.4-1 -static char cfi_table[4][PCFICH_CFI_LEN] = { { 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, +static uint8_t cfi_table[4][PCFICH_CFI_LEN] = { { 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1 }, { 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0 }, { 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, @@ -105,7 +105,7 @@ void pcfich_free(pcfich_t *q) { /** Finds the CFI with minimum distance with the vector of received 32 bits. * Saves the CFI value in the cfi pointer and returns the distance. */ -int pcfich_cfi_decode(char bits[PCFICH_CFI_LEN], uint32_t *cfi) { +int pcfich_cfi_decode(uint8_t bits[PCFICH_CFI_LEN], uint32_t *cfi) { int i, j; int distance, index = -1; int min = 32; @@ -130,11 +130,11 @@ int pcfich_cfi_decode(char bits[PCFICH_CFI_LEN], uint32_t *cfi) { /** Encodes the CFI producing a vector of 32 bits. * 36.211 10.3 section 5.3.4 */ -int pcfich_cfi_encode(int cfi, char bits[PCFICH_CFI_LEN]) { +int pcfich_cfi_encode(int cfi, uint8_t bits[PCFICH_CFI_LEN]) { if (cfi < 1 || cfi > 3) { return LIBLTE_ERROR_INVALID_INPUTS; } else{ - memcpy(bits, cfi_table[cfi - 1], PCFICH_CFI_LEN * sizeof(char)); + memcpy(bits, cfi_table[cfi - 1], PCFICH_CFI_LEN * sizeof(uint8_t)); return LIBLTE_SUCCESS; } } diff --git a/lte/phy/lib/phch/src/pdcch.c b/lte/phy/lib/phch/src/pdcch.c index 99d49b4aa..8775dacc5 100644 --- a/lte/phy/lib/phch/src/pdcch.c +++ b/lte/phy/lib/phch/src/pdcch.c @@ -108,7 +108,7 @@ int pdcch_init(pdcch_t *q, regs_t *regs, lte_cell_t cell) { goto clean; } - q->pdcch_e = malloc(sizeof(char) * q->max_bits); + q->pdcch_e = malloc(sizeof(uint8_t) * q->max_bits); if (!q->pdcch_e) { goto clean; } @@ -271,11 +271,11 @@ uint32_t pdcch_common_locations(pdcch_t *q, dci_location_t *c, uint32_t max_cand * * TODO: UE transmit antenna selection CRC mask */ -static int dci_decode(pdcch_t *q, float *e, char *data, uint32_t E, uint32_t nof_bits, uint16_t *crc) { +static int dci_decode(pdcch_t *q, float *e, uint8_t *data, uint32_t E, uint32_t nof_bits, uint16_t *crc) { float tmp[3 * (DCI_MAX_BITS + 16)]; uint16_t p_bits, crc_res; - char *x; + uint8_t *x; if (q != NULL && data != NULL && @@ -428,10 +428,10 @@ int pdcch_extract_llr(pdcch_t *q, cf_t *sf_symbols, cf_t *ce[MAX_PORTS], -static void crc_set_mask_rnti(char *crc, uint16_t rnti) { +static void crc_set_mask_rnti(uint8_t *crc, uint16_t rnti) { uint32_t i; - char mask[16]; - char *r = mask; + uint8_t mask[16]; + uint8_t *r = mask; INFO("Mask CRC with RNTI 0x%x\n", rnti); @@ -444,10 +444,10 @@ static void crc_set_mask_rnti(char *crc, uint16_t rnti) { /** 36.212 5.3.3.2 to 5.3.3.4 * TODO: UE transmit antenna selection CRC mask */ -static int dci_encode(pdcch_t *q, char *data, char *e, uint32_t nof_bits, uint32_t E, +static int dci_encode(pdcch_t *q, uint8_t *data, uint8_t *e, uint32_t nof_bits, uint32_t E, uint16_t rnti) { convcoder_t encoder; - char tmp[3 * (DCI_MAX_BITS + 16)]; + uint8_t tmp[3 * (DCI_MAX_BITS + 16)]; if (q != NULL && data != NULL && diff --git a/lte/phy/lib/phch/src/pdsch.c b/lte/phy/lib/phch/src/pdsch.c index 87d84f7c7..ec54c8db6 100644 --- a/lte/phy/lib/phch/src/pdsch.c +++ b/lte/phy/lib/phch/src/pdsch.c @@ -214,7 +214,7 @@ int pdsch_init(pdsch_t *q, lte_cell_t cell) { } // Allocate floats for reception (LLRs) - q->cb_in = malloc(sizeof(char) * MAX_LONG_CB); + q->cb_in = malloc(sizeof(uint8_t) * MAX_LONG_CB); if (!q->cb_in) { goto clean; } @@ -369,7 +369,7 @@ int pdsch_harq_init(pdsch_harq_t *p, pdsch_t *pdsch) { return LIBLTE_ERROR; } - p->pdsch_w_buff_c = malloc(sizeof(char*) * p->max_cb); + p->pdsch_w_buff_c = malloc(sizeof(uint8_t*) * p->max_cb); if (!p->pdsch_w_buff_c) { perror("malloc"); return LIBLTE_ERROR; @@ -384,7 +384,7 @@ int pdsch_harq_init(pdsch_harq_t *p, pdsch_t *pdsch) { perror("malloc"); return LIBLTE_ERROR; } - p->pdsch_w_buff_c[i] = malloc(sizeof(char) * p->w_buff_size); + p->pdsch_w_buff_c[i] = malloc(sizeof(uint8_t) * p->w_buff_size); if (!p->pdsch_w_buff_c[i]) { perror("malloc"); return LIBLTE_ERROR; @@ -471,11 +471,11 @@ uint32_t pdsch_last_noi(pdsch_t *q) { /* Decode a transport block according to 36.212 5.3.2 * */ -int pdsch_decode_tb(pdsch_t *q, char *data, uint32_t tbs, uint32_t nb_e, +int pdsch_decode_tb(pdsch_t *q, uint8_t *data, uint32_t tbs, uint32_t nb_e, pdsch_harq_t *harq_process, uint32_t rv_idx) { - char parity[24]; - char *p_parity = parity; + uint8_t parity[24]; + uint8_t *p_parity = parity; uint32_t par_rx, par_tx; uint32_t i; uint32_t cb_len, rp, wp, rlen, F, n_e; @@ -530,7 +530,7 @@ int pdsch_decode_tb(pdsch_t *q, char *data, uint32_t tbs, uint32_t nb_e, q->nof_iterations = 0; bool early_stop = false; uint32_t len_crc; - char *cb_in_ptr; + uint8_t *cb_in_ptr; crc_t *crc_ptr; tdec_reset(&q->decoder, cb_len); @@ -545,7 +545,7 @@ int pdsch_decode_tb(pdsch_t *q, char *data, uint32_t tbs, uint32_t nb_e, crc_ptr = &q->crc_cb; } else { len_crc = tbs+24; - bzero(q->cb_in, F*sizeof(char)); + bzero(q->cb_in, F*sizeof(uint8_t)); cb_in_ptr = &q->cb_in[F]; crc_ptr = &q->crc_tb; } @@ -566,14 +566,14 @@ int pdsch_decode_tb(pdsch_t *q, char *data, uint32_t tbs, uint32_t nb_e, /* Copy data to another buffer, removing the Codeblock CRC */ if (i < harq_process->cb_segm.C - 1) { - memcpy(&data[wp], &q->cb_in[F], (rlen - F) * sizeof(char)); + memcpy(&data[wp], &q->cb_in[F], (rlen - F) * sizeof(uint8_t)); } else { DEBUG("Last CB, appending parity: %d to %d from %d and 24 from %d\n", rlen - F - 24, wp, F, rlen - 24); /* Append Transport Block parity bits to the last CB */ - memcpy(&data[wp], &q->cb_in[F], (rlen - F - 24) * sizeof(char)); - memcpy(parity, &q->cb_in[rlen - 24], 24 * sizeof(char)); + memcpy(&data[wp], &q->cb_in[F], (rlen - F - 24) * sizeof(uint8_t)); + memcpy(parity, &q->cb_in[rlen - 24], 24 * sizeof(uint8_t)); } /* Set read/write pointers */ @@ -607,7 +607,7 @@ int pdsch_decode_tb(pdsch_t *q, char *data, uint32_t tbs, uint32_t nb_e, /** Decodes the PDSCH from the received symbols */ -int pdsch_decode(pdsch_t *q, cf_t *sf_symbols, cf_t *ce[MAX_PORTS], char *data, uint32_t subframe, +int pdsch_decode(pdsch_t *q, cf_t *sf_symbols, cf_t *ce[MAX_PORTS], uint8_t *data, uint32_t subframe, pdsch_harq_t *harq_process, uint32_t rv_idx) { @@ -699,15 +699,15 @@ int pdsch_decode(pdsch_t *q, cf_t *sf_symbols, cf_t *ce[MAX_PORTS], char *data, /* Encode a transport block according to 36.212 5.3.2 * */ -int pdsch_encode_tb(pdsch_t *q, char *data, uint32_t tbs, uint32_t nb_e, +int pdsch_encode_tb(pdsch_t *q, uint8_t *data, uint32_t tbs, uint32_t nb_e, pdsch_harq_t *harq_process, uint32_t rv_idx) { - char parity[24]; - char *p_parity = parity; + uint8_t parity[24]; + uint8_t *p_parity = parity; uint32_t par; uint32_t i; uint32_t cb_len, rp, wp, rlen, F, n_e; - char *e_bits = q->pdsch_e; + uint8_t *e_bits = q->pdsch_e; int ret = LIBLTE_ERROR_INVALID_INPUTS; if (q != NULL && @@ -769,13 +769,13 @@ int pdsch_encode_tb(pdsch_t *q, char *data, uint32_t tbs, uint32_t nb_e, if (rv_idx == 0) { /* Copy data to another buffer, making space for the Codeblock CRC */ if (i < harq_process->cb_segm.C - 1) { - memcpy(&q->cb_in[F], &data[rp], (rlen - F) * sizeof(char)); + memcpy(&q->cb_in[F], &data[rp], (rlen - F) * sizeof(uint8_t)); } else { INFO("Last CB, appending parity: %d from %d and 24 to %d\n", rlen - F - 24, rp, rlen - 24); /* Append Transport Block parity bits to the last CB */ - memcpy(&q->cb_in[F], &data[rp], (rlen - F - 24) * sizeof(char)); - memcpy(&q->cb_in[rlen - 24], parity, 24 * sizeof(char)); + memcpy(&q->cb_in[F], &data[rp], (rlen - F - 24) * sizeof(uint8_t)); + memcpy(&q->cb_in[rlen - 24], parity, 24 * sizeof(uint8_t)); } if (harq_process->cb_segm.C > 1) { /* Attach Codeblock CRC */ @@ -786,12 +786,12 @@ int pdsch_encode_tb(pdsch_t *q, char *data, uint32_t tbs, uint32_t nb_e, vec_fprint_b(stdout, q->cb_in, cb_len); } /* Turbo Encoding */ - tcod_encode(&q->encoder, q->cb_in, (char*) q->cb_out, cb_len); + tcod_encode(&q->encoder, q->cb_in, (uint8_t*) q->cb_out, cb_len); } /* Rate matching */ if (rm_turbo_tx(harq_process->pdsch_w_buff_c[i], harq_process->w_buff_size, - (char*) q->cb_out, 3 * cb_len + 12, + (uint8_t*) q->cb_out, 3 * cb_len + 12, &e_bits[wp], n_e, rv_idx)) { fprintf(stderr, "Error in rate matching\n"); @@ -815,7 +815,7 @@ int pdsch_encode_tb(pdsch_t *q, char *data, uint32_t tbs, uint32_t nb_e, /** Converts the PDSCH data bits to symbols mapped to the slot ready for transmission */ -int pdsch_encode(pdsch_t *q, char *data, cf_t *sf_symbols[MAX_PORTS], uint32_t subframe, +int pdsch_encode(pdsch_t *q, uint8_t *data, cf_t *sf_symbols[MAX_PORTS], uint32_t subframe, pdsch_harq_t *harq_process, uint32_t rv_idx) { int i; @@ -871,9 +871,9 @@ int pdsch_encode(pdsch_t *q, char *data, cf_t *sf_symbols[MAX_PORTS], uint32_t s return LIBLTE_ERROR; } - scrambling_b_offset(&q->seq_pdsch[subframe], (char*) q->pdsch_e, 0, nof_bits_e); + scrambling_b_offset(&q->seq_pdsch[subframe], (uint8_t*) q->pdsch_e, 0, nof_bits_e); - mod_modulate(&q->mod[harq_process->mcs.mod - 1], (char*) q->pdsch_e, q->pdsch_d, nof_bits_e); + mod_modulate(&q->mod[harq_process->mcs.mod - 1], (uint8_t*) q->pdsch_e, q->pdsch_d, nof_bits_e); /* TODO: only diversity supported */ if (q->cell.nof_ports > 1) { diff --git a/lte/phy/lib/phch/src/phich.c b/lte/phy/lib/phch/src/phich.c index d27765269..3d6fa182f 100644 --- a/lte/phy/lib/phch/src/phich.c +++ b/lte/phy/lib/phch/src/phich.c @@ -107,7 +107,7 @@ void phich_free(phich_t *q) { /* Decodes ACK * */ -char phich_ack_decode(char bits[PHICH_NBITS], uint32_t *distance) { +uint8_t phich_ack_decode(uint8_t bits[PHICH_NBITS], uint32_t *distance) { int i, n; n = 0; @@ -131,8 +131,8 @@ char phich_ack_decode(char bits[PHICH_NBITS], uint32_t *distance) { /** Encodes the ACK * 36.212 */ -void phich_ack_encode(char ack, char bits[PHICH_NBITS]) { - memset(bits, ack, 3 * sizeof(char)); +void phich_ack_encode(uint8_t ack, uint8_t bits[PHICH_NBITS]) { + memset(bits, ack, 3 * sizeof(uint8_t)); } /* Decodes the phich channel and saves the CFI in the cfi pointer. @@ -140,7 +140,7 @@ void phich_ack_encode(char ack, char bits[PHICH_NBITS]) { * Returns 1 if successfully decoded the CFI, 0 if not and -1 on error */ int phich_decode(phich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS], - uint32_t ngroup, uint32_t nseq, uint32_t subframe, char *ack, uint32_t *distance) { + uint32_t ngroup, uint32_t nseq, uint32_t subframe, uint8_t *ack, uint32_t *distance) { /* Set pointers for layermapping & precoding */ int i, j; @@ -268,9 +268,9 @@ int phich_decode(phich_t *q, cf_t *slot_symbols, cf_t *ce[MAX_PORTS], } /** Encodes ACK/NACK bits, modulates and inserts into resource. - * The parameter ack is an array of phich_ngroups() pointers to buffers of nof_sequences chars + * The parameter ack is an array of phich_ngroups() pointers to buffers of nof_sequences uint8_ts */ -int phich_encode(phich_t *q, char ack, uint32_t ngroup, uint32_t nseq, uint32_t subframe, +int phich_encode(phich_t *q, uint8_t ack, uint32_t ngroup, uint32_t nseq, uint32_t subframe, cf_t *slot_symbols[MAX_PORTS]) { int i; diff --git a/lte/phy/lib/phch/src/regs.c b/lte/phy/lib/phch/src/regs.c index 0c0bf5405..1f6112f9d 100644 --- a/lte/phy/lib/phch/src/regs.c +++ b/lte/phy/lib/phch/src/regs.c @@ -72,7 +72,7 @@ void regs_pdcch_free(regs_t *h) { } #define PDCCH_NCOLS 32 -const unsigned char PDCCH_PERM[PDCCH_NCOLS] = +const uint8_t PDCCH_PERM[PDCCH_NCOLS] = { 1, 17, 9, 25, 5, 21, 13, 29, 3, 19, 11, 27, 7, 23, 15, 31, 0, 16, 8, 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30 }; diff --git a/lte/phy/lib/phch/test/dci_unpacking.c b/lte/phy/lib/phch/test/dci_unpacking.c index 6a1087d11..8688c0ff2 100644 --- a/lte/phy/lib/phch/test/dci_unpacking.c +++ b/lte/phy/lib/phch/test/dci_unpacking.c @@ -44,7 +44,7 @@ int main(int argc, char **argv) { int nof_prb; int nwords; int i; - char *y; + uint8_t *y; if (argc < 3) { usage(argv[0]); @@ -63,7 +63,7 @@ int main(int argc, char **argv) { y = msg.data; rlen = 0; - unsigned int x; + uint32_t x; for (i = 0; i < nwords; i++) { x = strtoul(argv[i + 3], NULL, 16); if (len - rlen < 32) { diff --git a/lte/phy/lib/phch/test/pdsch_file_test.c b/lte/phy/lib/phch/test/pdsch_file_test.c index 6cd8bd0e5..b367e07d2 100644 --- a/lte/phy/lib/phch/test/pdsch_file_test.c +++ b/lte/phy/lib/phch/test/pdsch_file_test.c @@ -227,7 +227,7 @@ int main(int argc, char **argv) { int i; int nof_frames; int ret; - char *data; + uint8_t *data; dci_location_t locations[10]; uint32_t nof_locations; dci_msg_t dci_msg; diff --git a/lte/phy/lib/phch/test/pdsch_test.c b/lte/phy/lib/phch/test/pdsch_test.c index 271b3c471..4275ef219 100644 --- a/lte/phy/lib/phch/test/pdsch_test.c +++ b/lte/phy/lib/phch/test/pdsch_test.c @@ -118,7 +118,7 @@ void parse_args(int argc, char **argv) { int main(int argc, char **argv) { pdsch_t pdsch; uint32_t i, j; - char *data = NULL; + uint8_t *data = NULL; cf_t *ce[MAX_PORTS]; uint32_t nof_re; cf_t *slot_symbols[MAX_PORTS]; @@ -160,7 +160,7 @@ int main(int argc, char **argv) { } } - data = malloc(sizeof(char) * mcs.tbs); + data = malloc(sizeof(uint8_t) * mcs.tbs); if (!data) { perror("malloc"); goto quit; diff --git a/lte/phy/lib/phch/test/phich_file_test.c b/lte/phy/lib/phch/test/phich_file_test.c index 45a514ed8..0efb7a352 100644 --- a/lte/phy/lib/phch/test/phich_file_test.c +++ b/lte/phy/lib/phch/test/phich_file_test.c @@ -216,7 +216,7 @@ int main(int argc, char **argv) { uint32_t distance; int i, n; uint32_t ngroup, nseq, max_nseq; - char ack_rx; + uint8_t ack_rx; if (argc < 3) { usage(argv[0]); diff --git a/lte/phy/lib/phch/test/phich_test.c b/lte/phy/lib/phch/test/phich_test.c index 52ef05d74..1fb45f770 100644 --- a/lte/phy/lib/phch/test/phich_test.c +++ b/lte/phy/lib/phch/test/phich_test.c @@ -105,7 +105,7 @@ int main(int argc, char **argv) { cf_t *ce[MAX_PORTS]; int nof_re; cf_t *slot_symbols[MAX_PORTS]; - char ack[50][PHICH_NORM_NSEQUENCES], ack_rx; + uint8_t ack[50][PHICH_NORM_NSEQUENCES], ack_rx; uint32_t nsf, distance; int cid, max_cid; uint32_t ngroup, nseq, max_nseq; diff --git a/lte/phy/lib/scrambling/src/scrambling.c b/lte/phy/lib/scrambling/src/scrambling.c index d6ebead94..5bf0d6f99 100644 --- a/lte/phy/lib/scrambling/src/scrambling.c +++ b/lte/phy/lib/scrambling/src/scrambling.c @@ -57,7 +57,7 @@ void scrambling_c_offset(sequence_t *s, cf_t *data, int offset, int len) { } } -void scrambling_b(sequence_t *s, char *data) { +void scrambling_b(sequence_t *s, uint8_t *data) { int i; for (i = 0; i < s->len; i++) { @@ -65,7 +65,7 @@ void scrambling_b(sequence_t *s, char *data) { } } -void scrambling_b_offset(sequence_t *s, char *data, int offset, int len) { +void scrambling_b_offset(sequence_t *s, uint8_t *data, int offset, int len) { int i; assert (len + offset <= s->len); for (i = 0; i < len; i++) { @@ -125,7 +125,7 @@ int scrambling_work(scrambling_hl* hl) { sequence_t *seq = &hl->obj.seq[sf]; if (hl->init.hard) { - memcpy(hl->output, hl->input, sizeof(char) * hl->in_len); + memcpy(hl->output, hl->input, sizeof(uint8_t) * hl->in_len); scrambling_b(seq, hl->output); } else { memcpy(hl->output, hl->input, sizeof(float) * hl->in_len); diff --git a/lte/phy/lib/scrambling/test/scrambling_test.c b/lte/phy/lib/scrambling/test/scrambling_test.c index 02056590d..75053ae00 100644 --- a/lte/phy/lib/scrambling/test/scrambling_test.c +++ b/lte/phy/lib/scrambling/test/scrambling_test.c @@ -91,7 +91,7 @@ int init_sequence(sequence_t *seq, char *name) { int main(int argc, char **argv) { int i; sequence_t seq; - char *input_b, *scrambled_b; + uint8_t *input_b, *scrambled_b; float *input_f, *scrambled_f; parse_args(argc, argv); @@ -102,12 +102,12 @@ int main(int argc, char **argv) { } if (!do_floats) { - input_b = malloc(sizeof(char) * seq.len); + input_b = malloc(sizeof(uint8_t) * seq.len); if (!input_b) { perror("malloc"); exit(-1); } - scrambled_b = malloc(sizeof(char) * seq.len); + scrambled_b = malloc(sizeof(uint8_t) * seq.len); if (!scrambled_b) { perror("malloc"); exit(-1); diff --git a/lte/phy/lib/ue/src/ue_celldetect.c b/lte/phy/lib/ue/src/ue_celldetect.c index ca20b38f1..909dd3f69 100644 --- a/lte/phy/lib/ue/src/ue_celldetect.c +++ b/lte/phy/lib/ue/src/ue_celldetect.c @@ -64,7 +64,7 @@ int ue_celldetect_init_max(ue_celldetect_t * q, uint32_t max_frames_total, uint3 perror("malloc"); goto clean_exit; } - q->mode_counted = malloc(sizeof(char) * max_frames_detected); + q->mode_counted = malloc(sizeof(uint8_t) * max_frames_detected); if (!q->mode_counted) { perror("malloc"); goto clean_exit; diff --git a/lte/phy/lib/ue/src/ue_dl.c b/lte/phy/lib/ue/src/ue_dl.c index c6957cf55..73a6044af 100644 --- a/lte/phy/lib/ue/src/ue_dl.c +++ b/lte/phy/lib/ue/src/ue_dl.c @@ -145,7 +145,7 @@ void ue_dl_free(ue_dl_t *q) { LIBLTE_API float mean_exec_time=0; int frame_cnt=0; -int ue_dl_decode(ue_dl_t *q, cf_t *input, char *data, uint32_t sf_idx, uint16_t rnti) +int ue_dl_decode(ue_dl_t *q, cf_t *input, uint8_t *data, uint32_t sf_idx, uint16_t rnti) { uint32_t cfi, cfi_distance, i; ra_pdsch_t ra_dl; diff --git a/lte/phy/lib/ue/src/ue_sync.c b/lte/phy/lib/ue/src/ue_sync.c index 9122794f5..5681d33c8 100644 --- a/lte/phy/lib/ue/src/ue_sync.c +++ b/lte/phy/lib/ue/src/ue_sync.c @@ -180,7 +180,7 @@ int track_peak_ok(ue_sync_t *q, uint32_t track_idx) { /* Make sure subframe idx is what we expect */ if ((q->sf_idx != sync_get_sf_idx(&q->strack)) && q->decode_sss_on_track) { INFO("Warning: Expected SF idx %d but got %d (%d,%g - %d,%g)!\n", - q->sf_idx, sync_get_sf_idx(&q->strack), q->strack.m0, q->strack.m1, q->strack.m0_value, q->strack.m1_value); + q->sf_idx, sync_get_sf_idx(&q->strack), q->strack.m0, q->strack.m0_value, q->strack.m1, q->strack.m1_value); /* FIXME: What should we do in this case? */ q->sf_idx = sync_get_sf_idx(&q->strack); q->state = SF_TRACK; diff --git a/lte/phy/lib/utils/src/bit.c b/lte/phy/lib/utils/src/bit.c index 46b27a426..4443bc744 100644 --- a/lte/phy/lib/utils/src/bit.c +++ b/lte/phy/lib/utils/src/bit.c @@ -31,7 +31,7 @@ #include "liblte/phy/utils/bit.h" -void bit_pack(uint32_t value, char **bits, int nof_bits) +void bit_pack(uint32_t value, uint8_t **bits, int nof_bits) { int i; @@ -41,10 +41,10 @@ void bit_pack(uint32_t value, char **bits, int nof_bits) *bits += nof_bits; } -uint32_t bit_unpack(char **bits, int nof_bits) +uint32_t bit_unpack(uint8_t **bits, int nof_bits) { int i; - unsigned int value=0; + uint32_t value=0; for(i=0; idc = val; } -static void copy_pre(char *dst, char *src, int size_d, int len, +static void copy_pre(uint8_t *dst, uint8_t *src, int size_d, int len, bool forward, bool mirror, bool dc) { int offset = dc?1:0; if(mirror && !forward){ @@ -116,7 +116,7 @@ static void copy_pre(char *dst, char *src, int size_d, int len, } } -static void copy_post(char *dst, char *src, int size_d, int len, +static void copy_post(uint8_t *dst, uint8_t *src, int size_d, int len, bool forward, bool mirror, bool dc) { int offset = dc?1:0; if(mirror && forward){ @@ -141,7 +141,7 @@ void dft_run_c(dft_plan_t *plan, dft_c_t *in, dft_c_t *out) { int i; fftwf_complex *f_out = plan->out; - copy_pre((char*)plan->in, (char*)in, sizeof(dft_c_t), plan->size, + copy_pre((uint8_t*)plan->in, (uint8_t*)in, sizeof(dft_c_t), plan->size, plan->forward, plan->mirror, plan->dc); fftwf_execute(plan->p); if (plan->norm) { @@ -153,7 +153,7 @@ void dft_run_c(dft_plan_t *plan, dft_c_t *in, dft_c_t *out) { f_out[i] = 10*log10(f_out[i]); } } - copy_post((char*)out, (char*)plan->out, sizeof(dft_c_t), plan->size, + copy_post((uint8_t*)out, (uint8_t*)plan->out, sizeof(dft_c_t), plan->size, plan->forward, plan->mirror, plan->dc); } diff --git a/lte/phy/lib/utils/src/mux.c b/lte/phy/lib/utils/src/mux.c index 6cf92ebef..e5c8b4166 100644 --- a/lte/phy/lib/utils/src/mux.c +++ b/lte/phy/lib/utils/src/mux.c @@ -27,7 +27,7 @@ - +#include #include /** @@ -38,8 +38,8 @@ void mux(void **input, void *output, int *input_lengths, int *input_padding_pre, int nof_inputs, int sample_sz) { int i,r; - char *out = (char*) output; - char **in = (char**) input; + uint8_t *out = (uint8_t*) output; + uint8_t **in = (uint8_t**) input; r=0; for (i=0;i clip) tmp = clip; - out[i] = (unsigned char) tmp; + out[i] = (uint8_t) tmp; } } diff --git a/lte/rrc/asn/INTEGER.c b/lte/rrc/asn/INTEGER.c index 8ead23d51..54feb00e9 100644 --- a/lte/rrc/asn/INTEGER.c +++ b/lte/rrc/asn/INTEGER.c @@ -307,7 +307,7 @@ INTEGER_st_prealloc(INTEGER_t *st, int min_size) { static enum xer_pbd_rval INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { INTEGER_t *st = (INTEGER_t *)sptr; - long dec_value; + long dec_value=0; long hex_value = 0; const char *lp; const char *lstart = (const char *)chunk_buf; diff --git a/lte/rrc/asn/per_support.c b/lte/rrc/asn/per_support.c index 0d089f495..9beee04e4 100644 --- a/lte/rrc/asn/per_support.c +++ b/lte/rrc/asn/per_support.c @@ -302,7 +302,7 @@ int uper_put_constrained_whole_number_s(asn_per_outp_t *po, long v, int nbits) { long svalue = uvalue1; unsigned long uvalue2 = svalue; assert(uvalue1 == uvalue2); - return uper_put_constrained_whole_number_u(po, v, nbits); + return uper_put_constrained_whole_number_u(po, v, nbits); } int uper_put_constrained_whole_number_u(asn_per_outp_t *po, unsigned long v, int nbits) { diff --git a/lte/rrc/asn/xer_decoder.c b/lte/rrc/asn/xer_decoder.c index cb4b5f878..a714ee463 100644 --- a/lte/rrc/asn/xer_decoder.c +++ b/lte/rrc/asn/xer_decoder.c @@ -222,7 +222,7 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, */ if(ctx->phase > 1) RETURN(RC_FAIL); for(;;) { - pxer_chunk_type_e ch_type; /* XER chunk type */ + pxer_chunk_type_e ch_type=0; /* XER chunk type */ ssize_t ch_size; /* Chunk size */ xer_check_tag_e tcv; /* Tag check value */