086f8c4a174a8661f3342f5d4be9d329c6513593
[o-du/l2.git] / src / 5gnrmac / lwr_mac_phy.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 #ifndef _LWR_MAC_PHY_H_
19 #define _LWR_MAC_PHY_H_
20
21 #include "envdep.h"
22 #include "gen.h"
23 #include "ssi.h"
24 #include "cm_llist.h"
25
26 #include "gen.x"
27 #include "ssi.x"
28 #include "cm_llist.x"
29
30 typedef enum
31 {
32    MSG_OK,
33    MSG_INVALID_STATE,
34    MSG_INVALID_CONFIG,
35    SFN_OUT_OF_SYNC,
36    MSG_SLOT_ERR,
37    MSG_BCH_MISSING,
38    MSG_INVALID_SFN,
39    MSG_UL_DCI_ERR,
40    MSG_TX_ERR
41 }ErrorCode;
42
43 #ifdef INTEL_WLS
44 #define WLS_MEM_FREE_PRD       10        /* Free memory after 10 slot ind */
45 #define LWR_MAC_WLS_BUF_SIZE   8192      /* Size of WLS memory block */
46
47 /* allocate static buffer from WLS memory */
48 #define WLS_MEM_ALLOC(_datPtr, _size)                        \
49 {                                                            \
50    int16_t _ret;                                             \
51    _ret = SGetSBufWls(0, 0, (Data **)&_datPtr, _size);       \
52    if(_ret == ROK)                                           \
53       cmMemset((U8*)_datPtr, 0, _size);                      \
54    else                                                      \
55       _datPtr = NULLP;                                       \
56 }                                                              
57
58 /* free a static buffer from WLS memory*/
59 #define WLS_MEM_FREE(_datPtr, _size)                         \
60    if(_datPtr)                                               \
61       SPutSBufWls(0, 0, (Data *)_datPtr, _size);
62
63 typedef struct wlsBlockToFree
64 {
65    void *ptr;
66    uint32_t size;
67 }WlsBlockToFree;
68
69 CmLListCp wlsBlockToFreeList[WLS_MEM_FREE_PRD];
70 extern uint8_t slotIndIdx;
71
72 EXTERN void freeWlsBlockList(uint8_t idx);
73 EXTERN void LwrMacEnqueueWlsBlock();
74 #endif /* INTEL_WLS */
75
76 EXTERN uint16_t LwrMacSendToPhy(uint8_t msgType, uint32_t msgLen, void *msg);
77 #endif
78
79 /**********************************************************************
80          End of file
81 **********************************************************************/
82