Changed char for bits to uint8_t

master
ismagom 10 years ago
parent 0b3cbb0740
commit 1adfc16e1d

@ -1,12 +1,12 @@
#ifdef CHECK_FUNCTION_EXISTS #ifdef CHECK_FUNCTION_EXISTS
char CHECK_FUNCTION_EXISTS(); uint8_t CHECK_FUNCTION_EXISTS();
#ifdef __CLASSIC_C__ #ifdef __CLASSIC_C__
int main(){ int main(){
int ac; int ac;
char*av[]; uint8_t*av[];
#else #else
int main(int ac, char*av[]){ int main(int ac, uint8_t*av[]){
#endif #endif
float ac2 = sqrtf(rand()); float ac2 = sqrtf(rand());

@ -105,7 +105,7 @@ void parse_args(prog_args_t *args, int argc, char **argv) {
/**********************************************************************/ /**********************************************************************/
/* TODO: Do something with the output data */ /* 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) { int cuhd_recv_wrapper(void *h, void *data, uint32_t nsamples) {
DEBUG(" ---- Receive %d samples ---- \n", 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); int sf_re = SF_LEN_RE(cell.nof_prb, cell.cp);
cf_t *sf_symbols = vec_malloc(sf_re * sizeof(cf_t)); cf_t *sf_symbols = vec_malloc(sf_re * sizeof(cf_t));
unsigned int nframes=0; uint32_t nframes=0;
/* Main loop */ /* Main loop */
while (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1) { while (sf_cnt < prog_args.nof_subframes || prog_args.nof_subframes == -1) {

@ -103,7 +103,7 @@ int main(int argc, char **argv) {
demod_soft_work(&demod_s); demod_soft_work(&demod_s);
/* hard decision for soft demodulation */ /* hard decision for soft demodulation */
char* tmp = malloc(nbits); uint8_t* tmp = malloc(nbits);
for (int i=0;i<nbits;i++) { for (int i=0;i<nbits;i++) {
tmp[i] = demod_s.output[i]>0?1:0; tmp[i] = demod_s.output[i]>0?1:0;
} }

@ -33,7 +33,7 @@
int main(int argc, char **argv) { int main(int argc, char **argv) {
binsource_t bs; binsource_t bs;
char* output; uint8_t* output;
binsource_init(&bs); binsource_init(&bs);
binsource_seed_time(&bs); binsource_seed_time(&bs);

@ -241,7 +241,7 @@ int main(int argc, char **argv) {
ra_prb_t prb_alloc; ra_prb_t prb_alloc;
refsignal_t refs[NSLOTS_X_FRAME]; refsignal_t refs[NSLOTS_X_FRAME];
int i, n; int i, n;
char *data; uint8_t *data;
cf_t *sf_symbols[MAX_PORTS]; cf_t *sf_symbols[MAX_PORTS];
dci_msg_t dci_msg; dci_msg_t dci_msg;
dci_location_t locations[NSUBFRAMES_X_FRAME][10]; 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); 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) { if (!data) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);

@ -159,7 +159,7 @@ void sigintHandler(int x) {
} }
/* TODO: Do something with the output data */ /* TODO: Do something with the output data */
char data[10000]; uint8_t data[10000];
extern float mean_exec_time; extern float mean_exec_time;

@ -32,7 +32,7 @@
#include "liblte/phy/common/phy_common.h" #include "liblte/phy/common/phy_common.h"
typedef struct LIBLTE_API { typedef struct LIBLTE_API {
char *c; uint8_t *c;
uint32_t len; uint32_t len;
} sequence_t; } sequence_t;

@ -40,7 +40,7 @@ typedef struct LIBLTE_API {
bool tail_biting; bool tail_biting;
}convcoder_t; }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 */ /* High-level API */
@ -55,9 +55,9 @@ typedef struct LIBLTE_API {
int generator_2; int generator_2;
int frame_length; int frame_length;
} ctrl_in; } ctrl_in;
char *input; uint8_t *input;
int in_len; int in_len;
char *output; uint8_t *output;
int out_len; int out_len;
}convcoder_hl; }convcoder_hl;

@ -34,18 +34,18 @@
typedef struct LIBLTE_API { typedef struct LIBLTE_API {
unsigned long table[256]; unsigned long table[256];
unsigned char byte; uint8_t byte;
int polynom; int polynom;
int order; int order;
unsigned long crcinit; unsigned long crcinit;
unsigned long crcmask; unsigned long crcmask;
unsigned long crchighbit; unsigned long crchighbit;
unsigned int crc_out; uint32_t crc_out;
} crc_t; } 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 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 void crc_attach(crc_t *h, uint8_t *data, int len);
LIBLTE_API uint32_t crc_checksum(crc_t *h, char *data, int len); LIBLTE_API uint32_t crc_checksum(crc_t *h, uint8_t *data, int len);
#endif #endif

@ -33,9 +33,9 @@
#define RX_NULL 10000 #define RX_NULL 10000
#define TX_NULL 80 #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, uint32_t in_len,
char *output, uint8_t *output,
uint32_t out_len); uint32_t out_len);
LIBLTE_API int rm_conv_rx(float *input, LIBLTE_API int rm_conv_rx(float *input,
@ -49,7 +49,7 @@ typedef struct
struct rm_conv_init { struct rm_conv_init {
int direction; int direction;
} init; } 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; int in_len;
struct rm_conv_ctrl_in { struct rm_conv_ctrl_in {
int E; int E;

@ -41,11 +41,11 @@
#include "liblte/config.h" #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, uint32_t buff_len,
char *input, uint8_t *input,
uint32_t in_len, uint32_t in_len,
char *output, uint8_t *output,
uint32_t out_len, uint32_t out_len,
uint32_t rv_idx); uint32_t rv_idx);
@ -63,7 +63,7 @@ typedef struct LIBLTE_API {
struct rm_turbo_init { struct rm_turbo_init {
int direction; int direction;
} init; } 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; int in_len;
struct rm_turbo_ctrl_in { struct rm_turbo_ctrl_in {
int E; int E;

@ -43,7 +43,7 @@ typedef struct LIBLTE_API {
LIBLTE_API int tcod_init(tcod_t *h, uint32_t max_long_cb); LIBLTE_API int tcod_init(tcod_t *h, uint32_t max_long_cb);
LIBLTE_API void tcod_free(tcod_t *h); 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 #endif

@ -80,12 +80,12 @@ LIBLTE_API void tdec_iteration(tdec_t * h,
uint32_t long_cb); uint32_t long_cb);
LIBLTE_API void tdec_decision(tdec_t * h, LIBLTE_API void tdec_decision(tdec_t * h,
char *output, uint8_t *output,
uint32_t long_cb); uint32_t long_cb);
LIBLTE_API void tdec_run_all(tdec_t * h, LIBLTE_API void tdec_run_all(tdec_t * h,
llr_t * input, llr_t * input,
char *output, uint8_t *output,
uint32_t nof_iterations, uint32_t nof_iterations,
uint32_t long_cb); uint32_t long_cb);

@ -40,13 +40,13 @@ typedef struct LIBLTE_API{
void *ptr; void *ptr;
uint32_t R; uint32_t R;
uint32_t K; uint32_t K;
unsigned int framebits; uint32_t framebits;
bool tail_biting; bool tail_biting;
uint32_t poly[3]; uint32_t poly[3];
int (*decode) (void*, uint8_t*, char*, uint32_t); int (*decode) (void*, uint8_t*, uint8_t*, uint32_t);
void (*free) (void*); void (*free) (void*);
unsigned char *tmp; uint8_t *tmp;
unsigned char *symbols_uc; uint8_t *symbols_uc;
}viterbi_t; }viterbi_t;
LIBLTE_API int viterbi_init(viterbi_t *q, 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, LIBLTE_API int viterbi_decode_f(viterbi_t *q,
float *symbols, float *symbols,
char *data, uint8_t *data,
uint32_t frame_length); uint32_t frame_length);
LIBLTE_API int viterbi_decode_uc(viterbi_t *q, LIBLTE_API int viterbi_decode_uc(viterbi_t *q,
uint8_t *symbols, uint8_t *symbols,
char *data, uint8_t *data,
uint32_t frame_length); uint32_t frame_length);
@ -82,7 +82,7 @@ typedef struct LIBLTE_API{
} init; } init;
float *input; float *input;
int in_len; int in_len;
char *output; uint8_t *output;
int out_len; int out_len;
}viterbi_hl; }viterbi_hl;

@ -35,7 +35,7 @@
/* Low-level API */ /* Low-level API */
typedef struct LIBLTE_API{ typedef struct LIBLTE_API{
unsigned int seed; uint32_t seed;
uint32_t *seq_buff; uint32_t *seq_buff;
int seq_buff_nwords; int seq_buff_nwords;
int seq_cache_nbits; int seq_cache_nbits;
@ -44,23 +44,23 @@ typedef struct LIBLTE_API{
LIBLTE_API void binsource_init(binsource_t* q); LIBLTE_API void binsource_init(binsource_t* q);
LIBLTE_API void binsource_free(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 void binsource_seed_time(binsource_t *q);
LIBLTE_API int binsource_cache_gen(binsource_t* q, int nbits); 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 void binsource_cache_cpy(binsource_t* q, uint8_t *bits, int nbits);
LIBLTE_API int binsource_generate(binsource_t* q, char *bits, int nbits); LIBLTE_API int binsource_generate(binsource_t* q, uint8_t *bits, int nbits);
/* High-level API */ /* High-level API */
typedef struct LIBLTE_API { typedef struct LIBLTE_API {
binsource_t obj; binsource_t obj;
struct binsource_init { struct binsource_init {
int cache_seq_nbits; // If non-zero, generates random bits on 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; } init;
struct binsource_ctrl_in { struct binsource_ctrl_in {
int nbits; // Number of bits to generate int nbits; // Number of bits to generate
} ctrl_in; } ctrl_in;
char* output; uint8_t* output;
int out_len; int out_len;
}binsource_hl; }binsource_hl;

@ -44,7 +44,7 @@ typedef struct LIBLTE_API {
LIBLTE_API void demod_hard_init(demod_hard_t* q); 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 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; cf_t* input;
int in_len; int in_len;
char* output; uint8_t* output;
int out_len; int out_len;
}demod_hard_hl; }demod_hard_hl;

@ -37,7 +37,7 @@
typedef _Complex float cf_t; 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 */ /* High-level API */
typedef struct LIBLTE_API { typedef struct LIBLTE_API {
@ -46,7 +46,7 @@ typedef struct LIBLTE_API {
lte_mod_t std; // symbol mapping standard (see modem_table.h) lte_mod_t std; // symbol mapping standard (see modem_table.h)
} init; } init;
const char* input; const uint8_t* input;
int in_len; int in_len;
cf_t* output; cf_t* output;

@ -67,7 +67,7 @@ typedef struct LIBLTE_API {
} dci_location_t; } dci_location_t;
typedef struct LIBLTE_API { typedef struct LIBLTE_API {
char data[DCI_MAX_BITS]; uint8_t data[DCI_MAX_BITS];
uint32_t nof_bits; uint32_t nof_bits;
} dci_msg_t; } dci_msg_t;

@ -68,9 +68,9 @@ typedef struct LIBLTE_API {
float *pbch_llr; float *pbch_llr;
float *temp; float *temp;
float *pbch_rm_f; float *pbch_rm_f;
char *pbch_rm_b; uint8_t *pbch_rm_b;
char *data; uint8_t *data;
char *data_enc; uint8_t *data_enc;
uint32_t frame_idx; uint32_t frame_idx;

@ -58,7 +58,7 @@ typedef struct LIBLTE_API {
cf_t pcfich_d[PCFICH_RE]; cf_t pcfich_d[PCFICH_RE];
/* bit message */ /* bit message */
char data[PCFICH_CFI_LEN]; uint8_t data[PCFICH_CFI_LEN];
/* tx & rx objects */ /* tx & rx objects */
modem_table_t mod; modem_table_t mod;

@ -65,7 +65,7 @@ typedef struct LIBLTE_API {
cf_t *pdcch_symbols[MAX_PORTS]; cf_t *pdcch_symbols[MAX_PORTS];
cf_t *pdcch_x[MAX_PORTS]; cf_t *pdcch_x[MAX_PORTS];
cf_t *pdcch_d; cf_t *pdcch_d;
char *pdcch_e; uint8_t *pdcch_e;
float *pdcch_llr; float *pdcch_llr;
/* tx & rx objects */ /* tx & rx objects */

@ -55,7 +55,7 @@ typedef struct LIBLTE_API {
uint32_t max_cb; uint32_t max_cb;
uint32_t w_buff_size; uint32_t w_buff_size;
float **pdsch_w_buff_f; float **pdsch_w_buff_f;
char **pdsch_w_buff_c; uint8_t **pdsch_w_buff_c;
struct cb_segm { struct cb_segm {
uint32_t F; uint32_t F;
@ -85,7 +85,7 @@ typedef struct LIBLTE_API {
cf_t *pdsch_symbols[MAX_PORTS]; cf_t *pdsch_symbols[MAX_PORTS];
cf_t *pdsch_x[MAX_PORTS]; cf_t *pdsch_x[MAX_PORTS];
cf_t *pdsch_d; cf_t *pdsch_d;
char *cb_in; uint8_t *cb_in;
void *cb_out; void *cb_out;
void *pdsch_e; 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 void pdsch_harq_free(pdsch_harq_t *p);
LIBLTE_API int pdsch_encode(pdsch_t *q, LIBLTE_API int pdsch_encode(pdsch_t *q,
char *data, uint8_t *data,
cf_t *sf_symbols[MAX_PORTS], cf_t *sf_symbols[MAX_PORTS],
uint32_t nsubframe, uint32_t nsubframe,
pdsch_harq_t *harq_process, 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, LIBLTE_API int pdsch_decode(pdsch_t *q,
cf_t *sf_symbols, cf_t *sf_symbols,
cf_t *ce[MAX_PORTS], cf_t *ce[MAX_PORTS],
char *data, uint8_t *data,
uint32_t nsubframe, uint32_t nsubframe,
pdsch_harq_t *harq_process, pdsch_harq_t *harq_process,
uint32_t rv_idx); uint32_t rv_idx);

@ -69,7 +69,7 @@ typedef struct LIBLTE_API {
cf_t phich_z[PHICH_NBITS]; cf_t phich_z[PHICH_NBITS];
/* bit message */ /* bit message */
char data[PHICH_NBITS]; uint8_t data[PHICH_NBITS];
/* tx & rx objects */ /* tx & rx objects */
modem_table_t mod; modem_table_t mod;
@ -90,11 +90,11 @@ LIBLTE_API int phich_decode(phich_t *q,
uint32_t ngroup, uint32_t ngroup,
uint32_t nseq, uint32_t nseq,
uint32_t nsubframe, uint32_t nsubframe,
char *ack, uint8_t *ack,
uint32_t *distance); uint32_t *distance);
LIBLTE_API int phich_encode(phich_t *q, LIBLTE_API int phich_encode(phich_t *q,
char ack, uint8_t ack,
uint32_t ngroup, uint32_t ngroup,
uint32_t nseq, uint32_t nseq,
uint32_t nsubframe, uint32_t nsubframe,

@ -36,8 +36,8 @@
typedef _Complex float cf_t; typedef _Complex float cf_t;
/* Scrambling has no state */ /* Scrambling has no state */
LIBLTE_API void scrambling_b(sequence_t *s, char *data); LIBLTE_API void scrambling_b(sequence_t *s, uint8_t *data);
LIBLTE_API void scrambling_b_offset(sequence_t *s, char *data, int offset, int len); 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(sequence_t *s, float *data);
LIBLTE_API void scrambling_f_offset(sequence_t *s, float *data, int offset, int len); 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 channel;
int nof_symbols; // 7 normal 6 extended int nof_symbols; // 7 normal 6 extended
} init; } 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; int in_len;
struct scrambling_ctrl_in { struct scrambling_ctrl_in {
int subframe; int subframe;

@ -88,7 +88,7 @@ typedef struct LIBLTE_API {
uint32_t current_nof_total; uint32_t current_nof_total;
uint32_t *mode_ntimes; uint32_t *mode_ntimes;
char *mode_counted; uint8_t *mode_counted;
ue_celldetect_result_t *candidates; ue_celldetect_result_t *candidates;
} ue_celldetect_t; } ue_celldetect_t;

@ -92,7 +92,7 @@ LIBLTE_API void ue_dl_free(ue_dl_t *q);
LIBLTE_API int ue_dl_decode(ue_dl_t *q, LIBLTE_API int ue_dl_decode(ue_dl_t *q,
cf_t *sf_buffer, cf_t *sf_buffer,
char *data, uint8_t *data,
uint32_t sf_idx, uint32_t sf_idx,
uint16_t rnti); uint16_t rnti);

@ -34,10 +34,10 @@
#include "liblte/config.h" #include "liblte/config.h"
LIBLTE_API uint32_t bit_unpack(char **bits, int nof_bits); LIBLTE_API uint32_t bit_unpack(uint8_t **bits, int nof_bits);
LIBLTE_API void bit_pack(uint32_t value, char **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, char *bits, int nof_bits); LIBLTE_API void bit_fprint(FILE *stream, uint8_t *bits, int nof_bits);
LIBLTE_API unsigned int bit_diff(char *x, char *y, int nbits); LIBLTE_API uint32_t bit_diff(uint8_t *x, uint8_t *y, int nbits);
LIBLTE_API uint32_t bit_count(uint32_t n); LIBLTE_API uint32_t bit_count(uint32_t n);
#endif // BIT_ #endif // BIT_

@ -30,8 +30,13 @@
#define PACK_ #define PACK_
#include "liblte/config.h" #include "liblte/config.h"
#include <stdint.h>
LIBLTE_API unsigned int unpack_bits(char **bits, int nof_bits); LIBLTE_API uint32_t unpack_bits(uint8_t **bits,
LIBLTE_API void pack_bits(unsigned int value, char **bits, int nof_bits); int nof_bits);
LIBLTE_API void pack_bits(uint32_t value,
uint8_t **bits,
int nof_bits);
#endif // PACK_ #endif // PACK_

@ -53,15 +53,15 @@ LIBLTE_API void *vec_realloc(void *ptr, uint32_t old_size, uint32_t new_size);
/* print vectors */ /* print vectors */
LIBLTE_API void vec_fprint_c(FILE *stream, cf_t *x, uint32_t len); 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_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_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 */ /* Saves a vector to a file */
LIBLTE_API void vec_save_file(char *filename, void *buffer, uint32_t len); LIBLTE_API void vec_save_file(char *filename, void *buffer, uint32_t len);
/* sum two vectors */ /* 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); LIBLTE_API void vec_sum_ccc(cf_t *x, cf_t *y, cf_t *z, uint32_t len);
/* substract two vectors z=x-y */ /* 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_fi(float *x, uint32_t len);
LIBLTE_API uint32_t vec_max_abs_ci(cf_t *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 */ /* quantify vector of floats and convert to uint8_t */
LIBLTE_API void vec_quant_fuc(float *in, unsigned char *out, float gain, float offset, float clip, uint32_t len); 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 */ /* magnitude of each vector element */
LIBLTE_API void vec_abs_cf(cf_t *x, float *abs, uint32_t len); LIBLTE_API void vec_abs_cf(cf_t *x, float *abs, uint32_t len);

@ -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) { if (len >= 3 * RE_X_RB) {
uint32_t n_sz; uint32_t n_sz=0;
uint32_t q; uint32_t q;
float q_hat; float q_hat;
/* get largest prime n_zc<len */ /* get largest prime n_zc<len */

@ -40,7 +40,7 @@ lte_cell_t cell = {
CPNORM // cyclic prefix CPNORM // cyclic prefix
}; };
char *output_matlab = NULL; uint8_t *output_matlab = NULL;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [recov]\n", prog); printf("Usage: %s [recov]\n", prog);

@ -88,7 +88,7 @@ int sequence_init(sequence_t *q, uint32_t len) {
free(q->c); free(q->c);
} }
if (!q->c) { if (!q->c) {
q->c = malloc(len * sizeof(char)); q->c = malloc(len * sizeof(uint8_t));
if (!q->c) { if (!q->c) {
return LIBLTE_ERROR; return LIBLTE_ERROR;
} }

@ -34,7 +34,7 @@
#include "liblte/phy/fec/convcoder.h" #include "liblte/phy/fec/convcoder.h"
#include "parity.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 sr;
uint32_t i,j; uint32_t i,j;
uint32_t len = q->tail_biting ? frame_length : (frame_length + q->K - 1); 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; sr = 0;
} }
for (i = 0; i < len; i++) { 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; sr = (sr << 1) | bit;
for (j=0;j<q->R;j++) { for (j=0;j<q->R;j++) {
output[q->R * i + j] = parity(sr & q->poly[j]); output[q->R * i + j] = parity(sr & q->poly[j]);

@ -54,14 +54,14 @@ unsigned long crctable(crc_t *h) {
// Polynom order 8, 16, 24 or 32 only. // Polynom order 8, 16, 24 or 32 only.
int ord = h->order - 8; int ord = h->order - 8;
unsigned long crc = h->crcinit; unsigned long crc = h->crcinit;
unsigned char byte = h->byte; uint8_t byte = h->byte;
crc = (crc << 8) ^ h->table[((crc >> (ord)) & 0xff) ^ byte]; crc = (crc << 8) ^ h->table[((crc >> (ord)) & 0xff) ^ byte];
h->crcinit = crc; h->crcinit = crc;
return (crc & h->crcmask); 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; unsigned long m, rmask = 0x1;
@ -84,7 +84,7 @@ int crc_set_init(crc_t *crc_par, unsigned long crc_init_value) {
return 0; 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 // Set crc working default parameters
h->polynom = crc_poly; h->polynom = crc_poly;
@ -114,10 +114,10 @@ int crc_init(crc_t *h, unsigned int crc_poly, int crc_order) {
return 0; 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; int i, k, len8, res8, a = 0;
unsigned int crc = 0; uint32_t crc = 0;
char *pter; uint8_t *pter;
crc_set_init(h, 0); crc_set_init(h, 0);
@ -130,14 +130,14 @@ uint32_t crc_checksum(crc_t *h, char *data, int len) {
// Calculate CRC // Calculate CRC
for (i = 0; i < len8 + a; i++) { for (i = 0; i < len8 + a; i++) {
pter = (char *) (data + 8 * i); pter = (uint8_t *) (data + 8 * i);
if (i == len8) { if (i == len8) {
h->byte = 0x00; h->byte = 0x00;
for (k = 0; k < res8; k++) { for (k = 0; k < res8; k++) {
h->byte |= ((unsigned char) *(pter + k)) << (7 - k); h->byte |= ((uint8_t) *(pter + k)) << (7 - k);
} }
} else { } else {
h->byte = (unsigned char) (unpack_bits(&pter, 8) & 0xFF); h->byte = (uint8_t) (unpack_bits(&pter, 8) & 0xFF);
} }
crc = crctable(h); 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. /** Appends crc_order checksum bits to the buffer data.
* The buffer data must be len + crc_order bytes * The buffer data must be len + crc_order bytes
*/ */
void crc_attach(crc_t *h, char *data, int len) { void crc_attach(crc_t *h, uint8_t *data, int len) {
unsigned int checksum = crc_checksum(h, data, len); uint32_t checksum = crc_checksum(h, data, len);
// Add CRC // Add CRC
char *ptr = &data[len]; uint8_t *ptr = &data[len];
pack_bits(checksum, &ptr, h->order); pack_bits(checksum, &ptr, h->order);
} }

@ -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, { 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 }; 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 nrows, ndummy, K_p;
int i, j, k, s; int i, j, k, s;

@ -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 * 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) { uint32_t out_len, uint32_t rv_idx) {
int ndummy, kidx; int ndummy, kidx;

@ -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, 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, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199,
211, 223, 227, 229, 233, 239, 241, 251, 257 }; 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, 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 }; 5, 2, 3, 2, 3, 2, 6, 3, 7, 7, 6, 3 };

@ -47,12 +47,12 @@ void tcod_free(tcod_t *h) {
h->max_long_cb = 0; 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; uint32_t i, k = 0, j;
char bit; uint8_t bit;
char in, out; uint8_t in, out;
uint32_t *per; uint32_t *per;
if (long_cb > h->max_long_cb) { if (long_cb > h->max_long_cb) {

@ -317,7 +317,7 @@ int tdec_reset(tdec_t * h, uint32_t long_cb)
return tc_interl_LTE_gen(&h->interleaver, 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; uint32_t i;
for (i = 0; i < long_cb; 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 nof_iterations, uint32_t long_cb)
{ {
uint32_t iter = 0; uint32_t iter = 0;

@ -40,7 +40,7 @@
#define DEB 0 #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; viterbi_t *q = o;
uint32_t i; uint32_t i;
@ -57,7 +57,7 @@ int decode37(void *o, uint8_t *symbols, char *data, uint32_t frame_length) {
/* Decode block */ /* Decode block */
if (q->tail_biting) { 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++) { for (i = 0; i < 3 * (q->K - 1); i++) {
q->tmp[i + 3 * frame_length] = q->tmp[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; 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; viterbi_t *q = o;
if (frame_length > q->framebits) { 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->tail_biting = tail_biting;
q->decode = decode37; q->decode = decode37;
q->free = free37; 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) { if (!q->symbols_uc) {
perror("malloc"); perror("malloc");
return -1; return -1;
} }
if (q->tail_biting) { 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) { if (!q->tmp) {
perror("malloc"); perror("malloc");
free37(q); 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"); "Error: Tailbitting not supported in 1/3 K=9 decoder\n");
return -1; 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) { if (!q->symbols_uc) {
perror("malloc"); perror("malloc");
return -1; return -1;
@ -193,7 +193,7 @@ void viterbi_free(viterbi_t *q) {
} }
/* symbols are real-valued */ /* 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; uint32_t len;
if (frame_length > q->framebits) { if (frame_length > q->framebits) {
fprintf(stderr, "Initialized decoder for max frame length %d bits\n", 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); 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) { uint32_t frame_length) {
return q->decode(q, symbols, data, frame_length); return q->decode(q, symbols, data, frame_length);
} }

@ -34,13 +34,13 @@ int init_viterbi37_port(void *p,
uint32_t starting_state); uint32_t starting_state);
int chainback_viterbi37_port(void *p, int chainback_viterbi37_port(void *p,
char *data, uint8_t *data,
uint32_t nbits, uint32_t nbits,
uint32_t endstate); uint32_t endstate);
void delete_viterbi37_port(void *p); void delete_viterbi37_port(void *p);
int update_viterbi37_blk_port(void *p, int update_viterbi37_blk_port(void *p,
unsigned char *syms, uint8_t *syms,
uint32_t nbits, uint32_t nbits,
uint32_t *best_state); uint32_t *best_state);

@ -12,14 +12,14 @@
#include <limits.h> #include <limits.h>
typedef union { typedef union {
unsigned int w[64]; uint32_t w[64];
} metric_t; } metric_t;
typedef union { typedef union {
unsigned long w[2]; unsigned long w[2];
} decision_t; } decision_t;
static union { static union {
unsigned char c[128]; uint8_t c[128];
} Branchtab37[3]; } Branchtab37[3];
/* State info for instance of Viterbi decoder */ /* State info for instance of Viterbi decoder */
@ -83,7 +83,7 @@ void *create_viterbi37_port(uint32_t polys[3], uint32_t len) {
} }
/* Viterbi chainback */ /* 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 nbits, /* Number of data bits */
uint32_t endstate) { /* Terminal encoder state */ uint32_t endstate) { /* Terminal encoder state */
struct v37 *vp = p; struct v37 *vp = p;
@ -127,7 +127,7 @@ void delete_viterbi37_port(void *p) {
/* C-language butterfly */ /* C-language butterfly */
#define BFLY(i) {\ #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) + \ metric = (Branchtab37[0].c[i] ^ sym0) + (Branchtab37[1].c[i] ^ sym1) + \
(Branchtab37[2].c[i] ^ sym2);\ (Branchtab37[2].c[i] ^ sym2);\
m0 = vp->old_metrics->w[i] + metric;\ m0 = vp->old_metrics->w[i] + metric;\

@ -34,7 +34,7 @@ int init_viterbi39_port(void *p,
uint32_t starting_state); uint32_t starting_state);
int chainback_viterbi39_port(void *p, 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 nbits, /* Number of data bits */
uint32_t endstate); uint32_t endstate);

@ -10,14 +10,14 @@
#include "parity.h" #include "parity.h"
typedef union { typedef union {
unsigned int w[256]; uint32_t w[256];
} metric_t; } metric_t;
typedef union { typedef union {
unsigned long w[8]; unsigned long w[8];
} decision_t; } decision_t;
static union { static union {
unsigned char c[128]; uint8_t c[128];
} Branchtab39[3]; } Branchtab39[3];
/* State info for instance of Viterbi decoder */ /* State info for instance of Viterbi decoder */
@ -79,7 +79,7 @@ void *create_viterbi39_port(uint32_t polys[3], uint32_t len) {
} }
/* Viterbi chainback */ /* 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 nbits, /* Number of data bits */
uint32_t endstate) { /* Terminal encoder state */ uint32_t endstate) { /* Terminal encoder state */
struct v39 *vp = p; struct v39 *vp = p;
@ -121,7 +121,7 @@ void delete_viterbi39_port(void *p) {
/* C-language butterfly */ /* C-language butterfly */
#define BFLY(i) {\ #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) + \ metric = (Branchtab39[0].c[i] ^ sym0) + (Branchtab39[1].c[i] ^ sym1) + \
(Branchtab39[2].c[i] ^ sym2);\ (Branchtab39[2].c[i] ^ sym2);\
m0 = vp->old_metrics->w[i] + metric;\ m0 = vp->old_metrics->w[i] + metric;\

@ -37,8 +37,8 @@
#include "crc_test.h" #include "crc_test.h"
int num_bits = 5001, crc_length = 24; int num_bits = 5001, crc_length = 24;
unsigned int crc_poly = 0x1864CFB; uint32_t crc_poly = 0x1864CFB;
unsigned int seed = 1; uint32_t seed = 1;
void usage(char *prog) { void usage(char *prog) {
printf("Usage: %s [nlps]\n", prog); printf("Usage: %s [nlps]\n", prog);
@ -59,10 +59,10 @@ void parse_args(int argc, char **argv) {
crc_length = atoi(argv[optind]); crc_length = atoi(argv[optind]);
break; break;
case 'p': case 'p':
crc_poly = (unsigned int) strtoul(argv[optind], NULL, 16); crc_poly = (uint32_t) strtoul(argv[optind], NULL, 16);
break; break;
case 's': case 's':
seed = (unsigned int) strtoul(argv[optind], NULL, 0); seed = (uint32_t) strtoul(argv[optind], NULL, 0);
break; break;
default: default:
usage(argv[0]); usage(argv[0]);
@ -73,13 +73,13 @@ void parse_args(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
int i; int i;
char *data; uint8_t *data;
unsigned int crc_word, expected_word; uint32_t crc_word, expected_word;
crc_t crc_p; crc_t crc_p;
parse_args(argc, argv); 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) { if (!data) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);

@ -32,9 +32,9 @@
typedef struct { typedef struct {
int n; int n;
int l; int l;
unsigned int p; uint32_t p;
unsigned int s; uint32_t s;
unsigned int word; uint32_t word;
}expected_word_t; }expected_word_t;
@ -48,7 +48,7 @@ static expected_word_t expected_words[] = {
{-1, -1, 0, 0, 0} {-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; int i;
i=0; i=0;
while(expected_words[i].n != -1) { while(expected_words[i].n != -1) {

@ -69,18 +69,18 @@ void parse_args(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
int i; int i;
char *bits, *rm_bits; uint8_t *bits, *rm_bits;
float *rm_symbols, *unrm_symbols; float *rm_symbols, *unrm_symbols;
int nof_errors; int nof_errors;
parse_args(argc, argv); parse_args(argc, argv);
bits = malloc(sizeof(char) * nof_tx_bits); bits = malloc(sizeof(uint8_t) * nof_tx_bits);
if (!bits) { if (!bits) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
rm_bits = malloc(sizeof(char) * nof_rx_bits); rm_bits = malloc(sizeof(uint8_t) * nof_rx_bits);
if (!rm_bits) { if (!rm_bits) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);

@ -73,23 +73,23 @@ void parse_args(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
int i; 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; float *rm_symbols, *unrm_symbols, *w_buff_f;
int nof_errors; int nof_errors;
parse_args(argc, argv); parse_args(argc, argv);
bits = malloc(sizeof(char) * nof_tx_bits); bits = malloc(sizeof(uint8_t) * nof_tx_bits);
if (!bits) { if (!bits) {
perror("malloc"); perror("malloc");
exit(-1); 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) { if (!w_buff_c) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
rm_bits = malloc(sizeof(char) * nof_rx_bits); rm_bits = malloc(sizeof(uint8_t) * nof_rx_bits);
if (!rm_bits) { if (!rm_bits) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);

@ -90,7 +90,7 @@ void parse_args(int argc, char **argv) {
ebno_db = atof(argv[optind]); ebno_db = atof(argv[optind]);
break; break;
case 's': case 's':
seed = (unsigned int) strtoul(argv[optind], NULL, 0); seed = (uint32_t) strtoul(argv[optind], NULL, 0);
break; break;
case 'v': case 'v':
verbose++; verbose++;
@ -129,8 +129,8 @@ void output_matlab(float ber[MAX_ITERATIONS][SNR_POINTS], int snr_points) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
uint32_t frame_cnt; uint32_t frame_cnt;
float *llr; float *llr;
unsigned char *llr_c; uint8_t *llr_c;
char *data_tx, *data_rx, *symbols; uint8_t *data_tx, *data_rx, *symbols;
uint32_t i, j; uint32_t i, j;
float var[SNR_POINTS]; float var[SNR_POINTS];
uint32_t snr_points; uint32_t snr_points;
@ -162,19 +162,19 @@ int main(int argc, char **argv) {
printf(" EbNo: %.2f\n", ebno_db); printf(" EbNo: %.2f\n", ebno_db);
} }
data_tx = malloc(frame_length * sizeof(char)); data_tx = malloc(frame_length * sizeof(uint8_t));
if (!data_tx) { if (!data_tx) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
data_rx = malloc(frame_length * sizeof(char)); data_rx = malloc(frame_length * sizeof(uint8_t));
if (!data_rx) { if (!data_rx) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
symbols = malloc(coded_length * sizeof(char)); symbols = malloc(coded_length * sizeof(uint8_t));
if (!symbols) { if (!symbols) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
@ -184,7 +184,7 @@ int main(int argc, char **argv) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
llr_c = malloc(coded_length * sizeof(char)); llr_c = malloc(coded_length * sizeof(uint8_t));
if (!llr_c) { if (!llr_c) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);

@ -29,7 +29,7 @@
typedef struct { typedef struct {
int n; int n;
unsigned int s; uint32_t s;
int iterations; int iterations;
int len; int len;
float ebno; 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; int i;
i = 0; i = 0;
while (expected_errors[i].n != -1) { 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}; const int known_data_errors[4] = {47, 18, 0, 0};
#define KNOWN_DATA_LEN 504 #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, 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, 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, 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, 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 }; 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, 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, 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, 0, 0, 1, 0, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0,

@ -41,7 +41,7 @@ typedef _Complex float cf_t;
int frame_length = 1000, nof_frames = 128; int frame_length = 1000, nof_frames = 128;
float ebno_db = 100.0; float ebno_db = 100.0;
unsigned int seed = 0; uint32_t seed = 0;
bool tail_biting = false; bool tail_biting = false;
int K = -1; int K = -1;
@ -76,7 +76,7 @@ void parse_args(int argc, char **argv) {
ebno_db = atof(argv[optind]); ebno_db = atof(argv[optind]);
break; break;
case 's': case 's':
seed = (unsigned int) strtoul(argv[optind], NULL, 0); seed = (uint32_t) strtoul(argv[optind], NULL, 0);
break; break;
case 't': case 't':
tail_biting = true; 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 main(int argc, char **argv) {
int frame_cnt; int frame_cnt;
float *llr; float *llr;
unsigned char *llr_c; uint8_t *llr_c;
char *data_tx, *data_rx[NTYPES], *symbols; uint8_t *data_tx, *data_rx[NTYPES], *symbols;
int i, j; int i, j;
float var[SNR_POINTS], varunc[SNR_POINTS]; float var[SNR_POINTS], varunc[SNR_POINTS];
int snr_points; int snr_points;
float ber[NTYPES][SNR_POINTS]; float ber[NTYPES][SNR_POINTS];
unsigned int errors[NTYPES]; uint32_t errors[NTYPES];
viterbi_type_t viterbi_type[NCODS]; viterbi_type_t viterbi_type[NCODS];
viterbi_t dec[NCODS]; viterbi_t dec[NCODS];
convcoder_t cod[NCODS]; convcoder_t cod[NCODS];
@ -200,21 +200,21 @@ int main(int argc, char **argv) {
printf(" EbNo: %.2f\n", ebno_db); printf(" EbNo: %.2f\n", ebno_db);
} }
data_tx = malloc(frame_length * sizeof(char)); data_tx = malloc(frame_length * sizeof(uint8_t));
if (!data_tx) { if (!data_tx) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
for (i = 0; i < NTYPES; i++) { 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]) { if (!data_rx[i]) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
} }
symbols = malloc(max_coded_length * sizeof(char)); symbols = malloc(max_coded_length * sizeof(uint8_t));
if (!symbols) { if (!symbols) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
@ -224,7 +224,7 @@ int main(int argc, char **argv) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
llr_c = malloc(2 * max_coded_length * sizeof(char)); llr_c = malloc(2 * max_coded_length * sizeof(uint8_t));
if (!llr_c) { if (!llr_c) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);

@ -29,7 +29,7 @@
typedef struct { typedef struct {
int n; int n;
unsigned int s; uint32_t s;
int len; int len;
int k; int k;
bool tail; bool tail;
@ -52,7 +52,7 @@ static expected_errors_t expected_errors[] = {
{-1, -1, -1, -1, true, -1.0, -1} {-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; int i;
i=0; i=0;
while(expected_errors[i].n != -1) { while(expected_errors[i].n != -1) {

@ -77,7 +77,7 @@ void binsource_free(binsource_t* q) {
/** /**
* Sets a new seed * 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; q->seed = seed;
} }
@ -102,7 +102,7 @@ int binsource_cache_gen(binsource_t* q, int nbits) {
return 0; 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; int n;
n=nbits/32; n=nbits/32;
for (int i=0;i<n;i++) { for (int i=0;i<n;i++) {
@ -115,7 +115,7 @@ static int int_2_bits(uint32_t* src, char* dst, int nbits) {
/** /**
* Copies the next random bits to the buffer bits from the array generated by binsource_cache_gen * Copies the next random bits to the buffer bits from the array generated by binsource_cache_gen
*/ */
void binsource_cache_cpy(binsource_t* q, char *bits, int nbits) { void binsource_cache_cpy(binsource_t* q, uint8_t *bits, int nbits) {
q->seq_cache_rp += int_2_bits(&q->seq_buff[q->seq_cache_rp],bits,nbits); q->seq_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. * Stores in the bits buffer a sequence of nbits pseudo-random bits.
* Overwrites the bits generated using binsource_cache_gen. * 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))) { if (gen_seq_buff(q,DIV(nbits,32))) {
return -1; return -1;

@ -41,7 +41,7 @@ void demod_hard_table_set(demod_hard_t* q, lte_mod_t mod) {
q->mod = 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; int nbits=-1;
switch(q->mod) { switch(q->mod) {

@ -43,11 +43,11 @@
*---------> I *---------> I
*1 | *1 |
* \param in input symbols (_Complex float) * \param in input symbols (_Complex float)
* \param out output symbols (chars) * \param out output symbols (uint8_ts)
* \param N Number of input symbols * \param N Number of input symbols
* \param modulation Modulation type * \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; uint32_t s;
@ -78,11 +78,11 @@ inline void hard_bpsk_demod(const cf_t* in, char* out, uint32_t N)
*11 | 01 *11 | 01
* *
* \param in input symbols (_Complex float) * \param in input symbols (_Complex float)
* \param out output symbols (chars) * \param out output symbols (uint8_ts)
* \param N Number of input symbols * \param N Number of input symbols
* \param modulation Modulation type * \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; 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 * 1111 1101 | 0101 0111
* *
* \param in input symbols (_Complex float) * \param in input symbols (_Complex float)
* \param out output symbols (chars) * \param out output symbols (uint8_ts)
* \param N Number of input symbols * \param N Number of input symbols
* \param modulation Modulation type * \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; 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] * see [3GPP TS 36.211 version 10.5.0 Release 10, Section 7.1.4]
* *
* \param in input symbols (_Complex float) * \param in input symbols (_Complex float)
* \param out output symbols (chars) * \param out output symbols (uint8_ts)
* \param N Number of input symbols * \param N Number of input symbols
* \param modulation Modulation type * \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; uint32_t s;

@ -35,17 +35,17 @@
#define QAM64_THRESHOLD_3 6/sqrt(42) #define QAM64_THRESHOLD_3 6/sqrt(42)
void hard_bpsk_demod(const cf_t* in, void hard_bpsk_demod(const cf_t* in,
char* out, uint8_t* out,
uint32_t N); uint32_t N);
void hard_qpsk_demod(const cf_t* in, void hard_qpsk_demod(const cf_t* in,
char* out, uint8_t* out,
uint32_t N); uint32_t N);
void hard_qam16_demod(const cf_t* in, void hard_qam16_demod(const cf_t* in,
char* out, uint8_t* out,
uint32_t N); uint32_t N);
void hard_qam64_demod(const cf_t* in, void hard_qam64_demod(const cf_t* in,
char* out, uint8_t* out,
uint32_t N); uint32_t N);

@ -35,9 +35,9 @@
/** Low-level API */ /** 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; uint32_t i,j,idx;
char *b_ptr=(char*) bits; uint8_t *b_ptr=(uint8_t*) bits;
j=0; j=0;
for (i=0;i<nbits;i+=q->nbits_x_symbol) { for (i=0;i<nbits;i+=q->nbits_x_symbol) {
idx = bit_unpack(&b_ptr,q->nbits_x_symbol); idx = bit_unpack(&b_ptr,q->nbits_x_symbol);

@ -97,7 +97,7 @@ int main(int argc, char **argv) {
modem_table_t mod; modem_table_t mod;
demod_hard_t demod_hard; demod_hard_t demod_hard;
demod_soft_t demod_soft; demod_soft_t demod_soft;
char *input, *output; uint8_t *input, *output;
cf_t *symbols; cf_t *symbols;
float *llr; float *llr;
@ -129,12 +129,12 @@ int main(int argc, char **argv) {
} }
/* allocate buffers */ /* allocate buffers */
input = malloc(sizeof(char) * num_bits); input = malloc(sizeof(uint8_t) * num_bits);
if (!input) { if (!input) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
output = malloc(sizeof(char) * num_bits); output = malloc(sizeof(uint8_t) * num_bits);
if (!output) { if (!output) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);

@ -110,7 +110,7 @@ int main(int argc, char **argv) {
int i; int i;
modem_table_t mod; modem_table_t mod;
demod_soft_t demod_soft; demod_soft_t demod_soft;
char *input, *output; uint8_t *input, *output;
cf_t *symbols; cf_t *symbols;
float *llr_exact, *llr_approx; float *llr_exact, *llr_approx;
@ -131,12 +131,12 @@ int main(int argc, char **argv) {
/* allocate buffers */ /* allocate buffers */
input = malloc(sizeof(char) * num_bits); input = malloc(sizeof(uint8_t) * num_bits);
if (!input) { if (!input) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
output = malloc(sizeof(char) * num_bits); output = malloc(sizeof(uint8_t) * num_bits);
if (!output) { if (!output) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);

@ -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) { int dci_format0_pack(ra_pusch_t *data, dci_msg_t *msg, uint32_t nof_prb) {
/* pack bits */ /* pack bits */
char *y = msg->data; uint8_t *y = msg->data;
uint32_t n_ul_hop; uint32_t n_ul_hop;
*y++ = 0; // format differentiation *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) { int dci_format0_unpack(dci_msg_t *msg, ra_pusch_t *data, uint32_t nof_prb) {
/* pack bits */ /* pack bits */
char *y = msg->data; uint8_t *y = msg->data;
uint32_t n_ul_hop; uint32_t n_ul_hop;
/* Make sure it's a Format0 message */ /* 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) { int dci_format1_pack(ra_pdsch_t *data, dci_msg_t *msg, uint32_t nof_prb) {
/* pack bits */ /* pack bits */
char *y = msg->data; uint8_t *y = msg->data;
if (nof_prb > 10) { if (nof_prb > 10) {
*y++ = data->alloc_type; *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) { int dci_format1_unpack(dci_msg_t *msg, ra_pdsch_t *data, uint32_t nof_prb) {
/* pack bits */ /* pack bits */
char *y = msg->data; uint8_t *y = msg->data;
/* Make sure it's a Format1 message */ /* Make sure it's a Format1 message */
if (msg->nof_bits != dci_format_sizeof(Format1, nof_prb)) { 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) { bool crc_is_crnti) {
/* pack bits */ /* pack bits */
char *y = msg->data; uint8_t *y = msg->data;
*y++ = 1; // format differentiation *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) { bool crc_is_crnti) {
/* pack bits */ /* pack bits */
char *y = msg->data; uint8_t *y = msg->data;
/* Make sure it's a Format0 message */ /* Make sure it's a Format0 message */
if (msg->nof_bits != dci_format_sizeof(Format1A, nof_prb)) { 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) { int dci_format1Cs_pack(ra_pdsch_t *data, dci_msg_t *msg, uint32_t nof_prb) {
/* pack bits */ /* pack bits */
char *y = msg->data; uint8_t *y = msg->data;
if (data->alloc_type != alloc_type2 || data->type2_alloc.mode != t2_dist) { if (data->alloc_type != alloc_type2 || data->type2_alloc.mode != t2_dist) {
fprintf(stderr, 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; uint32_t L_p, RB_p;
/* pack bits */ /* pack bits */
char *y = msg->data; uint8_t *y = msg->data;
if (msg->nof_bits != dci_format_sizeof(Format1C, nof_prb)) { if (msg->nof_bits != dci_format_sizeof(Format1C, nof_prb)) {
fprintf(stderr, "Invalid message length for format 1C\n"); fprintf(stderr, "Invalid message length for format 1C\n");

@ -41,7 +41,7 @@
#include "liblte/phy/utils/vector.h" #include "liblte/phy/utils/vector.h"
#include "liblte/phy/utils/debug.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, { 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, 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 } }; 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) { if (!q->pbch_rm_b) {
goto clean; goto clean;
} }
q->data = malloc(sizeof(char) * 40); q->data = malloc(sizeof(uint8_t) * 40);
if (!q->data) { if (!q->data) {
goto clean; goto clean;
} }
q->data_enc = malloc(sizeof(char) * 120); q->data_enc = malloc(sizeof(uint8_t) * 120);
if (!q->data_enc) { if (!q->data_enc) {
goto clean; goto clean;
} }
@ -252,7 +252,7 @@ void pbch_free(pbch_t *q) {
/** Unpacks MIB from PBCH message. /** Unpacks MIB from PBCH message.
* msg buffer must be 24 byte length at least * 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; int bw, phich_res;
bw = bit_unpack(&msg, 3); bw = bit_unpack(&msg, 3);
@ -295,7 +295,7 @@ void pbch_mib_unpack(char *msg, pbch_mib_t *mib) {
/** Unpacks MIB from PBCH message. /** Unpacks MIB from PBCH message.
* msg buffer must be 24 byte length at least * 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; int bw, phich_res = 0;
bzero(msg, 24); bzero(msg, 24);
@ -359,7 +359,7 @@ void pbch_decode_reset(pbch_t *q) {
q->frame_idx = 0; 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; int i;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
data[24 + i] = (data[24 + i] + crc_mask[nof_ports - 1][i]) % 2; 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 * Returns 0 if the data is correct, -1 otherwise
*/ */
uint32_t pbch_crc_check(pbch_t *q, char *bits, uint32_t nof_ports) { uint32_t pbch_crc_check(pbch_t *q, uint8_t *bits, uint32_t nof_ports) {
char data[40]; uint8_t data[40];
memcpy(data, bits, 40 * sizeof(char)); memcpy(data, bits, 40 * sizeof(uint8_t));
crc_set_mask(data, nof_ports); crc_set_mask(data, nof_ports);
int ret = crc_checksum(&q->crc, data, 40); int ret = crc_checksum(&q->crc, data, 40);
if (ret == 0) { if (ret == 0) {

@ -42,7 +42,7 @@
#include "liblte/phy/utils/debug.h" #include "liblte/phy/utils/debug.h"
// Table 5.3.4-1 // 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, 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. /** 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. * 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 i, j;
int distance, index = -1; int distance, index = -1;
int min = 32; 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. /** Encodes the CFI producing a vector of 32 bits.
* 36.211 10.3 section 5.3.4 * 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) { if (cfi < 1 || cfi > 3) {
return LIBLTE_ERROR_INVALID_INPUTS; return LIBLTE_ERROR_INVALID_INPUTS;
} else{ } 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; return LIBLTE_SUCCESS;
} }
} }

@ -108,7 +108,7 @@ int pdcch_init(pdcch_t *q, regs_t *regs, lte_cell_t cell) {
goto clean; 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) { if (!q->pdcch_e) {
goto clean; 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 * 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)]; float tmp[3 * (DCI_MAX_BITS + 16)];
uint16_t p_bits, crc_res; uint16_t p_bits, crc_res;
char *x; uint8_t *x;
if (q != NULL && if (q != NULL &&
data != 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; uint32_t i;
char mask[16]; uint8_t mask[16];
char *r = mask; uint8_t *r = mask;
INFO("Mask CRC with RNTI 0x%x\n", rnti); 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 /** 36.212 5.3.3.2 to 5.3.3.4
* TODO: UE transmit antenna selection CRC mask * 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) { uint16_t rnti) {
convcoder_t encoder; convcoder_t encoder;
char tmp[3 * (DCI_MAX_BITS + 16)]; uint8_t tmp[3 * (DCI_MAX_BITS + 16)];
if (q != NULL && if (q != NULL &&
data != NULL && data != NULL &&

@ -214,7 +214,7 @@ int pdsch_init(pdsch_t *q, lte_cell_t cell) {
} }
// Allocate floats for reception (LLRs) // 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) { if (!q->cb_in) {
goto clean; goto clean;
} }
@ -369,7 +369,7 @@ int pdsch_harq_init(pdsch_harq_t *p, pdsch_t *pdsch) {
return LIBLTE_ERROR; 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) { if (!p->pdsch_w_buff_c) {
perror("malloc"); perror("malloc");
return LIBLTE_ERROR; return LIBLTE_ERROR;
@ -384,7 +384,7 @@ int pdsch_harq_init(pdsch_harq_t *p, pdsch_t *pdsch) {
perror("malloc"); perror("malloc");
return LIBLTE_ERROR; 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]) { if (!p->pdsch_w_buff_c[i]) {
perror("malloc"); perror("malloc");
return LIBLTE_ERROR; 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 /* 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) pdsch_harq_t *harq_process, uint32_t rv_idx)
{ {
char parity[24]; uint8_t parity[24];
char *p_parity = parity; uint8_t *p_parity = parity;
uint32_t par_rx, par_tx; uint32_t par_rx, par_tx;
uint32_t i; uint32_t i;
uint32_t cb_len, rp, wp, rlen, F, n_e; 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; q->nof_iterations = 0;
bool early_stop = false; bool early_stop = false;
uint32_t len_crc; uint32_t len_crc;
char *cb_in_ptr; uint8_t *cb_in_ptr;
crc_t *crc_ptr; crc_t *crc_ptr;
tdec_reset(&q->decoder, cb_len); 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; crc_ptr = &q->crc_cb;
} else { } else {
len_crc = tbs+24; 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]; cb_in_ptr = &q->cb_in[F];
crc_ptr = &q->crc_tb; 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 */ /* Copy data to another buffer, removing the Codeblock CRC */
if (i < harq_process->cb_segm.C - 1) { 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 { } else {
DEBUG("Last CB, appending parity: %d to %d from %d and 24 from %d\n", DEBUG("Last CB, appending parity: %d to %d from %d and 24 from %d\n",
rlen - F - 24, wp, F, rlen - 24); rlen - F - 24, wp, F, rlen - 24);
/* Append Transport Block parity bits to the last CB */ /* Append Transport Block parity bits to the last CB */
memcpy(&data[wp], &q->cb_in[F], (rlen - F - 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(char)); memcpy(parity, &q->cb_in[rlen - 24], 24 * sizeof(uint8_t));
} }
/* Set read/write pointers */ /* 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 /** 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) 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 /* 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) pdsch_harq_t *harq_process, uint32_t rv_idx)
{ {
char parity[24]; uint8_t parity[24];
char *p_parity = parity; uint8_t *p_parity = parity;
uint32_t par; uint32_t par;
uint32_t i; uint32_t i;
uint32_t cb_len, rp, wp, rlen, F, n_e; 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; int ret = LIBLTE_ERROR_INVALID_INPUTS;
if (q != NULL && 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) { if (rv_idx == 0) {
/* Copy data to another buffer, making space for the Codeblock CRC */ /* Copy data to another buffer, making space for the Codeblock CRC */
if (i < harq_process->cb_segm.C - 1) { 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 { } else {
INFO("Last CB, appending parity: %d from %d and 24 to %d\n", INFO("Last CB, appending parity: %d from %d and 24 to %d\n",
rlen - F - 24, rp, rlen - 24); rlen - F - 24, rp, rlen - 24);
/* Append Transport Block parity bits to the last CB */ /* 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[F], &data[rp], (rlen - F - 24) * sizeof(uint8_t));
memcpy(&q->cb_in[rlen - 24], parity, 24 * sizeof(char)); memcpy(&q->cb_in[rlen - 24], parity, 24 * sizeof(uint8_t));
} }
if (harq_process->cb_segm.C > 1) { if (harq_process->cb_segm.C > 1) {
/* Attach Codeblock CRC */ /* 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); vec_fprint_b(stdout, q->cb_in, cb_len);
} }
/* Turbo Encoding */ /* 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 */ /* Rate matching */
if (rm_turbo_tx(harq_process->pdsch_w_buff_c[i], harq_process->w_buff_size, 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)) &e_bits[wp], n_e, rv_idx))
{ {
fprintf(stderr, "Error in rate matching\n"); 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 /** 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) pdsch_harq_t *harq_process, uint32_t rv_idx)
{ {
int i; 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; 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 */ /* TODO: only diversity supported */
if (q->cell.nof_ports > 1) { if (q->cell.nof_ports > 1) {

@ -107,7 +107,7 @@ void phich_free(phich_t *q) {
/* Decodes ACK /* 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; int i, n;
n = 0; n = 0;
@ -131,8 +131,8 @@ char phich_ack_decode(char bits[PHICH_NBITS], uint32_t *distance) {
/** Encodes the ACK /** Encodes the ACK
* 36.212 * 36.212
*/ */
void phich_ack_encode(char ack, char bits[PHICH_NBITS]) { void phich_ack_encode(uint8_t ack, uint8_t bits[PHICH_NBITS]) {
memset(bits, ack, 3 * sizeof(char)); memset(bits, ack, 3 * sizeof(uint8_t));
} }
/* Decodes the phich channel and saves the CFI in the cfi pointer. /* 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 * 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], 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 */ /* Set pointers for layermapping & precoding */
int i, j; 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. /** 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]) { cf_t *slot_symbols[MAX_PORTS]) {
int i; int i;

@ -72,7 +72,7 @@ void regs_pdcch_free(regs_t *h) {
} }
#define PDCCH_NCOLS 32 #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, { 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 }; 24, 4, 20, 12, 28, 2, 18, 10, 26, 6, 22, 14, 30 };

@ -44,7 +44,7 @@ int main(int argc, char **argv) {
int nof_prb; int nof_prb;
int nwords; int nwords;
int i; int i;
char *y; uint8_t *y;
if (argc < 3) { if (argc < 3) {
usage(argv[0]); usage(argv[0]);
@ -63,7 +63,7 @@ int main(int argc, char **argv) {
y = msg.data; y = msg.data;
rlen = 0; rlen = 0;
unsigned int x; uint32_t x;
for (i = 0; i < nwords; i++) { for (i = 0; i < nwords; i++) {
x = strtoul(argv[i + 3], NULL, 16); x = strtoul(argv[i + 3], NULL, 16);
if (len - rlen < 32) { if (len - rlen < 32) {

@ -227,7 +227,7 @@ int main(int argc, char **argv) {
int i; int i;
int nof_frames; int nof_frames;
int ret; int ret;
char *data; uint8_t *data;
dci_location_t locations[10]; dci_location_t locations[10];
uint32_t nof_locations; uint32_t nof_locations;
dci_msg_t dci_msg; dci_msg_t dci_msg;

@ -118,7 +118,7 @@ void parse_args(int argc, char **argv) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
pdsch_t pdsch; pdsch_t pdsch;
uint32_t i, j; uint32_t i, j;
char *data = NULL; uint8_t *data = NULL;
cf_t *ce[MAX_PORTS]; cf_t *ce[MAX_PORTS];
uint32_t nof_re; uint32_t nof_re;
cf_t *slot_symbols[MAX_PORTS]; 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) { if (!data) {
perror("malloc"); perror("malloc");
goto quit; goto quit;

@ -216,7 +216,7 @@ int main(int argc, char **argv) {
uint32_t distance; uint32_t distance;
int i, n; int i, n;
uint32_t ngroup, nseq, max_nseq; uint32_t ngroup, nseq, max_nseq;
char ack_rx; uint8_t ack_rx;
if (argc < 3) { if (argc < 3) {
usage(argv[0]); usage(argv[0]);

@ -105,7 +105,7 @@ int main(int argc, char **argv) {
cf_t *ce[MAX_PORTS]; cf_t *ce[MAX_PORTS];
int nof_re; int nof_re;
cf_t *slot_symbols[MAX_PORTS]; 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; uint32_t nsf, distance;
int cid, max_cid; int cid, max_cid;
uint32_t ngroup, nseq, max_nseq; uint32_t ngroup, nseq, max_nseq;

@ -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; int i;
for (i = 0; i < s->len; 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; int i;
assert (len + offset <= s->len); assert (len + offset <= s->len);
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
@ -125,7 +125,7 @@ int scrambling_work(scrambling_hl* hl) {
sequence_t *seq = &hl->obj.seq[sf]; sequence_t *seq = &hl->obj.seq[sf];
if (hl->init.hard) { 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); scrambling_b(seq, hl->output);
} else { } else {
memcpy(hl->output, hl->input, sizeof(float) * hl->in_len); memcpy(hl->output, hl->input, sizeof(float) * hl->in_len);

@ -91,7 +91,7 @@ int init_sequence(sequence_t *seq, char *name) {
int main(int argc, char **argv) { int main(int argc, char **argv) {
int i; int i;
sequence_t seq; sequence_t seq;
char *input_b, *scrambled_b; uint8_t *input_b, *scrambled_b;
float *input_f, *scrambled_f; float *input_f, *scrambled_f;
parse_args(argc, argv); parse_args(argc, argv);
@ -102,12 +102,12 @@ int main(int argc, char **argv) {
} }
if (!do_floats) { if (!do_floats) {
input_b = malloc(sizeof(char) * seq.len); input_b = malloc(sizeof(uint8_t) * seq.len);
if (!input_b) { if (!input_b) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);
} }
scrambled_b = malloc(sizeof(char) * seq.len); scrambled_b = malloc(sizeof(uint8_t) * seq.len);
if (!scrambled_b) { if (!scrambled_b) {
perror("malloc"); perror("malloc");
exit(-1); exit(-1);

@ -64,7 +64,7 @@ int ue_celldetect_init_max(ue_celldetect_t * q, uint32_t max_frames_total, uint3
perror("malloc"); perror("malloc");
goto clean_exit; 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) { if (!q->mode_counted) {
perror("malloc"); perror("malloc");
goto clean_exit; goto clean_exit;

@ -145,7 +145,7 @@ void ue_dl_free(ue_dl_t *q) {
LIBLTE_API float mean_exec_time=0; LIBLTE_API float mean_exec_time=0;
int frame_cnt=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; uint32_t cfi, cfi_distance, i;
ra_pdsch_t ra_dl; ra_pdsch_t ra_dl;

@ -180,7 +180,7 @@ int track_peak_ok(ue_sync_t *q, uint32_t track_idx) {
/* Make sure subframe idx is what we expect */ /* Make sure subframe idx is what we expect */
if ((q->sf_idx != sync_get_sf_idx(&q->strack)) && q->decode_sss_on_track) { 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", 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? */ /* FIXME: What should we do in this case? */
q->sf_idx = sync_get_sf_idx(&q->strack); q->sf_idx = sync_get_sf_idx(&q->strack);
q->state = SF_TRACK; q->state = SF_TRACK;

@ -31,7 +31,7 @@
#include "liblte/phy/utils/bit.h" #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; int i;
@ -41,10 +41,10 @@ void bit_pack(uint32_t value, char **bits, int nof_bits)
*bits += 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; int i;
unsigned int value=0; uint32_t value=0;
for(i=0; i<nof_bits; i++) { for(i=0; i<nof_bits; i++) {
value |= (*bits)[i] << (nof_bits-i-1); value |= (*bits)[i] << (nof_bits-i-1);
@ -53,7 +53,7 @@ uint32_t bit_unpack(char **bits, int nof_bits)
return value; return value;
} }
void bit_fprint(FILE *stream, char *bits, int nof_bits) { void bit_fprint(FILE *stream, uint8_t *bits, int nof_bits) {
int i; int i;
fprintf(stream,"["); fprintf(stream,"[");
@ -63,8 +63,8 @@ void bit_fprint(FILE *stream, char *bits, int nof_bits) {
fprintf(stream,"%d]\n",bits[i]); fprintf(stream,"%d]\n",bits[i]);
} }
unsigned int bit_diff(char *x, char *y, int nbits) { uint32_t bit_diff(uint8_t *x, uint8_t *y, int nbits) {
unsigned int errors=0; uint32_t errors=0;
for (int i=0;i<nbits;i++) { for (int i=0;i<nbits;i++) {
if (x[i] != y[i]) { if (x[i] != y[i]) {
//printf("%d, ",i); //printf("%d, ",i);

@ -103,7 +103,7 @@ void dft_plan_set_dc(dft_plan_t *plan, bool val){
plan->dc = val; plan->dc = 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) { bool forward, bool mirror, bool dc) {
int offset = dc?1:0; int offset = dc?1:0;
if(mirror && !forward){ 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) { bool forward, bool mirror, bool dc) {
int offset = dc?1:0; int offset = dc?1:0;
if(mirror && forward){ 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; int i;
fftwf_complex *f_out = plan->out; 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); plan->forward, plan->mirror, plan->dc);
fftwf_execute(plan->p); fftwf_execute(plan->p);
if (plan->norm) { 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]); 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); plan->forward, plan->mirror, plan->dc);
} }

@ -27,7 +27,7 @@
#include <stdint.h>
#include <string.h> #include <string.h>
/** /**
@ -38,8 +38,8 @@
void mux(void **input, void *output, int *input_lengths, int *input_padding_pre, int nof_inputs, void mux(void **input, void *output, int *input_lengths, int *input_padding_pre, int nof_inputs,
int sample_sz) { int sample_sz) {
int i,r; int i,r;
char *out = (char*) output; uint8_t *out = (uint8_t*) output;
char **in = (char**) input; uint8_t **in = (uint8_t**) input;
r=0; r=0;
for (i=0;i<nof_inputs;i++) { for (i=0;i<nof_inputs;i++) {
@ -57,8 +57,8 @@ void demux(void *input, void **output, int *output_lengths,
int *output_padding_pre, int *output_padding_post, int nof_outputs, int *output_padding_pre, int *output_padding_post, int nof_outputs,
int sample_sz) { int sample_sz) {
int i,r; int i,r;
char **out = (char**) output; uint8_t **out = (uint8_t**) output;
char *in = (char*) input; uint8_t *in = (uint8_t*) input;
r=0; r=0;
for (i=0;i<nof_outputs;i++) { for (i=0;i<nof_outputs;i++) {

@ -25,9 +25,9 @@
* *
*/ */
#include "liblte/phy/utils/bit.h"
void pack_bits(uint32_t value, uint8_t **bits, int nof_bits)
void pack_bits(unsigned int value, char **bits, int nof_bits)
{ {
int i; int i;
@ -37,10 +37,10 @@ void pack_bits(unsigned int value, char **bits, int nof_bits)
*bits += nof_bits; *bits += nof_bits;
} }
unsigned int unpack_bits(char **bits, int nof_bits) uint32_t unpack_bits(uint8_t **bits, int nof_bits)
{ {
int i; int i;
unsigned int value=0; uint32_t value=0;
for(i=0; i<nof_bits; i++) { for(i=0; i<nof_bits; i++) {
value |= (*bits)[i] << (nof_bits-i-1); value |= (*bits)[i] << (nof_bits-i-1);

@ -102,7 +102,7 @@ void vec_sum_ccc(cf_t *x, cf_t *y, cf_t *z, uint32_t len) {
} }
} }
void vec_sum_bbb(char *x, char *y, char *z, uint32_t len) { void vec_sum_bbb(uint8_t *x, uint8_t *y, uint8_t *z, uint32_t len) {
int i; int i;
for (i=0;i<len;i++) { for (i=0;i<len;i++) {
z[i] = x[i]+y[i]; z[i] = x[i]+y[i];
@ -227,7 +227,7 @@ void vec_fprint_f(FILE *stream, float *x, uint32_t len) {
} }
void vec_fprint_b(FILE *stream, char *x, uint32_t len) { void vec_fprint_b(FILE *stream, uint8_t *x, uint32_t len) {
int i; int i;
fprintf(stream, "["); fprintf(stream, "[");
for (i=0;i<len;i++) { for (i=0;i<len;i++) {
@ -245,7 +245,7 @@ void vec_fprint_i(FILE *stream, int *x, uint32_t len) {
fprintf(stream, "];\n"); fprintf(stream, "];\n");
} }
void vec_fprint_hex(FILE *stream, char *x, uint32_t len) { void vec_fprint_hex(FILE *stream, uint8_t *x, uint32_t len) {
uint32_t i, nbytes, byte; uint32_t i, nbytes, byte;
nbytes = len/8; nbytes = len/8;
fprintf(stream, "[", len); fprintf(stream, "[", len);
@ -460,7 +460,7 @@ uint32_t vec_max_abs_ci(cf_t *x, uint32_t len) {
#endif #endif
} }
void vec_quant_fuc(float *in, unsigned char *out, float gain, float offset, float clip, uint32_t len) { void vec_quant_fuc(float *in, uint8_t *out, float gain, float offset, float clip, uint32_t len) {
int i; int i;
int tmp; int tmp;
for (i=0;i<len;i++) { for (i=0;i<len;i++) {
@ -469,7 +469,7 @@ void vec_quant_fuc(float *in, unsigned char *out, float gain, float offset, floa
tmp = 0; tmp = 0;
if (tmp > clip) if (tmp > clip)
tmp = clip; tmp = clip;
out[i] = (unsigned char) tmp; out[i] = (uint8_t) tmp;
} }
} }

@ -307,7 +307,7 @@ INTEGER_st_prealloc(INTEGER_t *st, int min_size) {
static enum xer_pbd_rval 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__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
INTEGER_t *st = (INTEGER_t *)sptr; INTEGER_t *st = (INTEGER_t *)sptr;
long dec_value; long dec_value=0;
long hex_value = 0; long hex_value = 0;
const char *lp; const char *lp;
const char *lstart = (const char *)chunk_buf; const char *lstart = (const char *)chunk_buf;

@ -222,7 +222,7 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
*/ */
if(ctx->phase > 1) RETURN(RC_FAIL); if(ctx->phase > 1) RETURN(RC_FAIL);
for(;;) { 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 */ ssize_t ch_size; /* Chunk size */
xer_check_tag_e tcv; /* Tag check value */ xer_check_tag_e tcv; /* Tag check value */

Loading…
Cancel
Save