• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ broadcast_event函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中broadcast_event函数的典型用法代码示例。如果您正苦于以下问题:C++ broadcast_event函数的具体用法?C++ broadcast_event怎么用?C++ broadcast_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了broadcast_event函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: msm_reset_all_device

int msm_reset_all_device(void)
{
	int rc = 0;
	int dev_id = 0;
	struct msm_snddev_info *dev_info = NULL;

	for (dev_id = 0; dev_id < audio_dev_ctrl.num_dev; dev_id++) {
		dev_info = audio_dev_ctrl_find_dev(dev_id);
		if (IS_ERR(dev_info)) {
			MM_ERR("pass invalid dev_id %d\n", dev_id);
			rc = PTR_ERR(dev_info);
			return rc;
		}
		if (!dev_info->opened)
			continue;
		MM_DBG("Resetting device %d active on COPP %d"
			"with  0x%08x as routing\n",
			dev_id, dev_info->copp_id, dev_info->sessions);
		broadcast_event(AUDDEV_EVT_REL_PENDING,
				dev_id,
				SESSION_IGNORE);
		rc = dev_info->dev_ops.close(dev_info);
		if (rc < 0) {
			MM_ERR("Snd device %d failed close!\n", dev_id);
			return rc;
		} else {
			dev_info->opened = 0;
			broadcast_event(AUDDEV_EVT_DEV_RLS,
				        dev_id,
				        SESSION_IGNORE);
		}
		dev_info->sessions = 0;
	}
	return 0;
}
开发者ID:DevChun,项目名称:ace-ics-kernel,代码行数:35,代码来源:audio_dev_ctl.c


示例2: msm_v_loopback_put

static int msm_v_loopback_put(struct snd_kcontrol *kcontrol,
                              struct snd_ctl_elem_value *ucontrol)
{
    int start = ucontrol->value.integer.value[0];
    printk(KERN_ERR "[MyTag]msm_v_loopback_put(%d)\n", start);
    if (start)
        broadcast_event(AUDDEV_EVT_AUDIO_LP_START, DEVICE_IGNORE,
                        SESSION_IGNORE);
    else
        broadcast_event(AUDDEV_EVT_AUDIO_LP_END, DEVICE_IGNORE,
                        SESSION_IGNORE);
    return 0;
}
开发者ID:agat63,项目名称:N861_ZTE_kernel,代码行数:13,代码来源:msm7x30.c


示例3: msm_set_voice_mute

int msm_set_voice_mute(int dir, int mute)
{
	MM_AUD_INFO("dir %x mute %x\n", dir, mute);
	if (dir == DIR_TX) {
		routing_info.tx_mute = mute;
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
			routing_info.voice_tx_dev_id, SESSION_IGNORE);
	} else{
		routing_info.rx_mute = mute;
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
			routing_info.voice_rx_dev_id, SESSION_IGNORE);
	}
	return 0;
}
开发者ID:DooMLoRD,项目名称:HTC-Flyer-HC-Kernel,代码行数:14,代码来源:audio_dev_ctl.c


示例4: msm_v_call_put

static int msm_v_call_put(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
	int start = ucontrol->value.integer.value[0];
	if (start) {
		pr_aud_info("[ALSA] msm_start_voice");
		broadcast_event(AUDDEV_EVT_START_VOICE, DEVICE_IGNORE,
							SESSION_IGNORE);
	} else {
		pr_aud_info("[ALSA] msm_end_voice");
		broadcast_event(AUDDEV_EVT_END_VOICE, DEVICE_IGNORE,
							SESSION_IGNORE);
	}
	return 0;
}
开发者ID:OMFGB,项目名称:OMFGB_Mecha_Kernel,代码行数:15,代码来源:msm7x30.c


示例5: msm_volume_put

static int msm_volume_put(struct snd_kcontrol *kcontrol,
                          struct snd_ctl_elem_value *ucontrol)
{
    int ret = 0;
    int session_id = ucontrol->value.integer.value[0];
    int volume = ucontrol->value.integer.value[1];
    int factor = ucontrol->value.integer.value[2];
    u32 session_mask = 0;


    if (factor > 10000)
        return -EINVAL;

    if ((volume < 0) || (volume/factor > 100))
        return -EINVAL;

    volume = (MSM_VOLUME_STEP * volume);


    volume = volume/factor;

    if (volume > MSM_MAX_VOLUME)
        volume = MSM_MAX_VOLUME;


    session_mask = (0x1 << (session_id) << (8 * ((int)AUDDEV_CLNT_DEC-1)));
    msm_vol_ctl.volume = volume;
    MM_DBG("session_id %d, volume %d", session_id, volume);
    broadcast_event(AUDDEV_EVT_STREAM_VOL_CHG, DEVICE_IGNORE,
                    session_mask);

