ReactOS 0.4.16-dev-250-g3ecd236
machxbox.h File Reference
#include "mm.h"
#include <drivers/xbox/xgpu.h>
Include dependency graph for machxbox.h:

Go to the source code of this file.

Functions

VOID XboxConsPutChar (int Ch)
 
BOOLEAN XboxConsKbHit (VOID)
 
int XboxConsGetCh (VOID)
 
VOID XboxVideoInit (VOID)
 
VOID XboxVideoClearScreen (UCHAR Attr)
 
VIDEODISPLAYMODE XboxVideoSetDisplayMode (char *DisplayModem, BOOLEAN Init)
 
VOID XboxVideoGetDisplaySize (PULONG Width, PULONG Height, PULONG Depth)
 
ULONG XboxVideoGetBufferSize (VOID)
 
VOID XboxVideoGetFontsFromFirmware (PULONG RomFontPointers)
 
VOID XboxVideoSetTextCursorPosition (UCHAR X, UCHAR Y)
 
VOID XboxVideoHideShowTextCursor (BOOLEAN Show)
 
VOID XboxVideoPutChar (int Ch, UCHAR Attr, unsigned X, unsigned Y)
 
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 XboxVideoPrepareForReactOS (VOID)
 
VOID XboxVideoScrollUp (VOID)
 
VOID XboxPrepareForReactOS (VOID)
 
VOID XboxMemInit (VOID)
 
PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap (ULONG *MemoryMapSize)
 
VOID XboxDiskInit (BOOLEAN Init)
 
