Skip to content
Snippets Groups Projects
Commit 86a308bb authored by knopp's avatar knopp
Browse files

added MAC header handling for TX

parent 5b59872d
No related branches found
No related tags found
No related merge requests found
...@@ -237,31 +237,73 @@ typedef struct { ...@@ -237,31 +237,73 @@ typedef struct {
} __attribute__((__packed__))SCH_SUBHEADER_FIXED; } __attribute__((__packed__))SCH_SUBHEADER_FIXED;
// Panos:
/*!\brief MAC subheader long with 24bit DST field */ /*!\brief MAC subheader long with 24bit DST field */
typedef struct { typedef struct {
uint8_t V:4; //Version number: Possible values "0001", "0010", "0011" based on TS36.321 section 6.2.3. uint8_t R0:4;
uint32_t SRC:24; //Prose UE source ID. Size 24 bits. uint8_t V:4;//Version number: Possible values "0001", "0010", "0011" based on TS36.321 section 6.2.3.
uint32_t DST:24; //Prose UE destination ID. Size 16 or 24 bits. uint8_t SRC07; //Prose UE source ID. Size 24 bits.
uint8_t LCID:5; uint8_t SRC815; //Prose UE source ID. Size 24 bits.
uint8_t L:7; // Length field indicating the size of the corresponding SDU in byes. Not sure about the size of this field (7). uint8_t SRC1623; //Prose UE source ID. Size 24 bits.
uint8_t F:1; uint8_t DST07; //Prose UE destination ID. Size 24 bits.
uint8_t E:1; uint8_t DST815; //Prose UE destination ID. Size 24 bits.
uint8_t R:1; uint8_t DST1623; //Prose UE destination ID. Size 24 bits.
}__attribute__((__packed__))SLSCH_SUBHEADER_24_Bit_DST; uint8_t LCID:5;
uint8_t E:1;
/*!\brief MAC subheader long with 16bit DST field */ uint8_t R1:2;
uint8_t L:7; // Length field indicating the size of the corresponding SDU in bytes.
uint8_t F:1;
}__attribute__((__packed__))SLSCH_SUBHEADER_24_Bit_DST_SHORT;
/*!\brief MAC subheader long with 24bit DST field */
typedef struct { typedef struct {
uint8_t V:4; //Version number: Possible values "0001", "0010", "0011" based on TS36.321 section 6.2.3. uint8_t R0:4;
uint32_t SRC:24; //Prose UE source ID. Size 24 bits. uint8_t V:4;//Version number: Possible values "0001", "0010", "0011" based on TS36.321 section 6.2.3.
uint32_t DST:16; //Prose UE destination ID. Size 16 or 24 bits. uint8_t SRC07; //Prose UE source ID. Size 24 bits.
uint8_t LCID:5; uint8_t SRC815; //Prose UE source ID. Size 24 bits.
uint8_t L:7; // Length field indicating the size of the corresponding SDU in byes. Not sure about the size of this field (7). uint8_t SRC1623; //Prose UE source ID. Size 24 bits.
uint8_t F:1; uint8_t DST07; //Prose UE destination ID. Size 24 bits.
uint8_t E:1; uint8_t DST815; //Prose UE destination ID. Size 24 bits.
uint8_t R:1; uint8_t DST1623; //Prose UE destination ID. Size 24 bits.
}__attribute__((__packed__))SLSCH_SUBHEADER_16_Bit_DST; uint8_t LCID:5;
uint8_t E:1;
uint8_t R1:2;
uint8_t L_MSB:7; // Length field indicating the size of the corresponding SDU in bytes.
uint8_t F:1;
uint8_t L_LSB:8;
}__attribute__((__packed__))SLSCH_SUBHEADER_24_Bit_DST_LONG;
/*!\brief MAC subheader long with 24bit DST field */
typedef struct {
uint8_t R0:4;
uint8_t V:4;//Version number: Possible values "0001", "0010", "0011" based on TS36.321 section 6.2.3.
uint8_t SRC07; //Prose UE source ID. Size 24 bits.
uint8_t SRC815; //Prose UE source ID. Size 24 bits.
uint8_t DST07; //Prose UE destination ID. Size 16 bits.
uint8_t DST815; //Prose UE destination ID. Size 16 bits.
uint8_t LCID:5;
uint8_t E:1;
uint8_t R1:2;
uint8_t L:7; // Length field indicating the size of the corresponding SDU in bytes.
uint8_t F:1;
}__attribute__((__packed__))SLSCH_SUBHEADER_16_Bit_DST_SHORT;
/*!\brief MAC subheader long with 24bit DST field */
typedef struct {
uint8_t R0:4;
uint8_t V:4;//Version number: Possible values "0001", "0010", "0011" based on TS36.321 section 6.2.3.
uint8_t SRC07; //Prose UE source ID. Size 24 bits.
uint8_t SRC815; //Prose UE source ID. Size 24 bits.
uint8_t SRC1623; //Prose UE source ID. Size 24 bits.
uint8_t DST07; //Prose UE destination ID. Size 16 bits.
uint8_t DST815; //Prose UE destination ID. Size 16 bits.
uint8_t LCID:5;
uint8_t E:1;
uint8_t R1:2;
uint8_t L_MSB:7; // Length field indicating the size of the corresponding SDU in bytes.
uint8_t F:1;
uint8_t L_LSB:8;
}__attribute__((__packed__))SLSCH_SUBHEADER_16_Bit_DST_LONG;
/*!\brief mac control element: short buffer status report for a specific logical channel group ID*/ /*!\brief mac control element: short buffer status report for a specific logical channel group ID*/
typedef struct { typedef struct {
......
...@@ -2724,11 +2724,44 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_ ...@@ -2724,11 +2724,44 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
MBMS_FLAG_NO, MBMS_FLAG_NO,
3, 3,
req, req,
(char*)ue->slsch_pdu.payload); (char*)(ue->slsch_pdu.payload + sizeof(SLSCH_SUBHEADER_24_Bit_DST_LONG)));
// Notes: 1. hard-coded to 24-bit destination format for now
// 2. LCID hard-coded to 3
// 3. SRC/DST IDs with debug values
if (sdu_length > 0) { if (sdu_length > 0) {
LOG_I(MAC,"SFN.SF %d.%d : got %d bytes from Sidelink buffer (%d requested)\n",frameP,subframeP,sdu_length,req); LOG_I(MAC,"SFN.SF %d.%d : got %d bytes from Sidelink buffer (%d requested)\n",frameP,subframeP,sdu_length,req);
slsch->payload = (unsigned char*)ue->slsch_pdu.payload; slsch->payload = (unsigned char*)ue->slsch_pdu.payload;
if (sdu_length < 128) {
slsch->payload++;
SLSCH_SUBHEADER_24_Bit_DST_SHORT *shorth= (SLSCH_SUBHEADER_24_Bit_DST_SHORT *)slsch->payload;
shorth->F=0;
shorth->L=sdu_length;
shorth->E=1;
shorth->LCID=3;
shorth->SRC07=0x12;
shorth->SRC815=0x34;
shorth->SRC1623=0x56;
shorth->DST07=0x78;
shorth->DST815=0x9A;
shorth->DST1623=0xBC;
shorth->V=0x1;
}
else {
SLSCH_SUBHEADER_24_Bit_DST_LONG *longh= (SLSCH_SUBHEADER_24_Bit_DST_LONG *)slsch->payload;
longh->F=1;
longh->L_LSB=sdu_length&0xff;
longh->L_MSB=(sdu_length>>8)&0x7f;
longh->E=1;
longh->LCID=3;
longh->SRC07=0x12;
longh->SRC815=0x34;
longh->SRC1623=0x56;
longh->DST07=0x78;
longh->DST815=0x9A;
longh->DST1623=0xBC;
longh->V=0x1;
}
slsch->rvidx = 0; slsch->rvidx = 0;
slsch->payload_length = TBS; slsch->payload_length = TBS;
// fill in SLSCH configuration // fill in SLSCH configuration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment