1
2
3
4
5
6
7
8
9
10
11
12#ifndef IEEE1394_ISO_H
13#define IEEE1394_ISO_H
14
15#include <linux/spinlock_types.h>
16#include <linux/wait.h>
17#include <asm/atomic.h>
18#include <asm/types.h>
19
20#include "dma.h"
21
22struct hpsb_host;
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40struct hpsb_iso_packet_info {
41
42 __u32 offset;
43
44
45
46 __u16 len;
47
48
49
50 __u16 cycle;
51
52
53 __u8 channel;
54
55
56 __u8 tag;
57 __u8 sy;
58
59
60
61
62
63 __u16 total_len;
64};
65
66enum hpsb_iso_type { HPSB_ISO_RECV = 0, HPSB_ISO_XMIT = 1 };
67
68
69enum raw1394_iso_dma_recv_mode {
70 HPSB_ISO_DMA_DEFAULT = -1,
71 HPSB_ISO_DMA_OLD_ABI = 0,
72 HPSB_ISO_DMA_BUFFERFILL = 1,
73 HPSB_ISO_DMA_PACKET_PER_BUFFER = 2
74};
75
76struct hpsb_iso {
77 enum hpsb_iso_type type;
78
79
80 struct hpsb_host *host;
81 void *hostdata;
82
83
84
85
86 void (*callback)(struct hpsb_iso*);
87
88
89 wait_queue_head_t waitq;
90
91 int speed;
92 int channel;
93 int dma_mode;
94
95
96
97
98 int irq_interval;
99
100
101 struct dma_region data_buf;
102
103
104 unsigned int buf_size;
105
106
107 unsigned int buf_packets;
108
109
110 spinlock_t lock;
111
112
113
114 int first_packet;
115
116
117
118 int pkt_dma;
119
120
121
122
123 int n_ready_packets;
124
125
126 atomic_t overflows;
127
128 atomic_t skips;
129
130
131 int bytes_discarded;
132
133
134#define HPSB_ISO_DRIVER_INIT (1<<0)
135#define HPSB_ISO_DRIVER_STARTED (1<<1)
136 unsigned int flags;
137
138
139 int prebuffer;
140
141
142 int start_cycle;
143
144
145
146 int xmit_cycle;
147
148
149
150
151 struct hpsb_iso_packet_info *infos;
152};
153
154
155
156struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host,
157 unsigned int data_buf_size,
158 unsigned int buf_packets,
159 int channel,
160 int speed,
161 int irq_interval,
162 void (*callback)(struct hpsb_iso*));
163struct hpsb_iso* hpsb_iso_recv_init(struct hpsb_host *host,
164 unsigned int data_buf_size,
165 unsigned int buf_packets,
166 int channel,
167 int dma_mode,
168 int irq_interval,
169 void (*callback)(struct hpsb_iso*));
170int hpsb_iso_recv_listen_channel(struct hpsb_iso *iso, unsigned char channel);
171int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel);
172int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask);
173int hpsb_iso_xmit_start(struct hpsb_iso *iso, int start_on_cycle,
174 int prebuffer);
175int hpsb_iso_recv_start(struct hpsb_iso *iso, int start_on_cycle,
176 int tag_mask, int sync);
177void hpsb_iso_stop(struct hpsb_iso *iso);
178void hpsb_iso_shutdown(struct hpsb_iso *iso);
179int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len,
180 u8 tag, u8 sy);
181int hpsb_iso_xmit_sync(struct hpsb_iso *iso);
182int hpsb_iso_recv_release_packets(struct hpsb_iso *recv,
183 unsigned int n_packets);
184int hpsb_iso_recv_flush(struct hpsb_iso *iso);
185int hpsb_iso_n_ready(struct hpsb_iso *iso);
186
187
188
189void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error);
190void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len,
191 u16 total_len, u16 cycle, u8 channel, u8 tag,
192 u8 sy);
193void hpsb_iso_wake(struct hpsb_iso *iso);
194
195#endif
196