cros_ec_python.ioports.x86portio
This module provides a class for port I/O using the portio module.
This method might be slightly faster than the /dev/port method,
since it uses the x86 I/O instructions directly,
but it requires the portio module to be installed.
1""" 2This module provides a class for port I/O using the portio module. 3 4This method might be slightly faster than the `/dev/port` method, 5since it uses the x86 I/O instructions directly, 6but it requires the `portio` module to be installed. 7""" 8 9from .baseportio import PortIOClass 10import portio 11 12 13class IoPortIo(PortIOClass): 14 """ 15 A class to interact with the portio module for x86 port I/O. 16 """ 17 18 portio = portio 19 20 def outb(self, data: int, port: int) -> None: 21 portio.outb(data, port) 22 23 def outb_p(self, data: int, port: int) -> None: 24 portio.outb_p(data, port) 25 26 def outw(self, data: int, port: int) -> None: 27 portio.outw(data, port) 28 29 def outw_p(self, data: int, port: int) -> None: 30 portio.outw_p(data, port) 31 32 def outl(self, data: int, port: int) -> None: 33 portio.outl(data, port) 34 35 def outl_p(self, data: int, port: int) -> None: 36 portio.outl_p(data, port) 37 38 def outsb(self, data: bytes, port: int) -> None: 39 portio.outsb(data, port) 40 41 def outsw(self, data: bytes, port: int) -> None: 42 portio.outsw(data, port) 43 44 def outsl(self, data: bytes, port: int) -> None: 45 portio.outsl(data, port) 46 47 def inb(self, port: int) -> int: 48 return portio.inb(port) 49 50 def inb_p(self, port: int) -> int: 51 return portio.inb_p(port) 52 53 def inw(self, port: int) -> int: 54 return portio.inw(port) 55 56 def inw_p(self, port: int) -> int: 57 return portio.inw_p(port) 58 59 def inl(self, port: int) -> int: 60 return portio.inl(port) 61 62 def inl_p(self, port: int) -> int: 63 return portio.inl_p(port) 64 65 def insb(self, port: int, num: int) -> bytes: 66 return portio.insb(port, num) 67 68 def insw(self, port: int, num: int) -> bytes: 69 return portio.insw(port, num) 70 71 def insl(self, port: int, num: int) -> bytes: 72 return portio.insl(port, num) 73 74 def ioperm(self, port, num, turn_on) -> None: 75 return portio.ioperm(port, num, turn_on) 76 77 def iopl(self, level) -> None: 78 return portio.iopl(level)
14class IoPortIo(PortIOClass): 15 """ 16 A class to interact with the portio module for x86 port I/O. 17 """ 18 19 portio = portio 20 21 def outb(self, data: int, port: int) -> None: 22 portio.outb(data, port) 23 24 def outb_p(self, data: int, port: int) -> None: 25 portio.outb_p(data, port) 26 27 def outw(self, data: int, port: int) -> None: 28 portio.outw(data, port) 29 30 def outw_p(self, data: int, port: int) -> None: 31 portio.outw_p(data, port) 32 33 def outl(self, data: int, port: int) -> None: 34 portio.outl(data, port) 35 36 def outl_p(self, data: int, port: int) -> None: 37 portio.outl_p(data, port) 38 39 def outsb(self, data: bytes, port: int) -> None: 40 portio.outsb(data, port) 41 42 def outsw(self, data: bytes, port: int) -> None: 43 portio.outsw(data, port) 44 45 def outsl(self, data: bytes, port: int) -> None: 46 portio.outsl(data, port) 47 48 def inb(self, port: int) -> int: 49 return portio.inb(port) 50 51 def inb_p(self, port: int) -> int: 52 return portio.inb_p(port) 53 54 def inw(self, port: int) -> int: 55 return portio.inw(port) 56 57 def inw_p(self, port: int) -> int: 58 return portio.inw_p(port) 59 60 def inl(self, port: int) -> int: 61 return portio.inl(port) 62 63 def inl_p(self, port: int) -> int: 64 return portio.inl_p(port) 65 66 def insb(self, port: int, num: int) -> bytes: 67 return portio.insb(port, num) 68 69 def insw(self, port: int, num: int) -> bytes: 70 return portio.insw(port, num) 71 72 def insl(self, port: int, num: int) -> bytes: 73 return portio.insl(port, num) 74 75 def ioperm(self, port, num, turn_on) -> None: 76 return portio.ioperm(port, num, turn_on) 77 78 def iopl(self, level) -> None: 79 return portio.iopl(level)
A class to interact with the portio module for x86 port I/O.
def
outb(self, data: int, port: int) -> None:
Write a byte (8 bit) to the specified port.
Parameters
- data: Byte to write.
- port: Port to write to.
def
outw(self, data: int, port: int) -> None:
Write a word (16 bit) to the specified port.
Parameters
- data: Word to write.
- port: Port to write to.
def
outl(self, data: int, port: int) -> None:
Write a long (32 bit) to the specified port.
Parameters
- data: Long to write.
- port: Port to write to.
def
inb(self, port: int) -> int:
Read a byte (8 bit) from the specified port.
Parameters
- port: Port to read from.
Returns
Byte read.
def
inw(self, port: int) -> int:
Read a word (16 bit) from the specified port.
Parameters
- port: Port to read from.
Returns
Word read.
def
inl(self, port: int) -> int:
Read a long (32 bit) from the specified port.
Parameters
- port: Port to read from.
Returns
Long read.