ReactOS  0.4.14-dev-323-g6fe6a88
machxbox.h File Reference
#include "mm.h"
Include dependency graph for machxbox.h:

Go to the source code of this file.

Macros

#define MAX_XBOX_COM_PORTS   2
 
#define LPC_IO_BASE   0x2E
 
#define LPC_ENTER_CONFIG_KEY   0x55
 
#define LPC_EXIT_CONFIG_KEY   0xAA
 
#define LPC_DEVICE_SERIAL_PORT_1   0x4
 
#define LPC_DEVICE_SERIAL_PORT_2   0x5
 
#define LPC_CONFIG_DEVICE_NUMBER   0x07
 
#define LPC_CONFIG_DEVICE_ACTIVATE   0x30
 
#define LPC_CONFIG_DEVICE_BASE_ADDRESS_HIGH   0x60
 
#define LPC_CONFIG_DEVICE_BASE_ADDRESS_LOW   0x61
 
#define LPC_CONFIG_DEVICE_INTERRUPT   0x70
 
#define NV2A_CONTROL_OFFSET   0xFD000000
 
#define NV2A_CRTC_OFFSET   (0x600000 + NV2A_CONTROL_OFFSET)
 
#define NV2A_CRTC_FRAMEBUFFER_START   (0x800 + NV2A_CRTC_OFFSET)
 
#define NV2A_CRTC_REGISTER_INDEX   (0x13D4 + NV2A_CRTC_OFFSET)
 
#define NV2A_CRTC_REGISTER_VALUE   (0x13D5 + NV2A_CRTC_OFFSET)
 
#define NV2A_RAMDAC_OFFSET   (0x680000 + NV2A_CONTROL_OFFSET)
 
#define NV2A_RAMDAC_FP_HVALID_END   (0x838 + NV2A_RAMDAC_OFFSET)
 
#define NV2A_RAMDAC_FP_VVALID_END   (0x818 + NV2A_RAMDAC_OFFSET)
 

Functions

VOID XboxMachInit (const char *CmdLine)
 
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 XboxPrepareForReactOS (VOID)
 
VOID XboxMemInit (VOID)
 
PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap (ULONG *MemoryMapSize)
 
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 (VOID)
 
VOID XboxHwIdle (VOID)
 
VOID XboxSetLED (PCSTR Pattern)
 

Variables

UCHAR XboxFont8x16 [256 *16]
 

Macro Definition Documentation

◆ LPC_CONFIG_DEVICE_ACTIVATE

#define LPC_CONFIG_DEVICE_ACTIVATE   0x30

Definition at line 35 of file machxbox.h.

◆ LPC_CONFIG_DEVICE_BASE_ADDRESS_HIGH

#define LPC_CONFIG_DEVICE_BASE_ADDRESS_HIGH   0x60

Definition at line 36 of file machxbox.h.

◆ LPC_CONFIG_DEVICE_BASE_ADDRESS_LOW

#define LPC_CONFIG_DEVICE_BASE_ADDRESS_LOW   0x61

Definition at line 37 of file machxbox.h.

◆ LPC_CONFIG_DEVICE_INTERRUPT

#define LPC_CONFIG_DEVICE_INTERRUPT   0x70

Definition at line 38 of file machxbox.h.

◆ LPC_CONFIG_DEVICE_NUMBER

#define LPC_CONFIG_DEVICE_NUMBER   0x07

Definition at line 34 of file machxbox.h.

◆ LPC_DEVICE_SERIAL_PORT_1

#define LPC_DEVICE_SERIAL_PORT_1   0x4

Definition at line 31 of file machxbox.h.

◆ LPC_DEVICE_SERIAL_PORT_2

#define LPC_DEVICE_SERIAL_PORT_2   0x5

Definition at line 32 of file machxbox.h.

◆ LPC_ENTER_CONFIG_KEY

#define LPC_ENTER_CONFIG_KEY   0x55

Definition at line 28 of file machxbox.h.

◆ LPC_EXIT_CONFIG_KEY

#define LPC_EXIT_CONFIG_KEY   0xAA

Definition at line 29 of file machxbox.h.

◆ LPC_IO_BASE

