Building mib PDU and SSB changes at scheduler
[o-du/l2.git] / src / 5gnrmac / lwr_mac_handle_phy.c
1
2 /* header include files (.h) */
3 #include "envopt.h"        /* environment options */
4 #include "envdep.h"        /* environment dependent */
5 #include "envind.h"        /* environment independent */
6 #include "gen.h"           /* general */
7 #include "ssi.h"           /* system services */
8 #include "cm_tkns.h"       /* Common Token Defines */
9 #include "cm_llist.h"      /* Common Link List Defines */
10 #include "cm_hash.h"       /* Common Hash List Defines */
11 #include "cm_lte.h"        /* Common LTE Defines */
12 #include "cm_mblk.h"        /* Common LTE Defines */
13 #include "tfu.h"           /* RGU Interface defines */
14 //#include "rg.h"
15 #include "fapi.h"
16
17 /* header/extern include files (.x) */
18 #include "gen.x"           /* general */
19 #include "ssi.x"           /* system services */
20 #include "cm_tkns.x"       /* Common Token Definitions */
21 #include "cm_llist.x"      /* Common Link List Definitions */
22 #include "cm_lib.x"        /* Common Library Definitions */
23 #include "cm_hash.x"       /* Common Hash List Definitions */
24 #include "cm_lte.x"        /* Common LTE Defines */
25 #include "cm_mblk.x"        /* Common LTE Defines */
26 #include "tfu.x"           /* RGU Interface includes */
27 //#include "rg.x"
28
29 /* function pointers for packing macCellCfg Request */
30 typedef S16 (*packSlotIndMsg) ARGS((
31    Pst           *pst,
32    fapi_slot_ind_t *slotInd
33 ));
34
35 S16 packLcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd);
36 S16 packTcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd);
37 S16 packLwlcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd);
38
39 packSlotIndMsg packSlotIndMt[] =
40 {
41    packLcSlotInd, /* packing for loosely coupled */
42    fapiMacSlotInd, /* packing for tightly coupled */
43    packLwlcSlotInd, /* packing for light weight loosly coupled */
44 };
45
46 S16 packLcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd)
47 {
48    Buffer *mBuf = NULLP;
49    if (SGetMsg(pst->region, pst->pool, &mBuf) != ROK) 
50    {
51       RETVALUE(RFAILED);
52    }
53
54    /* pack SFN and slot value */
55    CMCHKPK(SPkU16,slotInd->sfn, mBuf);
56    CMCHKPK(SPkU16,slotInd->slot, mBuf);
57
58    RETVALUE(SPstTsk(pst,mBuf));
59 }
60
61 S16 packTcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd)
62 {
63    return ROK;
64 }
65
66 S16 packLwlcSlotInd (Pst *pst, fapi_slot_ind_t *slotInd)
67 {
68    return ROK;
69 }
70
71 void handleSlotInd(fapi_slot_ind_t *fapiSlotInd)
72 {
73    /* fill Pst structure to send to lwr_mac to MAC */
74    Pst pst;
75    SlotIndInfo slotInd;
76
77    pst.srcProcId = 0;
78    pst.dstProcId = 0;
79    pst.srcEnt = ENTTF;
80    pst.dstEnt = ENTRG;
81    pst.srcInst = 0;
82    pst.dstInst = 0;
83    pst.event = EVENT_SLOT_IND_TO_MAC;
84    pst.region = 0;
85    pst.pool =  0;
86    pst.selector = MAC_SELECTOR_TC;
87
88    slotInd.sfn = fapiSlotInd->sfn;
89    slotInd.slot = fapiSlotInd->slot;
90
91    return (*packSlotIndMt[pst.selector])(&pst, &slotInd);
92 }
93
94 void handlePhyMessages(U8 *msg)
95 {
96    /* extract the header */
97    fapi_msg_t *header;
98    header = (fapi_msg_t *)msg;
99
100    switch(header->message_type_id)
101    {
102       case FAPI_SLOT_INDICATION:
103       {
104          fapi_slot_ind_t *slotInd;
105          slotInd  = (fapi_slot_ind_t *)msg;
106          handleSlotInd(slotInd);
107          break;
108       }
109       case FAPI_ERROR_INDICATION:
110       {
111          break;
112       }
113       case FAPI_RX_DATA_INDICATION:
114       {
115          break;
116       }  
117       case FAPI_CRC_INDICATION:
118       {
119          break;
120       }  
121       case FAPI_UCI_INDICATION:
122       {
123          break;
124       }  
125       case FAPI_SRS_INDICATION:
126       {
127          break;
128       }  
129       case FAPI_RACH_INDICATION:
130       {
131          break;
132       }  
133    }
134 }