The Pedigree Project  0.1
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
HostedVga Class Reference

#include <Vga.h>

+ Inheritance diagram for HostedVga:
+ Collaboration diagram for HostedVga:

Public Member Functions

virtual void setControl (VgaControl which)
 
virtual void clearControl (VgaControl which)
 
virtual bool setMode (int mode)
 
virtual bool setLargestTextMode ()
 
virtual bool isMode (size_t nCols, size_t nRows, bool bIsText, size_t nBpp=0)
 
virtual bool isLargestTextMode ()
 
virtual size_t getNumCols ()
 
virtual size_t getNumRows ()
 
virtual void rememberMode ()
 
virtual void restoreMode ()
 
virtual void pokeBuffer (uint8_t *pBuffer, size_t nBufLen)
 
virtual void peekBuffer (uint8_t *pBuffer, size_t nBufLen)
 
virtual void moveCursor (size_t nX, size_t nY)
 
bool initialise ()
 
 operator uint16_t * () const
 

Private Member Functions

 HostedVga (const HostedVga &)
 
HostedVgaoperator= (const HostedVga &)
 

Static Private Member Functions

static void printAttrAsAnsi (uint8_t attr)
 
static uint8_t ansiColourFixup (uint8_t colour)
 

Private Attributes

size_t m_nWidth
 
size_t m_nHeight
 
size_t m_CursorX
 
size_t m_CursorY
 
int m_ModeStack
 
int m_nMode
 
uint8_t m_nControls
 
uint16_t * m_pBackbuffer
 

Additional Inherited Members

- Public Types inherited from Vga
enum  VgaControl { LineGraphics = 2, Blink = 3 }
 

Detailed Description

Vga device abstraction.

Definition at line 28 of file kernel/machine/hosted/Vga.h.

Member Function Documentation

uint8_t HostedVga::ansiColourFixup ( uint8_t  colour)
staticprivate

Fix up the given colour into a proper ANSI colour.

Definition at line 146 of file kernel/machine/hosted/Vga.cc.

Referenced by getNumRows().

+ Here is the caller graph for this function:

void HostedVga::clearControl ( Vga::VgaControl  which)
virtual

Clears the given attribute mode control.

Implements Vga.

Definition at line 41 of file kernel/machine/hosted/Vga.cc.

virtual size_t HostedVga::getNumCols ( )
inlinevirtual
Returns
The number of columns in the current mode.

Implements Vga.

Definition at line 68 of file kernel/machine/hosted/Vga.h.

References m_nWidth.

virtual size_t HostedVga::getNumRows ( )
inlinevirtual
Returns
The number of rows in the current mode.

Implements Vga.

Definition at line 76 of file kernel/machine/hosted/Vga.h.

References ansiColourFixup(), m_nHeight, m_pBackbuffer, moveCursor(), peekBuffer(), pokeBuffer(), printAttrAsAnsi(), rememberMode(), and restoreMode().

bool HostedVga::isLargestTextMode ( )
virtual

Tests if the current video mode is the largest text mode.

Returns
True if the current video mode is equal to the largest text mode.

Implements Vga.

Definition at line 64 of file kernel/machine/hosted/Vga.cc.

bool HostedVga::isMode ( size_t  nCols,
size_t  nRows,
bool  bIsText,
size_t  nBpp = 0 
)
virtual

Tests the current video mode.

Returns
True if the current mode matches the given arguments.

Implements Vga.

Definition at line 57 of file kernel/machine/hosted/Vga.cc.

void HostedVga::moveCursor ( size_t  nX,
size_t  nY 
)
virtual

Moves the cursor to the position specified by the parameters.

Parameters
nXThe column to move to.
nYThe row to move to.

Implements Vga.

Definition at line 122 of file kernel/machine/hosted/Vga.cc.

Referenced by getNumRows().

+ Here is the caller graph for this function:

void HostedVga::peekBuffer ( uint8_t *  pBuffer,
size_t  nBufLen 
)
virtual

Copies the current framebuffer into the given buffer.

The buffer is assumed to be in the correct format for directly copying from video memory. This will obviously depend on the current mode (text/graphical) as well as resolution and bits per pixel (graphics mode only).

Parameters
pBufferA pointer to the buffer.
nBufLenThe length of pBuffer.

