ar_mem_move copies bytes from source area to destination area.
-
Param :
-
+
Parameters:
+
+
[in_out] – dest: destinatiopn buffer to copy data.
+
dest_size – [in] destination buffer size.
+
src – [in] source buffer pointer to copy data from.
+
size – [in] bytes to copy from source buffer.
+
+
+
Returns:
+
0 — Success Nonzero — Failure note: If some regions of the source area and the destination overlap, ar_mem_move ensures that the original source bytes in the overlapping region are copied before being overwritten.
Max length of the domain name i.e “soc/domain/subdomain” or service name i.e “provider/service” is 64 bytes e.g. msm/adsp/audio_pd or avs/audio or audio/avs_mdf_sdsp or audio/avs_mdf_mdsp
ar_osal_servreg_init Initialize servreg interface. Note:This API has to be called before any other API in this interface. Should be called at least once and is expected to be serialized if called multiple times.
ar_osal_servreg_get_domainlist Client to call this API to get a list of domains(msm/domain/subdomain) on which a given service(provider/service) is supported.
Parameters:
-
service – [in] service(provider/service) for which domain(s) list is required.
+
+
service – [in] service(provider/service) for which domain(s) list is required.
+
domain_list – [inout] service supported in domain(s), client to provide . payload buffer pointer.
+
num_domains – [inout] Client to provide the num_domains to get the domain list. . If num_domains is zero and domain_list is NULL, API will return . the number of domains for the given service if available.
+
+
+
Returns:
+
0 — Success Nonzero — Failure AR_ENOMEMORY- Failed due to insufficient memory, client to call the API again with required size as returned in num_domains.
ar_osal_servreg_set_state Service provider to call this API to register its service states(UP/DOWN). This API to be used only by the service provider(msm/domain/subdomain/provider/service) and not by service client(s).
initialize a signal object. The client must allocate the memory for the signal and pass the pointer to this function. The signal object is initially cleared.
Create a signal and initialize. Signal object memory is allocated by this API and returned to the client. The signal object is initially cleared. ar_osal_signal_create() or ar_osal_signal_init() would be used, but not both.
Clear signal in the specified signal object. Signal must be explicitly cleared by a thread when it is awakened, the wait operations do not automatically clear it.
-
Clearing a signal that is already cleared has no effect.
-
-
Associated data types
ar_osal_signal_t
-
-
Dependencies
Before calling this function, the signal group must be created and initialized.
Wait on a signal, wait infinitely for the signal to be set.
-
If a thread is waiting on a signal object for signal to be set, and the signal object is set, then the thread is awakened.
-
The signal can be cleared once the signal is set.
-
The signal must be manually cleared using the ar_osal_signal_clear function. Any number of waiting threads, or threads that subsequently begin wait operations for the specified signal object, will be released while the signal object’s state is signaled.
-
If a signal is set before a thread is waiting, then it will be returned immediately and the signal must be cleared to avoid unintended behavior
-
-
Associated data types
ar_osal_signal_t
-
-
Dependencies
Before calling this function, the signal group must be created and initialized.
The signal can be cleared once the signal is set or timeout occurs.
-
The signal must be manually cleared using the ar_osal_signal_clear function. Any number of waiting threads, or threads that subsequently begin wait operations for the specified signal object, will be released while the signal object’s state is signaled.
-
If a signal is set before a thread is waiting, then it will be returned immediately and the signal must be cleared to avoid unintended behavior
-
-
Associated data types
ar_osal_signal_t
-
-
Dependencies
Before calling this function, the signal group must be created and initialized.
-
-
-
-
-
Parameters:
-
-
signal – [in] Pointer to the signal.
-
timeout_in_nsec – [in] Time to wait in nano seconds
Initializes a signal2 object. Signal returns the initialized object. The signal object is initially cleared. signal object memory is allocated by the client.
Signal objects must not be destroyed while they are still in use. If this happens the behavior is undefined. In general, application code should “destroy” a signal2 object prior to deallocating it; calling osal_signal2_destroy() before deallocating it ensures that all osal_signal2_set() calls have completed.
+
@note1cont Signal objects must not be destroyed while they are still in use. If this happens the behavior is undefined. @note1cont In general, application code should “destroy” a signal2 object prior to deallocating it; calling osal_signal2_destroy() before deallocating it ensures that all osal_signal2_set() calls have completed.
Suspends the current thread until any of the specified signals are set.
Signals are represented as bits 0-31 in the 32-bit mask value. A mask bit value of 1 indicates that a signal is to be waited on, and 0 that it is not to be waited on.
If a thread is waiting on a signal object for any of the specified set of signals to be set, and one or more of those signals is set in the signal object, then the thread is awakened.
At most one thread can wait on a signal object at any given time.
Signals must be explicitly cleared by a thread when it is awakened the wait operations do not automatically clear them.
Suspends the current thread until all of the specified signals are set.
Signals are represented as bits 0-31 in the 32-bit mask value. A mask bit value of 1 indicates that a signal is to be waited on, and 0 that it is not to be waited on.
If a thread is waiting on a signal object for all of the specified set of signals to be set, and all of those signals are set in the signal object, then the thread is awakened.
At most one thread can wait on a signal object at any given time.
Signals must be explicitly cleared by a thread when it is awakened the wait operations do not automatically clear them.
Signals are represented as bits 0-31 in the 32-bit mask value. A mask bit value of 1 indicates that a signal is to be set, and 0 that it is not to be set.
Signals are represented as bits 0-31 in the 32-bit signal2_mask value. A signal2_mask bit value of 1 indicates that a signal is to be cleared, and 0 that it is not to be cleared.
Signals must be explicitly cleared by a thread when it is awakened the wait operations do not automatically clear them.
Micro second sleep function. Sleep internal may not be accurate as requested, it would vary based on resolution of system clock ticks. Note that a ready thread is not guaranteed to run immediately. Consequently, the thread may not run until some time after the sleep interval elapses.
PAGING functiona and data By default, the linker assigns names such as “.text” and “.data” to the code and data sections of a driver image file. When the driver is loaded, the I/O manager makes these sections nonpaged. A nonpaged section is always memory-resident. A driver developer has the option to make designated parts of a driver pageable so that Windows can move these parts to the paging file when they are not in use. To make a code or data section pageable, the driver developer assigns a name that begins with “PAGE” to the section. The I/O manager checks the names of the sections when it loads a driver. If a section name begins with “PAGE”, the I/O manager makes the section pageable. Code that runs at IRQL >= DISPATCH_LEVEL must be memory-resident. That is, this code must be either in a nonpageable segment, or in a pageable segment that is locked in memory. If code that is running at IRQL >= DISPATCH_LEVEL causes a page fault, a bug check occurs. Drivers can use the PAGED_CODE macro to verify that pageable functions are called only at appropriate IRQLs.Paged functions Should be used at the start of functions group to be paged
PAGING functiona and data By default, the linker assigns names such as “.text” and “.data” to the code and data sections of a driver image file. When the driver is loaded, the I/O manager makes these sections nonpaged. A nonpaged section is always memory-resident. A driver developer has the option to make designated parts of a driver pageable so that Windows can move these parts to the paging file when they are not in use. To make a code or data section pageable, the driver developer assigns a name that begins with “PAGE” to the section. The I/O manager checks the names of the sections when it loads a driver. If a section name begins with “PAGE”, the I/O manager makes the section pageable. Code that runs at IRQL >= DISPATCH_LEVEL must be memory-resident. That is, this code must be either in a nonpageable segment, or in a pageable segment that is locked in memory. If code that is running at IRQL >= DISPATCH_LEVEL causes a page fault, a bug check occurs. Drivers can use the PAGED_CODE macro to verify that pageable functions are called only at appropriate IRQLs. Paged functions Should be used at the start of functions group to be paged
Interrupt request level(IRQL) Driver code or system APIs can only run on certain IRQLs. Developer must ensure IRQL requirements are met. Code with in spin lock usage must not be paged. Code with in spin lock must be minimum possible. Interrupts/callbacks function running at DISPATCH IRQL (high priorities) should not be paged. Identify functions which could run at PASSIVE IRQL( low priority).
Driver code or system APIs can only run on certain IRQLs. Developer must ensure IRQL requirements are met. Code with in spin lock usage must not be paged. Code with in spin lock must be minimum possible. Interrupts/callbacks function running at DISPATCH IRQL (high priorities) should not be paged. Identify functions which could run at PASSIVE IRQL( low priority).
Opens for reading and appending. Creates the file if it does not exist. The file position for reading is at the beginning of the file, but write data is always appended to the end of the file.
ar_fmap Map a file into Data Memory for Read Only access
Whether this allocates heap memory for the buffer or not is platform dependent. On some platforms with low memory this may map non-volatile storage into a readable memory window instead. To free any possible resources allocated by this call, the caller MUST call ar_funmap
This call releases a buffer obtained by a previous call to ar_fmap and frees any resources that may be in use by it. The file still needs to be closed by a call to ar_fclose
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.
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.
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.
out, physical address lsw, alignment requirements apply, like 4k, start address multiple of 64, output of ar_shmem_alloc() in, physical address lsw, alignment requirements apply, like 4k, start address multiple of 64, input for ar_shmem_map()
out, physical address msw, alignment requirements apply, like 4k, start address multiple of 64, output of ar_shmem_alloc() in, physical address lsw, alignment requirements apply, like 4k start address multiple of 64, input for ar_shmem_map()
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.
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()
+ar_sprintf(str_dest, str_dest_size, format, ...)
ar_sprintf Write formated data to a string.
+
+ar_sscanf Read formated data from a string.
-
Param :
-
+
Parameters:
+
+
[in_out] – str_dest: Destination string buffer.
+
str_dest_size – [in] Size in bytes.
+
format – [in] Format control string.
+
... – [in] : variable arguments.
+
str_src – [in] Stored string buffer.
+
format – [in] Format control string.
+
... – [in] : variable arguments.
+
+
+
Returns:
+
Number of characters written to the buffer(null terminator not counted). Destination is appended with null terminator always, if data is greater than the destination buffer size, truncation will occur with appended null terminator.
+
+
Returns:
+
Number of fields successfully converted and assigned, the return value does not include fields that were read but not assigned. A return value of 0 indicates that no fields were assigned.
ar_strcpy Copies character from source to destination string.
-
Param :
-
+
Parameters:
+
+
[in_out] – str_dest: Destination string buffer.
+
str_dest_size – [in] Size in characters.
+
str_src – [in] Source string to copy from.
+
cpy_size – [in] Size in characters to copy from source string.
+
+
+
Returns:
+
0 — Success Nonzero — Failure note: Always null terminator is appended to the destination and string truncation will occur if destination size is smaller or equal to characters copy size.
ar_strcat Append character from source to destination string.
-
Param :
-
+
Parameters:
+
+
[in_out] – str_dest: Destination string buffer.
+
str_dest_size – [in] Size in characters.
+
str_src – [in] Source string to copy from.
+
apnd_size – [in] Size in characters to append from source string.
+
+
+
Returns:
+
0 — Success Nonzero — Failure note: Always null terminator is appended to the destination after concatenation and string truncation will occur if destination size is smaller or equal to source.
The thread stack can be passed in as the osal_thread_stack argument, or osal_thread_stack=NULL indicates that osal allocates the stack internally. If the caller provides the stack, the caller is responsible for freeing the stack memory after joining the thread.
-
-
Pre-allocated stacks must be freed after the dying thread is joined. The caller must specify the heap in which the thread stack is to be allocated.
-
-
Dependencies
None.
-
-
-
-
-
Parameters:
-
-
thread – [out] Pointer to the thread.
-
thread_attr – [in] Pointer to the thread attributes.
-
thread_start – [in] Pointer to the entry function of the thread.
-
thread_param – [in] Pointer to the arguments passed to the entry function. An argument can be to any pointer type.
use these flags when it is necessary to separate the allocation of memory buffers from sharing those buffers with DSP Example: opening graph with no GKV and push pull mode, the endpoint IID for the use case is not yet known, so cannot send shmem to DSP.
-
default does allocation of buffers and shared mem setup together buffers must be allocated first before shmem can be set up Client is responsible for calling these in the correct order, i.e. shmem must be allocated before provisioning SPFallocate buffers and set them up on SPF EP
+
default does allocation of buffers and shared mem setup together buffers must be allocated first before shmem can be set up Client is responsible for calling these in the correct order, i.e. shmem must be allocated before provisioning SPF allocate buffers and set them up on SPF EP
set up shmem on SPF endpoint only GSL ignores other params sent when this flag is used, since the datapath must be configured with ALLOC_SHMEM_ONLY before calling with this flag
Stop graph, stop processing data and reset to initial state Optional Payload: struct gsl_cmd_properties GRAPH_STOP is issued only to those subgraphs with matching property_ID and property_values
Insert EOS marker in playback data stream, the EOS marker is inserted in the stream immediately after all the data successfully written to GSL. Once all the buffers before the EOS marker are played out, GSL generates an EOS event to client. Note: If a gsl_write operation is pending when this command is issued the buffer passed in the pending gsl_write is not gauranteed to be played out.
Get buffer pointers and sizes for use in shared memory mode write operations Payload: struct gsl_cmd_get_shmem_buf_info will be sent from client and will get written to by GSL.
Get buffer pointers and sizes for use in shared memory mode read operations Payload: struct gsl_cmd_get_shmem_buf_info will be sent from client and will get written to by GSL.
Get pointer and size of position buffer used to synchronize writes in push/pull mode Payload: struct gsl_cmd_get_shmem_buf_info will be sent from client and will get written to by GSL.
Get pointer and size of position buffer used to synchronize reads in push/pull mode Payload: struct gsl_cmd_get_shmem_buf_info will be sent from client and will get written to by GSL.
Close subset of subgraphs in the graph based on properties Payload: struct gsl_cmd_properties GRAPH_STOP is issued only to those subgraphs with matching property_ID and property_values
End of stream event, indicates that all data written to GSL prior to client calling GSL_CMD_EOS has been played out Payload: struct gsl_event_eos_payload
Push calibration data for a given graph to DSP, Must be called before a graph is started. This API need not be called in the case of GSL_CMD_CHANGE_GRAPH as the calibration will be set during the graph change operation itself.
Set a custom configuration parameter on a specified graph, the payload is provided from the caller. Caller also provides tag ID so gsl can look up ACDB for the module IID to which this payload needs to be sent to.
Persistent set a custom configuration parameter on a specified graph, the payload is provided from the caller. Caller also provides tag ID so gsl can look up ACDB for the module IID to which this payload needs to be sent to. LIMITATION: The payload can contain only a single PID that is destined to a single MID.
Get the configuration parameter for a specified graph from the module that is specified by a tag, caller provides a payload with the PIDs populated. GSL will populate the MIDS into the payload. LIMITATION: Only a single parameter on a single module can be looked up at a time.
Query database for data associated with a given tag and tkv. This API is used to get spf module data in the form {IID, PID, Size, ErrorCode, variable length payload}.
Get the size of available buffer (in bytes) ready to be written (playback) / read (capture)
For playback case, returns the size of empty buffer (in bytes) for GSL clients to write. For capture case, returns the size of buffer (in bytes) that GSL clients can queue to SPF for read.
Get all GKVs that contain the provided key IDs as a subset.
Queries ACDB for all graph key vectors that contain the provided key ids as a subset. A graph key vector supports certain capabiliies if it matches the key id subset. If the subset contains zero keys, this api will return all the graph key vectors defined in ACDB.
Retrieves an alias of the graph key vector for readability. The alias includes the the usecase ID followed by a human readable graph key vector with names for keys and values. The string length is limited to 255 bytes.
API is to be called twice: once to get the size, and once to get the string.