Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 219373
b: refs/heads/master
c: 12d3203
h: refs/heads/master
i:
  219371: c070270
v: v3
  • Loading branch information
Steven Toth authored and Mauro Carvalho Chehab committed Oct 21, 2010
1 parent 89c46ed commit 661bf7e
Show file tree
Hide file tree
Showing 6 changed files with 192 additions and 41 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46eeb8dd30d3651e6ea55c2e60594206cd591d79
refs/heads/master: 12d3203e39db306f56611b3f47ba425ca6a409f9
7 changes: 5 additions & 2 deletions trunk/drivers/media/video/saa7164/saa7164-buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port,
buf->flags = SAA7164_BUFFER_FREE;
buf->pos = 0;
buf->actual_size = params->pitch * params->numberoflines;
buf->crc = 0;
/* TODO: arg len is being ignored */
buf->pci_size = SAA7164_PT_ENTRIES * 0x1000;
buf->pt_size = (SAA7164_PT_ENTRIES * sizeof(u64)) + 0x1000;
Expand All @@ -129,8 +130,9 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port,
goto fail2;

/* init the buffers to a known pattern, easier during debugging */
memset(buf->cpu, 0xff, buf->pci_size);
memset(buf->pt_cpu, 0xff, buf->pt_size);
memset_io(buf->cpu, 0xff, buf->pci_size);
buf->crc = crc32(0, buf->cpu, buf->actual_size);
memset_io(buf->pt_cpu, 0xff, buf->pt_size);

dprintk(DBGLVL_BUF, "%s() allocated buffer @ 0x%p\n",
__func__, buf);
Expand Down Expand Up @@ -296,6 +298,7 @@ struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev, u

buf->actual_size = len;
buf->pos = 0;
buf->crc = 0;

dprintk(DBGLVL_BUF, "%s() allocated user buffer @ 0x%p\n",
__func__, buf);
Expand Down
46 changes: 23 additions & 23 deletions trunk/drivers/media/video/saa7164/saa7164-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,28 +217,28 @@ int saa7164_bus_set(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf)
dprintk(DBGLVL_BUS, "%s() tr4\n", __func__);

