> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ACDB

> Contains the public interface definitions for the Audio Calibration Database (ACDB) module.

**Header:** `acdb/api/acdb.h`

## Structures

### `_acdb_key_value_t`

Generic response structure.

**Members**

**key** `uint32_t`

Key ID

**value** `uint32_t`

### `_acdb_blob_t`

Maintains buffer context information.

**Members**

**buf\_size** `uint32_t`

Buffer size.

**buf** `void *`

### `_acdb_buffer_context_t`

Request structure used to query for AMDB bootup modules, registration, and deregistration data.

**Members**

**size** `uint32_t`

**bytes\_filled** `uint32_t`

**buf** `uint8_t *`

### `_acdb_amdb_proc_id_t`

Request structure used to query for AMDB bootup modules, registration, and deregistration data.

**Members**

**proc\_id** `uint32_t`

The the ID of processor domain that the AMDB modules operate under

### `_acdb_amdb_db_handle_t`

A Key Vector with a zero sized array.

**Members**

**acdb\_handle** `acdb_handle_t`

The the ID of processor domain that the AMDB modules operate under.

**proc\_id** `uint32_t`

### `_acdb_key_vector_t`

A Tag Key Vector with a zero sized array.

**Members**

**num\_keys** `uint32_t`

number of keys

**graph\_key\_vector** `AcdbKeyValuePair`

### `_acdb_tag_key_vector_t`

List of uint32\_t with a pointer to an array of uint32\_t.

**Members**

**tag\_id** `uint32_t`

The module tag identifier

**num\_keys** `uint32_t`

Graph key vector.

**graph\_key\_vector** `AcdbKeyValuePair`

### `_acdb_uint_list_t`

List of uint32\_t with a zero sized array.

**Members**

**count** `uint32_t`

number of elemts in the list

**list** `uint32_t *`

### `_acdb_uint_list_zs_t`

**Members**

**count** `uint32_t`

number of elemts in the list

**list** `uint32_t`

### `_acdb_file_t`

**Members**

**fileNameLen** `uint32_t`

Full file path name length

**fileName** `char`

### `_acdb_data_files_t`

**Members**

**num\_files** `uint32_t`

Number of ACDB files

**acdbFiles** `AcdbFile`

### `_acdb_database_files_t`

**Members**

**num\_files** `uint32_t`

Number of database files

**database\_files** `AcdbFile`

### `_acdb_subgraph_t`

**Members**

**sg\_id** `uint32_t`

src Subgraph ID

**num\_dst\_sgids** `uint32_t`

dst subgraph IDs

**dst\_sg\_ids** `uint32_t`

### `_acdb_graph_key_vector_t`

**Members**

**num\_keys** `uint32_t`

number of keys

**graph\_key\_vector** `AcdbKeyValuePair *`

### `_acdb_get_graph_rsp_t`

**Members**

**num\_subgraphs** `uint32_t`

Number of SubGraphs for a given key combination

**size** `uint32_t`

Pointer to array of SubGraphs data for a given key combination.

**subgraphs** `AcdbSubgraph *`

### `_acdb_sgid_graph_key_vector_t`

**Members**

**num\_sgid** `uint32_t`

number of SubGraph ID

**sg\_ids** `uint32_t *`

**graph\_key\_vector** `AcdbGraphKeyVector`

Graph key vector

### `_acdb_property_data_t`

**Members**

**prop\_id** `uint32_t`

Property ID

**prop\_payload\_size** `uint32_t`

**prop\_payload** `char`

### `_acdb_sub_graph_property_data_t`

**Members**

**sg\_id** `uint32_t`

SubGraph ID

**num\_props** `uint32_t`

Array of prop\_data of type AcdbPropertyData.

**prop\_data** `char`

### `_acdb_driver_property_data_t`

**Members**

**num\_sgid** `uint32_t`

number of SubGraph ID

**size** `uint32_t`

