Commit 70920ffd authored by gauthier's avatar gauthier

abstraction mode is OK

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5092 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent cdabfe0a
......@@ -154,9 +154,9 @@ phy_adjust_gain (PHY_VARS_UE *phy_vars_ue, u8 eNB_id) {
#endif
#ifdef DEBUG_PHY
if ((mac_xface->frame%100==0) || (mac_xface->frame < 10))
msg("[PHY][ADJUST_GAIN] frame %d, clear = %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n",
mac_xface->frame,clear,rx_power,rx_power_fil,rx_power_fil_dB,coef,ncoef,phy_vars_ue->rx_total_gain_dB,
if ((phy_vars_ue->frame%100==0) || (phy_vars_ue->frame < 10))
msg("[PHY][ADJUST_GAIN] frame %d, rx_power = %d, rx_power_fil = %d, rx_power_fil_dB = %d, coef=%d, ncoef=%d, rx_total_gain_dB = %d (%d,%d,%d)\n",
phy_vars_ue->frame,rx_power,rx_power_fil,rx_power_fil_dB,coef,ncoef,phy_vars_ue->rx_total_gain_dB,
TARGET_RX_POWER,MAX_RF_GAIN,MIN_RF_GAIN);
#endif //DEBUG_PHY
......
......@@ -69,11 +69,11 @@
#define MAX_NUM_CHANNEL_BITS (14*1200*6) // 14 symbols, 1200 REs, 12 bits/RE
#define MAX_NUM_RE (14*1200)
#define SI_RNTI 0xffff
#define M_RNTI 0xfffd
#define P_RNTI 0xfffe
#define CBA_RNTI 0xfff4
#define C_RNTI 0x1234
#define SI_RNTI (rnti_t)0xffff
#define M_RNTI (rnti_t)0xfffd
#define P_RNTI (rnti_t)0xfffe
#define CBA_RNTI (rnti_t)0xfff4
#define C_RNTI (rnti_t)0x1234
#define PMI_2A_11 0
#define PMI_2A_1m1 1
......@@ -677,9 +677,9 @@ typedef struct {
/// Position of first CCE of the dci
unsigned int nCCE;
/// flag to indicate that this is a RA response
uint8_t ra_flag;
boolean_t ra_flag;
/// rnti
uint16_t rnti;
rnti_t rnti;
/// Format
DCI_format_t format;
/// DCI pdu
......
......@@ -261,7 +261,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
unsigned int success=0;
u8 eNB,UE_id,i,j,number_of_cards=1;
u8 eNB,UE_id,i,j,number_of_cards_l=1;
u32 ulsch_errors=0;
u32 ulsch_round_attempts[4]={0,0,0,0},ulsch_round_errors[4]={0,0,0,0};
u32 harq_pid_ul, harq_pid_dl;
......@@ -277,9 +277,9 @@ int dump_eNB_stats(PHY_VARS_eNB *phy_vars_eNB, char* buffer, int length) {
phy_vars_eNB->total_system_throughput = 0;//phy_vars_eNB->eNB_UE_stats[UE_id].total_transmitted_bits + phy_vars_eNB->total_system_throughput;
// }
for (eNB=0;eNB<number_of_cards;eNB++) {
for (eNB=0;eNB<number_of_cards_l;eNB++) {
len += sprintf(&buffer[len],"[eNB PROC] eNB %d/%d Frame %d: RX Gain %d dB, I0 %d dBm (%d,%d) dB \n",
eNB,number_of_cards,
eNB,number_of_cards_l,
phy_vars_eNB->frame,
phy_vars_eNB->rx_total_gain_eNB_dB,
phy_vars_eNB->PHY_measurements_eNB[eNB].n0_power_tot_dBm,
......
This diff is collapsed.
......@@ -67,47 +67,6 @@
#define CH_OFFSET 0x0004
#define CH_SHIFT 2
#ifdef MESH
//# define MAX_RB_MOBILE NB_RB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
//# define MAX_RAB_MOBILE NB_RAB_MAX * ( MAX_MANAGED_RG_PER_MOBILE + MAX_MOBILES_PER_RG - 1 )
//# define MAX_RB_RG MAX_RB_MOBILE //NB_RB_MAX * MAX_MOBILES_PER_RG
//# define MAX_RAB_RG (NB_RB_MAX+1) * (MAX_MOBILES_PER_RG + 1)
//# define MAX_RAB MAX_RAB_RG
//# define MAX_RB MAX_RB_RG
#else
//# define MAX_RB_MOBILE NB_RB_MAX * MAX_MANAGED_RG_PER_MOBILE
//# define MAX_RAB_MOBILE NB_RAB_MAX * MAX_MANAGED_RG_PER_MOBILE
//# define MAX_RB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
//# define MAX_RAB_RG NB_RB_MAX * MAX_MOBILES_PER_RG
//# ifdef NODE_RG
//# define MAX_RAB MAX_RAB_RG
//# define MAX_RB MAX_RB_RG
//# else
//# // ifdef NODE_MT
//# // define MAX_RAB MAX_RAB_MOBILE
//# // define MAX_RB MAX_RB_MOBILE
//# //else
//# //error NODE_RG or NODE_MT must be defined
//# //endif
//# endif
#endif //MESH
// RLC_MODE
# define RLC_NONE (rlc_mode_t)0
# define RLC_MODE_AM (rlc_mode_t)1
# define RLC_MODE_TM (rlc_mode_t)2
# define RLC_MODE_UM (rlc_mode_t)3
//E_R
# define E_R_RLC_ER_RELEASE 1
# define E_R_RLC_ER_MODIFICATION 2
# define E_R_RLC_ER_RE_ESTABLISHMENT 4
# define E_R_RLC_ER_STOP 8
# define E_R_RLC_ER_CONTINUE 16
# define E_R_RLC_ER_NONE 0
// RLC_AM_SEND_MRW
# define SEND_MRW_OFF 15
# define SEND_MRW_ON 240
......@@ -134,7 +93,8 @@
# endif
# endif
#define UNUSED_PARAM_MBMS_SESSION_ID 0
#define UNUSED_PARAM_MBMS_SERVICE_ID 0
#ifdef USER_MODE
#define printk printf
......
......@@ -32,18 +32,20 @@ typedef unsigned int tb_size_t;
typedef u16_t rb_id_t;
typedef u16_t srb_id_t;
typedef u32_t frame_t;
typedef s32_t sframe_t;
typedef u32_t sub_frame_t;
typedef u8_t module_id_t;
typedef s8_t smodule_id_t;
typedef unsigned int mui_t;
typedef unsigned int confirm_t;
typedef unsigned int rb_type_t;
typedef unsigned int logical_chan_id_t;
typedef unsigned int num_tb_t;
typedef unsigned int crc_t;
typedef unsigned int rlc_tx_status_t;
typedef unsigned int rlc_mode_t;
typedef s16_t rlc_sn_t;
typedef u16_t rlc_usn_t;
typedef u16_t pdcp_sn_t;
typedef u32_t pdcp_hfn_t;
typedef int traffic_type_t;
typedef u32_t mbms_session_id_t;
typedef u16_t mbms_service_id_t;
......@@ -56,6 +58,25 @@ typedef unsigned short crc16_t;
typedef unsigned int crc32_t;
typedef signed char boolean_t;
#if !defined(TRUE)
#define TRUE (boolean_t)0x01
#endif
#if !defined(FALSE)
#define FALSE (boolean_t)0x00
#endif
typedef enum link_direction_e {
UNKNOWN_DIR = 0,
DIR_UPLINK = 1,
DIR_DOWNLINK = 2
} link_direction_t;
typedef enum rb_type_e {
UNKNOWN_RADIO_BEARER = 0,
SIGNALLING_RADIO_BEARER = 1,
RADIO_ACCESS_BEARER = 2
} rb_type_t;
typedef enum MBMS_flag_e {
MBMS_FLAG_NO = 0,
......
......@@ -29,11 +29,6 @@
# define ACTION_MBMS_ADD 10
# define ACTION_MBMS_MODIFY 11
# define UPLINK 1
# define DOWNLINK 2
# define SIGNALLING_RADIO_BEARER 1
# define RADIO_ACCESS_BEARER 2
# define MOBILE 7
// equipment type
......
......@@ -203,7 +203,6 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
char* enb_ipv4_address_for_S1U = NULL;
char* enb_interface_name_for_S1_MME = NULL;
char* enb_ipv4_address_for_S1_MME = NULL;
char *astring = NULL;
char *address = NULL;
char *cidr = NULL;
......
......@@ -472,7 +472,7 @@ typedef struct{
/// NDI from last UL scheduling
uint8_t oldNDI_UL[8];
/// Flag to indicate UL has been scheduled at least once
int ul_active;
boolean_t ul_active;
// PHY interface info
......@@ -536,7 +536,7 @@ typedef struct{
typedef struct {
/// Flag to indicate this process is active
u8 RA_active;
boolean_t RA_active;
/// Size of DCI for RA-Response (bytes)
u8 RA_dci_size_bytes1;
/// Size of DCI for RA-Response (bits)
......@@ -1129,9 +1129,9 @@ void init_ue_sched_info(void);
void add_ue_ulsch_info (module_id_t module_idP, module_id_t ue_mod_idP, sub_frame_t subframe,UE_ULSCH_STATUS status);
void add_ue_dlsch_info (module_id_t module_idP, module_id_t ue_mod_idP, sub_frame_t subframe,UE_DLSCH_STATUS status);
module_id_t find_UE_id (module_id_t module_idP, rnti_t rnti) ;
u16 find_UE_RNTI (module_id_t module_idP, module_id_t ue_mod_idP);
rnti_t find_UE_RNTI (module_id_t module_idP, module_id_t ue_mod_idP);
u8 find_active_UEs (module_id_t module_idP);
u8 is_UE_active (module_id_t module_idP, module_id_t ue_mod_idP );
boolean_t is_UE_active (module_id_t module_idP, module_id_t ue_mod_idP );
u8 find_ulgranted_UEs(module_id_t module_idP);
u8 find_dlgranted_UEs(module_id_t module_idP);
u8 process_ue_cqi (module_id_t module_idP, module_id_t ue_mod_idP);
......@@ -1343,13 +1343,13 @@ BSR_SHORT *get_bsr_short(module_id_t module_idP, u8 bsr_len);
*/
BSR_LONG * get_bsr_long(module_id_t module_idP, u8 bsr_len);
/*! \fn int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid)
/*! \fn boolean_t update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid)
\brief get the rlc stats and update the bsr level for each lcid
\param[in] Mod_id instance of the UE
\param[in] frame Frame index
\param[in] lcid logical channel identifier
*/
int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcgid);
boolean_t update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcgid);
/*! \fn locate (int *table, int size, int value)
\brief locate the BSR level in the table as defined in 36.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table.
......
This diff is collapsed.
......@@ -54,6 +54,7 @@
#include "defs.h"
#include "extern.h"
#include "assertions.h"
#include "PHY_INTERFACE/extern.h"
#include "PHY_INTERFACE/defs.h"
#include "PHY/defs.h"
......@@ -68,11 +69,6 @@
#include "SCHED/defs.h"
//#ifdef BIGPHYSAREA
//extern void *bigphys_malloc(int);
//#endif
/***********************************************************************/
void dl_phy_sync_success(module_id_t module_idP,
frame_t frameP,
......
......@@ -106,7 +106,7 @@ void store_dlsch_buffer (module_id_t Mod_id,
for(i=0;i< MAX_NUM_LCID; i++){ // loop over all the logical channels
rlc_status = mac_rlc_status_ind(Mod_id,next_ue, frameP,1,RLC_MBMS_NO,i,0 );
rlc_status = mac_rlc_status_ind(Mod_id,next_ue, frameP,ENB_FLAG_YES,MBMS_FLAG_NO,i,0 );
eNB_mac_inst[Mod_id].UE_template[next_ue].dl_buffer_info[i] = rlc_status.bytes_in_buffer; //storing the dlsch buffer for each logical channel
eNB_mac_inst[Mod_id].UE_template[next_ue].dl_pdus_in_buffer[i] = rlc_status.pdus_in_buffer;
eNB_mac_inst[Mod_id].UE_template[next_ue].dl_buffer_head_sdu_creation_time[i] = rlc_status.head_sdu_creation_time ;
......
......@@ -296,7 +296,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind
else if (UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DCCH] > 0) {
// This is for triggering a transmission on DCCH using PRACH (during handover, or sending SR for example)
dcch_header_len = 2 + 2; /// SHORT Subheader + C-RNTI control element
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH,
6);
if (UE_mac_inst[module_idP].crnti_before_ho)
......@@ -306,7 +306,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind
LOG_D(MAC,"[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to send through PRACH(mac header len %d)\n",
module_idP,frameP, rlc_status.bytes_in_buffer,dcch_header_len);
sdu_lengths[0] = mac_rlc_data_req(eNB_indexP, module_idP,frameP,0, RLC_MBMS_NO,
sdu_lengths[0] = mac_rlc_data_req(eNB_indexP, module_idP,frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
DCCH,
(char *)&ulsch_buff[0]);
......@@ -355,7 +355,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,frame_t frameP, u8 eNB_ind
UE_mac_inst[module_idP].RA_tx_frame,UE_mac_inst[module_idP].RA_tx_subframe);
// compute backoff parameters
if (UE_mac_inst[module_idP].RA_backoff_cnt>0) {
frame_diff = (s32)frameP - UE_mac_inst[module_idP].RA_backoff_frame;
frame_diff = (sframe_t)frameP - UE_mac_inst[module_idP].RA_backoff_frame;
if (frame_diff < 0)
frame_diff = -frame_diff;
UE_mac_inst[module_idP].RA_backoff_cnt -= ((10*frame_diff) + (subframeP-UE_mac_inst[module_idP].RA_backoff_subframe));
......
......@@ -367,8 +367,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN
mac_rlc_data_ind(eNB_index,
module_idP,
frameP,
0,
RLC_MBMS_NO,
ENB_FLAG_NO,
MBMS_FLAG_NO,
DCCH,
(char *)payload_ptr,
rx_lengths[i],
......@@ -380,8 +380,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN
mac_rlc_data_ind(eNB_index,
module_idP,
frameP,
0,
RLC_MBMS_NO,
ENB_FLAG_NO,
MBMS_FLAG_NO,
DCCH1,
(char *)payload_ptr,
rx_lengths[i],
......@@ -401,8 +401,8 @@ void ue_send_sdu(module_id_t module_idP,frame_t frameP,u8 *sdu,u16 sdu_len,u8 eN
mac_rlc_data_ind(eNB_index,
module_idP,
frameP,
0,
RLC_MBMS_NO,
ENB_FLAG_NO,
MBMS_FLAG_NO,
DTCH,
(char *)payload_ptr,
rx_lengths[i],
......@@ -517,8 +517,8 @@ void ue_send_mch_sdu(module_id_t module_idP, frame_t frameP, u8 *sdu, u16 sdu_le
0,
module_idP,
frameP,
0,
RLC_MBMS_YES,
ENB_FLAG_NO,
MBMS_FLAG_YES,
MTCH + (maxDRB + 3),
(char *)payload_ptr,
rx_lengths[i],
......@@ -1080,14 +1080,14 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH] == LCID_NOT_EMPTY) {
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH,
(buflen-dcch_header_len-bsr_len-phr_len));
LOG_D(MAC, "[UE %d] Frame %d : UL-DCCH -> ULSCH, RRC message has %d bytes to "
"send (Transport Block size %d, mac header len %d)\n",
module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch_header_len);
sdu_lengths[0] += mac_rlc_data_req(0, module_idP,frameP,0, RLC_MBMS_NO,
sdu_lengths[0] += mac_rlc_data_req(0, module_idP,frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
DCCH,
(char *)&ulsch_buff[sdu_lengths[0]]);
......@@ -1106,7 +1106,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
// DCCH1
if (UE_mac_inst[module_idP].scheduling_info.LCID_status[DCCH1] == LCID_NOT_EMPTY) {
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH1,
(buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-sdu_length_total));
......@@ -1114,7 +1114,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
" send (Transport Block size %d, mac header len %d)\n",
module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dcch1_header_len);
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP,0,RLC_MBMS_NO,
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DCCH1,
(char *)&ulsch_buff[sdu_lengths[0]]);
sdu_length_total += sdu_lengths[num_sdus];
......@@ -1140,7 +1140,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
else
dtch_header_len = 2;//sizeof(SCH_SUBHEADER_SHORT);
*/
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
DTCH,
buflen-bsr_len-phr_len-dcch_header_len-dcch1_header_len-dtch_header_len-sdu_length_total);
......@@ -1148,7 +1148,7 @@ void ue_get_sdu(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, u8 e
module_idP,frameP, rlc_status.bytes_in_buffer,buflen,dtch_header_len,
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[DTCH]);
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP, 0, RLC_MBMS_NO,
sdu_lengths[num_sdus] = mac_rlc_data_req(0, module_idP,frameP, ENB_FLAG_NO, MBMS_FLAG_NO,
DTCH,
(char *)&ulsch_buff[sdu_length_total]);
......@@ -1586,10 +1586,10 @@ u8 get_bsr_len (module_id_t module_idP, u16 buflen) {
}
int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){
boolean_t update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){
mac_rlc_status_resp_t rlc_status;
u8 sr_pending = 0;
boolean_t sr_pending = FALSE;
if ((lcg_id < 0) || (lcg_id > MAX_NUM_LCGID) )
return sr_pending;
// fixme: need a better way to reset
......@@ -1599,11 +1599,11 @@ int update_bsr(module_id_t module_idP, frame_t frameP, u8 lcid, u8 lcg_id){
}
// for (lcid =0 ; lcid < MAX_NUM_LCID; lcid++) {
if (UE_mac_inst[module_idP].scheduling_info.LCGID[lcid] == lcg_id) {
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,0,RLC_MBMS_NO,
rlc_status = mac_rlc_status_ind(0, module_idP,frameP,ENB_FLAG_NO,MBMS_FLAG_NO,
lcid,
0);
if (rlc_status.bytes_in_buffer > 0 ) {
sr_pending = 1;
sr_pending = TRUE;
UE_mac_inst[module_idP].scheduling_info.LCID_status[lcid] = LCID_NOT_EMPTY;
UE_mac_inst[module_idP].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer);
UE_mac_inst[module_idP].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer;
......
This diff is collapsed.
This diff is collapsed.
......@@ -40,7 +40,7 @@
#include "pdcp.h"
#include "pdcp_primitives.h"
extern BOOL util_mark_nth_bit_of_octet(u8_t* octet, u8_t index);
extern boolean_t util_mark_nth_bit_of_octet(u8_t* octet, u8_t index);
/*
* Parses data/control field out of buffer of User Plane PDCP Data PDU with
......@@ -129,7 +129,7 @@ u8 pdcp_get_sequence_number_of_pdu_with_SRB_sn(unsigned char* pdu_buffer)
* @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
pdcp_control_plane_data_pdu_header* pdu)
{
if (pdu_buffer == NULL || pdu == NULL)
......@@ -150,7 +150,7 @@ BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu
* @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
pdcp_user_plane_data_pdu_header_with_long_sn* pdu)
{
if (pdu_buffer == NULL || pdu == NULL)
......@@ -182,7 +182,7 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b
* @param pdu A status report header
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu)
{
if (pdu_buffer == NULL || pdu == NULL)
......
......@@ -9,12 +9,6 @@
#ifndef PDCP_PRIMITIVES_H
#define PDCP_PRIMITIVES_H
#ifndef TRUE
#define TRUE 0x01
#define FALSE 0x00
typedef unsigned char BOOL;
#endif
/*
* 3GPP TS 36.323 V10.1.0 (2011-03)
*/
......@@ -130,7 +124,7 @@ u8 pdcp_get_sequence_number_of_pdu_with_SRB_sn(unsigned char* pdu_buffer);
* @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu_buffer, \
pdcp_control_plane_data_pdu_header* pdu);
/*
* Fills the incoming buffer with the fields of the header for long SN (RLC UM and AM)
......@@ -138,7 +132,7 @@ BOOL pdcp_serialize_control_plane_data_pdu_with_SRB_sn_buffer(unsigned char* pdu
* @param pdu_buffer PDCP PDU buffer
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_buffer, \
pdcp_user_plane_data_pdu_header_with_long_sn* pdu);
/*
......@@ -150,7 +144,7 @@ BOOL pdcp_serialize_user_plane_data_pdu_with_long_sn_buffer(unsigned char* pdu_b
* @param pdu A status report header
* @return TRUE on success, FALSE otherwise
*/
BOOL pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
boolean_t pdcp_serialize_control_pdu_for_pdcp_status_report(unsigned char* pdu_buffer, \
u8 bitmap[512], pdcp_control_pdu_for_pdcp_status_report* pdu);
int pdcp_netlink_dequeue_element(module_id_t enb_mod_idP, module_id_t ue_mod_idP, eNB_flag_t eNB_flagP,
......
......@@ -40,9 +40,9 @@
/*
* Initializes sequence numbering state
* @param pdcp_entity The PDCP entity to be initialized
* @return BOOL TRUE on success, FALSE otherwise
* @return boolean_t TRUE on success, FALSE otherwise
*/
BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity)
boolean_t pdcp_init_seq_numbers(pdcp_t* pdcp_entity)
{
if (pdcp_entity == NULL)
return FALSE;
......@@ -64,7 +64,7 @@ BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity)
return TRUE;
}
BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity)
boolean_t pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity)
{
if (pdcp_entity == NULL)
return FALSE;
......@@ -81,7 +81,7 @@ BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity)
/**
* Check if SN number is in the range according to SN size
*/
BOOL pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size)
boolean_t pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size)
{
if (seq_num >= 0 && seq_num <= pdcp_calculate_max_seq_num_for_given_size(seq_num_size))
return TRUE;
......@@ -121,7 +121,7 @@ u16 pdcp_get_next_tx_seq_number(pdcp_t* pdcp_entity)
return pdcp_seq_num;
}
BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity)
boolean_t pdcp_advance_rx_window(pdcp_t* pdcp_entity)
{
if (pdcp_is_seq_num_size_valid(pdcp_entity) == FALSE)
return FALSE;
......@@ -146,7 +146,7 @@ BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity)
* @return 1 if SN is okay, 0 otherwise
* XXX Reordering window should also be handled here
*/
BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity)
boolean_t pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity)
{
LOG_D(PDCP, "Incoming RX Seq # is %04d\n", seq_num);
......@@ -187,7 +187,7 @@ BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity)
}
}
BOOL pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity)
boolean_t pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity)
{
/*
* Incoming sequence number and PDCP entity were already
......
......@@ -43,17 +43,17 @@
* @param pdcp_entity The PDCP entity to be initialized
* @return none
*/
BOOL pdcp_init_seq_numbers(pdcp_t* pdcp_entity);
boolean_t pdcp_init_seq_numbers(pdcp_t* pdcp_entity);
/**
* Checks if incoming PDCP entitiy pointer and relevant sequence number size is valid
* @return TRUE (0x01) if it is valid, FALSE (0x00) otherwise
*/
BOOL pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity);
boolean_t pdcp_is_seq_num_size_valid(pdcp_t* pdcp_entity);
/**
* Check if SN number is in the range according to SN size
* @return TRUE if it is valid, FALSE otherwise
*/
BOOL pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size);
boolean_t pdcp_is_seq_num_valid(u16 seq_num, u8 seq_num_size);
/**
* Returns the maximum allowed sequence number value for given size of SN field
* @return Max sequence number value
......@@ -66,16 +66,16 @@ u16 pdcp_get_next_tx_seq_number(pdcp_t* pdcp_entity);
/**
* Advances the RX window state of given PDCP entity upon successfull receipt of a SDU
*/
BOOL pdcp_advance_rx_window(pdcp_t* pdcp_entity);
boolean_t pdcp_advance_rx_window(pdcp_t* pdcp_entity);
/**
* Checks if incoming PDU has a sequence number in accordance with the RX window
* @return TRUE if it is valid, FALSE otherwise
*/
BOOL pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity);
boolean_t pdcp_is_rx_seq_number_valid(u16 seq_num, pdcp_t* pdcp_entity);
/**
* Updates missing PDU bitmap with incoming sequence number
* @return TRUE if successful, FALSE otherwise
*/
BOOL pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity);
boolean_t pdcp_mark_current_pdu_as_received(u16 seq_num, pdcp_t* pdcp_entity);
#endif
......@@ -25,18 +25,18 @@
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
*******************************************************************************/
/*! \file pdcp_thread.c
* \brief
* \author F. Kaltenberger
* \date 2013
* \version 0.1
* \company Eurecom
* \email: florian.kaltenberger@eurecom.fr
* \note
* \warning
*/
* \brief
* \author F. Kaltenberger
* \date 2013
* \version 0.1
* \company Eurecom
* \email: florian.kaltenberger@eurecom.fr
* \note
* \warning
*/
#include <pthread.h>
//#include <inttypes.h>
......@@ -48,112 +48,108 @@
#define OPENAIR_THREAD_STACK_SIZE 8192
#define OPENAIR_THREAD_PRIORITY 255
extern int oai_exit;
extern int oai_exit;
extern char UE_flag;
pthread_t pdcp_thread;
pthread_attr_t pdcp_thread_attr;
pthread_t pdcp_thread;
pthread_attr_t pdcp_thread_attr;
pthread_mutex_t pdcp_mutex;
pthread_cond_t pdcp_cond;
int pdcp_instance_cnt;
pthread_cond_t pdcp_cond;
int pdcp_instance_cnt;
static void *pdcp_thread_main(void* param);
static void *pdcp_thread_main(void* param) {
//u8 eNB_flag = *((u8*)param);
u8 eNB_flag = !UE_flag;
LOG_I(PDCP,"This is pdcp_thread eNB_flag = %d\n",eNB_flag);
while (!oai_exit) {
if (pthread_mutex_lock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error locking mutex.\n");
}
else {
while (pdcp_instance_cnt < 0) {
pthread_cond_wait(&pdcp_cond,&pdcp_mutex);
}
if (pthread_mutex_unlock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error unlocking mutex.\n");
}
}
if (oai_exit) break;
if (eNB_flag) {
pdcp_run(PHY_vars_eNB_g[0]->frame, eNB_flag, PHY_vars_eNB_g[0]->Mod_id, 0);
LOG_D(PDCP,"Calling pdcp_run (eNB) for frame %d\n",PHY_vars_eNB_g[0]->frame);
}
else {
pdcp_run(PHY_vars_UE_g[0]->frame, eNB_flag, 0, PHY_vars_UE_g[0]->Mod_id);
LOG_D(PDCP,"Calling pdcp_run (UE) for frame %d\n",PHY_vars_UE_g[0]->frame);
}
if (pthread_mutex_lock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error locking mutex.\n");
}
else {
pdcp_instance_cnt--;
if (pthread_mutex_unlock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error unlocking mutex.\n");
}
}
if (pthread_mutex_lock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error locking mutex.\n");
}
else {
while (pdcp_instance_cnt < 0) {
pthread_cond_wait(&pdcp_cond,&pdcp_mutex);
}
if (pthread_mutex_unlock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error unlocking mutex.\n");
}
}
if (oai_exit) break;
if (eNB_flag) {
pdcp_run(PHY_vars_eNB_g[0]->frame, eNB_flag, PHY_vars_eNB_g[0]->Mod_id, 0);
LOG_D(PDCP,"Calling pdcp_run (eNB) for frame %d\n",PHY_vars_eNB_g[0]->frame);
}
else {
pdcp_run(PHY_vars_UE_g[0]->frame, eNB_flag, 0, PHY_vars_UE_g[0]->Mod_id);
LOG_D(PDCP,"Calling pdcp_run (UE) for frame %d\n",PHY_vars_UE_g[0]->frame);
}
if (pthread_mutex_lock(&pdcp_mutex) != 0) {
LOG_E(PDCP,"Error locking mutex.\n");
}
else {
pdcp_instance_cnt--;