• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ dma_alloc_writecombine函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中dma_alloc_writecombine函数的典型用法代码示例。如果您正苦于以下问题:C++ dma_alloc_writecombine函数的具体用法?C++ dma_alloc_writecombine怎么用?C++ dma_alloc_writecombine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了dma_alloc_writecombine函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: rockchip_pcm_preallocate_dma_buffer

static int rockchip_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
{
	struct snd_pcm_substream *substream = pcm->streams[stream].substream;
	struct snd_dma_buffer *buf = &substream->dma_buffer;
	size_t size = rockchip_pcm_hardware.buffer_bytes_max;

	DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);

	buf->dev.type = SNDRV_DMA_TYPE_DEV;
	buf->dev.dev = pcm->card->dev;
	buf->private_data = NULL;
#ifdef CONFIG_RK_SRAM_DMA
	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
		buf->area = SRAM_DMA_START_PLAYBACK;
		buf->addr = SRAM_DMA_PHYS_PLAYBACK;
	} else{
		buf->area = SRAM_DMA_START_CAPTURE;
		buf->addr = SRAM_DMA_PHYS_CAPTURE;		
	}
#else
	buf->area = dma_alloc_writecombine(pcm->card->dev, size,
					   &buf->addr, GFP_KERNEL);
#endif
	if (!buf->area)
		return -ENOMEM;
	buf->bytes = size;
	DBG("%s: size %d\n",__FUNCTION__, size);
	return 0;
}
开发者ID:Dee-UK,项目名称:RK3188_KK_4.4.02_Beta,代码行数:29,代码来源:rk29_pcm.c


示例2: abe_open_data

static int abe_open_data(struct inode *inode, struct file *file)
{
    struct omap_abe *abe = inode->i_private;

    /* adjust debug word size based on any user params */
    if (abe->debugfs.format1)
        abe->debugfs.elem_bytes += OMAP_ABE_DBG_FLAG1_SIZE;
    if (abe->debugfs.format2)
        abe->debugfs.elem_bytes += OMAP_ABE_DBG_FLAG2_SIZE;
    if (abe->debugfs.format3)
        abe->debugfs.elem_bytes += OMAP_ABE_DBG_FLAG3_SIZE;

    abe->debugfs.buffer_bytes = abe->debugfs.elem_bytes * 4 *
                                abe->debugfs.buffer_msecs;

    abe->debugfs.buffer = dma_alloc_writecombine(abe->dev,
                          abe->debugfs.buffer_bytes, &abe->debugfs.buffer_addr, GFP_KERNEL);
    if (abe->debugfs.buffer == NULL) {
        dev_err(abe->dev, "can't alloc %d bytes for trace DMA buffer\n",
                abe->debugfs.buffer_bytes);
        return -ENOMEM;
    }

    file->private_data = inode->i_private;
    abe->debugfs.complete = 0;
    abe_dbg_start_dma(abe, abe->debugfs.circular);

    return 0;
}
开发者ID:koh523,项目名称:kernel-pandaboard-ES-RevB3,代码行数:29,代码来源:omap-abe-dbg.c


示例3: lpc32xx_clcd_setup

static int lpc32xx_clcd_setup(struct clcd_fb *fb)
{
	dma_addr_t dma;

	fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev,
		PANEL_SIZE, &dma, GFP_KERNEL);
	if (!fb->fb.screen_base) {
		printk(KERN_ERR "CLCD: unable to map framebuffer\n");
		return -ENOMEM;
	}

	fb->fb.fix.smem_start = dma;
	fb->fb.fix.smem_len = PANEL_SIZE;
	fb->panel = &conn_lcd_panel;

	if (gpio_request(LCD_POWER_GPIO, "LCD power"))
		printk(KERN_ERR "Error requesting gpio %u",
			LCD_POWER_GPIO);
	else if (gpio_direction_output(LCD_POWER_GPIO, 1))
		printk(KERN_ERR "Error setting gpio %u to output",
			LCD_POWER_GPIO);

	if (gpio_request(BKL_POWER_GPIO, "LCD backlight power"))
		printk(KERN_ERR "Error requesting gpio %u",
			BKL_POWER_GPIO);
	else if (gpio_direction_output(BKL_POWER_GPIO, 1))
		printk(KERN_ERR "Error setting gpio %u to output",
			BKL_POWER_GPIO);

	return 0;
}
开发者ID:03199618,项目名称:linux,代码行数:31,代码来源:phy3250.c


