89748d9e6e4ee16a6c285de03cf8833d2929439e
[o-du/l2.git] / src / cm / rlc_mac_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 /* This file containes define for RLC-MAC interface */
19
20 /* RLC instances */
21 #define RLC_UL_INST  0
22 #define RLC_DL_INST  1
23
24 /* Event */
25 #define EVENT_BO_STATUS_TO_MAC   15
26 #define EVENT_SCHED_RESULT_TO_RLC  16 
27 #define EVENT_DL_DATA_TO_MAC     17
28 #define EVENT_UL_DATA_TO_RLC     18
29
30 /* MACRO defines */
31 #define MAX_NUM_PDU     16
32
33 /* Buffer occupancy status information */
34 typedef struct rlcBoStatus
35 {
36    uint16_t   cellId;     /*!< CELL ID */
37    uint16_t   ueIdx;      /*!< UE ID */
38    bool       commCh;     /*!< Common or Dedicated Channel */
39    uint8_t    lcId;       /*!< Logical channel ID */
40    uint32_t   bo;         /*!< Buffer occupancy reported by RLC */
41 }RlcBoStatus;
42
43 /* Scheduled logical channel info */
44 typedef struct rlcLcSchInfo
45 {
46    bool      commCh;      /* Common or dedicated channel */
47    uint8_t   lcId;        /*!< Logical channel ID */
48    uint32_t  bufSize;  /*!< Total buffer size in bytes scheduled by MAC */
49 }RlcLcSchInfo;
50
51 /* Schedule result report */
52 typedef struct rlcSchedResultRpt
53 {
54    //Slot info
55    uint16_t       cellId;       /*!< CELL ID */
56    uint16_t       rnti;         /*!< Temporary CRNTI */
57    uint8_t        numLc;        /*!< Number of logical channels scheduled */
58    SlotTimingInfo    slotInfo;     /*!< Timing info */
59    RlcLcSchInfo   lcSch[MAX_NUM_LC];  /*!< Scheduled info of logical channels */
60 }RlcSchedResultRpt;
61
62 /* DL/UL data transfer */
63 typedef struct rlcPduInfo
64 {
65    bool       commCh;   /*!<Common or Dedicated Channel */
66    uint8_t    lcId;     /*!< Logical channel ID */
67    uint16_t   pduLen;   /*!< PDU Length */
68    uint8_t    *pduBuf;  /*!< RLC PDU buffer */
69 }RlcPduInfo;
70  
71 typedef struct rlcData
72 {
73    uint16_t      cellId;       /*!< CELL ID */
74    uint16_t      rnti;         /*!< Temporary CRNTI */
75    SlotTimingInfo   slotInfo;     /*!< Timing info */
76    uint8_t       numPdu;       /*!< Number of RLC PDUs */
77    RlcPduInfo    pduInfo[MAX_NUM_PDU];
78    uint8_t       numLc;
79    RlcBoStatus   boStatus[MAX_NUM_LC];     /*!< Buffer occupancy */
80 }RlcData;
81
82 /* Function pointers */
83 typedef uint8_t (*RlcMacBoStatusFunc)(Pst* pst, RlcBoStatus  *boStatus);
84 typedef uint8_t (*RlcMacSchedResultRptFunc)(Pst *pst, RlcSchedResultRpt *schRpt);
85 typedef uint8_t (*RlcMacDlDataFunc)(Pst* pst, RlcData *dlData);
86 typedef uint8_t (*RlcMacUlDataFunc)(Pst* pst, RlcData *ulData);
87
88 /* Function declarations */
89 uint8_t packRlcBoStatus(Pst* pst, RlcBoStatus*  boStatus);
90 uint8_t unpackRlcBoStatus(RlcMacBoStatusFunc func, Pst* pst, Buffer *mBuf);
91 uint8_t MacProcRlcBoStatus(Pst* pst, RlcBoStatus* boStatus);
92 uint8_t packRlcSchedResultRpt(Pst* pst, RlcSchedResultRpt *schRpt);
93 uint8_t unpackSchedResultRpt(RlcMacSchedResultRptFunc func, Pst *pst, Buffer *mBuf);
94 uint8_t RlcProcSchedResultRpt(Pst *pst, RlcSchedResultRpt *schRpt);
95 uint8_t packRlcDlData(Pst* pst, RlcData *datReq);
96 uint8_t unpackRlcDlData(RlcMacDlDataFunc func, Pst *pst, Buffer *mBuf);
97 uint8_t MacProcRlcDlData(Pst* pst, RlcData *dlData);
98 uint8_t packRlcUlData(Pst* pst, RlcData *ulData);
99 uint8_t unpackRlcUlData(RlcMacUlDataFunc func, Pst *pst, Buffer *mBuf);
100 uint8_t RlcProcUlData(Pst* pst, RlcData *ulData);
101
102 /**********************************************************************
103           End of file
104 **********************************************************************/
105