Author: hogsberg
Date: 2002-08-25 23:43:23 -0400 (Sun, 25 Aug 2002)
New Revision: 554
Modified:
trunk/amdtp.c
Log:
Implemented poll and tried to make DMA continue over bus resets.
Modified: trunk/amdtp.c
==============================================================================
--- trunk/amdtp.c (original)
+++ trunk/amdtp.c 2002-08-25 23:43:24.000000000 -0400
@@ -46,8 +46,6 @@
*
* - Fix DMA stop after bus reset!
*
- * - Implement poll.
- *
* - Clean up iso context handling in ohci1394.
*
*
@@ -75,6 +73,7 @@
#include <linux/wait.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
+#include <linux/poll.h>
#include <asm/uaccess.h>
#include <asm/atomic.h>
@@ -398,6 +397,7 @@
if (pl->link.prev != &s->dma_packet_lists) {
struct packet *last = &prev->packets[PACKET_LIST_SIZE - 1];
last->db->payload_desc.branch = pl->packets[0].db_bus | 3;
+ last->db->header_desc.skip = pl->packets[0].db_bus | 3;
ohci1394_wake_it_ctx(s->host->ohci, s->iso_context);
}
else
@@ -569,18 +569,19 @@
p->db->header_desc.control =
DMA_CTL_OUTPUT_MORE | DMA_CTL_IMMEDIATE | 8;
- p->db->header_desc.skip = 0;
if (next) {
p->db->payload_desc.control =
DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH;
p->db->payload_desc.branch = next->db_bus | 3;
+ p->db->header_desc.skip = next->db_bus | 3;
}
else {
p->db->payload_desc.control =
DMA_CTL_OUTPUT_LAST | DMA_CTL_BRANCH |
DMA_CTL_UPDATE | DMA_CTL_IRQ;
p->db->payload_desc.branch = 0;
+ p->db->header_desc.skip = 0;
}
p->db->payload_desc.data_address = p->payload_bus;
p->db->payload_desc.status = 0;
@@ -1144,8 +1145,13 @@
stream_flush(s);
- if (s->current_packet_list == NULL &&
- wait_event_interruptible(s->packet_list_wait,
+ if (s->current_packet_list != NULL)
+ continue;
+
+ if (file->f_flags & O_NONBLOCK)
+ return i + length > 0 ? i + length : -EAGAIN;
+
+ if (wait_event_interruptible(s->packet_list_wait,
!list_empty(&s->free_packet_lists)))
return -EINTR;
}
@@ -1158,7 +1164,6 @@
{
struct stream *s = file->private_data;
struct amdtp_ioctl cfg;
- int new;
switch(cmd)
{
@@ -1169,23 +1174,23 @@
else
return stream_configure(s, cmd, &cfg);
- case AMDTP_IOC_PING:
- HPSB_INFO("ping: offsetting timpestamps %ld ticks", arg);
- new = s->cycle_offset.integer + arg;
- s->cycle_offset.integer = new % 3072;
- atomic_add(new / 3072, &s->cycle_count);
- return 0;
-
- case AMDTP_IOC_ZAP:
- while (MOD_IN_USE)
- MOD_DEC_USE_COUNT;
- return 0;
-
default:
return -EINVAL;
}
}
+static unsigned int amdtp_poll(struct file *file, poll_table *pt)
+{
+ struct stream *s = file->private_data;
+
+ poll_wait(file, &s->packet_list_wait, pt);
+
+ if (!list_empty(&s->free_packet_lists))
+ return POLLOUT | POLLWRNORM;
+ else
+ return 0;
+}
+
static int amdtp_open(struct inode *inode, struct file *file)
{
struct amdtp_host *host;
@@ -1221,6 +1226,7 @@
{
.owner = THIS_MODULE,
.write = amdtp_write,
+ .poll = amdtp_poll,
.ioctl = amdtp_ioctl,
.open = amdtp_open,
.release = amdtp_release
@@ -1232,7 +1238,8 @@
{
struct amdtp_host *ah;
- /* FIXME: check it's an ohci host. */
+ if (strcmp(host->driver->name, OHCI1394_DRIVER_NAME) != 0)
+ return;
ah = kmalloc(sizeof *ah, SLAB_KERNEL);
ah->host = host;
|