git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
VFS - Rework to remove function pointers from tVFS_Node
[tpg/acess2.git]
/
Modules
/
x86
/
VGAText
/
vga.c
diff --git
a/Modules/x86/VGAText/vga.c
b/Modules/x86/VGAText/vga.c
index
9fa9fd2
..
41f0bd0
100644
(file)
--- a/
Modules/x86/VGAText/vga.c
+++ b/
Modules/x86/VGAText/vga.c
@@
-4,7
+4,7
@@
#define DEBUG 0
#include <acess.h>
#include <fs_devfs.h>
#define DEBUG 0
#include <acess.h>
#include <fs_devfs.h>
-#include <
tpl
_drv_video.h>
+#include <
api
_drv_video.h>
#include <modules.h>
// === CONSTANTS ===
#include <modules.h>
// === CONSTANTS ===
@@
-13,10
+13,10
@@
// === PROTOTYPES ===
int VGA_Install(char **Arguments);
// === PROTOTYPES ===
int VGA_Install(char **Arguments);
-Uint64 VGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer);
+Uint64 VGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length,
const
void *Buffer);
int VGA_IOCtl(tVFS_Node *Node, int Id, void *Data);
Uint8 VGA_int_GetColourNibble(Uint16 col);
int VGA_IOCtl(tVFS_Node *Node, int Id, void *Data);
Uint8 VGA_int_GetColourNibble(Uint16 col);
-Uint16 VGA_int_GetWord(tVT_Char *Char);
+Uint16 VGA_int_GetWord(
const
tVT_Char *Char);
void VGA_int_SetCursor(Sint16 x, Sint16 y);
// --- 2D Acceleration Functions --
void VGA_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour);
void VGA_int_SetCursor(Sint16 x, Sint16 y);
// --- 2D Acceleration Functions --
void VGA_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour);
@@
-24,14
+24,17
@@
void VGA_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY,
// === GLOBALS ===
MODULE_DEFINE(0, 0x000A, x86_VGAText, VGA_Install, NULL, NULL);
// === GLOBALS ===
MODULE_DEFINE(0, 0x000A, x86_VGAText, VGA_Install, NULL, NULL);
+tVFS_NodeType gVGA_NodeType = {
+ //.Read = VGA_Read,
+ .Write = VGA_Write,
+ .IOCtl = VGA_IOCtl
+ };
tDevFS_Driver gVGA_DevInfo = {
NULL, "x86_VGAText",
{
.NumACLs = 0,
.Size = VGA_WIDTH*VGA_HEIGHT*sizeof(tVT_Char),
tDevFS_Driver gVGA_DevInfo = {
NULL, "x86_VGAText",
{
.NumACLs = 0,
.Size = VGA_WIDTH*VGA_HEIGHT*sizeof(tVT_Char),
- //.Read = VGA_Read,
- .Write = VGA_Write,
- .IOCtl = VGA_IOCtl
+ .Type = &gVGA_NodeType
}
};
Uint16 *gVGA_Framebuffer = (void*)( KERNEL_BASE|0xB8000 );
}
};
Uint16 *gVGA_Framebuffer = (void*)( KERNEL_BASE|0xB8000 );
@@
-65,17
+68,16
@@
int VGA_Install(char **Arguments)
}
/**
}
/**
- * \fn Uint64 VGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
* \brief Writes a string of bytes to the VGA controller
*/
* \brief Writes a string of bytes to the VGA controller
*/
-Uint64 VGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
+Uint64 VGA_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length,
const
void *Buffer)
{
if( giVGA_BufferFormat == VIDEO_BUFFMT_TEXT )
{
int num = Length / sizeof(tVT_Char);
int ofs = Offset / sizeof(tVT_Char);
int i = 0;
{
if( giVGA_BufferFormat == VIDEO_BUFFMT_TEXT )
{
int num = Length / sizeof(tVT_Char);
int ofs = Offset / sizeof(tVT_Char);
int i = 0;
-
tVT_Char
*chars = Buffer;
+
const tVT_Char
*chars = Buffer;
Uint16 word;
//ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer);
Uint16 word;
//ENTER("pNode XOffset XLength pBuffer", Node, Offset, Length, Buffer);
@@
-197,7
+199,7
@@
Uint8 VGA_int_GetColourNibble(Uint16 col)
* \fn Uint16 VGA_int_GetWord(tVT_Char *Char)
* \brief Convers a character structure to a VGA character word
*/
* \fn Uint16 VGA_int_GetWord(tVT_Char *Char)
* \brief Convers a character structure to a VGA character word
*/
-Uint16 VGA_int_GetWord(tVT_Char *Char)
+Uint16 VGA_int_GetWord(
const
tVT_Char *Char)
{
Uint16 ret;
Uint16 col;
{
Uint16 ret;
Uint16 col;
@@
-230,10
+232,10
@@
void VGA_int_SetCursor(Sint16 x, Sint16 y)
int pos = x+y*VGA_WIDTH;
if(x == -1 || y == -1)
pos = -1;
int pos = x+y*VGA_WIDTH;
if(x == -1 || y == -1)
pos = -1;
- outb(0x3D4, 14);
- outb(0x3D5, pos >> 8);
- outb(0x3D4, 15);
- outb(0x3D5, pos);
+
outb(0x3D4, 14);
+
outb(0x3D5, pos >> 8);
+
outb(0x3D4, 15);
+
outb(0x3D5, pos);
}
void VGA_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour)
}
void VGA_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour)
@@
-246,18
+248,20
@@
void VGA_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colou
Y /= giVT_CharHeight;
H /= giVT_CharHeight;
Y /= giVT_CharHeight;
H /= giVT_CharHeight;
- if( X > VGA_WIDTH || Y > VGA_HEIGHT ) return ;
- if( X + W > VGA_WIDTH ) W = VGA_WIDTH - X;
- if( Y + H > VGA_HEIGHT ) H = VGA_HEIGHT - Y;
-
ch.Ch = 0x20;
ch.BGCol = (Colour & 0x0F0000) >> (16-8);
ch.BGCol |= (Colour & 0x000F00) >> (8-4);
ch.BGCol |= (Colour & 0x00000F);
ch.Ch = 0x20;
ch.BGCol = (Colour & 0x0F0000) >> (16-8);
ch.BGCol |= (Colour & 0x000F00) >> (8-4);
ch.BGCol |= (Colour & 0x00000F);
+ word = VGA_int_GetWord(&ch);
+
+ Log("Fill (%i,%i) %ix%i with 0x%x", X, Y, W, H, word);
+
+ if( X > VGA_WIDTH || Y > VGA_HEIGHT ) return ;
+ if( X + W > VGA_WIDTH ) W = VGA_WIDTH - X;
+ if( Y + H > VGA_HEIGHT ) H = VGA_HEIGHT - Y;
buf = gVGA_Framebuffer + Y*VGA_WIDTH + X;
buf = gVGA_Framebuffer + Y*VGA_WIDTH + X;
- word = VGA_int_GetWord(&ch);
while( H -- ) {
int i;
while( H -- ) {
int i;
@@
-281,6
+285,14
@@
void VGA_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY,
// Log("(%i,%i) from (%i,%i) %ix%i", DstX, DstY, SrcX, SrcY, W, H);
// Log("(%i,%i) from (%i,%i) %ix%i", DstX, DstY, SrcX, SrcY, W, H);
+ if( SrcX > VGA_WIDTH || SrcY > VGA_HEIGHT ) return ;
+ if( SrcX + W > VGA_WIDTH ) W = VGA_WIDTH - SrcX;
+ if( SrcY + H > VGA_HEIGHT ) H = VGA_HEIGHT - SrcY;
+ if( DstX > VGA_WIDTH || DstY > VGA_HEIGHT ) return ;
+ if( DstX + W > VGA_WIDTH ) W = VGA_WIDTH - DstX;
+ if( DstY + H > VGA_HEIGHT ) H = VGA_HEIGHT - DstY;
+
+
src = gVGA_Framebuffer + SrcY*VGA_WIDTH + SrcX;
dst = gVGA_Framebuffer + DstY*VGA_WIDTH + DstX;
src = gVGA_Framebuffer + SrcY*VGA_WIDTH + SrcX;
dst = gVGA_Framebuffer + DstY*VGA_WIDTH + DstX;
UCC
git Repository :: git.ucc.asn.au