コード例 #1
0
ファイル: mb86r0xgdc.c プロジェクト: mike0/uboot-imx
void *video_hw_init(void)
{
	struct mb86r0x_gdc *gdc = (struct mb86r0x_gdc *) MB86R0x_GDC_BASE;
	GraphicDevice *pGD = &mb86r0x;
	char *s;
	u32 *vid;

	memset(pGD, 0, sizeof(GraphicDevice));

	pGD->gdfIndex = GDF_15BIT_555RGB;
	pGD->gdfBytesPP = 2;
	pGD->memSize = VIDEO_MEM_SIZE;
	pGD->frameAdrs = PHYS_SDRAM + PHYS_SDRAM_SIZE - VIDEO_MEM_SIZE;

	vid = (u32 *)pGD->frameAdrs;

	s = getenv("videomode");
	if (s != NULL)
		dsp_init(&gdc->dsp0, s, vid);

	s = getenv("videomode1");
	if (s != NULL)
		dsp_init(&gdc->dsp1, s, vid);

	return pGD;
}
コード例 #2
0
int YARPMEIDeviceDriver::open(void *d)
{
	// temporarily removed
	int16 rc = 0;

	MEIOpenParameters *p = (MEIOpenParameters *)d;

	_njoints = p->nj;

	rc = dsp_init(p->meiPortAddr);	// init
	rc = dsp_reset();				// reset

	_ref_speeds = new double [_njoints];
	ACE_ASSERT (_ref_speeds != NULL);
	_ref_accs = new double [_njoints];
	ACE_ASSERT (_ref_accs != NULL);
	_ref_positions = new double [_njoints];
	ACE_ASSERT (_ref_positions != NULL);
	_all_axes = new int16[_njoints];
	ACE_ASSERT (_all_axes != NULL);

	int i;
	for(i = 0; i < _njoints; i++)
		_all_axes[i] = i;

	_filter_coeffs = new int16* [_njoints];
	ACE_ASSERT (_filter_coeffs != NULL);
	for(i = 0; i < _njoints; i++)
	{
		_filter_coeffs[i] = new int16 [COEFFICIENTS];
		ACE_ASSERT (_filter_coeffs[i] != NULL);
	}

	_dsp_rate = dsp_sample_rate();
	
	_winding = new int16[_njoints];
	ACE_ASSERT (_winding != NULL);
	memset (_winding, 0, sizeof(int16) * _njoints);

	_16bit_oldpos = new double[_njoints];
	ACE_ASSERT (_16bit_oldpos != NULL);
	memset (_16bit_oldpos, 0, sizeof(double) * _njoints);

	_position_zero = new double[_njoints];
	ACE_ASSERT (_position_zero != NULL);
	memset (_position_zero, 0, sizeof(double) * _njoints);

	int mask = p->ioPorts;
	for (i = 0; i < MAX_PORTS; i++)
	{
		if (mask & 0x1)
			init_io (i, IO_OUTPUT);
		else
			init_io (i, IO_INPUT);

		mask >>= 1;
	}

	return rc;
}
コード例 #3
0
void machine_init(struct fnode * dev)
{
#       if CONFIG_SYS_CLOCK == 48000000
        rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_48MHZ]);
#       elif CONFIG_SYS_CLOCK == 84000000
        rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_84MHZ]);
#       elif CONFIG_SYS_CLOCK == 120000000
        rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_120MHZ]);
#       elif CONFIG_SYS_CLOCK == 168000000
        rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_168MHZ]);
#       elif CONFIG_SYS_CLOCK == 180000000
        rcc_clock_setup_hse_3v3(&rcc_hse_8mhz_3v3[RCC_CLOCK_3V3_180MHZ]);
#       else
#error No valid clock speed selected
#endif

    gpio_init(dev, gpio_addrs, NUM_GPIOS);
#ifdef CONFIG_DEVUART
    uart_init(dev, uart_addrs, NUM_UARTS);
#endif
    rng_init(dev, rng_addrs, NUM_RNGS);
#ifdef CONFIG_DEVSTM32SDIO
    stm32_sdio_rcc_init();
    stm32_sdio_init(dev);
#endif
#ifdef CONFIG_DSP
    dsp_init(dev);
#endif

#ifdef CONFIG_DEVSTMETH
    gpio_clear(GPIOE,GPIO2);    /* Clear ETH nRESET pin */
    gpio_set(GPIOE,GPIO2);      /* Set ETH nRESET pin */