示例4: videoin_dmamalloc_phy

unsigned long videoin_dmamalloc_phy(unsigned int u32Buf, unsigned long size)
{
	videoin_priv_t *priv = (videoin_priv_t *)&videoin_priv;
	void *mem;
	unsigned long adr;

	DBG_PRINTF("%s\n",__FUNCTION__);	
	size = PAGE_ALIGN(size);	
	priv->vaddr = dma_alloc_writecombine(NULL/*dev*/, 
									size,&priv->paddr, 
									GFP_KERNEL);	
	printk("videoin priv->paddr=%x,priv->vaddr=%x\n", priv->paddr, priv->vaddr);
	if (!priv->vaddr)
		return NULL;

	adr = (unsigned long) priv->vaddr;
	videoIn_buf[u32Buf].u32PhysAddr = priv->paddr;
	if(u32Buf<3)
		videoIn_buf[u32Buf+5].u32PhysAddr;
	videoIn_buf[u32Buf].u32VirtAddr = adr;
	while (size > 0) {
		SetPageReserved(vmalloc_to_page((void *)adr));		
		adr += PAGE_SIZE;
		size -= PAGE_SIZE;		
	}
	DBG_PRINTF("SetPageReserved = 0x%x\n", adr);
	return priv->paddr;
}
开发者ID:me-oss,项目名称:me-linux,代码行数:28,代码来源:videoin.c


示例5: mxc_elcdif_fb_map_video_memory

/*!
 * Allocates the DRAM memory for the frame buffer.      This buffer is remapped
 * into a non-cached, non-buffered, memory region to allow palette and pixel
 * writes to occur without flushing the cache.  Once this area is remapped,
 * all virtual memory access to the video memory should occur at the new region.
 *
 * @param       fbi     framebuffer information pointer
 *
 * @return      Error code indicating success or failure
 */
static int mxc_elcdif_fb_map_video_memory(struct fb_info *fbi)
{
	if (fbi->fix.smem_len < fbi->var.yres_virtual * fbi->fix.line_length)
		fbi->fix.smem_len = fbi->var.yres_virtual *
				    fbi->fix.line_length;

	fbi->screen_base = dma_alloc_writecombine(fbi->device,
				fbi->fix.smem_len,
				(dma_addr_t *)&fbi->fix.smem_start,
				GFP_DMA);
	if (fbi->screen_base == 0) {
		dev_err(fbi->device, "Unable to allocate framebuffer memory\n");
		fbi->fix.smem_len = 0;
		fbi->fix.smem_start = 0;
		return -EBUSY;
	}

	dev_dbg(fbi->device, "allocated fb @ paddr=0x%08X, size=%d.\n",
		(uint32_t) fbi->fix.smem_start, fbi->fix.smem_len);

	fbi->screen_size = fbi->fix.smem_len;

	/* Clear the screen */
	memset((char *)fbi->screen_base, 0, fbi->fix.smem_len);

	return 0;
}
开发者ID:AvalueAES,项目名称:rev-sa01,代码行数:37,代码来源:mxc_elcdif_fb.c


示例6: dma_alloc_descriptor_ring

int dma_alloc_descriptor_ring(DMA_DescriptorRing_t *ring,	/*                             */
			      int numDescriptors	/*                                                  */
    ) {
	size_t bytesToAlloc = dmacHw_descriptorLen(numDescriptors);

	if ((ring == NULL) || (numDescriptors <= 0)) {
		return -EINVAL;
	}

	ring->physAddr = 0;
	ring->descriptorsAllocated = 0;
	ring->bytesAllocated = 0;

	ring->virtAddr = dma_alloc_writecombine(NULL,
						     bytesToAlloc,
						     &ring->physAddr,
						     GFP_KERNEL);
	if (ring->virtAddr == NULL) {
		return -ENOMEM;
	}

	ring->bytesAllocated = bytesToAlloc;
	ring->descriptorsAllocated = numDescriptors;

	return dma_init_descriptor_ring(ring, numDescriptors);
}
开发者ID:curbthepain,项目名称:android_kernel_us990_rev,代码行数:26,代码来源:dma.c


示例7: round_up

/*
 * drm_gem_cma_create - allocate an object with the given size
 *
 * returns a struct drm_gem_cma_object* on success or ERR_PTR values
 * on failure.
 */