#define LPC_IO_BASE   0x2E

Definition at line 27 of file machxbox.h.

◆ MAX_XBOX_COM_PORTS

#define MAX_XBOX_COM_PORTS   2

Definition at line 25 of file machxbox.h.

◆ NV2A_CONTROL_OFFSET

#define NV2A_CONTROL_OFFSET   0xFD000000

Definition at line 40 of file machxbox.h.

◆ NV2A_CRTC_FRAMEBUFFER_START

#define NV2A_CRTC_FRAMEBUFFER_START   (0x800 + NV2A_CRTC_OFFSET)

Definition at line 42 of file machxbox.h.

◆ NV2A_CRTC_OFFSET

#define NV2A_CRTC_OFFSET   (0x600000 + NV2A_CONTROL_OFFSET)

Definition at line 41 of file machxbox.h.

◆ NV2A_CRTC_REGISTER_INDEX

#define NV2A_CRTC_REGISTER_INDEX   (0x13D4 + NV2A_CRTC_OFFSET)

Definition at line 43 of file machxbox.h.

◆ NV2A_CRTC_REGISTER_VALUE

#define NV2A_CRTC_REGISTER_VALUE   (0x13D5 + NV2A_CRTC_OFFSET)

Definition at line 44 of file machxbox.h.

◆ NV2A_RAMDAC_FP_HVALID_END

#define NV2A_RAMDAC_FP_HVALID_END   (0x838 + NV2A_RAMDAC_OFFSET)

Definition at line 46 of file machxbox.h.

◆ NV2A_RAMDAC_FP_VVALID_END

#define NV2A_RAMDAC_FP_VVALID_END   (0x818 + NV2A_RAMDAC_OFFSET)

Definition at line 47 of file machxbox.h.

◆ NV2A_RAMDAC_OFFSET

#define NV2A_RAMDAC_OFFSET   (0x680000 + NV2A_CONTROL_OFFSET)

Definition at line 45 of file machxbox.h.

Function Documentation

◆ XboxConsGetCh()

int XboxConsGetCh ( VOID  )

Definition at line 66 of file xboxcons.c.

67 {
68  /* No keyboard support yet */
69  while (1)
70  {
71  ;
72  }
73 
74  return 0;
75 }

Referenced by XboxMachInit().

◆ XboxConsKbHit()

BOOLEAN XboxConsKbHit ( VOID  )

Definition at line 59 of file xboxcons.c.

60 {
61  /* No keyboard support yet */
62  return FALSE;
63 }

Referenced by XboxMachInit().

◆ XboxConsPutChar()

VOID XboxConsPutChar ( int  Ch)

Definition at line 26 of file xboxcons.c.

27 {
28  ULONG Width;
29  ULONG Height;
30  ULONG Depth;
31 
32  if ('\r' == c)
33  {
34  CurrentCursorX = 0;
35  }
36  else if ('\n' == c)
37  {
38  CurrentCursorX = 0;
40  }
41  else if ('\t' == c)
42  {
43  CurrentCursorX = (CurrentCursorX + 8) & ~ 7;
44  }
45  else
46  {
49  }
50  XboxVideoGetDisplaySize(&Width, &Height, &Depth);
51  if (Width <= CurrentCursorX)
52  {
53  CurrentCursorX = 0;
55  }
56 }
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION _In_ ULONG _In_ SIZE_T _In_ ULONG _In_ USHORT Depth
Definition: exfuncs.h:656
VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: xboxvideo.c:173
const GLubyte * c
Definition: glext.h:8905
static unsigned CurrentCursorX
Definition: xboxcons.c:21
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: xboxvideo.c:114
static unsigned CurrentCursorY
Definition: xboxcons.c:22
unsigned int ULONG
Definition: retypes.h:1
static unsigned CurrentAttr
Definition: xboxcons.c:23

Referenced by XboxMachInit().

◆ XboxDiskGetCacheableBlockCount()

ULONG XboxDiskGetCacheableBlockCount ( UCHAR  DriveNumber)

Definition at line 516 of file xboxdisk.c.

517 {
518  /* 64 seems a nice number, it is used by the machpc code for LBA devices */
519  return 64;
520 }

Referenced by XboxMachInit().