BOOLEAN XboxDiskReadLogicalSectors (UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
 
BOOLEAN XboxDiskGetDriveGeometry (UCHAR DriveNumber, PGEOMETRY DriveGeometry)
 
ULONG XboxDiskGetCacheableBlockCount (UCHAR DriveNumber)
 
TIMEINFOXboxGetTime (VOID)
 
PCONFIGURATION_COMPONENT_DATA XboxHwDetect (_In_opt_ PCSTR Options)
 
VOID XboxHwIdle (VOID)
 
VOID XboxSetLED (PCSTR Pattern)
 

Variables

UCHAR BitmapFont8x16 [256 *16]
 

Function Documentation

◆ XboxConsGetCh()

int XboxConsGetCh ( VOID  )

Definition at line 76 of file xboxcons.c.

77{
78 /* No keyboard support yet */
79 while (1) ;
80
81 return 0;
82}

Referenced by MachInit().

◆ XboxConsKbHit()

BOOLEAN XboxConsKbHit ( VOID  )

Definition at line 69 of file xboxcons.c.

70{
71 /* No keyboard support yet */
72 return FALSE;
73}
#define FALSE
Definition: types.h:117

Referenced by MachInit().

◆ XboxConsPutChar()

VOID XboxConsPutChar ( int  Ch)

Definition at line 26 of file xboxcons.c.

27{
29 BOOLEAN NeedScroll;
30
32
33 NeedScroll = (CurrentCursorY >= Height);
34 if (NeedScroll)
35 {
38 }
39
40 if (c == '\r')
41 {
43 }
44 else if (c == '\n')
45 {
47
48 if (!NeedScroll)
50 }
51 else if (c == '\t')
52 {
53 CurrentCursorX = (CurrentCursorX + 8) & ~ 7;
54 }
55 else
56 {
59 }
60
61 if (CurrentCursorX >= Width)
62 {
65 }
66}
unsigned char BOOLEAN
const GLubyte * c
Definition: glext.h:8905
#define Unused(x)
Definition: atlwin.h:28
uint32_t ULONG
Definition: typedefs.h:59
_In_ HFONT _Out_ PUINT _Out_ PUINT Width
Definition: font.h:89
_In_ HFONT _Out_ PUINT Height
Definition: font.h:88
static unsigned CurrentAttr
Definition: xboxcons.c:23
static unsigned CurrentCursorX
Definition: xboxcons.c:21
static unsigned CurrentCursorY
Definition: xboxcons.c:22
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: xboxvideo.c:136
VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: xboxvideo.c:243
VOID XboxVideoScrollUp(VOID)
Definition: xboxvideo.c:108

Referenced by MachInit().

◆ XboxDiskGetCacheableBlockCount()

ULONG XboxDiskGetCacheableBlockCount ( UCHAR  DriveNumber)

Definition at line 123 of file xboxdisk.c.

124{
125 PDEVICE_UNIT DeviceUnit;
126
127 DeviceUnit = XboxDiskDriveNumberToDeviceUnit(DriveNumber);
128 if (!DeviceUnit)
129 return 1; // Unknown count.
130
131 /*
132 * If LBA is supported then the block size will be 64 sectors (32k).
133 * If not then the block size is the size of one track.
134 */
135 if (DeviceUnit->Flags & ATA_DEVICE_LBA)
136 return 64;
137 else
138 return DeviceUnit->Sectors;
139}
#define ATA_DEVICE_LBA
Definition: hwide.h:307
USHORT Flags
Definition: hwide.h:299
ULONG Sectors
Definition: hwide.h:296
static PDEVICE_UNIT XboxDiskDriveNumberToDeviceUnit(UCHAR DriveNumber)
Definition: xboxdisk.c:63

Referenced by MachInit().

◆ XboxDiskGetDriveGeometry()

BOOLEAN XboxDiskGetDriveGeometry ( UCHAR  DriveNumber,
PGEOMETRY  DriveGeometry 
)

Definition at line 103 of file xboxdisk.c.

104{
105 PDEVICE_UNIT DeviceUnit;
106
107 TRACE("XboxDiskGetDriveGeometry(0x%x)\n", DriveNumber);
108
109 DeviceUnit = XboxDiskDriveNumberToDeviceUnit(DriveNumber);
110 if (!DeviceUnit)
111 return FALSE;
112
113 Geometry->Cylinders = DeviceUnit->Cylinders;
114 Geometry->Heads = DeviceUnit->Heads;
115 Geometry->SectorsPerTrack = DeviceUnit->Sectors;
116 Geometry->BytesPerSector = DeviceUnit->SectorSize;
117 Geometry->Sectors = DeviceUnit->TotalSectors;
118
119 return TRUE;
120}
#define TRUE
Definition: types.h:120
#define TRACE(s)
Definition: solgame.cpp:4
ULONG Cylinders
Definition: hwide.h:294
ULONG SectorSize
Definition: hwide.h:297
ULONGLONG TotalSectors
Definition: hwide.h:298
ULONG Heads
Definition: hwide.h:295

Referenced by MachInit(), and XboxGetHarddiskConfigurationData().

◆ XboxDiskInit()

VOID XboxDiskInit ( BOOLEAN  Init)

Definition at line 26 of file xboxdisk.c.

27{
28 UCHAR DetectedCount;
29 UCHAR UnitNumber;
30 PDEVICE_UNIT DeviceUnit = NULL;
31
32 if (Init & !AtaInitialized)
33 {
34 /* Find first HDD and CD */
35 AtaInit(&DetectedCount);
36 for (UnitNumber = 0; UnitNumber <= DetectedCount; UnitNumber++)
37 {
38 DeviceUnit = AtaGetDevice(UnitNumber);
39 if (DeviceUnit)
40 {
41 if (DeviceUnit->Flags & ATA_DEVICE_ATAPI)
42 {
43 if (!CdDrive)
44 CdDrive = DeviceUnit;
45 }
46 else
47 {
48 if (!HardDrive)
49 HardDrive = DeviceUnit;
50 }
51 }
52 }
54 }
55 else
56 {
57 AtaFree();
58 }
59}
#define NULL
Definition: types.h:112
PDEVICE_UNIT AtaGetDevice(IN UCHAR UnitNumber)
Definition: hwide.c:178
BOOLEAN AtaInit(OUT PUCHAR DetectedCount)
Definition: hwide.c:139
VOID AtaFree()
#define ATA_DEVICE_ATAPI
Definition: hwide.h:303
static PDEVICE_UNIT HardDrive
Definition: xboxdisk.c:19
static BOOLEAN AtaInitialized
Definition: xboxdisk.c:21
static PDEVICE_UNIT CdDrive
Definition: xboxdisk.c:20
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by XboxDiskDriveNumberToDeviceUnit(), and XboxPrepareForReactOS().

◆ XboxDiskReadLogicalSectors()

BOOLEAN XboxDiskReadLogicalSectors ( UCHAR  DriveNumber,
ULONGLONG  SectorNumber,
ULONG  SectorCount,
PVOID  Buffer 
)

◆ XboxGetTime()

TIMEINFO * XboxGetTime ( VOID  )

Definition at line 40 of file xboxrtc.c.

41{
42 static TIMEINFO TimeInfo;
43
45 {
46 ;
47 }
48
49 TimeInfo.Second = BCD_INT(HalpQueryCMOS(0));
50 TimeInfo.Minute = BCD_INT(HalpQueryCMOS(2));
51 TimeInfo.Hour = BCD_INT(HalpQueryCMOS(4));
52 TimeInfo.Day = BCD_INT(HalpQueryCMOS(7));
53 TimeInfo.Month = BCD_INT(HalpQueryCMOS(8));
54 TimeInfo.Year = BCD_INT(HalpQueryCMOS(9));
55 if (TimeInfo.Year > 80)
56 TimeInfo.Year += 1900;
57 else
58 TimeInfo.Year += 2000;
59
60 return &TimeInfo;
61}
Definition: fw.h:10
USHORT Month
Definition: fw.h:12
USHORT Day
Definition: fw.h:13
USHORT Minute
Definition: fw.h:15
USHORT Hour
Definition: fw.h:14
USHORT Second
Definition: fw.h:16
USHORT Year
Definition: fw.h:11
#define BCD_INT(bcd)
Definition: xboxrtc.c:24
static UCHAR HalpQueryCMOS(UCHAR Reg)
Definition: xboxrtc.c:27
#define RTC_REG_A_UIP
Definition: xboxrtc.c:22
#define RTC_REGISTER_A
Definition: xboxrtc.c:21

Referenced by MachInit().

◆ XboxHwDetect()

PCONFIGURATION_COMPONENT_DATA XboxHwDetect ( _In_opt_ PCSTR  Options)

Definition at line 266 of file machxbox.c.

268{
270 ULONG BusNumber = 0;
271
272 TRACE("DetectHardware()\n");
273
274 /* Create the 'System' key */
275 FldrCreateSystemKey(&SystemKey, "Original Xbox (PC/AT like)");
276
279
280 /* TODO: Build actual xbox's hardware configuration tree */
281 DetectPciBios(SystemKey, &BusNumber);
282 DetectIsaBios(Options, SystemKey, &BusNumber);
283
284 TRACE("DetectHardware() Done\n");
285 return SystemKey;
286}
VOID FldrCreateSystemKey(_Out_ PCONFIGURATION_COMPONENT_DATA *SystemNode, _In_ PCSTR IdentifierString)
Definition: archwsup.c:135
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:176
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
static PCM_PARTIAL_RESOURCE_LIST XboxGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machxbox.c:94
static VOID DetectIsaBios(_In_opt_ PCSTR Options, _Inout_ PCONFIGURATION_COMPONENT_DATA SystemKey, _Out_ ULONG *BusNumber)
Definition: machxbox.c:201
BOOLEAN XboxFindPciBios(PPCI_REGISTRY_INFO BusData)
Definition: machxbox.c:31
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pchw.c:45
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3534
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

Referenced by MachInit().

◆ XboxHwIdle()

VOID XboxHwIdle ( VOID  )

Definition at line 288 of file machxbox.c.

289{
290 /* UNIMPLEMENTED */
291}

Referenced by MachInit().

◆ XboxMemGetMemoryMap()

PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap ( ULONG MemoryMapSize)

Definition at line 228 of file xboxmem.c.

229{
230 memory_map_t * MbMap;
231 INT Count, i;
232
233 TRACE("XboxMemGetMemoryMap()\n");
234
236 if (MbMap)
237 {
238 /* Obtain memory map via multiboot spec */
239
240 for (i = 0; i < Count; i++, MbMap++)
241 {
242 TRACE("i = %d, base_addr_low = 0x%p, length_low = 0x%p\n", i, MbMap->base_addr_low, MbMap->length_low);
243
244 if (MbMap->base_addr_high > 0 || MbMap->length_high > 0)
245 {
246 ERR("Memory descriptor base or size is greater than 4 GB, should not happen on Xbox!\n");
247 ASSERT(FALSE);
248 }
249
251 MbMap->base_addr_low,
252 MbMap->length_low,
254 }
255 }
256 else
257 {
258 /* Synthesize memory map */
259
260 /* Available RAM block */
262 0,
263 AvailableMemoryMb * 1024 * 1024,
264 LoaderFree);
265
266 if (FrameBufferSize != 0)
267 {
268 /* Video memory */
273 "Video memory");
274 }
275 }
276
277 *MemoryMapSize = PcMemFinalizeMemoryMap(XboxMemoryMap);
278 return XboxMemoryMap;
279}
#define ERR(fmt,...)
Definition: precomp.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ASSERT(a)
Definition: mode.c:44
int Count
Definition: noreturn.cpp:7
@ LoaderFree
Definition: arc.h:176
@ LoaderFirmwarePermanent
Definition: arc.h:180
unsigned long base_addr_low
Definition: multiboot.h:119
unsigned long length_low
Definition: multiboot.h:121
unsigned long type
Definition: multiboot.h:123
unsigned long base_addr_high
Definition: multiboot.h:120
unsigned long length_high
Definition: multiboot.h:122
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
memory_map_t * XboxGetMultibootMemoryMap(INT *Count)
Definition: xboxmem.c:175
ULONG FrameBufferSize
Definition: xboxvideo.c:29
FREELDR_MEMORY_DESCRIPTOR XboxMemoryMap[MAX_BIOS_DESCRIPTORS+1]
Definition: xboxmem.c:225
ULONG PcMemFinalizeMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap)
Definition: pcmem.c:547
PVOID FrameBuffer
Definition: xboxvideo.c:28
static ULONG AvailableMemoryMb
Definition: xboxmem.c:28
VOID ReserveMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType, PCHAR Usage)
Definition: pcmem.c:484
TYPE_OF_MEMORY XboxMultibootMemoryType(ULONG Type)
Definition: xboxmem.c:206
VOID SetMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType)
Definition: pcmem.c:527