struct drm_gem_cma_object *drm_gem_cma_create(struct drm_device *drm,
		unsigned int size)
{
	struct drm_gem_cma_object *cma_obj;
	int ret;

	size = round_up(size, PAGE_SIZE);

	cma_obj = __drm_gem_cma_create(drm, size);
	if (IS_ERR(cma_obj))
		return cma_obj;

	cma_obj->vaddr = dma_alloc_writecombine(drm->dev, size,
			&cma_obj->paddr, GFP_KERNEL | __GFP_NOWARN);
	if (!cma_obj->vaddr) {
		dev_err(drm->dev, "failed to allocate buffer with size %d\n",
			size);
		ret = -ENOMEM;
		goto error;
	}

	return cma_obj;

error:
	drm_gem_cma_free_object(&cma_obj->base);
	return ERR_PTR(ret);
}
开发者ID:TimeMachine,项目名称:linux-juno_3.18,代码行数:33,代码来源:drm_gem_cma_helper.c


示例8: realview_clcd_setup

static int realview_clcd_setup(struct clcd_fb *fb)
{
	unsigned long framesize;
	dma_addr_t dma;

	if (machine_is_realview_eb())
		/* VGA, 16bpp */
		framesize = 640 * 480 * 2;
	else
		/* XVGA, 16bpp */
		framesize = 1024 * 768 * 2;

	fb->panel		= realview_clcd_panel();

	fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev, framesize,
						    &dma, GFP_KERNEL);
	if (!fb->fb.screen_base) {
		printk(KERN_ERR "CLCD: unable to map framebuffer\n");
		return -ENOMEM;
	}

	fb->fb.fix.smem_start	= dma;
	fb->fb.fix.smem_len	= framesize;

	return 0;
}
开发者ID:steveglen,项目名称:linux-2.6,代码行数:26,代码来源:core.c


示例9: pxa2xx_pcm_open

static int pxa2xx_pcm_open(struct snd_pcm_substream *substream)
{
	struct pxa2xx_pcm_client *client = substream->private_data;
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct pxa2xx_runtime_data *rtd;
	int ret;

	runtime->hw = pxa2xx_pcm_hardware;

	/*
	 * For mysterious reasons (and despite what the manual says)
	 * playback samples are lost if the DMA count is not a multiple
	 * of the DMA burst size.  Let's add a rule to enforce that.
	 */
	ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
				  pxa2xx_pcm_hw_rule_mult32, NULL,
				  SNDRV_PCM_HW_PARAM_PERIOD_BYTES, -1);
	if (ret)
		goto out;
	ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
				  pxa2xx_pcm_hw_rule_mult32, NULL,
				  SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1);
	if (ret)
		goto out;

	ret = -ENOMEM;
	rtd = kmalloc(sizeof(*rtd), GFP_KERNEL);
	if (!rtd)
		goto out;
	rtd->dma_desc_array =
		dma_alloc_writecombine(substream->pcm->card->dev, PAGE_SIZE,
				       &rtd->dma_desc_array_phys, GFP_KERNEL);
	if (!rtd->dma_desc_array)
		goto err1;

	rtd->params = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
		      client->playback_params : client->capture_params;
	ret = pxa_request_dma(rtd->params->name, DMA_PRIO_LOW,
			      pxa2xx_pcm_dma_irq, substream);
	if (ret < 0)
		goto err2;
	rtd->dma_ch = ret;

	runtime->private_data = rtd;
	ret = client->startup(substream);
	if (!ret)
		goto out;

	pxa_free_dma(rtd->dma_ch);
 err2:
	dma_free_writecombine(substream->pcm->card->dev, PAGE_SIZE,
			      rtd->dma_desc_array, rtd->dma_desc_array_phys);
 err1:
	kfree(rtd);
 out:
	return ret;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:57,代码来源:pxa2xx-pcm.c


示例10: pxa3xx_pcm_open

