diff --git a/lib/include/srslte/common/mac_nr_pdu.h b/lib/include/srslte/mac/mac_nr_pdu.h similarity index 100% rename from lib/include/srslte/common/mac_nr_pdu.h rename to lib/include/srslte/mac/mac_nr_pdu.h diff --git a/lib/include/srslte/common/pdu.h b/lib/include/srslte/mac/pdu.h similarity index 100% rename from lib/include/srslte/common/pdu.h rename to lib/include/srslte/mac/pdu.h diff --git a/lib/include/srslte/common/pdu_queue.h b/lib/include/srslte/mac/pdu_queue.h similarity index 98% rename from lib/include/srslte/common/pdu_queue.h rename to lib/include/srslte/mac/pdu_queue.h index b9464f84d..8c360722f 100644 --- a/lib/include/srslte/common/pdu_queue.h +++ b/lib/include/srslte/mac/pdu_queue.h @@ -25,8 +25,8 @@ #include "srslte/common/block_queue.h" #include "srslte/common/buffer_pool.h" #include "srslte/common/log.h" -#include "srslte/common/pdu.h" #include "srslte/common/timers.h" +#include "srslte/mac/pdu.h" /* Logical Channel Demultiplexing and MAC CE dissassemble */ diff --git a/lib/src/CMakeLists.txt b/lib/src/CMakeLists.txt index 9c99dd71f..512475db1 100644 --- a/lib/src/CMakeLists.txt +++ b/lib/src/CMakeLists.txt @@ -20,6 +20,7 @@ add_subdirectory(asn1) add_subdirectory(common) +add_subdirectory(mac) add_subdirectory(phy) add_subdirectory(radio) add_subdirectory(upper) diff --git a/lib/src/common/CMakeLists.txt b/lib/src/common/CMakeLists.txt index 1891580d1..501fb29e5 100644 --- a/lib/src/common/CMakeLists.txt +++ b/lib/src/common/CMakeLists.txt @@ -32,8 +32,6 @@ set(SOURCES arch_select.cc nas_pcap.cc network_utils.cc pcap.c - pdu.cc - pdu_queue.cc rlc_pcap.cc s1ap_pcap.cc security.cc @@ -46,7 +44,7 @@ set(SOURCES arch_select.cc zuc.cc) if (ENABLE_5GNR) - set(SOURCES ${SOURCES} mac_nr_pcap.cc mac_nr_pdu.cc) + set(SOURCES ${SOURCES} mac_nr_pcap.cc) endif(ENABLE_5GNR) # Avoid warnings caused by libmbedtls about deprecated functions diff --git a/lib/src/mac/CMakeLists.txt b/lib/src/mac/CMakeLists.txt new file mode 100644 index 000000000..1f46b6520 --- /dev/null +++ b/lib/src/mac/CMakeLists.txt @@ -0,0 +1,28 @@ +# +# Copyright 2013-2020 Software Radio Systems Limited +# +# This file is part of srsLTE +# +# srsLTE is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# srsLTE is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# A copy of the GNU Affero General Public License can be found in +# the LICENSE file in the top-level directory of this distribution +# and at http://www.gnu.org/licenses/. +# + +SET(SOURCES pdu.cc pdu_queue.cc) + +if (ENABLE_5GNR) + set(SOURCES ${SOURCES} mac_nr_pdu.cc) +endif(ENABLE_5GNR) + +add_library(srslte_mac STATIC ${SOURCES}) + diff --git a/lib/src/common/mac_nr_pdu.cc b/lib/src/mac/mac_nr_pdu.cc similarity index 99% rename from lib/src/common/mac_nr_pdu.cc rename to lib/src/mac/mac_nr_pdu.cc index 9f7f9b5ad..304fbf72a 100644 --- a/lib/src/common/mac_nr_pdu.cc +++ b/lib/src/mac/mac_nr_pdu.cc @@ -19,7 +19,7 @@ * */ -#include "srslte/common/mac_nr_pdu.h" +#include "srslte/mac/mac_nr_pdu.h" namespace srslte { diff --git a/lib/src/common/pdu.cc b/lib/src/mac/pdu.cc similarity index 99% rename from lib/src/common/pdu.cc rename to lib/src/mac/pdu.cc index 182fc1956..80774a7e2 100644 --- a/lib/src/common/pdu.cc +++ b/lib/src/mac/pdu.cc @@ -24,7 +24,7 @@ #include #include -#include "srslte/common/pdu.h" +#include "srslte/mac/pdu.h" #include "srslte/srslte.h" // Table 6.1.3.1-1 Buffer size levels for BSR diff --git a/lib/src/common/pdu_queue.cc b/lib/src/mac/pdu_queue.cc similarity index 98% rename from lib/src/common/pdu_queue.cc rename to lib/src/mac/pdu_queue.cc index 897a3ea82..3278c9c46 100644 --- a/lib/src/common/pdu_queue.cc +++ b/lib/src/mac/pdu_queue.cc @@ -19,7 +19,7 @@ * */ -#include "srslte/common/pdu_queue.h" +#include "srslte/mac/pdu_queue.h" #include "srslte/common/log_helper.h" namespace srslte { diff --git a/lib/test/CMakeLists.txt b/lib/test/CMakeLists.txt index c6848c363..0ec11d383 100644 --- a/lib/test/CMakeLists.txt +++ b/lib/test/CMakeLists.txt @@ -20,5 +20,6 @@ add_subdirectory(asn1) add_subdirectory(common) +add_subdirectory(mac) add_subdirectory(phy) add_subdirectory(upper) diff --git a/lib/test/common/CMakeLists.txt b/lib/test/common/CMakeLists.txt index 9e6319f1a..61ab20db3 100644 --- a/lib/test/common/CMakeLists.txt +++ b/lib/test/common/CMakeLists.txt @@ -63,16 +63,6 @@ target_link_libraries(timeout_test srslte_phy ${CMAKE_THREAD_LIBS_INIT}) add_executable(bcd_helpers_test bcd_helpers_test.cc) -add_executable(pdu_test pdu_test.cc) -target_link_libraries(pdu_test srslte_phy srslte_common ${CMAKE_THREAD_LIBS_INIT}) -add_test(pdu_test pdu_test) - -if (ENABLE_5GNR) - add_executable(mac_nr_pdu_test mac_nr_pdu_test.cc) - target_link_libraries(mac_nr_pdu_test srslte_phy srslte_common ${CMAKE_THREAD_LIBS_INIT}) - add_test(mac_nr_pdu_test mac_nr_pdu_test) -endif (ENABLE_5GNR) - add_executable(stack_procedure_test stack_procedure_test.cc) add_test(stack_procedure_test stack_procedure_test) diff --git a/lib/test/mac/CMakeLists.txt b/lib/test/mac/CMakeLists.txt new file mode 100644 index 000000000..b7c10c394 --- /dev/null +++ b/lib/test/mac/CMakeLists.txt @@ -0,0 +1,29 @@ +# +# Copyright 2013-2020 Software Radio Systems Limited +# +# This file is part of srsLTE +# +# srsLTE is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# srsLTE is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# A copy of the GNU Affero General Public License can be found in +# the LICENSE file in the top-level directory of this distribution +# and at http://www.gnu.org/licenses/. +# + +add_executable(pdu_test pdu_test.cc) +target_link_libraries(pdu_test srslte_phy srslte_common srslte_mac ${CMAKE_THREAD_LIBS_INIT}) +add_test(pdu_test pdu_test) + +if (ENABLE_5GNR) + add_executable(mac_nr_pdu_test mac_nr_pdu_test.cc) + target_link_libraries(mac_nr_pdu_test srslte_phy srslte_common srslte_mac ${CMAKE_THREAD_LIBS_INIT}) + add_test(mac_nr_pdu_test mac_nr_pdu_test) +endif (ENABLE_5GNR) diff --git a/lib/test/common/mac_nr_pdu_test.cc b/lib/test/mac/mac_nr_pdu_test.cc similarity index 99% rename from lib/test/common/mac_nr_pdu_test.cc rename to lib/test/mac/mac_nr_pdu_test.cc index 8a7aad59a..78ef1451c 100644 --- a/lib/test/common/mac_nr_pdu_test.cc +++ b/lib/test/mac/mac_nr_pdu_test.cc @@ -21,8 +21,8 @@ #include "srslte/common/log_filter.h" #include "srslte/common/mac_nr_pcap.h" -#include "srslte/common/mac_nr_pdu.h" #include "srslte/config.h" +#include "srslte/mac/mac_nr_pdu.h" #include #include diff --git a/lib/test/common/pdu_test.cc b/lib/test/mac/pdu_test.cc similarity index 99% rename from lib/test/common/pdu_test.cc rename to lib/test/mac/pdu_test.cc index 0a66cfa21..f076b12f3 100644 --- a/lib/test/common/pdu_test.cc +++ b/lib/test/mac/pdu_test.cc @@ -23,9 +23,9 @@ #include "srslte/common/interfaces_common.h" #include "srslte/common/logmap.h" #include "srslte/common/mac_pcap.h" -#include "srslte/common/pdu.h" #include "srslte/common/test_common.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/mac/pdu.h" #include #include #include diff --git a/srsenb/hdr/stack/mac/ue.h b/srsenb/hdr/stack/mac/ue.h index ab65d8a9c..ee36c39c5 100644 --- a/srsenb/hdr/stack/mac/ue.h +++ b/srsenb/hdr/stack/mac/ue.h @@ -26,10 +26,10 @@ #include "srslte/common/block_queue.h" #include "srslte/common/log.h" #include "srslte/common/mac_pcap.h" -#include "srslte/common/pdu.h" -#include "srslte/common/pdu_queue.h" #include "srslte/interfaces/enb_interfaces.h" #include "srslte/interfaces/sched_interface.h" +#include "srslte/mac/pdu.h" +#include "srslte/mac/pdu_queue.h" #include "ta.h" #include #include diff --git a/srsenb/src/CMakeLists.txt b/srsenb/src/CMakeLists.txt index 20399197e..68d3459e2 100644 --- a/srsenb/src/CMakeLists.txt +++ b/srsenb/src/CMakeLists.txt @@ -41,6 +41,7 @@ target_link_libraries(srsenb srsenb_phy srsenb_mac srsenb_rrc srslte_common + srslte_mac srslte_phy srslte_upper srslte_radio diff --git a/srsenb/src/stack/mac/scheduler_harq.cc b/srsenb/src/stack/mac/scheduler_harq.cc index a803e8e69..8914f3adf 100644 --- a/srsenb/src/stack/mac/scheduler_harq.cc +++ b/srsenb/src/stack/mac/scheduler_harq.cc @@ -23,7 +23,7 @@ #include "srsenb/hdr/stack/mac/scheduler.h" #include "srslte/common/log_helper.h" -#include "srslte/common/pdu.h" +#include "srslte/mac/pdu.h" #include "srslte/srslte.h" using srslte::tti_point; diff --git a/srsenb/src/stack/mac/scheduler_ue.cc b/srsenb/src/stack/mac/scheduler_ue.cc index 82f82f709..fde3f60d8 100644 --- a/srsenb/src/stack/mac/scheduler_ue.cc +++ b/srsenb/src/stack/mac/scheduler_ue.cc @@ -25,7 +25,7 @@ #include "srsenb/hdr/stack/mac/scheduler_ue.h" #include "srslte/common/log_helper.h" #include "srslte/common/logmap.h" -#include "srslte/common/pdu.h" +#include "srslte/mac/pdu.h" #include "srslte/srslte.h" /****************************************************** diff --git a/srsenb/test/mac/CMakeLists.txt b/srsenb/test/mac/CMakeLists.txt index c69539b1d..81bfa3ded 100644 --- a/srsenb/test/mac/CMakeLists.txt +++ b/srsenb/test/mac/CMakeLists.txt @@ -25,6 +25,7 @@ add_executable(sched_grid_test sched_grid_test.cc) target_link_libraries(sched_grid_test srsenb_mac srsenb_phy srslte_common + srslte_mac scheduler_test_common ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) diff --git a/srsenb/test/mac/scheduler_ca_test.cc b/srsenb/test/mac/scheduler_ca_test.cc index 9cc6ee310..6d00b27d8 100644 --- a/srsenb/test/mac/scheduler_ca_test.cc +++ b/srsenb/test/mac/scheduler_ca_test.cc @@ -19,10 +19,10 @@ * */ -#include "lib/include/srslte/common/pdu.h" #include "scheduler_test_common.h" #include "scheduler_test_utils.h" #include "srsenb/hdr/stack/mac/scheduler.h" +#include "srslte/mac/pdu.h" using namespace srsenb; diff --git a/srsenb/test/mac/scheduler_test_common.cc b/srsenb/test/mac/scheduler_test_common.cc index 4ee65d320..d3a826b5b 100644 --- a/srsenb/test/mac/scheduler_test_common.cc +++ b/srsenb/test/mac/scheduler_test_common.cc @@ -20,8 +20,8 @@ */ #include "scheduler_test_common.h" -#include "lib/include/srslte/common/pdu.h" #include "srsenb/hdr/stack/mac/scheduler.h" +#include "srslte/mac/pdu.h" #include "srslte/common/test_common.h" diff --git a/srsue/hdr/stack/mac/demux.h b/srsue/hdr/stack/mac/demux.h index ef5538cd0..92f4d8541 100644 --- a/srsue/hdr/stack/mac/demux.h +++ b/srsue/hdr/stack/mac/demux.h @@ -23,10 +23,10 @@ #define SRSUE_DEMUX_H #include "srslte/common/log.h" -#include "srslte/common/pdu.h" -#include "srslte/common/pdu_queue.h" #include "srslte/common/timers.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/mac/pdu.h" +#include "srslte/mac/pdu_queue.h" /* Logical Channel Demultiplexing and MAC CE dissassemble */ diff --git a/srsue/hdr/stack/mac/mux.h b/srsue/hdr/stack/mac/mux.h index a2435f036..2a7f1dc17 100644 --- a/srsue/hdr/stack/mac/mux.h +++ b/srsue/hdr/stack/mac/mux.h @@ -30,8 +30,8 @@ #include "proc_phr.h" #include "srslte/common/common.h" #include "srslte/common/log.h" -#include "srslte/common/pdu.h" #include "srslte/interfaces/ue_interfaces.h" +#include "srslte/mac/pdu.h" #include /* Logical Channel Multiplexing and Prioritization + Msg3 Buffer */ diff --git a/srsue/hdr/stack/mac/proc_ra.h b/srsue/hdr/stack/mac/proc_ra.h index 94df2bca3..b46fc5819 100644 --- a/srsue/hdr/stack/mac/proc_ra.h +++ b/srsue/hdr/stack/mac/proc_ra.h @@ -29,8 +29,8 @@ #include "mux.h" #include "srslte/common/log.h" #include "srslte/common/mac_pcap.h" -#include "srslte/common/pdu.h" #include "srslte/common/timers.h" +#include "srslte/mac/pdu.h" /* Random access procedure as specified in Section 5.1 of 36.321 */ diff --git a/srsue/src/CMakeLists.txt b/srsue/src/CMakeLists.txt index 96a5edacf..ace316f74 100644 --- a/srsue/src/CMakeLists.txt +++ b/srsue/src/CMakeLists.txt @@ -37,6 +37,7 @@ target_link_libraries(srsue srsue_phy srsue_mac srsue_rrc srslte_common + srslte_mac srslte_phy srslte_radio srslte_upper diff --git a/srsue/test/CMakeLists.txt b/srsue/test/CMakeLists.txt index 19d6ce9f2..39105855f 100644 --- a/srsue/test/CMakeLists.txt +++ b/srsue/test/CMakeLists.txt @@ -30,5 +30,5 @@ target_link_libraries(metrics_test srslte_phy srslte_common) add_test(metrics_test metrics_test -o ${CMAKE_CURRENT_BINARY_DIR}/ue_metrics.csv) add_executable(mac_test mac_test.cc) -target_link_libraries(mac_test srsue_mac srsue_phy srslte_common srslte_phy srslte_radio srslte_asn1 rrc_asn1 ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) +target_link_libraries(mac_test srsue_mac srsue_phy srslte_common srslte_mac srslte_phy srslte_radio srslte_asn1 rrc_asn1 ${CMAKE_THREAD_LIBS_INIT} ${Boost_LIBRARIES}) add_test(mac_test mac_test) \ No newline at end of file diff --git a/srsue/test/ttcn3/hdr/ttcn3_drb_interface.h b/srsue/test/ttcn3/hdr/ttcn3_drb_interface.h index 3e179bb2c..356fd8e67 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_drb_interface.h +++ b/srsue/test/ttcn3/hdr/ttcn3_drb_interface.h @@ -24,7 +24,7 @@ #include "srslte/common/buffer_pool.h" #include "srslte/common/common.h" -#include "srslte/common/pdu.h" +#include "srslte/mac/pdu.h" #include "ttcn3_interfaces.h" #include "ttcn3_port_handler.h" #include diff --git a/srsue/test/ttcn3/hdr/ttcn3_srb_interface.h b/srsue/test/ttcn3/hdr/ttcn3_srb_interface.h index ee0c5ff1e..eca420152 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_srb_interface.h +++ b/srsue/test/ttcn3/hdr/ttcn3_srb_interface.h @@ -24,7 +24,7 @@ #include "srslte/common/buffer_pool.h" #include "srslte/common/common.h" -#include "srslte/common/pdu.h" +#include "srslte/mac/pdu.h" #include "ttcn3_interfaces.h" #include "ttcn3_port_handler.h" #include diff --git a/srsue/test/ttcn3/hdr/ttcn3_syssim.h b/srsue/test/ttcn3/hdr/ttcn3_syssim.h index cf36c1a2c..37feaa9c6 100644 --- a/srsue/test/ttcn3/hdr/ttcn3_syssim.h +++ b/srsue/test/ttcn3/hdr/ttcn3_syssim.h @@ -23,7 +23,7 @@ #define SRSUE_TTCN3_SYSSIM_H #include "dut_utils.h" -#include "srslte/common/pdu_queue.h" +#include "srslte/mac/pdu_queue.h" #include "srslte/test/ue_test_interfaces.h" #include "srslte/upper/pdcp.h" #include "srslte/upper/rlc.h" diff --git a/srsue/test/ttcn3/src/CMakeLists.txt b/srsue/test/ttcn3/src/CMakeLists.txt index cd1bb26b7..eab13456e 100644 --- a/srsue/test/ttcn3/src/CMakeLists.txt +++ b/srsue/test/ttcn3/src/CMakeLists.txt @@ -24,6 +24,7 @@ target_link_libraries(ttcn3_dut srsue_stack srsue_rrc srslte_upper srslte_common + srslte_mac srslte_phy srslte_radio srslte_upper