本文整理汇总了C++中rtac_set_adm_handle函数的典型用法代码示例。如果您正苦于以下问题:C++ rtac_set_adm_handle函数的具体用法?C++ rtac_set_adm_handle怎么用?C++ rtac_set_adm_handle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtac_set_adm_handle函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: adm_memory_map_regions
int adm_memory_map_regions(int port_id,
uint32_t *buf_add, uint32_t mempool_id,
uint32_t *bufsz, uint32_t bufcnt)
{
struct avs_cmd_shared_mem_map_regions *mmap_regions = NULL;
struct avs_shared_map_region_payload *mregions = NULL;
void *mmap_region_cmd = NULL;
void *payload = NULL;
int ret = 0;
int i = 0;
int cmd_size = 0;
int index = 0;
pr_debug("%s\n", __func__);
if (this_adm.apr == NULL) {
this_adm.apr = apr_register("ADSP", "ADM", adm_callback,
0xFFFFFFFF, &this_adm);
if (this_adm.apr == NULL) {
pr_err("%s: Unable to register ADM\n", __func__);
ret = -ENODEV;
return ret;
}
rtac_set_adm_handle(this_adm.apr);
}
port_id = q6audio_convert_virtual_to_portid(port_id);
if (q6audio_validate_port(port_id) < 0) {
pr_err("%s port id[%d] is invalid\n", __func__, port_id);
return -ENODEV;
}
index = q6audio_get_port_index(port_id);
cmd_size = sizeof(struct avs_cmd_shared_mem_map_regions)
+ sizeof(struct avs_shared_map_region_payload)
* bufcnt;
mmap_region_cmd = kzalloc(cmd_size, GFP_KERNEL);
if (!mmap_region_cmd) {
pr_err("%s: allocate mmap_region_cmd failed\n", __func__);
return -ENOMEM;
}
mmap_regions = (struct avs_cmd_shared_mem_map_regions *)mmap_region_cmd;
mmap_regions->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
APR_HDR_LEN(APR_HDR_SIZE),
APR_PKT_VER);
mmap_regions->hdr.pkt_size = cmd_size;
mmap_regions->hdr.src_port = 0;
mmap_regions->hdr.dest_port = 0;
mmap_regions->hdr.token = 0;
mmap_regions->hdr.opcode = ADM_CMD_SHARED_MEM_MAP_REGIONS;
mmap_regions->mem_pool_id = ADSP_MEMORY_MAP_SHMEM8_4K_POOL & 0x00ff;
mmap_regions->num_regions = bufcnt & 0x00ff;
mmap_regions->property_flag = 0x00;
pr_debug("%s: map_regions->num_regions = %d\n", __func__,
mmap_regions->num_regions);
payload = ((u8 *) mmap_region_cmd +
sizeof(struct avs_cmd_shared_mem_map_regions));
mregions = (struct avs_shared_map_region_payload *)payload;
for (i = 0; i < bufcnt; i++) {
mregions->shm_addr_lsw = buf_add[i];
mregions->shm_addr_msw = 0x00;
mregions->mem_size_bytes = bufsz[i];
++mregions;
}
atomic_set(&this_adm.copp_stat[0], 0);
ret = apr_send_pkt(this_adm.apr, (uint32_t *) mmap_region_cmd);
if (ret < 0) {
pr_err("%s: mmap_regions op[0x%x]rc[%d]\n", __func__,
mmap_regions->hdr.opcode, ret);
ret = -EINVAL;
goto fail_cmd;
}
ret = wait_event_timeout(this_adm.wait[index],
atomic_read(&this_adm.copp_stat[0]), 5 * HZ);
if (!ret) {
pr_err("%s: timeout. waited for memory_map\n", __func__);
ret = -EINVAL;
goto fail_cmd;
}
fail_cmd:
kfree(mmap_region_cmd);
return ret;
}
开发者ID:Krabappel2548,项目名称:apq8064_Revolution-_kernel,代码行数:89,代码来源:q6adm.c
示例2: adm_open
int adm_open(int port_id, int path, int rate, int channel_mode, int topology)
{
struct adm_cmd_device_open_v5 open;
int ret = 0;
int index;
int tmp_port = q6audio_get_port_id(port_id);
pr_debug("%s: port %d path:%d rate:%d mode:%d\n", __func__,
port_id, path, rate, channel_mode);
port_id = q6audio_convert_virtual_to_portid(port_id);
if (q6audio_validate_port(port_id) < 0) {
pr_err("%s port idi[%d] is invalid\n", __func__, port_id);
return -ENODEV;
}
index = q6audio_get_port_index(port_id);
pr_debug("%s: Port ID %d, index %d\n", __func__, port_id, index);
if (this_adm.apr == NULL) {
this_adm.apr = apr_register("ADSP", "ADM", adm_callback,
0xFFFFFFFF, &this_adm);
if (this_adm.apr == NULL) {
pr_err("%s: Unable to register ADM\n", __func__);
ret = -ENODEV;
return ret;
}
rtac_set_adm_handle(this_adm.apr);
}
/* Create a COPP if port id are not enabled */
if (atomic_read(&this_adm.copp_cnt[index]) == 0) {
open.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
open.hdr.pkt_size = sizeof(open);
open.hdr.src_svc = APR_SVC_ADM;
open.hdr.src_domain = APR_DOMAIN_APPS;
open.hdr.src_port = tmp_port;
open.hdr.dest_svc = APR_SVC_ADM;
open.hdr.dest_domain = APR_DOMAIN_ADSP;
open.hdr.dest_port = tmp_port;
open.hdr.token = port_id;
open.hdr.opcode = ADM_CMD_DEVICE_OPEN_V5;
open.mode_of_operation = path;
/* Reserved for future use, need to set this to 0 */
open.flags = 0x00;
open.endpoint_id_1 = tmp_port;
open.endpoint_id_2 = 0xFFFF;
/* convert path to acdb path */
if (path == ADM_PATH_PLAYBACK)
open.topology_id = get_adm_rx_topology();
else {
open.topology_id = get_adm_tx_topology();
if ((open.topology_id ==
VPM_TX_SM_ECNS_COPP_TOPOLOGY) ||
(open.topology_id ==
VPM_TX_DM_FLUENCE_COPP_TOPOLOGY))
rate = 16000;
}
if (open.topology_id == 0)
open.topology_id = topology;
open.dev_num_channel = channel_mode & 0x00FF;
open.bit_width = 16;
open.sample_rate = rate;
memset(open.dev_channel_mapping, 0, 8);
if (channel_mode == 1) {
open.dev_channel_mapping[0] = PCM_CHANNEL_FC;
} else if (channel_mode == 2) {
open.dev_channel_mapping[0] = PCM_CHANNEL_FL;
open.dev_channel_mapping[1] = PCM_CHANNEL_FR;
} else if (channel_mode == 6) {
open.dev_channel_mapping[0] = PCM_CHANNEL_FL;
open.dev_channel_mapping[1] = PCM_CHANNEL_FR;
open.dev_channel_mapping[2] = PCM_CHANNEL_LFE;
open.dev_channel_mapping[3] = PCM_CHANNEL_FC;
open.dev_channel_mapping[4] = PCM_CHANNEL_LB;
open.dev_channel_mapping[5] = PCM_CHANNEL_RB;
} else {
pr_err("%s invalid num_chan %d\n", __func__,
channel_mode);
return -EINVAL;
}
pr_debug("%s: port_id=%d rate=%d"
"topology_id=0x%X\n", __func__, open.endpoint_id_1, \
open.sample_rate, open.topology_id);
atomic_set(&this_adm.copp_stat[index], 0);
ret = apr_send_pkt(this_adm.apr, (uint32_t *)&open);
if (ret < 0) {
pr_err("%s:ADM enable for port %d for[%d] failed\n",
//.........这里部分代码省略.........
开发者ID:Krabappel2548,项目名称:apq8064_Revolution-_kernel,代码行数:101,代码来源:q6adm.c
示例3: adm_multi_ch_copp_pseudo_open_v3
int adm_multi_ch_copp_pseudo_open_v3(int port_id, int path,
int rate, int channel_mode,
int topology)
{
struct adm_multi_channel_copp_open_v3 open;
int ret = 0;
int index;
pr_debug("%s: port %d path:%d rate:%d mode:%d\n", __func__,
port_id, path, rate, channel_mode);
port_id = afe_convert_virtual_to_portid(port_id);
if (afe_validate_port(port_id) < 0) {
pr_err("%s port idi[%d] is invalid\n", __func__, port_id);
return -ENODEV;
}
index = afe_get_port_index(port_id);
pr_debug("%s: Port ID %d, index %d\n", __func__, port_id, index);
if (this_adm.apr == NULL) {
this_adm.apr = apr_register("ADSP", "ADM", adm_callback,
0xFFFFFFFF, &this_adm);
if (this_adm.apr == NULL) {
pr_err("%s: Unable to register ADM\n", __func__);
ret = -ENODEV;
return ret;
}
rtac_set_adm_handle(this_adm.apr);
}
{
open.hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
open.hdr.pkt_size = sizeof(open);
open.hdr.src_svc = APR_SVC_ADM;
open.hdr.src_domain = APR_DOMAIN_APPS;
open.hdr.src_port = port_id;
open.hdr.dest_svc = APR_SVC_ADM;
open.hdr.dest_domain = APR_DOMAIN_ADSP;
open.hdr.dest_port = port_id;
open.hdr.token = port_id;
open.hdr.opcode = ADM_CMD_MULTI_CHANNEL_COPP_OPEN_V3;
memset(open.dev_channel_mapping, 0, 8);
if (channel_mode == 1) {
open.dev_channel_mapping[0] = PCM_CHANNEL_FC;
} else if (channel_mode == 2) {
open.dev_channel_mapping[0] = PCM_CHANNEL_FL;
open.dev_channel_mapping[1] = PCM_CHANNEL_FR;
} else if (channel_mode == 4) {
open.dev_channel_mapping[0] = PCM_CHANNEL_FL;
open.dev_channel_mapping[1] = PCM_CHANNEL_FR;
open.dev_channel_mapping[2] = PCM_CHANNEL_LS;
open.dev_channel_mapping[3] = PCM_CHANNEL_RS;
} else if (channel_mode == 6) {
open.dev_channel_mapping[0] = PCM_CHANNEL_FC;
open.dev_channel_mapping[1] = PCM_CHANNEL_FL;
open.dev_channel_mapping[2] = PCM_CHANNEL_FR;
open.dev_channel_mapping[3] = PCM_CHANNEL_LS;
open.dev_channel_mapping[4] = PCM_CHANNEL_RS;
open.dev_channel_mapping[5] = PCM_CHANNEL_LFE;
} else {
pr_err("%s invalid num_chan %d\n", __func__,
channel_mode);
return -EINVAL;
}
open.mode = path;
open.endpoint_id1 = port_id;
open.endpoint_id2 = 0xFFFF;
open.bit_width = 16;
if (path == ADM_PATH_PLAYBACK)
open.topology_id = get_adm_rx_topology();
else {
open.topology_id = get_adm_tx_topology();
if ((open.topology_id ==
VPM_TX_SM_ECNS_COPP_TOPOLOGY) ||
(open.topology_id ==
VPM_TX_DM_FLUENCE_COPP_TOPOLOGY))
rate = 16000;
}
if (open.topology_id == 0)
open.topology_id = topology;
open.channel_config = channel_mode & 0x00FF;
open.rate = rate;
open.flags = 0;
pr_debug("%s: channel_config=%d port_id=%d rate=%d" \
"topology_id=0x%X\n", __func__, open.channel_config,\
open.endpoint_id1, open.rate,\
open.topology_id);
atomic_set(&this_adm.copp_stat[index], 0);
ret = apr_send_pkt(this_adm.apr, (uint32_t *)&open);
//.........这里部分代码省略.........
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:101,代码来源:q6adm.c
注:本文中的rtac_set_adm_handle函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论