FreeNOS
Public Member Functions | Private Attributes
VGA Class Reference

Video Graphics Array (VGA) support. More...

#include <VGA.h>

Inheritance diagram for VGA:
Device File

Public Member Functions

 VGA (const u32 inode, const Size width=80, const Size height=25)
 Class constructor function. More...
 
virtual FileSystem::Result initialize ()
 Initialize the VGA device. More...
 
virtual FileSystem::Result read (IOBuffer &buffer, Size &size, const Size offset)
 Read video memory. More...
 
virtual FileSystem::Result write (IOBuffer &buffer, Size &size, const Size offset)
 Write video memory. More...
 
- Public Member Functions inherited from Device
 Device (const u32 inode, const FileSystem::FileType type)
 Constructor. More...
 
virtual ~Device ()
 Destructor. More...
 
virtual const StringgetIdentifier () const
 Get unique device identifier. More...
 
virtual FileSystem::Result interrupt (const Size vector)
 Called when an interrupt has been triggered for this device. 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 Attributes

u16vga
 VGA video memory address. More...
 
Size width
 Number of characters horizontally. More...
 
Size height
 Number of characters vertically. More...
 
Arch::IO m_io
 Port I/O object. More...
 

Additional Inherited Members

- 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...
 

Detailed Description

Video Graphics Array (VGA) support.

This class implements a VGA driver. Applications may read and write from the /dev/vga0 device file to retrieve and modify the current screen. Currently the Terminal driver uses the /dev/vga device file to implement the system console in FreeNOS.

See also
Terminal

Definition at line 94 of file VGA.h.

Constructor & Destructor Documentation

◆ VGA()

VGA::VGA ( const u32  inode,
const Size  width = 80,
const Size  height = 25 
)

Class constructor function.

Parameters
inodeInode number
widthNumber of characters horizontally.
heightNumber of characters vertically.

Definition at line 23 of file VGA.cpp.

References Device::m_identifier.

Member Function Documentation

◆ initialize()

FileSystem::Result VGA::initialize ( )
virtual

Initialize the VGA device.

First this function maps the VGA video memory into our address space. It clears the screen and finally disables the VGA hardware cursor.

Returns
Result code

Reimplemented from Device.

Definition at line 33 of file VGA.cpp.

References Memory::Range::access, BLACK, height, LIGHTGREY, m_io, MapContiguous, PAGESIZE, Memory::Range::phys, Memory::Readable, SELF, Memory::Range::size, FileSystem::Success, Memory::User, vga, VGA_CHAR, VGA_IOADDR, VGA_IODATA, VGA_PADDR, Memory::Range::virt, VMCtl(), width, Memory::Writable, and ZERO.

◆ read()

FileSystem::Result VGA::read ( IOBuffer buffer,
Size size,
const Size  offset 
)
virtual

Read video memory.

Parameters
bufferInput/Output buffer to output bytes to.
sizeMaximum number of bytes to read on input. On output, the actual number of bytes read.
offsetOffset inside the file to start reading.
Returns
Result code

Reimplemented from File.

Definition at line 63 of file VGA.cpp.

References height, FileSystem::InvalidArgument, FileSystem::Success, vga, width, and IOBuffer::write().

◆ write()

FileSystem::Result VGA::write ( IOBuffer buffer,
Size size,
const Size  offset 
)
virtual

Write video memory.

Parameters
bufferInput/Output buffer to input bytes from.
sizeMaximum number of bytes to write on input. On output, the actual number of bytes written.
offsetOffset inside the file to start writing.
Returns
Result code

Reimplemented from File.

Definition at line 76 of file VGA.cpp.

References MemoryBlock::copy(), IOBuffer::getBuffer(), height, FileSystem::InvalidArgument, FileSystem::Success, vga, and width.

Field Documentation

◆ height

Size VGA::height
private

Number of characters vertically.

Definition at line 157 of file VGA.h.

Referenced by initialize(), read(), and write().

◆ m_io

Arch::IO VGA::m_io
private

Port I/O object.

Definition at line 160 of file VGA.h.

Referenced by initialize().

◆ vga

u16* VGA::vga
private

VGA video memory address.

Definition at line 151 of file VGA.h.

Referenced by initialize(), read(), and write().

◆ width

Size VGA::width
private

Number of characters horizontally.

Definition at line 154 of file VGA.h.

Referenced by initialize(), read(), and write().


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