1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
19 /* header include files -- defines (.h) */
21 #ifndef __LWR_MAC_UPR_INF_H__
22 #define __LWR_MAC_UPR_INF_H__
24 #define MAX_PREAMBLE_PER_SLOT 1 /* Max number of preamble per slot */
25 #define MAX_RACH_PDU_PER_SLOT 1 /* Max number of rach pdu per slot */
26 #define MAX_CRCS_PER_SLOT 1
27 #define MAX_CB_PER_TTI_IN_BYTES 1
28 #define MAX_ULSCH_PDUS_PER_TTI 1
29 #define MAX_ULCCH_PDUS_PER_TTI 1
30 #define MAX_NUM_HARQS_PER_TTI 1
31 #define MAX_HARQ_INFO_IN_BYTES 1
32 #define MAX_CSI_PART1_DATA_IN_BYTES 1
33 #define MAX_CSI_PART2_DATA_IN_BYTES 1
34 #define MAX_UCI_PDUS_PER_TTI 1
35 #define MAX_UCI_BIT_PER_TTI_IN_BYTES 2
36 #define UCI_IND_PUSCH 0 /* UCI Indication carried on PUSCH */
37 #define UCI_IND_PUCCH_F0F1 1 /* UCI Indication carried on PUCCH Format 0, 1 */
38 #define UCI_IND_PUCCH_F2F3F4 2 /* UCI Indication carried on PUCCH Format 2, 3, 4 */
39 #define SR_PDU_BITMASK 1 /* Bit Mask for SR_PDU */
40 #define HARQ_PDU_BITMASK 2 /* Bit Mask for HARQ PDU */
41 #define SR_NOT_DETECTED 0 /* SR not detected */
42 #define SR_DETECTED 1 /* SR detected */
43 #define CONFDC_LEVEL_GOOD 0 /* Confidence Level HARQ/SR */
44 #define CONFDC_LEVEL_BAD 1
47 #define HARQ_NOT_PRESENT 3
50 #define EVENT_RACH_IND_TO_MAC 1
51 #define EVENT_CRC_IND_TO_MAC 2
52 #define EVENT_RX_DATA_IND_TO_MAC 3
53 #define EVENT_STOP_IND_TO_MAC 4
54 #define EVENT_SLOT_IND_TO_MAC 5
55 #define EVENT_UCI_IND_TO_MAC 6
57 typedef struct rachPreamInfo
63 typedef struct rachPduInfo
70 RachPreamInfo preamInfo[MAX_PREAMBLE_PER_SLOT];
73 typedef struct rachInd
76 SlotIndInfo timingInfo;
78 RachPduInfo rachPdu[MAX_RACH_PDU_PER_SLOT];
81 typedef struct crcInfo
88 uint8_t cbCrcStatus[MAX_CB_PER_TTI_IN_BYTES];
90 uint16_t timingAdvance;
97 SlotIndInfo timingInfo;
99 CrcInfo crcInfo[MAX_CRCS_PER_SLOT];
109 uint16_t timingAdvance;
117 SlotIndInfo timingInfo;
119 RxDataIndPdu pdus[MAX_ULSCH_PDUS_PER_TTI];
122 /* UCI Indication Structure */
127 uint8_t harqPayload[MAX_HARQ_INFO_IN_BYTES];
133 uint16_t csiPart1BitLen;
134 uint8_t csiPart1Payload[MAX_CSI_PART1_DATA_IN_BYTES];
140 uint16_t csiPart2BitLen;
141 uint8_t csiPart2Payload[MAX_CSI_PART2_DATA_IN_BYTES];
150 uint16_t timingAdvance;
152 PuschHarqInfo harqInfo;
153 PuschCsiPart1Info csiPart1Info;
154 PuschCsiPart2Info csiPart2Info;
160 uint8_t srConfdcLevel;
166 uint8_t harqConfdcLevel;
167 uint8_t harqValue[MAX_NUM_HARQS_PER_TTI];
177 uint16_t timingAdvance;
180 HarqInfoF0F1 harqInfo;
190 uint16_t timingAdvance;
192 uint16_t num_uci_bits;
193 uint8_t uciBits[MAX_UCI_BIT_PER_TTI_IN_BYTES];
202 UciPusch uciPusch; /*TODO: UCI Ind for PUSCH to be handled separately */
203 UciPucchF0F1 uciPucchF0F1;
204 UciPucchF2F3F4 uciPucchF2F3F4;
213 UciIndPduInfo pdus[MAX_UCI_PDUS_PER_TTI];
216 typedef uint8_t (*SlotIndFunc)(Pst *pst, SlotIndInfo *slotInd);
217 typedef uint8_t (*RachIndFunc)(Pst *pst, RachInd *rachInd);
218 typedef uint8_t (*CrcIndFunc)(Pst *pst, CrcInd *crcInd);
219 typedef uint8_t (*RxDataIndFunc)(Pst *pst, RxDataInd *rxDataInd);
220 typedef uint8_t (*StopIndFunc)(Pst *pst, uint16_t *cellId);
221 typedef uint8_t (*UciIndFunc)(Pst *pst, UciInd *uciInd);
223 uint8_t packSlotInd (Pst *pst, SlotIndInfo *slotInd);
224 uint8_t unpackSlotInd(SlotIndFunc func, Pst *pst, Buffer *mBuf);
225 uint8_t fapiMacSlotInd(Pst *pst, SlotIndInfo *slotInd);
226 uint8_t packRachInd(Pst *pst, RachInd *rachInd);
227 uint8_t unpackRachInd(RachIndFunc func, Pst *pst, Buffer *mBuf);
228 uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd);
229 uint8_t packCrcInd(Pst *pst, CrcInd *crcInd);
230 uint8_t unpackCrcInd(CrcIndFunc func, Pst *pst, Buffer *mBuf);
231 uint8_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd);
232 uint8_t packRxDataInd(Pst *pst, RxDataInd *rxDataInd);
233 uint8_t unpackRxDataInd(RxDataIndFunc func, Pst *pst, Buffer *mBuf);
234 uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd);
235 uint8_t packStopInd(Pst *pst, uint16_t *cellId);
236 uint8_t unpackStopInd(StopIndFunc func, Pst *pst, Buffer *mBuf);
237 uint8_t fapiMacStopInd(Pst *pst, uint16_t *cellId);
238 uint8_t packUciInd(Pst *pst, UciInd *uciInd);
239 uint8_t unpackUciInd(UciIndFunc func, Pst *pst, Buffer *mBuf);
240 uint8_t FapiMacUciInd(Pst *pst, UciInd *uciInd);
243 /**********************************************************************
245 **********************************************************************/