strat: use m_ for member variables

This commit is contained in:
Michael Scire 2021-10-10 00:14:06 -07:00
parent ce28591ab2
commit a595c232b9
425 changed files with 8531 additions and 8484 deletions

View file

@ -19,12 +19,12 @@
namespace ams::i2c::server {
ManagerImpl::ManagerImpl() {
this->heap_handle = lmem::CreateExpHeap(this->heap_buffer, sizeof(this->heap_buffer), lmem::CreateOption_None);
this->allocator.Attach(this->heap_handle);
m_heap_handle = lmem::CreateExpHeap(m_heap_buffer, sizeof(m_heap_buffer), lmem::CreateOption_None);
m_allocator.Attach(m_heap_handle);
}
ManagerImpl::~ManagerImpl() {
lmem::DestroyExpHeap(this->heap_handle);
lmem::DestroyExpHeap(m_heap_handle);
}
Result ManagerImpl::OpenSessionForDev(ams::sf::Out<ams::sf::SharedPointer<i2c::sf::ISession>> out, s32 bus_idx, u16 slave_address, i2c::AddressingMode addressing_mode, i2c::SpeedMode speed_mode) {
@ -51,7 +51,7 @@ namespace ams::i2c::server {
Result ManagerImpl::OpenSession2(ams::sf::Out<ams::sf::SharedPointer<i2c::sf::ISession>> out, DeviceCode device_code) {
/* Allocate a session. */
auto session = Factory::CreateSharedEmplaced<i2c::sf::ISession, SessionImpl>(std::addressof(this->allocator), this);
auto session = Factory::CreateSharedEmplaced<i2c::sf::ISession, SessionImpl>(std::addressof(m_allocator), this);
/* Open the session. */
R_TRY(session.GetImpl().OpenSession(device_code));

View file

@ -24,9 +24,9 @@ namespace ams::i2c::server {
using Allocator = ams::sf::ExpHeapAllocator;
using Factory = ams::sf::ObjectFactory<Allocator::Policy>;
private:
lmem::HeapHandle heap_handle;
Allocator allocator;
u8 heap_buffer[4_KB];
lmem::HeapHandle m_heap_handle;
Allocator m_allocator;
u8 m_heap_buffer[4_KB];
public:
ManagerImpl();

View file

@ -22,53 +22,53 @@ namespace ams::i2c::server {
class SessionImpl {
private:
ManagerImpl *parent; /* NOTE: this is an sf::SharedPointer<> in Nintendo's code. */
i2c::driver::I2cSession internal_session;
bool has_session;
ManagerImpl *m_parent; /* NOTE: this is an sf::SharedPointer<> in Nintendo's code. */
i2c::driver::I2cSession m_internal_session;
bool m_has_session;
public:
explicit SessionImpl(ManagerImpl *p) : parent(p), has_session(false) { /* ... */ }
explicit SessionImpl(ManagerImpl *p) : m_parent(p), m_has_session(false) { /* ... */ }
~SessionImpl() {
if (this->has_session) {
i2c::driver::CloseSession(this->internal_session);
if (m_has_session) {
i2c::driver::CloseSession(m_internal_session);
}
}
Result OpenSession(DeviceCode device_code) {
AMS_ABORT_UNLESS(!this->has_session);
AMS_ABORT_UNLESS(!m_has_session);
R_TRY(i2c::driver::OpenSession(std::addressof(this->internal_session), device_code));
this->has_session = true;
R_TRY(i2c::driver::OpenSession(std::addressof(m_internal_session), device_code));
m_has_session = true;
return ResultSuccess();
}
public:
/* Actual commands. */
Result SendOld(const ams::sf::InBuffer &in_data, i2c::TransactionOption option) {
return i2c::driver::Send(this->internal_session, in_data.GetPointer(), in_data.GetSize(), option);
return i2c::driver::Send(m_internal_session, in_data.GetPointer(), in_data.GetSize(), option);
}
Result ReceiveOld(const ams::sf::OutBuffer &out_data, i2c::TransactionOption option) {
return i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), this->internal_session, option);
return i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), m_internal_session, option);
}
Result ExecuteCommandListOld(const ams::sf::OutBuffer &rcv_buf, const ams::sf::InPointerArray<i2c::I2cCommand> &command_list){
return i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), this->internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand));
return i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), m_internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand));
}
Result Send(const ams::sf::InAutoSelectBuffer &in_data, i2c::TransactionOption option) {
return i2c::driver::Send(this->internal_session, in_data.GetPointer(), in_data.GetSize(), option);
return i2c::driver::Send(m_internal_session, in_data.GetPointer(), in_data.GetSize(), option);
}
Result Receive(const ams::sf::OutAutoSelectBuffer &out_data, i2c::TransactionOption option) {
return i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), this->internal_session, option);
return i2c::driver::Receive(out_data.GetPointer(), out_data.GetSize(), m_internal_session, option);
}
Result ExecuteCommandList(const ams::sf::OutAutoSelectBuffer &rcv_buf, const ams::sf::InPointerArray<i2c::I2cCommand> &command_list) {
return i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), this->internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand));
return i2c::driver::ExecuteCommandList(rcv_buf.GetPointer(), rcv_buf.GetSize(), m_internal_session, command_list.GetPointer(), command_list.GetSize() * sizeof(i2c::I2cCommand));
}
Result SetRetryPolicy(s32 max_retry_count, s32 retry_interval_us) {
return i2c::driver::SetRetryPolicy(this->internal_session, max_retry_count, retry_interval_us);
return i2c::driver::SetRetryPolicy(m_internal_session, max_retry_count, retry_interval_us);
}
};
static_assert(i2c::sf::IsISession<SessionImpl>);