◆ XboxDiskGetDriveGeometry()

BOOLEAN XboxDiskGetDriveGeometry ( UCHAR  DriveNumber,
PGEOMETRY  DriveGeometry 
)

Definition at line 456 of file xboxdisk.c.

457 {
458  IDE_DRIVE_IDENTIFY DrvParms;
459  ULONG i;
460  BOOLEAN Atapi;
461 
462  Atapi = FALSE; /* FIXME */
463  /* Get the Drive Identify block from drive or die */
466  0,
467  1,
468  0,
469  0,
470  0,
471  ((DriveNumber & 0x0f) == 0 ? IDE_DH_DRV0 : IDE_DH_DRV1),
473  (PUCHAR) &DrvParms))
474  {
475  ERR("XboxDiskPolledRead() failed\n");
476  return FALSE;
477  }
478 
479  Geometry->Cylinders = DrvParms.LogicalCyls;
480  Geometry->Heads = DrvParms.LogicalHeads;
481  Geometry->Sectors = DrvParms.SectorsPerTrack;
482 
483  if (!Atapi && (DrvParms.Capabilities & IDE_DRID_LBA_SUPPORTED) != 0)
484  {
485  /* LBA ATA drives always have a sector size of 512 */
486  Geometry->BytesPerSector = 512;
487  }
488  else
489  {
490  TRACE("BytesPerSector %d\n", DrvParms.BytesPerSector);
491  if (DrvParms.BytesPerSector == 0)
492  {
493  Geometry->BytesPerSector = 512;
494  }
495  else
496  {
497  for (i = 1 << 15; i; i /= 2)
498  {
499  if ((DrvParms.BytesPerSector & i) != 0)
500  {
501  Geometry->BytesPerSector = i;
502  break;
503  }
504  }
505  }
506  }
507  TRACE("Cylinders %d\n", Geometry->Cylinders);
508  TRACE("Heads %d\n", Geometry->Heads);
509  TRACE("Sectors %d\n", Geometry->Sectors);
510  TRACE("BytesPerSector %d\n", Geometry->BytesPerSector);
511 
512  return TRUE;
513 }
static BOOLEAN XboxDiskPolledRead(ULONG CommandPort, ULONG ControlPort, UCHAR PreComp, UCHAR SectorCnt, UCHAR SectorNum, UCHAR CylinderLow, UCHAR CylinderHigh, UCHAR DrvHead, UCHAR Command, PVOID Buffer)
Definition: xboxdisk.c:245
#define TRUE
Definition: types.h:120
unsigned char * PUCHAR
Definition: retypes.h:3
#define XBOX_IDE_CONTROL_PORT
Definition: xboxdisk.c:31
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 IDE_CMD_IDENT_ATAPI_DRV
Definition: xboxdisk.c:87
unsigned char BOOLEAN
#define TRACE(s)
Definition: solgame.cpp:4
#define IDE_DH_DRV1
Definition: xboxdisk.c:64
#define IDE_CMD_IDENT_ATA_DRV
Definition: xboxdisk.c:86
#define ERR(fmt,...)
Definition: debug.h:109
#define IDE_DH_DRV0
Definition: xboxdisk.c:63
unsigned int ULONG
Definition: retypes.h:1
#define IDE_DRID_LBA_SUPPORTED
Definition: xboxdisk.c:185
#define XBOX_IDE_COMMAND_PORT
Definition: xboxdisk.c:30

Referenced by XboxGetHarddiskConfigurationData(), and XboxMachInit().

◆ XboxDiskReadLogicalSectors()

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

Definition at line 413 of file xboxdisk.c.

