You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
2.0 KiB
C

/**
11 years ago
*
* \section COPYRIGHT
11 years ago
*
* Copyright 2013-2014 The libLTE Developers. See the
* COPYRIGHT file at the top-level directory of this distribution.
*
* \section LICENSE
*
* This file is part of the libLTE library.
*
* libLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* libLTE is distributed in the hope that it will be useful,
11 years ago
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* A copy of the GNU Lesser General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
11 years ago
*/
11 years ago
#include <stdlib.h>
#include <strings.h>
#include "liblte/phy/modem/demod_hard.h"
11 years ago
#include "hard_demod_lte.h"
void demod_hard_init(demod_hard_t* q) {
bzero((void*) q, sizeof(demod_hard_t));
11 years ago
}
void demod_hard_table_set(demod_hard_t* q, lte_mod_t mod) {
q->mod = mod;
11 years ago
}
int demod_hard_demodulate(demod_hard_t* q, cf_t* symbols, uint8_t *bits, uint32_t nsymbols) {
11 years ago
int nbits=-1;
switch(q->mod) {
case LTE_BPSK:
hard_bpsk_demod(symbols,bits,nsymbols);
nbits=nsymbols;
break;
case LTE_QPSK:
hard_qpsk_demod(symbols,bits,nsymbols);
nbits=nsymbols*2;
break;
case LTE_QAM16:
hard_qam16_demod(symbols,bits,nsymbols);
nbits=nsymbols*4;
break;
case LTE_QAM64:
hard_qam64_demod(symbols,bits,nsymbols);
nbits=nsymbols*6;
break;
}
return nbits;
11 years ago
}
int demod_hard_initialize(demod_hard_hl* hl) {
demod_hard_init(&hl->obj);
demod_hard_table_set(&hl->obj,hl->init.std);
11 years ago
return 0;
11 years ago
}
int demod_hard_work(demod_hard_hl* hl) {
int ret = demod_hard_demodulate(&hl->obj,hl->input,hl->output,hl->in_len);
hl->out_len = ret;
return 0;
11 years ago
}
int demod_hard_stop(demod_hard_hl* hl) {
return 0;
}
11 years ago