diff options
Diffstat (limited to 'drivers/ieee1394/iso.h')
| -rw-r--r-- | drivers/ieee1394/iso.h | 87 | 
1 files changed, 49 insertions, 38 deletions
diff --git a/drivers/ieee1394/iso.h b/drivers/ieee1394/iso.h index 3efc60b33a88..1210a97e8685 100644 --- a/drivers/ieee1394/iso.h +++ b/drivers/ieee1394/iso.h  | |||
| @@ -12,33 +12,40 @@ | |||
| 12 | #ifndef IEEE1394_ISO_H | 12 | #ifndef IEEE1394_ISO_H | 
| 13 | #define IEEE1394_ISO_H | 13 | #define IEEE1394_ISO_H | 
| 14 | 14 | ||
| 15 | #include "hosts.h" | 15 | #include <linux/spinlock_types.h> | 
| 16 | #include <asm/atomic.h> | ||
| 17 | #include <asm/types.h> | ||
| 18 | |||
| 16 | #include "dma.h" | 19 | #include "dma.h" | 
| 17 | 20 | ||
| 18 | /* high-level ISO interface */ | 21 | struct hpsb_host; | 
| 19 | 22 | ||
| 20 | /* This API sends and receives isochronous packets on a large, | 23 | /* high-level ISO interface */ | 
| 21 | virtually-contiguous kernel memory buffer. The buffer may be mapped | ||
| 22 | into a user-space process for zero-copy transmission and reception. | ||
| 23 | 24 | ||
| 24 | There are no explicit boundaries between packets in the buffer. A | 25 | /* | 
| 25 | packet may be transmitted or received at any location. However, | 26 | * This API sends and receives isochronous packets on a large, | 
| 26 | low-level drivers may impose certain restrictions on alignment or | 27 | * virtually-contiguous kernel memory buffer. The buffer may be mapped | 
| 27 | size of packets. (e.g. in OHCI no packet may cross a page boundary, | 28 | * into a user-space process for zero-copy transmission and reception. | 
| 28 | and packets should be quadlet-aligned) | 29 | * | 
| 29 | */ | 30 | * There are no explicit boundaries between packets in the buffer. A | 
| 31 | * packet may be transmitted or received at any location. However, | ||
| 32 | * low-level drivers may impose certain restrictions on alignment or | ||
| 33 | * size of packets. (e.g. in OHCI no packet may cross a page boundary, | ||
| 34 | * and packets should be quadlet-aligned) | ||
| 35 | */ | ||
| 30 | 36 | ||
| 31 | /* Packet descriptor - the API maintains a ring buffer of these packet | 37 | /* Packet descriptor - the API maintains a ring buffer of these packet | 
| 32 | descriptors in kernel memory (hpsb_iso.infos[]). */ | 38 | * descriptors in kernel memory (hpsb_iso.infos[]). */ | 
| 33 | |||
| 34 | struct hpsb_iso_packet_info { | 39 | struct hpsb_iso_packet_info { | 
| 35 | /* offset of data payload relative to the first byte of the buffer */ | 40 | /* offset of data payload relative to the first byte of the buffer */ | 
| 36 | __u32 offset; | 41 | __u32 offset; | 
| 37 | 42 | ||
| 38 | /* length of the data payload, in bytes (not including the isochronous header) */ | 43 | /* length of the data payload, in bytes (not including the isochronous | 
| 44 | * header) */ | ||
| 39 | __u16 len; | 45 | __u16 len; | 
| 40 | 46 | ||
| 41 | /* (recv only) the cycle number (mod 8000) on which the packet was received */ | 47 | /* (recv only) the cycle number (mod 8000) on which the packet was | 
| 48 | * received */ | ||
| 42 | __u16 cycle; | 49 | __u16 cycle; | 
| 43 | 50 | ||
| 44 | /* (recv only) channel on which the packet was received */ | 51 | /* (recv only) channel on which the packet was received */ | 
| @@ -48,12 +55,10 @@ struct hpsb_iso_packet_info { | |||
| 48 | __u8 tag; | 55 | __u8 tag; | 
| 49 | __u8 sy; | 56 | __u8 sy; | 
| 50 | 57 | ||
| 51 | /* | 58 | /* length in bytes of the packet including header/trailer. | 
| 52 | * length in bytes of the packet including header/trailer. | 59 | * MUST be at structure end, since the first part of this structure is | 
| 53 | * MUST be at structure end, since the first part of this structure is also | 60 | * also defined in raw1394.h (i.e. struct raw1394_iso_packet_info), is | 
| 54 | * defined in raw1394.h (i.e. struct raw1394_iso_packet_info), is copied to | 61 | * copied to userspace and is accessed there through libraw1394. */ | 
| 55 | * userspace and is accessed there through libraw1394. | ||
| 56 | */ | ||
| 57 | __u16 total_len; | 62 | __u16 total_len; | 
| 58 | }; | 63 | }; | 
| 59 | 64 | ||
| @@ -75,8 +80,8 @@ struct hpsb_iso { | |||
| 75 | void *hostdata; | 80 | void *hostdata; | 
| 76 | 81 | ||
| 77 | /* a function to be called (from interrupt context) after | 82 | /* a function to be called (from interrupt context) after | 
| 78 | outgoing packets have been sent, or incoming packets have | 83 | * outgoing packets have been sent, or incoming packets have | 
| 79 | arrived */ | 84 | * arrived */ | 
| 80 | void (*callback)(struct hpsb_iso*); | 85 | void (*callback)(struct hpsb_iso*); | 
| 81 | 86 | ||
| 82 | /* wait for buffer space */ | 87 | /* wait for buffer space */ | 
| @@ -88,7 +93,7 @@ struct hpsb_iso { | |||
| 88 | 93 | ||
| 89 | 94 | ||
| 90 | /* greatest # of packets between interrupts - controls | 95 | /* greatest # of packets between interrupts - controls | 
| 91 | the maximum latency of the buffer */ | 96 | * the maximum latency of the buffer */ | 
| 92 | int irq_interval; | 97 | int irq_interval; | 
| 93 | 98 | ||
| 94 | /* the buffer for packet data payloads */ | 99 | /* the buffer for packet data payloads */ | 
| @@ -112,8 +117,8 @@ struct hpsb_iso { | |||
| 112 | int pkt_dma; | 117 | int pkt_dma; | 
| 113 | 118 | ||
| 114 | /* how many packets, starting at first_packet: | 119 | /* how many packets, starting at first_packet: | 
| 115 | (transmit) are ready to be filled with data | 120 | * (transmit) are ready to be filled with data | 
| 116 | (receive) contain received data */ | 121 | * (receive) contain received data */ | 
| 117 | int n_ready_packets; | 122 | int n_ready_packets; | 
| 118 | 123 | ||
| 119 | /* how many times the buffer has overflowed or underflowed */ | 124 | /* how many times the buffer has overflowed or underflowed */ | 
| @@ -134,7 +139,7 @@ struct hpsb_iso { | |||
| 134 | int start_cycle; | 139 | int start_cycle; | 
| 135 | 140 | ||
| 136 | /* cycle at which next packet will be transmitted, | 141 | /* cycle at which next packet will be transmitted, | 
| 137 | -1 if not known */ | 142 | * -1 if not known */ | 
| 138 | int xmit_cycle; | 143 | int xmit_cycle; | 
| 139 | 144 | ||
| 140 | /* ringbuffer of packet descriptors in regular kernel memory | 145 | /* ringbuffer of packet descriptors in regular kernel memory | 
| @@ -170,25 +175,30 @@ int hpsb_iso_recv_unlisten_channel(struct hpsb_iso *iso, unsigned char channel); | |||
| 170 | int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask); | 175 | int hpsb_iso_recv_set_channel_mask(struct hpsb_iso *iso, u64 mask); | 
| 171 | 176 | ||
| 172 | /* start/stop DMA */ | 177 | /* start/stop DMA */ | 
| 173 | int hpsb_iso_xmit_start(struct hpsb_iso *iso, int start_on_cycle, int prebuffer); | 178 | int hpsb_iso_xmit_start(struct hpsb_iso *iso, int start_on_cycle, | 
| 174 | int hpsb_iso_recv_start(struct hpsb_iso *iso, int start_on_cycle, int tag_mask, int sync); | 179 | int prebuffer); | 
| 180 | int hpsb_iso_recv_start(struct hpsb_iso *iso, int start_on_cycle, | ||
| 181 | int tag_mask, int sync); | ||
| 175 | void hpsb_iso_stop(struct hpsb_iso *iso); | 182 | void hpsb_iso_stop(struct hpsb_iso *iso); | 
| 176 | 183 | ||
| 177 | /* deallocate buffer and DMA context */ | 184 | /* deallocate buffer and DMA context */ | 
| 178 | void hpsb_iso_shutdown(struct hpsb_iso *iso); | 185 | void hpsb_iso_shutdown(struct hpsb_iso *iso); | 
| 179 | 186 | ||
| 180 | /* queue a packet for transmission. 'offset' is relative to the beginning of the | 187 | /* queue a packet for transmission. | 
| 181 | DMA buffer, where the packet's data payload should already have been placed */ | 188 | * 'offset' is relative to the beginning of the DMA buffer, where the packet's | 
| 182 | int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, u8 tag, u8 sy); | 189 | * data payload should already have been placed. */ | 
| 190 | int hpsb_iso_xmit_queue_packet(struct hpsb_iso *iso, u32 offset, u16 len, | ||
| 191 | u8 tag, u8 sy); | ||
| 183 | 192 | ||
| 184 | /* wait until all queued packets have been transmitted to the bus */ | 193 | /* wait until all queued packets have been transmitted to the bus */ | 
| 185 | int hpsb_iso_xmit_sync(struct hpsb_iso *iso); | 194 | int hpsb_iso_xmit_sync(struct hpsb_iso *iso); | 
| 186 | 195 | ||
| 187 | /* N packets have been read out of the buffer, re-use the buffer space */ | 196 | /* N packets have been read out of the buffer, re-use the buffer space */ | 
| 188 | int hpsb_iso_recv_release_packets(struct hpsb_iso *recv, unsigned int n_packets); | 197 | int hpsb_iso_recv_release_packets(struct hpsb_iso *recv, | 
| 198 | unsigned int n_packets); | ||
| 189 | 199 | ||
| 190 | /* check for arrival of new packets immediately (even if irq_interval | 200 | /* check for arrival of new packets immediately (even if irq_interval | 
| 191 | has not yet been reached) */ | 201 | * has not yet been reached) */ | 
| 192 | int hpsb_iso_recv_flush(struct hpsb_iso *iso); | 202 | int hpsb_iso_recv_flush(struct hpsb_iso *iso); | 
| 193 | 203 | ||
| 194 | /* returns # of packets ready to send or receive */ | 204 | /* returns # of packets ready to send or receive */ | 
| @@ -197,14 +207,15 @@ int hpsb_iso_n_ready(struct hpsb_iso *iso); | |||
| 197 | /* the following are callbacks available to low-level drivers */ | 207 | /* the following are callbacks available to low-level drivers */ | 
| 198 | 208 | ||
| 199 | /* call after a packet has been transmitted to the bus (interrupt context is OK) | 209 | /* call after a packet has been transmitted to the bus (interrupt context is OK) | 
| 200 | 'cycle' is the _exact_ cycle the packet was sent on | 210 | * 'cycle' is the _exact_ cycle the packet was sent on | 
| 201 | 'error' should be non-zero if some sort of error occurred when sending the packet | 211 | * 'error' should be non-zero if some sort of error occurred when sending the | 
| 202 | */ | 212 | * packet */ | 
| 203 | void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error); | 213 | void hpsb_iso_packet_sent(struct hpsb_iso *iso, int cycle, int error); | 
| 204 | 214 | ||
| 205 | /* call after a packet has been received (interrupt context OK) */ | 215 | /* call after a packet has been received (interrupt context OK) */ | 
| 206 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, | 216 | void hpsb_iso_packet_received(struct hpsb_iso *iso, u32 offset, u16 len, | 
| 207 | u16 total_len, u16 cycle, u8 channel, u8 tag, u8 sy); | 217 | u16 total_len, u16 cycle, u8 channel, u8 tag, | 
| 218 | u8 sy); | ||
| 208 | 219 | ||
| 209 | /* call to wake waiting processes after buffer space has opened up. */ | 220 | /* call to wake waiting processes after buffer space has opened up. */ | 
| 210 | void hpsb_iso_wake(struct hpsb_iso *iso); | 221 | void hpsb_iso_wake(struct hpsb_iso *iso); | 
