Skip to content

File formosa-driver.h

FileList > formosa-driver > include > formosa-driver.h

Go to the source code of this file

  • #include <stddef.h>
  • #include <stdint.h>

Public Functions

Type Name
int fsa_addr_malloc (uintptr_t dev_addr, size_t size)
int fsa_cache_flush ()
int fsa_cache_invalidate ()
int fsa_cmd_barrier ()
int fsa_copy_from_dev (uintptr_t dev_addr, void * host_ptr, size_t size)
int fsa_copy_to_dev (uintptr_t dev_addr, const void * host_ptr, size_t size)
int fsa_driver_init (void * args)
int fsa_driver_uninit ()
int fsa_free (void * dev_addr)
int fsa_malloc (void ** dev_addr, size_t size)
int fsa_mmio (int id, uint64_t wr_val, uint64_t * rd_ptr)
int fsa_probe ()
int fsa_start_kernel ()

Public Functions Documentation

function fsa_addr_malloc

int fsa_addr_malloc (
    uintptr_t dev_addr,
    size_t size
) 

Allocate memory on device with designated address.

Parameters:

  • dev_addr Device address to allocate memory.
  • size Size of memory to allocate.

Returns:

0 on success, -1 on failure.


function fsa_cache_flush

int fsa_cache_flush () 

Flush cache. Write back all dirty lines in cache to memory.

Returns:

0 on success, -1 on failure.


function fsa_cache_invalidate

int fsa_cache_invalidate () 

Invalidate all lines in cache.

Returns:

0 on success, -1 on failure.


function fsa_cmd_barrier

int fsa_cmd_barrier () 

Barrier command for synchronization. All commands before barrier will be completed before barrier returns.

Returns:

0 on success, -1 on failure.


function fsa_copy_from_dev

int fsa_copy_from_dev (
    uintptr_t dev_addr,
    void * host_ptr,
    size_t size
) 

Copy data from device to host.

Parameters:

  • dev_addr Device address to copy from.
  • host_ptr Host pointer that data is copied to.
  • size Size of data to copy.

Returns:

0 on success, -1 on failure.


function fsa_copy_to_dev

int fsa_copy_to_dev (
    uintptr_t dev_addr,
    const void * host_ptr,
    size_t size
) 

Copy data from host to device.

Parameters:

  • dev_addr Device address to copy to.
  • host_ptr Host pointer that data is copied from.
  • size Size of data to copy.

Returns:

0 on success, -1 on failure.


function fsa_driver_init

int fsa_driver_init (
    void * args
) 

Initialize driver.

Parameters:

  • args Arguments for initialization.

Returns:

0 on success, -1 on failure.


function fsa_driver_uninit

int fsa_driver_uninit () 

Uninitialize driver.

Returns:

0 on success, -1 on failure.


function fsa_free

int fsa_free (
    void * dev_addr
) 

Free memory on device.

Parameters:

  • dev_addr Device address to free memory.

Returns:

0 on success, -1 on failure.


function fsa_malloc

int fsa_malloc (
    void ** dev_addr,
    size_t size
) 

Allocate memory on device.

Parameters:

  • dev_addr Pointer to device address to allocate memory.
  • size Size of memory to allocate.

Returns:

0 on success, -1 on failure.


function fsa_mmio

int fsa_mmio (
    int id,
    uint64_t wr_val,
    uint64_t * rd_ptr
) 

Memory-mapped I/O. When rd_ptr is nullptr, it is a write request. Otherwise, it is a read request.

Parameters:

  • id CSR ID.
  • wr_val Value to write.
  • rd_ptr Pointer to read value.

Returns:

0 on success, -1 on failure.


function fsa_probe

int fsa_probe () 

Probe for available devices.

Returns:

0 on device found, -1 on no device found.


function fsa_start_kernel

int fsa_start_kernel () 

Start kernel on device.

Returns:

0 on success, -1 on failure.



The documentation for this class was generated from the following file projects/formosa-driver/include/formosa-driver.h