    return ret;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:33,代码来源:msm7x30.c


示例6: msm_volume_put

static int msm_volume_put(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
	int ret = 0;
	int session_id = ucontrol->value.integer.value[0];
	int volume = ucontrol->value.integer.value[1];
	u32 session_mask = 0;

	pr_aud_info("[ALSA] msm_set_volume: volume %d\n", volume);
	if ((volume < 0) || (volume > 100))
		return -EINVAL;

	volume = (MSM_VOLUME_STEP * volume);

	if (volume > MSM_MAX_VOLUME)
		volume = MSM_MAX_VOLUME;

	/* Only Decoder volume control supported */
	session_mask = (0x1 << (session_id) << (8 * ((int)AUDDEV_CLNT_DEC-1)));
	msm_vol_ctl.volume = volume;
	MM_DBG("session_id %d, volume %d", session_id, volume);
	broadcast_event(AUDDEV_EVT_STREAM_VOL_CHG, DEVICE_IGNORE,
							session_mask);

	return ret;
}
开发者ID:OMFGB,项目名称:OMFGB_Mecha_Kernel,代码行数:26,代码来源:msm7x30.c


示例7: msm_set_voice_vol

int msm_set_voice_vol(int dir, s32 volume)
{
	if (dir == DIR_TX) {
		routing_info.voice_tx_vol = volume;
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
					routing_info.voice_tx_dev_id,
					SESSION_IGNORE);
	} else if (dir == DIR_RX) {
		routing_info.voice_rx_vol = volume;
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
					routing_info.voice_rx_dev_id,
					SESSION_IGNORE);
	} else
		return -EINVAL;
	return 0;
}
开发者ID:yxsh,项目名称:ZTE-Blade-2.6.38.6,代码行数:16,代码来源:audio_dev_ctl.c


示例8: msm_set_voice_mute

int msm_set_voice_mute(int dir, int mute)
{
	MM_AUD_INFO("dir %x mute %x\n", dir, mute);
        if (!audio_dev_ctrl.voice_rx_dev
                || !audio_dev_ctrl.voice_tx_dev)
                return -EPERM;
	if (dir == DIR_TX) {
		routing_info.tx_mute = mute;
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
			routing_info.voice_tx_dev_id, SESSION_IGNORE);
	} else{
		routing_info.rx_mute = mute;
		pr_aud_info("%s, rx_mute=%d\n", __func__, routing_info.rx_mute);
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
			routing_info.voice_rx_dev_id, SESSION_IGNORE);
	}
	return 0;
}
开发者ID:DevChun,项目名称:ace-ics-kernel,代码行数:18,代码来源:audio_dev_ctl.c


示例9: msm_set_voice_mute

int msm_set_voice_mute(int dir, int mute, u32 session_id)
{
	pr_debug("dir %x mute %x\n", dir, mute);
	if (dir == DIR_TX) {
		routing_info.tx_mute = mute;
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
			routing_info.voice_tx_dev_id, session_id);
	} else
		return -EPERM;
	return 0;
}
开发者ID:Ravike14,项目名称:Ravike14-kernel,代码行数:11,代码来源:audio_dev_ctl.c


示例10: msm_set_voice_vol

int msm_set_voice_vol(int dir, s32 volume)
{
#ifdef CONFIG_2WCR
        if (!audio_dev_ctrl.voice_rx_dev
                || !audio_dev_ctrl.voice_tx_dev)
                return -EPERM;
#endif
	if (dir == DIR_TX) {
		routing_info.voice_tx_vol = volume;
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
					routing_info.voice_tx_dev_id,
					SESSION_IGNORE);
	} else if (dir == DIR_RX) {
		routing_info.voice_rx_vol = volume;
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
					routing_info.voice_rx_dev_id,
					SESSION_IGNORE);
	} else
		return -EINVAL;
	return 0;
}
开发者ID:12rafael,项目名称:jellytimekernel,代码行数:21,代码来源:audio_dev_ctl.c


示例11: msm_reset_all_device

int msm_reset_all_device(void)
{
	int rc = 0;
	int dev_id = 0;
	struct msm_snddev_info *dev_info = NULL;

	for (dev_id = 0; dev_id < audio_dev_ctrl.num_dev; dev_id++) {
		dev_info = audio_dev_ctrl_find_dev(dev_id);
		if (IS_ERR(dev_info)) {
			pr_err("%s:pass invalid dev_id\n", __func__);
			rc = PTR_ERR(dev_info);
			return rc;
		}
		if (!dev_info->opened)
			continue;
		pr_debug("%s:Resetting device %d active on COPP %d"
			"with  %lld as routing\n", __func__,
				dev_id, dev_info->copp_id, dev_info->sessions);
		broadcast_event(AUDDEV_EVT_REL_PENDING,
					dev_id,
					SESSION_IGNORE);
		rc = dev_info->dev_ops.close(dev_info);
		if (rc < 0) {
			pr_err("%s:Snd device failed close!\n", __func__);
			return rc;
		} else {
			dev_info->opened = 0;
			broadcast_event(AUDDEV_EVT_DEV_RLS,
				dev_id,
				SESSION_IGNORE);

			if (dev_info->copp_id == VOICE_PLAYBACK_TX)
				voice_start_playback(0);
		}
		dev_info->sessions = 0;
	}
	msm_clear_all_session();
	return 0;
}
开发者ID:yxsh,项目名称:ZTE-Blade-2.6.38.6,代码行数:39,代码来源:audio_dev_ctl.c