**sub\_graph\_prop\_data** `AcdbSubGraphPropertyData *`

### `_acdb_get_subgraph_data_rsp_t`

**Members**

**driver\_prop** `AcdbDriverPropertyData`

Size of container data.

**spf\_blob** `AcdbBlob`

### `_acdb_subgraph_list_t`

**Members**

**num\_subgraphs** `uint32_t`

Number of SubGraphs for a given key combination

**subgraphs** `AcdbSubgraph *`

### `_acdb_sgid_calkey_vector_t`

**Members**

**num\_sg\_ids** `uint32_t`

Number of Subgraphs

**sg\_ids** `uint32_t *`

Calibration Key vector prior.

**cal\_key\_vector\_prior** `AcdbGraphKeyVector`

Calibration Key vector new.

**cal\_key\_vector\_new** `AcdbGraphKeyVector`

### `_acdb_sgid_persist_data_t`

**Members**

**sg\_id** `uint32_t`

Subgraph ID

**persist\_data\_size** `uint32_t`

persist cal data.

**buf** `char`

### `_acdb_sgid_persist_cal_data_t`

**Members**

**num\_sg\_ids** `uint32_t`

Number of Subgraphs

**cal\_data\_size** `uint32_t`

Persist cal data.

**cal\_data** `AcdbSgIdPersistData *`

### `_acdb_global_persistent_cal_info_t`

**Members**

**cal\_identifier** `uint32_t`

cal identifier

**num\_iids** `uint32_t`

iid list

**iids** `uint32_t`

### `_acdb_get_blb_psist_identifier_t`

**Members**

**num\_glb\_persist\_identifiers** `uint32_t`

number of global-persistent cal info entries

**size** `uint32_t`

Size of container data.

**global\_persistent\_cal\_info** `AcdbGlbPsistCalInfo *`

### `_acdb_get_subgraph_glb_persist_cal_data_cmd_type`

**Members**

**cal\_Id** `uint32_t`

Cal Identifier>

### `_acdb_driver_data_t`

**Members**

**key\_vector** `AcdbGraphKeyVector`

Key Vector associated with the driver data

**module\_id** `uint32_t`

### `_acdb_module_tag_t`

**Members**

**tag\_id** `uint32_t`

Module tag ID

**tag\_key\_vector** `AcdbGraphKeyVector`

### `_acdb_sgid_module_tag_t`

**Members**

**num\_sg\_ids** `uint32_t`

Num of Subgraph IDs

**sg\_ids** `uint32_t *`

Module tag.

**module\_tag** `AcdbModuleTag`

### `_acdb_get_tagged_modules_req_t`

**Members**

**num\_sg\_ids** `uint32_t`

Num of Subgraph IDs

**sg\_ids** `uint32_t *`

tag ID

**tag\_id** `uint32_t`

### `_acdb_module_instance_t`

**Members**

**mid\_id** `uint32_t`

Module ID

**mid\_iid** `uint32_t`

### `_acdb_get_tagged_modules_t`

**Members**

**num\_tagged\_mids** `uint32_t`

Number of tagged modules

**tagged\_mid\_list** `AcdbModuleInstance *`

### `_acdb_get_key_capabilities_t`

**Members**

**cal\_key\_vector** `AcdbGraphKeyVector`

Number of modules.

**num\_modules** `uint32_t`

Pointer to array of Module instances.

**module\_Instances** `AcdbModuleInstance *`

### `_acdb_set_cal_data_t`

**Members**

**graph\_key\_vector** `AcdbGraphKeyVector`

The graph keys that describe the usecase the modules are under

**cal\_key\_vector** `AcdbGraphKeyVector`

cal blob size

**cal\_blob\_size** `uint32_t`

cal blob

**cal\_blob** `void *`

### `_acdb_sg_proc_id_map_t`

Request structure that contains the list of subgraphs to retrieve processor lists for.