static int pxa3xx_pcm_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct pxa3xx_runtime_data *prtd;
	int ret;

	snd_soc_set_runtime_hwparams(substream, &pxa3xx_pcm_hardware);

	/*
	 * For mysterious reasons (and despite what the manual says)
	 * playback samples are lost if the DMA count is not a multiple
	 * of the DMA burst size.  Let's add a rule to enforce that.
	 */
	ret = snd_pcm_hw_constraint_step(runtime, 0,
		SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32);
	if (ret)
		goto out;

	ret = snd_pcm_hw_constraint_step(runtime, 0,
		SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 32);
	if (ret)
		goto out;

	ret = snd_pcm_hw_constraint_integer(runtime,
					SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		goto out;

	prtd = kzalloc(sizeof(struct pxa3xx_runtime_data), GFP_KERNEL);
	if (prtd == NULL) {
		ret = -ENOMEM;
		goto out;
	}

	prtd->dma_ch = -1;
	prtd->dma_desc_array =
		dma_alloc_writecombine(substream->pcm->card->dev, PAGE_SIZE,
				&prtd->dma_desc_array_phys, GFP_KERNEL);
	
	if (!prtd->dma_desc_array) {
		ret = -ENOMEM;
		goto err1;
	}

	runtime->private_data = prtd;
	return 0;

 err1:
	kfree(prtd);
 out:
	return ret;
}
开发者ID:robacklin,项目名称:ts4700,代码行数:52,代码来源:pxa3xx-pcm.c


示例11: s3cfb_map_video_memory

static int __init s3cfb_map_video_memory(s3c_fb_info_t *fbi)
{
	DPRINTK("map_video_memory(fbi=%p)\n", fbi);

	fbi->map_size_f1 = PAGE_ALIGN(fbi->fb.fix.smem_len);
	fbi->map_cpu_f1 = dma_alloc_writecombine(fbi->dev, fbi->map_size_f1, &fbi->map_dma_f1, GFP_KERNEL);
	fbi->map_size_f1 = fbi->fb.fix.smem_len;

	if (fbi->map_cpu_f1) {
		/* prevent initial garbage on screen */
		printk("Window[%d] - FB1: map_video_memory: clear %p:%08x\n",
			fbi->win_id, fbi->map_cpu_f1, fbi->map_size_f1);
		memset(fbi->map_cpu_f1, 0xf0, fbi->map_size_f1);

		fbi->screen_dma_f1 = fbi->map_dma_f1;
		fbi->fb.screen_base = fbi->map_cpu_f1;
		fbi->fb.fix.smem_start = fbi->screen_dma_f1;

		printk("            FB1: map_video_memory: dma=%08x cpu=%p size=%08x\n",
			fbi->map_dma_f1, fbi->map_cpu_f1, fbi->fb.fix.smem_len);
	}

	/* RAM Dump Info */
	if ((fbi->win_id == 1) && fbi->map_cpu_f1)
		frame_buf_mark.p_fb = (void *)fbi->map_dma_f1;	

	if (!fbi->map_cpu_f1)
		return -ENOMEM;

#if defined(CONFIG_FB_S3C_DOUBLE_BUFFERING)
	if (fbi->win_id < 2 && fbi->map_cpu_f1) {
		fbi->map_size_f2 = (fbi->fb.fix.smem_len / 2);
		fbi->map_cpu_f2 = fbi->map_cpu_f1 + fbi->map_size_f2;
		fbi->map_dma_f2 = fbi->map_dma_f1 + fbi->map_size_f2;

		/* prevent initial garbage on screen */
		printk("Window[%d] - FB2: map_video_memory: clear %p:%08x\n",
			fbi->win_id, fbi->map_cpu_f2, fbi->map_size_f2);

		fbi->screen_dma_f2 = fbi->map_dma_f2;

		printk("            FB2: map_video_memory: dma=%08x cpu=%p size=%08x\n",
			fbi->map_dma_f2, fbi->map_cpu_f2, fbi->map_size_f2);
	}
#endif

	if (s3c_fimd.map_video_memory)
		(s3c_fimd.map_video_memory)(fbi);

	return 0;
}
开发者ID:LouZiffer,项目名称:m900_kernel_cupcake-SDX,代码行数:51,代码来源:s3cfb.c


示例12: ion_cma_allocate

