[Epic-ID: ODUHIGH-405][Task-ID: ODUHIGH-437] Establishing communication between Sourc...
[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 /* Changes the IP information 
21 * At DU1, SOURCE_DU_IPV4_ADDR = 192.168.130.81 and DESTINATION_DU_IPV4_ADDR = 192.168.130.83 
22 * At DU2, SOURCE_DU_IPV4_ADDR = 192.168.130.83 and DESTINATION_DU_IPV4_ADDR = 192.168.130.81 */
23 #define SOURCE_DU_IPV4_ADDR      "192.168.130.81"
24 #define DESTINATION_DU_IPV4_ADDR "192.168.130.83"
25 #define PORT_NUMBER 8080
26 #define NUM_THREADS 1
27
28 #ifdef NR_TDD
29 #define MAX_SLOT_VALUE   19
30 #else
31 #define MAX_SLOT_VALUE   9
32 #endif
33 #define MAX_SFN_VALUE    1023
34 #define NR_PCI            1
35 #define SLOT_DELAY       3
36 #define NUM_DRB_TO_PUMP_DATA  3
37 #define NUM_UL_PACKETS   1
38 /*UE Ids for RACH IND*/
39 #define UE_IDX_0     0
40 #define UE_IDX_1     1
41 #define UE_IDX_2     2
42
43 bool     slotIndicationStarted;
44 uint16_t sfnValue;
45 uint16_t slotValue;
46
47 /*Mapping between LCG ID and BSR Idx*/
48 typedef struct lcgBufferSize
49 {
50    uint8_t lcgId;   /*LCG ID for which BSR will be requested*/
51    /*BufferStatus Index. This is as per Spec 38.321, BSR will be reported as Index 
52     * Refer table Table 6.1.3.1-1:Short_BSR and Table 6.1.3.1-2:Long_BSR*/
53    uint8_t bsIdx;
54 }LcgBufferSize;
55
56 /* UE specific information */
57 typedef struct ueCb
58 {
59    uint8_t  ueId;
60    uint16_t crnti;
61    bool     rachIndSent;
62    bool     msg3Sent;
63    bool     msg5ShortBsrSent;
64    bool     msg5Sent;
65    bool     dlDedMsg;
66    bool     msgSecurityModeComp;
67    bool            msgRrcReconfiguration;
68    bool            msgRegistrationComp;
69    uint8_t  rlcSnForSrb1;           /* Sequence number of PDU at RLC for AM mode */
70    uint8_t  pdcpSn;                 /* Sequence number of PDU at PDCP */
71 }UeCb;
72
73 /* Database to store information for all UE */
74 typedef struct ueDb
75 {
76    uint8_t   numActvUe;
77    UeCb      ueCb[MAX_NUM_UE];
78 }UeDb;
79
80 typedef struct ipCfg
81 {
82    uint32_t sourceDu;
83    uint32_t destinationDu;
84    uint16_t portNumber;
85 }IpCfg;
86
87 typedef struct phyDb
88 {
89    bool   isServer;
90    IpCfg  ipCfgInfo;  
91    UeDb    ueDb;
92 }PhyDb;
93
94 PhyDb phyDb;
95
96 typedef enum
97 {
98    MSG_TYPE_MSG3,
99    MSG_TYPE_SHORT_BSR,
100    MSG_TYPE_MSG5,
101    MSG_TYPE_SECURITY_MODE_COMPLETE,
102    MSG_TYPE_REGISTRATION_COMPLETE,
103    MSG_TYPE_RRC_RECONFIG_COMPLETE
104 }MsgType;
105
106 void phyToMac ARGS((uint16_t msgType, uint32_t msgLen,void *msg));
107 #ifdef INTEL_FAPI
108 void fillTlvs ARGS((fapi_uint16_tlv_t *tlv, uint16_t tag, uint16_t
109 length, uint16_t value, uint32_t *msgLen));
110 void fillMsgHeader ARGS((fapi_msg_t *hdr, uint16_t msgType, uint16_t msgLen));
111 #endif
112 void procPhyMessages(uint16_t msgType, uint32_t msgSize, void *msg);
113 void l1StartConsoleHandler();
114 void l1HdlSlotIndicaion(bool);
115 void GenerateTicks();
116 uint8_t l1SendUlUserData(uint8_t drbId, uint8_t ueIdx);
117 uint8_t l1SendStatusPdu();
118 uint16_t l1BuildAndSendSlotIndication();
119 uint16_t l1BuildAndSendStopInd();
120 int inet_pton(int af, const char *sourc, void *dst);
121 void *establishConnectionWithPeerL1(void *args);
122 /**********************************************************************
123          End of file
124 **********************************************************************/