From cfd45a1d9e84b1af8ac6356632fa7bb629c83b91 Mon Sep 17 00:00:00 2001 From: Sandeep Kumar <ee13b1025@iith.ac.in> Date: Mon, 4 Jul 2016 17:42:31 +0200 Subject: [PATCH] small fixes and mid save --- openair1/PHY/LTE_TRANSPORT/if4_tools.c | 2 - openair1/PHY/LTE_TRANSPORT/if4_tools.h | 3 +- .../PHY/LTE_TRANSPORT/if5_mobipass_tools.c | 67 ++++++++++++++----- .../PHY/LTE_TRANSPORT/if5_mobipass_tools.h | 59 +++++++++++++--- openair1/SCHED/phy_procedures_lte_eNb.c | 15 ++++- targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c | 8 +-- targets/RT/USER/lte-enb.c | 16 ++--- 7 files changed, 123 insertions(+), 47 deletions(-) diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.c b/openair1/PHY/LTE_TRANSPORT/if4_tools.c index b71365d6fc..1a1178ee6f 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.c @@ -38,8 +38,6 @@ * \warning */ -#include <stdint.h> - #include "PHY/defs.h" #include "PHY/LTE_TRANSPORT/if4_tools.h" #include "PHY/TOOLS/ALAW/alaw_lut.h" diff --git a/openair1/PHY/LTE_TRANSPORT/if4_tools.h b/openair1/PHY/LTE_TRANSPORT/if4_tools.h index 18ff2bb8f8..a885d28ec2 100644 --- a/openair1/PHY/LTE_TRANSPORT/if4_tools.h +++ b/openair1/PHY/LTE_TRANSPORT/if4_tools.h @@ -38,7 +38,6 @@ * \warning */ -#include <stdint.h> #include "PHY/defs.h" /// Macro for IF4 packet type @@ -57,7 +56,7 @@ struct IF4_header { /// Frame Status uint32_t frame_status; -}; +} __attribute__ ((__packed__)); typedef struct IF4_header IF4_header_t; #define sizeof_IF4_header_t 12 diff --git a/openair1/PHY/LTE_TRANSPORT/if5_mobipass_tools.c b/openair1/PHY/LTE_TRANSPORT/if5_mobipass_tools.c index 2306fef39b..d38dfb76a5 100644 --- a/openair1/PHY/LTE_TRANSPORT/if5_mobipass_tools.c +++ b/openair1/PHY/LTE_TRANSPORT/if5_mobipass_tools.c @@ -1,5 +1,42 @@ +/******************************************************************************* + OpenAirInterface + Copyright(c) 1999 - 2014 Eurecom -#include <stdint.h> + 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@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + + *******************************************************************************/ + +/*! \file PHY/LTE_TRANSPORT/if5_mobipass_tools.c +* \brief +* \author S. Sandeep Kumar, Raymond Knopp +* \date 2016 +* \version 0.1 +* \company Eurecom +* \email: ee13b1025@iith.ac.in, knopp@eurecom.fr +* \note +* \warning +*/ #include "PHY/defs.h" #include "PHY/LTE_TRANSPORT/if5_mobipass_tools.h" @@ -7,36 +44,35 @@ #include "targets/ARCH/ETHERNET/USERSPACE/LIB/if_defs.h" -uint8_t send_IF5(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint8_t init_seq) { +void send_IF5(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint8_t *seqno) { - uint8_t seqno=init_seq; - void *txp[2]; + LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms; + void *txp[fp->nb_antennas_tx]; void *tx_buffer=NULL; - __m128i *data_block=NULL,*main_data_block=NULL; + __m128i *data_block=NULL, *data_block_head=NULL; __m128i *txp128; __m128i t0, t1; uint16_t packet_id=0, i; - uint16_t db_fulllength = 640; + uint16_t db_fulllength=640; tx_buffer = memalign(16, MAC_HEADER_SIZE_BYTES + sizeof_IF5_mobipass_header_t + db_fulllength*sizeof(int16_t)); IF5_mobipass_header_t *header = (IF5_mobipass_header_t *)(tx_buffer + MAC_HEADER_SIZE_BYTES); - data_block = (__m128i *)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF5_mobipass_header_t + 4); - main_data_block = data_block; + data_block_head = (__m128i *)(tx_buffer + MAC_HEADER_SIZE_BYTES + sizeof_IF5_mobipass_header_t + 4); header->flags = 0; header->fifo_status = 0; + header->seqno = *seqno; header->ack = 0; - header->seqno = seqno; - header->rsvd = 0; + header->word0 = 0; txp[0] = (void*)&eNB->common_vars.txdata[0][0][proc->subframe_tx*eNB->frame_parms.samples_per_tti]; txp128 = (__m128i *) txp[0]; - for (packet_id=0; packet_id<(7680*2)/640; packet_id++) { - header->time_stamp = proc->timestamp_tx + packet_id*640; - data_block = main_data_block; + for (packet_id=0; packet_id<(fp->samples_per_tti*2)/db_fulllength; packet_id++) { + header->time_stamp = proc->timestamp_tx + packet_id * db_fulllength; + data_block = data_block_head; for (i=0; i<db_fulllength>>3; i+=2) { t0 = _mm_srli_epi16(*txp128++, 4); @@ -58,8 +94,7 @@ uint8_t send_IF5(PHY_VARS_eNB *eNB, eNB_rxtx_proc_t *proc, uint8_t init_seq) { header->seqno += 1; } - seqno = header->seqno; + *seqno = header->seqno; free(tx_buffer); - return(seqno); + return; } - diff --git a/openair1/PHY/LTE_TRANSPORT/if5_mobipass_tools.h b/openair1/PHY/LTE_TRANSPORT/if5_mobipass_tools.h index 307742dc1e..e9bc26f9a6 100644 --- a/openair1/PHY/LTE_TRANSPORT/if5_mobipass_tools.h +++ b/openair1/PHY/LTE_TRANSPORT/if5_mobipass_tools.h @@ -1,26 +1,65 @@ +/******************************************************************************* + 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@lists.eurecom.fr + + Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE + + *******************************************************************************/ + +/*! \file PHY/LTE_TRANSPORT/if5_mobipass_tools.h +* \brief +* \author S. Sandeep Kumar, Raymond Knopp +* \date 2016 +* \version 0.1 +* \company Eurecom +* \email: ee13b1025@iith.ac.in, knopp@eurecom.fr +* \note +* \warning +*/ #include <stdint.h> #include "PHY/defs.h" -#define IF5_MOBIPASS 0x0050 +#define IF5_MOBIPASS 0xbffe struct IF5_mobipass_header { - /// Type + /// uint16_t flags; - /// Sub-Type + /// uint16_t fifo_status; - /// Reserved + /// uint8_t seqno; - + /// uint8_t ack; - - uint32_t rsvd; - /// Frame Status + /// + uint32_t word0; + /// uint32_t time_stamp; - + } __attribute__ ((__packed__)); typedef struct IF5_mobipass_header IF5_mobipass_header_t; #define sizeof_IF5_mobipass_header_t 14 -uint8_t send_IF5(PHY_VARS_eNB*, eNB_rxtx_proc_t*, uint8_t); +void send_IF5(PHY_VARS_eNB*, eNB_rxtx_proc_t*, uint8_t*); diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index e5b93dc6ac..a81e9dcfad 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -2524,6 +2524,10 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl uint16_t packet_type; uint32_t symbol_number=0; uint32_t symbol_mask, symbol_mask_full; + + struct timespec time_req, time_rem; + time_req.tv_sec = 0; + time_req.tv_nsec = 900000; if (subframe==9) { subframe=0; @@ -2583,7 +2587,16 @@ void phy_procedures_eNB_common_RX(PHY_VARS_eNB *eNB,const uint8_t abstraction_fl } else if(eNB->node_function == eNodeB_3GPP_BBU) { // acquisition from IF /// **** trx_read_func from IF device **** /// - + nanosleep(&time_req, &time_rem); + + proc->timestamp_rx += fp->samples_per_tti; + + proc->frame_rx = (proc->timestamp_rx / (fp->samples_per_tti*10))&1023; + proc->subframe_rx = (proc->timestamp_rx / fp->samples_per_tti)%10; + + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_RX_ENB, proc->frame_rx ); + VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_SUBFRAME_NUMBER_RX_ENB, proc->subframe_rx ); } diff --git a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c index 17a9a677e0..bf5554fd26 100644 --- a/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c +++ b/targets/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c @@ -124,11 +124,11 @@ int eth_socket_init_raw(openair0_device *device) { /* Construct the Ethernet header */ ether_aton_r(local_mac, (struct ether_addr *)(&(eth->eh.ether_shost))); ether_aton_r(remote_mac, (struct ether_addr *)(&(eth->eh.ether_dhost))); -// if (((*) device->priv)->flags == ETH_RAW_IF5_MOBIPASS) { + if (eth->flags == ETH_RAW_IF5_MOBIPASS) { eth->eh.ether_type = htons(0xbffe); -// } else { -// eth->eh.ether_type = htons((short)device->openair0_cfg->my_port); -// } + } else { + eth->eh.ether_type = htons((short)device->openair0_cfg->my_port); + } printf("[%s] binding mod_%d to hardware address %x:%x:%x:%x:%x:%x\n",((device->host_type == BBU_HOST) ? "BBU": "RRH"),Mod_id,eth->eh.ether_shost[0],eth->eh.ether_shost[1],eth->eh.ether_shost[2],eth->eh.ether_shost[3],eth->eh.ether_shost[4],eth->eh.ether_shost[5]); return 0; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index 1fcd9bb61c..de37789c3d 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -302,6 +302,8 @@ static void* eNB_thread_rxtx( void* param ) { uint16_t packet_type; uint32_t symbol_number=0; + uint8_t seqno=0; + if (opp_enabled == 1) { snprintf(tx_time_name, 100,"/tmp/%s_tx_time_thread_sf", "eNB"); tx_time_file = fopen(tx_time_name,"w"); @@ -548,8 +550,8 @@ static void* eNB_thread_rxtx( void* param ) { } else if (PHY_vars_eNB_g[0][proc->CC_id]->node_function == eNodeB_3GPP_BBU) { /// **** trx_write_func to IF device **** /// - // send_IF5(PHY_vars_eNB_g[0][proc->CC_id], proc, 0); - + send_IF5(PHY_vars_eNB_g[0][proc->CC_id], proc, &seqno); + } else { /// **** send_IF4 of txdataF to RRU **** /// VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_SEND_IF4, 1 ); @@ -626,10 +628,8 @@ static void* eNB_thread_rx_common( void* param ) { PHY_VARS_eNB *eNB = PHY_vars_eNB_g[0][proc->CC_id]; LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms; - uint8_t seqno=0; FILE *rx_time_file = NULL; char rx_time_name[101]; - int i; struct timespec wait; wait.tv_sec=0; @@ -764,14 +764,6 @@ static void* eNB_thread_rx_common( void* param ) { if (eNB->rfdevice.trx_start_func(&eNB->rfdevice) != 0 ) LOG_E(HW,"Could not start the RF device\n"); } - - // proc->proc_rxtx[0].timestamp_tx = 0; - // seqno = send_IF5(eNB, &proc->proc_rxtx[0], 0); - - // for (i=0; i<1000;i++) { - // seqno = send_IF5(eNB, &proc->proc_rxtx[0], seqno); - // proc->proc_rxtx[0].timestamp_tx += 7680*2; - // } // This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices while (!oai_exit) { -- GitLab