Referenced by MachInit().

◆ XboxMemInit()

VOID XboxMemInit ( VOID  )

Definition at line 117 of file xboxmem.c.

118{
119 PCI_TYPE1_CFG_BITS PciCfg1;
120 UCHAR ControlRegion[TEST_SIZE];
121 PVOID MembaseTop = (PVOID)(64 * 1024 * 1024);
122 PVOID MembaseLow = (PVOID)0;
123
125 WRITE_REGISTER_ULONG((PULONG)(NvBase + NV2A_FB_CFG0 + 4), 0x11448000);
126
127 /* Select Host to PCI bridge */
128 PciCfg1.u.bits.Enable = 1;
129 PciCfg1.u.bits.BusNumber = 0;
130 PciCfg1.u.bits.DeviceNumber = 0;
131 PciCfg1.u.bits.FunctionNumber = 0;
132 PciCfg1.u.bits.Reserved = 0;
133 /* Prepare hardware for 128 MB */
134 PciCfg1.u.bits.RegisterNumber = 0x84;
135
138
140 memset(ControlRegion, TEST_PATTERN1, TEST_SIZE);
141 memset(MembaseTop, TEST_PATTERN1, TEST_SIZE);
142 __wbinvd();
143
144 if (memcmp(MembaseTop, ControlRegion, TEST_SIZE) == 0)
145 {
146 /* Looks like there is memory .. maybe a 128MB box */
147 memset(ControlRegion, TEST_PATTERN2, TEST_SIZE);
148 memset(MembaseTop, TEST_PATTERN2, TEST_SIZE);
149 __wbinvd();
150 if (memcmp(MembaseTop, ControlRegion, TEST_SIZE) == 0)
151 {
152 /* Definitely looks like there is memory */
153 if (memcmp(MembaseLow, ControlRegion, TEST_SIZE) == 0)
154 {
155 /* Hell, we find the Test-string at 0x0 too! */
157 }
158 else
159 {
160 InstalledMemoryMb = 128;
161 }
162 }
163 }
164
165 /* Set hardware for amount of memory detected */
168
170
172}
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define WRITE_REGISTER_ULONG(r, v)
Definition: arm.h:27
#define PCI_TYPE1_DATA_PORT
Definition: hardware.h:34
#define PCI_TYPE1_ADDRESS_PORT
Definition: hardware.h:33
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
PPC_QUAL void __wbinvd(void)
Definition: intrin_ppc.h:759
#define memset(x, y, z)
Definition: compat.h:39
struct _PCI_TYPE1_CFG_BITS::@157::@158 bits
union _PCI_TYPE1_CFG_BITS::@157 u
uint32_t * PULONG
Definition: typedefs.h:59
void * PVOID
Definition: typedefs.h:50
static VOID XboxInitializePCI(VOID)
Definition: xboxmem.c:59
#define TEST_PATTERN2
Definition: xboxmem.c:36
#define TEST_SIZE
Definition: xboxmem.c:34
ULONG NvBase
Definition: xboxvideo.c:27
#define TEST_PATTERN1
Definition: xboxmem.c:35
static ULONG InstalledMemoryMb
Definition: xboxmem.c:27
#define NV2A_FB_CFG0
Definition: xgpu.h:19