414 {
415  ULONG StartSector;
416  UCHAR Count;
417 
418  if (DriveNumber < 0x80 || (DriveNumber & 0x0f) >= 2)
419  {
420  /* Xbox has only 1 IDE controller and no floppy */
421  WARN("Invalid drive number\n");
422  return FALSE;
423  }
424 
425  if (((SectorNumber + SectorCount) & UINT64_C(0xfffffffff0000000)) != UINT64_C(0))
426  {
427  FIXME("48bit LBA required but not implemented\n");
428  return FALSE;
429  }
430 
431  StartSector = (ULONG) SectorNumber;
432  while (SectorCount > 0)
433  {
434  Count = (SectorCount <= 255 ? (UCHAR)SectorCount : 255);
437  0, Count,
438  StartSector & 0xff,
439  (StartSector >> 8) & 0xff,
440  (StartSector >> 16) & 0xff,
441  ((StartSector >> 24) & 0x0f) | IDE_DH_LBA |
442  ((DriveNumber & 0x0f) == 0 ? IDE_DH_DRV0 : IDE_DH_DRV1),
443  IDE_CMD_READ,
444  Buffer))
445  {
446  return FALSE;
447  }
448  SectorCount -= Count;
450  }
451 
452  return TRUE;
453 }
signed char * PCHAR
Definition: retypes.h:7
static BOOLEAN XboxDiskPolledRead(ULONG CommandPort, ULONG ControlPort, UCHAR PreComp, UCHAR SectorCnt, UCHAR SectorNum, UCHAR CylinderLow, UCHAR CylinderHigh, UCHAR DrvHead, UCHAR Command, PVOID Buffer)
Definition: xboxdisk.c:245
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:111
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
#define XBOX_IDE_CONTROL_PORT
Definition: xboxdisk.c:31
#define UINT64_C(val)
Definition: freeldr.h:23
#define FIXME(fmt,...)
Definition: debug.h:110
#define IDE_SECTOR_BUF_SZ
Definition: xboxdisk.c:33
Definition: bufpool.h:45
void * PVOID
Definition: retypes.h:9
#define IDE_DH_LBA
Definition: xboxdisk.c:61
unsigned char UCHAR
Definition: xmlstorage.h:181
ULONG SectorCount
Definition: part_xbox.c:32
#define IDE_DH_DRV1
Definition: xboxdisk.c:64
#define IDE_DH_DRV0
Definition: xboxdisk.c:63
#define IDE_CMD_READ
Definition: xboxdisk.c:75
unsigned int ULONG
Definition: retypes.h:1
#define XBOX_IDE_COMMAND_PORT
Definition: xboxdisk.c:30

Referenced by XboxMachInit().

◆ 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 }
static UCHAR HalpQueryCMOS(UCHAR Reg)
Definition: xboxrtc.c:27
USHORT Second
Definition: fw.h:16
USHORT Month
Definition: fw.h:12
USHORT Minute
Definition: fw.h:15
Definition: fw.h:9
USHORT Year
Definition: fw.h:11
#define BCD_INT(bcd)
Definition: xboxrtc.c:24
USHORT Hour
Definition: fw.h:14
#define RTC_REGISTER_A
Definition: xboxrtc.c:21
USHORT Day
Definition: fw.h:13
#define RTC_REG_A_UIP
Definition: xboxrtc.c:22

Referenced by XboxMachInit().

◆ XboxHwDetect()

PCONFIGURATION_COMPONENT_DATA XboxHwDetect ( VOID  )

Definition at line 226 of file machxbox.c.

227 {
229  ULONG BusNumber = 0;
230 
231  TRACE("DetectHardware()\n");
232 
233  /* Create the 'System' key */
234  FldrCreateSystemKey(&SystemKey);
235 
238 
239  /* TODO: Build actual xbox's hardware configuration tree */
240  DetectPciBios(SystemKey, &BusNumber);
241  DetectIsaBios(SystemKey, &BusNumber);
242 
243  TRACE("DetectHardware() Done\n");
244  return SystemKey;
245 }
BOOLEAN XboxFindPciBios(PPCI_REGISTRY_INFO BusData)
Definition: machxbox.c:26
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: hardware.c:40
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:156
#define TRACE(s)
Definition: solgame.cpp:4
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:176
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
Definition: archwsup.c:89
static VOID DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: machxbox.c:165
static PCM_PARTIAL_RESOURCE_LIST XboxGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machxbox.c:96

Referenced by XboxMachInit().

◆ XboxHwIdle()

VOID XboxHwIdle ( VOID  )

Definition at line 247 of file machxbox.c.

248 {
249  /* UNIMPLEMENTED */
250 }

Referenced by XboxMachInit().

◆ XboxMachInit()