/* ION CMA heap operations functions */
static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
			    unsigned long len, unsigned long align,
			    unsigned long flags)
{
	struct device *dev = heap->priv;
	struct ion_cma_buffer_info *info;

	dev_dbg(dev, "Request buffer allocation len %ld\n", len);

	info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
	if (!info) {
		dev_err(dev, "Can't allocate buffer info\n");
		return -ENOMEM;
	}

	if (!ION_IS_CACHED(flags))
		info->cpu_addr = dma_alloc_writecombine(dev, len,
					&(info->handle), 0);
	else
		info->cpu_addr = dma_alloc_nonconsistent(dev, len,
					&(info->handle), 0);

	if (!info->cpu_addr) {
		dev_err(dev, "Fail to allocate buffer\n");
		goto err;
	}

	info->table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
	if (!info->table) {
		dev_err(dev, "Fail to allocate sg table\n");
		goto free_mem;
	}

	info->is_cached = ION_IS_CACHED(flags);

	ion_cma_get_sgtable(dev,
			info->table, info->cpu_addr, info->handle, len);

	/* keep this for memory release */
	buffer->priv_virt = info;
	dev_dbg(dev, "Allocate buffer %p\n", buffer);
	return 0;
free_mem:
	if (!ION_IS_CACHED(flags))
		dma_free_writecombine(dev, len, info->cpu_addr, info->handle);
	else
		dma_free_nonconsistent(dev, len, info->cpu_addr, info->handle);
err:
	kfree(info);
	return -ENOMEM;
}
开发者ID:XperiaZProject,项目名称:Sony_Kernel,代码行数:52,代码来源:ion_cma_heap.c


示例13: preallocate_dma_buffer

static int preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
{
	struct snd_pcm_substream *substream = pcm->streams[stream].substream;
	struct snd_dma_buffer *buf = &substream->dma_buffer;
	size_t size = dma_hardware.buffer_bytes_max;
#ifdef CONFIG_SND_SAMSUNG_USE_ADMA_SRAM
	struct snd_soc_pcm_runtime *rtd = pcm->private_data;
	const char *cpu_dai_name = rtd->cpu_dai->name;
#endif

	pr_debug("Entered %s\n", __func__);

	buf->dev.type = SNDRV_DMA_TYPE_DEV;
	buf->dev.dev = pcm->card->dev;
	buf->private_data = NULL;

#ifdef CONFIG_SND_SAMSUNG_USE_ADMA_SRAM
	if ((stream == SNDRV_PCM_STREAM_PLAYBACK) && !strncmp(cpu_dai_name,
			CONFIG_SND_SAMSUNG_ADMA_SRAM_CPUDAI_NAME,
			strlen(CONFIG_SND_SAMSUNG_ADMA_SRAM_CPUDAI_NAME))) {
		size = CONFIG_SND_SAMSUNG_ADMA_SRAM_SIZE_KB * 1024;
		buf->addr = CONFIG_SND_SAMSUNG_ADMA_SRAM_ADDR;
		buf->area = (unsigned char *)ioremap(buf->addr, size);
		pr_info("%s: DMA-buf reserved @%08X, size %d\n",
				cpu_dai_name, buf->addr, size);
	} else {
		buf->area = dma_alloc_writecombine(pcm->card->dev, size,
						&buf->addr, GFP_KERNEL);
	}
#else
	buf->area = dma_alloc_writecombine(pcm->card->dev, size,
					   &buf->addr, GFP_KERNEL);
#endif
	if (!buf->area)
		return -ENOMEM;
	buf->bytes = size;
	return 0;
}
开发者ID:poldo964,项目名称:android_kernel_samsung_kminilte,代码行数:38,代码来源:dma.c


示例14: s3cfb_map_video_memory

int s3cfb_map_video_memory(struct s3cfb_global *fbdev, struct fb_info *fb)
{
	struct fb_fix_screeninfo *fix = &fb->fix;
	struct s3cfb_window *win = fb->par;
#ifdef CONFIG_CMA
	struct cma_info mem_info;
	int err;
#endif

#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
	return 0;
#endif

	if (win->owner == DMA_MEM_OTHER)
		return 0;

#ifdef CONFIG_CMA
	err = cma_info(&mem_info, fbdev->dev, CMA_REGION_VIDEO);
	if (err)
		return err;
	fix->smem_start = (dma_addr_t)cma_alloc
#ifdef CONFIG_EXYNOS_CONTENT_PATH_PROTECTION
		(fbdev->dev, "fimd_video", (size_t)PAGE_ALIGN(fix->smem_len), 0);
#else
		(fbdev->dev, "fimd", (size_t)PAGE_ALIGN(fix->smem_len), 0);
#endif
	if (IS_ERR_OR_NULL((char *)fix->smem_start)) {
		printk(KERN_ERR "fix->smem_start allocation fail (%x)\n",
				(int)fix->smem_start);
		return -1;
	}

	fb->screen_base = NULL;
#else
	fb->screen_base = dma_alloc_writecombine(fbdev->dev,
						 PAGE_ALIGN(fix->smem_len),
						 (unsigned int *)
						 &fix->smem_start, GFP_KERNEL);
#endif

	dev_info(fbdev->dev, "[fb%d] Alloc dma: 0x%08x, "
			"size: 0x%08x\n", win->id,
			(unsigned int)fix->smem_start,
			fix->smem_len);

	win->owner = DMA_MEM_FIMD;

	return 0;
}
开发者ID:Lukiqq,项目名称:GT-I9100-Galaxian-ICS-Kernel,代码行数:49,代码来源:s3cfb_ops.c


