mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-04 16:53:48 -04:00
strat: use m_ for member variables
This commit is contained in:
parent
ce28591ab2
commit
a595c232b9
425 changed files with 8531 additions and 8484 deletions
|
@ -21,30 +21,30 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
|
||||
void InterruptEventHandler::Initialize(DriverImpl *drv, os::InterruptName intr, int ctlr) {
|
||||
/* Set fields. */
|
||||
this->driver = drv;
|
||||
this->interrupt_name = intr;
|
||||
this->controller_number = ctlr;
|
||||
m_driver = drv;
|
||||
m_interrupt_name = intr;
|
||||
m_controller_number = ctlr;
|
||||
|
||||
/* Initialize interrupt event. */
|
||||
os::InitializeInterruptEvent(std::addressof(this->interrupt_event), intr, os::EventClearMode_ManualClear);
|
||||
os::InitializeInterruptEvent(std::addressof(m_interrupt_event), intr, os::EventClearMode_ManualClear);
|
||||
|
||||
/* Initialize base. */
|
||||
IEventHandler::Initialize(std::addressof(this->interrupt_event));
|
||||
IEventHandler::Initialize(std::addressof(m_interrupt_event));
|
||||
}
|
||||
|
||||
void InterruptEventHandler::HandleEvent() {
|
||||
/* Lock the driver's interrupt mutex. */
|
||||
std::scoped_lock lk(this->driver->interrupt_control_mutex);
|
||||
std::scoped_lock lk(m_driver->m_interrupt_control_mutex);
|
||||
|
||||
/* Check each pad. */
|
||||
bool found = false;
|
||||
for (auto it = this->driver->interrupt_pad_list.begin(); !found && it != this->driver->interrupt_pad_list.end(); ++it) {
|
||||
for (auto it = m_driver->m_interrupt_pad_list.begin(); !found && it != m_driver->m_interrupt_pad_list.end(); ++it) {
|
||||
found = this->CheckAndHandleInterrupt(*it);
|
||||
}
|
||||
|
||||
/* If we didn't find a pad, clear the interrupt event. */
|
||||
if (!found) {
|
||||
os::ClearInterruptEvent(std::addressof(this->interrupt_event));
|
||||
os::ClearInterruptEvent(std::addressof(m_interrupt_event));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,13 +53,13 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
const InternalGpioPadNumber pad_number = static_cast<InternalGpioPadNumber>(pad.GetPadNumber());
|
||||
|
||||
/* Check if the pad matches our controller number. */
|
||||
if (this->controller_number != ConvertInternalGpioPadNumberToController(pad_number)) {
|
||||
if (m_controller_number != ConvertInternalGpioPadNumberToController(pad_number)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Get the addresses of INT_STA, INT_ENB. */
|
||||
const uintptr_t sta_address = GetGpioRegisterAddress(this->driver->gpio_virtual_address, GpioRegisterType_GPIO_INT_STA, pad_number);
|
||||
const uintptr_t enb_address = GetGpioRegisterAddress(this->driver->gpio_virtual_address, GpioRegisterType_GPIO_INT_STA, pad_number);
|
||||
const uintptr_t sta_address = GetGpioRegisterAddress(m_driver->m_gpio_virtual_address, GpioRegisterType_GPIO_INT_STA, pad_number);
|
||||
const uintptr_t enb_address = GetGpioRegisterAddress(m_driver->m_gpio_virtual_address, GpioRegisterType_GPIO_INT_STA, pad_number);
|
||||
const uintptr_t pad_index = ConvertInternalGpioPadNumberToBitIndex(pad_number);
|
||||
|
||||
/* Check if both STA and ENB are set. */
|
||||
|
@ -73,10 +73,10 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
|
||||
/* Disable the interrupt on the pad. */
|
||||
pad.SetInterruptEnabled(false);
|
||||
this->driver->RemoveInterruptPad(std::addressof(pad));
|
||||
m_driver->RemoveInterruptPad(std::addressof(pad));
|
||||
|
||||
/* Clear the interrupt event. */
|
||||
os::ClearInterruptEvent(std::addressof(this->interrupt_event));
|
||||
os::ClearInterruptEvent(std::addressof(m_interrupt_event));
|
||||
|
||||
/* Signal the pad's bound event. */
|
||||
pad.SignalInterruptBoundEvent();
|
||||
|
@ -84,15 +84,15 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
return true;
|
||||
}
|
||||
|
||||
DriverImpl::DriverImpl(dd::PhysicalAddress reg_paddr, size_t size) : gpio_physical_address(reg_paddr), gpio_virtual_address(), suspend_handler(this), interrupt_pad_list(), interrupt_control_mutex() {
|
||||
DriverImpl::DriverImpl(dd::PhysicalAddress reg_paddr, size_t size) : m_gpio_physical_address(reg_paddr), m_gpio_virtual_address(), m_suspend_handler(this), m_interrupt_pad_list(), m_interrupt_control_mutex() {
|
||||
/* Get the corresponding virtual address for our physical address. */
|
||||
this->gpio_virtual_address = dd::QueryIoMapping(reg_paddr, size);
|
||||
AMS_ABORT_UNLESS(this->gpio_virtual_address != 0);
|
||||
m_gpio_virtual_address = dd::QueryIoMapping(reg_paddr, size);
|
||||
AMS_ABORT_UNLESS(m_gpio_virtual_address != 0);
|
||||
}
|
||||
|
||||
void DriverImpl::InitializeDriver() {
|
||||
/* Initialize our suspend handler. */
|
||||
this->suspend_handler.Initialize(this->gpio_virtual_address);
|
||||
m_suspend_handler.Initialize(m_gpio_virtual_address);
|
||||
}
|
||||
|
||||
void DriverImpl::FinalizeDriver() {
|
||||
|
@ -107,7 +107,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
const InternalGpioPadNumber pad_number = pad->GetPadNumber();
|
||||
|
||||
/* Configure the pad as GPIO by modifying the appropriate bit in CNF. */
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(this->gpio_virtual_address, GpioRegisterType_GPIO_CNF, pad_number);
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(m_gpio_virtual_address, GpioRegisterType_GPIO_CNF, pad_number);
|
||||
const uintptr_t pad_index = ConvertInternalGpioPadNumberToBitIndex(pad_number);
|
||||
SetMaskedBit(pad_address, pad_index, 1);
|
||||
|
||||
|
@ -134,7 +134,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
const InternalGpioPadNumber pad_number = pad->GetPadNumber();
|
||||
|
||||
/* Get the pad direction by reading the appropriate bit in OE */
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(this->gpio_virtual_address, GpioRegisterType_GPIO_OE, pad_number);
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(m_gpio_virtual_address, GpioRegisterType_GPIO_OE, pad_number);
|
||||
const uintptr_t pad_index = ConvertInternalGpioPadNumberToBitIndex(pad_number);
|
||||
|
||||
if (reg::Read(pad_address, 1u << pad_index) != 0) {
|
||||
|
@ -155,7 +155,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
const InternalGpioPadNumber pad_number = pad->GetPadNumber();
|
||||
|
||||
/* Configure the pad direction by modifying the appropriate bit in OE */
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(this->gpio_virtual_address, GpioRegisterType_GPIO_OE, pad_number);
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(m_gpio_virtual_address, GpioRegisterType_GPIO_OE, pad_number);
|
||||
const uintptr_t pad_index = ConvertInternalGpioPadNumberToBitIndex(pad_number);
|
||||
SetMaskedBit(pad_address, pad_index, direction);
|
||||
|
||||
|
@ -174,7 +174,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
const InternalGpioPadNumber pad_number = pad->GetPadNumber();
|
||||
|
||||
/* Get the pad value by reading the appropriate bit in IN */
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(this->gpio_virtual_address, GpioRegisterType_GPIO_IN, pad_number);
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(m_gpio_virtual_address, GpioRegisterType_GPIO_IN, pad_number);
|
||||
const uintptr_t pad_index = ConvertInternalGpioPadNumberToBitIndex(pad_number);
|
||||
|
||||
if (reg::Read(pad_address, 1u << pad_index) != 0) {
|
||||
|
@ -194,7 +194,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
const InternalGpioPadNumber pad_number = pad->GetPadNumber();
|
||||
|
||||
/* Configure the pad value by modifying the appropriate bit in IN */
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(this->gpio_virtual_address, GpioRegisterType_GPIO_IN, pad_number);
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(m_gpio_virtual_address, GpioRegisterType_GPIO_IN, pad_number);
|
||||
const uintptr_t pad_index = ConvertInternalGpioPadNumberToBitIndex(pad_number);
|
||||
SetMaskedBit(pad_address, pad_index, value);
|
||||
|
||||
|
@ -213,7 +213,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
const InternalGpioPadNumber pad_number = pad->GetPadNumber();
|
||||
|
||||
/* Get the pad mode by reading the appropriate bits in INT_LVL */
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(this->gpio_virtual_address, GpioRegisterType_GPIO_INT_LVL, pad_number);
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(m_gpio_virtual_address, GpioRegisterType_GPIO_INT_LVL, pad_number);
|
||||
const uintptr_t pad_index = ConvertInternalGpioPadNumberToBitIndex(pad_number);
|
||||
|
||||
switch ((reg::Read(pad_address) >> pad_index) & InternalInterruptMode_Mask) {
|
||||
|
@ -236,7 +236,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
const InternalGpioPadNumber pad_number = pad->GetPadNumber();
|
||||
|
||||
/* Configure the pad mode by modifying the appropriate bits in INT_LVL */
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(this->gpio_virtual_address, GpioRegisterType_GPIO_INT_LVL, pad_number);
|
||||
const uintptr_t pad_address = GetGpioRegisterAddress(m_gpio_virtual_address, GpioRegisterType_GPIO_INT_LVL, pad_number);
|
||||
const uintptr_t pad_index = ConvertInternalGpioPadNumberToBitIndex(pad_number);
|
||||
|
||||
switch (mode) {
|
||||
|
|
|
@ -26,14 +26,14 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
|
||||
class InterruptEventHandler : public ddsf::IEventHandler {
|
||||
private:
|
||||
DriverImpl *driver;
|
||||
os::InterruptName interrupt_name;
|
||||
os::InterruptEventType interrupt_event;
|
||||
int controller_number;
|
||||
DriverImpl *m_driver;
|
||||
os::InterruptName m_interrupt_name;
|
||||
os::InterruptEventType m_interrupt_event;
|
||||
int m_controller_number;
|
||||
private:
|
||||
bool CheckAndHandleInterrupt(TegraPad &pad);
|
||||
public:
|
||||
InterruptEventHandler() : IEventHandler(), driver(nullptr), interrupt_name(), interrupt_event(), controller_number() { /* ... */ }
|
||||
InterruptEventHandler() : IEventHandler(), m_driver(nullptr), m_interrupt_name(), m_interrupt_event(), m_controller_number() { /* ... */ }
|
||||
|
||||
void Initialize(DriverImpl *drv, os::InterruptName intr, int ctlr);
|
||||
|
||||
|
@ -46,11 +46,11 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
AMS_DDSF_CASTABLE_TRAITS(ams::gpio::driver::board::nintendo::nx::impl::DriverImpl, ::ams::gpio::driver::IGpioDriver);
|
||||
friend class InterruptEventHandler;
|
||||
private:
|
||||
dd::PhysicalAddress gpio_physical_address;
|
||||
uintptr_t gpio_virtual_address;
|
||||
SuspendHandler suspend_handler;
|
||||
TegraPad::InterruptList interrupt_pad_list;
|
||||
mutable os::SdkMutex interrupt_control_mutex;
|
||||
dd::PhysicalAddress m_gpio_physical_address;
|
||||
uintptr_t m_gpio_virtual_address;
|
||||
SuspendHandler m_suspend_handler;
|
||||
TegraPad::InterruptList m_interrupt_pad_list;
|
||||
mutable os::SdkMutex m_interrupt_control_mutex;
|
||||
public:
|
||||
DriverImpl(dd::PhysicalAddress reg_paddr, size_t size);
|
||||
|
||||
|
@ -76,7 +76,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
|
||||
virtual os::SdkMutex &GetInterruptControlMutex(const Pad &pad) const override {
|
||||
AMS_UNUSED(pad);
|
||||
return this->interrupt_control_mutex;
|
||||
return m_interrupt_control_mutex;
|
||||
}
|
||||
|
||||
virtual Result GetDebounceEnabled(bool *out, Pad *pad) const override;
|
||||
|
@ -114,14 +114,14 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
void AddInterruptPad(TegraPad *pad) {
|
||||
AMS_ASSERT(pad != nullptr);
|
||||
if (!pad->IsLinkedToInterruptBoundPadList()) {
|
||||
this->interrupt_pad_list.push_back(*pad);
|
||||
m_interrupt_pad_list.push_back(*pad);
|
||||
}
|
||||
}
|
||||
|
||||
void RemoveInterruptPad(TegraPad *pad) {
|
||||
AMS_ASSERT(pad != nullptr);
|
||||
if (pad->IsLinkedToInterruptBoundPadList()) {
|
||||
this->interrupt_pad_list.erase(this->interrupt_pad_list.iterator_to(*pad));
|
||||
m_interrupt_pad_list.erase(m_interrupt_pad_list.iterator_to(*pad));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
|
||||
void SuspendHandler::Initialize(uintptr_t gpio_vaddr) {
|
||||
/* Set our gpio virtual address. */
|
||||
this->gpio_virtual_address = gpio_vaddr;
|
||||
m_gpio_virtual_address = gpio_vaddr;
|
||||
|
||||
/* Ensure that we can use the wec library. */
|
||||
ams::wec::Initialize();
|
||||
|
|
|
@ -54,21 +54,21 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
}
|
||||
};
|
||||
private:
|
||||
ddsf::IDriver &driver;
|
||||
uintptr_t gpio_virtual_address;
|
||||
RegisterValues register_values[GpioPadPort_Count];
|
||||
ValuesForSleepState values_for_sleep_state[GpioPadPort_Count];
|
||||
ddsf::IDriver &m_driver;
|
||||
uintptr_t m_gpio_virtual_address;
|
||||
RegisterValues m_register_values[GpioPadPort_Count];
|
||||
ValuesForSleepState m_values_for_sleep_state[GpioPadPort_Count];
|
||||
private:
|
||||
uintptr_t GetGpioVirtualAddress() const {
|
||||
AMS_ASSERT(this->gpio_virtual_address != 0);
|
||||
return this->gpio_virtual_address;
|
||||
AMS_ASSERT(m_gpio_virtual_address != 0);
|
||||
return m_gpio_virtual_address;
|
||||
}
|
||||
public:
|
||||
explicit SuspendHandler(ddsf::IDriver *drv) : driver(*drv), gpio_virtual_address(0) {
|
||||
for (auto &rv : this->register_values) {
|
||||
explicit SuspendHandler(ddsf::IDriver *drv) : m_driver(*drv), m_gpio_virtual_address(0) {
|
||||
for (auto &rv : m_register_values) {
|
||||
rv.Reset();
|
||||
}
|
||||
for (auto &v : this->values_for_sleep_state) {
|
||||
for (auto &v : m_values_for_sleep_state) {
|
||||
v.Reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -351,26 +351,26 @@ namespace ams::gpio::driver::board::nintendo::nx::impl {
|
|||
private:
|
||||
using Base = ::ams::gpio::driver::Pad;
|
||||
private:
|
||||
util::IntrusiveListNode interrupt_list_node;
|
||||
PadInfo info;
|
||||
PadStatus status;
|
||||
util::IntrusiveListNode m_interrupt_list_node;
|
||||
PadInfo m_info;
|
||||
PadStatus m_status;
|
||||
public:
|
||||
using InterruptListTraits = util::IntrusiveListMemberTraitsDeferredAssert<&TegraPad::interrupt_list_node>;
|
||||
using InterruptListTraits = util::IntrusiveListMemberTraitsDeferredAssert<&TegraPad::m_interrupt_list_node>;
|
||||
using InterruptList = typename InterruptListTraits::ListType;
|
||||
friend class util::IntrusiveList<TegraPad, util::IntrusiveListMemberTraitsDeferredAssert<&TegraPad::interrupt_list_node>>;
|
||||
friend class util::IntrusiveList<TegraPad, util::IntrusiveListMemberTraitsDeferredAssert<&TegraPad::m_interrupt_list_node>>;
|
||||
public:
|
||||
TegraPad() : Pad(), interrupt_list_node(), info(), status() { /* ... */ }
|
||||
TegraPad() : Pad(), m_interrupt_list_node(), m_info(), m_status() { /* ... */ }
|
||||
|
||||
const PadInfo &GetInfo() const { return this->info; }
|
||||
PadStatus &GetStatus() { return this->status; }
|
||||
const PadInfo &GetInfo() const { return m_info; }
|
||||
PadStatus &GetStatus() { return m_status; }
|
||||
|
||||
void SetParameters(int pad, const PadInfo &i) {
|
||||
Base::SetPadNumber(pad);
|
||||
this->info = i;
|
||||
m_info = i;
|
||||
}
|
||||
|
||||
bool IsLinkedToInterruptBoundPadList() const {
|
||||
return this->interrupt_list_node.IsLinked();
|
||||
return m_interrupt_list_node.IsLinked();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue