SDSoC Environment API
This section describes
functions in sds_lib
available for applications developed in the
SDSoC environment.
Note: To use the library,
The
SDSoC™ environment API provides functions to map memory
spaces, and to wait for asynchronous accelerator calls to complete.#include "sds_lib.h"
in source files. You
must include stdlib.h before including sds_lib.h
to provide the size_t
type declaration.void sds_wait(unsigned int id)
- Wait for the first accelerator in the queue identified by
id
, to complete. The recommended alternative is the use#pragma SDS wait(id)
, as described in Asynchronous Function Execution.
void *sds_alloc(size_t size)
- Allocate a physically contiguous array of
size
bytes.
void *sds_alloc_non_cacheable(size_t size)
-
Allocate a physically contiguous array of
size
bytes that is marked as non-cacheable. Memory allocated by this function is not cached in the processing system. Pointers to this memory should be passed to a hardware function in conjunction with#pragma SDS data mem_attribute (p:NON_CACHEABLE)
void sds_free(void *memptr)
- Free an array allocated through sds_alloc()
void *sds_mmap(void *physical_addr, size_t size, void *virtual_addr)
- Create a virtual address mapping to access a memory of
size
bytes located at physical addressphysical_addr
.physical_addr
: physical address to be mapped.size
: size of physical address to be mapped.virtual_addr
:- If not null, it is considered to be the virtual-address
already mapped to the
physical_addr
, andsds_mmap
keeps track of the mapping. - If null,
sds_mmap
invokesmmap()
to generate the virtual address, andvirtual_addr
is assigned this value.
- If not null, it is considered to be the virtual-address
already mapped to the
void *sds_munmap(void *virtual_addr)
- Unmaps a virtual address associated with a physical address created using sds_mmap().
unsigned long long sds_clock_counter(void)
- Returns the value associated with a free-running counter used for fine grain time interval measurements.
unsigned long long sds_clock_frequency(void)
- Returns the frequency (in ticks/second) associated with the free-running
counter that is read by calls to
sds_clock_counter
. This is used to translate counter ticks to seconds.