[Task-ID: ODUHIGH-432]Fix to send correct RLC header and PDCP SN for RRC messages...
[o-du/l2.git] / src / phy_stub / phy_stub.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 #include <unistd.h>
19
20 #ifdef NR_TDD
21 #define MAX_SLOT_VALUE   19
22 #else
23 #define MAX_SLOT_VALUE   9
24 #endif
25 #define MAX_SFN_VALUE    1023
26 #define NR_PCI            1
27 #define SLOT_DELAY       3
28 #define NUM_DRB_TO_PUMP_DATA  3
29 #define NUM_UL_PACKETS   1
30 /*UE Ids for RACH IND*/
31 #define UE_IDX_0     0
32 #define UE_IDX_1     1
33 #define UE_IDX_2     2
34
35 bool     slotIndicationStarted;
36 uint16_t sfnValue;
37 uint16_t slotValue;
38
39 /*Mapping between LCG ID and BSR Idx*/
40 typedef struct lcgBufferSize
41 {
42    uint8_t lcgId;   /*LCG ID for which BSR will be requested*/
43    /*BufferStatus Index. This is as per Spec 38.321, BSR will be reported as Index 
44     * Refer table Table 6.1.3.1-1:Short_BSR and Table 6.1.3.1-2:Long_BSR*/
45    uint8_t bsIdx;
46 }LcgBufferSize;
47
48 /* UE specific information */
49 typedef struct ueCb
50 {
51    uint8_t  ueId;
52    uint16_t crnti;
53    bool     rachIndSent;
54    bool     msg3Sent;
55    bool     msg5ShortBsrSent;
56    bool     msg5Sent;
57    bool     dlDedMsg;
58    bool     msgSecurityModeComp;
59    bool            msgRrcReconfiguration;
60    bool            msgRegistrationComp;
61    uint8_t  rlcSnForSrb1;           /* Sequence number of PDU at RLC for AM mode */
62    uint8_t  pdcpSn;                 /* Sequence number of PDU at PDCP */
63 }UeCb;
64
65 /* Database to store information for all UE */
66 typedef struct ueDb
67 {
68    uint8_t   numActvUe;
69    UeCb      ueCb[MAX_NUM_UE];
70 }UeDb;
71
72 UeDb ueDb;
73
74 typedef enum
75 {
76    MSG_TYPE_MSG3,
77    MSG_TYPE_SHORT_BSR,
78    MSG_TYPE_MSG5,
79    MSG_TYPE_SECURITY_MODE_COMPLETE,
80    MSG_TYPE_REGISTRATION_COMPLETE,
81    MSG_TYPE_RRC_RECONFIG_COMPLETE
82 }MsgType;
83
84 void phyToMac ARGS((uint16_t msgType, uint32_t msgLen,void *msg));
85 #ifdef INTEL_FAPI
86 void fillTlvs ARGS((fapi_uint16_tlv_t *tlv, uint16_t tag, uint16_t
87 length, uint16_t value, uint32_t *msgLen));
88 void fillMsgHeader ARGS((fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen));
89 #endif
90 void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
91 void l1StartConsoleHandler();
92 void l1HdlSlotIndicaion(bool);
93 void GenerateTicks();
94 uint8_t l1SendUlUserData(uint8_t drbId, uint8_t ueIdx);
95 uint8_t l1SendStatusPdu();
96 uint16_t l1BuildAndSendSlotIndication();
97 uint16_t l1BuildAndSendStopInd();
98
99 /**********************************************************************
100          End of file
101 **********************************************************************/