VOID XboxMachInit ( const char CmdLine)

Definition at line 256 of file machxbox.c.

257 {
258  /* Set LEDs to red before anything is initialized */
259  XboxSetLED("rrrr");
260 
261  /* Initialize our stuff */
262  XboxMemInit();
263  XboxVideoInit();
264 
265  /* Setup vtbl */
282  MachVtbl.Beep = PcBeep;
294 
295  /* Set LEDs to orange after init */
296  XboxSetLED("oooo");
297 }
BOOLEAN XboxConsKbHit(VOID)
Definition: xboxcons.c:59
PCONFIGURATION_COMPONENT_DATA XboxHwDetect(VOID)
Definition: machxbox.c:226
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
VOID(* GetExtendedBIOSData)(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machine.h:64
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(VOID)
Definition: machine.h:77
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
static UCHAR XboxGetFloppyCount(VOID)
Definition: machxbox.c:211
VOID XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: xboxvideo.c:205
VOID XboxVideoClearScreen(UCHAR Attr)
Definition: xboxvideo.c:104
VOID XboxConsPutChar(int c)
Definition: xboxcons.c:26
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:54
UCHAR(* GetFloppyCount)(VOID)
Definition: machine.h:66
VOID XboxMemInit(VOID)
Definition: xboxmem.c:56
VOID XboxVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: xboxvideo.c:193
BOOLEAN PcInitializeBootDevices(VOID)
Definition: hwdisk.c:468
VOID(* VideoGetFontsFromFirmware)(PULONG RomFontPointers)
Definition: machine.h:49
int XboxConsGetCh(void)
Definition: xboxcons.c:66
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:68
VOID(* VideoSetTextCursorPosition)(UCHAR X, UCHAR Y)
Definition: machine.h:50
ULONG XboxVideoGetBufferSize(VOID)
Definition: xboxvideo.c:181
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:72
VOID XboxVideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: xboxvideo.c:187
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:76
BOOLEAN XboxDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: xboxdisk.c:413
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
BOOLEAN XboxVideoIsPaletteFixed(VOID)
Definition: xboxvideo.c:221
PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap(ULONG *MemoryMapSize)
Definition: xboxmem.c:104
VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: xboxvideo.c:173
VOID XboxPrepareForReactOS(VOID)
Definition: machxbox.c:300
VOID XboxHwIdle(VOID)
Definition: machxbox.c:247
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:67
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
VOID XboxVideoSync(VOID)
Definition: xboxvideo.c:239
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:52
VOID XboxVideoInit(VOID)
Definition: xboxvideo.c:131
void XboxSetLED(PCSTR pattern)
Definition: xboxi2c.c:198
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: xboxvideo.c:114
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:55
VOID PcBeep(VOID)
Definition: i386rtl.c:25
VOID XboxVideoHideShowTextCursor(BOOLEAN Show)
Definition: xboxvideo.c:199
VOID(* PrepareForReactOS)(VOID)
Definition: machine.h:59
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
int(* ConsGetCh)(VOID)
Definition: machine.h:43
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:69
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
BOOLEAN XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: xboxdisk.c:456
MACHVTBL MachVtbl
Definition: arcemul.c:21
VOID(* HwIdle)(VOID)
Definition: machine.h:78
VOID(* VideoSync)(VOID)
Definition: machine.h:57
VOID XboxVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: xboxvideo.c:227
VOID XboxVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: xboxvideo.c:233
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:53
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
VOID XboxGetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machxbox.c:85
VIDEODISPLAYMODE XboxVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
Definition: xboxvideo.c:166
VOID(* Beep)(VOID)
Definition: machine.h:58
TIMEINFO * XboxGetTime(VOID)
Definition: xboxrtc.c:40
ULONG XboxDiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: xboxdisk.c:516
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:51

Referenced by MachInit().

◆ XboxMemGetMemoryMap()

PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap ( ULONG MemoryMapSize)

Definition at line 104 of file xboxmem.c.

105 {
106  TRACE("XboxMemGetMemoryMap()\n");
107  /* FIXME: Obtain memory map via multiboot spec */
108 
109  /* Synthesize memory map */
110 
111  /* Available RAM block */
113  0,
114  AvailableMemoryMb * 1024 * 1024,
115  LoaderFree);
116 
117  if (FrameBufferSize != 0)
118  {
119  /* Video memory */
124  "Video memory");
125  }
126 
127  *MemoryMapSize = PcMemFinalizeMemoryMap(XboxMemoryMap);
128  return XboxMemoryMap;
129 }
ULONG FrameBufferSize
Definition: xboxvideo.c:28
VOID ReserveMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType, PCHAR Usage)
Definition: pcmem.c:479
uint32_t ULONG_PTR
Definition: typedefs.h:63
static ULONG AvailableMemoryMb
Definition: xboxmem.c:28
#define TRACE(s)
Definition: solgame.cpp:4
FREELDR_MEMORY_DESCRIPTOR XboxMemoryMap[MAX_BIOS_DESCRIPTORS+1]
Definition: xboxmem.c:101
VOID SetMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType)
Definition: pcmem.c:522
ULONG PcMemFinalizeMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap)
Definition: pcmem.c:542
PVOID FrameBuffer
Definition: xboxvideo.c:27

