Lines Matching +full:fifo +full:- +full:size
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Sample fifo dma implementation
13 * This module shows how to handle fifo dma operations.
16 /* fifo size in elements (bytes) */
19 static struct kfifo fifo; variable
28 printk(KERN_INFO "DMA fifo test start\n"); in example_init()
30 if (kfifo_alloc(&fifo, FIFO_SIZE, GFP_KERNEL)) { in example_init()
32 return -ENOMEM; in example_init()
35 printk(KERN_INFO "queue size: %u\n", kfifo_size(&fifo)); in example_init()
37 kfifo_in(&fifo, "test", 4); in example_init()
40 kfifo_put(&fifo, i); in example_init()
43 kfifo_skip(&fifo); in example_init()
45 printk(KERN_INFO "queue len: %u\n", kfifo_len(&fifo)); in example_init()
50 * .--------------------------------------. in example_init()
52 * |---|------------------|---------------| in example_init()
63 nents = kfifo_dma_in_prepare(&fifo, sg, ARRAY_SIZE(sg), FIFO_SIZE); in example_init()
66 /* fifo is full and no sgl was created */ in example_init()
68 return -EIO; in example_init()
75 "sg[%d] -> " in example_init()
90 kfifo_dma_in_finish(&fifo, ret); in example_init()
93 nents = kfifo_dma_out_prepare(&fifo, sg, ARRAY_SIZE(sg), 8); in example_init()
98 return -EIO; in example_init()
104 "sg[%d] -> " in example_init()
119 kfifo_dma_out_finish(&fifo, ret); in example_init()
121 ret = kfifo_len(&fifo); in example_init()
122 printk(KERN_INFO "queue len: %u\n", kfifo_len(&fifo)); in example_init()
125 printk(KERN_WARNING "size mismatch: test failed"); in example_init()
126 return -EIO; in example_init()
135 kfifo_free(&fifo); in example_exit()