void fillMsg4DlData(MacDlData *dlData)
{
uint8_t idx = 0;
+ uint16_t idx2;
dlData->numPdu = 1;
dlData->pduInfo[idx].lcId = MAC_LCID_CCCH;
- dlData->pduInfo[idx].pduLen = macCb.macCell->macRaCb[0].msg4PduLen;
- memcpy(dlData->pduInfo[idx].dlPdu, macCb.macCell->macRaCb[0].msg4Pdu,\
- macCb.macCell->macRaCb[0].msg4PduLen);
+ dlData->pduInfo[idx].pduLen = macCb.macCell->macRaCb[idx].msg4PduLen;
+ for(idx2 = 0; idx2 < dlData->pduInfo[idx].pduLen; idx2++)
+ {
+ dlData->pduInfo[idx].dlPdu[idx2] = \
+ macCb.macCell->macRaCb[idx].msg4Pdu[idx2];
+ }
}
/*************************************************
for(idx = 0; idx < macCeInfo->numCes; idx++)
{
macCeInfo->macCe[idx].macCeLcid = MAC_LCID_CRI;
- memcpy(&macCeInfo->macCe[idx].macCeValue, \
- &macCb.macCell->macRaCb[idx].msg3Pdu, MAX_CRI_SIZE);
+ memcpy(macCeInfo->macCe[idx].macCeValue, \
+ macCb.macCell->macRaCb[idx].msg3Pdu, MAX_CRI_SIZE);
}
}
*
* @details
*
- * Function : buildMacPdu
+ * Function : macMuxPdu
*
* Functionality:
* The MAC PDU will be MUXed and formed
uint8_t RBit = 0; /* Reserved bit */
uint8_t FBit; /* Format Indicator */
uint8_t lcid; /* LCID */
- uint8_t lenField = 0; /* Length field */
+ uint16_t lenField = 0; /* Length field */
/* subheader field size (in bits) */
uint8_t RBitSize = 1;
uint8_t FBitSize = 1;
uint8_t lcidSize = 6;
- uint8_t lenFieldSize = 0; /* 8-bit or 16-bit L field */
+ uint8_t lenFieldSize = 0; /* 8-bit or 16-bit L field */
/* PACK ALL MAC CE */
for(idx = 0; idx < macCeData->numCes; idx++)
case MAC_LCID_CRI:
{
/* Packing fields into MAC PDU R/R/LCID */
- packBytes(macPdu, &bytePos, &bitPos, RBit, RBitSize);
- packBytes(macPdu, &bytePos, &bitPos, RBit, RBitSize);
+ packBytes(macPdu, &bytePos, &bitPos, RBit, (RBitSize * 2));
packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
memcpy(&macPdu[bytePos], macCeData->macCe[idx].macCeValue,\
MAX_CRI_SIZE);
+ bytePos += MAX_CRI_SIZE;
break;
}
default:
for(idx = 0; idx < dlData->numPdu; idx++)
{
lcid = dlData->pduInfo[idx].lcId;
- lenField = dlData->pduInfo[idx].pduLen;
switch(lcid)
{
case MAC_LCID_CCCH:
{
+ lenField = dlData->pduInfo[idx].pduLen;
if(dlData->pduInfo[idx].pduLen > 255)
{
FBit = 1;
packBytes(macPdu, &bytePos, &bitPos, FBit, FBitSize);
packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
packBytes(macPdu, &bytePos, &bitPos, lenField, lenFieldSize);
- memcpy(&macPdu[bytePos], dlData->pduInfo[idx].dlPdu, lenField);
+ memcpy(&macPdu[bytePos], dlData->pduInfo[idx].dlPdu, lenField);
+ bytePos += lenField;
break;
}
packBytes(macPdu, &bytePos, &bitPos, lcid, lcidSize);
}
+ /*Storing the muxed pdu in macRaCb */
+ macCb.macCell->macRaCb[0].msg4TxPdu = NULLP;
MAC_ALLOC(macCb.macCell->macRaCb[0].msg4TxPdu, macCb.macCell->macRaCb[0].msg4TbSize);
if(macCb.macCell->macRaCb[0].msg4TxPdu != NULLP)
{
- memcpy(macCb.macCell->macRaCb[0].msg4TxPdu, macPdu,\
- macCb.macCell->macRaCb[0].msg4TbSize);
+ memcpy(macCb.macCell->macRaCb[0].msg4TxPdu, macPdu,\
+ macCb.macCell->macRaCb[0].msg4TbSize);
}
}