Commit d6cdcb91 authored by knopp's avatar knopp

removed PHY/TOOLS/fft.c and all uses of this FFT implementation. All are...

removed PHY/TOOLS/fft.c and all uses of this FFT implementation. All are replaced by the faster versions in PHY/TOOLS/lte_dfts.c

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7390 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent f8bc7e38
......@@ -768,9 +768,7 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
${OPENAIR1_DIR}/PHY/INIT/lte_init.c
${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
${OPENAIR1_DIR}/PHY/INIT/init_top.c
${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
${OPENAIR1_DIR}/PHY/TOOLS/fft.c
${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c
......
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*!\brief Initilization and reconfiguration routines for PHY */
#ifndef USER_MODE
#define __NO_VERSION__
/*
* @addtogroup _PHY_STRUCTURES_
* Memory Initializaion and Cleanup.
* @{
\section _Memory_init_ Memory Initialization
Blah Blah
*/
#ifdef RTAI_ENABLED
#include <rtai.h>
#include <rtai_posix.h>
#include <rtai_fifos.h>
#endif //
#else
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#define PAGE_SIZE 4096
#endif // USER_MODE
//#include "types.h"
#include "PHY/defs.h"
#include "PHY/extern.h"
//#include "MAC_INTERFACE/defs.h"
#include "MAC_INTERFACE/extern.h"
#ifndef USER_MODE
#include "SCHED/defs.h"
#ifdef PLATON
#endif //PLATON
#ifdef CBMIMO1
#include "ARCH/CBMIMO1/DEVICE_DRIVER/from_grlib_softconfig.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/cbmimo1_device.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/defs.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/cbmimo1_pci.h"
//#include "pci_commands.h"
#endif //CBMIMO1
#endif //USER_MODE
#ifdef USER_MODE
#define printk printf
#endif //USER_MODE
int phy_init(unsigned char nb_antennas_tx)
{
int *tmp_ptr;
unsigned int tx_dma_buffer_size_bytes;
int i,j,n,tb;
bzero((void *)PHY_vars,sizeof(PHY_VARS));
if (mac_xface->is_cluster_head == 1)
printk("[openair][PHY][INIT]TERMINODE is preconfigured as a Cluster Head\n");
printk("[openair][PHY][INIT]OFDM size : %d\n",NUMBER_OF_OFDM_CARRIERS);
printk("[openair][PHY][INIT]FRAME_LENGTH_SAMPLES : %d\n",FRAME_LENGTH_SAMPLES);
printk("[openair][PHY][INIT]NUMBER_OF_SYMBOLS_PER_FRAME : %d\n",NUMBER_OF_SYMBOLS_PER_FRAME);
crcTableInit();
ccodedot11_init();
ccodedot11_init_inv();
ccodelte_init();
ccodelte_init_inv();
#ifndef EXPRESSMIMO_TARGET
phy_generate_viterbi_tables();
#endif //EXPRESSMIMO_TARGET
for (i=0; i<NB_ANTENNAS_RX; i++) {
// Allocate memory for TX DMA Buffer
#ifdef IFFT_FPGA
tx_dma_buffer_size_bytes = NUMBER_OF_USEFUL_CARRIERS*NUMBER_OF_SYMBOLS_PER_FRAME*sizeof(mod_sym_t);
#else
tx_dma_buffer_size_bytes = FRAME_LENGTH_BYTES;
#endif
tmp_ptr = (mod_sym_t*) bigmalloc16(tx_dma_buffer_size_bytes+2*PAGE_SIZE);
if (tmp_ptr==NULL) {
printk("[PHY][INIT] Could not allocate TX_DMA %d (%x bytes)\n",i,
(unsigned int)(tx_dma_buffer_size_bytes+2*PAGE_SIZE));
return(-1);
} else {
#ifndef USER_MODE
pci_buffer[(2*i)] = (unsigned int)tmp_ptr;
tmp_ptr = (unsigned int*)(((unsigned int)tmp_ptr + PAGE_SIZE -1) & PAGE_MASK);
// reserve_mem(tmp_ptr,FRAME_LENGTH_BYTES+2*PAGE_SIZE);
#endif // //USER_MODE
#ifdef DEBUG_PHY
printk("[PHY][INIT] TX_DMA_BUFFER %d at %p (%p), size 0x%x\n",i,
(void *)tmp_ptr,
(void *)virt_to_phys(tmp_ptr),
(unsigned int)(tx_dma_buffer_size+2*PAGE_SIZE));
#endif
}
PHY_vars->tx_rx_switch_point = TX_RX_SWITCH_SYMBOL;
PHY_vars->tx_vars[i].TX_DMA_BUFFER = tmp_ptr;
#ifdef DEBUG_PHY
printk("[PHY][INIT] PHY_vars->tx_vars[%d].TX_DMA_BUFFER = %p\n",i,(void *)PHY_vars->tx_vars[i].TX_DMA_BUFFER);
#endif
#ifndef USER_MODE
TX_DMA_BUFFER[i] = tmp_ptr;
#endif //USER_MODE
#ifndef USER_MODE
#ifdef PLATON
tx_dma_buffer[i]=tmp_ptr;
tx_mbox[i] = tmp_ptr + (FRAME_LENGTH_BYTES>>2);
#endif // //USER_MODE
#endif // // PLATON
// RX DMA Buffers
tmp_ptr = (int *)bigmalloc16(FRAME_LENGTH_BYTES+OFDM_SYMBOL_SIZE_BYTES+2*PAGE_SIZE);
if (tmp_ptr==NULL) {
#ifdef DEBUG_PHY
printk("[PHY][INIT] Could not allocate RX_DMA %d (%x bytes)\n",i,
FRAME_LENGTH_BYTES+2*OFDM_SYMBOL_SIZE_BYTES + 2*PAGE_SIZE);
#endif
return(-1);
} else {
#ifndef USER_MODE
pci_buffer[1+(2*i)] = tmp_ptr;
tmp_ptr = (((unsigned long)tmp_ptr + PAGE_SIZE -1) & PAGE_MASK);
// reserve_mem(tmp_ptr,FRAME_LENGTH_BYTES+2*PAGE_SIZE);
#endif //USER_MODE
#ifdef DEBUG_PHY
printk("[PHY][INIT] RX_DMA_BUFFER %d at %p (%p), size %x\n",i,
(void *)tmp_ptr,
(void *)virt_to_phys(tmp_ptr),(unsigned int)(FRAME_LENGTH_BYTES+OFDM_SYMBOL_SIZE_BYTES+2*PAGE_SIZE));
#endif
}
PHY_vars->rx_vars[i].RX_DMA_BUFFER = tmp_ptr;
#ifdef PLATON
#ifndef USER_MODE
rx_mbox[i] = tmp_ptr + ((FRAME_LENGTH_BYTES+OFDM_SYMBOL_SIZE_BYTES)>>2);
rx_dma_buffer[i] = tmp_ptr;
#endif // //USER_MODE
#endif // //PLATON
//#endif //
#ifndef USER_MODE
RX_DMA_BUFFER[i] = tmp_ptr;
#endif // //USER_MODE
}
#ifndef USER_MODE
#ifndef NOCARD_TEST
#ifndef PLATON
// Allocate memory for PCI interface and store pointers to dma buffers
printk("[PHY][INIT] Setting up Leon PCI interface structure\n");
pci_interface = (PCI_interface_t *)((unsigned int)(tmp_ptr + ((OFDM_SYMBOL_SIZE_BYTES+FRAME_LENGTH_BYTES+PAGE_SIZE)>>2)));
printk("[PHY][INIT] PCI interface at %p\n",pci_interface);
if (vid != XILINX_VENDOR)
openair_writel(pdev[0],FROM_GRLIB_CFG_GRPCI_EUR_CTRL0_OFFSET+4,(unsigned int)virt_to_phys((volatile void*)pci_interface));
else
iowrite32((unsigned int)virt_to_phys((volatile void*)pci_interface),(bar[0]+0x1c));
mbox = (unsigned int)(&pci_interface->adac_cnt);
for (i=0; i<NB_ANTENNAS_RX; i++) {
pci_interface->adc_head[i] = (unsigned int)virt_to_phys((volatile void*)RX_DMA_BUFFER[i]);
pci_interface->dac_head[i] = (unsigned int)virt_to_phys((volatile void*)TX_DMA_BUFFER[i]);
}
#endif //PLATON
#endif //NOCARD_TEST
#endif // USER_MODE
#ifdef PLATON
#ifndef USER_MODE
PHY_vars->mbox = tx_mbox[0];
#endif //// USER_MODE
#endif // //PLATON
#ifdef CBMIMO1
#ifndef USER_MODE
PHY_vars->mbox = mbox;
#endif //// USER_MODE
#endif // // CBMIMO1
// printk("[PHY][INIT] mbox = %p,rxgainreg = %p\n",PHY_vars->mbox,rxgainreg);
//#ifndef USER_MODE
// rt_sleep(nano2count(100000000));
//#endif
// Loop over all different SCHs
for (n=0; n<8; n++) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] CHSCH %d:\n",n);
printk("[openair][PHY][INIT] ******************\n");
#endif
PHY_vars->chsch_data[n].CHSCH_conj_f = (int *)malloc16(2*4*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS);
if (PHY_vars->chsch_data[n].CHSCH_conj_f) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch receive filter %p\n",
2*4*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS,
PHY_vars->chsch_data[n].CHSCH_conj_f );
#endif
} else
return(-1);
PHY_vars->chsch_data[n].CHSCH_f = (int *)malloc16(2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS);
if (PHY_vars->chsch_data[n].CHSCH_f) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch transmit signal (%p)\n",
2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS,PHY_vars->chsch_data[n].CHSCH_f);
#endif
} else
return(-1);
for (i=0; i<4; i++) {
PHY_vars->chsch_data[n].CHSCH_f_sync[i] = (int *)malloc16(2*4*4*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS);
if (PHY_vars->chsch_data[n].CHSCH_f_sync[i]) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch synch filter %d (%p)\n",
2*4*4*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS,i,PHY_vars->chsch_data[n].CHSCH_f_sync[i]);
#endif
} else
return(-1);
}
for (i=0; i<NB_ANTENNAS_RX; i++) {
PHY_vars->chsch_data[n].CHSCH_f_tx[i] = (int *)malloc16(2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS);
if (PHY_vars->chsch_data[n].CHSCH_f_tx[i]) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch transmit signal %d (%p)\n",
2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS,i,PHY_vars->chsch_data[n].CHSCH_f_tx[i]);
#endif
} else
return(-1);
PHY_vars->chsch_data[n].rx_sig_f[i] = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS*(NUMBER_OF_CHSCH_SYMBOLS));
if (PHY_vars->chsch_data[n].rx_sig_f[i]) {
if (((unsigned int)PHY_vars->chsch_data[n].rx_sig_f[i] & 0x0000000f) != 0)
PHY_vars->chsch_data[n].rx_sig_f[i] = PHY_vars->chsch_data[n].rx_sig_f[i] + 2;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch rx_sig_f, antenna %d (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS,
i,
PHY_vars->chsch_data[n].rx_sig_f[i]);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->chsch_data[n].rx_sig_f[i],
8*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS);
#endif // USER_MODE
} else
return(-1);
PHY_vars->chsch_data[n].channel_f[i] = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->chsch_data[n].channel_f[i]) {
if (((unsigned int)PHY_vars->chsch_data[n].channel_f[i] & 0x0000000f) != 0)
PHY_vars->chsch_data[n].channel_f[i] = PHY_vars->chsch_data[n].channel_f[i] + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch channel_f %d (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,i,PHY_vars->chsch_data[n].channel_f[i]);
printk("[openair][PHY][INIT] Allocated %d bytes for chsch channel_f %d%d (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,n,i,PHY_vars->chsch_data[n].channel_f[i]);
#ifndef USER_MODE
reserve_mem(PHY_vars->chsch_data[n].channel_f[i],8*NUMBER_OF_OFDM_CARRIERS);
#endif
#endif //
} else
return(-1);
PHY_vars->chsch_data[n].mag_channel_f[i] = (int *)malloc16(4*NUMBER_OF_SACH_SYMBOLS_MAX*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->chsch_data[n].mag_channel_f[i]) {
if (((unsigned int)PHY_vars->chsch_data[n].mag_channel_f[i] & 0x0000000f) > 0)
PHY_vars->chsch_data[n].mag_channel_f[i] = PHY_vars->chsch_data[n].mag_channel_f[i] + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch mag_channel_f (%p)\n",
32*NUMBER_OF_OFDM_CARRIERS,PHY_vars->chsch_data[n].mag_channel_f[i]);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->chsch_data[n].mag_channel_f[i],32*NUMBER_OF_OFDM_CARRIERS);
#endif // USER_MODE
} else
return(-1);
PHY_vars->chsch_data[n].channel_matched_filter_f[i] = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->chsch_data[n].channel_matched_filter_f[i]) {
if (((unsigned int)PHY_vars->chsch_data[n].channel_matched_filter_f[i] & 0x0000000f) != 0)
PHY_vars->chsch_data[n].channel_matched_filter_f[i] = PHY_vars->chsch_data[n].channel_matched_filter_f[i] + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch channel_matched_filter_f %d (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,i,PHY_vars->chsch_data[n].channel_matched_filter_f[i]);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->chsch_data[n].channel_matched_filter_f[i],8*NUMBER_OF_OFDM_CARRIERS);
#endif //
} else
return(-1);
PHY_vars->chsch_data[n].channel[i] = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->chsch_data[n].channel[i]) {
if (((unsigned int)PHY_vars->chsch_data[n].channel[i] & 0x0000000f) > 0)
PHY_vars->chsch_data[n].channel[i] = PHY_vars->chsch_data[n].channel[i] + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch channel %d (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,i,PHY_vars->chsch_data[n].channel[i]);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->chsch_data[n].channel[i],8*NUMBER_OF_OFDM_CARRIERS);
#endif // USER_MODE
} else
return(-1);
}
PHY_vars->chsch_data[n].mag_channel = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->chsch_data[n].mag_channel) {
if (((unsigned int)PHY_vars->chsch_data[n].mag_channel & 0x0000000f) > 0)
PHY_vars->chsch_data[n].mag_channel = PHY_vars->chsch_data[n].mag_channel + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch mag_channel (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,PHY_vars->chsch_data[n].mag_channel);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->chsch_data[n].mag_channel,8*NUMBER_OF_OFDM_CARRIERS);
#endif // USER_MODE
} else
return(-1);
for (i=0; i<4; i++) {
PHY_vars->chsch_data[n].CHSCH_f_txr[i] = (int *)malloc16(2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS);
if (PHY_vars->chsch_data[n].CHSCH_f_txr[i]) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch transmit signal for receiver %d (%p)\n",
2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS,i,PHY_vars->chsch_data[n].CHSCH_f_txr[i]);
#endif
} else
return(-1);
}
for (i=0; i<NB_ANTENNAS_TXRX; i++)
for (j=0; j<NB_ANTENNAS_RX; j++) {
PHY_vars->chsch_data[n].channel_f_interp[i][j]= (int*) malloc16(8*NUMBER_OF_USEFUL_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS);
if (PHY_vars->chsch_data[n].channel_f_interp[i][j]) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch channel_f_interp[%d][%d] (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS,i,j,PHY_vars->chsch_data[n].channel_f_interp[i][j]);
#endif
} else
return(-1);
}
for (i=0; i<NB_ANTENNAS_TXRX; i++)
for (j=0; j<NB_ANTENNAS_RX; j++) {
PHY_vars->chsch_data[n].channel_mmse_filter_f[i][j] = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->chsch_data[n].channel_mmse_filter_f[i][j]) {
if (((unsigned int)PHY_vars->chsch_data[n].channel_mmse_filter_f[i][j] & 0x0000000f) != 0)
PHY_vars->chsch_data[n].channel_mmse_filter_f[i][j] = PHY_vars->chsch_data[n].channel_mmse_filter_f[i][j] + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch channel_mmse_filter_f[%d][%d] (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,i,j,PHY_vars->chsch_data[n].channel_mmse_filter_f[i][j]);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->chsch_data[n].channel_mmse_filter_f[i][j],8*NUMBER_OF_OFDM_CARRIERS);
#endif //
} else
return(-1);
}
PHY_vars->chsch_data[n].det = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->chsch_data[n].det) {
if (((unsigned int)PHY_vars->chsch_data[n].det & 0x0000000f) != 0)
PHY_vars->chsch_data[n].det = PHY_vars->chsch_data[n].det + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch det (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,PHY_vars->chsch_data[n].det);
#endif
}
PHY_vars->chsch_data[n].idet = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->chsch_data[n].idet) {
if (((unsigned int)PHY_vars->chsch_data[n].idet & 0x0000000f) != 0)
PHY_vars->chsch_data[n].idet = PHY_vars->chsch_data[n].idet + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch idet (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,PHY_vars->chsch_data[n].idet);
#endif
}
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] SCH %d:\n",n);
printk("[openair][PHY][INIT] ******************\n");
#endif
PHY_vars->sch_data[n].SCH_conj_f = (int *)malloc16(2*4*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS);
if (PHY_vars->sch_data[n].SCH_conj_f) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch receive filter (%p)\n",
2*4*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS,
PHY_vars->sch_data[n].SCH_conj_f);
#endif
} else
return(-1);
PHY_vars->sch_data[n].SCH_f = (int *)malloc16(2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS);
if (PHY_vars->sch_data[n].SCH_f) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch transmit signal (%p)\n",
2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_CHSCH_SYMBOLS,PHY_vars->sch_data[n].SCH_f);
#endif
} else
return(-1);
for (i=0; i<4; i++) {
PHY_vars->sch_data[n].SCH_f_sync[i] = (int *)malloc16(2*4*4*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS);
if (PHY_vars->sch_data[n].SCH_f_sync[i]) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chsch synch filter %d (%p)\n",
2*4*4*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS,i,PHY_vars->sch_data[n].SCH_f_sync[i]);
#endif
} else
return(-1);
}
for (i=0; i<NB_ANTENNAS_TX; i++) {
PHY_vars->sch_data[n].SCH_f_tx[i] = (int *)malloc16(2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS);
if (PHY_vars->sch_data[n].SCH_f_tx[i]!=NULL) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch transmit signal (%p), %d\n",
2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS,PHY_vars->sch_data[n].SCH_f_tx[i],i);
#endif
} else
return(-1);
PHY_vars->sch_data[n].rx_sig_f[i] = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS*(NUMBER_OF_SCH_SYMBOLS));
if (PHY_vars->sch_data[n].rx_sig_f[i]) {
if (((unsigned int)PHY_vars->sch_data[n].rx_sig_f[i] & 0x0000000f) != 0)
PHY_vars->sch_data[n].rx_sig_f[i] = PHY_vars->sch_data[n].rx_sig_f[i] + 2;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch rx_sig_f, antenna %d (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS,
i,
PHY_vars->sch_data[n].rx_sig_f[i]);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->sch_data[n].rx_sig_f[i],
8*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS);
#endif // USER_MODE
} else
return(-1);
PHY_vars->sch_data[n].channel_f[i] = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->sch_data[n].channel_f[i]) {
if (((unsigned int)PHY_vars->sch_data[n].channel_f[i] & 0x0000000f) != 0)
PHY_vars->sch_data[n].channel_f[i] = PHY_vars->sch_data[n].channel_f[i] + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch channel_f (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,PHY_vars->sch_data[n].channel_f[i]);
#ifndef USER_MODE
reserve_mem(PHY_vars->sch_data[n].channel_f[i],8*NUMBER_OF_OFDM_CARRIERS);
#endif
#endif //
} else
return(-1);
PHY_vars->sch_data[n].channel_matched_filter_f[i] = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->sch_data[n].channel_matched_filter_f[i]) {
if (((unsigned int)PHY_vars->sch_data[n].channel_matched_filter_f[i] & 0x0000000f) != 0)
PHY_vars->sch_data[n].channel_matched_filter_f[i] = PHY_vars->sch_data[n].channel_matched_filter_f[i] + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch channel_matched_filter_f (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,PHY_vars->sch_data[n].channel_matched_filter_f[i]);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->sch_data[n].channel_matched_filter_f[i],8*NUMBER_OF_OFDM_CARRIERS);
#endif //
} else
return(-1);
PHY_vars->sch_data[n].channel[i] = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->sch_data[n].channel[i]) {
if (((unsigned int)PHY_vars->sch_data[n].channel[i] & 0x0000000f) != 0)
PHY_vars->sch_data[n].channel[i] = PHY_vars->sch_data[n].channel[i] + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch channel (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,PHY_vars->sch_data[n].channel[i]);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->sch_data[n].channel[i],8*NUMBER_OF_OFDM_CARRIERS);
#endif //
} else
return(-1);
PHY_vars->sch_data[n].mag_channel_f[i] = (int *)malloc16(4*NUMBER_OF_SACH_SYMBOLS_MAX*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->sch_data[n].mag_channel_f[i]) {
if (((unsigned int)PHY_vars->sch_data[n].mag_channel_f[i] & 0x0000000f) > 0)
PHY_vars->sch_data[n].mag_channel_f[i] = PHY_vars->sch_data[n].mag_channel_f[i] + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch mag_channel_f (%p)\n",
32*NUMBER_OF_OFDM_CARRIERS,PHY_vars->sch_data[n].mag_channel_f[i]);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->sch_data[n].mag_channel_f[i],32*NUMBER_OF_OFDM_CARRIERS);
#endif // USER_MODE
} else
return(-1);
}
PHY_vars->sch_data[n].mag_channel = (int *)malloc16(8*NUMBER_OF_OFDM_CARRIERS);
if (PHY_vars->sch_data[n].mag_channel) {
if (((unsigned int)PHY_vars->sch_data[n].mag_channel & 0x0000000f) > 0)
PHY_vars->sch_data[n].mag_channel = PHY_vars->sch_data[n].mag_channel + 4;
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch mag_channel (%p)\n",
8*NUMBER_OF_OFDM_CARRIERS,PHY_vars->sch_data[n].mag_channel);
#endif
#ifndef USER_MODE
reserve_mem(PHY_vars->sch_data[n].mag_channel,8*NUMBER_OF_OFDM_CARRIERS);
#endif // USER_MODE
} else
return(-1);
for (i=0; i<4; i++) {
PHY_vars->sch_data[n].SCH_f_txr[i] = (int *)malloc16(2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS);
if (PHY_vars->sch_data[n].SCH_f_txr[i]) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for sch transmit signal for receiver (%p), %d\n",
2*2*NUMBER_OF_OFDM_CARRIERS*NUMBER_OF_SCH_SYMBOLS,PHY_vars->sch_data[n].SCH_f_txr[i],i);
#endif
} else
return(-1);
}
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] CHBCH %d:\n",n);
printk("[openair][PHY][INIT] ******************\n");
#endif
PHY_vars->chbch_data[n].encoded_data[0] = (unsigned char *)malloc16(2*NUMBER_OF_USEFUL_CARRIERS*NUMBER_OF_CHBCH_SYMBOLS);
if (PHY_vars->chbch_data[n].encoded_data[0]) {
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Allocated %d bytes for chbch encoded bits\n",
2*NUMBER_OF_USEFUL_CARRIERS*NUMBER_OF_CHBCH_SYMBOLS);
#endif
} else
return(-1);
#ifdef DEBUG_PHY
printk("[openair][PHY][INIT] Number of bytes for chbch PDU : %d\n", NUMBER_OF_USEFUL_CARRIERS*NUMBER_OF_CHBCH_SYMBOLS/8);
#endif
for (i=0; i<NB_ANTENNAS_TX; i++) {
PHY_vars->chbch_data[n].fft_input[i] = (int *)malloc16(NUMBER_OF_OFDM_CARRIERS_BYTES*NUMBER_OF_CHBCH_SYMBOLS);
if (PHY_vars->chbch_data[n].fft_input[i]) {
if (((unsigned int)PHY_vars