diff options
author | Evan Lojewski <github@meklort.com> | 2019-02-26 21:48:11 -0700 |
---|---|---|
committer | Evan Lojewski <github@meklort.com> | 2019-02-26 21:48:11 -0700 |
commit | e5a53938bb925fabfabc44e8911d611c5ee45458 (patch) | |
tree | d1d76086e04c13b14bd5e91f3f714b40708e438c /libs | |
parent | ffe607d0c2c0b8c3f58d8855cef2b50aa538ca19 (diff) | |
download | bcm5719-ortega-e5a53938bb925fabfabc44e8911d611c5ee45458.tar.gz bcm5719-ortega-e5a53938bb925fabfabc44e8911d611c5ee45458.zip |
Add an initial APE library to allow locking and un-locking.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/APE/CMakeLists.txt | 57 | ||||
-rw-r--r-- | libs/APE/ape.c | 106 | ||||
-rw-r--r-- | libs/APE/include/APE.h | 52 | ||||
-rw-r--r-- | libs/CMakeLists.txt | 1 |
4 files changed, 216 insertions, 0 deletions
diff --git a/libs/APE/CMakeLists.txt b/libs/APE/CMakeLists.txt new file mode 100644 index 0000000..446f125 --- /dev/null +++ b/libs/APE/CMakeLists.txt @@ -0,0 +1,57 @@ +################################################################################ +### +### @file libs/APE/CMakeLists.txt +### +### @project +### +### @brief APE CMake file +### +################################################################################ +### +################################################################################ +### +### @copyright Copyright (c) 2018, 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 +################################################################################ + +project(APE) + + +# Host Simulation library +simulator_add_library(${PROJECT_NAME} STATIC ape.c) +target_link_libraries(${PROJECT_NAME} PRIVATE simulator) +target_include_directories(${PROJECT_NAME} PUBLIC ../../include) +target_include_directories(${PROJECT_NAME} PUBLIC include) + +# MIPS Library +mips_add_library(${PROJECT_NAME}-mips STATIC ape.c) +target_include_directories(${PROJECT_NAME}-mips PUBLIC ../../include) +target_include_directories(${PROJECT_NAME}-mips PUBLIC include) diff --git a/libs/APE/ape.c b/libs/APE/ape.c new file mode 100644 index 0000000..aca7475 --- /dev/null +++ b/libs/APE/ape.c @@ -0,0 +1,106 @@ +//////////////////////////////////////////////////////////////////////////////// +/// +/// @file ape.c +/// +/// @project +/// +/// @brief APE Support Routines +/// +//////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////// +/// +/// @copyright Copyright (c) 2018, 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 "bcm5719_APE.h" +#include "bcm5719_DEVICE.h" + +void APE_aquireLock(void) +{ + uint8_t function = DEVICE.Status.bits.FunctionNumber; + switch(function) + { + default: + case 0: + APE.PerLockRequestPhy0.r32 = 0x10; + do + { + // spin + } while(0x10 != APE.PerLockGrantPhy0.r32); + return; + + case 1: + APE.PerLockRequestPhy1.r32 = 0x10; + do + { + // spin + } while(0x10 != APE.PerLockGrantPhy1.r32); + return; + + case 2: + APE.PerLockRequestPhy2.r32 = 0x10; + do + { + // spin + } while(0x10 != APE.PerLockGrantPhy2.r32); + return; + + case 3: + APE.PerLockRequestPhy3.r32 = 0x10; + do + { + // spin + } while(0x10 != APE.PerLockGrantPhy3.r32); + return; + } + +} + +void APE_releaseLock(void) +{ + uint8_t function = DEVICE.Status.bits.FunctionNumber; + switch(function) + { + default: + case 0: + APE.PerLockGrantPhy0.r32 = 0x10; + + case 1: + APE.PerLockGrantPhy1.r32 = 0x10; + + case 2: + APE.PerLockGrantPhy2.r32 = 0x10; + + case 3: + APE.PerLockGrantPhy3.r32 = 0x10; + } +}
\ No newline at end of file diff --git a/libs/APE/include/APE.h b/libs/APE/include/APE.h new file mode 100644 index 0000000..a7d1fc3 --- /dev/null +++ b/libs/APE/include/APE.h @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////////////////////////// +/// +/// @file APE.h +/// +/// @project +/// +/// @brief APE Support Routines +/// +//////////////////////////////////////////////////////////////////////////////// +/// +//////////////////////////////////////////////////////////////////////////////// +/// +/// @copyright Copyright (c) 2018, 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 +//////////////////////////////////////////////////////////////////////////////// + +#ifndef APE_H +#define APE_H + +void APE_aquireLock(void); + +void APE_releaseLock(void); + +#endif /* APE_H */ diff --git a/libs/CMakeLists.txt b/libs/CMakeLists.txt index 1093020..79cebcb 100644 --- a/libs/CMakeLists.txt +++ b/libs/CMakeLists.txt @@ -44,6 +44,7 @@ add_subdirectory(NVRam) +add_subdirectory(APE) add_subdirectory(MII) add_subdirectory(VPD) |