ReactOS  0.4.15-dev-341-g17c5fb8
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_FB_OFFSET   (0x100000 + NV2A_CONTROL_OFFSET)
 
#define NV2A_FB_CFG0   (0x200 + NV2A_FB_OFFSET)
 
#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 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 (VOID)
 
VOID XboxHwIdle (VOID)
 
VOID XboxSetLED (PCSTR Pattern)
 

Variables

UCHAR BitmapFont8x16 [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 44 of file machxbox.h.

◆ NV2A_CRTC_OFFSET

#define NV2A_CRTC_OFFSET   (0x600000 + NV2A_CONTROL_OFFSET)

Definition at line 43 of file machxbox.h.

◆ NV2A_CRTC_REGISTER_INDEX

#define NV2A_CRTC_REGISTER_INDEX   (0x13D4 + NV2A_CRTC_OFFSET)

Definition at line 45 of file machxbox.h.

◆ NV2A_CRTC_REGISTER_VALUE

#define NV2A_CRTC_REGISTER_VALUE   (0x13D5 + NV2A_CRTC_OFFSET)

Definition at line 46 of file machxbox.h.

◆ NV2A_FB_CFG0

#define NV2A_FB_CFG0   (0x200 + NV2A_FB_OFFSET)

Definition at line 42 of file machxbox.h.

◆ NV2A_FB_OFFSET

#define NV2A_FB_OFFSET   (0x100000 + NV2A_CONTROL_OFFSET)

Definition at line 41 of file machxbox.h.

◆ NV2A_RAMDAC_FP_HVALID_END

#define NV2A_RAMDAC_FP_HVALID_END   (0x838 + NV2A_RAMDAC_OFFSET)

Definition at line 48 of file machxbox.h.

◆ NV2A_RAMDAC_FP_VVALID_END

#define NV2A_RAMDAC_FP_VVALID_END   (0x818 + NV2A_RAMDAC_OFFSET)

Definition at line 49 of file machxbox.h.

◆ NV2A_RAMDAC_OFFSET

#define NV2A_RAMDAC_OFFSET   (0x680000 + NV2A_CONTROL_OFFSET)

Definition at line 47 of file machxbox.h.

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 }

Referenced by MachInit().

◆ XboxConsPutChar()

VOID XboxConsPutChar ( int  Ch)

Definition at line 26 of file xboxcons.c.

27 {
28  ULONG Width, Height, Unused;
29  BOOLEAN NeedScroll;
30 
31  XboxVideoGetDisplaySize(&Width, &Height, &Unused);
32 
33  NeedScroll = (CurrentCursorY >= Height);
34  if (NeedScroll)
35  {
38  }
39 
40  if (c == '\r')
41  {
42  CurrentCursorX = 0;
43  }
44  else if (c == '\n')
45  {
46  CurrentCursorX = 0;
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  {
63  CurrentCursorX = 0;
65  }
66 }
_Must_inspect_result_ typedef _In_ PVOID Unused
Definition: iotypes.h:1129
unsigned char BOOLEAN
VOID XboxVideoScrollUp(VOID)
Definition: xboxvideo.c:105
VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: xboxvideo.c:240
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:133
static unsigned CurrentCursorY
Definition: xboxcons.c:22
unsigned int ULONG
Definition: retypes.h:1
static unsigned CurrentAttr
Definition: xboxcons.c:23

Referenced by MachInit().

◆ XboxDiskGetCacheableBlockCount()

ULONG XboxDiskGetCacheableBlockCount ( UCHAR  DriveNumber)

Definition at line 122 of file xboxdisk.c.

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

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->Sectors = DeviceUnit->Sectors;
116  Geometry->BytesPerSector = DeviceUnit->SectorSize;
117 
118  return TRUE;
119 }
ULONG Cylinders
Definition: hwide.h:294
#define TRUE
Definition: types.h:120
ULONG SectorSize
Definition: hwide.h:297
ULONG Heads
Definition: hwide.h:295
ULONG Sectors
Definition: hwide.h:296
static PDEVICE_UNIT XboxDiskDriveNumberToDeviceUnit(UCHAR DriveNumber)
Definition: xboxdisk.c:63
#define TRACE(s)
Definition: solgame.cpp:4

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 TRUE
Definition: types.h:120
VOID AtaFree(VOID)
Definition: hwide.c:166
BOOLEAN AtaInit(OUT PUCHAR DetectedCount)
Definition: hwide.c:139
static BOOLEAN AtaInitialized
Definition: xboxdisk.c:21
static PDEVICE_UNIT CdDrive
Definition: xboxdisk.c:20
smooth NULL
Definition: ftsmooth.c:416
USHORT Flags
Definition: hwide.h:299
unsigned char UCHAR
Definition: xmlstorage.h:181
#define ATA_DEVICE_ATAPI
Definition: hwide.h:303
PDEVICE_UNIT AtaGetDevice(IN UCHAR UnitNumber)
Definition: hwide.c:178
static PDEVICE_UNIT HardDrive
Definition: xboxdisk.c:19

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 }
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 MachInit().