**Members**

**sg\_id** `uint32_t`

Subgraph ID

**num\_proc\_ids** `uint32_t`

Array of Processor IDs.

**proc\_ids** `uint32_t`

### `_acdb_get_subgraph_proc_ids_req_t`

Response structure that contains a list of mappings between subgraphs and their associated processors.

**Members**

**num\_sg\_ids** `uint32_t`

Number of subgraphs

**sg\_ids** `uint32_t *`

### `_acdb_get_subgraph_proc_ids_rsp_t`

**Members**

**num\_sg\_ids** `uint32_t`

Number of subgraphs

**size** `uint32_t`

Array of maps that associate a subgraph to a list of processors.

**sg\_proc\_ids** `AcdbSgProcIdsMap *`

### `_acdb_cmd_get_tags_from_gkv_req`

Contains a Modules ID and Instance ID.

**Members**

**graph\_key\_vector** `AcdbGraphKeyVector *`

Graph Key Vector representing the usecase

### `_acdb_module`

Contains the mapping beween a Tag and one or more module.

**Members**

**module\_id** `uint32_t`

Module ID

**module\_iid** `uint32_t`

### `_acdb_tag_module`

Response structure that contains a list of Tag + Module(s) mapping.

**Members**

**tag\_id** `uint32_t`

Tag ID associated with the module(s)

**num\_modules** `uint32_t`

List of modules associated with this tag.

**modules** `AcdbModule`

### `_acdb_cmd_get_tags_from_gkv_rsp`

**Members**

**num\_tags** `uint32_t`

Number of tags found

**list\_size** `uint32_t`

List of Tags plus their associated module(s)

**tag\_module\_list** `AcdbTagModule *`

### `_acdb_key_vector_list_t`

**Members**

**num\_key\_vectors** `uint32_t`

Number of key vectors in the key vector list

**list\_size** `uint32_t`