示例12: msm_set_voice_mute

int msm_set_voice_mute(int dir, int mute)
{
	MM_DBG("dir %x mute %x\n", dir, mute);
	if (!audio_dev_ctrl.voice_rx_dev
		|| !audio_dev_ctrl.voice_tx_dev)
		return -EPERM;
	if (dir == DIR_TX) {
		routing_info.tx_mute = mute;
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG,
			routing_info.voice_tx_dev_id, SESSION_IGNORE);
	} else
		return -EPERM;
	return 0;
}
开发者ID:DRHAX34,项目名称:android_kernel_zte_sailboat,代码行数:14,代码来源:audio_dev_ctl.c


示例13: mixer_post_event

void mixer_post_event(u32 evt_id, u32 id)
{

	MM_DBG("evt_id = %d\n", evt_id);
	switch (evt_id) {
	case AUDDEV_EVT_DEV_CHG_VOICE: /* Called from Voice_route */
		broadcast_event(AUDDEV_EVT_DEV_CHG_VOICE, id, SESSION_IGNORE);
		break;
	case AUDDEV_EVT_DEV_RDY:
		broadcast_event(AUDDEV_EVT_DEV_RDY, id, SESSION_IGNORE);
		break;
	case AUDDEV_EVT_DEV_RLS:
		broadcast_event(AUDDEV_EVT_DEV_RLS, id, SESSION_IGNORE);
		break;
	case AUDDEV_EVT_REL_PENDING:
		broadcast_event(AUDDEV_EVT_REL_PENDING, id, SESSION_IGNORE);
		break;
	case AUDDEV_EVT_DEVICE_VOL_MUTE_CHG:
		broadcast_event(AUDDEV_EVT_DEVICE_VOL_MUTE_CHG, id,
							SESSION_IGNORE);
		break;
	case AUDDEV_EVT_STREAM_VOL_CHG:
		broadcast_event(AUDDEV_EVT_STREAM_VOL_CHG, id,
							SESSION_IGNORE);
		break;
	case AUDDEV_EVT_START_VOICE:
		broadcast_event(AUDDEV_EVT_START_VOICE,
				id, SESSION_IGNORE);
		break;
	case AUDDEV_EVT_END_VOICE:
		broadcast_event(AUDDEV_EVT_END_VOICE,
				id, SESSION_IGNORE);
		break;
	case AUDDEV_EVT_FREQ_CHG:
		broadcast_event(AUDDEV_EVT_FREQ_CHG, id, SESSION_IGNORE);
		break;
	default:
		break;
	}
}
开发者ID:DooMLoRD,项目名称:HTC-Flyer-HC-Kernel,代码行数:40,代码来源:audio_dev_ctl.c


示例14: msm_volume_put

static int msm_volume_put(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_value *ucontrol)
{
	int ret = 0;
	int session_id = ucontrol->value.integer.value[0];
	int volume = ucontrol->value.integer.value[1];
	int factor = ucontrol->value.integer.value[2];
	u64 session_mask = 0;

	pr_aud_info("[ALSA] msm_set_volume: volume %d\n", volume);
	if (factor > 10000)
		return -EINVAL;

	if ((volume < 0) || (volume/factor > 100))
		return -EINVAL;

	volume = (MSM_VOLUME_STEP * volume);

	/* Convert back to original decimal point by removing the 10-base factor
	* and discard the fractional portion
	*/

	volume = volume/factor;

	if (volume > MSM_MAX_VOLUME)
		volume = MSM_MAX_VOLUME;

	/* Only Decoder volume control supported */
	session_mask = (((u64)0x1) << session_id) << (MAX_BIT_PER_CLIENT * \
				((int)AUDDEV_CLNT_DEC-1));
	msm_vol_ctl.volume = volume;
	MM_DBG("session_id %d, volume %d", session_id, volume);
	broadcast_event(AUDDEV_EVT_STREAM_VOL_CHG, DEVICE_IGNORE,
							session_mask);

	return ret;
}
开发者ID:RepoBackups,项目名称:bricked-shooteru-ics-sense,代码行数:37,代码来源:msm8x60.c


