Lines Matching defs:buf

55 void saa7164_buffer_display(struct saa7164_buffer *buf)
57 struct saa7164_dev *dev = buf->port->dev;
61 __func__, buf, buf->idx);
63 buf->cpu, (long long)buf->dma, buf->pci_size);
65 buf->pt_cpu, (long long)buf->pt_dma, buf->pt_size);
71 i, buf->pt_cpu, (u64)*(buf->pt_cpu));
82 struct saa7164_buffer *buf = NULL;
91 buf = kzalloc(sizeof(*buf), GFP_KERNEL);
92 if (!buf)
95 buf->idx = -1;
96 buf->port = port;
97 buf->flags = SAA7164_BUFFER_FREE;
98 buf->pos = 0;
99 buf->actual_size = params->pitch * params->numberoflines;
100 buf->crc = 0;
102 buf->pci_size = SAA7164_PT_ENTRIES * 0x1000;
103 buf->pt_size = (SAA7164_PT_ENTRIES * sizeof(u64)) + 0x1000;
106 buf->cpu = dma_alloc_coherent(&port->dev->pci->dev, buf->pci_size,
107 &buf->dma, GFP_KERNEL);
108 if (!buf->cpu)
111 buf->pt_cpu = dma_alloc_coherent(&port->dev->pci->dev, buf->pt_size,
112 &buf->pt_dma, GFP_KERNEL);
113 if (!buf->pt_cpu)
117 memset(buf->cpu, 0xff, buf->pci_size);
118 buf->crc = crc32(0, buf->cpu, buf->actual_size);
119 memset(buf->pt_cpu, 0xff, buf->pt_size);
122 __func__, buf, params->numpagetables);
124 buf->cpu, (long)buf->dma, buf->pci_size);
126 buf->pt_cpu, (long)buf->pt_dma, buf->pt_size);
131 *(buf->pt_cpu + i) = buf->dma + (i * 0x1000); /* TODO */
133 i, buf->pt_cpu, (u64)*(buf->pt_cpu));
140 dma_free_coherent(&port->dev->pci->dev, buf->pci_size, buf->cpu,
141 buf->dma);
143 kfree(buf);
145 buf = NULL;
147 return buf;
150 int saa7164_buffer_dealloc(struct saa7164_buffer *buf)
154 if (!buf || !buf->port)
156 dev = buf->port->dev;
159 __func__, buf);
161 if (buf->flags != SAA7164_BUFFER_FREE)
164 dma_free_coherent(&dev->pci->dev, buf->pci_size, buf->cpu, buf->dma);
165 dma_free_coherent(&dev->pci->dev, buf->pt_size, buf->pt_cpu,
166 buf->pt_dma);
168 kfree(buf);
188 int saa7164_buffer_activate(struct saa7164_buffer *buf, int i)
190 struct saa7164_port *port = buf->port;
198 buf->idx = i; /* Note of which buffer list index position we occupy */
199 buf->flags = SAA7164_BUFFER_BUSY;
200 buf->pos = 0;
204 saa7164_writel(port->bufptr32h + ((sizeof(u32) * 2) * i), buf->pt_dma);
207 dprintk(DBGLVL_BUF, " buf[%d] offset 0x%llx (0x%x) buf 0x%llx/%llx (0x%x/%x) nr=%d\n",
208 buf->idx,
215 buf->idx);
224 struct saa7164_buffer *buf;
253 buf = list_entry(c, struct saa7164_buffer, list);
255 BUG_ON(buf->flags != SAA7164_BUFFER_FREE);
258 saa7164_buffer_activate(buf, i);
273 struct saa7164_user_buffer *buf;
275 buf = kzalloc(sizeof(*buf), GFP_KERNEL);
276 if (!buf)
279 buf->data = kzalloc(len, GFP_KERNEL);
281 if (!buf->data) {
282 kfree(buf);
286 buf->actual_size = len;
287 buf->pos = 0;
288 buf->crc = 0;
291 __func__, buf);
293 return buf;
296 void saa7164_buffer_dealloc_user(struct saa7164_user_buffer *buf)
298 if (!buf)
301 kfree(buf->data);
302 buf->data = NULL;
304 kfree(buf);