◆ 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
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pchw.c:45
_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 MachInit().

◆ XboxHwIdle()

VOID XboxHwIdle ( VOID  )

Definition at line 247 of file machxbox.c.

248 {
249  /* UNIMPLEMENTED */
250 }

Referenced by MachInit().

◆ XboxMemGetMemoryMap()

PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap ( ULONG MemoryMapSize)

Definition at line 157 of file xboxmem.c.

158 {
159  memory_map_t * MbMap;
160  INT Count, i;
161 
162  TRACE("XboxMemGetMemoryMap()\n");
163 
165  if (MbMap)
166  {
167  /* Obtain memory map via multiboot spec */
168 
169  for (i = 0; i < Count; i++, MbMap++)
170  {
171  TRACE("i = %d, base_addr_low = 0x%p, length_low = 0x%p\n", i, MbMap->base_addr_low, MbMap->length_low);
172 
173  if (MbMap->base_addr_high > 0 || MbMap->length_high > 0)
174  {
175  ERR("Memory descriptor base or size is greater than 4 GB, should not happen on Xbox!\n");
176  ASSERT(FALSE);
177  }
178 
180  MbMap->base_addr_low,
181  MbMap->length_low,
182  XboxMultibootMemoryType(MbMap->type));
183  }
184  }
185  else
186  {
187  /* Synthesize memory map */
188 
189  /* Available RAM block */
191  0,
192  AvailableMemoryMb * 1024 * 1024,
193  LoaderFree);
194 
195  if (FrameBufferSize != 0)
196  {
197  /* Video memory */
202  "Video memory");
203  }
204  }
205 
206  *MemoryMapSize = PcMemFinalizeMemoryMap(XboxMemoryMap);
207  return XboxMemoryMap;
208 }
ULONG FrameBufferSize
Definition: xboxvideo.c:28
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
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:135
int32_t INT
Definition: typedefs.h:57
uint32_t ULONG_PTR
Definition: typedefs.h:64
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
static ULONG AvailableMemoryMb
Definition: xboxmem.c:28
#define TRACE(s)
Definition: solgame.cpp:4
memory_map_t * XboxGetMultibootMemoryMap(INT *Count)
Definition: xboxmem.c:104
unsigned long length_high
Definition: multiboot.h:122
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
unsigned long base_addr_low
Definition: multiboot.h:119
FREELDR_MEMORY_DESCRIPTOR XboxMemoryMap[MAX_BIOS_DESCRIPTORS+1]
Definition: xboxmem.c:154
#define ERR(fmt,...)
Definition: debug.h:110
unsigned long length_low
Definition: multiboot.h:121
unsigned long base_addr_high
Definition: multiboot.h:120
unsigned long type
Definition: multiboot.h:123
VOID SetMemory(PFREELDR_MEMORY_DESCRIPTOR MemoryMap, ULONG_PTR BaseAddress, SIZE_T Size, TYPE_OF_MEMORY MemoryType)
Definition: pcmem.c:527
ULONG PcMemFinalizeMemoryMap(PFREELDR_MEMORY_DESCRIPTOR MemoryMap)
Definition: pcmem.c:547
PVOID FrameBuffer
Definition: xboxvideo.c:27

Referenced by MachInit().

◆ XboxMemInit()

VOID XboxMemInit ( VOID  )

Definition at line 57 of file xboxmem.c.

