static void audplay_dsp_event(void *data, unsigned id, size_t len,
			    void (*getevent)(void *ptr, size_t len))
{
	struct audio *audio = data;
	uint32_t msg[28];
	getevent(msg, sizeof(msg));

	switch (id) {
	case AUDPLAY_MSG_STREAM_INFO:
		/* only for AAC playback */
		break;
	case AUDPLAY_MSG_DEC_NEEDS_DATA:
		if (!atomic_read(&audio->curr_img)) {
			audplay_send_data(audio, 1);
		} else {
			audio->dsp_free_len = msg[3] - 2;
			audio->dsp_write_ptr = (uint16_t *)
						adsp_rtos_phy_to_vir(msg[4],
								MSM_AD5_BASE);
			audio->dsp_start_ptr = (uint16_t *)
						adsp_rtos_phy_to_vir(msg[5],
								MSM_AD5_BASE);
			audio->dsp_buf_size = msg[6];
			audplay_send_lp_data(audio, 1);
		}
		break;
	default:
		pr_err("mp3:unexpected message from decoder \n");
		break;
	}
}
Example #2
0
static void audplay_aac_dsp_event(void *data, unsigned id, size_t len,
			    void (*getevent)(void *ptr, size_t len))
{
	struct audio *audio = data;
	uint32_t msg[28];
	getevent(msg, sizeof(msg));

	switch (id) {
	case AUDPLAY_MSG_STREAM_INFO:
		pr_info("aac:channel_mode = %d, sample_rate = %d\n", \
			msg[1], msg[2]);
		break;
	case AUDPLAY_MSG_DEC_NEEDS_DATA:
		if (!atomic_read(&audio->curr_img)) {
			audplay_send_data(audio, 1);
		} else {
			audio->dsp_free_len = msg[3] - 2;
			audio->dsp_write_ptr = (uint16_t *)
				adsp_rtos_phy_to_vir(msg[4], MSM_AD5_BASE);
			audio->dsp_start_ptr = (uint16_t *)
				adsp_rtos_phy_to_vir(msg[5], MSM_AD5_BASE);
			audio->dsp_buf_size = msg[6];
			audplay_send_lp_data(audio, 1);
		}
		break;
	case ADSP_MESSAGE_ID:
		pr_info("audplay: module enabled\n");
		break;
	default:
		pr_err("aac: unexpected message from decoder\n");
		break;
	}
}