Trigger_macCellCfg
[o-du/l2.git] / src / cm / du_app_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
19 /* Defines APIs exchanged between du_app and cl module of MAC */
20 #ifndef __MACINT_H__
21 #define __MACINT_H__
22
23 #define NUM_NUMEROLOGY 5  /* Number of numerology */
24 #define MAXIMUM_TDD_PERIODICITY 5
25 #define MAX_SYMB_PER_SLOT 14 
26
27 #define NUM_SSB         1       /* max value is 64 */
28 #define SSB_MASK_SIZE   1       /* SSB mask size is 32bit for sub6 */
29 #define SIB1_NEW_TX_PERIOD      160
30 #define SIB1_REPETITION_PERIOD   20
31 #define CORESET_0_INDEX      0
32 #define SEARCHSPACE_0_INDEX   0
33 #define SIB1_MCS  4
34
35
36 /* Event IDs */
37 #define EVENT_MAC_CELL_CONFIG_REQ    200
38 #define EVENT_MAC_CELL_CONFIG_CFM    201
39
40 typedef enum
41 {
42    DUP_MODE_FDD,
43    DUP_MODE_TDD
44 }DuplexMode;
45
46 typedef enum
47 {
48    MAC_GEN_FULL_PBCH_PAYLD,   /* MAC generated the full PBCH Payload */
49    PHY_GEN_TIMING_PBCH_BIT,   /* PHY generates the timing PBCH bits */
50    PHY_GEN_FULL_PBCH_PAYLD    /* PHY generates full PBCH payload */
51 }BchPduOpt;
52
53 typedef enum
54 {
55    LONG_SEQUENCE,
56    SHORT_SEQUENCE
57 }PrachSeqLen;
58
59 typedef enum
60 {
61    UNRESTRICTED,
62    RESTRICTED_SET_TYPE_A,
63    RESTRICTED_SET_TYPE_B
64 }RstSetCfg;
65
66 typedef enum
67 {
68    DONT_REPORT_RSSI,
69    RSSI_UNIT_DBM,
70    RSSI_UNIT_DBFS
71 }RSSIMeasUnit;
72
73 typedef enum
74 {
75    DL_SLOT,
76    UL_SLOT,
77    GUARD_SLOT
78 }SlotConfig;
79
80 typedef enum
81 {
82    TX_PRDCTY_MS_0P5,
83    TX_PRDCTY_MS_0P625,
84    TX_PRDCTY_MS_1,
85    TX_PRDCTY_MS_1P25,
86    TX_PRDCTY_MS_2,
87    TX_PRDCTY_MS_2P5,
88    TX_PRDCTY_MS_5,
89    TX_PRDCTY_MS_10
90 }DlUlTxPeriodicity;
91
92 typedef enum
93 {
94    BETA_PSS_0DB,
95    BETA_PSS_1DB
96 }BetaPss;
97
98 typedef enum 
99 {
100    SSB_PRDCTY_MS_5,
101    SSB_PRDCTY_MS_10,
102    SSB_PRDCTY_MS_20,
103    SSB_PRDCTY_MS_40,
104    SSB_PRDCTY_MS_80,
105    SSB_PRDCTY_MS_160
106 }SSBPeriod;
107
108 typedef struct carrierCfg
109 {
110    Bool  pres;
111    U16   bw;             /* DL/UL bandwidth */
112    U32   freq;           /* Absolute frequency of DL/UL point A in KHz */
113    U16   k0[NUM_NUMEROLOGY];          /* K0 for DL/UL */
114    U16   gridSize[NUM_NUMEROLOGY];    /* DL/UL Grid size for each numerologies */
115    U16   numAnt;         /* Number of Tx/Rx antennas */
116 }CarrierCfg;
117
118 typedef struct ssbCfg
119 {
120    uint32_t    ssbPbchPwr;       /* SSB block power */
121    BchPduOpt   bchPayloadFlag;   /* Options for generation of payload */
122    uint8_t     scsCmn;           /* subcarrier spacing for common */
123    uint16_t    ssbOffsetPointA;  /* SSB subcarrier offset from point A */
124    BetaPss     betaPss;
125    SSBPeriod   ssbPeriod;        /* SSB Periodicity in msec */
126    uint8_t     ssbScOffset;       /* Subcarrier Offset */
127    uint8_t     mibPdu[3];           /* MIB payload */
128    uint32_t    ssbMask[SSB_MASK_SIZE];      /* Bitmap for actually transmitted SSB. */
129    uint8_t     beamId[NUM_SSB];
130    Bool        multCarrBand;     /* Multiple carriers in a band */
131    Bool        multCellCarr;     /* Multiple cells in single carrier */
132 }SsbCfg;
133
134 typedef struct fdmInfo
135 {
136    U16   rootSeqIdx;        /* Root sequence index */
137    U8    numRootSeq;        /* Number of root sequences required for FD */
138    U16   k1;                /* Frequency Offset for each FD */
139    U8    zeroCorrZoneCfg;   /* Zero correlation zone cofig */
140    U8    numUnusedRootSeq;  /* Number of unused root sequence */
141    U8    *unsuedRootSeq;     /* Unused root sequence per FD */
142 }FdmInfo;
143
144 typedef struct prachCfg
145 {
146    Bool          pres;
147    PrachSeqLen   prachSeqLen;         /* RACH Sequence length: Long/short */
148    U8            prachSubcSpacing;    /* Subcarrier spacing of RACH */
149    RstSetCfg     prachRstSetCfg;      /* PRACH restricted set config */
150    U8            prachFdm;            /* PRACH FDM (1,2,4,8) */
151    FdmInfo       fdm[8];
152    U8            ssbPerRach;          /* SSB per RACH occassion */
153    Bool          prachMultCarrBand;    /* Multiple carriers in Band */
154 }PrachCfg;
155
156 typedef struct tddCfg
157 {
158    Bool               pres;
159    DlUlTxPeriodicity  tddPeriod;      /* DL UL Transmission periodicity */
160    SlotConfig         slotCfg[MAXIMUM_TDD_PERIODICITY][MAX_SYMB_PER_SLOT]; 
161 }TDDCfg;
162
163 typedef struct sib1CellCfg
164 {
165    uint8_t  *sib1Pdu;
166    uint16_t sib1PduLen;
167    uint16_t sib1NewTxPeriod;
168    uint16_t sib1RepetitionPeriod;
169    uint8_t coresetZeroIndex;     /* derived from 4 LSB of pdcchSib1 present in MIB */
170    uint8_t searchSpaceZeroIndex; /* derived from 4 MSB of pdcchSib1 present in MIB */
171    uint16_t sib1Mcs;
172 } Sib1CellCfg; 
173
174 typedef struct macCellCfg
175 {
176    U16            transId;
177    U16            cellId;     /* Cell Id */
178    U8             numTlv;     /* Number of configuration TLVs */
179    U8             carrierId;  /* Carrired Index */
180    U16            phyCellId;  /* Physical cell id */
181    DuplexMode     dupType;    /* Duplex type: TDD/FDD */
182    CarrierCfg     dlCarrCfg;  /* DL Carrier configuration */
183    CarrierCfg     ulCarrCfg;  /* UL Carrier configuration */
184    Bool           freqShft;   /* Indicates presence of 7.5kHz frequency shift */
185    SsbCfg         ssbCfg;     /* SSB configuration */          
186    PrachCfg       prachCfg;   /* PRACH Configuration */
187    TDDCfg         tddCfg;     /* TDD periodicity and slot configuration */
188    RSSIMeasUnit   rssiUnit;   /* RSSI measurement unit */
189    Sib1CellCfg    sib1Cfg;
190 }MacCellCfg;
191
192 typedef struct macCellCfgCfm
193 {
194    U16            transId;
195 }MacCellCfgCfm;
196
197 /* function pointers for packing macCellCfg Request */
198 typedef U16 (*packMacCellCfgReq) ARGS((
199    Pst           *pst,
200    MacCellCfg    *macCellCfg
201 ));
202
203 typedef S16 (*packMacCellCfgConfirm) ARGS((
204    Pst              *pst,
205    MacCellCfgCfm    *macCellCfgCfm
206 ));
207
208 typedef S16 (*DuMacCellCfgReq)     ARGS((
209         Pst        *pst,               /* Post Structure */
210         MacCellCfg *macCellCfg         /* Config Structure */
211      ));
212
213 typedef S16 (*DuMacCellCfgCfm)     ARGS((
214         MacCellCfgCfm *macCellCfgCfm         /* Config Structure */
215      ));
216
217 U16 packMacCellCfg(Pst *pst, MacCellCfg *macCellCfg);
218
219 EXTERN S16 MacHdlCellCfgReq
220 (
221  Pst           *pst,
222  MacCellCfg    *macCellCfg
223 );
224
225 void cmUnpackLwLcMacCellCfg(
226    DuMacCellCfgReq func,
227    Pst *pst,
228    Buffer *mBuf);
229
230 U16 unpackMacCellCfgCfm(
231    DuMacCellCfgCfm func,
232    Pst *pst,
233    Buffer *mBuf);
234
235 EXTERN S16 duHandleMacCellCfgCfm
236 (
237  MacCellCfgCfm    *macCellCfgCfm
238 );
239
240 #endif
241
242 /**********************************************************************
243          End of file
244 **********************************************************************/