Referenced by MachInit().

◆ XboxPrepareForReactOS()

VOID XboxPrepareForReactOS ( VOID  )

Definition at line 373 of file machxbox.c.

374{
375 /* On Xbox, prepare video and disk support */
379
380 /* Turn off debug messages to screen */
382}
#define DebugDisableScreenPort()
Definition: debug.h:123
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1235
VOID XboxDiskInit(BOOLEAN Init)
Definition: xboxdisk.c:26
VOID XboxVideoPrepareForReactOS(VOID)
Definition: xboxvideo.c:315

Referenced by MachInit().

◆ XboxSetLED()

VOID XboxSetLED ( PCSTR  Pattern)

Definition at line 198 of file xboxi2c.c.

198 {
199 const char *x = pattern;
200 int r, g;
201
202 if(strlen(pattern) == 4) {
203 r = g = 0;
204 while (*x) {
205 r *= 2;
206 g *= 2;
207 switch (*x) {
208 case 'r':
209 r++;
210 break;
211 case 'g':
212 g++;
213 break;
214 case 'o':
215 r++;
216 g++;
217 break;
218 }
219 x++;
220 }
221 I2cSetFrontpanelLed(((r<<4) & 0xF0) + (g & 0xF));
222 }
223}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLubyte * pattern
Definition: glext.h:7787
GLboolean GLboolean g
Definition: glext.h:6204
static void I2cSetFrontpanelLed(UCHAR b)
Definition: xboxi2c.c:188