List of Key Vectors in the format of \[#keys, kvPair+,..., #keys, kvPair+].

**key\_vector\_list** `AcdbKeyVector *`

### `_acdb_tag_key_vector_list_t`

**Members**

**num\_key\_vectors** `uint32_t`

Number of tag key vectors in the key vector list

**list\_size** `uint32_t`

List of Tag Key Vectors in the format of \[#keys, kvPair+,..., #keys, kvPair+].

**key\_vector\_list** `AcdbTagKeyVector *`

### `_acdb_module_param_list`

Request structure for retrieving cal data for modules under a usecase.

**Members**

**instance\_id** `uint32_t`

The module instance to get parameter data from

**parameter\_list** `AcdbUintListZS`

### `_acdb_get_cal_data_req_t`

**Members**

**graph\_key\_vector** `AcdbGraphKeyVector`

The graph keys that describe the usecase the modules are under

**cal\_key\_vector** `AcdbGraphKeyVector`

The number of module instances in the instance\_param\_list.

**num\_module\_instance** `uint32_t`

List of module instances plus their parameters to get data for.

**instance\_param\_list** `AcdbModuleParamList *`

### `_acdb_get_tag_data_req_t`

**Members**

**graph\_key\_vector** `AcdbGraphKeyVector`

The graph keys that describe the usecase the modules are under

**module\_tag** `AcdbModuleTag`

The number of module instances in the instance\_param\_list.

**num\_module\_instance** `uint32_t`

List of module instances plus their parameters to get data for.

**instance\_param\_list** `AcdbModuleParamList *`

### `_acdb_set_tag_data_t`

**Members**

**graph\_key\_vector** `AcdbGraphKeyVector`

The graph keys that describe the usecase the modules are under

**module\_tag** `AcdbModuleTag`

Size of the tag data blob.

**blob\_size** `uint32_t`

Pointer to blob containing tag data.

**blob** `void *`

### `_acdb_set_temp_path_req_t`

**Members**

**path\_length** `uint32_t`

The length of the path including the null terminating character

**path** `char_t`

### `_acdb_hw_accel_subgraphs_info_req_t`

**Members**

**subgraph\_list** `AcdbUintList`

List of Subgraph IDs

### `_acdb_hw_accel_subgraph_t`

**Members**

**subgraph\_id** `uint32_t`

Subgraph ID

**mem\_type** `AcdbHwAccelMemType`

### `_acdb_hw_accel_subgraph_info_rsp_t`

**Members**

**num\_subgraphs** `uint32_t`

Number of Subgraphs

**list\_size** `uint32_t`

Subgraph IDs.

**subgraph\_list** `AcdbHwAccelSubgraph *`

### `_acdb_subgraph_proc_pair_t`

Request structure for retrieving persistent calibration based on processor.

**Members**

**subgraph\_id** `uint32_t`

The ID of the subgraph to get calibration for

**proc\_id** `uint32_t`

### `_acdb_proc_subgraph_persist_cal_req_t`

**Members**

**num\_subgraphs** `uint32_t`

Number of subgraphs

**subgraph\_list** `AcdbSubgraphProcPair *`

Calibration Key vector prior.

**cal\_key\_vector\_prior** `AcdbGraphKeyVector`

Calibration Key vector new.

**cal\_key\_vector\_new** `AcdbGraphKeyVector`

### `_acdb_string_t`

**Members**

**length** `uint32_t`

The length of the string including the null terminating character

**string** `char_t *`

### `_acdb_get_proc_tagged_modules_req_t`

Maps tagged modules to a processor domain.

**Members**

**num\_sg\_ids** `uint32_t`

Number of Subgraphs

**sg\_ids** `uint32_t *`

The tag to search for.

**tag\_id** `uint32_t`

### `_acdb_proc_tagged_modules_t`

Response struture containing a mapping of tagged modules to processor domain ID.

**Members**

**proc\_domain\_id** `uint32_t`

Number of tagged modules.

**num\_tagged\_mids** `uint32_t`

Pointer to array of tagged modules.

**tagged\_mid\_list** `AcdbModuleInstance`

### `_acdb_get_proc_tagged_modules_rsp_t`

**Members**

**num\_procs** `uint32_t`

Number of tagged modules

**list\_size** `uint32_t`

A pointer to contiguous block of memory containing tagged module ID and IID ordered by processor domain.

**proc\_tagged\_module\_list** `AcdbProcTaggedModules *`

## Functions

### `acdb_init`

```cpp theme={null}
int32_t acdb_init(AcdbDataFiles *acdb_data_files, AcdbFile *delta_file_path)
```

### `acdb_flash_init`

```cpp theme={null}
int32_t acdb_flash_init(uint32_t *acdbdata_base_addr)
```

### `acdb_deinit`

```cpp theme={null}
int32_t acdb_deinit(void)
```

### `acdbCmdIsPersistenceSupported`

```cpp theme={null}
int32_t acdbCmdIsPersistenceSupported(uint32_t *resp)
```

### `acdb_add_database`

Extends the database by adding database files (\*.acdb and \*.qwsp) at runtime.

```cpp theme={null}
int32_t acdb_add_database(AcdbDatabaseFiles *acdb_files, AcdbFile *writable_file_path, acdb_handle_t *acdb_handle)
```

**Parameters**

**acdb\_data\_files**

A list of database file paths containing \*.acdb and \*.qwsp

**writable\_file\_path** `AcdbFile *`

The delta data file path and temp files

**\[in/out]**

acdb\_handle: A handle to the database provided

**Returns**

0 on success, non-zero on failure

### `acdb_remove_database`

Shrinks the database by removing all data associated with the given database handle at runtime.

```cpp theme={null}
int32_t acdb_remove_database(const acdb_handle_t *acdb_handle)
```

**Parameters**

**acdb\_handle** `const acdb_handle_t *`

A handle to the database to remove

**Returns**

0 on success, non-zero on failure

### `acdb_get_handle`

Retrieves a handle associated with the given acdb file which can be used in APIs to retrieve information from a database.

```cpp theme={null}
int32_t acdb_get_handle(AcdbFile *acdb_file, acdb_handle_t *acdb_handle)
```

**Parameters**

**acdb\_file** `AcdbFile *`

The file to get the handle for

**\[in/out]**

acdb\_handle: The acdb hande for the given file

**Returns**

0 on success, non-zero on failure

### `acdb_ioctl`

Main entry function to the ACDB.

This entry function takes any supported ACDB IOCTL and provides the appropriate response.

See the individual command documentation for more details on the expectations of the command.

```cpp theme={null}
int32_t acdb_ioctl(uint32_t cmd_id, const void *cmd_struct, uint32_t cmd_struct_size, void *rsp_struct, uint32_t rsp_struct_size)
```

**Parameters**

**cmd\_id** `uint32_t`

Command ID to execute on the Audio Calibration Database. The cmd and the rsp must match the expected structures for that command. If not, the command fails.

**cmd**

Pointer to the command structure.

**cmd\_size**

Size of the command structure.

**rsp**

Pointer to the response structure.

**rsp\_size**

Size of the response structure.

**Returns**

The result of the call as defined by the command.

## Type Definitions

### `acdb_handle_t`

A handle to a database

```cpp theme={null}
typedef void * acdb_handle_t
```

### `AcdbFile`

```cpp theme={null}
typedef struct _acdb_file_t AcdbFile
```

### `AcdbDataFiles`

```cpp theme={null}
typedef struct _acdb_data_files_t AcdbDataFiles
```

### `AcdbDatabaseFiles`

```cpp theme={null}
typedef struct _acdb_database_files_t AcdbDatabaseFiles
```

## Macros

### `ACDB_SOFTWARE_VERSION_MAJOR`

The ACDB Software Major Version

```c theme={null}
#define ACDB_SOFTWARE_VERSION_MAJOR 0x00000001
```

### `ACDB_SOFTWARE_VERSION_MINOR`

The ACDB Software Revision.

```c theme={null}
#define ACDB_SOFTWARE_VERSION_MINOR 0x00000030
```

### `ACDB_SOFTWARE_VERSION_REVISION`

The ACDB Software CPL Info.

```c theme={null}
#define ACDB_SOFTWARE_VERSION_REVISION 0x00000000
```

### `ACDB_SOFTWARE_VERSION_CPLINFO`

The max character length of a file name string.

```c theme={null}
#define ACDB_SOFTWARE_VERSION_CPLINFO 0x00000000
```

### `MAX_FILENAME_LENGTH`

The max allowed number databases to manage.

```c theme={null}
#define MAX_FILENAME_LENGTH 256
```

### `MAX_ACDB_FILE_COUNT`

The max number of files that can be init'ed/added to the database.

```c theme={null}
#define MAX_ACDB_FILE_COUNT 16
```

### `ACDB_MAX_FILE_ADD_LIMIT`

```c theme={null}
#define ACDB_MAX_FILE_ADD_LIMIT 2
```

### `INF`

```c theme={null}
#define INF 4294967295U
```

### `ACDB_CMD_ID`

```c theme={null}
#define ACDB_CMD_ID ((0xACDBUL << 16) | (0xFFFFUL & x))
```

### `ACDB_MEM_CPY`

```c theme={null}
#define ACDB_MEM_CPY memcpy((uint8_t *)dst, (uint8_t *)src, src_size)
```

### `ACDB_MEM_CMP`

```c theme={null}
#define ACDB_MEM_CMP memcmp(x,y,len)
```

### `ACDB_CLEAR_BUFFER`

```c theme={null}
#define ACDB_CLEAR_BUFFER memset(&x, 0, sizeof(x))
```
