FreeNOS
|
#include <i8250.h>
Public Member Functions | |
i8250 (const u32 irq, const u16 base) | |
Constructor function. More... | |
virtual FileSystem::Result | initialize () |
Initializes the i8250 serial UART. More... | |
virtual FileSystem::Result | interrupt (const Size vector) |
Called when an interrupt has been triggered for this device. More... | |
virtual FileSystem::Result | read (IOBuffer &buffer, Size &size, const Size offset) |
Read bytes from the device. More... | |
virtual FileSystem::Result | write (IOBuffer &buffer, Size &size, const Size offset) |
Write bytes to the device. More... | |
Public Member Functions inherited from SerialDevice | |
SerialDevice (const u32 irq) | |
Constructor. More... | |
u32 | getIrq () const |
Get interrupt vector. More... | |
Public Member Functions inherited from Device | |
Device (const u32 inode, const FileSystem::FileType type) | |
Constructor. More... | |
virtual | ~Device () |
Destructor. More... | |
virtual const String & | getIdentifier () const |
Get unique device identifier. More... | |
Public Member Functions inherited from File | |
File (const u32 inode, const FileSystem::FileType type=FileSystem::RegularFile, const UserID uid=ZERO, const GroupID gid=ZERO) | |
Constructor function. More... | |
virtual | ~File () |
Destructor function. More... | |
u32 | getInode () const |
Get inode number. More... | |
FileSystem::FileType | getType () const |
Retrieve our filetype. More... | |
virtual FileSystem::Result | status (FileSystem::FileStat &st) |
Retrieve file statistics. More... | |
virtual bool | canRead () const |
Check if the File has data ready for reading. More... | |
virtual bool | canWrite () const |
Check if the File can be written to. More... | |
Private Types | |
enum | Constants { TRANSMIT = 0, RECEIVE = 0, DIVISORLOW = 0, DIVISORHIGH = 1, RXREADY = 1, IRQCONTROL = 1, IRQSTATUS = 2, FIFOCONTROL = 2, LINECONTROL = 3, MODEMCONTROL = 4, LINESTATUS = 5, TXREADY = 0x20, DLAB = 0x80, BAUDRATE = 9600 } |
Constants used to communicate with the UART. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from AbstractFactory< SerialDevice > | |
static SerialDevice * | create () |
Abstract function to create an instance of T. More... | |
Static Public Attributes inherited from SerialDevice | |
static u32 | inodeNumber = 2 |
Keeps track of inode number for SerialDevices. More... | |
Protected Attributes inherited from SerialDevice | |
const u32 | m_irq |
interrupt vector More... | |
Arch::IO | m_io |
I/O instance. More... | |
Protected Attributes inherited from Device | |
String | m_identifier |
Unique identifier for this Device. More... | |
Protected Attributes inherited from File | |
const u32 | m_inode |
Inode number. More... | |
const FileSystem::FileType | m_type |
Type of this file. More... | |
UserID | m_uid |
Owner of the file. More... | |
GroupID | m_gid |
Group of the file. More... | |
FileSystem::FileModes | m_access |
Access permissions. More... | |
Size | m_size |
Size of the file, in bytes. More... | |
|
private |
Constructor function.
irq | Interrupt vector |
base | I/O base port |
Definition at line 29 of file i8250.cpp.
References Device::m_identifier, and SerialDevice::m_io.
|
virtual |
Initializes the i8250 serial UART.
Reimplemented from Device.
Definition at line 36 of file i8250.cpp.
References BAUDRATE, DisableIRQ, DIVISORHIGH, DIVISORLOW, DLAB, EnableIRQ, FIFOCONTROL, IRQCONTROL, isKernel, LINECONTROL, SerialDevice::m_io, SerialDevice::m_irq, MODEMCONTROL, ProcessCtl(), SELF, and FileSystem::Success.
Referenced by kernel_main().
|
virtual |
Called when an interrupt has been triggered for this device.
vector | Vector number of the interrupt. |
Reimplemented from Device.
Definition at line 72 of file i8250.cpp.
References EnableIRQ, SerialDevice::m_irq, ProcessCtl(), SELF, and FileSystem::Success.
|
virtual |
Read bytes from the device.
buffer | Input/Output buffer to output bytes to. |
size | Maximum number of bytes to read on input. On output, the actual number of bytes read. |
offset | Offset inside the file to start reading. |
Reimplemented from File.
Definition at line 78 of file i8250.cpp.
References IOBuffer::bufferedWrite(), LINESTATUS, SerialDevice::m_io, RECEIVE, FileSystem::RetryAgain, RXREADY, and FileSystem::Success.
|
virtual |
Write bytes to the device.
buffer | Input/Output buffer to input bytes from. |
size | Maximum number of bytes to write on input. On output, the actual number of bytes written. |
offset | Offset inside the file to start writing. |
Reimplemented from File.
Definition at line 104 of file i8250.cpp.
References LINESTATUS, SerialDevice::m_io, FileSystem::RetryAgain, FileSystem::Success, TRANSMIT, and TXREADY.