Commit 6e81f269 authored by Raymond Knopp's avatar Raymond Knopp

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5494 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent a491fbb1
......@@ -5,14 +5,8 @@
#include "MAC_INTERFACE/extern.h"
#ifdef EXMIMO
#ifdef DRIVER2013
#include "openair0_lib.h"
extern int card;
#else
#include "ARCH/CBMIMO1/DEVICE_DRIVER/cbmimo1_device.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/defs.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/extern.h"
#endif
#endif
void
......@@ -20,11 +14,7 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) {
uint16_t rx_power_fil_dB;
#ifdef EXMIMO
#ifdef DRIVER2013
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
#endif
#endif
#if defined(EXMIMO) || defined(CBMIMO1)
uint16_t i;
#endif
......@@ -61,39 +51,21 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) {
}
#ifdef CBMIMO1
for (i=0;i<number_of_cards;i++) {
//openair_set_rx_rf_mode(i,openair_daq_vars.rx_rf_mode);
openair_set_rx_gain_cal_openair(i,phy_vars_ue->rx_total_gain_dB);
}
#else
#ifdef EXMIMO
//switch (phy_vars_ue->rx_gain_mode[0]) {
//case max_gain:
if (phy_vars_ue->rx_total_gain_dB>phy_vars_ue->rx_gain_max[0]) {
phy_vars_ue->rx_total_gain_dB = phy_vars_ue->rx_gain_max[0];
#ifdef DRIVER2013
for (i=0;i<phy_vars_ue->lte_frame_parms.nb_antennas_rx;i++) {
p_exmimo_config->rf.rx_gain[i][0] = 30;
}
#else
exmimo_pci_interface->rf.rx_gain00 = 30;
exmimo_pci_interface->rf.rx_gain10 = 30;
#endif
}
else if (phy_vars_ue->rx_total_gain_dB<(phy_vars_ue->rx_gain_max[0]-30)) {
// for the moment we stay in max gain mode
phy_vars_ue->rx_total_gain_dB = phy_vars_ue->rx_gain_max[0] - 30;
#ifdef DRIVER2013
for (i=0;i<phy_vars_ue->lte_frame_parms.nb_antennas_rx;i++) {
p_exmimo_config->rf.rx_gain[i][0] = 0;
}
#else
exmimo_pci_interface->rf.rx_gain00 = 0;
exmimo_pci_interface->rf.rx_gain10 = 0;
#endif
/*
phy_vars_ue->rx_gain_mode[0] = byp;
phy_vars_ue->rx_gain_mode[1] = byp;
......@@ -107,14 +79,10 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) {
*/
}
else {
#ifdef DRIVER2013
for (i=0;i<phy_vars_ue->lte_frame_parms.nb_antennas_rx;i++) {
p_exmimo_config->rf.rx_gain[i][0] = 30 - phy_vars_ue->rx_gain_max[0] + phy_vars_ue->rx_total_gain_dB;
}
#else
exmimo_pci_interface->rf.rx_gain00 = 30 - phy_vars_ue->rx_gain_max[0] + phy_vars_ue->rx_total_gain_dB;
exmimo_pci_interface->rf.rx_gain10 = 30 - phy_vars_ue->rx_gain_max[1] + phy_vars_ue->rx_total_gain_dB;
#endif
}
/*
break;
......@@ -151,7 +119,6 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, uint8_t eNB_id) {
}
*/
#endif
#endif
#ifdef DEBUG_PHY
/* if ((phy_vars_ue->frame%100==0) || (phy_vars_ue->frame < 10))
......
......@@ -90,9 +90,6 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
phy_vars_ue->PHY_measurements.n0_power_tot_dBm,
phy_vars_ue->PHY_measurements.n0_power_dB[0],
phy_vars_ue->PHY_measurements.n0_power_dB[1]);
#ifdef CBMIMO1
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (rf_mode %d)\n",phy_vars_ue->rx_total_gain_dB, openair_daq_vars.rx_rf_mode);
#else
#ifdef EXMIMO
#ifdef DRIVER2013
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB (LNA %d, vga %d dB)\n",phy_vars_ue->rx_total_gain_dB, (p_exmimo_config->rf.rf_mode[0]& LNAGAINMASK) >> 14,p_exmimo_config->rf.rx_gain[0][0]);
......@@ -102,7 +99,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
#else
len += sprintf(&buffer[len], "[UE PROC] RX Gain %d dB\n",phy_vars_ue->rx_total_gain_dB);
#endif
#endif
len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d)\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset);
len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[phy_vars_ue->UE_mode[0]],phy_vars_ue->UE_mode[0]);
len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",phy_vars_ue->timing_advance);
......@@ -246,13 +243,9 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
#ifdef EXMIMO
phy_vars_ue->rx_total_gain_dB = ((int)(10*log10(phy_vars_ue->PHY_measurements.rssi)))-input_level_dBm;
len += sprintf(&buffer[len], "[UE PROC] rf_mode %d, input level (set by user) %d dBm, VGA gain %d dB ==> total gain %3.2f dB, noise figure %3.2f dB\n",
phy_vars_ue->rx_gain_mode[0],
p_exmimo_config->rf.rf_mode[0],
input_level_dBm,
#ifdef DRIVER2013
p_exmimo_config->rf.rx_gain[0][0],
#else
exmimo_pci_interface->rf.rx_gain00,
#endif
10*log10(phy_vars_ue->PHY_measurements.rssi)-input_level_dBm,
10*log10(phy_vars_ue->PHY_measurements.n0_power_tot)-phy_vars_ue->rx_total_gain_dB+105);
#endif
......
......@@ -40,7 +40,6 @@
#ifndef __PHY_DEFS__H__
#define __PHY_DEFS__H__
#ifdef USER_MODE
#include <stdio.h>
#include <stdlib.h>
#include <malloc.h>
......@@ -86,45 +85,6 @@
#define min(a,b) ((a)<(b) ? (a) : (b))
#else // USER_MODE
#include "ARCH/COMMON/defs.h"
#include "ARCH/CBMIMO1/DEVICE_DRIVER/defs.h"
#define msg fifo_printf
//#define msg(x...) rt_printk(KERN_ALERT x)
#define msg_nrt printk(KERN_ALERT x)
#ifdef BIGPHYSAREA
#define bigmalloc(x) (bigphys_malloc(x))
#define bigmalloc16(x) (bigphys_malloc(x))
#define malloc16(x) (bigphys_malloc(x))
#define free16(y,x)
#define bigfree(y,x)
#else // BIGPHYSAREA
#define bigmalloc(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0))
#define bigmalloc16(x) (dma_alloc_coherent(pdev[0],(x),&dummy_dma_ptr,0))
#define bigfree(y,x) (dma_free_coherent(pdev[0],(x),(void *)(y),dummy_dma_ptr))
#define malloc16(x) (kmalloc(x,GFP_KERNEL))
#define free16(y,x) (kfree(y))
#endif // BIGPHYSAREA
#ifdef CBMIMO1
#define openair_get_mbox() (*(uint32_t *)mbox)
#else //CBMIMO1
#define openair_get_mbox() (*(uint32_t *)PHY_vars->mbox>>1)
#endif //CBMIMO1
#endif // USERMODE
#define bzero(s,n) (memset((s),0,(n)))
#define cmax(a,b) ((a>b) ? (a) : (b))
......@@ -362,10 +322,11 @@ typedef struct PHY_VARS_eNB_s{
#define debug_msg if (((mac_xface->frame%100) == 0) || (mac_xface->frame < 50)) msg
//#define debug_msg msg
/*
typedef enum {
max_gain=0,med_gain,byp_gain
} rx_gain_t;
*/
/// Top-level PHY Data Structure for UE
typedef struct
......@@ -375,8 +336,9 @@ typedef struct
uint8_t local_flag;
uint32_t tx_total_gain_dB;
uint32_t rx_total_gain_dB; ///this is a function of rx_gain_mode (and the corresponding gain) and the rx_gain of the card
rx_gain_t rx_gain_mode[4];
uint32_t rx_gain_max[4];
/*
rx_gain_t rx_gain_mode[4];*/
uint32_t rx_gain_med[4];
uint32_t rx_gain_byp[4];
int8_t tx_power_dBm;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment