namespace sts -> namespace ams
namespace sts::ams -> ams::exosphere, ams::. This is to facilitate future use of ams:: namespace code in mesosphere, as we'll want to include ams::util, ams::result, ams::svc...
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#include "i2c_pcv.hpp"
|
||||
#include "i2c_bus_accessor.hpp"
|
||||
|
||||
namespace sts::i2c::driver::impl {
|
||||
namespace ams::i2c::driver::impl {
|
||||
|
||||
void BusAccessor::Open(Bus bus, SpeedMode speed_mode) {
|
||||
std::scoped_lock lk(this->open_mutex);
|
||||
@@ -29,7 +29,7 @@ namespace sts::i2c::driver::impl {
|
||||
|
||||
/* Ensure we're good if this isn't our first session. */
|
||||
if (this->open_sessions > 1) {
|
||||
STS_ASSERT(this->speed_mode == speed_mode);
|
||||
AMS_ASSERT(this->speed_mode == speed_mode);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ namespace sts::i2c::driver::impl {
|
||||
0x46, 0x74, 0x7C, 0x98, 0x55, 0x5F
|
||||
};
|
||||
const auto index = ConvertToIndex(bus);
|
||||
STS_ASSERT(index < util::size(s_interrupts));
|
||||
AMS_ASSERT(index < util::size(s_interrupts));
|
||||
R_ASSERT(this->interrupt_event.Initialize(s_interrupts[index], false));
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace sts::i2c::driver::impl {
|
||||
src_div = 0x02;
|
||||
debounce = 0;
|
||||
break;
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
|
||||
if (speed_mode == SpeedMode::HighSpeed) {
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "i2c_driver_types.hpp"
|
||||
#include "i2c_registers.hpp"
|
||||
|
||||
namespace sts::i2c::driver::impl {
|
||||
namespace ams::i2c::driver::impl {
|
||||
|
||||
class BusAccessor {
|
||||
private:
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "i2c_driver_types.hpp"
|
||||
|
||||
namespace sts::i2c::driver::impl {
|
||||
namespace ams::i2c::driver::impl {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -88,37 +88,37 @@ namespace sts::i2c::driver::impl {
|
||||
|
||||
Bus GetDeviceBus(I2cDevice dev) {
|
||||
const size_t dev_idx = GetDeviceIndex(dev);
|
||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
return g_device_configs[dev_idx].bus;
|
||||
}
|
||||
|
||||
u32 GetDeviceSlaveAddress(I2cDevice dev) {
|
||||
const size_t dev_idx = GetDeviceIndex(dev);
|
||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
return g_device_configs[dev_idx].slave_address;
|
||||
}
|
||||
|
||||
AddressingMode GetDeviceAddressingMode(I2cDevice dev) {
|
||||
const size_t dev_idx = GetDeviceIndex(dev);
|
||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
return g_device_configs[dev_idx].addressing_mode;
|
||||
}
|
||||
|
||||
SpeedMode GetDeviceSpeedMode(I2cDevice dev) {
|
||||
const size_t dev_idx = GetDeviceIndex(dev);
|
||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
return g_device_configs[dev_idx].speed_mode;
|
||||
}
|
||||
|
||||
u32 GetDeviceMaxRetries(I2cDevice dev) {
|
||||
const size_t dev_idx = GetDeviceIndex(dev);
|
||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
return g_device_configs[dev_idx].max_retries;
|
||||
}
|
||||
|
||||
u64 GetDeviceRetryWaitTime(I2cDevice dev) {
|
||||
const size_t dev_idx = GetDeviceIndex(dev);
|
||||
STS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
AMS_ASSERT(dev_idx != DeviceInvalidIndex);
|
||||
return g_device_configs[dev_idx].retry_wait_time;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "../../i2c_types.hpp"
|
||||
|
||||
namespace sts::i2c::driver::impl {
|
||||
namespace ams::i2c::driver::impl {
|
||||
|
||||
enum class Command {
|
||||
Send = 0,
|
||||
@@ -43,7 +43,7 @@ namespace sts::i2c::driver::impl {
|
||||
}
|
||||
|
||||
constexpr inline Bus ConvertFromIndex(size_t idx) {
|
||||
STS_ASSERT(idx < static_cast<size_t>(Bus::Count));
|
||||
AMS_ASSERT(idx < static_cast<size_t>(Bus::Count));
|
||||
return static_cast<Bus>(idx);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace sts::i2c::driver::impl {
|
||||
return PcvModule_I2C5;
|
||||
case Bus::I2C6:
|
||||
return PcvModule_I2C6;
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace sts::i2c::driver::impl {
|
||||
return Bus::I2C5;
|
||||
case PcvModule_I2C6:
|
||||
return Bus::I2C6;
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
/* This forward declares the functionality from pcv that i2c::driver uses. */
|
||||
/* This allows for overriding at compile-time (e.g., for boot sysmodule). */
|
||||
namespace sts::pcv {
|
||||
namespace ams::pcv {
|
||||
|
||||
void Initialize();
|
||||
void Finalize();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#include "i2c_driver_types.hpp"
|
||||
|
||||
namespace sts::i2c::driver::impl {
|
||||
namespace ams::i2c::driver::impl {
|
||||
|
||||
struct Registers {
|
||||
volatile u32 I2C_I2C_CNFG_0;
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include "i2c_pcv.hpp"
|
||||
#include "i2c_resource_manager.hpp"
|
||||
|
||||
namespace sts::i2c::driver::impl {
|
||||
namespace ams::i2c::driver::impl {
|
||||
|
||||
void ResourceManager::Initialize() {
|
||||
std::scoped_lock lk(this->initialize_mutex);
|
||||
@@ -29,7 +29,7 @@ namespace sts::i2c::driver::impl {
|
||||
|
||||
void ResourceManager::Finalize() {
|
||||
std::scoped_lock lk(this->initialize_mutex);
|
||||
STS_ASSERT(this->ref_cnt > 0);
|
||||
AMS_ASSERT(this->ref_cnt > 0);
|
||||
this->ref_cnt--;
|
||||
if (this->ref_cnt > 0) {
|
||||
return;
|
||||
@@ -59,11 +59,11 @@ namespace sts::i2c::driver::impl {
|
||||
/* Get, open session. */
|
||||
{
|
||||
std::scoped_lock lk(this->session_open_mutex);
|
||||
STS_ASSERT(out_session != nullptr);
|
||||
STS_ASSERT(bus < Bus::Count);
|
||||
AMS_ASSERT(out_session != nullptr);
|
||||
AMS_ASSERT(bus < Bus::Count);
|
||||
|
||||
session_id = GetFreeSessionId();
|
||||
STS_ASSERT(session_id != InvalidSessionId);
|
||||
AMS_ASSERT(session_id != InvalidSessionId);
|
||||
|
||||
|
||||
if ((bus == Bus::I2C2 || bus == Bus::I2C3) && (this->bus_accessors[ConvertToIndex(Bus::I2C2)].GetOpenSessions() == 0 && this->bus_accessors[ConvertToIndex(Bus::I2C3)].GetOpenSessions() == 0)) {
|
||||
@@ -90,7 +90,7 @@ namespace sts::i2c::driver::impl {
|
||||
/* Get, open session. */
|
||||
{
|
||||
std::scoped_lock lk(this->session_open_mutex);
|
||||
STS_ASSERT(this->sessions[session.session_id].IsOpen());
|
||||
AMS_ASSERT(this->sessions[session.session_id].IsOpen());
|
||||
|
||||
this->sessions[session.session_id].Close();
|
||||
|
||||
@@ -109,7 +109,7 @@ namespace sts::i2c::driver::impl {
|
||||
}
|
||||
|
||||
void ResourceManager::SuspendBuses() {
|
||||
STS_ASSERT(this->ref_cnt > 0);
|
||||
AMS_ASSERT(this->ref_cnt > 0);
|
||||
|
||||
if (!this->suspended) {
|
||||
{
|
||||
@@ -128,7 +128,7 @@ namespace sts::i2c::driver::impl {
|
||||
}
|
||||
|
||||
void ResourceManager::ResumeBuses() {
|
||||
STS_ASSERT(this->ref_cnt > 0);
|
||||
AMS_ASSERT(this->ref_cnt > 0);
|
||||
|
||||
if (this->suspended) {
|
||||
if (this->bus_accessors[ConvertToIndex(Bus::I2C2)].GetOpenSessions() > 0 || this->bus_accessors[ConvertToIndex(Bus::I2C3)].GetOpenSessions() > 0) {
|
||||
@@ -151,7 +151,7 @@ namespace sts::i2c::driver::impl {
|
||||
}
|
||||
|
||||
void ResourceManager::SuspendPowerBus() {
|
||||
STS_ASSERT(this->ref_cnt > 0);
|
||||
AMS_ASSERT(this->ref_cnt > 0);
|
||||
std::scoped_lock lk(this->session_open_mutex);
|
||||
|
||||
if (!this->power_bus_suspended) {
|
||||
@@ -163,7 +163,7 @@ namespace sts::i2c::driver::impl {
|
||||
}
|
||||
|
||||
void ResourceManager::ResumePowerBus() {
|
||||
STS_ASSERT(this->ref_cnt > 0);
|
||||
AMS_ASSERT(this->ref_cnt > 0);
|
||||
std::scoped_lock lk(this->session_open_mutex);
|
||||
|
||||
if (this->power_bus_suspended) {
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "i2c_bus_accessor.hpp"
|
||||
#include "i2c_session.hpp"
|
||||
|
||||
namespace sts::i2c::driver::impl {
|
||||
namespace ams::i2c::driver::impl {
|
||||
|
||||
class ResourceManager {
|
||||
public:
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#include "i2c_session.hpp"
|
||||
|
||||
namespace sts::i2c::driver::impl {
|
||||
namespace ams::i2c::driver::impl {
|
||||
|
||||
void Session::Open(Bus bus, u32 slave_address, AddressingMode addr_mode, SpeedMode speed_mode, BusAccessor *bus_accessor, u32 max_retries, u64 retry_wait_time) {
|
||||
std::scoped_lock lk(this->bus_accessor_mutex);
|
||||
@@ -74,7 +74,7 @@ namespace sts::i2c::driver::impl {
|
||||
case Command::Receive:
|
||||
R_TRY(this->bus_accessor->Receive(reinterpret_cast<u8 *>(dst), num_bytes, option, this->addressing_mode, this->slave_address));
|
||||
break;
|
||||
STS_UNREACHABLE_DEFAULT_CASE();
|
||||
AMS_UNREACHABLE_DEFAULT_CASE();
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "i2c_driver_types.hpp"
|
||||
#include "i2c_bus_accessor.hpp"
|
||||
|
||||
namespace sts::i2c::driver::impl {
|
||||
namespace ams::i2c::driver::impl {
|
||||
|
||||
class Session {
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user