示例15: msm_route_put

static int msm_route_put(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol)
{
	int rc = 0;
	int enc_freq = 0;
	int requested_freq = 0;
	struct msm_audio_route_config route_cfg;
	struct msm_snddev_info *dev_info;
	int session_id = ucontrol->value.integer.value[0];
	int set = ucontrol->value.integer.value[2];
	u32 session_mask = 0;
	route_cfg.dev_id = ucontrol->value.integer.value[1];

	pr_aud_info("[ALSA] msm_route_stream: session %d, dev %d, enable %d\n",
		session_id, route_cfg.dev_id, set);
	if (ucontrol->id.numid == 2)
		route_cfg.stream_type =	AUDIO_ROUTE_STREAM_PLAYBACK;
	else
		route_cfg.stream_type =	AUDIO_ROUTE_STREAM_REC;

	MM_DBG("route cfg %d %d type for popp %d\n",
		route_cfg.dev_id, route_cfg.stream_type, session_id);
	dev_info = audio_dev_ctrl_find_dev(route_cfg.dev_id);

	if (IS_ERR(dev_info)) {
		MM_AUD_ERR("pass invalid dev_id\n");
		rc = PTR_ERR(dev_info);
		return rc;
	}
	if (route_cfg.stream_type == AUDIO_ROUTE_STREAM_PLAYBACK) {
		rc = msm_snddev_set_dec(session_id, dev_info->copp_id, set);
		session_mask =
			(0x1 << (session_id) << (8 * ((int)AUDDEV_CLNT_DEC-1)));
		if (!set) {
			if (dev_info->opened)
				broadcast_event(AUDDEV_EVT_DEV_RLS,
							route_cfg.dev_id,
							session_mask);
			dev_info->sessions &= ~(session_mask);
		} else {
			dev_info->sessions = dev_info->sessions | session_mask;
			if (dev_info->opened)
				broadcast_event(AUDDEV_EVT_DEV_RDY,
							route_cfg.dev_id,
							session_mask);
		}
	} else {
		rc = msm_snddev_set_enc(session_id, dev_info->copp_id, set);
		session_mask =
			(0x1 << (session_id)) << (8 * ((int)AUDDEV_CLNT_ENC-1));
		if (!set) {
			if (dev_info->opened)
				broadcast_event(AUDDEV_EVT_DEV_RLS,
							route_cfg.dev_id,
							session_mask);
			dev_info->sessions &= ~(session_mask);
		} else {
			dev_info->sessions = dev_info->sessions | session_mask;
			enc_freq = msm_snddev_get_enc_freq(session_id);
			requested_freq = enc_freq;
			if (enc_freq > 0) {
				rc = msm_snddev_request_freq(&enc_freq,
						session_id,
						SNDDEV_CAP_TX,
						AUDDEV_CLNT_ENC);
				MM_DBG("sample rate configured %d"
					"sample rate requested %d \n",
					enc_freq, requested_freq);
				if ((rc <= 0) || (enc_freq != requested_freq)) {
					MM_DBG("msm_snddev_withdraw_freq\n");
					rc = msm_snddev_withdraw_freq
						(session_id,
						SNDDEV_CAP_TX, AUDDEV_CLNT_ENC);
					broadcast_event(AUDDEV_EVT_FREQ_CHG,
							route_cfg.dev_id,
							SESSION_IGNORE);
				}
			}
			if (dev_info->opened)
				broadcast_event(AUDDEV_EVT_DEV_RDY,
							route_cfg.dev_id,
							session_mask);
		}
	}

	if (rc < 0) {
		MM_AUD_ERR("device could not be assigned!\n");
		return -EFAULT;
	}

	return rc;
}
开发者ID:OMFGB,项目名称:OMFGB_Mecha_Kernel,代码行数:92,代码来源:msm7x30.c


示例16: msm_device_put

