本文整理汇总了C++中dma_free_writecombine函数的典型用法代码示例。如果您正苦于以下问题:C++ dma_free_writecombine函数的具体用法?C++ dma_free_writecombine怎么用?C++ dma_free_writecombine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dma_free_writecombine函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sun7i_pcm_free_dma_buffers
static void sun7i_pcm_free_dma_buffers(struct snd_pcm *pcm)
{
struct snd_pcm_substream *substream;
struct snd_dma_buffer *buf;
int stream;
for (stream = 0; stream < 2; stream++) {
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;
}
}
示例2: nusmart_pcm_free_dma_buffers
void nusmart_pcm_free_dma_buffers(struct snd_pcm *pcm)
{
struct snd_pcm_substream *substream;
struct snd_dma_buffer *buf;
int stream;
for (stream = 0; stream < 2; stream++) {
substream = pcm->streams[stream].substream;
if (!substream)
continue;
buf = &substream->dma_buffer;
if (!buf->area)
continue;
DBG_PRINT("pcm_free_dma_buffer, size = %x, stream = %x\n",
buf->bytes, stream);
dma_free_writecombine(pcm->card->dev, buf->bytes,
buf->area, buf->addr);
buf->area = NULL;
}
}
示例3: goldfish_mmc_remove
static int goldfish_mmc_remove(struct platform_device *pdev)
{
struct goldfish_mmc_host *host = platform_get_drvdata(pdev);
platform_set_drvdata(pdev, NULL);
BUG_ON(host == NULL);
mmc_remove_host(host->mmc);
free_irq(host->irq, host);
#if defined(CONFIG_ARM)
dma_free_writecombine(&pdev->dev, BUFFER_SIZE, host->virt_base, host->phys_base);
#elif defined(CONFIG_X86) || defined(CONFIG_MIPS)
dma_free_coherent(NULL, BUFFER_SIZE, host->virt_base, host->phys_base);
#else
#error NOT SUPPORTED
#endif
mmc_free_host(host->mmc);
return 0;
}
示例4: dmabuf_ioctl_create
static int dmabuf_ioctl_create(struct dmabuf_file *priv,
const void __user *data)
{
struct dmabuf_create args;
int ret = 0;
if (priv->buf || priv->virt)
return -EBUSY;
if (copy_from_user(&args, data, sizeof(args)))
return -EFAULT;
priv->virt = dma_alloc_writecombine(priv->dev, args.size, &priv->phys,
GFP_KERNEL | __GFP_NOWARN);
if (!priv->virt)
return -ENOMEM;
args.flags |= O_RDWR;
priv->buf = dma_buf_export(priv, &dmabuf_ops, args.size, args.flags,
NULL);
if (!priv->buf) {
ret = -ENOMEM;
goto free;
}
if (IS_ERR(priv->buf)) {
ret = PTR_ERR(priv->buf);
goto free;
}
priv->size = args.size;
return 0;
free:
dma_free_writecombine(NULL, priv->size, priv->virt, priv->phys);
priv->virt = NULL;
return ret;
}
示例5: s3c24xx_pcm_free_dma_buffers
static void s3c24xx_pcm_free_dma_buffers(struct snd_pcm *pcm)
{
struct snd_pcm_substream *substream;
struct snd_dma_buffer *buf;
int stream;
s3cdbg("Entered %s\n", __FUNCTION__);
for (stream = 0; stream < 2; stream++) {
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;
}
}
示例6: free_mem
static void free_mem(void *buf, dma_addr_t addr, size_t len, enum mem_t type)
{
if (buf == NULL || type >= MEM_TYPE_MAX || len == 0)
return;
switch (type) {
case MEM_TYPE_DMA:
dma_free_writecombine(NULL, len, buf, addr);
break;
case MEM_TYPE_KMALLOC:
kfree(buf);
break;
case MEM_TYPE_VMALLOC:
vfree(buf);
break;
default:
return;
}
}
示例7: test_init
static int __init test_init(void)
{
int ret;
fb_mem_virt = dma_alloc_writecombine(NULL,
FB_MEM_SIZE, &fb_mem_phys, GFP_KERNEL);
if(!fb_mem_virt)
{
DEBUG();
return -ENOMEM;
}
ret = lcd_init();
if(ret)
{
dma_free_writecombine(NULL, FB_MEM_SIZE,
fb_mem_virt, fb_mem_phys);
return ret;
}
return misc_register(&mdev);
}
示例8: rockchip_pcm_free_dma_buffers
static void rockchip_pcm_free_dma_buffers(struct snd_pcm *pcm)
{
struct snd_pcm_substream *substream;
struct snd_dma_buffer *buf;
int stream;
DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__);
for (stream = 0; stream < 2; stream++) {
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;
}
}
示例9: cns3xxx_pcm_free_dma_buffers
static void cns3xxx_pcm_free_dma_buffers(struct snd_pcm *pcm)
{
struct snd_pcm_substream *substream;
struct snd_dma_buffer *buf;
int stream;
#ifdef __DEBUG_PATH
printk("%s=>%d\n", __FUNCTION__, __LINE__);
#endif
for (stream = 0; stream < 2; stream++) {
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;
}
}
示例10: nvhost_3dctx_free
void nvhost_3dctx_free(struct kref *ref)
{
struct nvhost_hwctx *nctx = container_of(ref, struct nvhost_hwctx, ref);
struct host1x_hwctx *ctx = to_host1x_hwctx(nctx);
if (ctx->cpuva) {
if (ctx->mem_flag)
dma_free_writecombine(&nctx->channel->dev->dev,
ctx->restore_size * 4,
ctx->cpuva,
ctx->iova);
else
dma_free_coherent(&nctx->channel->dev->dev,
ctx->restore_size * 4,
ctx->cpuva,
ctx->iova);
ctx->cpuva = NULL;
ctx->iova = 0;
}
kfree(ctx);
}
示例11: drm_gem_cma_free_object
/*
* drm_gem_cma_free_object - (struct drm_driver)->gem_free_object callback
* function
*/
void drm_gem_cma_free_object(struct drm_gem_object *gem_obj)
{
struct drm_gem_cma_object *cma_obj;
drm_gem_free_mmap_offset(gem_obj);
cma_obj = to_drm_gem_cma_obj(gem_obj);
if (cma_obj->vaddr) {
dma_free_writecombine(gem_obj->dev->dev, cma_obj->base.size,
cma_obj->vaddr, cma_obj->paddr);
if (cma_obj->sgt) {
sg_free_table(cma_obj->sgt);
kfree(cma_obj->sgt);
}
} else if (gem_obj->import_attach) {
drm_prime_gem_destroy(gem_obj, cma_obj->sgt);
}
drm_gem_object_release(gem_obj);
kfree(cma_obj);
}
示例12: 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;
}
示例13: goldfish_mmc_probe
static int goldfish_mmc_probe(struct platform_device *pdev)
{
struct mmc_host *mmc;
struct goldfish_mmc_host *host = NULL;
struct resource *res;
int ret = 0;
int irq;
dma_addr_t buf_addr;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
irq = platform_get_irq(pdev, 0);
if (res == NULL || irq < 0)
return -ENXIO;
mmc = mmc_alloc_host(sizeof(struct goldfish_mmc_host), &pdev->dev);
if (mmc == NULL) {
ret = -ENOMEM;
goto err_alloc_host_failed;
}
host = mmc_priv(mmc);
host->mmc = mmc;
#if defined(CONFIG_ARM)
host->reg_base = (void __iomem *)IO_ADDRESS(res->start - IO_START);
host->virt_base = dma_alloc_writecombine(&pdev->dev, BUFFER_SIZE,
&buf_addr, GFP_KERNEL);
#elif defined(CONFIG_X86) || defined(CONFIG_MIPS)
/*
* Use NULL for dev for ISA-like devices
*/
host->reg_base = ioremap(res->start, res->end - res->start + 1);
host->virt_base = dma_alloc_coherent(NULL, BUFFER_SIZE, &buf_addr, GFP_KERNEL);
#else
#error NOT SUPPORTED
#endif
if(host->virt_base == 0) {
ret = -EBUSY;
goto dma_alloc_failed;
}
host->phys_base = buf_addr;
host->id = pdev->id;
host->irq = irq;
mmc->ops = &goldfish_mmc_ops;
mmc->f_min = 400000;
mmc->f_max = 24000000;
mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34;
mmc->caps = MMC_CAP_4_BIT_DATA;
/* Use scatterlist DMA to reduce per-transfer costs.
* NOTE max_seg_size assumption that small blocks aren't
* normally used (except e.g. for reading SD registers).
*/
mmc->max_segs = 32;
mmc->max_blk_size = 2048; /* MMC_BLOCK_LENGTH is 11 bits (+1) */
mmc->max_blk_count = 2048; /* MMC_BLOCK_COUNT is 11 bits (+1) */
mmc->max_req_size = BUFFER_SIZE;
mmc->max_seg_size = mmc->max_req_size;
ret = request_irq(host->irq, goldfish_mmc_irq, 0, DRIVER_NAME, host);
if (ret)
goto err_request_irq_failed;
host->dev = &pdev->dev;
platform_set_drvdata(pdev, host);
ret = device_create_file(&pdev->dev, &dev_attr_cover_switch);
if (ret)
dev_warn(mmc_dev(host->mmc), "Unable to create sysfs attributes\n");
GOLDFISH_MMC_WRITE(host, MMC_SET_BUFFER, host->phys_base);
GOLDFISH_MMC_WRITE(host, MMC_INT_ENABLE,
MMC_STAT_END_OF_CMD | MMC_STAT_END_OF_DATA | MMC_STAT_STATE_CHANGE |
MMC_STAT_CMD_TIMEOUT);
mmc_add_host(mmc);
return 0;
err_request_irq_failed:
#if defined(CONFIG_ARM)
dma_free_writecombine(&pdev->dev, BUFFER_SIZE, host->virt_base, host->phys_base);
#elif defined(CONFIG_X86) || defined(CONFIG_MIPS)
dma_free_coherent(NULL, BUFFER_SIZE, host->virt_base, host->phys_base);
#else
#error NOT SUPPORTED
#endif
dma_alloc_failed:
mmc_free_host(host->mmc);
err_alloc_host_failed:
return ret;
}
示例14: videoin_init
int __devinit videoin_init(void)
{
int ret = 0;
int i;
unsigned int u32PacketBuf0, u32PacketBuf1, u32PacketBuf2;
unsigned int u32PlanarBuf0, u32PlanarBuf1;
UINT32 u32PhyAddr;
videoin_priv_t *priv = (videoin_priv_t *)&videoin_priv;
g_u32FbPhyAddr = inp32(REG_LCM_FSADDR);
DBG_PRINTF("%s\n",__FUNCTION__);
/* initialize locks */
init_MUTEX(&videoin_priv.lock);
priv->jdev.owner = THIS_MODULE;
priv->jdev.type = VID_TYPE_CAPTURE | VID_TYPE_SCALES;
priv->jdev.hardware = VID_HARDWARE_W55FA93;
priv->jdev.release = videoin_release;
priv->jdev.fops = &videoin_fops;
priv->jdev.priv = &videoin_priv;
priv->preview_width = LCDWIDTH; //CONFIG_VIDEOIN_PREVIEW_RESOLUTION_X;
priv->preview_height = LCDHEIGHT; //CONFIG_VIDEOIN_PREVIEW_RESOLUTION_Y;
priv->videoin_buffersize = CONFIG_VIDEOIN_PREVIEW_BUFFER_SIZE;
priv->videoin_buffer = kmalloc(sizeof(__u8*) * CONFIG_VIDEOIN_BUFFER_COUNT, GFP_KERNEL);
#ifdef CONFIG_VIDEOIN_VPOST_OVERLAY_BUFFER
DBG_PRINTF("\nUsing Overlay\n");
/*For 1 * Packet pipe*/
u32PhysPacketBuf = w55fa93_FB_BG_PHY_ADDR;
u32VirtPacketBuf = phys_to_virt(u32PhysPacketBuf);
/*For Planar pipe*/
priv->vaddr = videoin_dmamalloc(VIDEOIN_ENCODE_BUFFER_SIZE);
if (!priv->vaddr)
return -ENOMEM;
#else
DBG_PRINTF("\nUsing FSC\n");
//Allocate 3 buffer for preview
u32PacketBuf0 = videoin_dmamalloc_phy(0, LCDWIDTH*LCDHEIGHT*LCDBPP/8); //Packet buffer 0
if (!u32PacketBuf0)
{
printk("VideoIn allocated buffer fail\n");
return -ENOMEM;
}
u32PacketBuf1 = videoin_dmamalloc_phy(1, LCDWIDTH*LCDHEIGHT*LCDBPP/8); //Packet buffer 1
if (!u32PacketBuf1)
{
printk("VideoIn allocated buffer fail\n");
return -ENOMEM;
}
u32PacketBuf2 = videoin_dmamalloc_phy(2, LCDWIDTH*LCDHEIGHT*LCDBPP/8); //Packet buffer 2
if (!u32PacketBuf2)
{
printk("VideoIn allocated buffer fail\n");
return -ENOMEM;
}
//Allocate 2 buffer for JEPG encode
u32PlanarBuf0 = videoin_dmamalloc_phy(3, VIDEOIN_ENCODE_BUFFER_SIZE); //Planar buffer 0
w55fa93_JPG_Y0_ADDR = u32PlanarBuf0;
if (!u32PlanarBuf0)
{
printk("VideoIn allocated buffer fail\n");
return -ENOMEM;
}
u32PlanarBuf1 = videoin_dmamalloc_phy(4, VIDEOIN_ENCODE_BUFFER_SIZE); //Planar buffer 1
w55fa93_JPG_Y1_ADDR = u32PlanarBuf1;
if (!u32PlanarBuf1)
{
printk("VideoIn allocated buffer fail\n");
return -ENOMEM;
}
#endif
for(i = 0; i < CONFIG_VIDEOIN_BUFFER_COUNT; i++)
{
priv->videoin_buffer[i] = priv->paddr + i * CONFIG_VIDEOIN_PREVIEW_BUFFER_SIZE;
DBG_PRINTF("bufer[%d]:%x\n", i, priv->videoin_buffer[i]);
}
if (video_register_device(&priv->jdev, VFL_TYPE_GRABBER, videoin_nr) == -1) {
printk("%s: video_register_device failed\n", __FUNCTION__);
dma_free_writecombine(NULL/*dev*/, VIDEOIN_ENCODE_BUFFER_SIZE, priv->vaddr, priv->paddr);
kfree(priv->videoin_buffer);//2010-07-27
return -EPIPE;
}
if (!request_mem_region((unsigned long)W55FA93_VA_VIDEOIN, W55FA93_SZ_VIDEOIN, "w55fa93-videoin"))
{
printk("%s: request_mem_region failed\n", __FUNCTION__);
video_unregister_device(&videoin_priv.jdev);
dma_free_writecombine(NULL/*dev*/, VIDEOIN_ENCODE_BUFFER_SIZE, priv->vaddr, priv->paddr);
kfree(priv->videoin_buffer); //2010-07-27
return -EBUSY;
}
ret = request_irq(IRQ_CAP, irq_handler, SA_INTERRUPT, "w55fa93-videoin", priv);
if (ret) {
printk("cannot get irq %d - err %d\n", IRQ_CAP, ret);
//.........这里部分代码省略.........
示例15: s3c_mem_ioctl
//.........这里部分代码省略.........
if (param.vir_addr == -EINVAL) {
printk(KERN_INFO "S3C_MEM_SHARE_ALLOC FAILED\n");
flag = 0;
mutex_unlock(&mem_cacheable_share_alloc_lock);
return -EFAULT;
}
DEBUG("MALLOC_SHARE : param.phy_addr = 0x%X \t "
"size = %d \t param.vir_addr = 0x%X, %d\n",
param.phy_addr, param.size, param.vir_addr,
__LINE__);
if (copy_to_user((struct s3c_mem_alloc *)arg, ¶m,
sizeof(struct s3c_mem_alloc))) {
flag = 0;
mutex_unlock(&mem_cacheable_share_alloc_lock);
return -EFAULT;
}
flag = 0;
mutex_unlock(&mem_cacheable_share_alloc_lock);
break;
case S3C_MEM_FREE:
mutex_lock(&mem_free_lock);
if (copy_from_user(¶m, (struct s3c_mem_alloc *)arg,
sizeof(struct s3c_mem_alloc))) {
mutex_unlock(&mem_free_lock);
return -EFAULT;
}
DEBUG("KERNEL FREE : param.phy_addr = 0x%X \t "
"size = %d \t param.vir_addr = 0x%X, %d\n",
param.phy_addr, param.size, param.vir_addr,
__LINE__);
if (do_munmap(mm, param.vir_addr, param.size) < 0) {
printk(KERN_INFO "do_munmap() failed !!\n");
mutex_unlock(&mem_free_lock);
return -EINVAL;
}
#ifdef USE_DMA_ALLOC
virt_addr = param.kvir_addr;
dma_free_writecombine(NULL, param.size,
(unsigned int *) virt_addr, param.phy_addr);
#else
virt_addr = (unsigned long *)phys_to_virt(param.phy_addr);
kfree(virt_addr);
#endif
param.size = 0;
DEBUG("do_munmap() succeed !!\n");
if (copy_to_user((struct s3c_mem_alloc *)arg, ¶m,
sizeof(struct s3c_mem_alloc))) {
mutex_unlock(&mem_free_lock);
return -EFAULT;
}
mutex_unlock(&mem_free_lock);
break;
case S3C_MEM_SHARE_FREE:
mutex_lock(&mem_share_free_lock);
if (copy_from_user(¶m, (struct s3c_mem_alloc *)arg,
sizeof(struct s3c_mem_alloc))) {
mutex_unlock(&mem_share_free_lock);
return -EFAULT; }
DEBUG("MEM_SHARE_FREE : param.phy_addr = 0x%X \t "
"size = %d \t param.vir_addr = 0x%X, %d\n",
param.phy_addr, param.size, param.vir_addr,
__LINE__);
if (do_munmap(mm, param.vir_addr, param.size) < 0) {
printk(KERN_INFO "do_munmap() failed - MEM_SHARE_FREE!!\n");
mutex_unlock(&mem_share_free_lock);
return -EINVAL;
}
param.vir_addr = 0;
DEBUG("do_munmap() succeed !! - MEM_SHARE_FREE\n");
if (copy_to_user((struct s3c_mem_alloc *)arg, ¶m,
sizeof(struct s3c_mem_alloc))) {
mutex_unlock(&mem_share_free_lock);
return -EFAULT;
}
mutex_unlock(&mem_share_free_lock);
break;
default:
DEBUG("s3c_mem_ioctl() : default !!\n");
return -EINVAL;
}
return 0;
}