ReactOS  0.4.13-dev-257-gfabbd7c
xboxvideo.c File Reference
#include <freeldr.h>
Include dependency graph for xboxvideo.c:

Go to the source code of this file.

Macros

#define CHAR_WIDTH   8
 
#define CHAR_HEIGHT   16
 
#define TOP_BOTTOM_LINES   0
 
#define FB_SIZE_MB   4
 
#define MAKE_COLOR(Red, Green, Blue)   (0xff000000 | (((Red) & 0xff) << 16) | (((Green) & 0xff) << 8) | ((Blue) & 0xff))
 

Functions

BOOLEAN I2CTransmitByteGetReturn (UCHAR bPicAddressI2cFormat, UCHAR bDataToWrite, ULONG *Return)
 
static VOID XboxVideoOutputChar (UCHAR Char, unsigned X, unsigned Y, ULONG FgColor, ULONG BgColor)
 
static ULONG XboxVideoAttrToSingleColor (UCHAR Attr)
 
static VOID XboxVideoAttrToColors (UCHAR Attr, ULONG *FgColor, ULONG *BgColor)
 
static VOID XboxVideoClearScreenColor (ULONG Color, BOOLEAN FullScreen)
 
VOID XboxVideoClearScreen (UCHAR Attr)
 
VOID XboxVideoPutChar (int Ch, UCHAR Attr, unsigned X, unsigned Y)
 
VOID XboxVideoInit (VOID)
 
VIDEODISPLAYMODE XboxVideoSetDisplayMode (char *DisplayMode, BOOLEAN Init)
 
VOID XboxVideoGetDisplaySize (PULONG Width, PULONG Height, PULONG Depth)
 
ULONG XboxVideoGetBufferSize (VOID)
 
VOID XboxVideoSetTextCursorPosition (UCHAR X, UCHAR Y)
 
VOID XboxVideoHideShowTextCursor (BOOLEAN Show)
 
VOID XboxVideoCopyOffScreenBufferToVRAM (PVOID Buffer)
 
BOOLEAN XboxVideoIsPaletteFixed (VOID)
 
