Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::hardwarecommunication::Port32Bit Class Reference

Handles 32 bit ports. More...

#include <port.h>

Inheritance diagram for MaxOS::hardwarecommunication::Port32Bit:
MaxOS::hardwarecommunication::Port

Public Member Functions

 Port32Bit (uint16_t port_number)
 Construct a new Port object for ports handling 32 bit read/writes.
 
virtual void write (uint32_t data)
 write a double word to the port (32Bit)
 
virtual uint32_t read ()
 read a double word from the port (32Bit)
 

Additional Inherited Members

- Protected Member Functions inherited from MaxOS::hardwarecommunication::Port
 Port (uint16_t port_number)
 Construct a new Port object.
 
- Protected Attributes inherited from MaxOS::hardwarecommunication::Port
uint16_t m_port_number
 The port to write to / read from.
 

Detailed Description

Handles 32 bit ports.

Definition at line 70 of file port.h.

Constructor & Destructor Documentation

◆ Port32Bit()

Port32Bit::Port32Bit ( uint16_t  port_number)
explicit

Construct a new Port object for ports handling 32 bit read/writes.

Parameters
port_numberThe IO port number

Definition at line 117 of file port.cpp.

118: Port(port_number) {
119}
base class for all ports
Definition port.h:20

Member Function Documentation

◆ read()

uint32_t Port32Bit::read ( )
virtual

read a double word from the port (32Bit)

Returns
the double word read

Definition at line 138 of file port.cpp.

138 {
139
140 uint32_t result;
141 asm volatile("inl %1, %0" : "=a" (result) : "Nd" (m_port_number));
142 return result;
143}
uint16_t m_port_number
The port to write to / read from.
Definition port.h:22

References MaxOS::hardwarecommunication::Port::m_port_number.

◆ write()

void Port32Bit::write ( uint32_t  data)
virtual

write a double word to the port (32Bit)

Parameters
datathe double word to write

Definition at line 128 of file port.cpp.

128 {
129
130 asm volatile("outl %0, %1" : : "a" (data), "Nd" (m_port_number));
131}

References MaxOS::hardwarecommunication::Port::m_port_number.


The documentation for this class was generated from the following files: