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

#include <Vga.h>

+ Inheritance diagram for PPCVga:
+ Collaboration diagram for PPCVga:

Public Member Functions

void initialise ()
 
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)
 
 operator uint16_t * () const
 
- Public Member Functions inherited from Vga
virtual void setControl (VgaControl which)=0
 
virtual void clearControl (VgaControl which)=0
 

Private Member Functions

 PPCVga (const PPCVga &)
 
PPCVgaoperator= (const PPCVga &)
 
void putChar (char c, int x, int y, unsigned int f, unsigned int b)
 

Private Attributes

uint16_t m_pTextBuffer [(MAX_WIDTH/FONT_WIDTH)*(MAX_HEIGHT/FONT_HEIGHT)]
 
MemoryRegion m_Framebuffer
 
uint8_t * m_pFramebuffer
 
uint32_t m_Width
 
uint32_t m_Height
 
uint32_t m_Depth
 
uint32_t m_Stride
 
uint32_t m_pColours [16]
 

Additional Inherited Members

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

Detailed Description

Vga device abstraction.

Definition at line 50 of file kernel/machine/ppc_common/Vga.h.

Member Function Documentation

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

Implements Vga.

Definition at line 102 of file kernel/machine/ppc_common/Vga.h.

References m_Width.

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

Implements Vga.

Definition at line 110 of file kernel/machine/ppc_common/Vga.h.

References m_Height.

void PPCVga::initialise ( )
virtual bool PPCVga::isLargestTextMode ( )
inlinevirtual

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 94 of file kernel/machine/ppc_common/Vga.h.

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

Tests the current video mode.

Returns
True if the current mode matches the given arguments.

Implements Vga.

Definition at line 85 of file kernel/machine/ppc_common/Vga.h.

virtual void PPCVga::moveCursor ( size_t  nX,
size_t  nY 
)
inlinevirtual

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 156 of file kernel/machine/ppc_common/Vga.h.

References m_pTextBuffer.

void PPCVga::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
Apointer to the buffer.
Thelength of pBuffer.

Implements Vga.

Definition at line 160 of file kernel/machine/ppc_common/Vga.cc.

References X86Vga::m_pFramebuffer.

Referenced by restoreMode().

+ Here is the caller graph for this function:

void PPCVga::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 137 of file kernel/machine/ppc_common/Vga.cc.

Referenced by restoreMode().

+ Here is the caller graph for this function:

virtual void PPCVga::rememberMode ( )
inlinevirtual

Stores the current video mode.

Implements Vga.

Definition at line 118 of file kernel/machine/ppc_common/Vga.h.

virtual void PPCVga::restoreMode ( )
inlinevirtual

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

Implements Vga.

Definition at line 125 of file kernel/machine/ppc_common/Vga.h.

References peekBuffer(), and pokeBuffer().

virtual bool PPCVga::setLargestTextMode ( )
inlinevirtual

Sets the largest possible text mode.

Returns
True on success, false on failure.

Implements Vga.

Definition at line 75 of file kernel/machine/ppc_common/Vga.h.

virtual bool PPCVga::setMode ( int  mode)
inlinevirtual

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 66 of file kernel/machine/ppc_common/Vga.h.

Member Data Documentation

uint32_t PPCVga::m_Depth
private

Screen depth - bits per pixel

Definition at line 188 of file kernel/machine/ppc_common/Vga.h.

uint32_t PPCVga::m_Height
private

Screen height

Definition at line 186 of file kernel/machine/ppc_common/Vga.h.

Referenced by getNumRows().

uint32_t PPCVga::m_pColours[16]
private

Colour index table

Definition at line 192 of file kernel/machine/ppc_common/Vga.h.

uint8_t* PPCVga::m_pFramebuffer
private

Our real graphics framebuffer

Todo:
: This should be a MemoryMappedIO - needs VirtualAddressSpace though.

Definition at line 181 of file kernel/machine/ppc_common/Vga.h.

uint16_t PPCVga::m_pTextBuffer[(MAX_WIDTH/FONT_WIDTH)*(MAX_HEIGHT/FONT_HEIGHT)]
private

We use a 16-bit-per-character text mode buffer to simplify things. BootIO is a bit of a simpleton, really.

Definition at line 174 of file kernel/machine/ppc_common/Vga.h.

Referenced by moveCursor().

uint32_t PPCVga::m_Stride
private

Stride - number of bytes per row

Definition at line 190 of file kernel/machine/ppc_common/Vga.h.

uint32_t PPCVga::m_Width
private

Screen width

Definition at line 184 of file kernel/machine/ppc_common/Vga.h.

Referenced by getNumCols().


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