• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/components/opensource/linux/linux-2.6.36/drivers/ieee1394/

Lines Matching defs:iso

18 #include "iso.h"
23 void hpsb_iso_stop(struct hpsb_iso *iso)
25 if (!(iso->flags & HPSB_ISO_DRIVER_STARTED))
28 iso->host->driver->isoctl(iso, iso->type == HPSB_ISO_XMIT ?
30 iso->flags &= ~HPSB_ISO_DRIVER_STARTED;
36 void hpsb_iso_shutdown(struct hpsb_iso *iso)
38 if (iso->flags & HPSB_ISO_DRIVER_INIT) {
39 hpsb_iso_stop(iso);
40 iso->host->driver->isoctl(iso, iso->type == HPSB_ISO_XMIT ?
42 iso->flags &= ~HPSB_ISO_DRIVER_INIT;
45 dma_region_free(&iso->data_buf);
46 kfree(iso);
58 struct hpsb_iso *iso;
92 iso =
93 kmalloc(sizeof(*iso) +
96 if (!iso)
99 iso->infos = (struct hpsb_iso_packet_info *)(iso + 1);
101 iso->type = type;
102 iso->host = host;
103 iso->hostdata = NULL;
104 iso->callback = callback;
105 init_waitqueue_head(&iso->waitq);
106 iso->channel = channel;
107 iso->irq_interval = irq_interval;
108 iso->dma_mode = dma_mode;
109 dma_region_init(&iso->data_buf);
110 iso->buf_size = PAGE_ALIGN(data_buf_size);
111 iso->buf_packets = buf_packets;
112 iso->pkt_dma = 0;
113 iso->first_packet = 0;
114 spin_lock_init(&iso->lock);
116 if (iso->type == HPSB_ISO_XMIT) {
117 iso->n_ready_packets = iso->buf_packets;
120 iso->n_ready_packets = 0;
124 atomic_set(&iso->overflows, 0);
125 iso->bytes_discarded = 0;
126 iso->flags = 0;
127 iso->prebuffer = 0;
131 (&iso->data_buf, iso->buf_size, host->pdev, dma_direction))
134 return iso;
137 hpsb_iso_shutdown(iso);
144 int hpsb_iso_n_ready(struct hpsb_iso *iso)
149 spin_lock_irqsave(&iso->lock, flags);
150 val = iso->n_ready_packets;
151 spin_unlock_irqrestore(&iso->lock, flags);
167 struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_XMIT,
172 if (!iso)
175 iso->speed = speed;
178 if (host->driver->isoctl(iso, XMIT_INIT, 0))
181 iso->flags |= HPSB_ISO_DRIVER_INIT;
182 return iso;
185 hpsb_iso_shutdown(iso);
202 struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_RECV,
206 if (!iso)
210 if (host->driver->isoctl(iso, RECV_INIT, 0))
213 iso->flags |= HPSB_ISO_DRIVER_INIT;
214 return iso;
217 hpsb_iso_shutdown(iso);
226 int hpsb_iso_recv_listen_channel(struct hpsb_iso *iso, unsigned char channel)
228 if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)
230 return iso->host->driver->isoctl(iso, RECV_LISTEN_CHANNEL, channel);
238 int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel)
240 if (iso->type != HPSB_ISO_RECV || iso->channel != -1 || channel >= 64)
242 return iso->host->driver->isoctl(iso, RECV_UNLISTEN_CHANNEL, channel);
250 int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask)
252 if (iso->type != HPSB_ISO_RECV || iso->channel != -1)
254 return iso->host->driver->isoctl(iso, RECV_SET_CHANNEL_MASK,
264 int hpsb_iso_recv_flush(struct hpsb_iso *iso)
266 if (iso->type != HPSB_ISO_RECV)
268 return iso->host->driver->isoctl(iso, RECV_FLUSH, 0);
271 static int do_iso_xmit_start(struct hpsb_iso *iso, int cycle)
273 int retval = iso->host->driver->isoctl(iso, XMIT_START, cycle);
277 iso->flags |= HPSB_ISO_DRIVER_STARTED;
284 int hpsb_iso_xmit_start(struct hpsb_iso *iso, int cycle, int prebuffer)
286 if (iso->type != HPSB_ISO_XMIT)
289 if (iso->flags & HPSB_ISO_DRIVER_STARTED)
297 iso->xmit_cycle = cycle;
300 prebuffer = iso->buf_packets - 1;
304 if (prebuffer >= iso->buf_packets)
305 prebuffer = iso->buf_packets - 1;
307 iso->prebuffer = prebuffer;
311 iso->start_cycle = cycle;
319 int hpsb_iso_recv_start(struct hpsb_iso *iso, int cycle, int tag_mask, int sync)
324 if (iso->type != HPSB_ISO_RECV)
327 if (iso->flags & HPSB_ISO_DRIVER_STARTED)
345 iso->host->driver->isoctl(iso, RECV_START,
350 iso->flags |= HPSB_ISO_DRIVER_STARTED;
356 static int hpsb_iso_check_offset_len(struct hpsb_iso *iso,
361 if (offset >= iso->buf_size)
365 if (offset + len > iso->buf_size)
385 int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len,
392 if (iso->type != HPSB_ISO_XMIT)
396 if (iso->n_ready_packets <= 0) {
400 info = &iso->infos[iso->first_packet];
404 (iso, offset, len, &info->offset, &info->len))
410 spin_lock_irqsave(&iso->lock, flags);
412 rv = iso->host->driver->isoctl(iso, XMIT_QUEUE, (unsigned long)info);
417 iso->first_packet = (iso->first_packet + 1) % iso->buf_packets;
418 iso->xmit_cycle = (iso->xmit_cycle + 1) % 8000;
419 iso->n_ready_packets--;
421 if (iso->prebuffer != 0) {
422 iso->prebuffer--;
423 if (iso->prebuffer <= 0) {
424 iso->prebuffer = 0;
425 rv = do_iso_xmit_start(iso, iso->start_cycle);
430 spin_unlock_irqrestore(&iso->lock, flags);
437 int hpsb_iso_xmit_sync(struct hpsb_iso *iso)
439 if (iso->type != HPSB_ISO_XMIT)
442 return wait_event_interruptible(iso->waitq,
443 hpsb_iso_n_ready(iso) ==
444 iso->buf_packets);
456 void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error)
459 spin_lock_irqsave(&iso->lock, flags);
464 cycle += iso->buf_packets - iso->n_ready_packets;
467 iso->xmit_cycle = cycle;
468 iso->n_ready_packets++;
469 iso->pkt_dma = (iso->pkt_dma + 1) % iso->buf_packets;
471 if (iso->n_ready_packets == iso->buf_packets || error != 0) {
473 atomic_inc(&iso->overflows);
476 spin_unlock_irqrestore(&iso->lock, flags);
486 void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,
491 spin_lock_irqsave(&iso->lock, flags);
493 if (iso->n_ready_packets == iso->buf_packets) {
495 atomic_inc(&iso->overflows);
497 iso->bytes_discarded += total_len;
499 struct hpsb_iso_packet_info *info = &iso->infos[iso->pkt_dma];
508 iso->pkt_dma = (iso->pkt_dma + 1) % iso->buf_packets;
509 iso->n_ready_packets++;
512 spin_unlock_irqrestore(&iso->lock, flags);
520 int hpsb_iso_recv_release_packets(struct hpsb_iso *iso, unsigned int n_packets)
526 if (iso->type != HPSB_ISO_RECV)
529 spin_lock_irqsave(&iso->lock, flags);
531 rv = iso->host->driver->isoctl(iso, RECV_RELEASE,
532 (unsigned long)&iso->infos[iso->
537 iso->first_packet = (iso->first_packet + 1) % iso->buf_packets;
538 iso->n_ready_packets--;
541 if (iso->n_ready_packets == 0) { /* Release only after all prior packets handled */
542 if (iso->bytes_discarded != 0) {
544 inf.total_len = iso->bytes_discarded;
545 iso->host->driver->isoctl(iso, RECV_RELEASE,
547 iso->bytes_discarded = 0;
551 spin_unlock_irqrestore(&iso->lock, flags);
562 void hpsb_iso_wake(struct hpsb_iso *iso)
564 wake_up_interruptible(&iso->waitq);
566 if (iso->callback)
567 iso->callback(iso);