FAPI TM, WLS_LIB and ODULOW documentation
[o-du/phy.git] / wls_lib / test / mac / mac_main.c
1 /******************************************************************************
2 *
3 *   Copyright (c) 2019 Intel.
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 /**
20  * @brief This file is test MAC wls lib main process
21  * @file mac_main.c
22  * @ingroup group_testmacwls
23  * @author Intel Corporation
24  **/
25
26
27 #include <stdint.h>
28 #include <stdio.h>
29
30 #include "wls_lib.h"
31 #include "mac_wls.h"
32
33 #define WLS_TEST_DEV_NAME "wls"
34 #define WLS_TEST_MSG_ID   1
35 #define WLS_TEST_MSG_SIZE 100
36 #define WLS_TEST_MEM_SIZE 2126512128 
37
38 #define N_MAC_MSGS   16
39
40 int main()
41 {
42     p_fapi_api_queue_elem_t p_list_elem;
43     unsigned int ret;
44     unsigned int n= N_MAC_MSGS; 
45     unsigned int i;
46
47     // DPDK init
48     ret = mac_dpdk_init();
49     if (ret)
50     {
51         printf("\n[MAC] DPDK Init - Failed\n");
52         return FAILURE;
53     }
54     printf("\n[MAC] DPDK Init - Done\n");
55
56     wls_mac_init(WLS_TEST_DEV_NAME, WLS_TEST_MEM_SIZE);
57     printf("\n[MAC] WLS Init - Done\n");
58
59     for (i=0; i< N_MAC_MSGS; i++)
60     {
61     p_list_elem = wls_mac_create_elem(WLS_TEST_MSG_ID, WLS_TEST_MSG_SIZE, 1, 0);
62       printf("\n[MAC] MAC Create Element %d- Done\n", i);
63
64     if(p_list_elem)
65     {
66         wls_mac_send_msg_to_phy((void *)p_list_elem);
67                 printf("\n[MAC] Send to FAPI %d- Done\n",i);
68         }
69     }
70
71     // Receive from FAPI WLS
72     wls_mac_rx_task();
73
74     printf("\n[MAC] Exiting...\n");
75
76     return SUCCESS;
77 }
78