Commit 1f8c702f authored by Xiwen JIANG's avatar Xiwen JIANG

support more >1 EXMIMO2 cards

parent fc1e26d0
......@@ -1040,13 +1040,13 @@ typedef struct {
/// first index: ? [0..1023] (hard coded)
int16_t *prachF;
/// \brief ?.
/// first index: rx antenna [0..3] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
/// first index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
/// second index: ? [0..ofdm_symbol_size*12[
int16_t *rxsigF[4];
int16_t *rxsigF[64];
/// \brief local buffer to compute prach_ifft (necessary in case of multiple CCs)
/// first index: rx antenna [0..3] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
/// first index: rx antenna [0..63] (hard coded) \note Hard coded array size indexed by \c nb_antennas_rx.
/// second index: ? [0..2047] (hard coded)
int16_t *prach_ifft[4];
int16_t *prach_ifft[64];
} LTE_eNB_PRACH;
typedef struct {
......
......@@ -277,14 +277,18 @@ int openair_device_ioctl(struct inode *inode,struct file *filp, unsigned int cmd
printk("[openair][IOCTL] : openair_DUMP_CONFIG(%d): exmimo_pci_kvirt[%d].exmimo_config_ptr = %p (phys %08x)\n",
(int)arg, (int)arg, exmimo_pci_kvirt[(int)arg].exmimo_config_ptr, p_exmimo_pci_phys[(int)arg]->exmimo_config_ptr);
/*printk("EXMIMO_CONFIG: freq0 %d Hz, freq1 %d Hz, freqtx0 %d Hz, freqtx1 %d Hz, \nRX gain0 %d dB, RX Gain1 %d dB\n",
printk("[openair][IOCTL]: EXMIMO_CONFIG: freq0 %u Hz, freq1 %u Hz, freqtx0 %u Hz, freqtx1 %u Hz, \nRX gain0 %d dB, RX Gain1 %d dB, autocal (%d,%d,%d,%d)\n",
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rf_freq_rx[0],
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rf_freq_rx[1],
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rf_freq_tx[0],
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rf_freq_tx[1],
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rx_gain[0][0],
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rx_gain[1][0]);
*/
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.rx_gain[1][0],
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.do_autocal[0],
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.do_autocal[1],
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.do_autocal[2],
exmimo_pci_kvirt[(int)arg].exmimo_config_ptr->rf.do_autocal[3]);
exmimo_send_pccmd((int)arg, EXMIMO_CONFIG);
......
......@@ -252,7 +252,7 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
// Initialize card
// exmimo_config_t *p_exmimo_config;
exmimo_id_t *p_exmimo_id;
int ret;
int ret, card;
ret = openair0_open();
......@@ -276,15 +276,17 @@ int device_init(openair0_device *device, openair0_config_t *openair0_cfg) {
printf ("Detected %d number of cards, %d number of antennas.\n", openair0_num_detected_cards, openair0_num_antennas[0]);
}
// p_exmimo_config = openair0_exmimo_pci[0].exmimo_config_ptr;
p_exmimo_id = openair0_exmimo_pci[0].exmimo_id_ptr;
for (card=0; card<openair0_num_detected_cards; card++) {
// p_exmimo_config = openair0_exmimo_pci[0].exmimo_config_ptr;
p_exmimo_id = openair0_exmimo_pci[card].exmimo_id_ptr;
printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", 0, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev);
printf("Card %d: ExpressMIMO %d, HW Rev %d, SW Rev 0x%d\n", card, p_exmimo_id->board_exmimoversion, p_exmimo_id->board_hwrev, p_exmimo_id->board_swrev);
// check if the software matches firmware
if (p_exmimo_id->board_swrev!=BOARD_SWREV_CNTL2) {
printf("Software revision %d and firmware revision %d do not match. Please update either the firmware or the software!\n",BOARD_SWREV_CNTL2,p_exmimo_id->board_swrev);
return(-1);
// check if the software matches firmware
if (p_exmimo_id->board_swrev!=BOARD_SWREV_CNTL2) {
printf("Software revision %d and firmware revision %d do not match. Please update either the firmware or the software!\n",BOARD_SWREV_CNTL2,p_exmimo_id->board_swrev);
return(-1);
}
}
device->type = EXMIMO_DEV;
......@@ -361,11 +363,17 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
#endif
for (ant=0; ant<4; ant++) {
p_exmimo_config->rf.rf_freq_rx[ant] = 0;
p_exmimo_config->rf.rf_freq_tx[ant] = 0;
p_exmimo_config->rf.rf_mode[ant] = 0;
p_exmimo_config->rf.rx_gain[ant][0] = 0;
p_exmimo_config->rf.tx_gain[ant][0] = 0;
if (openair0_cfg[card].rx_freq[ant] || openair0_cfg[card].tx_freq[ant]) {
ACTIVE_RF += (1<<ant)<<5;
p_exmimo_config->rf.rf_mode[ant] = RF_MODE_BASE;
p_exmimo_config->rf.do_autocal[ant] = 1;//openair0_cfg[card].autocal[ant];
printf("card %d, antenna %d, autocal %d\n",card,ant,openair0_cfg[card].autocal[ant]);
printf("card %d, antenna %d, autocal %d\n",card,ant,p_exmimo_config->rf.do_autocal[ant]);
}
if (openair0_cfg[card].tx_freq[ant]) {
......@@ -396,10 +404,7 @@ int openair0_config(openair0_config_t *openair0_cfg, int UE_flag)
p_exmimo_config->rf.rf_mode[ant] += LNAByp;
break;
}
} else {
p_exmimo_config->rf.rf_mode[ant] = 0;
p_exmimo_config->rf.do_autocal[ant] = 0;
}
}
p_exmimo_config->rf.rf_local[ant] = rf_local[ant];
p_exmimo_config->rf.rf_rxdc[ant] = rf_rxdc[ant];
......
......@@ -2926,7 +2926,8 @@ int main( int argc, char **argv )
if (rf_config_file[0] == '\0')
openair0_cfg[0].configFilename = NULL;
else
openair0_cfg[0].configFilename = rf_config_file;
for (card=0; card<MAX_CARDS; card++)
openair0_cfg[card].configFilename = rf_config_file;
#if T_TRACER
T_init(T_port, T_wait, T_dont_fork);
......@@ -3923,7 +3924,7 @@ int main( int argc, char **argv )
int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_cfg, openair0_rf_map rf_map[MAX_NUM_CCs])
{
int i, CC_id;
int i, CC_id, card, ant;
#ifndef EXMIMO
uint16_t N_TA_offset = 0;
#else
......@@ -3960,17 +3961,19 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c
openair0_cfg[CC_id].rx_num_channels = 0;
for (i=0; i<frame_parms->nb_antennas_rx; i++) {
printf("Mapping eNB CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i);
card = i/4;
ant = i%4;
printf("Mapping eNB CC_id %d, rx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][ant]+uplink_frequency_offset[CC_id][ant],rf_map[CC_id].card+card, rf_map[CC_id].chain+ant);
free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i]);
phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].adc_head[rf_map[CC_id].chain+i];
phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card+card].adc_head[rf_map[CC_id].chain+ant];
if (openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i]) {
if (openair0_cfg[rf_map[CC_id].card+card].rx_freq[rf_map[CC_id].chain+ant]) {
printf("Error with rf_map! A channel has already been allocated!\n");
return(-1);
} else {
openair0_cfg[rf_map[CC_id].card].rx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i]+uplink_frequency_offset[CC_id][i];
openair0_cfg[rf_map[CC_id].card].rx_gain[rf_map[CC_id].chain+i] = rx_gain[CC_id][i];
openair0_cfg[rf_map[CC_id].card].rx_num_channels++;
openair0_cfg[rf_map[CC_id].card+card].rx_freq[rf_map[CC_id].chain+ant] = downlink_frequency[CC_id][ant]+uplink_frequency_offset[CC_id][ant];
openair0_cfg[rf_map[CC_id].card+card].rx_gain[rf_map[CC_id].chain+ant] = rx_gain[CC_id][ant];
openair0_cfg[rf_map[CC_id].card+card].rx_num_channels++;
}
printf("rxdata[%d] @ %p\n",i,phy_vars_eNB[CC_id]->lte_eNB_common_vars.rxdata[0][i]);
......@@ -3982,17 +3985,19 @@ int setup_eNB_buffers(PHY_VARS_eNB **phy_vars_eNB, openair0_config_t *openair0_c
}
for (i=0; i<frame_parms->nb_antennas_tx; i++) {
printf("Mapping eNB CC_id %d, tx_ant %d, freq %u on card %d, chain %d\n",CC_id,i,downlink_frequency[CC_id][i],rf_map[CC_id].card,rf_map[CC_id].chain+i);
card = i/4;
ant = i%4;
printf("Mapping eNB CC_id %d, tx_ant %d, freq %u on card %d chain %d\n",CC_id,i,downlink_frequency[CC_id][ant],rf_map[CC_id].card+card,rf_map[CC_id].chain+ant);
free(phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]);
phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card].dac_head[rf_map[CC_id].chain+i];
phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i] = (int32_t*) openair0_exmimo_pci[rf_map[CC_id].card+card].dac_head[rf_map[CC_id].chain+ant];
if (openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i]) {
if (openair0_cfg[rf_map[CC_id].card+card].tx_freq[rf_map[CC_id].chain+ant]) {
printf("Error with rf_map! A channel has already been allocated!\n");
return(-1);
} else {
openair0_cfg[rf_map[CC_id].card].tx_freq[rf_map[CC_id].chain+i] = downlink_frequency[CC_id][i];
openair0_cfg[rf_map[CC_id].card].tx_gain[rf_map[CC_id].chain+i] = tx_gain[CC_id][i];
openair0_cfg[rf_map[CC_id].card].tx_num_channels++;
openair0_cfg[rf_map[CC_id].card+card].tx_freq[rf_map[CC_id].chain+ant] = downlink_frequency[CC_id][ant];
openair0_cfg[rf_map[CC_id].card+card].tx_gain[rf_map[CC_id].chain+ant] = tx_gain[CC_id][ant];
openair0_cfg[rf_map[CC_id].card+card].tx_num_channels++;
}
printf("txdata[%d] @ %p\n",i,phy_vars_eNB[CC_id]->lte_eNB_common_vars.txdata[0][i]);
......
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