VOID XboxVideoSetPaletteColor (UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
 
VOID XboxVideoGetPaletteColor (UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
 
VOID XboxVideoSync (VOID)
 
VOID XboxBeep (VOID)
 
VOID XboxVideoPrepareForReactOS (IN BOOLEAN Setup)
 

Variables

static PVOID FrameBuffer
 
static ULONG ScreenWidth
 
static ULONG ScreenHeight
 
static ULONG BytesPerPixel
 
static ULONG Delta
 

Macro Definition Documentation

◆ CHAR_HEIGHT

#define CHAR_HEIGHT   16

Definition at line 31 of file xboxvideo.c.

◆ CHAR_WIDTH

#define CHAR_WIDTH   8

Definition at line 30 of file xboxvideo.c.

◆ FB_SIZE_MB

#define FB_SIZE_MB   4

Definition at line 35 of file xboxvideo.c.

◆ MAKE_COLOR

#define MAKE_COLOR (   Red,
  Green,
  Blue 
)    (0xff000000 | (((Red) & 0xff) << 16) | (((Green) & 0xff) << 8) | ((Blue) & 0xff))

Definition at line 37 of file xboxvideo.c.

◆ TOP_BOTTOM_LINES

#define TOP_BOTTOM_LINES   0

Definition at line 33 of file xboxvideo.c.

Function Documentation

◆ I2CTransmitByteGetReturn()

BOOLEAN I2CTransmitByteGetReturn ( UCHAR  bPicAddressI2cFormat,
UCHAR  bDataToWrite,
ULONG Return 
)

Definition at line 175 of file xboxi2c.c.

176 {
177  return ReadfromSMBus(bPicAddressI2cFormat, bDataToWrite, 1, Return);
178 }
static BOOLEAN ReadfromSMBus(UCHAR Address, UCHAR bRegister, UCHAR Size, ULONG *Data_to_smbus)
Definition: xboxi2c.c:98

Referenced by XboxVideoInit().

◆ XboxBeep()

VOID XboxBeep ( VOID  )

Definition at line 236 of file xboxvideo.c.

237 {
238  /* Call PC version */
239  PcBeep();
240 }
VOID PcBeep(VOID)
Definition: i386rtl.c:25

◆ XboxVideoAttrToColors()

static VOID XboxVideoAttrToColors ( UCHAR  Attr,
ULONG FgColor,
ULONG BgColor 
)
static

Definition at line 79 of file xboxvideo.c.

80 {
81  *FgColor = XboxVideoAttrToSingleColor(Attr & 0xf);
82  *BgColor = XboxVideoAttrToSingleColor((Attr >> 4) & 0xf);
83 }
static ULONG XboxVideoAttrToSingleColor(UCHAR Attr)
Definition: xboxvideo.c:66

Referenced by XboxVideoClearScreen(), and XboxVideoPutChar().

◆ XboxVideoAttrToSingleColor()

static ULONG XboxVideoAttrToSingleColor ( UCHAR  Attr)
static

Definition at line 66 of file xboxvideo.c.

67 {
69 
70  Intensity = (0 == (Attr & 0x08) ? 127 : 255);
71 
72  return 0xff000000 |
73  (0 == (Attr & 0x04) ? 0 : (Intensity << 16)) |
74  (0 == (Attr & 0x02) ? 0 : (Intensity << 8)) |
75  (0 == (Attr & 0x01) ? 0 : Intensity);
76 }
unsigned char UCHAR
Definition: xmlstorage.h:181
static WORD Intensity(RGBQUAD clr)
Definition: msrle32.c:44

Referenced by XboxVideoAttrToColors().

◆ XboxVideoClearScreen()

VOID XboxVideoClearScreen ( UCHAR  Attr)

Definition at line 102 of file xboxvideo.c.

103 {
104  ULONG FgColor, BgColor;
105 
106  XboxVideoAttrToColors(Attr, &FgColor, &BgColor);
107 
109 }
static VOID XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: xboxvideo.c:86
static VOID XboxVideoAttrToColors(UCHAR Attr, ULONG *FgColor, ULONG *BgColor)
Definition: xboxvideo.c:79
unsigned int ULONG
Definition: retypes.h:1

Referenced by XboxMachInit().

◆ XboxVideoClearScreenColor()

static VOID XboxVideoClearScreenColor ( ULONG  Color,
BOOLEAN  FullScreen 
)
static

Definition at line 86 of file xboxvideo.c.

87 {
88  ULONG Line, Col;
89  PULONG p;
90 
91  for (Line = 0; Line < ScreenHeight - (FullScreen ? 0 : 2 * TOP_BOTTOM_LINES); Line++)
92  {
93  p = (PULONG) ((char *) FrameBuffer + (Line + (FullScreen ? 0 : TOP_BOTTOM_LINES)) * Delta);
94  for (Col = 0; Col < ScreenWidth; Col++)
95  {
96  *p++ = Color;
97  }
98  }
99 }
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:33
static ULONG ScreenWidth
Definition: xboxvideo.c:25
struct Color Color
static ULONG ScreenHeight
Definition: xboxvideo.c:26
Definition: ncftp.h:79
static PVOID FrameBuffer
Definition: xboxvideo.c:24
static ULONG Delta
Definition: xboxvideo.c:28
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
GLfloat GLfloat p
Definition: glext.h:8902
struct Line Line

Referenced by XboxVideoClearScreen(), XboxVideoInit(), and XboxVideoPrepareForReactOS().

◆ XboxVideoCopyOffScreenBufferToVRAM()

VOID XboxVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 196 of file xboxvideo.c.

197 {
198  PUCHAR OffScreenBuffer = (PUCHAR) Buffer;
199  ULONG Col, Line;
200 
201  for (Line = 0; Line < (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT; Line++)
202  {
203  for (Col = 0; Col < ScreenWidth / CHAR_WIDTH; Col++)
204  {
205  XboxVideoPutChar(OffScreenBuffer[0], OffScreenBuffer[1], Col, Line);
206  OffScreenBuffer += 2;
207  }
208  }
209 }
unsigned char * PUCHAR
Definition: retypes.h:3
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:33
static ULONG ScreenWidth
Definition: xboxvideo.c:25
Definition: bufpool.h:45
static ULONG ScreenHeight
Definition: xboxvideo.c:26
Definition: ncftp.h:79
#define CHAR_WIDTH
Definition: xboxvideo.c:30
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: xboxvideo.c:112
#define CHAR_HEIGHT
Definition: xboxvideo.c:31
unsigned int ULONG
Definition: retypes.h:1
struct Line Line

Referenced by XboxMachInit().

◆ XboxVideoGetBufferSize()

ULONG XboxVideoGetBufferSize ( VOID  )

Definition at line 178 of file xboxvideo.c.

179 {
181 }
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:33
static ULONG ScreenWidth
Definition: xboxvideo.c:25
static ULONG ScreenHeight
Definition: xboxvideo.c:26
#define CHAR_WIDTH
Definition: xboxvideo.c:30
#define CHAR_HEIGHT
Definition: xboxvideo.c:31

Referenced by XboxMachInit().

◆ XboxVideoGetDisplaySize()

VOID XboxVideoGetDisplaySize ( PULONG  Width,
PULONG  Height,
PULONG  Depth 
)

Definition at line 170 of file xboxvideo.c.

171 {
172  *Width = ScreenWidth / CHAR_WIDTH;
173  *Height = (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT;
174  *Depth = 0;
175 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:656
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:33
static ULONG ScreenWidth
Definition: xboxvideo.c:25
static ULONG ScreenHeight
Definition: xboxvideo.c:26
#define CHAR_WIDTH
Definition: xboxvideo.c:30
#define CHAR_HEIGHT
Definition: xboxvideo.c:31

Referenced by XboxConsPutChar(), and XboxMachInit().

◆ XboxVideoGetPaletteColor()

VOID XboxVideoGetPaletteColor ( UCHAR  Color,
UCHAR Red,
UCHAR Green,
UCHAR Blue 
)

Definition at line 224 of file xboxvideo.c.

225 {
226  /* Not supported */
227 }

Referenced by XboxMachInit().

◆ XboxVideoHideShowTextCursor()

VOID XboxVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 190 of file xboxvideo.c.

191 {
192  /* We don't have a cursor yet */
193 }

Referenced by XboxMachInit().

◆ XboxVideoInit()

VOID XboxVideoInit ( VOID  )

Definition at line 122 of file xboxvideo.c.

123 {
124  ULONG AvMode;
125 
127 
128  if (I2CTransmitByteGetReturn(0x10, 0x04, &AvMode))
129  {
130  if (1 == AvMode) /* HDTV */
131  {
132  ScreenWidth = 720;
133  }
134  else
135  {
136  /* FIXME Other possible values of AvMode:
137  * 0 - AV_SCART_RGB
138  * 2 - AV_VGA_SOG
139  * 4 - AV_SVIDEO
140  * 6 - AV_COMPOSITE
141  * 7 - AV_VGA
142  * other AV_COMPOSITE
143  */
144  ScreenWidth = 640;
145  }
146  }
147  else
148  {
149  ScreenWidth = 640;
150  }
151 
152  ScreenHeight = 480;
153  BytesPerPixel = 4;
154  Delta = (ScreenWidth * BytesPerPixel + 3) & ~ 0x3;
155 
157 
158  /* Tell the nVidia controller about the framebuffer */
159  *((PULONG) 0xfd600800) = (ULONG) FrameBuffer;
160 }
#define TRUE
Definition: types.h:120
static VOID XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: xboxvideo.c:86
static ULONG BytesPerPixel
Definition: xboxvideo.c:27
static ULONG ScreenWidth
Definition: xboxvideo.c:25
void * PVOID
Definition: retypes.h:9
BOOLEAN I2CTransmitByteGetReturn(UCHAR bPicAddressI2cFormat, UCHAR bDataToWrite, ULONG *Return)
Definition: xboxi2c.c:175
PVOID XboxMemReserveMemory(ULONG MbToReserve)
Definition: xboxmem.c:98
static ULONG ScreenHeight
Definition: xboxvideo.c:26
static PVOID FrameBuffer
Definition: xboxvideo.c:24
static ULONG Delta
Definition: xboxvideo.c:28
unsigned int * PULONG
Definition: retypes.h:1
#define FB_SIZE_MB
Definition: xboxvideo.c:35
#define MAKE_COLOR(Red, Green, Blue)
Definition: xboxvideo.c:37
unsigned int ULONG
Definition: retypes.h:1

Referenced by XboxMachInit().

◆ XboxVideoIsPaletteFixed()

BOOLEAN XboxVideoIsPaletteFixed ( VOID  )

Definition at line 212 of file xboxvideo.c.

213 {
214  return FALSE;
215 }

Referenced by XboxMachInit().

◆ XboxVideoOutputChar()

static VOID XboxVideoOutputChar ( UCHAR  Char,
unsigned  X,
unsigned  Y,
ULONG  FgColor,
ULONG  BgColor 
)
static

Definition at line 42 of file xboxvideo.c.

43 {
44  PUCHAR FontPtr;
45  PULONG Pixel;
46  UCHAR Mask;
47  unsigned Line;
48  unsigned Col;
49 
50  FontPtr = XboxFont8x16 + Char * 16;
51  Pixel = (PULONG) ((char *) FrameBuffer + (Y * CHAR_HEIGHT + TOP_BOTTOM_LINES) * Delta
52  + X * CHAR_WIDTH * BytesPerPixel);
53  for (Line = 0; Line < CHAR_HEIGHT; Line++)
54  {
55  Mask = 0x80;
56  for (Col = 0; Col < CHAR_WIDTH; Col++)
57  {
58  Pixel[Col] = (0 != (FontPtr[Line] & Mask) ? FgColor : BgColor);
59  Mask = Mask >> 1;
60  }
61  Pixel = (PULONG) ((char *) Pixel + Delta);
62  }
63 }
#define Y(I)
static ULONG BytesPerPixel
Definition: xboxvideo.c:27
unsigned char * PUCHAR
Definition: retypes.h:3
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:33
char Char
Definition: bzip2.c:161
UCHAR XboxFont8x16[256 *16]
Definition: xboxfont.c:23
Definition: ncftp.h:79
#define CHAR_WIDTH
Definition: xboxvideo.c:30
unsigned char UCHAR
Definition: xmlstorage.h:181
#define CHAR_HEIGHT
Definition: xboxvideo.c:31
static PVOID FrameBuffer
Definition: xboxvideo.c:24
static ULONG Delta
Definition: xboxvideo.c:28
unsigned int * PULONG
Definition: retypes.h:1
struct Line Line

Referenced by XboxVideoPutChar().

◆ XboxVideoPrepareForReactOS()

VOID XboxVideoPrepareForReactOS ( IN BOOLEAN  Setup)

Definition at line 243 of file xboxvideo.c.

244 {
246 }
#define TRUE
Definition: types.h:120
static VOID XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: xboxvideo.c:86
#define MAKE_COLOR(Red, Green, Blue)
Definition: xboxvideo.c:37

Referenced by XboxPrepareForReactOS().

◆ XboxVideoPutChar()

VOID XboxVideoPutChar ( int  Ch,
UCHAR  Attr,
unsigned  X,
unsigned  Y 
)

Definition at line 112 of file xboxvideo.c.

113 {
114  ULONG FgColor, BgColor;
115 
116  XboxVideoAttrToColors(Attr, &FgColor, &BgColor);
117 
118  XboxVideoOutputChar(Ch, X, Y, FgColor, BgColor);
119 }
static VOID XboxVideoOutputChar(UCHAR Char, unsigned X, unsigned Y, ULONG FgColor, ULONG BgColor)
Definition: xboxvideo.c:42
#define Y(I)
#define Ch(x, y, z)
Definition: sha2.c:141
static VOID XboxVideoAttrToColors(UCHAR Attr, ULONG *FgColor, ULONG *BgColor)
Definition: xboxvideo.c:79
unsigned int ULONG
Definition: retypes.h:1

Referenced by XboxConsPutChar(), XboxMachInit(), and XboxVideoCopyOffScreenBufferToVRAM().

◆ XboxVideoSetDisplayMode()

VIDEODISPLAYMODE XboxVideoSetDisplayMode ( char DisplayMode,
BOOLEAN  Init 
)

Definition at line 163 of file xboxvideo.c.

164 {
165  /* We only have one mode, semi-text */
166  return VideoTextMode;
167 }

Referenced by XboxMachInit().

◆ XboxVideoSetPaletteColor()

VOID XboxVideoSetPaletteColor ( UCHAR  Color,
UCHAR  Red,
UCHAR  Green,
UCHAR  Blue 
)

Definition at line 218 of file xboxvideo.c.

219 {
220  /* Not supported */
221 }

Referenced by XboxMachInit().

◆ XboxVideoSetTextCursorPosition()

VOID XboxVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 184 of file xboxvideo.c.

185 {
186  /* We don't have a cursor yet */
187 }

◆ XboxVideoSync()

VOID XboxVideoSync ( VOID  )

Definition at line 230 of file xboxvideo.c.

231 {
232  /* Not supported */
233 }

Referenced by XboxMachInit().

Variable Documentation

◆ BytesPerPixel

ULONG BytesPerPixel
static

Definition at line 27 of file xboxvideo.c.

Referenced by ConsolepClearBuffer(), XboxVideoInit(), and XboxVideoOutputChar().

◆ Delta

◆ FrameBuffer

◆ ScreenHeight

◆ ScreenWidth