23 #include "pedigree/kernel/Log.h" 24 #include "pedigree/kernel/processor/MemoryRegion.h" 25 #include "pedigree/kernel/processor/PhysicalMemoryManager.h" 26 #include "pedigree/kernel/processor/VirtualAddressSpace.h" 27 #include "pedigree/kernel/processor/types.h" 34 : m_Gpio1(
"GPIO1"), m_Gpio2(
"GPIO2"), m_Gpio3(
"GPIO3"),
35 m_Gpio4(
"GPIO4"), m_Gpio5(
"GPIO5"), m_Gpio6(
"GPIO6")
42 static Gpio &instance()
48 uintptr_t gpio1, uintptr_t gpio2, uintptr_t gpio3, uintptr_t gpio4,
49 uintptr_t gpio5, uintptr_t gpio6)
58 ERROR(
"GPIO: Couldn't get a memory region!");
62 1, reinterpret_cast<volatile uint32_t *>(m_Gpio1.
virtualAddress()));
71 ERROR(
"GPIO: Couldn't get a memory region!");
75 2, reinterpret_cast<volatile uint32_t *>(m_Gpio2.
virtualAddress()));
84 ERROR(
"GPIO: Couldn't get a memory region!");
88 3, reinterpret_cast<volatile uint32_t *>(m_Gpio3.
virtualAddress()));
97 ERROR(
"GPIO: Couldn't get a memory region!");
101 4, reinterpret_cast<volatile uint32_t *>(m_Gpio4.
virtualAddress()));
110 ERROR(
"GPIO: Couldn't get a memory region!");
114 5, reinterpret_cast<volatile uint32_t *>(m_Gpio5.
virtualAddress()));
123 ERROR(
"GPIO: Couldn't get a memory region!");
127 6, reinterpret_cast<volatile uint32_t *>(m_Gpio6.
virtualAddress()));
130 void clearpin(
int pin);
132 void drivepin(
int pin);
134 bool pinstate(
int pin);
136 int capturepin(
int pin);
138 void enableoutput(
int pin);
155 static Gpio m_Instance;
void initspecific(int n, volatile uint32_t *gpio)
Initialises a specific GPIO to a given set of defaults.
static PhysicalMemoryManager & instance()
static const size_t continuous
static const size_t force
volatile uint32_t * getGpioForPin(int pin, int *bit)
static const size_t Write
static const size_t KernelMode
Special memory entity in the kernel's virtual address space.
void * virtualAddress() const