static int msm_device_put(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol)
{
	int rc = 0;
	int set = 0;
	struct msm_audio_route_config route_cfg;
	struct msm_snddev_info *dev_info;
	int tx_freq = 0;
	int rx_freq = 0;
	u32 set_freq = 0;
	int retry = 3;

	set = ucontrol->value.integer.value[0];
	route_cfg.dev_id = ucontrol->id.numid - device_index;
	dev_info = audio_dev_ctrl_find_dev(route_cfg.dev_id);
	if (IS_ERR(dev_info)) {
		MM_AUD_ERR("pass invalid dev_id\n");
		rc = PTR_ERR(dev_info);
		return rc;
	}
	MM_AUD_INFO("device %s set %d\n", dev_info->name, set);
	pr_aud_info("[ALSA] msm_en_device (dev %s, id %d, enable %d, opened %d)\n",
		dev_info->name, route_cfg.dev_id, set, dev_info->opened);
	if (set) {
		if (!dev_info->opened) {
			set_freq = dev_info->sample_rate;
			if (!msm_device_is_voice(route_cfg.dev_id)) {
				msm_get_voc_freq(&tx_freq, &rx_freq);
				if (dev_info->capability & SNDDEV_CAP_TX)
					set_freq = tx_freq;

				if (set_freq == 0)
					set_freq = dev_info->sample_rate;
			} else
				set_freq = dev_info->sample_rate;


			MM_AUD_INFO("device freq =%d\n", set_freq);
			rc = dev_info->dev_ops.set_freq(dev_info, set_freq);
			if (rc < 0) {
				MM_AUD_ERR("device freq failed!\n");
				return rc;
			}
			dev_info->set_sample_rate = rc;
			rc = 0;
			do{
				rc = dev_info->dev_ops.open(dev_info);
				retry--;
			} while (rc < 0 && retry);

			if (rc < 0) {
				MM_AUD_ERR("Enabling %s failed, rc=%d\n", dev_info->name, rc);
				return rc;
			}
			dev_info->opened = 1;
			pr_aud_info("set device %s opened as %d\n",
				dev_info->name, dev_info->opened);
			broadcast_event(AUDDEV_EVT_DEV_RDY, route_cfg.dev_id,
							SESSION_IGNORE);
		}
	} else {
		if (dev_info->opened) {
			broadcast_event(AUDDEV_EVT_REL_PENDING,
						route_cfg.dev_id,
						SESSION_IGNORE);
			rc = dev_info->dev_ops.close(dev_info);
			if (rc < 0) {
				MM_AUD_ERR("Snd device failed close!\n");
				return rc;
			} else {
				dev_info->opened = 0;
				pr_aud_info("set device %s opened as %d\n",
					dev_info->name, dev_info->opened);
				broadcast_event(AUDDEV_EVT_DEV_RLS,
					route_cfg.dev_id,
					SESSION_IGNORE);
			}
		}

	}
	return rc;
}
开发者ID:OMFGB,项目名称:OMFGB_Mecha_Kernel,代码行数:82,代码来源:msm7x30.c


示例17: msm_voice_put


//.........这里部分代码省略.........
		tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
		tm.tm_hour, tm.tm_min, tm.tm_sec, ts.tv_nsec);
	}

	/* Rx Device Routing */
	rx_dev_id = ucontrol->value.integer.value[0];
	rx_dev_info = audio_dev_ctrl_find_dev(rx_dev_id);

	if (IS_ERR(rx_dev_info)) {
		MM_AUD_ERR("pass invalid dev_id\n");
		rc = PTR_ERR(rx_dev_info);
		return rc;
	}

	if (!(rx_dev_info->capability & SNDDEV_CAP_RX)) {
		MM_AUD_ERR("First Dev is supposed to be RX\n");
		return -EFAULT;
	}

	MM_DBG("route cfg %d STREAM_VOICE_RX type\n",
		rx_dev_id);

	/* replace with Rx voice/media setting for adie */
	if (rx_dev_info->acdb_id != 10 &&
	    (rx_dev_info->acdb_id < 1000)) {
	    icodec = (struct snddev_icodec_state *)rx_dev_info->private_data;
	    rx_entry = icodec->data->profile->settings;
	    j = icodec->data->profile->setting_sz;
	    if (set) {
		for (i = 0; i < j; i++)
		    if (rx_entry[i].voc_action != NULL) {
			rx_entry[i].actions = rx_entry[i].voc_action;
			rx_entry[i].action_sz = rx_entry[i].voc_action_sz;
		    }
	    } else {
		for (i = 0; i < j; i++)
		    if (rx_entry[i].midi_action != NULL) {
			rx_entry[i].actions = rx_entry[i].midi_action;
			rx_entry[i].action_sz = rx_entry[i].midi_action_sz;
		    }
	    }
	}

	msm_set_voc_route(rx_dev_info, AUDIO_ROUTE_STREAM_VOICE_RX,
				rx_dev_id);

	session_mask =	0x1 << (8 * ((int)AUDDEV_CLNT_VOC-1));

	/* Tx Device Routing */
	tx_dev_id = ucontrol->value.integer.value[1];
	tx_dev_info = audio_dev_ctrl_find_dev(tx_dev_id);

	if (IS_ERR(tx_dev_info)) {
		MM_AUD_ERR("pass invalid dev_id\n");
		rc = PTR_ERR(tx_dev_info);
		return rc;
	}

	if (!(tx_dev_info->capability & SNDDEV_CAP_TX)) {
		MM_AUD_ERR("Second Dev is supposed to be Tx\n");
		return -EFAULT;
	}

	MM_DBG("route cfg %d %d type\n",
		tx_dev_id, AUDIO_ROUTE_STREAM_VOICE_TX);
	/* replace with Tx voice/media setting for adie */
	if (tx_dev_info->acdb_id != 9 &&
	    (tx_dev_info->acdb_id < 1000)) {
	    icodec = (struct snddev_icodec_state *)tx_dev_info->private_data;
	    tx_entry = icodec->data->profile->settings;
	    j = icodec->data->profile->setting_sz;
	    if (set) {
		for (i = 0; i < j; i++)
		    if (tx_entry[i].voc_action != NULL) {
			tx_entry[i].actions = tx_entry[i].voc_action;
			tx_entry[i].action_sz = tx_entry[i].voc_action_sz;
		    }
	    } else {
		for (i = 0; i < j; i++)
		    if (tx_entry[i].midi_action != NULL) {
			tx_entry[i].actions = tx_entry[i].midi_action;
			tx_entry[i].action_sz = tx_entry[i].midi_action_sz;
		    }
	    }
	}
	msm_set_voc_route(tx_dev_info, AUDIO_ROUTE_STREAM_VOICE_TX,
				tx_dev_id);

	broadcast_event(AUDDEV_EVT_DEV_CHG_VOICE, tx_dev_id, session_mask);

	if (set) {
	if (rx_dev_info->opened)
		broadcast_event(AUDDEV_EVT_DEV_RDY, rx_dev_id,	session_mask);

	if (tx_dev_info->opened)
		broadcast_event(AUDDEV_EVT_DEV_RDY, tx_dev_id, session_mask);
	}

	return rc;
}
开发者ID:OMFGB,项目名称:OMFGB_Mecha_Kernel,代码行数:101,代码来源:msm7x30.c