58 {
59  UCHAR ControlRegion[TEST_SIZE];
60  PVOID MembaseTop = (PVOID)(64 * 1024 * 1024);
61  PVOID MembaseLow = (PVOID)0;
62 
64  WRITE_REGISTER_ULONG((PULONG)(NV2A_FB_CFG0 + 4), 0x11448000);
65 
66  /* Prep hardware for 128 Mb */
67  WRITE_PORT_ULONG((PULONG)0xCF8, CONFIG_CMD(0, 0, 0x84));
68  WRITE_PORT_ULONG((PULONG)0xCFC, 0x7FFFFFF);
69 
70  InstalledMemoryMb = 64;
71  memset(ControlRegion, TEST_PATTERN1, TEST_SIZE);
72  memset(MembaseTop, TEST_PATTERN1, TEST_SIZE);
73  __wbinvd();
74 
75  if (memcmp(MembaseTop, ControlRegion, TEST_SIZE) == 0)
76  {
77  /* Looks like there is memory .. maybe a 128MB box */
78  memset(ControlRegion, TEST_PATTERN2, TEST_SIZE);
79  memset(MembaseTop, TEST_PATTERN2, TEST_SIZE);
80  __wbinvd();
81  if (memcmp(MembaseTop, ControlRegion, TEST_SIZE) == 0)
82  {
83  /* Definitely looks like there is memory */
84  if (memcmp(MembaseLow, ControlRegion, TEST_SIZE) == 0)
85  {
86  /* Hell, we find the Test-string at 0x0 too! */
87  InstalledMemoryMb = 64;
88  }
89  else
90  {
91  InstalledMemoryMb = 128;
92  }
93  }
94  }
95 
96  /* Set hardware for amount of memory detected */
97  WRITE_PORT_ULONG((PULONG)0xCF8, CONFIG_CMD(0, 0, 0x84));
98  WRITE_PORT_ULONG((PULONG)0xCFC, InstalledMemoryMb * 1024 * 1024 - 1);
99 
101 }
NTKERNELAPI VOID NTAPI WRITE_REGISTER_ULONG(IN PULONG Register, IN ULONG Value)
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define TEST_SIZE
Definition: xboxmem.c:33
static ULONG AvailableMemoryMb
Definition: xboxmem.c:28
#define TEST_PATTERN1
Definition: xboxmem.c:34
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:35
#define NV2A_FB_CFG0
Definition: machxbox.h:42
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
#define memset(x, y, z)
Definition: compat.h:39

Referenced by MachInit().

◆ XboxPrepareForReactOS()

VOID XboxPrepareForReactOS ( VOID  )

Definition at line 321 of file machxbox.c.

322 {
323  /* On Xbox, prepare video and disk support */
327 
328  /* Turn off debug messages to screen */
329  DebugDisableScreenPort();
330 }
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1244
VOID XboxVideoPrepareForReactOS(VOID)
Definition: xboxvideo.c:312
VOID XboxDiskInit(BOOLEAN Init)
Definition: xboxdisk.c:26

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
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 MachInit().

◆ XboxVideoClearScreen()

VOID XboxVideoClearScreen ( UCHAR  Attr)

Definition at line 123 of file xboxvideo.c.

124 {
125  ULONG FgColor, BgColor;
126 
127  XboxVideoAttrToColors(Attr, &FgColor, &BgColor);
128 
130 }
static VOID XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: xboxvideo.c:89
static VOID XboxVideoAttrToColors(UCHAR Attr, ULONG *FgColor, ULONG *BgColor)
Definition: xboxvideo.c:82
unsigned int ULONG
Definition: retypes.h:1

Referenced by MachInit().

◆ XboxVideoCopyOffScreenBufferToVRAM()

VOID XboxVideoCopyOffScreenBufferToVRAM ( PVOID  Buffer)

Definition at line 272 of file xboxvideo.c.