示例15: lh7a40x_clcd_setup

static int lh7a40x_clcd_setup (struct clcd_fb *fb)
{
	dma_addr_t dma;
	u32 len = FRAMESIZE (lcd_panel.mode.xres*lcd_panel.mode.yres
			     *(lcd_panel.bpp/8));

	fb->panel = &lcd_panel;

		/* Enforce the sync polarity defaults */
	if (!(fb->panel->tim2 & TIM2_IHS))
		fb->fb.var.sync |= FB_SYNC_HOR_HIGH_ACT;
	if (!(fb->panel->tim2 & TIM2_IVS))
		fb->fb.var.sync |= FB_SYNC_VERT_HIGH_ACT;

#if defined (HAS_LCD_PANEL_EXTRA)
	fb->board_data = &lcd_panel_extra;
#endif

	fb->fb.screen_base
		= dma_alloc_writecombine (&fb->dev->dev, len,
					  &dma, GFP_KERNEL);
	printk ("CLCD: LCD setup fb virt 0x%p phys 0x%p l %x io 0x%p \n",
		fb->fb.screen_base, (void*) dma, len,
		(void*) io_p2v (CLCDC_PHYS));
	printk ("CLCD: pixclock %d\n", lcd_panel.mode.pixclock);

	if (!fb->fb.screen_base) {
		printk(KERN_ERR "CLCD: unable to map framebuffer\n");
		return -ENOMEM;
	}

#if defined (USE_RGB555)
	fb->fb.var.green.length = 5; /* Panel uses RGB 5:5:5 */
#endif

	fb->fb.fix.smem_start = dma;
	fb->fb.fix.smem_len = len;

		/* Drive PE4 high to prevent CPLD crash */
	GPIO_PEDD |= (1<<4);
	GPIO_PED  |= (1<<4);

	GPIO_PINMUX |= (1<<1) | (1<<0); /* LCDVD[15:4] */

//	fb->fb.fbops->fb_check_var (&fb->fb.var, &fb->fb);
//	fb->fb.fbops->fb_set_par (&fb->fb);

	return 0;
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:49,代码来源:clcd.c


示例16: pxa2xx_pcm_preallocate_dma_buffer

int pxa2xx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
{
	struct snd_pcm_substream *substream = pcm->streams[stream].substream;
	struct snd_dma_buffer *buf = &substream->dma_buffer;
	size_t size = pxa2xx_pcm_hardware.buffer_bytes_max;
	buf->dev.type = SNDRV_DMA_TYPE_DEV;
	buf->dev.dev = pcm->card->dev;
	buf->private_data = NULL;
	buf->area = dma_alloc_writecombine(pcm->card->dev, size,
					   &buf->addr, GFP_KERNEL);
	if (!buf->area)
		return -ENOMEM;
	buf->bytes = size;
	return 0;
}
开发者ID:antonywcl,项目名称:AR-5315u_PLD,代码行数:15,代码来源:pxa2xx-pcm-lib.c


示例17: dma_alloc_writecombine

static void *alloc_mem( dma_mem_t *mem, size_t numBytes )
{
    mem->numBytes = numBytes;
    mem->virtPtr = dma_alloc_writecombine( NULL, numBytes, &mem->physPtr, GFP_KERNEL );

    if ( mem->virtPtr == NULL )
    {
        printk( KERN_ERR "dma_alloc_writecombine of %d bytes failed\n", numBytes );
    }

    printk( "dma_alloc_writecombine of %d bytes returned virtPtr: 0x%08lx physPstr: %08x\n",
            numBytes, (unsigned long)mem->virtPtr, mem->physPtr );

    return mem->virtPtr;
}
开发者ID:CVlaspoel,项目名称:VSMC-i9105p,代码行数:15,代码来源:sdma-test.c


示例18: s3c_dma_init

static int s3c_dma_init(void)
{
	//分配src,dst对应的缓冲区
	src = dma_alloc_writecombine(NULL, BUF_SIZE, &src_phys, GFP_KERNEL);
	if(NULL == src)
	{
		printk("can not alloc buf for src");
		return -ENOMEM;
	}

	dst = dma_alloc_writecombine(NULL, BUF_SIZE, &dst_phys, GFP_KERNEL);
	if(NULL == dst)
	{
		dma_free_writecombine(NULL, BUF_SIZE, src, src_phys);
		printk("can not alloc buf for dst");
		return -ENOMEM;
	}

	major = register_chrdev(0, "s3c_dma", &dma_fops);

	cls = class_create(THIS_MODULE, "s3c_dma");
	class_device_create(cls, NULL, MKDEV(major, 0), NULL, "dma");
	return 0;
}
开发者ID:mallius,项目名称:drivers-m,代码行数:24,代码来源:22_drv_dma.c


示例19: __pxa2xx_pcm_open

int __pxa2xx_pcm_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct pxa2xx_runtime_data *rtd;
	int ret;

	runtime->hw = pxa2xx_pcm_hardware;

	/*
                                                             
                                                                
                                                             
  */
	ret = snd_pcm_hw_constraint_step(runtime, 0,
		SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 32);
	if (ret)
		goto out;

	ret = snd_pcm_hw_constraint_step(runtime, 0,
		SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 32);
	if (ret)
		goto out;

	ret = snd_pcm_hw_constraint_integer(runtime,
					    SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		goto out;

	ret = -ENOMEM;
	rtd = kzalloc(sizeof(*rtd), GFP_KERNEL);
	if (!rtd)
		goto out;
	rtd->dma_desc_array =
		dma_alloc_writecombine(substream->pcm->card->dev, PAGE_SIZE,
				       &rtd->dma_desc_array_phys, GFP_KERNEL);
	if (!rtd->dma_desc_array)
		goto err1;

	rtd->dma_ch = -1;
	runtime->private_data = rtd;
	return 0;

 err1:
	kfree(rtd);
 out:
	return ret;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:47,代码来源:pxa2xx-pcm-lib.c


示例20: kzalloc

struct tegra_bo *tegra_bo_create(struct drm_device *drm, unsigned int size,
				 unsigned long flags)
{
	struct tegra_bo *bo;
	int err;

	bo = kzalloc(sizeof(*bo), GFP_KERNEL);
	if (!bo)
		return ERR_PTR(-ENOMEM);

	host1x_bo_init(&bo->base, &tegra_bo_ops);
	size = round_up(size, PAGE_SIZE);

	bo->vaddr = dma_alloc_writecombine(drm->dev, size, &bo->paddr,
					   GFP_KERNEL | __GFP_NOWARN);
	if (!bo->vaddr) {
		dev_err(drm->dev, "failed to allocate buffer with size %u\n",
			size);
		err = -ENOMEM;
		goto err_dma;
	}

	err = drm_gem_object_init(drm, &bo->gem, size);
	if (err)
		goto err_init;

	err = drm_gem_create_mmap_offset(&bo->gem);
	if (err)
		goto err_mmap;

	if (flags & DRM_TEGRA_GEM_CREATE_TILED)
		bo->tiling.mode = TEGRA_BO_TILING_MODE_TILED;

	if (flags & DRM_TEGRA_GEM_CREATE_BOTTOM_UP)
		bo->flags |= TEGRA_BO_BOTTOM_UP;

	return bo;

err_mmap:
	drm_gem_object_release(&bo->gem);
err_init:
	tegra_bo_destroy(drm, bo);
err_dma:
	kfree(bo);

	return ERR_PTR(err);
}
开发者ID:mikuhatsune001,项目名称:linux2.6.32,代码行数:47,代码来源:gem.c



注:本文中的dma_alloc_writecombine函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ dma_async_issue_pending函数代码示例发布时间:2022-05-30
下一篇:
C++ dma_alloc_coherent函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap