Functions

Functions

int32_t hal_gfx_sys_init (void)
 Initialize system. Implementor defined. Called in hal_gfx_init() More...
 
int hal_gfx_wait_irq (void)
 Wait for interrupt from the GPU. More...
 
int hal_gfx_wait_irq_cl (int cl_id)
 Wait for a Command List to finish. More...
 
int hal_gfx_wait_irq_brk (int brk_id)
 Wait for a Breakpoint. More...
 
uint32_t hal_gfx_reg_read (uint32_t reg)
 Read Hardware register. More...
 
void hal_gfx_reg_write (uint32_t reg, uint32_t value)
 Write Hardware Register. More...
 
hal_gfx_buffer_t hal_gfx_buffer_create (int size)
 Create memory buffer. More...
 
hal_gfx_buffer_t hal_gfx_buffer_create_pool (int pool, int size)
 Create memory buffer at a specific pool. More...
 
void * hal_gfx_buffer_map (hal_gfx_buffer_t *bo)
 Maps buffer. More...
 
void hal_gfx_buffer_unmap (hal_gfx_buffer_t *bo)
 Unmaps buffer. More...
 
void hal_gfx_buffer_destroy (hal_gfx_buffer_t *bo)
 Destroy/deallocate buffer. More...
 
uintptr_t hal_gfx_buffer_phys (hal_gfx_buffer_t *bo)
 Get physical (GPU) base address of a given buffer. More...
 
void hal_gfx_buffer_flush (hal_gfx_buffer_t *bo)
 Write-back buffer from cache to main memory. More...
 
void * hal_gfx_host_malloc (size_t size)
 Allocate memory for CPU to use (typically, standard malloc() is called) More...
 
void hal_gfx_host_free (void *ptr)
 Free memory previously allocated with hal_gfx_host_malloc() More...
 
int hal_gfx_rb_init (hal_gfx_ringbuffer_t *rb, int reset)
 Initialize Ring Buffer. Should be called from inside hal_gfx_sys_init(). This is a private function, the user should never call it. More...
 
int hal_gfx_mutex_lock (int mutex_id)
 Mutex Lock for multiple processes/threads. More...
 
int hal_gfx_mutex_unlock (int mutex_id)
 Mutex Unlock for multiple processes/threads. More...
 

Detailed Description

Function Documentation

◆ hal_gfx_buffer_create()

hal_gfx_buffer_t hal_gfx_buffer_create ( int  size)

Create memory buffer.

Parameters
[in]sizeSize of buffer in bytes
Returns
hal_gfx_buffer_t struct

◆ hal_gfx_buffer_create_pool()

hal_gfx_buffer_t hal_gfx_buffer_create_pool ( int  pool,
int  size 
)

Create memory buffer at a specific pool.

Parameters
[in]poolID of the desired memory pool
[in]sizeof buffer in bytes
Returns
hal_gfx_buffer_t struct

◆ hal_gfx_buffer_destroy()

void hal_gfx_buffer_destroy ( hal_gfx_buffer_t bo)

Destroy/deallocate buffer.

Parameters
[in]boPointer to buffer struct

◆ hal_gfx_buffer_flush()

void hal_gfx_buffer_flush ( hal_gfx_buffer_t bo)

Write-back buffer from cache to main memory.

Parameters
[in]boPointer to buffer struct

◆ hal_gfx_buffer_map()

void* hal_gfx_buffer_map ( hal_gfx_buffer_t bo)

Maps buffer.

Parameters
[in]boPointer to buffer struct
Returns
Virtual pointer of the buffer (same as in bo->base_virt)

◆ hal_gfx_buffer_phys()

uintptr_t hal_gfx_buffer_phys ( hal_gfx_buffer_t bo)

Get physical (GPU) base address of a given buffer.

Parameters
[in]boPointer to buffer struct
Returns
Physical base address of a given buffer

◆ hal_gfx_buffer_unmap()

void hal_gfx_buffer_unmap ( hal_gfx_buffer_t bo)

Unmaps buffer.

Parameters
[in]boPointer to buffer struct

◆ hal_gfx_host_free()

void hal_gfx_host_free ( void *  ptr)

Free memory previously allocated with hal_gfx_host_malloc()

Parameters
[in]ptrPointer to allocated memory (virtual)

◆ hal_gfx_host_malloc()

void* hal_gfx_host_malloc ( size_t  size)

Allocate memory for CPU to use (typically, standard malloc() is called)

Parameters
[in]sizeSize in bytes
Returns
Pointer to allocated memory (virtual)

◆ hal_gfx_mutex_lock()

int hal_gfx_mutex_lock ( int  mutex_id)

Mutex Lock for multiple processes/threads.

Parameters
[in]mutex_idMUTEX_RB or MUTEX_MALLOC

◆ hal_gfx_mutex_unlock()

int hal_gfx_mutex_unlock ( int  mutex_id)

Mutex Unlock for multiple processes/threads.

Parameters
[in]mutex_idMUTEX_RB or MUTEX_MALLOC

◆ hal_gfx_rb_init()

int hal_gfx_rb_init ( hal_gfx_ringbuffer_t rb,
int  reset 
)

Initialize Ring Buffer. Should be called from inside hal_gfx_sys_init(). This is a private function, the user should never call it.

Parameters
[in]rbPointer to hal_gfx_ring_buffer_t struct
[in]resetResets the Ring Buffer if non-zero
Returns
Negative number on error

◆ hal_gfx_reg_read()

uint32_t hal_gfx_reg_read ( uint32_t  reg)

Read Hardware register.

Parameters
[in]regRegister to read
Returns
Value read from the register

◆ hal_gfx_reg_write()

void hal_gfx_reg_write ( uint32_t  reg,
uint32_t  value 
)

Write Hardware Register.

Parameters
[in]regRegister to write
[in]valueValue to be written

◆ hal_gfx_sys_init()

int32_t hal_gfx_sys_init ( void  )

Initialize system. Implementor defined. Called in hal_gfx_init()

Returns
0 if no errors occurred

◆ hal_gfx_wait_irq()

int hal_gfx_wait_irq ( void  )

Wait for interrupt from the GPU.

Returns
0 on success

◆ hal_gfx_wait_irq_brk()

int hal_gfx_wait_irq_brk ( int  brk_id)

Wait for a Breakpoint.

Parameters
[in]brk_idBreakpoint ID
Returns
0 on success

◆ hal_gfx_wait_irq_cl()

int hal_gfx_wait_irq_cl ( int  cl_id)

Wait for a Command List to finish.

Parameters
[in]cl_idcl_id Command List ID
Returns
0 on success