/* Split the msg into pieces as the ring wraps */
memcpy(bus->m_pdwSetRing + curr_swp, msg, space_rem);
memcpy(bus->m_pdwSetRing, (u8 *)msg + space_rem,
memcpy_toio(bus->m_pdwSetRing + curr_swp, msg, space_rem);
memcpy_toio(bus->m_pdwSetRing, (u8 *)msg + space_rem,
sizeof(*msg) - space_rem);

memcpy(bus->m_pdwSetRing + sizeof(*msg) - space_rem,
memcpy_toio(bus->m_pdwSetRing + sizeof(*msg) - space_rem,
buf, msg->size);

} else if (space_rem == sizeof(*msg)) {
dprintk(DBGLVL_BUS, "%s() tr5\n", __func__);

/* Additional data at the beginning of the ring */
memcpy(bus->m_pdwSetRing + curr_swp, msg, sizeof(*msg));
memcpy(bus->m_pdwSetRing, buf, msg->size);
memcpy_toio(bus->m_pdwSetRing + curr_swp, msg, sizeof(*msg));
memcpy_toio(bus->m_pdwSetRing, buf, msg->size);

} else {
/* Additional data wraps around the ring */
memcpy(bus->m_pdwSetRing + curr_swp, msg, sizeof(*msg));
memcpy_toio(bus->m_pdwSetRing + curr_swp, msg, sizeof(*msg));
if (msg->size > 0) {
memcpy(bus->m_pdwSetRing + curr_swp +
memcpy_toio(bus->m_pdwSetRing + curr_swp +
sizeof(*msg), buf, space_rem -
sizeof(*msg));
memcpy(bus->m_pdwSetRing, (u8 *)buf +
memcpy_toio(bus->m_pdwSetRing, (u8 *)buf +
space_rem - sizeof(*msg),
bytes_to_write - space_rem);
}
Expand All @@ -250,8 +250,8 @@ int saa7164_bus_set(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf)
dprintk(DBGLVL_BUS, "%s() tr6\n", __func__);

/* The ring buffer doesn't wrap, two simple copies */
memcpy(bus->m_pdwSetRing + curr_swp, msg, sizeof(*msg));
memcpy(bus->m_pdwSetRing + curr_swp + sizeof(*msg), buf,
memcpy_toio(bus->m_pdwSetRing + curr_swp, msg, sizeof(*msg));
memcpy_toio(bus->m_pdwSetRing + curr_swp + sizeof(*msg), buf,
msg->size);
}

Expand Down Expand Up @@ -343,19 +343,19 @@ int saa7164_bus_get(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf,
new_grp -= bus->m_dwSizeGetRing;
space_rem = bus->m_dwSizeGetRing - curr_grp;

memcpy(&msg_tmp, bus->m_pdwGetRing + curr_grp, space_rem);
memcpy((u8 *)&msg_tmp + space_rem, bus->m_pdwGetRing,
memcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, space_rem);
memcpy_fromio((u8 *)&msg_tmp + space_rem, bus->m_pdwGetRing,
bytes_to_read - space_rem);

} else {
/* No wrapping */
memcpy(&msg_tmp, bus->m_pdwGetRing + curr_grp, bytes_to_read);
memcpy_fromio(&msg_tmp, bus->m_pdwGetRing + curr_grp, bytes_to_read);
}

/* No need to update the read positions, because this was a peek */
/* If the caller specifically want to peek, return */
if (peekonly) {
memcpy(msg, &msg_tmp, sizeof(*msg));
memcpy_fromio(msg, &msg_tmp, sizeof(*msg));
goto peekout;
}

Expand Down Expand Up @@ -401,24 +401,24 @@ int saa7164_bus_get(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf,

if (space_rem < sizeof(*msg)) {
/* msg wraps around the ring */
memcpy(msg, bus->m_pdwGetRing + curr_grp, space_rem);
memcpy((u8 *)msg + space_rem, bus->m_pdwGetRing,
memcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, space_rem);
memcpy_fromio((u8 *)msg + space_rem, bus->m_pdwGetRing,
sizeof(*msg) - space_rem);
if (buf)
memcpy(buf, bus->m_pdwGetRing + sizeof(*msg) -
memcpy_fromio(buf, bus->m_pdwGetRing + sizeof(*msg) -
space_rem, buf_size);

} else if (space_rem == sizeof(*msg)) {
memcpy(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));
memcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));
if (buf)
memcpy(buf, bus->m_pdwGetRing, buf_size);
} else {
/* Additional data wraps around the ring */
memcpy(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));
memcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));
if (buf) {
memcpy(buf, bus->m_pdwGetRing + curr_grp +
memcpy_fromio(buf, bus->m_pdwGetRing + curr_grp +
sizeof(*msg), space_rem - sizeof(*msg));
memcpy(buf + space_rem - sizeof(*msg),
memcpy_fromio(buf + space_rem - sizeof(*msg),
bus->m_pdwGetRing, bytes_to_read -
space_rem);
}
Expand All @@ -427,9 +427,9 @@ int saa7164_bus_get(struct saa7164_dev *dev, tmComResInfo_t* msg, void *buf,

} else {
/* No wrapping */
memcpy(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));
memcpy_fromio(msg, bus->m_pdwGetRing + curr_grp, sizeof(*msg));
if (buf)
memcpy(buf, bus->m_pdwGetRing + curr_grp + sizeof(*msg),
memcpy_fromio(buf, bus->m_pdwGetRing + curr_grp + sizeof(*msg),
buf_size);
}

Expand Down
Loading

0 comments on commit 661bf7e

Please sign in to comment.