move AOTAG to BPMP
This commit is contained in:
1 parent
0262236d2c
commit
3141d0ea2e
4 files changed
+62
-19
No files matched your search
@@ -0,0 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2014 - 2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) Souldbminer, Lightos and Horizon OC Contributors
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
* version 2, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "regs.hpp"
|
||||
|
||||
#include <hocclk/bpmp.h>
|
||||
|
||||
namespace aotag {
|
||||
|
||||
constexpr u32 PmcBase = 0x7000E400;
|
||||
constexpr u32 PmcTsensorStatus1 = 0x4AC;
|
||||
|
||||
constexpr u32 Status1ValidBit = (1u << 31);
|
||||
constexpr u32 Status1AbsShift = 8;
|
||||
constexpr u32 Status1AbsMask = 0xFF;
|
||||
constexpr u32 Status1FracBit = (1u << 7);
|
||||
constexpr u32 Status1SignBit = (1u << 0);
|
||||
|
||||
constexpr s32 InvalidSentinel = -125;
|
||||
|
||||
inline void Update(HocClkBpmpSharedInfo &info) {
|
||||
const u32 regval = MMIO32(PmcBase + PmcTsensorStatus1);
|
||||
|
||||
if (!(regval & Status1ValidBit)) {
|
||||
info.tempAO = InvalidSentinel;
|
||||
return;
|
||||
}
|
||||
|
||||
const u32 abs = (regval >> Status1AbsShift) & Status1AbsMask;
|
||||
const bool frac = (regval & Status1FracBit) != 0;
|
||||
const bool negative = (regval & Status1SignBit) != 0;
|
||||
|
||||
s32 temp = static_cast<s32>(abs) * 1000 + (frac ? 500 : 0);
|
||||
if (negative) {
|
||||
temp = -temp;
|
||||
}
|
||||
|
||||
info.tempAO = temp;
|
||||
}
|
||||
|
||||
} // namespace aotag
|
||||
@@ -19,6 +19,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "actmon.hpp"
|
||||
#include "aotag.hpp"
|
||||
#include "bpmp_mmu.hpp"
|
||||
#include "freq.hpp"
|
||||
#include "libc_platform.hpp"
|
||||
@@ -53,6 +54,7 @@ void MainLoop(HocClkBpmpSharedInfo &info) {
|
||||
|
||||
freq::Update(info);
|
||||
actmon::Update(info);
|
||||
aotag::Update(info);
|
||||
|
||||
msleep(250);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user