示例18: msm_snddev_request_freq

int msm_snddev_request_freq(int *freq, u32 session_id,
			u32 capability, u32 clnt_type)
{
	int i = 0;
	int rc = 0;
	struct msm_snddev_info *info;
	u32 set_freq;
	u64 session_mask = 0;
	u64 clnt_type_mask = 0;

	pr_debug(": clnt_type 0x%08x\n", clnt_type);

	if ((clnt_type == AUDDEV_CLNT_VOC) && (session_id != 0))
		return -EINVAL;
	if ((clnt_type == AUDDEV_CLNT_DEC)
			&& (session_id >= MAX_SESSIONS))
		return -EINVAL;
	if ((clnt_type == AUDDEV_CLNT_ENC)
			&& (session_id >= MAX_SESSIONS))
		return -EINVAL;
	session_mask = (((u64)0x1) << session_id) << (MAX_BIT_PER_CLIENT * \
				((int)clnt_type-1));
	clnt_type_mask = (0xFFFF << (MAX_BIT_PER_CLIENT * (clnt_type-1)));
	if (!(*freq == 8000) && !(*freq == 11025) &&
		!(*freq == 12000) && !(*freq == 16000) &&
		!(*freq == 22050) && !(*freq == 24000) &&
		!(*freq == 32000) && !(*freq == 44100) &&
		!(*freq == 48000))
		return -EINVAL;

	for (i = 0; i < audio_dev_ctrl.num_dev; i++) {
		info = audio_dev_ctrl.devs[i];
		if ((info->sessions & session_mask)
			&& (info->capability & capability)) {
			rc = 0;
			if ((info->sessions & ~clnt_type_mask)
				&& ((*freq != 8000) && (*freq != 16000)
					&& (*freq != 48000))) {
				if (clnt_type == AUDDEV_CLNT_ENC) {
					routing_info.enc_freq[session_id].freq
							= 0;
					return -EPERM;
				} else if (clnt_type == AUDDEV_CLNT_DEC) {
					routing_info.dec_freq[session_id].freq
							= 0;
					return -EPERM;
				}
			}
			if (*freq == info->set_sample_rate) {
				rc = info->set_sample_rate;
				continue;
			}
			set_freq = MAX(*freq, info->set_sample_rate);


			if (clnt_type == AUDDEV_CLNT_DEC) {
				routing_info.dec_freq[session_id].evt = 1;
				routing_info.dec_freq[session_id].freq
						= set_freq;
			} else if (clnt_type == AUDDEV_CLNT_ENC) {
				routing_info.enc_freq[session_id].evt = 1;
				routing_info.enc_freq[session_id].freq
						= set_freq;
			} else if (capability == SNDDEV_CAP_TX)
				routing_info.voice_tx_sample_rate = set_freq;

			rc = set_freq;
			info->set_sample_rate = set_freq;
			*freq = info->set_sample_rate;

			if (info->opened) {
				broadcast_event(AUDDEV_EVT_FREQ_CHG, i,
							SESSION_IGNORE);
				set_freq = info->dev_ops.set_freq(info,
								set_freq);
				broadcast_event(AUDDEV_EVT_DEV_RDY, i,
							SESSION_IGNORE);
			}
		}
		pr_debug("info->set_sample_rate = %d\n", info->set_sample_rate);
		pr_debug("routing_info.enc_freq.freq = %d\n",
					routing_info.enc_freq[session_id].freq);
	}
	return rc;
}
开发者ID:yxsh,项目名称:ZTE-Blade-2.6.38.6,代码行数:85,代码来源:audio_dev_ctl.c


