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; }
static void davinci_pcm_free(struct snd_pcm *pcm) { struct snd_pcm_substream *substream; struct snd_dma_buffer *buf; int stream; for (stream = 0; stream < 2; stream++) { struct snd_dma_buffer *iram_dma; substream = pcm->streams[stream].substream; if (!substream) continue; buf = &substream->dma_buffer; if (!buf->area) continue; dma_free_writecombine(pcm->card->dev, buf->bytes, buf->area, buf->addr); buf->area = NULL; iram_dma = buf->private_data; if (iram_dma) { sram_free(iram_dma->area, iram_dma->bytes); kfree(iram_dma); } } }
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; }
static void davinci_pcm_free(struct snd_pcm *pcm) { struct snd_pcm_substream *substream; struct snd_dma_buffer *buf; int stream; for (stream = 0; stream < 2; stream++) { struct snd_dma_buffer *iram_dma; substream = pcm->streams[stream].substream; if (!substream) continue; buf = &substream->dma_buffer; if (!buf->area) continue; dma_free_writecombine(pcm->card->dev, buf->bytes, buf->area, buf->addr); buf->area = NULL; iram_dma = buf->private_data; if (iram_dma) { #if !defined(CONFIG_ARCH_TI81XX) /* No SRAM support on TI81xx */ sram_free(iram_dma->area, iram_dma->bytes); kfree(iram_dma); #endif } } }
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 }
static int __exit davinci_pm_remove(struct platform_device *pdev) { sram_free(davinci_sram_suspend, davinci_cpu_suspend_sz); return 0; }