273 {
274  PUCHAR OffScreenBuffer = (PUCHAR) Buffer;
275  ULONG Col, Line;
276 
277  for (Line = 0; Line < (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT; Line++)
278  {
279  for (Col = 0; Col < ScreenWidth / CHAR_WIDTH; Col++)
280  {
281  XboxVideoPutChar(OffScreenBuffer[0], OffScreenBuffer[1], Col, Line);
282  OffScreenBuffer += 2;
283  }
284  }
285 }
unsigned char * PUCHAR
Definition: retypes.h:3
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:38
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:35
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: xboxvideo.c:133
#define CHAR_HEIGHT
Definition: xboxvideo.c:36
unsigned int ULONG
Definition: retypes.h:1
struct Line Line

Referenced by MachInit().

◆ XboxVideoGetBufferSize()

ULONG XboxVideoGetBufferSize ( VOID  )

Definition at line 248 of file xboxvideo.c.

249 {
251 }
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:38
static ULONG ScreenWidth
Definition: xboxvideo.c:29
static ULONG ScreenHeight
Definition: xboxvideo.c:30
#define CHAR_WIDTH
Definition: xboxvideo.c:35
#define CHAR_HEIGHT
Definition: xboxvideo.c:36

Referenced by MachInit().

◆ XboxVideoGetDisplaySize()

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

Definition at line 240 of file xboxvideo.c.

241 {
242  *Width = ScreenWidth / CHAR_WIDTH;
243  *Height = (ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT;
244  *Depth = 0;
245 }
_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:38
static ULONG ScreenWidth
Definition: xboxvideo.c:29
static ULONG ScreenHeight
Definition: xboxvideo.c:30
#define CHAR_WIDTH
Definition: xboxvideo.c:35
#define CHAR_HEIGHT
Definition: xboxvideo.c:36

Referenced by MachInit(), and XboxConsPutChar().

◆ XboxVideoGetFontsFromFirmware()

VOID XboxVideoGetFontsFromFirmware ( PULONG  RomFontPointers)

Definition at line 254 of file xboxvideo.c.

255 {
256  TRACE("XboxVideoGetFontsFromFirmware(): UNIMPLEMENTED\n");
257 }
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by MachInit().

◆ XboxVideoGetPaletteColor()

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

Definition at line 300 of file xboxvideo.c.

301 {
302  /* Not supported */
303 }

Referenced by MachInit().

◆ XboxVideoHideShowTextCursor()

VOID XboxVideoHideShowTextCursor ( BOOLEAN  Show)

Definition at line 266 of file xboxvideo.c.

267 {
268  /* We don't have a cursor yet */
269 }

Referenced by MachInit(), and XboxVideoPrepareForReactOS().

◆ XboxVideoInit()

VOID XboxVideoInit ( VOID  )

Definition at line 193 of file xboxvideo.c.

194 {
195  /* Reuse framebuffer that was set up by firmware */
197  /* Verify that framebuffer address is page-aligned */
199 
200  /* Obtain framebuffer memory size from multiboot memory map */
202  {
203  /* Fallback to Cromwell standard which reserves high 4 MB of RAM */
204  FrameBufferSize = 4 * 1024 * 1024;
205  WARN("Could not detect framebuffer memory size, fallback to 4 MB\n");
206  }
207 
210  /* Get BPP directly from NV2A CRTC (magic constants are from Cromwell) */
211  BytesPerPixel = 8 * (((NvGetCrtc(0x19) & 0xE0) << 3) | (NvGetCrtc(0x13) & 0xFF)) / ScreenWidth;
212  if (BytesPerPixel == 4)
213  {
214  ASSERT((NvGetCrtc(0x28) & 0xF) == BytesPerPixel - 1);
215  }
216  else
217  {
218  ASSERT((NvGetCrtc(0x28) & 0xF) == BytesPerPixel);
219  }
220  Delta = (ScreenWidth * BytesPerPixel + 3) & ~ 0x3;
221 
222  /* Verify screen resolution */
223  ASSERT(ScreenWidth > 1);
224  ASSERT(ScreenHeight > 1);
225  ASSERT(BytesPerPixel >= 1 && BytesPerPixel <= 4);
226  /* Verify that screen fits framebuffer size */
228 
230 }
#define TRUE
Definition: types.h:120
static VOID XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: xboxvideo.c:89
static ULONG BytesPerPixel
Definition: xboxvideo.c:31
#define WARN(fmt,...)
Definition: debug.h:112
static ULONG ScreenWidth
Definition: xboxvideo.c:29
NTKERNELAPI ULONG NTAPI READ_REGISTER_ULONG(IN PULONG Register)
uint32_t ULONG_PTR
Definition: typedefs.h:64
ULONG XboxGetFramebufferSize(PVOID Offset)
Definition: xboxvideo.c:150
#define NV2A_RAMDAC_FP_VVALID_END
Definition: machxbox.h:49
ULONG FrameBufferSize
Definition: xboxvideo.c:28
void * PVOID
Definition: retypes.h:9
#define NV2A_CRTC_FRAMEBUFFER_START
Definition: machxbox.h:44
static ULONG ScreenHeight
Definition: xboxvideo.c:30
UCHAR NvGetCrtc(UCHAR Index)
Definition: xboxvideo.c:143
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
#define MAKE_COLOR(Red, Green, Blue)
Definition: xboxvideo.c:42
#define NV2A_RAMDAC_FP_HVALID_END
Definition: machxbox.h:48

Referenced by MachInit().

◆ XboxVideoIsPaletteFixed()

BOOLEAN XboxVideoIsPaletteFixed ( VOID  )

Definition at line 288 of file xboxvideo.c.

289 {
290  return FALSE;
291 }

Referenced by MachInit().

◆ XboxVideoPrepareForReactOS()

VOID XboxVideoPrepareForReactOS ( VOID  )

Definition at line 312 of file xboxvideo.c.

313 {
316 }
#define TRUE
Definition: types.h:120
static VOID XboxVideoClearScreenColor(ULONG Color, BOOLEAN FullScreen)
Definition: xboxvideo.c:89
VOID XboxVideoHideShowTextCursor(BOOLEAN Show)
Definition: xboxvideo.c:266
#define MAKE_COLOR(Red, Green, Blue)
Definition: xboxvideo.c:42

Referenced by XboxPrepareForReactOS().

◆ XboxVideoPutChar()

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

Definition at line 133 of file xboxvideo.c.

134 {
135  ULONG FgColor, BgColor;
136 
137  XboxVideoAttrToColors(Attr, &FgColor, &BgColor);
138 
139  XboxVideoOutputChar(Ch, X, Y, FgColor, BgColor);
140 }
static VOID XboxVideoOutputChar(UCHAR Char, unsigned X, unsigned Y, ULONG FgColor, ULONG BgColor)
Definition: xboxvideo.c:45
#define Y(I)
#define Ch(x, y, z)
Definition: sha2.c:141
static VOID XboxVideoAttrToColors(UCHAR Attr, ULONG *FgColor, ULONG *BgColor)
Definition: xboxvideo.c:82
unsigned int ULONG
Definition: retypes.h:1

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

◆ XboxVideoScrollUp()

VOID XboxVideoScrollUp ( VOID  )

Definition at line 105 of file xboxvideo.c.

106 {
107  ULONG BgColor, Dummy;
108  ULONG PixelCount = ScreenWidth * CHAR_HEIGHT *
109  (((ScreenHeight - 2 * TOP_BOTTOM_LINES) / CHAR_HEIGHT) - 1);
112 
113  XboxVideoAttrToColors(ATTR(COLOR_WHITE, COLOR_BLACK), &Dummy, &BgColor);
114 
115  while (PixelCount--)
116  *Dst++ = *Src++;
117 
118  for (PixelCount = 0; PixelCount < ScreenWidth * CHAR_HEIGHT; PixelCount++)
119  *Dst++ = BgColor;
120 }
#define COLOR_BLACK
Definition: ui.h:204
unsigned char * PUCHAR
Definition: retypes.h:3
#define TOP_BOTTOM_LINES
Definition: xboxvideo.c:38
static ULONG ScreenWidth
Definition: xboxvideo.c:29
#define ATTR(cFore, cBack)
Definition: ui.h:192
static VOID XboxVideoAttrToColors(UCHAR Attr, ULONG *FgColor, ULONG *BgColor)
Definition: xboxvideo.c:82
static ULONG ScreenHeight
Definition: xboxvideo.c:30
#define COLOR_WHITE
Definition: ui.h:220
#define CHAR_HEIGHT
Definition: xboxvideo.c:36
#define Dst
Definition: mesh.h:153
PVOID FrameBuffer
Definition: xboxvideo.c:27
static ULONG Delta
Definition: xboxvideo.c:32
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1

Referenced by XboxConsPutChar().

◆ XboxVideoSetDisplayMode()

VIDEODISPLAYMODE XboxVideoSetDisplayMode ( char DisplayModem,
BOOLEAN  Init 
)

Definition at line 233 of file xboxvideo.c.

234 {
235  /* We only have one mode, semi-text */
236  return VideoTextMode;
237 }

Referenced by MachInit().

◆ XboxVideoSetPaletteColor()

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

Definition at line 294 of file xboxvideo.c.

295 {
296  /* Not supported */
297 }

Referenced by MachInit().

◆ XboxVideoSetTextCursorPosition()

VOID XboxVideoSetTextCursorPosition ( UCHAR  X,
UCHAR  Y 
)

Definition at line 260 of file xboxvideo.c.

261 {
262  /* We don't have a cursor yet */
263 }

Referenced by MachInit().

◆ XboxVideoSync()

VOID XboxVideoSync ( VOID  )

Definition at line 306 of file xboxvideo.c.

307 {
308  /* Not supported */
309 }

Referenced by MachInit().

Variable Documentation

◆ BitmapFont8x16

UCHAR BitmapFont8x16[256 *16]

Definition at line 12 of file vgafont.c.