Building mib PDU and SSB changes at scheduler
[o-du/l2.git] / src / cm / mac_sch_interface.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 /* events */
20 #define EVENT_SCH_CELL_CFG 1
21 #define EVENT_SCH_CELL_CFG_CFM 2
22
23 /* selector */
24 #define MAC_SCH_LC_SELECTOR 0
25 #define MAC_SCH_TC_SELECTOR 1
26 #define MAC_SCH_LWLC_SELECTOR 2
27
28 /*macros*/
29 #define NO_SSB 0
30 #define SSB_TRANSMISSION 1
31 #define SSB_REPEAT 2
32 #define MAX_SSB_IDX 1 /* forcing it as 1 for now. Right value is 64 */
33
34 /*structures*/
35
36
37 typedef enum
38 {
39         RSP_OK,
40         RSP_NOK
41 }schMacRsp;
42
43 typedef struct schCellCfg
44 {
45    U16         cellId;     /* Cell Id */
46    U16         phyCellId;  /* Physical cell id */
47         U8          bandwidth;  /* Supported B/W */
48    DuplexMode  dupMode;    /* Duplex type: TDD/FDD */
49    U32         ssbPbchPwr;       /* SSB block power */
50    U8          scsCommon;           /* subcarrier spacing for common [0-3]*/
51    U16         ssbOffsetPointA;  /* SSB sub carrier offset from point A */
52    SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
53    U8          ssbSubcOffset;    /* Subcarrier Offset(Kssb) */
54    U32         nSSBMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
55 }SchCellCfg;
56
57 typedef struct schCellCfgCfm
58 {
59    U16         cellId;     /* Cell Id */
60    schMacRsp   rsp;   
61 }SchCellCfgCfm;
62
63 typedef struct timeDomainAlloc
64 {
65    uint16_t ssbStartSymbIdx;
66         uint16_t ssbSymbolDuration;
67 }TimeDomainAlloc;
68
69 typedef struct freqDomainAlloc
70 {
71    uint16_t ssbStartPrbIdx;
72    uint16_t ssbPrbDuration;
73 }FreqDomainAlloc;
74
75 typedef struct ssbInfo
76 {
77    uint8_t ssbIdx;          /* SSB Index */
78         TimeDomainAlloc tdAlloc; /* Time domain allocation */
79         FreqDomainAlloc fdAlloc; /* Freq domain allocation */
80 }SsbInfo;
81
82 /* Interface structure signifying DL broadcast allocation for SSB, SIB1 */
83 typedef struct dlBrdcstAlloc
84 {
85    uint16_t cellId;  /* Cell Id */
86         SlotIndInfo slotIndInfo; /* Slot Info: sfn, slot number */
87         /* Ssb transmission is determined as follows:
88          * 0 : No tranamission
89          * 1 : SSB Transmission
90          * 2 : SSB Repetition */
91         uint8_t ssbTrans;
92         uint8_t ssbIdxSupported;
93         SsbInfo ssbInfo[MAX_SSB_IDX];
94         /* Sib1 transmission is determined as follows:
95          * 0 : No tranamission
96          * 1 : SIB1 Transmission
97          * 2 : SIB1 Repetition */
98         U8 sib1Trans;
99 }DlBrdcstAlloc;
100
101 /* function pointers */
102
103 typedef int (*SchMacDlBrdcstAllocFunc)     ARGS((                     
104    Pst            *pst,           /* Post Structure */                         
105    DlBrdcstAlloc  *dlBrdcstAlloc    /* slot ind Info */                      
106 ));
107
108 typedef int (*SchCellCfgCfmFunc)    ARGS((
109    Pst            *pst,           /* Post Structure */                         
110    SchCellCfgCfm  *schCellCfgCfm  /* Cell Cfg Cfm */
111 ));
112
113 typedef int (*SchCellCfgFunc)    ARGS((
114    Pst            *pst,           /* Post Structure */                         
115    SchCellCfg  *schCellCfg     /* Cell Cfg  */
116 ));
117 /* function declarations */
118 int packMacSchSlotInd(Pst *pst, SlotIndInfo *slotInd);
119 int packSchMacDlBrdcstAlloc(Pst *pst, DlBrdcstAlloc  *dlBrdcstAlloc);
120 EXTERN int packSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
121 EXTERN int packSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
122
123 EXTERN int MacProcDlBrdcstAlloc(Pst *pst, DlBrdcstAlloc *dlBrdcstAlloc);
124 EXTERN int MacProcSchCellCfg(Pst *pst, SchCellCfg  *schCellCfg);
125 EXTERN int MacProcSchCellCfgCfm(Pst *pst, SchCellCfgCfm  *schCellCfgCfm);
126 EXTERN int SchHdlCellCfgReq(Pst *pst, SchCellCfg *schCellCfg);
127 EXTERN int schActvInit(Ent entity, Inst instId, Region region, Reason reason);
128 EXTERN S16 SchSendCfgCfm(Pst *pst, RgMngmt *cfm);
129
130 /**********************************************************************
131   End of file
132  **********************************************************************/
133