示例#1
0
int test5()
{
	/* Blackfin GCC after version 2006R2 supports L1 allocation */
	short *x = (short *) sram_alloc(N * 2, L1_DATA_B_SRAM);
	short *y = (short *) sram_alloc(N * 2, L1_DATA_A_SRAM);

	int i, k, ret;
	unsigned int time[M];

	for (i = 0; i < N; i++) {
		x[i] = 1;
		y[i] = 1;
	}

	for (k = 0; k < M; k++) {
		ret = dot_asm_cycles(x, y, N);
		time[k] = after - before;
	}

	printf("Test 5: data in internal memory, inboard cycles\n");
	printf("  ret = %d: run time:\n  ", ret);
	for (k = 0; k < M; k++)
		printf("%u ", time[k]);
	printf("\n");

	sram_free(x);
	sram_free(y);
	
	return ret;
}
示例#2
0
static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
		struct snd_pcm_hardware *ppcm)
{
	struct snd_dma_buffer *buf = &substream->dma_buffer;
	struct snd_dma_buffer *iram_dma = NULL;
	dma_addr_t iram_phys = 0;
	void *iram_virt = NULL;

	if (buf->private_data || !size)
		return 0;

	ppcm->period_bytes_max = size;
	iram_virt = sram_alloc(size, &iram_phys);
	if (!iram_virt)
		goto exit1;
	iram_dma = kzalloc(sizeof(*iram_dma), GFP_KERNEL);
	if (!iram_dma)
		goto exit2;
	iram_dma->area = iram_virt;
	iram_dma->addr = iram_phys;
	memset(iram_dma->area, 0, size);
	iram_dma->bytes = size;
	buf->private_data = iram_dma;
	return 0;
exit2:
	if (iram_virt)
		sram_free(iram_virt, size);
exit1:
	return -ENOMEM;
}
示例#3
0
static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
		struct snd_pcm_hardware *ppcm)
{
	struct snd_dma_buffer *buf = &substream->dma_buffer;
#if !defined(CONFIG_ARCH_TI81XX)	/* No SRAM support on TI81xx */
	struct snd_dma_buffer *iram_dma = NULL;
	dma_addr_t iram_phys = 0;
	void *iram_virt = NULL;
#endif
	if (buf->private_data || !size)
		return 0;

#if !defined(CONFIG_ARCH_TI81XX)	/* No SRAM support on TI81xx */
	ppcm->period_bytes_max = size;
	iram_virt = sram_alloc(size, &iram_phys);
	if (!iram_virt)
		goto exit1;
	iram_dma = kzalloc(sizeof(*iram_dma), GFP_KERNEL);
	if (!iram_dma)
		goto exit2;
	iram_dma->area = iram_virt;
	iram_dma->addr = iram_phys;
	memset(iram_dma->area, 0, size);
	iram_dma->bytes = size;
	buf->private_data = iram_dma;
	return 0;
exit2:
	if (iram_virt)
		sram_free(iram_virt, size);
exit1:
	return -ENOMEM;
#else
	return 0;
#endif
}
示例#4
0
文件: pm.c 项目: 0-T-0/ps4-linux
static int __init davinci_pm_probe(struct platform_device *pdev)
{
	pdata = pdev->dev.platform_data;
	if (!pdata) {
		dev_err(&pdev->dev, "cannot get platform data\n");
		return -ENOENT;
	}

	davinci_sram_suspend = sram_alloc(davinci_cpu_suspend_sz, NULL);
	if (!davinci_sram_suspend) {
		dev_err(&pdev->dev, "cannot allocate SRAM memory\n");
		return -ENOMEM;
	}

	davinci_sram_push(davinci_sram_suspend, davinci_cpu_suspend,
						davinci_cpu_suspend_sz);

	suspend_set_ops(&davinci_pm_ops);

	return 0;
}