Referenced by MachInit().

◆ XboxVideoClearScreen()

VOID XboxVideoClearScreen ( UCHAR  Attr)

Definition at line 126 of file xboxvideo.c.

127{
128 ULONG FgColor, BgColor;
129
130 XboxVideoAttrToColors(Attr, &FgColor, &BgColor);
131
133}
static VOID XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: xboxvideo.c:92
static VOID XboxVideoAttrToColors(UCHAR Attr, ULONG *FgColor, ULONG *BgColor)
Definition: xboxvideo.c:85

Referenced by MachInit().

◆ XboxVideoCopyOffScreenBufferToVRAM()

VOID XboxVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 275 of file xboxvideo.c.

276{
277 PUCHAR OffScreenBuffer = (PUCHAR) Buffer;
278 ULONG Col, Line;
279
280 for (Line = 0; Line < (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT; Line++)
281 {
282 for (Col = 0; Col < ScreenWidth / CHAR_WIDTH; Col++)
283 {
284 XboxVideoPutChar(OffScreenBuffer[0], OffScreenBuffer[1], Col, Line);
285 OffScreenBuffer += 2;
286 }
287 }
288}
Definition: bufpool.h:45
Definition: ncftp.h:79
unsigned char * PUCHAR
Definition: typedefs.h:53
static ULONG ScreenWidth
Definition: xboxvideo.c:30
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:41
static ULONG ScreenHeight
Definition: xboxvideo.c:31
#define CHAR_WIDTH
Definition: xboxvideo.c:38
#define CHAR_HEIGHT
Definition: xboxvideo.c:39

Referenced by MachInit().

◆ XboxVideoGetBufferSize()

ULONG XboxVideoGetBufferSize ( VOID  )

Definition at line 251 of file xboxvideo.c.

252{
254}

Referenced by MachInit().

◆ XboxVideoGetDisplaySize()

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

Definition at line 243 of file xboxvideo.c.

244{
247 *Depth = 0;
248}
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:819

Referenced by MachInit(), and XboxConsPutChar().

◆ XboxVideoGetFontsFromFirmware()

VOID XboxVideoGetFontsFromFirmware ( PULONG  RomFontPointers)

Definition at line 257 of file xboxvideo.c.

258{
259 TRACE("XboxVideoGetFontsFromFirmware(): UNIMPLEMENTED\n");
260}

Referenced by MachInit().

◆ XboxVideoGetPaletteColor()

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

Definition at line 303 of file xboxvideo.c.

304{
305 /* Not supported */
306}

Referenced by MachInit().

◆ XboxVideoHideShowTextCursor()

VOID XboxVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 269 of file xboxvideo.c.

270{
271 /* We don't have a cursor yet */
272}

Referenced by MachInit(), and XboxVideoPrepareForReactOS().

◆ XboxVideoInit()

VOID XboxVideoInit ( VOID  )

Definition at line 196 of file xboxvideo.c.

197{
198 /* Reuse framebuffer that was set up by firmware */
200 /* Verify that framebuffer address is page-aligned */
202
203 /* Obtain framebuffer memory size from multiboot memory map */
205 {
206 /* Fallback to Cromwell standard which reserves high 4 MB of RAM */
207 FrameBufferSize = 4 * 1024 * 1024;
208 WARN("Could not detect framebuffer memory size, fallback to 4 MB\n");
209 }
210
213 /* Get BPP directly from NV2A CRTC (magic constants are from Cromwell) */
214 BytesPerPixel = 8 * (((NvGetCrtc(0x19) & 0xE0) << 3) | (NvGetCrtc(0x13) & 0xFF)) / ScreenWidth;
215 if (BytesPerPixel == 4)
216 {
217 ASSERT((NvGetCrtc(0x28) & 0xF) == BytesPerPixel - 1);
218 }
219 else
220 {
221 ASSERT((NvGetCrtc(0x28) & 0xF) == BytesPerPixel);
222 }
223 Delta = (ScreenWidth * BytesPerPixel + 3) & ~ 0x3;
224
225 /* Verify screen resolution */
226 ASSERT(ScreenWidth > 1);
227 ASSERT(ScreenHeight > 1);
228 ASSERT(BytesPerPixel >= 1 && BytesPerPixel <= 4);
229 /* Verify that screen fits framebuffer size */
231
233}
#define READ_REGISTER_ULONG(r)
Definition: arm.h:26
#define WARN(fmt,...)
Definition: precomp.h:61
#define PAGE_SIZE
Definition: env_spec_w32.h:49
ULONG FrameBufferSize
Definition: xboxvideo.c:29
static ULONG Delta
Definition: xboxvideo.c:33
PVOID FrameBuffer
Definition: xboxvideo.c:28
ULONG XboxGetFramebufferSize(PVOID Offset)
Definition: xboxvideo.c:153
ULONG NvBase
Definition: xboxvideo.c:27
#define MAKE_COLOR(Red, Green, Blue)
Definition: xboxvideo.c:45
static ULONG BytesPerPixel
Definition: xboxvideo.c:32
UCHAR NvGetCrtc(UCHAR Index)
Definition: xboxvideo.c:146
#define NV2A_CRTC_FRAMEBUFFER_START
Definition: xgpu.h:21
#define NV2A_RAMDAC_FP_VVALID_END
Definition: xgpu.h:26
#define NV2A_RAMDAC_FP_HVALID_END
Definition: xgpu.h:25

Referenced by MachInit().

◆ XboxVideoIsPaletteFixed()

BOOLEAN XboxVideoIsPaletteFixed ( VOID  )

Definition at line 291 of file xboxvideo.c.

292{
293 return FALSE;
294}

Referenced by MachInit().

◆ XboxVideoPrepareForReactOS()

VOID XboxVideoPrepareForReactOS ( VOID  )

Definition at line 315 of file xboxvideo.c.

316{
319}
VOID XboxVideoHideShowTextCursor(BOOLEAN Show)
Definition: xboxvideo.c:269

Referenced by XboxPrepareForReactOS().

◆ XboxVideoPutChar()

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

Definition at line 136 of file xboxvideo.c.

137{
138 ULONG FgColor, BgColor;
139
140 XboxVideoAttrToColors(Attr, &FgColor, &BgColor);
141
142 XboxVideoOutputChar(Ch, X, Y, FgColor, BgColor);
143}
#define Y(I)
#define Ch(x, y, z)
Definition: sha2.c:141
static VOID XboxVideoOutputChar(UCHAR Char, unsigned X, unsigned Y, ULONG FgColor, ULONG BgColor)
Definition: xboxvideo.c:48

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

◆ XboxVideoScrollUp()

VOID XboxVideoScrollUp ( VOID  )

Definition at line 108 of file xboxvideo.c.

109{
110 ULONG BgColor, Dummy;
111 ULONG PixelCount = ScreenWidth * CHAR_HEIGHT *
112 (((ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT) - 1);
115
117
118 while (PixelCount--)
119 *Dst++ = *Src++;
120
121 for (PixelCount = 0; PixelCount < ScreenWidth * CHAR_HEIGHT; PixelCount++)
122 *Dst++ = BgColor;
123}
#define ATTR(cFore, cBack)
Definition: ui.h:317
#define COLOR_WHITE
Definition: ui.h:338
#define COLOR_BLACK
Definition: ui.h:322
#define Dst
Definition: mesh.h:153

Referenced by XboxConsPutChar().

◆ XboxVideoSetDisplayMode()

VIDEODISPLAYMODE XboxVideoSetDisplayMode ( char DisplayModem,
BOOLEAN  Init 
)

Definition at line 236 of file xboxvideo.c.

237{
238 /* We only have one mode, semi-text */
239 return VideoTextMode;
240}
@ VideoTextMode
Definition: machine.h:35

Referenced by MachInit().

◆ XboxVideoSetPaletteColor()

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

Definition at line 297 of file xboxvideo.c.

298{
299 /* Not supported */
300}

Referenced by MachInit().

◆ XboxVideoSetTextCursorPosition()

VOID XboxVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 263 of file xboxvideo.c.

264{
265 /* We don't have a cursor yet */
266}

Referenced by MachInit().

◆ XboxVideoSync()

VOID XboxVideoSync ( VOID  )

Definition at line 309 of file xboxvideo.c.

310{
311 /* Not supported */
312}

Referenced by MachInit().

Variable Documentation

◆ BitmapFont8x16

UCHAR BitmapFont8x16[256 *16]
extern

Definition at line 12 of file vgafont.c.