Referenced by XboxMachInit().

◆ XboxMemInit()

VOID XboxMemInit ( VOID  )

Definition at line 56 of file xboxmem.c.

57 {
58  UCHAR ControlRegion[TEST_SIZE];
59  PVOID MembaseTop = (PVOID)(64 * 1024 * 1024);
60  PVOID MembaseLow = (PVOID)0;
61 
62  (*(PULONG)(0xfd000000 + 0x100200)) = 0x03070103;
63  (*(PULONG)(0xfd000000 + 0x100204)) = 0x11448000;
64 
65  WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0x84));
66  WRITE_PORT_ULONG((ULONG*) 0xcfc, 0x7ffffff); /* Prep hardware for 128 Mb */
67 
68  InstalledMemoryMb = 64;
69  memset(ControlRegion, TEST_PATTERN1, TEST_SIZE);
70  memset(MembaseTop, TEST_PATTERN1, TEST_SIZE);
71  __wbinvd();
72 
73  if (memcmp(MembaseTop, ControlRegion, TEST_SIZE) == 0)
74  {
75  /* Looks like there is memory .. maybe a 128MB box */
76  memset(ControlRegion, TEST_PATTERN2, TEST_SIZE);
77  memset(MembaseTop, TEST_PATTERN2, TEST_SIZE);
78  __wbinvd();
79  if (memcmp(MembaseTop, ControlRegion, TEST_SIZE) == 0)
80  {
81  /* Definitely looks like there is memory */
82  if (memcmp(MembaseLow, ControlRegion, TEST_SIZE) == 0)
83  {
84  /* Hell, we find the Test-string at 0x0 too! */
85  InstalledMemoryMb = 64;
86  }
87  else
88  {
89  InstalledMemoryMb = 128;
90  }
91  }
92  }
93 
94  /* Set hardware for amount of memory detected */
95  WRITE_PORT_ULONG((ULONG*) 0xcf8, CONFIG_CMD(0, 0, 0x84));
96  WRITE_PORT_ULONG((ULONG*) 0xcfc, InstalledMemoryMb * 1024 * 1024 - 1);
97 
99 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define TEST_SIZE
Definition: xboxmem.c:32
static ULONG AvailableMemoryMb
Definition: xboxmem.c:28
#define TEST_PATTERN1
Definition: xboxmem.c:33
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
void * PVOID
Definition: retypes.h:9
PPC_QUAL void __wbinvd(void)
Definition: intrin_ppc.h:759
unsigned char UCHAR
Definition: xmlstorage.h:181
#define TEST_PATTERN2
Definition: xboxmem.c:34
unsigned int * PULONG
Definition: retypes.h:1
#define CONFIG_CMD(bus, dev_fn, where)
Definition: hardware.h:23
static ULONG InstalledMemoryMb
Definition: xboxmem.c:27
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39

Referenced by XboxMachInit().

◆ XboxPrepareForReactOS()

VOID XboxPrepareForReactOS ( VOID  )

Definition at line 300 of file machxbox.c.

