Files
openairinterface5g/nfapi/tests/p7/nr_fapi_dci_inversion_test.c
Robert Schmidt 8107939f08 Change OAI license to CSSL v1.0 (and others)
- all RAN code, CI code, configuration files, dockerfiles, in CSSL v1.0
- all deployment code (openshift, charts, ancillary files like shell
  scripts), in MIT
- documentation in CC-BY-4.0
- exceptions might apply and are listed in NOTICE
- there is a new LICENSES folder with all licenses
- CONTRIBUTIONS.md has been updated accordingly

For automated changes based on OAI PL v1.1:

    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.{c,h,cpp}
    perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.ts
    perl -i~ -0pe 's/<!--.*Licensed to the OpenAirInterface.*openairinterface.org\n.*-->/<!-- SPDX-License-Identifier: LicenseRef-CSSL-1.0 -->/s' **/*.xml

The rest (cmake, files with missing license, cmake) manually.
2026-03-27 16:36:37 +01:00

51 lines
1.4 KiB
C

/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#include "dci_payload_utils.h"
#include "nr_fapi.h"
void test_pack_payload(uint8_t payloadSizeBits, uint8_t payload[])
{
uint8_t msg_buf[8192] = {0};
uint8_t payloadSizeBytes = (payloadSizeBits + 7) / 8;
uint8_t *pWritePackedMessage = msg_buf;
uint8_t *pPackMessageEnd = msg_buf + sizeof(msg_buf);
pack_dci_payload(payload, payloadSizeBits, &pWritePackedMessage, pPackMessageEnd);
uint8_t unpack_buf[payloadSizeBytes];
pWritePackedMessage = msg_buf;
unpack_dci_payload(unpack_buf, payloadSizeBits, &pWritePackedMessage, pPackMessageEnd);
printf("\nOriginal:\t");
for (int j = payloadSizeBytes - 1; j >= 0; j--) {
printbits(payload[j], 1);
printf(" ");
}
printf("\n");
printf("Unpacked:\t");
for (int j = payloadSizeBytes - 1; j >= 0; j--) {
printbits(unpack_buf[j], 1);
printf(" ");
}
printf("\n");
DevAssert(memcmp(payload, unpack_buf, payloadSizeBytes) == 0);
// All tests successful!
}
int main(int n, char *v[])
{
fapi_test_init();
uint8_t upper = 8 * DCI_PAYLOAD_BYTE_LEN;
uint8_t lower = 1;
uint8_t payloadSizeBits = (rand() % (upper - lower + 1)) + lower; // from 1 bit to DCI_PAYLOAD_BYTE_LEN, in bits
printf("payloadSizeBits:%d\n", payloadSizeBits);
uint8_t payload[(payloadSizeBits + 7) / 8];
generate_payload(payloadSizeBits, payload);
test_pack_payload(payloadSizeBits, payload);
return 0;
}