gpu.h File Reference

Barebones GPU communications driver. More...

`#include "registers.h"`
`#include "enums.h"`

Go to the source code of this file.

## Macros

#define | GPUCMD_HEADER(incremental, mask, reg) (((incremental)<<31)|(((mask)&0xF)<<16)|((reg)&0x3FF))
| Creates a GPU command header from its write increments, mask, and register.
#define | GPUCMD_AddMaskedWrite(reg, mask, val) GPUCMD_AddSingleParam(GPUCMD_HEADER(0, (mask), (reg)), (val))
| Adds a masked register write to the current command buffer.
#define | GPUCMD_AddWrite(reg, val) GPUCMD_AddMaskedWrite((reg), 0xF, (val))
| Adds a register write to the current command buffer.
#define | GPUCMD_AddMaskedWrites(reg, mask, vals, num) GPUCMD_Add(GPUCMD_HEADER(0, (mask), (reg)), (vals), (num))
| Adds multiple masked register writes to the current command buffer.
#define | GPUCMD_AddWrites(reg, vals, num) GPUCMD_AddMaskedWrites((reg), 0xF, (vals), (num))
| Adds multiple register writes to the current command buffer.
#define | GPUCMD_AddMaskedIncrementalWrites(reg, mask, vals, num) GPUCMD_Add(GPUCMD_HEADER(1, (mask), (reg)), (vals), (num))
| Adds multiple masked incremental register writes to the current command buffer.
#define | GPUCMD_AddIncrementalWrites(reg, vals, num) GPUCMD_AddMaskedIncrementalWrites((reg), 0xF, (vals), (num))
| Adds multiple incremental register writes to the current command buffer.

## Functions

static void | GPUCMD_SetBuffer (u32 *adr, u32 size, u32 offset)
| Sets the GPU command buffer to use. More...
static void | GPUCMD_SetBufferOffset (u32 offset)
| Sets the offset of the GPU command buffer. More...
static void | GPUCMD_GetBuffer (u32 **addr, u32 *size, u32 *offset)
| Gets the current GPU command buffer. More...
void | GPUCMD_AddRawCommands (const u32 *cmd, u32 size)
| Adds raw GPU commands to the current command buffer. More...
void | GPUCMD_Add (u32 header, const u32 *param, u32 paramlength)
| Adds a GPU command to the current command buffer. More...
void | GPUCMD_Split (u32 **addr, u32 *size)
| Splits the current GPU command buffer. More...
u32 | f32tof16 (float f)
| Converts a 32-bit float to a 16-bit float. More...
u32 | f32tof20 (float f)
| Converts a 32-bit float to a 20-bit float. More...
u32 | f32tof24 (float f)
| Converts a 32-bit float to a 24-bit float. More...
u32 | f32tof31 (float f)
| Converts a 32-bit float to a 31-bit float. More...
static void | GPUCMD_AddSingleParam (u32 header, u32 param)
| Adds a command with a single parameter to the current command buffer.

## Variables

u32 * | gpuCmdBuf
| GPU command buffer.
u32 | gpuCmdBufSize
| GPU command buffer size.
u32 | gpuCmdBufOffset
| GPU command buffer offset.

## Detailed Description

Barebones GPU communications driver.

## Function Documentation

## f32tof16()

u32 f32tof16 | ( | float | f | ) |

Converts a 32-bit float to a 16-bit float.

Parameters

  f | Float to convert.

Returns
  The converted float.

## f32tof20()

u32 f32tof20 | ( | float | f | ) |

Converts a 32-bit float to a 20-bit float.

Parameters

  f | Float to convert.

Returns
  The converted float.

## f32tof24()

u32 f32tof24 | ( | float | f | ) |

Converts a 32-bit float to a 24-bit float.

Parameters

  f | Float to convert.

Returns
  The converted float.

## f32tof31()

u32 f32tof31 | ( | float | f | ) |

Converts a 32-bit float to a 31-bit float.

Parameters

  f | Float to convert.

Returns
  The converted float.

## GPUCMD_Add()

void GPUCMD_Add | ( | u32 | header,
|  | const u32 * | param,
|  | u32 | paramlength
| ) |  |

Adds a GPU command to the current command buffer.

Parameters

  header | Header of the command.
  param | Parameters of the command.
  paramlength | Size of the parameter buffer.

## GPUCMD_AddRawCommands()

void GPUCMD_AddRawCommands | ( | const u32 * | cmd,
|  | u32 | size
| ) |  |

Adds raw GPU commands to the current command buffer.

Parameters

  cmd | Buffer containing commands to add.
  size | Size of the buffer.

## GPUCMD_GetBuffer()

static void GPUCMD_GetBuffer | ( | u32 ** | addr,
|  | u32 * | size,
|  | u32 * | offset
| ) |  |

inlinestatic

Gets the current GPU command buffer.

Parameters

  addr | Pointer to output the command buffer to.
  size | Pointer to output the size (in words) of the command buffer to.
  offset | Pointer to output the offset of the command buffer to.

## GPUCMD_SetBuffer()

static void GPUCMD_SetBuffer | ( | u32 * | adr,
|  | u32 | size,
|  | u32 | offset
| ) |  |

inlinestatic

Sets the GPU command buffer to use.

Parameters

  adr | Pointer to the command buffer.
  size | Size of the command buffer.
  offset | Offset of the command buffer.

## GPUCMD_SetBufferOffset()

static void GPUCMD_SetBufferOffset | ( | u32 | offset | ) |

inlinestatic

Sets the offset of the GPU command buffer.

Parameters

  offset | Offset of the command buffer.

## GPUCMD_Split()

void GPUCMD_Split | ( | u32 ** | addr,
|  | u32 * | size
| ) |  |

Splits the current GPU command buffer.

Parameters

  addr | Pointer to output the command buffer to.
  size | Pointer to output the size (in words) of the command buffer to.