// variable-size MAC CE(known by LCID), padding, MSG3, MAC SDU
uint16_tmac_ce_len;
uint16_tmac_subheader_len;
uint16_tmac_sdu_len;
// For both DL/UL-SCH
// Except:
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
// - UL/DL-SCH: padding
// - UL-SCH: MSG3 48-bits
// |0|1|2|3|4|5|6|7| bit-wise
// |0|1|2|3|4|5|6|7| bit-wise
// |R|F| LCID |
// |R|F| LCID |
// | L |
// | L |
// variable-size MAC CE(known by LCID), padding, MSG3, MAC SDU
// |0|1|2|3|4|5|6|7| bit-wise
// |0|1|2|3|4|5|6|7| bit-wise
// |R|F| LCID |
// |R|F| LCID |
// | L |
// | L |
// | L |
// | L |
// fixed-size MAC CE(known by LCID), padding, MSG3
// For both DL/UL-SCH
// For:
// - UL/DL-SCH: fixed-size MAC CE(known by LCID)
// - UL/DL-SCH: padding, for single/multiple 1-oct padding CE(s)
// - UL-SCH: MSG3 48-bits
// |0|1|2|3|4|5|6|7| bit-wise
// |0|1|2|3|4|5|6|7| bit-wise
// |R|R| LCID |
// |R|R| LCID |
// LCID: The Logical Channel ID field identifies the logical channel instance of the corresponding MAC SDU or the type of the corresponding MAC CE or padding as described in Tables 6.2.1-1 and 6.2.1-2 for the DL-SCH and UL-SCH respectively. There is one LCID field per MAC subheader. The LCID field size is 6 bits;
// LCID: The Logical Channel ID field identifies the logical channel instance of the corresponding MAC SDU or the type of the corresponding MAC CE or padding as described in Tables 6.2.1-1 and 6.2.1-2 for the DL-SCH and UL-SCH respectively. There is one LCID field per MAC subheader. The LCID field size is 6 bits;
// L: The Length field indicates the length of the corresponding MAC SDU or variable-sized MAC CE in bytes. There is one L field per MAC subheader except for subheaders corresponding to fixed-sized MAC CEs and padding. The size of the L field is indicated by the F field;
// L: The Length field indicates the length of the corresponding MAC SDU or variable-sized MAC CE in bytes. There is one L field per MAC subheader except for subheaders corresponding to fixed-sized MAC CEs and padding. The size of the L field is indicated by the F field;
// F: lenght of L is 8 or 16 bits wide
// F: lenght of L is 0:8 or 1:16 bits wide
// R: Reserved bit, set to zero.
// R: Reserved bit, set to zero.
uint8_tdone=0;
while(!done){
uint8_tdone=0;
while(!done||pdu_len<=0){
mac_ce_len=0x0000;
mac_subheader_len=0x0001;// default to fixed-length subheader = 1-oct