Skip to main content
Header: ar_osal/api/ar_osal_shmem.h

Structures

ar_shmem_proc_info_t

Members
uint8_t
ar_shmem_pd_type_t
bool_t

ar_shmem_info_t

Shared memory info structure. Members
ar_shmem_cache_type_t
in, cache type, cached or uncached memory
size_t
in, shared buffer size, should be a minimum of 4K and multiple of 4K only
ar_shmem_memory_type_t
out, shmem memory type, virtual or physical for ar_shmem_alloc()
ar_shmem_buffer_index_type_t
out, DSP to operate on buffer offsets or on address pointers.
uint32_t
out, smmu mapped ipa lsw, output for ar_shmem_alloc()/ar_shmem_map()
uint32_t
out, smmu mapped ipa msw, output for ar_shmem_alloc()/ar_shmem_map()
uint32_t
out, physical address lsw, alignment requirements apply, like 4k, start address multiple of 64, output of ar_shmem_alloc()
uint32_t
out, physical address msw, alignment requirements apply, like 4k, start address multiple of 64, output of ar_shmem_alloc()
void *
out, virtual address 64bit/32bit, alignment requirements apply, like 4k, start address multiple of 64, input for ar_shmem_alloc()
uint64_t
out opt, pointer address to metadata structure defined by each platform for ar_shmem_alloc()
uint8_t
in, number of subsystem IDs provided with ar_shmem_alloc()/ar_shmem_map() call.
ar_shmem_proc_info *
in, pointer to array of size num_sys_id for sub-system Ids provided in ar_osal_sys_id.h, used to allocate shared memory between the given list of sys_id provided with ar_shmem_alloc()/ar_shmem_map() call.
uint32_t
in opt, optional field for passing platform specific data to OSAL, this can be used for example to communicate some heap properties provided only for ar_shmem_alloc()
uint32_t
in, Bit field for flags.

ar_shmem_hyp_assign_phys_addr_t

Shared memory physical address and size details for hyp assign. Members
uint64_t
64-bit physical address.
size_t
size in bytes for the buffer pointed by phys_addr

ar_shmem_hyp_assign_dest_sys_info_t

Destination sub system id details and permission required for hyp assign. Members
uint64_t
destination sub system id, refer to ar_osal_sys_id.h
ar_shmem_hyp_assign_dest_sys_perm
destination permissions

ar_shmem_hyp_assign_phys_info_t

Hyp assign physical memory info structure. Members
ar_shmem_hyp_assign_phys_addr *
list of hyp_assign_phys_addr structures.
uint32_t
number of phys_addr_list entries.
uint64_t *
source sub system Id list, refer to ar_osal_sys_id.h for sys ids.
uint32_t
number of src_sys_list entries.
ar_shmem_hyp_assign_dest_sys_info *
destination sys list hyp_assign_dest_sys_info.
uint32_t
number of destination sys list/dest_sys_list entires.
uint64_t
in opt, pointer address to metadata structure defined by platform during ar_shmem_alloc() call.

Functions

ar_shmem_init

Initialize the shared memory interface (V1 API). This function initializes the shared memory interface using the default configuration. It performs the legacy initialization flow.
Returns 0 Success Nonzero Failure

ar_shmem_init_v2

Initialize the shared memory interface using a list of processor domains (V2 API). This V2 API selects the appropriate shared memory implementation based on the provided list of processor domain IDs. Passing num_master_procs = 0 results in behavior equivalent to the V1 API (ar_shmem_init), allowing a smooth transition from V1 to V2.
Parameters
uint32_t
Number of processor domain IDs.
uint32_t *
Pointer to an array of processor domain IDs.
Returns 0 Success Nonzero Failure

ar_shmem_alloc

Allocates shared memory. Only non cached memory allocation supported. Size if multiple of 4KB and the returned is aligned to 4KB boundary. Buffer start address should be atleast 64bit multiple aligned.
Parameters
info: pointer to ar_shmem_info.
Returns 0 Success Nonzero Failure

ar_shmem_free

Frees shared memory.
Parameters
ar_shmem_info *
pointer to ar_shmem_info.
Returns 0 Success Nonzero Failure

ar_shmem_map

Helps map memory with SMMU an already allocated shared memory for a give sub system. Size should be multiple of 4KB boundary. Buffer start address should be 64bit aligned.
Parameters
info: pointer to ar_shmem_info. required input parameters in ar_shmem_info ar_shmem_info_t.cache_type ar_shmem_info_t.buf_size ar_shmem_info_t.mem_type ar_shmem_info_t.pa_lsw ar_shmem_info_t.pa_msw ar_shmem_info_t.num_sys_id ar_shmem_info_t.sys_id required output parameters in ar_shmem_info ar_shmem_info_t.ipa_lsw ar_shmem_info_t.ipa_msw
Returns 0 Success Nonzero Failure

ar_shmem_unmap

Helps unmap the shared memory allocated externally with SMMU.
Parameters
ar_shmem_info *
pointer to ar_shmem_info. required input parameters in ar_shmem_info ar_shmem_info_t.cache_type ar_shmem_info_t.buf_size ar_shmem_info_t.mem_type ar_shmem_info_t.pa_lsw ar_shmem_info_t.pa_msw ar_shmem_info_t.num_sys_id ar_shmem_info_t.sys_id
Returns 0 Success Nonzero Failure

ar_shmem_hyp_assign_phys

Helps to hyp assign physical memory between source and destination sub systems.
Parameters
ar_shmem_hyp_assign_phys_info *
pointer to ar_shmem_hyp_assign_phys_info.
Returns 0 Success Nonzero Failure

ar_shmem_get_uid

ar_shmem_get_uid. Get associated unique identifier(UID) for the shared memory pointed by alloc_handle, platform which doesn`t support UID should return alloc_handle as UID with expectation of alloc_handle being unique.
Parameters
uint64_t
handle for the shared memory.
uint64_t *
unique identifier to the shmem.
Returns 0 Success Nonzero Failure

ar_shmem_deinit

ar_shmem_deinit.
Returns 0 Success Nonzero Failure

Type Definitions

ar_shmem_memory_type_t

enum for shmem memory type

ar_shmem_cache_type_t

enum for shmem cache type

ar_shmem_buffer_index_type_t

enum for shmem offset/address buffer index type

ar_shmem_pd_type_t

Bits to indicate if hardware accelerator is enabled/disabled.

ar_shmem_proc_info

ar_shmem_info

Shared memory info structure.

ar_shmem_hyp_assign_phys_addr

Shared memory physical address and size details for hyp assign.

ar_shmem_hyp_assign_dest_sys_perm

Destination sub system permission bit mask types supported.

ar_shmem_hyp_assign_dest_sys_info

Destination sub system id details and permission required for hyp assign.

ar_shmem_hyp_assign_phys_info

Hyp assign physical memory info structure.

Enumerations

ar_shmem_memory_type

enum for shmem memory type

Values

ar_shmem_cache_type

enum for shmem cache type

Values

ar_shmem_buffer_index_type

enum for shmem offset/address buffer index type

Values

ar_shmem_pd_type

Values

ar_shmem_hyp_assign_dest_sys_perm_t

Destination sub system permission bit mask types supported.

Values

Macros

AR_SHMEM_HW_ACCELERATOR_ENABLED

AR_SHMEM_HW_ACCELERATOR_DISABLED

Bit mask for hardware accelerator flag.

AR_SHMEM_BIT_MASK_HW_ACCELERATOR_FLAG

Shift amount for hardware accelerator setup flag.

AR_SHMEM_SHIFT_HW_ACCELERATOR_FLAG