#endif
}
コード例 #4
0
ファイル: gstdspdummy.c プロジェクト: miverco/gst-dsp
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;
}
コード例 #5
0
ファイル: main.c プロジェクト: sooda/spankmoog
// Initialization of the panel and the DSP
void initialize()
{
    // Initialize panel and DSP
    panel = panel_init();
    if (!panel)
        Error("ERROR: cannot access the panel.\n");

    dsp = dsp_init(1, dspCode);
    if (!dsp)
        Error("ERROR: cannot access the DSP.\n");

    panel_out_lcd_print(panel, 0, 0, "SampleTemplate12");
}
コード例 #6
0
ファイル: esddsp.c プロジェクト: TravisKraatz/cinelerra
int
open (const char *pathname, int flags, ...)
{
  static int (*func) (const char *, int, mode_t) = NULL;
  va_list args;
  mode_t mode;

  if (!func)
    func = (int (*) (const char *, int, mode_t)) dlsym (REAL_LIBC, "open");


  dsp_init ();

  va_start (args, flags);
  mode = va_arg (args, mode_t);
  va_end (args);

  if (!strcmp (pathname, "/dev/dsp"))
    {
      if (!getenv ("ESPEAKER"))
	{
          int ret;

	  flags |= O_NONBLOCK;
	  if ((ret = (*func) (pathname, flags, mode)) >= 0)
	    return ret;
	}

      DPRINTF ("hijacking /dev/dsp open, and taking it to esd...\n");
      settings = done = 0;
      return (sndfd = esd_open_sound (NULL));
    }
  else if (use_mixer && !strcmp (pathname, "/dev/mixer"))
    {
      DPRINTF ("hijacking /dev/mixer open, and taking it to esd...\n");
      return (mixfd = (*func) (mixer, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR));
    }
  else
    return (*func) (pathname, flags, mode);
}
コード例 #7
0
ファイル: aacenc.c プロジェクト: Markgorden/smt
static av_cold int aac_encode_init(AVCodecContext *avctx)
{
    AACEncContext *s = avctx->priv_data;
    int i, ret = 0;
    const uint8_t *sizes[2];
    uint8_t grouping[AAC_MAX_CHANNELS];
    int lengths[2];

    s->channels = avctx->channels;
    s->chan_map = aac_chan_configs[s->channels-1];
    s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120;
    s->last_frame_pb_count = 0;
    avctx->extradata_size = 5;
    avctx->frame_size = 1024;
    avctx->initial_padding = 1024;
    avctx->bit_rate = (int)FFMIN(
        6144 * s->channels / 1024.0 * avctx->sample_rate,
        avctx->bit_rate);
    avctx->profile = avctx->profile == FF_PROFILE_UNKNOWN ? FF_PROFILE_AAC_LOW :
                     avctx->profile;

    for (i = 0; i < 16; i++)
        if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i])
            break;
    s->samplerate_index = i;

    ERROR_IF(s->samplerate_index == 16 ||
             s->samplerate_index >= ff_aac_swb_size_1024_len ||
             s->samplerate_index >= ff_aac_swb_size_128_len,
             "Unsupported sample rate %d\n", avctx->sample_rate);
    ERROR_IF(s->channels > AAC_MAX_CHANNELS || s->channels == 7,
             "Unsupported number of channels: %d\n", s->channels);
    WARN_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels,
             "Too many bits %f > %d per frame requested, clamping to max\n",
             1024.0 * avctx->bit_rate / avctx->sample_rate,
             6144 * s->channels);

    for (i = 0; i < FF_ARRAY_ELEMS(aacenc_profiles); i++)
        if (avctx->profile == aacenc_profiles[i])
            break;
    ERROR_IF(i == FF_ARRAY_ELEMS(aacenc_profiles),
             "Unsupported encoding profile: %d\n", avctx->profile);
    if (avctx->profile == FF_PROFILE_MPEG2_AAC_LOW) {
        avctx->profile = FF_PROFILE_AAC_LOW;
        ERROR_IF(s->options.pred,
                 "Main prediction unavailable in the \"mpeg2_aac_low\" profile\n");
        ERROR_IF(s->options.ltp,
                 "LTP prediction unavailable in the \"mpeg2_aac_low\" profile\n");
        WARN_IF(s->options.pns,
                "PNS unavailable in the \"mpeg2_aac_low\" profile, turning off\n");
        s->options.pns = 0;
    } else if (avctx->profile == FF_PROFILE_AAC_LTP) {
        s->options.ltp = 1;
        ERROR_IF(s->options.pred,
                 "Main prediction unavailable in the \"aac_ltp\" profile\n");
    } else if (avctx->profile == FF_PROFILE_AAC_MAIN) {
        s->options.pred = 1;
        ERROR_IF(s->options.ltp,
                 "LTP prediction unavailable in the \"aac_main\" profile\n");
    } else if (s->options.ltp) {
        avctx->profile = FF_PROFILE_AAC_LTP;
        WARN_IF(1,
                "Chainging profile to \"aac_ltp\"\n");
        ERROR_IF(s->options.pred,
                 "Main prediction unavailable in the \"aac_ltp\" profile\n");
    } else if (s->options.pred) {
        avctx->profile = FF_PROFILE_AAC_MAIN;
        WARN_IF(1,
                "Chainging profile to \"aac_main\"\n");
        ERROR_IF(s->options.ltp,
                 "LTP prediction unavailable in the \"aac_main\" profile\n");
    }
    s->profile = avctx->profile;
    s->coder = &ff_aac_coders[s->options.coder];

    if (s->options.coder != AAC_CODER_TWOLOOP) {
        ERROR_IF(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL,
                 "Coders other than twoloop require -strict -2 and some may be removed in the future\n");
        WARN_IF(s->options.coder == AAC_CODER_FAAC,
                "The FAAC-like coder will be removed in the near future, please use twoloop!\n");
        s->options.intensity_stereo = 0;
        s->options.pns = 0;
    }

    if ((ret = dsp_init(avctx, s)) < 0)
        goto fail;

    if ((ret = alloc_buffers(avctx, s)) < 0)
        goto fail;

    put_audio_specific_config(avctx);

    sizes[0]   = ff_aac_swb_size_1024[s->samplerate_index];
    sizes[1]   = ff_aac_swb_size_128[s->samplerate_index];
    lengths[0] = ff_aac_num_swb_1024[s->samplerate_index];
    lengths[1] = ff_aac_num_swb_128[s->samplerate_index];
    for (i = 0; i < s->chan_map[0]; i++)
        grouping[i] = s->chan_map[i + 1] == TYPE_CPE;
    if ((ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths,
                           s->chan_map[0], grouping)) < 0)
        goto fail;
    s->psypp = ff_psy_preprocess_init(avctx);
    ff_lpc_init(&s->lpc, 2*avctx->frame_size, TNS_MAX_ORDER, FF_LPC_TYPE_LEVINSON);
    av_lfg_init(&s->lfg, 0x72adca55);

    if (HAVE_MIPSDSP)
        ff_aac_coder_init_mips(s);

    if ((ret = ff_thread_once(&aac_table_init, &aac_encode_init_tables)) != 0)
        return AVERROR_UNKNOWN;

    ff_af_queue_init(avctx, &s->afq);

    return 0;
