Lines Matching +full:fifo +full:- +full:size

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Sample fifo dma implementation
14 * This module shows how to handle fifo dma operations.
17 /* fifo size in elements (bytes) */
20 static struct kfifo fifo; variable
29 printk(KERN_INFO "DMA fifo test start\n"); in example_init()
31 if (kfifo_alloc(&fifo, FIFO_SIZE, GFP_KERNEL)) { in example_init()
33 return -ENOMEM; in example_init()
36 printk(KERN_INFO "queue size: %u\n", kfifo_size(&fifo)); in example_init()
38 kfifo_in(&fifo, "test", 4); in example_init()
41 kfifo_put(&fifo, i); in example_init()
44 kfifo_skip(&fifo); in example_init()
46 printk(KERN_INFO "queue len: %u\n", kfifo_len(&fifo)); in example_init()
51 * .--------------------------------------. in example_init()
53 * |---|------------------|---------------| in example_init()
64 nents = kfifo_dma_in_prepare(&fifo, sg, ARRAY_SIZE(sg), FIFO_SIZE); in example_init()
67 /* fifo is full and no sgl was created */ in example_init()
69 return -EIO; in example_init()
76 "sg[%d] -> " in example_init()
91 kfifo_dma_in_finish(&fifo, ret); in example_init()
94 nents = kfifo_dma_out_prepare(&fifo, sg, ARRAY_SIZE(sg), 8); in example_init()
99 return -EIO; in example_init()
105 "sg[%d] -> " in example_init()
120 kfifo_dma_out_finish(&fifo, ret); in example_init()
122 ret = kfifo_len(&fifo); in example_init()
123 printk(KERN_INFO "queue len: %u\n", kfifo_len(&fifo)); in example_init()
126 printk(KERN_WARNING "size mismatch: test failed"); in example_init()
127 return -EIO; in example_init()
136 kfifo_free(&fifo); in example_exit()
141 MODULE_DESCRIPTION("Sample fifo dma implementation");