diff options
author | Evan Lojewski <github@meklort.com> | 2019-06-29 11:34:55 -0600 |
---|---|---|
committer | Evan Lojewski <github@meklort.com> | 2019-06-29 11:34:55 -0600 |
commit | 4e9143d8ab7fe77339946b7bc37eec0820b00f2e (patch) | |
tree | 02c137f81b03b4f11daa244d87821a5f524b4030 /simulator | |
parent | 99dd644512cfef951ade6d2403a8cf2f43666b94 (diff) | |
download | bcm5719-ortega-4e9143d8ab7fe77339946b7bc37eec0820b00f2e.tar.gz bcm5719-ortega-4e9143d8ab7fe77339946b7bc37eec0820b00f2e.zip |
SPlit the MIPS hal from the APE hal in the simulation code.
Diffstat (limited to 'simulator')
-rw-r--r-- | simulator/APE_HAL.cpp | 113 | ||||
-rw-r--r-- | simulator/CMakeLists.txt | 1 | ||||
-rw-r--r-- | simulator/HAL.cpp | 92 | ||||
-rw-r--r-- | simulator/include/HAL.hpp | 11 |
4 files changed, 163 insertions, 54 deletions
diff --git a/simulator/APE_HAL.cpp b/simulator/APE_HAL.cpp new file mode 100644 index 0000000..5f968e2 --- /dev/null +++ b/simulator/APE_HAL.cpp @@ -0,0 +1,113 @@ +//////////////////////////////////////////////////////////////////////////////// +/// +/// @file APE_HAL.cpp +/// +/// @project +/// +/// @brief C++ Register wrapper code for the APE +/// +//////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////// +/// +/// @copyright Copyright (c) 2019, Evan Lojewski +/// @cond +/// +/// All rights reserved. +/// +/// Redistribution and use in source and binary forms, with or without +/// modification, are permitted provided that the following conditions are met: +/// 1. Redistributions of source code must retain the above copyright notice, +/// this list of conditions and the following disclaimer. +/// 2. Redistributions in binary form must reproduce the above copyright notice, +/// this list of conditions and the following disclaimer in the documentation +/// and/or other materials provided with the distribution. +/// 3. Neither the name of the copyright holder nor the +/// names of its contributors may be used to endorse or promote products +/// derived from this software without specific prior written permission. +/// +//////////////////////////////////////////////////////////////////////////////// +/// +/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +/// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +/// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +/// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +/// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +/// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +/// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +/// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +/// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +/// POSSIBILITY OF SUCH DAMAGE. +/// @endcond +//////////////////////////////////////////////////////////////////////////////// + +#include <HAL.hpp> +#include <APE_NVIC.h> +#include <APE_FILTERS0.h> +#include <APE_FILTERS1.h> +#include <APE_FILTERS2.h> +#include <APE_FILTERS3.h> +#include <APE_TX_PORT0.h> +#include <APE_RX_PORT0.h> +#include <APE_TX_PORT1.h> +#include <APE_RX_PORT1.h> +#include <APE_TX_PORT2.h> +#include <APE_RX_PORT2.h> +#include <APE_TX_PORT3.h> +#include <APE_RX_PORT3.h> +#include <APE_DEVICE.h> +#include <APE_DEVICE1.h> +#include <APE_DEVICE2.h> +#include <APE_DEVICE3.h> + +void initAPEHAL(void) +{ + // init_APE_DEVICE0(); + // init_APE_DEVICE0_sim(NULL); + init_APE_DEVICE1(); + init_APE_DEVICE1_sim(NULL); + init_APE_DEVICE2(); + init_APE_DEVICE2_sim(NULL); + init_APE_DEVICE3(); + init_APE_DEVICE3_sim(NULL); + + init_APE_FILTERS0(); + init_APE_FILTERS0_sim(NULL); + + init_APE_FILTERS1(); + init_APE_FILTERS1_sim(NULL); + + init_APE_FILTERS2(); + init_APE_FILTERS2_sim(NULL); + + init_APE_FILTERS3(); + init_APE_FILTERS3_sim(NULL); + + init_APE_NVIC(); + init_APE_NVIC_sim(NULL); + + init_APE_TX_PORT0(); + init_APE_TX_PORT0_sim(NULL); + + init_APE_RX_PORT0(); + init_APE_RX_PORT0_sim(NULL); + + init_APE_TX_PORT1(); + init_APE_TX_PORT1_sim(NULL); + + init_APE_RX_PORT1(); + init_APE_RX_PORT1_sim(NULL); + + init_APE_TX_PORT2(); + init_APE_TX_PORT2_sim(NULL); + + init_APE_RX_PORT2(); + init_APE_RX_PORT2_sim(NULL); + + init_APE_TX_PORT3(); + init_APE_TX_PORT3_sim(NULL); + + init_APE_RX_PORT3(); + init_APE_RX_PORT3_sim(NULL); +}
\ No newline at end of file diff --git a/simulator/CMakeLists.txt b/simulator/CMakeLists.txt index d8061ab..20302a3 100644 --- a/simulator/CMakeLists.txt +++ b/simulator/CMakeLists.txt @@ -27,6 +27,7 @@ simulator_add_library(${PROJECT_NAME} STATIC bcm5719_SHM_CHANNEL3_sim.cpp # APE indirect registers + APE_HAL.cpp APE_FILTERS0.cpp APE_FILTERS0_sim.cpp APE_NVIC.cpp diff --git a/simulator/HAL.cpp b/simulator/HAL.cpp index 90ca052..2342840 100644 --- a/simulator/HAL.cpp +++ b/simulator/HAL.cpp @@ -1,3 +1,46 @@ +//////////////////////////////////////////////////////////////////////////////// +/// +/// @file HAL.cpp +/// +/// @project +/// +/// @brief C++ Register wrapper code +/// +//////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////// +/// +/// @copyright Copyright (c) 2019, Evan Lojewski +/// @cond +/// +/// All rights reserved. +/// +/// Redistribution and use in source and binary forms, with or without +/// modification, are permitted provided that the following conditions are met: +/// 1. Redistributions of source code must retain the above copyright notice, +/// this list of conditions and the following disclaimer. +/// 2. Redistributions in binary form must reproduce the above copyright notice, +/// this list of conditions and the following disclaimer in the documentation +/// and/or other materials provided with the distribution. +/// 3. Neither the name of the copyright holder nor the +/// names of its contributors may be used to endorse or promote products +/// derived from this software without specific prior written permission. +/// +//////////////////////////////////////////////////////////////////////////////// +/// +/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +/// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +/// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +/// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +/// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +/// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +/// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +/// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +/// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +/// POSSIBILITY OF SUCH DAMAGE. +/// @endcond +//////////////////////////////////////////////////////////////////////////////// #include "../libs/NVRam/bcm5719_NVM.h" #include "pci_config.h" @@ -10,19 +53,6 @@ #include <bcm5719_SHM_CHANNEL2.h> #include <bcm5719_SHM_CHANNEL3.h> #include <bcm5719_GEN.h> -#include <APE_NVIC.h> -#include <APE_FILTERS0.h> -#include <APE_TX_PORT0.h> -#include <APE_RX_PORT0.h> -#include <APE_TX_PORT1.h> -#include <APE_RX_PORT1.h> -#include <APE_TX_PORT2.h> -#include <APE_RX_PORT2.h> -#include <APE_TX_PORT3.h> -#include <APE_RX_PORT3.h> -// #include <APE_DEVICE1.h> -// #include <APE_DEVICE2.h> -// #include <APE_DEVICE3.h> #include <dirent.h> #include <endian.h> @@ -302,41 +332,5 @@ bool initHAL(const char *pci_path, int wanted_function) init_bcm5719_SHM_CHANNEL3(); init_bcm5719_SHM_CHANNEL3_sim(&APEBase[0x4c00]); - init_APE_FILTERS0(); - init_APE_FILTERS0_sim(NULL); - - init_APE_NVIC(); - init_APE_NVIC_sim(NULL); - - init_APE_TX_PORT0(); - init_APE_TX_PORT0_sim(NULL); - - init_APE_RX_PORT0(); - init_APE_RX_PORT0_sim(NULL); - - init_APE_TX_PORT1(); - init_APE_TX_PORT1_sim(NULL); - - init_APE_RX_PORT1(); - init_APE_RX_PORT1_sim(NULL); - - init_APE_TX_PORT2(); - init_APE_TX_PORT2_sim(NULL); - - init_APE_RX_PORT2(); - init_APE_RX_PORT2_sim(NULL); - - init_APE_TX_PORT3(); - init_APE_TX_PORT3_sim(NULL); - - init_APE_RX_PORT3(); - init_APE_RX_PORT3_sim(NULL); - - // init_APE_DEVICE1(); - // init_APE_DEVICE1_sim(NULL); - // init_APE_DEVICE2(); - // init_APE_DEVICE2_sim(NULL); - // init_APE_DEVICE3(); - // init_APE_DEVICE3_sim(NULL); return true; } diff --git a/simulator/include/HAL.hpp b/simulator/include/HAL.hpp index 198b782..4898f2c 100644 --- a/simulator/include/HAL.hpp +++ b/simulator/include/HAL.hpp @@ -2,15 +2,15 @@ /// /// @file HAL.h /// -/// @project +/// @project /// -/// @brief C++ REgister wrapper code +/// @brief C++ Register wrapper code /// //////////////////////////////////////////////////////////////////////////////// /// //////////////////////////////////////////////////////////////////////////////// /// -/// @copyright Copyright (c) 2018, Evan Lojewski +/// @copyright Copyright (c) 2019, Evan Lojewski /// @cond /// /// All rights reserved. @@ -45,11 +45,12 @@ #ifndef HAL_H #define HAL_H -#include <bcm5719_DEVICE.h> -#include <bcm5719_APE.h> +#include <stdint.h> +#include <stdbool.h> bool is_supported(uint16_t vendor_id, uint16_t device_id); bool initHAL(const char* pci_path, int wanted_function = 0); +void initAPEHAL(void); extern uint8_t *gDEVICEBase; extern uint8_t *gAPEBase; |