Beispiel #1
0
void init_iapetus(int res)
{
   int i;

   interrupt_set_level_mask(0xF);

   for (i = 0; i < 0x80; i++)
      bios_set_sh2_interrupt(i, 0);

   for (i = 0x40; i < 0x60; i++)
      bios_set_scu_interrupt(i, 0);

   // Make sure all interrupts have been called
   bios_change_scu_interrupt_mask(0, 0);
   bios_change_scu_interrupt_mask(0xFFFFFFFF, 0xFFFFFFFF);

   vdp_init(res);
   per_init();

   commlink_stop_service();
   cl_set_service_func(cl_check2);

#ifdef DEBUG
   debug_init();
#endif

   // If DSP is running, stop it
   if (dsp_is_exec())
       dsp_stop();

   if (interrupt_get_level_mask() > 0x7)
      interrupt_set_level_mask(0x7);
}
Beispiel #2
0
static GstStateChangeReturn
change_state(GstElement *element,
	     GstStateChange transition)
{
	GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
	GstDspDummy *self;

	self = GST_DSP_DUMMY(element);

	switch (transition) {
	case GST_STATE_CHANGE_NULL_TO_READY:
		if (!dsp_init(self)) {
			GST_ERROR("dsp init failed");
			return GST_STATE_CHANGE_FAILURE;
		}

		break;

	case GST_STATE_CHANGE_READY_TO_PAUSED:
		if (!dsp_start(self)) {
			GST_ERROR("dsp start failed");
			return GST_STATE_CHANGE_FAILURE;
		}

		break;

	default:
		break;
	}

	ret = parent_class->change_state(element, transition);

	if (ret == GST_STATE_CHANGE_FAILURE)
		return ret;

	switch (transition) {
	case GST_STATE_CHANGE_PAUSED_TO_READY:
		if (!dsp_stop(self)) {
			GST_ERROR("dsp stop failed");
			return GST_STATE_CHANGE_FAILURE;
		}

		break;

	case GST_STATE_CHANGE_READY_TO_NULL:
		if (!dsp_deinit(self)) {
			GST_ERROR("dsp deinit failed");
			return GST_STATE_CHANGE_FAILURE;
		}

		break;

	default:
		break;
	}

	return ret;
}
int audiodsp_start(void)
{
	struct audiodsp_priv *priv=audiodsp_privdata();
	struct audiodsp_microcode *pmcode;
	struct audio_info *audio_info;
	int ret,i;
	priv->frame_format.valid=0;
	priv->decode_error_count=0;
	priv->last_valid_pts=0;
	priv->out_len_after_last_valid_pts = 0;
	priv->decode_fatal_err = 0;
	priv->first_lookup_over = 0;
	pmcode=audiodsp_find_supoort_mcode(priv,priv->stream_fmt);
	if(pmcode==NULL)
	{
		DSP_PRNT("have not find a valid mcode for fmt(0x%x)\n",priv->stream_fmt);
		return -1;
	}

	stop_audiodsp_monitor(priv);
	dsp_stop(priv);
	ret=dsp_start(priv,pmcode);
	if(ret==0){
 		start_audiodsp_monitor(priv);

#ifdef CONFIG_AM_VDEC_REAL
	if((pmcode->fmt == MCODEC_FMT_COOK) || 
	   (pmcode->fmt == MCODEC_FMT_RAAC) || 
	   (pmcode->fmt == MCODEC_FMT_AMR)  || 
	   (pmcode->fmt == MCODEC_FMT_WMA)  ||
	   (pmcode->fmt == MCODEC_FMT_ADPCM)|| 
	   (pmcode->fmt == MCODEC_FMT_PCM)  ||
	   (pmcode->fmt == MCODEC_FMT_WMAPRO)||
	   (pmcode->fmt == MCODEC_FMT_ALAC)||
	  (pmcode->fmt & MCODEC_FMT_AC3) ||
	   (pmcode->fmt & MCODEC_FMT_EAC3) ||	  
	  (pmcode->fmt == MCODEC_FMT_APE) ||
	  (pmcode->fmt == MCODEC_FMT_FLAC))

	{
		DSP_PRNT("dsp send audio info\n");
    		for(i = 0; i< 2000;i++){
                if(DSP_RD(DSP_AUDIOINFO_STATUS) == DSP_AUDIOINFO_READY)//maybe at audiodsp side,INT not enabled yet,so wait a while
                    break;
    		     msleep(1);
            }
		if(i == 2000)
			DSP_PRNT("audiodsp not ready for info  \n");
            DSP_WD(DSP_AUDIOINFO_STATUS,0);
		    audio_info = get_audio_info();
		DSP_PRNT("kernel sent info first 4 byte[0x%x],[0x%x],[0x%x],[0x%x]\n\t",audio_info->extradata[0],\
			audio_info->extradata[1],audio_info->extradata[2],audio_info->extradata[3]);
		DSP_WD(DSP_GET_EXTRA_INFO_FINISH, 0);
		while(1){
		    dsp_mailbox_send(priv, 1, M2B_IRQ4_AUDIO_INFO, 0, (const char*)audio_info, sizeof(struct audio_info));
		    msleep(100);

		    if(DSP_RD(DSP_GET_EXTRA_INFO_FINISH) == 0x12345678)
		        break;
		}
    }
#endif
     }
	return ret;
}
Beispiel #4
0
int main(int argc, const char **argv)
{
	int ret = 0;
	int dsp_handle;
	void *proc;
	char *cmd[1];

	if (argc != 2) {
		pr_err("Wrong arguments: %s <dsp_program>", argv[0]);
		return -1;
	}

	dsp_handle = dsp_open();

	if (dsp_handle < 0) {
		pr_err("dsp open failed");
		return -1;
	}

	if (!dsp_attach(dsp_handle, 0, NULL, &proc)) {
		pr_err("dsp attach failed");
		ret = -1;
		goto leave;
	}

	if (!dsp_stop(dsp_handle, proc)) {
		pr_err("dsp stop failed");
		ret = -1;
		goto leave;
	}

	cmd[0] = (char *) argv[1];
	if (!dsp_load(dsp_handle, proc, 1, cmd, NULL)) {
		pr_err("dsp load failed");
		ret = -1;
		goto leave;
	}

	if (!dsp_start(dsp_handle, proc)) {
		pr_err("dsp start failed");
		ret = -1;
	}

leave:
	if (proc) {
		if (!dsp_detach(dsp_handle, proc)) {
			pr_err("dsp detach failed");
			ret = -1;
		}
		proc = NULL;
	}

	if (dsp_handle > 0) {
		if (dsp_close(dsp_handle) < 0) {
			pr_err("dsp close failed");
			return -1;
		}
	}

	return ret;
}
static int audiodsp_ioctl(struct inode *node, struct file *file, unsigned int cmd,
		      unsigned long args)
{
	struct audiodsp_priv *priv=audiodsp_privdata();
	struct audiodsp_cmd *a_cmd;
	char name[64];
	int len;
	unsigned long pts;
	int ret=0;
	unsigned long *val=(unsigned long *)args;
#ifdef ENABLE_WAIT_FORMAT
	static int wait_format_times=0;
#endif	
	switch(cmd)
		{
		case AUDIODSP_SET_FMT:
			priv->stream_fmt=args;
            if(args == MCODEC_FMT_DTS)
              	IEC958_mode_codec = 1;
            else if(args == MCODEC_FMT_AC3)
            	IEC958_mode_codec = 2; 	
            else
            	IEC958_mode_codec = 0;
			break;
		case AUDIODSP_START:
			if(IEC958_mode_raw_last != IEC958_mode_raw || IEC958_mode_codec_last !=  IEC958_mode_codec)
			{
				IEC958_mode_raw_last = IEC958_mode_raw;
				IEC958_mode_codec_last = IEC958_mode_codec;
				aml_alsa_hw_reprepare();
			}	
			priv->decoded_nb_frames = 0;
			priv->format_wait_count = 0;
			if(priv->stream_fmt<=0)
				{
				DSP_PRNT("Audio dsp steam format have not set!\n");
				}
			else
				{
				ret=audiodsp_start();
				}
			break;
		case AUDIODSP_STOP:
			//DSP_PRNT("audiodsp command stop\n");
			stop_audiodsp_monitor(priv);
			dsp_stop(priv);
			priv->decoded_nb_frames = 0;
			priv->format_wait_count = 0;
			break;
#ifdef ENABLE_WAIT_FORMAT
		case AUDIODSP_DECODE_START:			
			if(priv->dsp_is_started)
				{
				dsp_codec_start(priv);
				wait_format_times=0;
				}
			else
				{
				DSP_PRNT("Audio dsp have not started\n");
				}			
			break;
		case AUDIODSP_WAIT_FORMAT:
			if(priv->dsp_is_started)
				{
				struct audio_info *audio_format;
				int ch = 0;
				audio_format = get_audio_info();
				
				wait_format_times++;
				
				if(wait_format_times>100){
					int audio_info = DSP_RD(DSP_AUDIO_FORMAT_INFO);
					if(audio_info){
						priv->frame_format.channel_num = audio_info&0xf;
						if(priv->frame_format.channel_num)
							priv->frame_format.valid |= CHANNEL_VALID;
						priv->frame_format.data_width= (audio_info>>4)&0x3f;
						if(priv->frame_format.data_width)
							priv->frame_format.valid |= DATA_WIDTH_VALID;
						priv->frame_format.sample_rate = (audio_info>>10);
						if(priv->frame_format.sample_rate)
							priv->frame_format.valid |= SAMPLE_RATE_VALID;
						DSP_PRNT("warning::got info from mailbox failed,read from regiser\n");
						ret = 0;
					}else{
						DSP_PRNT("dsp have not set the codec stream's format details,valid=%x\n",
						priv->frame_format.valid);		
						priv->format_wait_count++;
						if(priv->format_wait_count > 5){						
							if(audio_format->channels&&audio_format->sample_rate){
								priv->frame_format.channel_num = audio_format->channels>2?2:audio_format->channels;
								priv->frame_format.sample_rate = audio_format->sample_rate;
								priv->frame_format.data_width = 16;
								priv->frame_format.valid = CHANNEL_VALID|DATA_WIDTH_VALID|SAMPLE_RATE_VALID;
								DSP_PRNT("we have not got format details from dsp,so use the info got from the header parsed instead\n");
								ret = 0;
							}else{
								ret = -1;
							}
						}else{
							ret=-1;
						}
					}
				}else if(priv->frame_format.valid == (CHANNEL_VALID|DATA_WIDTH_VALID|SAMPLE_RATE_VALID)){