fail:
    aac_encode_end(avctx);
    return ret;
}
コード例 #8
0
ファイル: dspdrv.c プロジェクト: earthGavinLee/hg556a_source
/***************************************************************************
 * Function Name: init_module
 * Description  : Initial function that is called if this driver is compiled
 *                as a module.  If it is not, endpoint_init is called in
 *                chr_dev_init() in drivers/char/mem.c.
 * Returns      : None.
 ***************************************************************************/
int init_module(void)
{
    return( dsp_init() );
}
コード例 #9
0
ファイル: aacenc.c プロジェクト: 0xFFeng/ffmpeg
static av_cold int aac_encode_init(AVCodecContext *avctx)
{
    AACEncContext *s = avctx->priv_data;
    int i, ret = 0;
    const uint8_t *sizes[2];
    uint8_t grouping[AAC_MAX_CHANNELS];
    int lengths[2];

    avctx->frame_size = 1024;

    for (i = 0; i < 16; i++)
        if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i])
            break;

    s->channels = avctx->channels;

    ERROR_IF(i == 16,
             "Unsupported sample rate %d\n", avctx->sample_rate);
    ERROR_IF(s->channels > AAC_MAX_CHANNELS,
             "Unsupported number of channels: %d\n", s->channels);
    ERROR_IF(avctx->profile != FF_PROFILE_UNKNOWN && avctx->profile != FF_PROFILE_AAC_LOW,
             "Unsupported profile %d\n", avctx->profile);
    ERROR_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels,
             "Too many bits per frame requested\n");

    s->samplerate_index = i;

    s->chan_map = aac_chan_configs[s->channels-1];

    if (ret = dsp_init(avctx, s))
        goto fail;

    if (ret = alloc_buffers(avctx, s))
        goto fail;

    avctx->extradata_size = 5;
    put_audio_specific_config(avctx);

    sizes[0]   = swb_size_1024[i];
    sizes[1]   = swb_size_128[i];
    lengths[0] = ff_aac_num_swb_1024[i];
    lengths[1] = ff_aac_num_swb_128[i];
    for (i = 0; i < s->chan_map[0]; i++)
        grouping[i] = s->chan_map[i + 1] == TYPE_CPE;
    if (ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths, s->chan_map[0], grouping))
        goto fail;
    s->psypp = ff_psy_preprocess_init(avctx);
    s->coder = &ff_aac_coders[s->options.aac_coder];

    if (HAVE_MIPSDSPR1)
        ff_aac_coder_init_mips(s);

    s->lambda = avctx->global_quality ? avctx->global_quality : 120;

    ff_aac_tableinit();

    for (i = 0; i < 428; i++)
        ff_aac_pow34sf_tab[i] = sqrt(ff_aac_pow2sf_tab[i] * sqrt(ff_aac_pow2sf_tab[i]));

    avctx->delay = 1024;
    ff_af_queue_init(avctx, &s->afq);

    return 0;
