MAC Clean-up [Issue-ID: ODUHIGH-212]
[o-du/l2.git] / src / 5gnrmac / lwr_mac_upr_inf.h
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
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                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
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 *******************************************************************************/
18
19 /* header include files -- defines (.h)  */
20
21 #ifndef __LWR_MAC_UPR_INF_H__
22 #define __LWR_MAC_UPR_INF_H__
23
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
30 /* events */
31 #define EVENT_RACH_IND_TO_MAC    0
32 #define EVENT_CRC_IND_TO_MAC     1
33 #define EVENT_RX_DATA_IND_TO_MAC 2
34 #define EVENT_STOP_IND_TO_MAC    3
35 #define EVENT_SLOT_IND_TO_MAC    4
36
37 typedef struct rachPreamInfo
38 {
39    uint8_t   preamIdx;
40    uint16_t  timingAdv;
41 }RachPreamInfo;
42
43 typedef struct rachPduInfo
44 {
45    uint16_t   pci;
46    uint8_t    symbolIdx;
47    uint8_t    slotIdx;
48    uint8_t    freqIdx;
49    uint8_t    numPream;
50    RachPreamInfo   preamInfo[MAX_PREAMBLE_PER_SLOT];
51 }RachPduInfo;
52
53 typedef struct rachInd
54 {
55    uint16_t      cellId;
56    SlotIndInfo   timingInfo;
57    uint8_t       numPdu;
58    RachPduInfo   rachPdu[MAX_RACH_PDU_PER_SLOT];
59 }RachInd;
60
61 typedef struct crcInfo
62 {
63    uint32_t   handle;
64    uint16_t   rnti;
65    uint8_t    harqId;
66    uint8_t    tbCrcStatus;
67    uint16_t   numCb;
68    uint8_t    cbCrcStatus[MAX_CB_PER_TTI_IN_BYTES];
69    uint8_t    ul_cqi;
70    uint16_t   timingAdvance;
71    uint16_t   rssi;
72 }CrcInfo;
73
74 typedef struct crcInd
75 {
76    uint16_t      cellId;
77    SlotIndInfo   timingInfo;
78    uint16_t      numCrc;
79    CrcInfo       crcInfo[MAX_CRCS_PER_SLOT];
80 }CrcInd;
81
82 typedef struct
83 {
84    uint32_t      handle;
85    uint16_t      rnti;
86    uint8_t       harqId;
87    uint16_t      pduLength;
88    uint8_t       ul_cqi;
89    uint16_t      timingAdvance;
90    uint16_t      rssi;
91    uint8_t       *pduData;
92 }RxDataIndPdu;
93
94 typedef struct
95 {
96    uint16_t      cellId;
97    SlotIndInfo   timingInfo;
98    uint16_t      numPdus;
99    RxDataIndPdu  pdus[MAX_ULSCH_PDUS_PER_TTI];
100 }RxDataInd;
101
102 typedef uint8_t (*packSlotIndMsg)(Pst *pst, SlotIndInfo *slotInd);
103 uint8_t packLcSlotInd (Pst *pst, SlotIndInfo *slotInd);
104 uint8_t packLwlcSlotInd (Pst *pst, SlotIndInfo *slotInd);
105
106 uint8_t fapiMacSlotInd(Pst  *pst, SlotIndInfo  *slotInd);
107
108 typedef uint8_t (*packRachIndMsg)(Pst *pst, RachInd *rachInd);
109 uint8_t packRachInd(Pst *pst, RachInd *rachInd);
110 uint8_t fapiMacRachInd(Pst *pst, RachInd *rachInd);
111
112 typedef uint8_t (*packCrcIndMsg)(Pst *pst, CrcInd *crcInd);
113 uint8_t packCrcInd(Pst *pst, CrcInd *crcInd);
114 uint8_t fapiMacCrcInd(Pst *pst, CrcInd *crcInd);
115
116
117 typedef uint8_t (*packRxDataIndMsg)(Pst *pst, RxDataInd *rxDataInd);
118 uint8_t packRxDataInd(Pst *pst, RxDataInd *rxDataInd);
119 uint8_t fapiMacRxDataInd(Pst *pst, RxDataInd *rxDataInd);
120
121 typedef uint8_t (*packStopIndMsg)(Pst *pst, uint16_t cellId);
122 uint8_t packStopInd(Pst *pst, uint16_t cellId);
123 uint8_t fapiMacStopInd(Pst *pst, uint16_t cellId);
124 #endif
125 /**********************************************************************
126   End of file
127  **********************************************************************/