Move functions for packing/unpacking UCI.indication
Reordered PDU pack/unpack function to follow PDU value order Changed nfapi_p7_allocate calls to calloc to avoid dependency from FAPI lib to nFAPI lib. Add unitary test for UCI.indication( test pack/unpack, free, copy and compare )
This commit is contained in:
committed by
Robert Schmidt
parent
3682164166
commit
3272225e1f
@@ -45,8 +45,6 @@ uint8_t pack_ue_release_request(void *msg, uint8_t **ppWritePackedMsg, uint8_t *
|
||||
|
||||
uint8_t pack_ue_release_response(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_srs_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
@@ -57,8 +55,6 @@ uint8_t pack_nr_ul_node_sync(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end
|
||||
|
||||
uint8_t pack_nr_timing_info(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config);
|
||||
|
||||
uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_nr_rach_indication_t *msg,
|
||||
|
||||
@@ -2639,230 +2639,6 @@ uint8_t pack_nr_rach_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *
|
||||
return 1;
|
||||
}
|
||||
|
||||
//UCI INDICATION
|
||||
|
||||
static uint8_t pack_nr_uci_pucch_0_1(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t* value = (nfapi_nr_uci_pucch_pdu_format_0_1_t*)tlv;
|
||||
|
||||
if (!push8(value->pduBitmap, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push32(value->handle, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rnti, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->pucch_format, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->ul_cqi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->timing_advance, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rssi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (value->pduBitmap & 0x01) { //SR
|
||||
if (!push8(value->sr.sr_indication, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->sr.sr_confidence_level, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 1) & 0x01)) { //HARQ
|
||||
if (!push8(value->harq.num_harq, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->harq.harq_confidence_level, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
for (int i = 0; i < value->harq.num_harq; i++)
|
||||
{
|
||||
if (!push8(value->harq.harq_list[i].harq_value, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_uci_pucch_2_3_4(void* tlv, uint8_t **ppWritePackedMsg, uint8_t *end) {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value = (nfapi_nr_uci_pucch_pdu_format_2_3_4_t*) tlv;
|
||||
|
||||
if (!push8(value->pduBitmap, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push32(value->handle, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rnti, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->pucch_format, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->ul_cqi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->timing_advance, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rssi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
if (value->pduBitmap & 0x01) { //SR
|
||||
if (!push16(value->sr.sr_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!pusharray8(value->sr.sr_payload,
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 1) & 0x01) { //HARQ
|
||||
if (!push8(value->harq.harq_crc, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->harq.harq_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!pusharray8(value->harq.harq_payload,
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 2) & 0x01) { //CSI-1
|
||||
if (!push8(value->csi_part1.csi_part1_crc, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->csi_part1.csi_part1_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!pusharray8(value->csi_part1.csi_part1_payload,
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 3) & 0x01) { //CSI-2
|
||||
if (!push8(value->csi_part2.csi_part2_crc, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->csi_part2.csi_part2_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!pusharray8(value->csi_part2.csi_part2_payload,
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_uci_pusch(void *tlv, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
nfapi_nr_uci_pusch_pdu_t *value = (nfapi_nr_uci_pusch_pdu_t *)tlv;
|
||||
|
||||
if (!push8(value->pduBitmap, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push32(value->handle, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rnti, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push8(value->ul_cqi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->timing_advance, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->rssi, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
// Bit 0 not used in PUSCH PDU
|
||||
if ((value->pduBitmap >> 1) & 0x01) { // HARQ
|
||||
if (!push8(value->harq.harq_crc, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->harq.harq_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
if (!pusharray8(value->harq.harq_payload,
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 2) & 0x01) { // CSI-1
|
||||
if (!push8(value->csi_part1.csi_part1_crc, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->csi_part1.csi_part1_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
if (!pusharray8(value->csi_part1.csi_part1_payload,
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 3) & 0x01) { // CSI-2
|
||||
if (!push8(value->csi_part2.csi_part2_crc, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->csi_part2.csi_part2_bit_len, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
if (!pusharray8(value->csi_part2.csi_part2_payload,
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
ppWritePackedMsg,
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t pack_nr_uci_indication_body(nfapi_nr_uci_t* value, uint8_t **ppWritePackedMsg, uint8_t *end)
|
||||
{
|
||||
if (!push16(value->pdu_type, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(value->pdu_size, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
switch (value->pdu_type) {
|
||||
case NFAPI_NR_UCI_PUSCH_PDU_TYPE:
|
||||
if(!pack_nr_uci_pusch(&value->pusch_pdu, ppWritePackedMsg, end)){
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE:
|
||||
if(!pack_nr_uci_pucch_0_1(&value->pucch_pdu_format_0_1, ppWritePackedMsg, end)){
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE:
|
||||
if(!pack_nr_uci_pucch_2_3_4(&value->pucch_pdu_format_2_3_4, ppWritePackedMsg, end)){
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t pack_nr_uci_indication(void *msg, uint8_t **ppWritePackedMsg, uint8_t *end, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t *)msg;
|
||||
|
||||
if (!push16(pNfapiMsg->sfn, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(pNfapiMsg->slot, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
if (!push16(pNfapiMsg->num_ucis, ppWritePackedMsg, end))
|
||||
return 0;
|
||||
|
||||
for (int i = 0; i < pNfapiMsg->num_ucis; i++) {
|
||||
if (!pack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppWritePackedMsg, end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Main pack function - public
|
||||
|
||||
int nfapi_nr_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t *config)
|
||||
@@ -4776,294 +4552,6 @@ uint8_t unpack_nr_rach_indication(uint8_t **ppReadPackedMsg,
|
||||
return 1;
|
||||
}
|
||||
|
||||
//NR UCI
|
||||
|
||||
static uint8_t unpack_nr_uci_pucch_0_1(nfapi_nr_uci_pucch_pdu_format_0_1_t *value,
|
||||
uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
if (!(pull8(ppReadPackedMsg, &value->pduBitmap, end) && pull32(ppReadPackedMsg, &value->handle, end)
|
||||
&& pull16(ppReadPackedMsg, &value->rnti, end) && pull8(ppReadPackedMsg, &value->pucch_format, end)
|
||||
&& pull8(ppReadPackedMsg, &value->ul_cqi, end) && pull16(ppReadPackedMsg, &value->timing_advance, end)
|
||||
&& pull16(ppReadPackedMsg, &value->rssi, end)))
|
||||
return 0;
|
||||
if (value->pduBitmap & 0x01) { // SR
|
||||
if (!(pull8(ppReadPackedMsg, &value->sr.sr_indication, end) && pull8(ppReadPackedMsg, &value->sr.sr_confidence_level, end)))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (((value->pduBitmap >> 1) & 0x01)) { // HARQ
|
||||
|
||||
if (!(pull8(ppReadPackedMsg, &value->harq.num_harq, end) && pull8(ppReadPackedMsg, &value->harq.harq_confidence_level, end)))
|
||||
return 0;
|
||||
if (value->harq.num_harq > 0) {
|
||||
for (int i = 0; i < value->harq.num_harq; i++) {
|
||||
if (!pull8(ppReadPackedMsg, &value->harq.harq_list[i].harq_value, end)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_uci_pucch_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t* value,
|
||||
uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config) {
|
||||
|
||||
if (!pull8(ppReadPackedMsg, &value->pduBitmap, end))
|
||||
return 0;
|
||||
if (!pull32(ppReadPackedMsg, &value->handle, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->rnti, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &value->pucch_format, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &value->ul_cqi, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->timing_advance, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->rssi, end))
|
||||
return 0;
|
||||
|
||||
if (value->pduBitmap & 0x01) { //SR
|
||||
if (!pull16(ppReadPackedMsg, &value->sr.sr_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->sr.sr_payload = nfapi_p7_allocate(sizeof(*value->sr.sr_payload) *
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->sr.sr_payload == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->sr.sr_payload\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!pullarray8(ppReadPackedMsg, value->sr.sr_payload,
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
(int)((value->sr.sr_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 1) & 0x01) { //HARQ
|
||||
if (!pull8(ppReadPackedMsg, &value->harq.harq_crc, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->harq.harq_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->harq.harq_payload = nfapi_p7_allocate(sizeof(*value->harq.harq_payload) *
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->harq.harq_payload == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->harq.harq_payload\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!pullarray8(ppReadPackedMsg, value->harq.harq_payload,
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 2) & 0x01) { //CSI-1
|
||||
if (!pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->csi_part1.csi_part1_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->csi_part1.csi_part1_payload = nfapi_p7_allocate(sizeof(*value->csi_part1.csi_part1_payload) *
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->csi_part1.csi_part1_payload == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->csi_part1.csi_part1_payload\n",
|
||||
__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!pullarray8(ppReadPackedMsg, value->csi_part1.csi_part1_payload,
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 3) & 0x01) { //CSI-2
|
||||
if (!pull8(ppReadPackedMsg, &value->csi_part2.csi_part2_crc, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->csi_part2.csi_part2_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->csi_part2.csi_part2_payload = nfapi_p7_allocate(sizeof(*value->csi_part2.csi_part2_payload) *
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->csi_part2.csi_part2_payload == NULL)
|
||||
{
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->csi_part2.csi_part2_payload\n",
|
||||
__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!pullarray8(ppReadPackedMsg, value->csi_part2.csi_part2_payload,
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_uci_pusch(nfapi_nr_uci_pusch_pdu_t *value,
|
||||
uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
if (!pull8(ppReadPackedMsg, &value->pduBitmap, end))
|
||||
return 0;
|
||||
if (!pull32(ppReadPackedMsg, &value->handle, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->rnti, end))
|
||||
return 0;
|
||||
if (!pull8(ppReadPackedMsg, &value->ul_cqi, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->timing_advance, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->rssi, end))
|
||||
return 0;
|
||||
|
||||
// Bit 0 not used in PUSCH PDU
|
||||
if ((value->pduBitmap >> 1) & 0x01) { // HARQ
|
||||
if (!pull8(ppReadPackedMsg, &value->harq.harq_crc, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->harq.harq_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->harq.harq_payload =
|
||||
nfapi_p7_allocate(sizeof(*value->harq.harq_payload) * (int)((value->harq.harq_bit_len / 8) + 1), config);
|
||||
if (value->harq.harq_payload == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->harq.harq_payload\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!pullarray8(ppReadPackedMsg,
|
||||
value->harq.harq_payload,
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
(int)((value->harq.harq_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 2) & 0x01) { // CSI-1
|
||||
if (!pull8(ppReadPackedMsg, &value->csi_part1.csi_part1_crc, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->csi_part1.csi_part1_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->csi_part1.csi_part1_payload =
|
||||
nfapi_p7_allocate(sizeof(*value->csi_part1.csi_part1_payload) * (int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->csi_part1.csi_part1_payload == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->csi_part1.csi_part1_payload\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!pullarray8(ppReadPackedMsg,
|
||||
value->csi_part1.csi_part1_payload,
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
(int)((value->csi_part1.csi_part1_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((value->pduBitmap >> 3) & 0x01) { // CSI-2
|
||||
if (!pull8(ppReadPackedMsg, &value->csi_part2.csi_part2_crc, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->csi_part2.csi_part2_bit_len, end))
|
||||
return 0;
|
||||
|
||||
value->csi_part2.csi_part2_payload =
|
||||
nfapi_p7_allocate(sizeof(*value->csi_part2.csi_part2_payload) * (int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
config);
|
||||
if (value->csi_part2.csi_part2_payload == NULL) {
|
||||
NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s failed to allocate value->csi_part2.csi_part2_payload\n", __FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!pullarray8(ppReadPackedMsg,
|
||||
value->csi_part2.csi_part2_payload,
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
(int)((value->csi_part2.csi_part2_bit_len / 8) + 1),
|
||||
end))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_nr_uci_indication_body(nfapi_nr_uci_t *value,
|
||||
uint8_t **ppReadPackedMsg,
|
||||
uint8_t *end,
|
||||
nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
if (!pull16(ppReadPackedMsg, &value->pdu_type, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &value->pdu_size, end))
|
||||
return 0;
|
||||
|
||||
switch (value->pdu_type) {
|
||||
case NFAPI_NR_UCI_PUSCH_PDU_TYPE: {
|
||||
nfapi_nr_uci_pusch_pdu_t *uci_pdu = &value->pusch_pdu;
|
||||
if (!unpack_nr_uci_pusch(uci_pdu, ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_0_1_t *uci_pdu = &value->pucch_pdu_format_0_1;
|
||||
if (!unpack_nr_uci_pucch_0_1(uci_pdu, ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: {
|
||||
nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu = &value->pucch_pdu_format_2_3_4;
|
||||
if (!unpack_nr_uci_pucch_2_3_4(uci_pdu, ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
NFAPI_TRACE(NFAPI_TRACE_WARN, "Unexpected pdu type %d\n", value->pdu_type);
|
||||
break;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
uint8_t unpack_nr_uci_indication(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config)
|
||||
{
|
||||
nfapi_nr_uci_indication_t *pNfapiMsg = (nfapi_nr_uci_indication_t *)msg;
|
||||
|
||||
if (!pull16(ppReadPackedMsg, &pNfapiMsg->sfn, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &pNfapiMsg->slot, end))
|
||||
return 0;
|
||||
if (!pull16(ppReadPackedMsg, &pNfapiMsg->num_ucis, end))
|
||||
return 0;
|
||||
|
||||
pNfapiMsg->uci_list = nfapi_p7_allocate(sizeof(*pNfapiMsg->uci_list) * pNfapiMsg->num_ucis, config);
|
||||
for (int i = 0; i < pNfapiMsg->num_ucis; i++) {
|
||||
if (!unpack_nr_uci_indication_body(&pNfapiMsg->uci_list[i], ppReadPackedMsg, end, config))
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static uint8_t unpack_ue_release_request(uint8_t **ppReadPackedMsg, uint8_t *end, void *msg, nfapi_p7_codec_config_t *config) {
|
||||
uint8_t proceed = 1;
|
||||
nfapi_ue_release_request_t *pNfapiMsg = (nfapi_ue_release_request_t *)msg;
|
||||
|
||||
Reference in New Issue
Block a user