fail:
    aac_encode_end(avctx);
    return ret;
}
コード例 #10
0
static int omap3_bridge_startup(struct platform_device *pdev)
{
	struct omap_dsp_platform_data *pdata = pdev->dev.platform_data;
	struct drv_data *drv_datap = NULL;
	u32 phys_membase, phys_memsize;
	int err;

#ifdef CONFIG_TIDSPBRIDGE_RECOVERY
	bridge_rec_queue = create_workqueue("bridge_rec_queue");
	INIT_WORK(&bridge_recovery_work, bridge_recover);
	INIT_COMPLETION(bridge_comp);
#endif

#ifdef CONFIG_PM
	
	bridge_suspend_data.suspended = 0;
	init_waitqueue_head(&bridge_suspend_data.suspend_wq);

#ifdef CONFIG_TIDSPBRIDGE_DVFS
	for (i = 0; i < 6; i++)
		pdata->mpu_speed[i] = vdd1_rate_table_bridge[i].rate;

	err = cpufreq_register_notifier(&iva_clk_notifier,
					CPUFREQ_TRANSITION_NOTIFIER);
	if (err)
		pr_err("%s: clk_notifier_register failed for iva2_ck\n",
								__func__);
#endif
#endif

	dsp_clk_init();

	drv_datap = kzalloc(sizeof(struct drv_data), GFP_KERNEL);
	if (!drv_datap) {
		err = -ENOMEM;
		goto err1;
	}

	drv_datap->shm_size = shm_size;
	drv_datap->tc_wordswapon = tc_wordswapon;

	if (base_img) {
		drv_datap->base_img = kmalloc(strlen(base_img) + 1, GFP_KERNEL);
		if (!drv_datap->base_img) {
			err = -ENOMEM;
			goto err2;
		}
		strncpy(drv_datap->base_img, base_img, strlen(base_img) + 1);
	}

	dev_set_drvdata(bridge, drv_datap);

	if (shm_size < 0x10000) {	
		err = -EINVAL;
		pr_err("%s: shm size must be at least 64 KB\n", __func__);
		goto err3;
	}
	dev_dbg(bridge, "%s: requested shm_size = 0x%x\n", __func__, shm_size);

	phys_membase = pdata->phys_mempool_base;
	phys_memsize = pdata->phys_mempool_size;
	if (phys_membase > 0 && phys_memsize > 0)
		mem_ext_phys_pool_init(phys_membase, phys_memsize);

	if (tc_wordswapon)
		dev_dbg(bridge, "%s: TC Word Swap is enabled\n", __func__);

	driver_context = dsp_init(&err);
	if (err) {
		pr_err("DSP Bridge driver initialization failed\n");
		goto err4;
	}

	return 0;

err4:
	mem_ext_phys_pool_release();
err3:
	kfree(drv_datap->base_img);
err2:
	kfree(drv_datap);
err1:
#ifdef CONFIG_TIDSPBRIDGE_DVFS
	cpufreq_unregister_notifier(&iva_clk_notifier,
				    CPUFREQ_TRANSITION_NOTIFIER);
#endif
	dsp_clk_exit();

	return err;
}
コード例 #11
0
ファイル: aacenc.c プロジェクト: Hero2000/CainCamera
static av_cold int aac_encode_init(AVCodecContext *avctx)
{
    AACEncContext *s = avctx->priv_data;
    int i, ret = 0;
    const uint8_t *sizes[2];
    uint8_t grouping[AAC_MAX_CHANNELS];
    int lengths[2];

    /* Constants */
    s->last_frame_pb_count = 0;
    avctx->extradata_size = 5;
    avctx->frame_size = 1024;
    avctx->initial_padding = 1024;
    s->lambda = avctx->global_quality > 0 ? avctx->global_quality : 120;

    /* Channel map and unspecified bitrate guessing */
    s->channels = avctx->channels;
    ERROR_IF(s->channels > AAC_MAX_CHANNELS || s->channels == 7,
             "Unsupported number of channels: %d\n", s->channels);
    s->chan_map = aac_chan_configs[s->channels-1];
    if (!avctx->bit_rate) {
        for (i = 1; i <= s->chan_map[0]; i++) {
            avctx->bit_rate += s->chan_map[i] == TYPE_CPE ? 128000 : /* Pair */
                               s->chan_map[i] == TYPE_LFE ? 16000  : /* LFE  */
                                                            69000  ; /* SCE  */
        }
    }

    /* Samplerate */
    for (i = 0; i < 16; i++)
        if (avctx->sample_rate == avpriv_mpeg4audio_sample_rates[i])
            break;
    s->samplerate_index = i;
    ERROR_IF(s->samplerate_index == 16 ||
             s->samplerate_index >= ff_aac_swb_size_1024_len ||
             s->samplerate_index >= ff_aac_swb_size_128_len,
             "Unsupported sample rate %d\n", avctx->sample_rate);

    /* Bitrate limiting */
    WARN_IF(1024.0 * avctx->bit_rate / avctx->sample_rate > 6144 * s->channels,
             "Too many bits %f > %d per frame requested, clamping to max\n",
             1024.0 * avctx->bit_rate / avctx->sample_rate,
             6144 * s->channels);
    avctx->bit_rate = (int64_t)FFMIN(6144 * s->channels / 1024.0 * avctx->sample_rate,
                                     avctx->bit_rate);

    /* Profile and option setting */
    avctx->profile = avctx->profile == FF_PROFILE_UNKNOWN ? FF_PROFILE_AAC_LOW :
                     avctx->profile;
    for (i = 0; i < FF_ARRAY_ELEMS(aacenc_profiles); i++)
        if (avctx->profile == aacenc_profiles[i])
            break;
    if (avctx->profile == FF_PROFILE_MPEG2_AAC_LOW) {
        avctx->profile = FF_PROFILE_AAC_LOW;
        ERROR_IF(s->options.pred,
                 "Main prediction unavailable in the \"mpeg2_aac_low\" profile\n");
        ERROR_IF(s->options.ltp,
                 "LTP prediction unavailable in the \"mpeg2_aac_low\" profile\n");
        WARN_IF(s->options.pns,
                "PNS unavailable in the \"mpeg2_aac_low\" profile, turning off\n");
        s->options.pns = 0;
    } else if (avctx->profile == FF_PROFILE_AAC_LTP) {
        s->options.ltp = 1;
        ERROR_IF(s->options.pred,
                 "Main prediction unavailable in the \"aac_ltp\" profile\n");
    } else if (avctx->profile == FF_PROFILE_AAC_MAIN) {
        s->options.pred = 1;
        ERROR_IF(s->options.ltp,
                 "LTP prediction unavailable in the \"aac_main\" profile\n");
    } else if (s->options.ltp) {
        avctx->profile = FF_PROFILE_AAC_LTP;
        WARN_IF(1,
                "Chainging profile to \"aac_ltp\"\n");
        ERROR_IF(s->options.pred,
                 "Main prediction unavailable in the \"aac_ltp\" profile\n");
    } else if (s->options.pred) {
        avctx->profile = FF_PROFILE_AAC_MAIN;
        WARN_IF(1,
                "Chainging profile to \"aac_main\"\n");
        ERROR_IF(s->options.ltp,
                 "LTP prediction unavailable in the \"aac_main\" profile\n");
    }
    s->profile = avctx->profile;

    /* Coder limitations */
    s->coder = &ff_aac_coders[s->options.coder];
    if (s->options.coder == AAC_CODER_ANMR) {
        ERROR_IF(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL,
                 "The ANMR coder is considered experimental, add -strict -2 to enable!\n");
        s->options.intensity_stereo = 0;
        s->options.pns = 0;
    }
    ERROR_IF(s->options.ltp && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL,
             "The LPT profile requires experimental compliance, add -strict -2 to enable!\n");

    /* M/S introduces horrible artifacts with multichannel files, this is temporary */
    if (s->channels > 3)
        s->options.mid_side = 0;

    if ((ret = dsp_init(avctx, s)) < 0)
        goto fail;

    if ((ret = alloc_buffers(avctx, s)) < 0)
        goto fail;

    put_audio_specific_config(avctx);

    sizes[0]   = ff_aac_swb_size_1024[s->samplerate_index];
    sizes[1]   = ff_aac_swb_size_128[s->samplerate_index];
    lengths[0] = ff_aac_num_swb_1024[s->samplerate_index];
    lengths[1] = ff_aac_num_swb_128[s->samplerate_index];
    for (i = 0; i < s->chan_map[0]; i++)
        grouping[i] = s->chan_map[i + 1] == TYPE_CPE;
    if ((ret = ff_psy_init(&s->psy, avctx, 2, sizes, lengths,
                           s->chan_map[0], grouping)) < 0)
        goto fail;
    s->psypp = ff_psy_preprocess_init(avctx);
    ff_lpc_init(&s->lpc, 2*avctx->frame_size, TNS_MAX_ORDER, FF_LPC_TYPE_LEVINSON);
    s->random_state = 0x1f2e3d4c;

    s->abs_pow34   = abs_pow34_v;
    s->quant_bands = quantize_bands;

    if (ARCH_X86)
        ff_aac_dsp_init_x86(s);

    if (HAVE_MIPSDSP)
        ff_aac_coder_init_mips(s);

    if ((ret = ff_thread_once(&aac_table_init, &aac_encode_init_tables)) != 0)
        return AVERROR_UNKNOWN;

    ff_af_queue_init(avctx, &s->afq);

    return 0;
fail:
    aac_encode_end(avctx);
    return ret;
}
コード例 #12
0
ファイル: warble.c プロジェクト: UMadeIt/rockbox-cygwin
static void decode_file(const char *input_fn)
{
    /* Initialize DSP before any sort of interaction */
    dsp_init();

    /* Set up global settings */
    memset(&global_settings, 0, sizeof(global_settings));
    global_settings.timestretch_enabled = true;
    dsp_timestretch_enable(true);

    /* Open file */
    if (!strcmp(input_fn, "-")) {
        input_fd = STDIN_FILENO;
    } else {
        input_fd = open(input_fn, O_RDONLY);
        if (input_fd == -1) {
            perror(input_fn);
            exit(1);
        }
    }

    /* Set up ci */
    struct mp3entry id3;
    if (!get_metadata(&id3, input_fd, input_fn)) {
        fprintf(stderr, "error: metadata parsing failed\n");
        exit(1);
    }
    print_mp3entry(&id3, stderr);
    ci.filesize = filesize(input_fd);
    ci.id3 = &id3;
    if (use_dsp) {
        ci.dsp = dsp_get_config(CODEC_IDX_AUDIO);
        dsp_configure(ci.dsp, DSP_SET_OUT_FREQUENCY, DSP_OUT_DEFAULT_HZ);
        dsp_configure(ci.dsp, DSP_RESET, 0);
        dsp_dither_enable(false);
    }
    perform_config();

    /* Load codec */
    char str[MAX_PATH];
    snprintf(str, sizeof(str), CODECDIR"/%s.codec", audio_formats[id3.codectype].codec_root_fn);
    debugf("Loading %s\n", str);
    void *dlcodec = dlopen(str, RTLD_NOW);
    if (!dlcodec) {
        fprintf(stderr, "error: dlopen failed: %s\n", dlerror());
        exit(1);
    }
    struct codec_header *c_hdr = NULL;
    c_hdr = dlsym(dlcodec, "__header");
    if (c_hdr->lc_hdr.magic != CODEC_MAGIC) {
        fprintf(stderr, "error: %s invalid: incorrect magic\n", str);
        exit(1);
    }
    if (c_hdr->lc_hdr.target_id != TARGET_ID) {
        fprintf(stderr, "error: %s invalid: incorrect target id\n", str);
        exit(1);
    }
    if (c_hdr->lc_hdr.api_version != CODEC_API_VERSION) {
        fprintf(stderr, "error: %s invalid: incorrect API version\n", str);
        exit(1);
    }

    /* Run the codec */
    *c_hdr->api = &ci;
    if (c_hdr->entry_point(CODEC_LOAD) != CODEC_OK) {
        fprintf(stderr, "error: codec returned error from codec_main\n");
        exit(1);
    }
    if (c_hdr->run_proc() != CODEC_OK) {
        fprintf(stderr, "error: codec error\n");
    }
    c_hdr->entry_point(CODEC_UNLOAD);

    /* Close */
    dlclose(dlcodec);
    if (input_fd != STDIN_FILENO)
        close(input_fd);
}
コード例 #13
0
ファイル: system_msp.c プロジェクト: ivanovev/stm32f4
void myinit(void)
{
#pragma message "myinit()"
#pragma message "HAL_Init()"
#pragma message "SystemClock_Config()"
    HAL_Init();
    SystemClock_Config();

#ifdef ENABLE_GPIO
#pragma message "led_init()"
    led_init();
#ifdef btn_init
#pragma message "btn_init()"
    btn_init();
#endif
#endif

#ifdef ENABLE_RNG
#pragma message "rng_init()"
    rng_init();
#endif

#ifdef ENABLE_UART
#pragma message "uart_init()"
    uart_init();
#endif

#ifdef ENABLE_I2C
#pragma message "i2c_init()"
    i2c_init();
#endif

#ifdef ENABLE_SPI
#pragma message "spi_init()"
    spi_init();
#endif

#ifdef ENABLE_TIM
#pragma message "tim_init()"
    tim_init();
#endif

#ifdef ENABLE_ADC
#pragma message "adc_init()"
    adc_init();
#endif

#ifdef ENABLE_CAN
#pragma message "can_init()"
    can_init();
#endif

#ifdef ENABLE_DAC
#pragma message "dac_init()"
    dac_init();
#endif

#ifdef ENABLE_DMA
#pragma message "dma_init()"
    dma_init();
#endif

#ifdef ENABLE_FLASH
#pragma message "flash_erase_img1()"
    flash_erase_img1();
#endif

#ifdef ENABLE_ETH
#pragma message "eth_init()"
    eth_init();
#endif

#ifdef ENABLE_DSP
#pragma message "dsp_init()"
    dsp_init();
#endif

#ifdef ENABLE_USB
#pragma message "usb_init()"
    usb_init();
#endif

#ifdef ENABLE_PCL
#pragma message "pcl_init()"
    pcl_init();
#endif

#ifdef ENABLE_SDIO
#pragma message "sdio_init()"
    sdio_init();
#endif

#ifdef ENABLE_DISPLAY
#pragma message "display_init()"
    display_init();
#endif

#ifdef ENABLE_BR
#pragma message "br_init()"
    br_init();
#endif
}
コード例 #14
0
ファイル: dac3550drv.c プロジェクト: rgmabs19357/gameseer
//STATUS dac3550DevCreate (char *devName, int port, int irq)
DEV_HDR* dac3550DevCreate (char *devName, int port, int irq)
{
  SND_DEV *pDev;

  if (DrvNum < 1)
  {
    errno = S_ioLib_NO_DRIVER;
    return ERROR;
  }
  if(dac3550Dev) 
  	return &(dac3550Dev->devHdr);
  pDev = (SND_DEV *)malloc (sizeof(SND_DEV));
  if (!pDev) return 0;

  bzero ((char *)pDev, sizeof(SND_DEV));
  if(port==0) port = (int)AT91C_BASE_SSC1;
  if(irq==0) irq = AT91C_ID_SSC1;
  pDev->port   = port;
  pDev->irq    = irq;
/*  pDev->dma8   = dma8;
  pDev->dma16  = dma16;
*/
  pDev->devSem = semBCreate (SEM_Q_FIFO, SEM_FULL);
  pDev->intSem = semCCreate (SEM_Q_FIFO, 0);
  pDev->bufSem = semCCreate (SEM_Q_FIFO, MAX_DMA_MSGS);
  pDev->dmaQ   = msgQCreate (MAX_DMA_MSGS, sizeof (DMA_MSG), MSG_Q_FIFO);

  pDev->dmaIndex = 0;

  if (createDmaBuffer () < 0)
  {
    free (pDev);
    return 0;
  }

  if (dsp_init (pDev) < 0)
  {
    free (pDev);
    return 0;
  }



  if (iosDevAdd (&pDev->devHdr, devName, DrvNum) == ERROR)
  {
    free ((char *)pDev);
    return 0;
  }
/*
  pDev->tid = taskSpawn ("tSndTask", TASK_PRIORITY, TASK_OPTIONS,
			 TASK_STACK_SIZE, dspHelperTask, (int)pDev,
			 0, 0, 0, 0, 0, 0, 0, 0, 0);

  if (pDev->tid == ERROR)
  {
    free (pDev);
    return ERROR;
  }
*/
  intConnect (INUM_TO_IVEC (	(irq)), dspInterrupt, (int)pDev);
  dac3550Dev = pDev;
  return &(pDev->devHdr);
}
コード例 #15
0
ファイル: micro_mode.c プロジェクト: fgerneth/Treibertest
/*!
 * This function is used to initialize any module/dsp
 * module specific structures or tables etc.
 *
 * @param context SS level igd_context.
 *
 * @return 0 on success.
 * @return -IGD_INVAL or -IGD_ERROR_NODEV on failure
 */
