4 * Copyright (c) 2008 Henrik Kurelid <henrik@kurelid.se>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
14 static void rawiso_activity_cb(struct hpsb_iso
*iso
);
16 void tear_down_iso_channel(struct firesat
*firesat
)
18 if (firesat
->iso_handle
!= NULL
) {
19 hpsb_iso_stop(firesat
->iso_handle
);
20 hpsb_iso_shutdown(firesat
->iso_handle
);
22 firesat
->iso_handle
= NULL
;
25 int setup_iso_channel(struct firesat
*firesat
)
29 hpsb_iso_recv_init(firesat
->host
,
30 256 * 200, //data_buf_size,
33 HPSB_ISO_DMA_DEFAULT
, //dma_mode,
34 -1, //stat.config.irq_interval,
36 if (firesat
->iso_handle
== NULL
) {
37 printk(KERN_ERR
"Cannot initialize iso receive.\n");
40 result
= hpsb_iso_recv_start(firesat
->iso_handle
, -1, -1, 0);
42 printk(KERN_ERR
"Cannot start iso receive.\n");
48 static void rawiso_activity_cb(struct hpsb_iso
*iso
)
55 struct firesat
*firesat
= NULL
;
56 struct firesat
*firesat_iterator
;
58 spin_lock_irqsave(&firesat_list_lock
, flags
);
59 list_for_each_entry(firesat_iterator
, &firesat_list
, list
) {
60 if(firesat_iterator
->iso_handle
== iso
) {
61 firesat
= firesat_iterator
;
65 spin_unlock_irqrestore(&firesat_list_lock
, flags
);
68 packet
= iso
->first_packet
;
69 num
= hpsb_iso_n_ready(iso
);
70 for (i
= 0; i
< num
; i
++,
71 packet
= (packet
+ 1) % iso
->buf_packets
) {
73 dma_region_i(&iso
->data_buf
, unsigned char,
74 iso
->infos
[packet
].offset
+
75 sizeof(struct CIPHeader
));
76 int count
= (iso
->infos
[packet
].len
-
77 sizeof(struct CIPHeader
)) /
78 (188 + sizeof(struct firewireheader
));
79 if (iso
->infos
[packet
].len
<= sizeof(struct CIPHeader
))
80 continue; // ignore empty packet
81 /* printk("%s: Handling packets (%d): ", __func__, */
82 /* iso->infos[packet].len); */
83 /* for (j = 0; j < iso->infos[packet].len - */
84 /* sizeof(struct CIPHeader); j++) */
85 /* printk("%02X,", buf[j]); */
88 if (buf
[sizeof(struct firewireheader
)] == 0x47)
89 dvb_dmx_swfilter_packets(&firesat
->demux
,
90 &buf
[sizeof(struct firewireheader
)], 1);
92 printk("%s: invalid packet, skipping\n", __func__
);
93 buf
+= 188 + sizeof(struct firewireheader
);
98 hpsb_iso_recv_release_packets(iso
, num
);
101 printk("%s: packets for unknown iso channel, skipping\n",
103 hpsb_iso_recv_release_packets(iso
, hpsb_iso_n_ready(iso
));