301 {
302  /* On XBOX, prepare video and turn off the floppy motor */
304  DiskStopFloppyMotor();
305 }
VOID XboxVideoPrepareForReactOS(VOID)
Definition: xboxvideo.c:252

Referenced by XboxMachInit().

◆ 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
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLboolean GLboolean g
Definition: glext.h:6204
static void I2cSetFrontpanelLed(UCHAR b)
Definition: xboxi2c.c:188
GLubyte * pattern
Definition: glext.h:7787

Referenced by XboxMachInit().

◆ XboxVideoClearScreen()

VOID XboxVideoClearScreen ( UCHAR  Attr)

Definition at line 104 of file xboxvideo.c.

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

Referenced by XboxMachInit().

◆ XboxVideoCopyOffScreenBufferToVRAM()

VOID XboxVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 205 of file xboxvideo.c.

206 {
207  PUCHAR OffScreenBuffer = (PUCHAR) Buffer;
208  ULONG Col, Line;
209 
210  for (Line = 0; Line < (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT; Line++)
211  {
212  for (Col = 0; Col < ScreenWidth / CHAR_WIDTH; Col++)
213  {
214  XboxVideoPutChar(OffScreenBuffer[0], OffScreenBuffer[1], Col, Line);
215  OffScreenBuffer += 2;
216  }
217  }
218 }
unsigned char * PUCHAR
Definition: retypes.h:3
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:37
static ULONG ScreenWidth
Definition: xboxvideo.c:29
Definition: bufpool.h:45
static ULONG ScreenHeight
Definition: xboxvideo.c:30
Definition: ncftp.h:79
#define CHAR_WIDTH
Definition: xboxvideo.c:34
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: xboxvideo.c:114
#define CHAR_HEIGHT
Definition: xboxvideo.c:35
unsigned int ULONG
Definition: retypes.h:1
struct Line Line

Referenced by XboxMachInit().

◆ XboxVideoGetBufferSize()

ULONG XboxVideoGetBufferSize ( VOID  )

Definition at line 181 of file xboxvideo.c.

182 {
184 }
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:37
static ULONG ScreenWidth
Definition: xboxvideo.c:29
static ULONG ScreenHeight
Definition: xboxvideo.c:30
#define CHAR_WIDTH
Definition: xboxvideo.c:34
#define CHAR_HEIGHT
Definition: xboxvideo.c:35

Referenced by XboxMachInit().

◆ XboxVideoGetDisplaySize()

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

Definition at line 173 of file xboxvideo.c.

174 {
175  *Width = ScreenWidth / CHAR_WIDTH;
176  *Height = (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT;
177  *Depth = 0;
178 }
_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:37
static ULONG ScreenWidth
Definition: xboxvideo.c:29
static ULONG ScreenHeight
Definition: xboxvideo.c:30
#define CHAR_WIDTH
Definition: xboxvideo.c:34
#define CHAR_HEIGHT
Definition: xboxvideo.c:35

Referenced by XboxConsPutChar(), and XboxMachInit().

◆ XboxVideoGetFontsFromFirmware()

VOID XboxVideoGetFontsFromFirmware ( PULONG  RomFontPointers)

Definition at line 187 of file xboxvideo.c.

188 {
189  TRACE("XboxVideoGetFontsFromFirmware(): UNIMPLEMENTED\n");
190 }
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by XboxMachInit().

◆ XboxVideoGetPaletteColor()

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

Definition at line 233 of file xboxvideo.c.

234 {
235  /* Not supported */
236 }

Referenced by XboxMachInit().

◆ XboxVideoHideShowTextCursor()

VOID XboxVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 199 of file xboxvideo.c.

200 {
201  /* We don't have a cursor yet */
202 }

Referenced by XboxMachInit(), and XboxVideoPrepareForReactOS().

◆ XboxVideoInit()

VOID XboxVideoInit ( VOID  )

Definition at line 131 of file xboxvideo.c.

132 {
133  /* Reuse framebuffer that was set up by firmware */
135  /* Verify that framebuffer address is page-aligned */
137 
138  /* FIXME: obtain fb size from firmware somehow (Cromwell reserves high 4 MB of RAM) */
139  FrameBufferSize = 4 * 1024 * 1024;
140 
143  /* Get BPP directly from NV2A CRTC (magic constants are from Cromwell) */
144  BytesPerPixel = 8 * (((NvGetCrtc(0x19) & 0xE0) << 3) | (NvGetCrtc(0x13) & 0xFF)) / ScreenWidth;
145  if (BytesPerPixel == 4)
146  {
147  ASSERT((NvGetCrtc(0x28) & 0xF) == BytesPerPixel - 1);
148  }
149  else
150  {
151  ASSERT((NvGetCrtc(0x28) & 0xF) == BytesPerPixel);
152  }
153  Delta = (ScreenWidth * BytesPerPixel + 3) & ~ 0x3;
154 
155  /* Verify screen resolution */
156  ASSERT(ScreenWidth > 1);
157  ASSERT(ScreenHeight > 1);
158  ASSERT(BytesPerPixel >= 1 && BytesPerPixel <= 4);
159  /* Verify that screen fits framebuffer size */
161 
163 }
#define TRUE
Definition: types.h:120
static VOID XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: xboxvideo.c:88
static ULONG BytesPerPixel
Definition: xboxvideo.c:31
static ULONG ScreenWidth
Definition: xboxvideo.c:29
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define NV2A_RAMDAC_FP_VVALID_END
Definition: machxbox.h:47
ULONG FrameBufferSize
Definition: xboxvideo.c:28
void * PVOID
Definition: retypes.h:9
#define NV2A_CRTC_FRAMEBUFFER_START
Definition: machxbox.h:42
static ULONG ScreenHeight
Definition: xboxvideo.c:30
UCHAR NvGetCrtc(UCHAR Index)
Definition: xboxvideo.c:124
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define PAGE_SIZE
Definition: env_spec_w32.h:49
PVOID FrameBuffer
Definition: xboxvideo.c:27
static ULONG Delta
Definition: xboxvideo.c:32
unsigned int * PULONG
Definition: retypes.h:1
#define MAKE_COLOR(Red, Green, Blue)
Definition: xboxvideo.c:41
#define NV2A_RAMDAC_FP_HVALID_END
Definition: machxbox.h:46

Referenced by XboxMachInit().

◆ XboxVideoIsPaletteFixed()

BOOLEAN XboxVideoIsPaletteFixed ( VOID  )

Definition at line 221 of file xboxvideo.c.

222 {
223  return FALSE;
224 }

Referenced by XboxMachInit().

◆ XboxVideoPrepareForReactOS()

VOID XboxVideoPrepareForReactOS ( VOID  )

Definition at line 252 of file xboxvideo.c.

253 {
256 }
#define TRUE
Definition: types.h:120
static VOID XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: xboxvideo.c:88
VOID XboxVideoHideShowTextCursor(BOOLEAN Show)
Definition: xboxvideo.c:199
#define MAKE_COLOR(Red, Green, Blue)
Definition: xboxvideo.c:41

Referenced by XboxPrepareForReactOS().

◆ XboxVideoPutChar()

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

Definition at line 114 of file xboxvideo.c.

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

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

◆ XboxVideoSetDisplayMode()

VIDEODISPLAYMODE XboxVideoSetDisplayMode ( char DisplayModem,
BOOLEAN  Init 
)

Definition at line 166 of file xboxvideo.c.

167 {
168  /* We only have one mode, semi-text */
169  return VideoTextMode;
170 }

Referenced by XboxMachInit().

◆ XboxVideoSetPaletteColor()

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

Definition at line 227 of file xboxvideo.c.

228 {
229  /* Not supported */
230 }

Referenced by XboxMachInit().

◆ XboxVideoSetTextCursorPosition()

VOID XboxVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 193 of file xboxvideo.c.

194 {
195  /* We don't have a cursor yet */
196 }

Referenced by XboxMachInit().

◆ XboxVideoSync()

VOID XboxVideoSync ( VOID  )

Definition at line 239 of file xboxvideo.c.

240 {
241  /* Not supported */
242 }

Referenced by XboxMachInit().

Variable Documentation

◆ XboxFont8x16

UCHAR XboxFont8x16[256 *16]

Definition at line 23 of file xboxfont.c.