X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=src%2F5gnrmac%2Fmac_mux.c;h=8659fa5dd8abb8880d4fb9cb88c901e360ef9807;hb=3ba126e9d0aff0ceca5012c27ffd4a3722fdbc4e;hp=8017f57553cce5af4b2d3432046bcbac36cc0c5b;hpb=2193e4cf01012809495be026097e8d7eacb9f0ac;p=o-du%2Fl2.git diff --git a/src/5gnrmac/mac_mux.c b/src/5gnrmac/mac_mux.c index 8017f5755..8659fa5dd 100644 --- a/src/5gnrmac/mac_mux.c +++ b/src/5gnrmac/mac_mux.c @@ -42,7 +42,7 @@ * @return void * * ****************************************************************/ -void packBytes(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos, uint32_t val, uint8_t valSize) +void packBytes(uint8_t *buf, uint16_t *bytePos, uint8_t *bitPos, uint32_t val, uint8_t valSize) { uint32_t temp; uint8_t bytePart1; @@ -97,9 +97,7 @@ void packBytes(uint8_t *buf, uint8_t *bytePos, uint8_t *bitPos, uint32_t val, ui void fillRarPdu(RarInfo *rarInfo) { uint8_t *rarPdu = rarInfo->rarPdu; - uint16_t totalBits = 0; - uint8_t numBytes = 0; - uint8_t bytePos= 0; + uint16_t bytePos= 0; uint8_t bitPos = 0; /* RAR subheader fields */ @@ -137,23 +135,10 @@ void fillRarPdu(RarInfo *rarInfo) timeAdv = rarInfo->ta; ulGrant = 0; /* this will be done when implementing msg3 */ tmpCrnti = rarInfo->tcrnti; - - /* Calulating total number of bytes in buffer */ - totalBits = EBitSize + TBitSize + rapidSize + RBitSize + timeAdvSize \ - + ulGrantSize + tmpCrntiSize; - - /* add padding size */ - totalBits += RBitSize*2 + paddingLcidSize + paddingSize; - - /* Calulating total number of bytes in buffer */ - numBytes = totalBits/8; - if(totalBits % 8) - numBytes += 1; - - rarInfo->rarPduLen = numBytes; + rarInfo->rarPduLen = RAR_PAYLOAD_SIZE; /* Initialize buffer */ - for(bytePos = 0; bytePos < numBytes; bytePos++) + for(bytePos = 0; bytePos < rarInfo->rarPduLen; bytePos++) rarPdu[bytePos] = 0; bytePos = 0; @@ -278,7 +263,7 @@ void fillMacCe(MacCeInfo *macCeInfo, uint8_t *msg3Pdu) void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *txPdu, uint16_t tbSize) { - uint8_t bytePos = 0; + uint16_t bytePos = 0; uint8_t bitPos = 7; uint8_t idx = 0; uint8_t macPdu[tbSize]; @@ -286,8 +271,8 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *txPdu, uint16_t /* subheader fields */ uint8_t RBit = 0; /* Reserved bit */ - uint8_t FBit; /* Format Indicator */ - uint8_t lcid; /* LCID */ + uint8_t FBit =0; /* Format Indicator */ + uint8_t lcid =0; /* LCID */ uint16_t lenField = 0; /* Length field */ /* subheader field size (in bits) */ @@ -315,7 +300,7 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *txPdu, uint16_t break; } default: - DU_LOG("\n MAC: Invalid LCID %d in mac pdu",lcid); + DU_LOG("\nERROR --> MAC: Invalid LCID %d in mac pdu",lcid); break; } } @@ -353,10 +338,9 @@ void macMuxPdu(MacDlData *dlData, MacCeInfo *macCeData, uint8_t *txPdu, uint16_t } default: - DU_LOG("\n MAC: Invalid LCID %d in mac pdu",lcid); + DU_LOG("\nERROR --> MAC: Invalid LCID %d in mac pdu",lcid); break; } - } if(bytePos < tbSize && (tbSize-bytePos >= 1)) {