示例19: msm_voice_put

static int msm_voice_put(struct snd_kcontrol *kcontrol,
			struct snd_ctl_elem_value *ucontrol)
{
	int rc = 0;
	uint32_t rx_dev_id;
	uint32_t tx_dev_id;
	struct msm_snddev_info *rx_dev_info;
	struct msm_snddev_info *tx_dev_info;
	int set = ucontrol->value.integer.value[2];
	u64 session_mask;

	int i = 0, j = 0;
	struct snddev_icodec_state *icodec;
	struct adie_codec_hwsetting_entry *rx_entry;
	struct adie_codec_hwsetting_entry *tx_entry;

	/* if (!set)
		return -EPERM; */

	pr_aud_info("[ALSA] msm_route_voice: "
		"tx %d, rx %d, set %d\n",
		(int) ucontrol->value.integer.value[1],
		(int) ucontrol->value.integer.value[0],
		set);
	/* Rx Device Routing */
	rx_dev_id = ucontrol->value.integer.value[0];
	rx_dev_info = audio_dev_ctrl_find_dev(rx_dev_id);

	if (IS_ERR(rx_dev_info)) {
		MM_AUD_ERR("pass invalid dev_id\n");
		rc = PTR_ERR(rx_dev_info);
		return rc;
	}

	if (!(rx_dev_info->capability & SNDDEV_CAP_RX)) {
		MM_AUD_ERR("First Dev is supposed to be RX\n");
		return -EFAULT;
	}

	MM_DBG("route cfg %d STREAM_VOICE_RX type\n",
		rx_dev_id);

	/* replace with Rx voice/media setting for adie */
	/* only for internal codec */
	if (rx_dev_info->copp_id == PRIMARY_I2S_RX) {
		icodec = (struct snddev_icodec_state *)rx_dev_info->private_data;
		rx_entry = icodec->data->profile->settings;
		j = icodec->data->profile->setting_sz;
		if (set) {
			for (i = 0; i < j; i++)
				if (rx_entry[i].voc_action != NULL) {
					rx_entry[i].actions = rx_entry[i].voc_action;
					rx_entry[i].action_sz = rx_entry[i].voc_action_sz;
			}
		} else {
			for (i = 0; i < j; i++)
				if (rx_entry[i].midi_action != NULL) {
					rx_entry[i].actions = rx_entry[i].midi_action;
					rx_entry[i].action_sz = rx_entry[i].midi_action_sz;
				}
		}
	}

	msm_set_voc_route(rx_dev_info, AUDIO_ROUTE_STREAM_VOICE_RX,
				rx_dev_id);

	session_mask =	((u64)0x1) << (MAX_BIT_PER_CLIENT * \
				((int)AUDDEV_CLNT_VOC-1));

	broadcast_event(AUDDEV_EVT_DEV_CHG_VOICE, rx_dev_id, session_mask);


	/* Tx Device Routing */
	tx_dev_id = ucontrol->value.integer.value[1];
	tx_dev_info = audio_dev_ctrl_find_dev(tx_dev_id);

	if (IS_ERR(tx_dev_info)) {
		MM_AUD_ERR("pass invalid dev_id\n");
		rc = PTR_ERR(tx_dev_info);
		return rc;
	}

	if (!(tx_dev_info->capability & SNDDEV_CAP_TX)) {
		MM_AUD_ERR("Second Dev is supposed to be Tx\n");
		return -EFAULT;
	}

	MM_DBG("route cfg %d %d type\n",
		tx_dev_id, AUDIO_ROUTE_STREAM_VOICE_TX);