Implements Vga.

Definition at line 111 of file kernel/machine/hosted/Vga.cc.

Referenced by getNumRows().

+ Here is the caller graph for this function:

void HostedVga::pokeBuffer ( uint8_t *  pBuffer,
size_t  nBufLen 
)
virtual

Copies the given buffer into video memory, replacing the current framebuffer.

The buffer is assumed to be in the correct format for directly copying into video memory. This will obviously depend on the current mode (text/graphical) as well as resolution and bits per pixel (graphics mode only).

Parameters
pBufferA pointer to the buffer to swap into video memory.
nBufLenThe length of pBuffer.

Implements Vga.

Definition at line 77 of file kernel/machine/hosted/Vga.cc.

References ArmVersatileVga::moveCursor(), and printAttrAsAnsi().

Referenced by getNumRows().

+ Here is the caller graph for this function:

void HostedVga::printAttrAsAnsi ( uint8_t  attr)
staticprivate

Print the given VGA attribute as an ANSI escape sequence.

Definition at line 180 of file kernel/machine/hosted/Vga.cc.

Referenced by getNumRows(), and pokeBuffer().

+ Here is the caller graph for this function:

void HostedVga::rememberMode ( )
virtual

Stores the current video mode.

Implements Vga.

Definition at line 69 of file kernel/machine/hosted/Vga.cc.

Referenced by getNumRows().

+ Here is the caller graph for this function:

void HostedVga::restoreMode ( )
virtual

Restores the saved video mode from a rememberMode() call.

Implements Vga.

Definition at line 73 of file kernel/machine/hosted/Vga.cc.

Referenced by getNumRows().

+ Here is the caller graph for this function:

void HostedVga::setControl ( Vga::VgaControl  which)
virtual

Sets the given attribute mode control.

Implements Vga.

Definition at line 36 of file kernel/machine/hosted/Vga.cc.

bool HostedVga::setLargestTextMode ( )
virtual

Sets the largest possible text mode.

Returns
True on success, false on failure.

Implements Vga.

Definition at line 52 of file kernel/machine/hosted/Vga.cc.

bool HostedVga::setMode ( int  mode)
virtual

Changes the mode the VGA device is in.

Parameters
nColsThe number of columns required.
nRowsThe number of rows required.
bIsTextTrue if the caller requires a text mode, false if graphical.
nBppOnly applicable for graphics modes - the number of bits per pixel.
Returns
True on success, false on failure.

Implements Vga.

Definition at line 46 of file kernel/machine/hosted/Vga.cc.

Member Data Documentation

size_t HostedVga::m_CursorX
private

Cursor X.

Definition at line 155 of file kernel/machine/hosted/Vga.h.

size_t HostedVga::m_CursorY
private

Cursor Y.

Definition at line 160 of file kernel/machine/hosted/Vga.h.

int HostedVga::m_ModeStack
private

We keep a count of the number of times we've entered the debugger without leaving it - when we enter the debugger, we increment this. When we leave, we decrement. If we leave and it reaches zero, we change out of mode 0x3 into the current video mode.

Definition at line 168 of file kernel/machine/hosted/Vga.h.

Referenced by X86Vga::rememberMode(), and X86Vga::restoreMode().

uint8_t HostedVga::m_nControls
private

Most recent VGA controls (as these get reset on mode change).

Definition at line 178 of file kernel/machine/hosted/Vga.h.

Referenced by X86Vga::moveCursor(), X86Vga::rememberMode(), and X86Vga::restoreMode().

size_t HostedVga::m_nHeight
private

The height of the current mode.

Definition at line 150 of file kernel/machine/hosted/Vga.h.

Referenced by getNumRows().

int HostedVga::m_nMode
private

Current video mode.

Definition at line 173 of file kernel/machine/hosted/Vga.h.

Referenced by X86Vga::restoreMode(), and X86Vga::setMode().

size_t HostedVga::m_nWidth
private

The width of the current mode.

Definition at line 145 of file kernel/machine/hosted/Vga.h.

Referenced by getNumCols(), and X86Vga::moveCursor().

uint16_t* HostedVga::m_pBackbuffer
private

Backbuffer for text.

Definition at line 183 of file kernel/machine/hosted/Vga.h.

Referenced by getNumRows().


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