int mode_init(igd_context_t *context)
{
	igd_dispatch_t     *dispatch = &context->dispatch;
	inter_module_dispatch_t *md;

	EMGD_TRACE_ENTER;

	EMGD_DEBUG("Allocating a mode context...");

	/* Clear the allocated memory for mode context */
	OS_MEMSET((void *)mode_context, 0, sizeof(mode_context_t));

	/* Set the pointer to igd level context */
	mode_context->context = context;
	mode_context->first_alter = TRUE;
	mode_context->display_color =
		context->mod_dispatch.init_params->display_color;
	mode_context->ref_freq =
		context->mod_dispatch.init_params->ref_freq;
	mode_context->tuning_wa =
		context->mod_dispatch.init_params->tuning_wa;

	/* Get mode's dispatch table */
	mode_context->dispatch = (mode_dispatch_t *)
		dispatch_acquire(context, mode_dispatch);
	if(!mode_context->dispatch) {
		EMGD_ERROR_EXIT("Unsupported Device");
		return -IGD_ERROR_NODEV;
	}

	md = &context->mod_dispatch;

	/* Set the fw_info to 0 */
	mode_context->fw_info = NULL;

	/* Hook up the IGD dispatch table entires for mode */
	dispatch->get_EDID_block = igd_get_EDID_block;
	dispatch->power_display = igd_power_display;
	dispatch->query_mode_list = igd_query_mode_list;
	dispatch->alter_displays = igd_alter_displays;

	OPT_MICRO_CALL(full_mode_init(context, mode_context));

	/* Hook up inter-module dispatch functions */
	md->mode_get_gpio_sets = mode_context->dispatch->get_gpio_sets;
	md->mode_reset_plane_pipe_ports =
		mode_context->dispatch->reset_plane_pipe_ports;
	md->filter_modes = mode_context->dispatch->filter_modes;

	/* Hook up Core specific IGD dispatch table entries */
	dispatch->set_palette_entries =
		mode_context->dispatch->full->set_palette_entries;
	dispatch->set_palette_entry = mode_context->dispatch->set_palette_entry;
	dispatch->get_palette_entry = mode_context->dispatch->get_palette_entry;
	dispatch->wait_vblank = mode_context->dispatch->wait_vblank;

	/* Initialize dsp module */
	if (dsp_init(context)) {
		EMGD_ERROR("dsp_init() failed.");
		return -IGD_INVAL;
	}

	/* Initialze port interface (pi) module */
	if (pi_init(context)) {
		EMGD_ERROR_EXIT("pi_init() failed.");
		if(md->dsp_shutdown) {
			md->dsp_shutdown(context);
		}
		return -IGD_ERROR_INVAL;
	}

	if (mode_context->dispatch->full && md->reg_get_mod_state) {
		/* Save mode state */
		module_state_h *state = NULL;
		unsigned long *flags = NULL;
		md->reg_get_mod_state(REG_MODE_STATE, &state, &flags);
		md->mode_save(context, state, flags);
	}

	/* Initialize the Display Configuration List */
	/* FIXME: This should be done in dsp init */
	dsp_dc_init(context);

	EMGD_TRACE_EXIT;
	return 0;
}