	/* replace with Tx voice/media setting for adie */
	/* only for internal codec */
	if (tx_dev_info->copp_id == PRIMARY_I2S_TX) {
		icodec = (struct snddev_icodec_state *)tx_dev_info->private_data;
		tx_entry = icodec->data->profile->settings;
		j = icodec->data->profile->setting_sz;
		if (set) {
			for (i = 0; i < j; i++)
				if (tx_entry[i].voc_action != NULL) {
					tx_entry[i].actions = tx_entry[i].voc_action;
//.........这里部分代码省略.........
开发者ID:RepoBackups,项目名称:bricked-shooteru-ics-sense,代码行数:101,代码来源:msm8x60.c


示例20: voice_thread

static int voice_thread(void *data)
{
    struct voice_data *v = (struct voice_data *)data;
    int rc = 0;

    MM_INFO("voice_thread() start\n");

    while (!kthread_should_stop()) {
        wait_for_completion(&v->complete);
        init_completion(&v->complete);

        MM_DBG(" voc_event=%d, voice state =%d, dev_event=%d\n",
               v->voc_event, v->voc_state, v->dev_event);
        switch (v->voc_event) {
        case VOICE_ACQUIRE_START:
            /* check if dev_state = READY */
            /* if ready, send device_info and acquire_done */
            /* if not ready, block to wait the dev_state = READY */
            if ((v->voc_state == VOICE_INIT) ||
                    (v->voc_state == VOICE_RELEASE)) {
                if (v->dev_state == DEV_READY) {
                    mutex_lock(&voice.voc_lock);
                    voice_change_sample_rate(v);
                    rc = voice_cmd_device_info(v);
                    rc = voice_cmd_acquire_done(v);
                    v->voc_state = VOICE_ACQUIRE;
                    mutex_unlock(&voice.voc_lock);
                    broadcast_event(
                        AUDDEV_EVT_VOICE_STATE_CHG,
                        VOICE_STATE_INCALL, SESSION_IGNORE);
                } else {
                    rc = wait_event_interruptible(
                             v->dev_wait,
                             (v->dev_state == DEV_READY)
                             || (atomic_read(&v->rel_start_flag)
                                 == 1));
                    if (atomic_read(&v->rel_start_flag)
                            == 1) {
                        v->voc_state = VOICE_RELEASE;
                        atomic_dec(&v->rel_start_flag);
                        msm_snddev_withdraw_freq(0,
                                                 SNDDEV_CAP_TX, AUDDEV_CLNT_VOC);
                        broadcast_event(
                            AUDDEV_EVT_VOICE_STATE_CHG,
                            VOICE_STATE_OFFCALL,
                            SESSION_IGNORE);
                    } else {
                        mutex_lock(&voice.voc_lock);
                        voice_change_sample_rate(v);
                        rc = voice_cmd_device_info(v);
                        rc = voice_cmd_acquire_done(v);
                        v->voc_state = VOICE_ACQUIRE;
                        mutex_unlock(&voice.voc_lock);
                        broadcast_event(
                            AUDDEV_EVT_VOICE_STATE_CHG,
                            VOICE_STATE_INCALL,
                            SESSION_IGNORE);
                    }
                }
            } else
                MM_ERR("Get this event at the wrong state\n");
            if (atomic_read(&v->acq_start_flag))
                atomic_dec(&v->acq_start_flag);
            break;
        case VOICE_RELEASE_START:
            MM_DBG("broadcast voice call end\n");
            broadcast_event(AUDDEV_EVT_VOICE_STATE_CHG,
                            VOICE_STATE_OFFCALL, SESSION_IGNORE);
            if ((v->dev_state == DEV_REL_DONE) ||
                    (v->dev_state == DEV_INIT)) {
                v->voc_state = VOICE_RELEASE;
                msm_snddev_withdraw_freq(0, SNDDEV_CAP_TX,
                                         AUDDEV_CLNT_VOC);
            } else {
                /* wait for the dev_state = RELEASE */
                rc = wait_event_interruptible(v->dev_wait,
                                              (v->dev_state == DEV_REL_DONE)
                                              || (atomic_read(&v->acq_start_flag) == 1));
                if (atomic_read(&v->acq_start_flag) == 1)
                    atomic_dec(&v->acq_start_flag);
                v->voc_state = VOICE_RELEASE;
                msm_snddev_withdraw_freq(0, SNDDEV_CAP_TX,
                                         AUDDEV_CLNT_VOC);
            }
            if (atomic_read(&v->rel_start_flag))
                atomic_dec(&v->rel_start_flag);
            break;
        case VOICE_CHANGE_START:
            if (v->voc_state == VOICE_ACQUIRE)
                v->voc_state = VOICE_CHANGE;
            else
                MM_ERR("Get this event at the wrong state\n");
            wake_up(&v->voc_wait);
            if (atomic_read(&v->chg_start_flag))
                atomic_dec(&v->chg_start_flag);
            break;
        case VOICE_NETWORK_RECONFIG:
            if ((v->voc_state == VOICE_ACQUIRE)
                    || (v->voc_state == VOICE_CHANGE)) {
                voice_change_sample_rate(v);
//.........这里部分代码省略.........
开发者ID:Jimmyk422,项目名称:android_kernel_samsung_iconvmu,代码行数:101,代码来源:voice.c



注:本文中的broadcast_event函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ browse函数代码示例发布时间:2022-05-30
下一篇:
C++ broadcastMessage函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap