Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


firewire-cdev.h
0001: /*
0002:  * Char device interface.
0003:  *
0004:  * Copyright (C) 2005-2007  Kristian Hoegsberg <krh@bitplanet.net>
0005:  *
0006:  * Permission is hereby granted, free of charge, to any person obtaining a
0007:  * copy of this software and associated documentation files (the "Software"),
0008:  * to deal in the Software without restriction, including without limitation
0009:  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0010:  * and/or sell copies of the Software, and to permit persons to whom the
0011:  * Software is furnished to do so, subject to the following conditions:
0012:  *
0013:  * The above copyright notice and this permission notice (including the next
0014:  * paragraph) shall be included in all copies or substantial portions of the
0015:  * Software.
0016:  *
0017:  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0018:  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0019:  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0020:  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
0021:  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0022:  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
0023:  * DEALINGS IN THE SOFTWARE.
0024:  */
0025: 
0026: #ifndef _LINUX_FIREWIRE_CDEV_H
0027: #define _LINUX_FIREWIRE_CDEV_H
0028: 
0029: #include <linux/ioctl.h>
0030: #include <linux/types.h>
0031: #include <linux/firewire-constants.h>
0032: 
0033: /* available since kernel version 2.6.22 */
0034: #define FW_CDEV_EVENT_BUS_RESET                         0x00
0035: #define FW_CDEV_EVENT_RESPONSE                          0x01
0036: #define FW_CDEV_EVENT_REQUEST                           0x02
0037: #define FW_CDEV_EVENT_ISO_INTERRUPT                     0x03
0038: 
0039: /* available since kernel version 2.6.30 */
0040: #define FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED            0x04
0041: #define FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED          0x05
0042: 
0043: /* available since kernel version 2.6.36 */
0044: #define FW_CDEV_EVENT_REQUEST2                          0x06
0045: #define FW_CDEV_EVENT_PHY_PACKET_SENT                   0x07
0046: #define FW_CDEV_EVENT_PHY_PACKET_RECEIVED               0x08
0047: #define FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL        0x09
0048: 
0049: /**
0050:  * struct fw_cdev_event_common - Common part of all fw_cdev_event_ types
0051:  * @closure:    For arbitrary use by userspace
0052:  * @type:       Discriminates the fw_cdev_event_ types
0053:  *
0054:  * This struct may be used to access generic members of all fw_cdev_event_
0055:  * types regardless of the specific type.
0056:  *
0057:  * Data passed in the @closure field for a request will be returned in the
0058:  * corresponding event.  It is big enough to hold a pointer on all platforms.
0059:  * The ioctl used to set @closure depends on the @type of event.
0060:  */
0061: struct fw_cdev_event_common {
0062:         __u64 closure;
0063:         __u32 type;
0064: };
0065: 
0066: /**
0067:  * struct fw_cdev_event_bus_reset - Sent when a bus reset occurred
0068:  * @closure:    See &fw_cdev_event_common; set by %FW_CDEV_IOC_GET_INFO ioctl
0069:  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_BUS_RESET
0070:  * @node_id:       New node ID of this node
0071:  * @local_node_id: Node ID of the local node, i.e. of the controller
0072:  * @bm_node_id:    Node ID of the bus manager
0073:  * @irm_node_id:   Node ID of the iso resource manager
0074:  * @root_node_id:  Node ID of the root node
0075:  * @generation:    New bus generation
0076:  *
0077:  * This event is sent when the bus the device belongs to goes through a bus
0078:  * reset.  It provides information about the new bus configuration, such as
0079:  * new node ID for this device, new root ID, and others.
0080:  *
0081:  * If @bm_node_id is 0xffff right after bus reset it can be reread by an
0082:  * %FW_CDEV_IOC_GET_INFO ioctl after bus manager selection was finished.
0083:  * Kernels with ABI version < 4 do not set @bm_node_id.
0084:  */
0085: struct fw_cdev_event_bus_reset {
0086:         __u64 closure;
0087:         __u32 type;
0088:         __u32 node_id;
0089:         __u32 local_node_id;
0090:         __u32 bm_node_id;
0091:         __u32 irm_node_id;
0092:         __u32 root_node_id;
0093:         __u32 generation;
0094: };
0095: 
0096: /**
0097:  * struct fw_cdev_event_response - Sent when a response packet was received
0098:  * @closure:    See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_REQUEST
0099:  *              or %FW_CDEV_IOC_SEND_BROADCAST_REQUEST
0100:  *              or %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl
0101:  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_RESPONSE
0102:  * @rcode:      Response code returned by the remote node
0103:  * @length:     Data length, i.e. the response's payload size in bytes
0104:  * @data:       Payload data, if any
0105:  *
0106:  * This event is sent when the stack receives a response to an outgoing request
0107:  * sent by %FW_CDEV_IOC_SEND_REQUEST ioctl.  The payload data for responses
0108:  * carrying data (read and lock responses) follows immediately and can be
0109:  * accessed through the @data field.
0110:  *
0111:  * The event is also generated after conclusions of transactions that do not
0112:  * involve response packets.  This includes unified write transactions,
0113:  * broadcast write transactions, and transmission of asynchronous stream
0114:  * packets.  @rcode indicates success or failure of such transmissions.
0115:  */
0116: struct fw_cdev_event_response {
0117:         __u64 closure;
0118:         __u32 type;
0119:         __u32 rcode;
0120:         __u32 length;
0121:         __u32 data[0];
0122: };
0123: 
0124: /**
0125:  * struct fw_cdev_event_request - Old version of &fw_cdev_event_request2
0126:  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST
0127:  *
0128:  * This event is sent instead of &fw_cdev_event_request2 if the kernel or
0129:  * the client implements ABI version <= 3.  &fw_cdev_event_request lacks
0130:  * essential information; use &fw_cdev_event_request2 instead.
0131:  */
0132: struct fw_cdev_event_request {
0133:         __u64 closure;
0134:         __u32 type;
0135:         __u32 tcode;
0136:         __u64 offset;
0137:         __u32 handle;
0138:         __u32 length;
0139:         __u32 data[0];
0140: };
0141: 
0142: /**
0143:  * struct fw_cdev_event_request2 - Sent on incoming request to an address region
0144:  * @closure:    See &fw_cdev_event_common; set by %FW_CDEV_IOC_ALLOCATE ioctl
0145:  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_REQUEST2
0146:  * @tcode:      Transaction code of the incoming request
0147:  * @offset:     The offset into the 48-bit per-node address space
0148:  * @source_node_id: Sender node ID
0149:  * @destination_node_id: Destination node ID
0150:  * @card:       The index of the card from which the request came
0151:  * @generation: Bus generation in which the request is valid
0152:  * @handle:     Reference to the kernel-side pending request
0153:  * @length:     Data length, i.e. the request's payload size in bytes
0154:  * @data:       Incoming data, if any
0155:  *
0156:  * This event is sent when the stack receives an incoming request to an address
0157:  * region registered using the %FW_CDEV_IOC_ALLOCATE ioctl.  The request is
0158:  * guaranteed to be completely contained in the specified region.  Userspace is
0159:  * responsible for sending the response by %FW_CDEV_IOC_SEND_RESPONSE ioctl,
0160:  * using the same @handle.
0161:  *
0162:  * The payload data for requests carrying data (write and lock requests)
0163:  * follows immediately and can be accessed through the @data field.
0164:  *
0165:  * Unlike &fw_cdev_event_request, @tcode of lock requests is one of the
0166:  * firewire-core specific %TCODE_LOCK_MASK_SWAP...%TCODE_LOCK_VENDOR_DEPENDENT,
0167:  * i.e. encodes the extended transaction code.
0168:  *
0169:  * @card may differ from &fw_cdev_get_info.card because requests are received
0170:  * from all cards of the Linux host.  @source_node_id, @destination_node_id, and
0171:  * @generation pertain to that card.  Destination node ID and bus generation may
0172:  * therefore differ from the corresponding fields of the last
0173:  * &fw_cdev_event_bus_reset.
0174:  *
0175:  * @destination_node_id may also differ from the current node ID because of a
0176:  * non-local bus ID part or in case of a broadcast write request.  Note, a
0177:  * client must call an %FW_CDEV_IOC_SEND_RESPONSE ioctl even in case of a
0178:  * broadcast write request; the kernel will then release the kernel-side pending
0179:  * request but will not actually send a response packet.
0180:  *
0181:  * In case of a write request to FCP_REQUEST or FCP_RESPONSE, the kernel already
0182:  * sent a write response immediately after the request was received; in this
0183:  * case the client must still call an %FW_CDEV_IOC_SEND_RESPONSE ioctl to
0184:  * release the kernel-side pending request, though another response won't be
0185:  * sent.
0186:  *
0187:  * If the client subsequently needs to initiate requests to the sender node of
0188:  * an &fw_cdev_event_request2, it needs to use a device file with matching
0189:  * card index, node ID, and generation for outbound requests.
0190:  */
0191: struct fw_cdev_event_request2 {
0192:         __u64 closure;
0193:         __u32 type;
0194:         __u32 tcode;
0195:         __u64 offset;
0196:         __u32 source_node_id;
0197:         __u32 destination_node_id;
0198:         __u32 card;
0199:         __u32 generation;
0200:         __u32 handle;
0201:         __u32 length;
0202:         __u32 data[0];
0203: };
0204: 
0205: /**
0206:  * struct fw_cdev_event_iso_interrupt - Sent when an iso packet was completed
0207:  * @closure:    See &fw_cdev_event_common;
0208:  *              set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
0209:  * @type:       See &fw_cdev_event_common; always %FW_CDEV_EVENT_ISO_INTERRUPT
0210:  * @cycle:      Cycle counter of the interrupt packet
0211:  * @header_length: Total length of following headers, in bytes
0212:  * @header:     Stripped headers, if any
0213:  *
0214:  * This event is sent when the controller has completed an &fw_cdev_iso_packet
0215:  * with the %FW_CDEV_ISO_INTERRUPT bit set.
0216:  *
0217:  * Isochronous transmit events (context type %FW_CDEV_ISO_CONTEXT_TRANSMIT):
0218:  *
0219:  * In version 3 and some implementations of version 2 of the ABI, &header_length
0220:  * is a multiple of 4 and &header contains timestamps of all packets up until
0221:  * the interrupt packet.  The format of the timestamps is as described below for
0222:  * isochronous reception.  In version 1 of the ABI, &header_length was 0.
0223:  *
0224:  * Isochronous receive events (context type %FW_CDEV_ISO_CONTEXT_RECEIVE):
0225:  *
0226:  * The headers stripped of all packets up until and including the interrupt
0227:  * packet are returned in the @header field.  The amount of header data per
0228:  * packet is as specified at iso context creation by
0229:  * &fw_cdev_create_iso_context.header_size.
0230:  *
0231:  * Hence, _interrupt.header_length / _context.header_size is the number of
0232:  * packets received in this interrupt event.  The client can now iterate
0233:  * through the mmap()'ed DMA buffer according to this number of packets and
0234:  * to the buffer sizes as the client specified in &fw_cdev_queue_iso.
0235:  *
0236:  * Since version 2 of this ABI, the portion for each packet in _interrupt.header
0237:  * consists of the 1394 isochronous packet header, followed by a timestamp
0238:  * quadlet if &fw_cdev_create_iso_context.header_size > 4, followed by quadlets
0239:  * from the packet payload if &fw_cdev_create_iso_context.header_size > 8.
0240:  *
0241:  * Format of 1394 iso packet header:  16 bits data_length, 2 bits tag, 6 bits
0242:  * channel, 4 bits tcode, 4 bits sy, in big endian byte order.
0243:  * data_length is the actual received size of the packet without the four
0244:  * 1394 iso packet header bytes.
0245:  *
0246:  * Format of timestamp:  16 bits invalid, 3 bits cycleSeconds, 13 bits
0247:  * cycleCount, in big endian byte order.
0248:  *
0249:  * In version 1 of the ABI, no timestamp quadlet was inserted; instead, payload
0250:  * data followed directly after the 1394 is header if header_size > 4.
0251:  * Behaviour of ver. 1 of this ABI is no longer available since ABI ver. 2.
0252:  */
0253: struct fw_cdev_event_iso_interrupt {
0254:         __u64 closure;
0255:         __u32 type;
0256:         __u32 cycle;
0257:         __u32 header_length;
0258:         __u32 header[0];
0259: };
0260: 
0261: /**
0262:  * struct fw_cdev_event_iso_interrupt_mc - An iso buffer chunk was completed
0263:  * @closure:    See &fw_cdev_event_common;
0264:  *              set by %FW_CDEV_CREATE_ISO_CONTEXT ioctl
0265:  * @type:       %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
0266:  * @completed:  Offset into the receive buffer; data before this offset is valid
0267:  *
0268:  * This event is sent in multichannel contexts (context type
0269:  * %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL) for &fw_cdev_iso_packet buffer
0270:  * chunks that have the %FW_CDEV_ISO_INTERRUPT bit set.  Whether this happens
0271:  * when a packet is completed and/or when a buffer chunk is completed depends
0272:  * on the hardware implementation.
0273:  *
0274:  * The buffer is continuously filled with the following data, per packet:
0275:  *  - the 1394 iso packet header as described at &fw_cdev_event_iso_interrupt,
0276:  *    but in little endian byte order,
0277:  *  - packet payload (as many bytes as specified in the data_length field of
0278:  *    the 1394 iso packet header) in big endian byte order,
0279:  *  - 0...3 padding bytes as needed to align the following trailer quadlet,
0280:  *  - trailer quadlet, containing the reception timestamp as described at
0281:  *    &fw_cdev_event_iso_interrupt, but in little endian byte order.
0282:  *
0283:  * Hence the per-packet size is data_length (rounded up to a multiple of 4) + 8.
0284:  * When processing the data, stop before a packet that would cross the
0285:  * @completed offset.
0286:  *
0287:  * A packet near the end of a buffer chunk will typically spill over into the
0288:  * next queued buffer chunk.  It is the responsibility of the client to check
0289:  * for this condition, assemble a broken-up packet from its parts, and not to
0290:  * re-queue any buffer chunks in which as yet unread packet parts reside.
0291:  */
0292: struct fw_cdev_event_iso_interrupt_mc {
0293:         __u64 closure;
0294:         __u32 type;
0295:         __u32 completed;
0296: };
0297: 
0298: /**
0299:  * struct fw_cdev_event_iso_resource - Iso resources were allocated or freed
0300:  * @closure:    See &fw_cdev_event_common;
0301:  *              set by %FW_CDEV_IOC_(DE)ALLOCATE_ISO_RESOURCE(_ONCE) ioctl
0302:  * @type:       %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
0303:  *              %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
0304:  * @handle:     Reference by which an allocated resource can be deallocated
0305:  * @channel:    Isochronous channel which was (de)allocated, if any
0306:  * @bandwidth:  Bandwidth allocation units which were (de)allocated, if any
0307:  *
0308:  * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event is sent after an isochronous
0309:  * resource was allocated at the IRM.  The client has to check @channel and
0310:  * @bandwidth for whether the allocation actually succeeded.
0311:  *
0312:  * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event is sent after an isochronous
0313:  * resource was deallocated at the IRM.  It is also sent when automatic
0314:  * reallocation after a bus reset failed.
0315:  *
0316:  * @channel is <0 if no channel was (de)allocated or if reallocation failed.
0317:  * @bandwidth is 0 if no bandwidth was (de)allocated or if reallocation failed.
0318:  */
0319: struct fw_cdev_event_iso_resource {
0320:         __u64 closure;
0321:         __u32 type;
0322:         __u32 handle;
0323:         __s32 channel;
0324:         __s32 bandwidth;
0325: };
0326: 
0327: /**
0328:  * struct fw_cdev_event_phy_packet - A PHY packet was transmitted or received
0329:  * @closure:    See &fw_cdev_event_common; set by %FW_CDEV_IOC_SEND_PHY_PACKET
0330:  *              or %FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl
0331:  * @type:       %FW_CDEV_EVENT_PHY_PACKET_SENT or %..._RECEIVED
0332:  * @rcode:      %RCODE_..., indicates success or failure of transmission
0333:  * @length:     Data length in bytes
0334:  * @data:       Incoming data
0335:  *
0336:  * If @type is %FW_CDEV_EVENT_PHY_PACKET_SENT, @length is 0 and @data empty,
0337:  * except in case of a ping packet:  Then, @length is 4, and @data[0] is the
0338:  * ping time in 49.152MHz clocks if @rcode is %RCODE_COMPLETE.
0339:  *
0340:  * If @type is %FW_CDEV_EVENT_PHY_PACKET_RECEIVED, @length is 8 and @data
0341:  * consists of the two PHY packet quadlets, in host byte order.
0342:  */
0343: struct fw_cdev_event_phy_packet {
0344:         __u64 closure;
0345:         __u32 type;
0346:         __u32 rcode;
0347:         __u32 length;
0348:         __u32 data[0];
0349: };
0350: 
0351: /**
0352:  * union fw_cdev_event - Convenience union of fw_cdev_event_ types
0353:  * @common:             Valid for all types
0354:  * @bus_reset:          Valid if @common.type == %FW_CDEV_EVENT_BUS_RESET
0355:  * @response:           Valid if @common.type == %FW_CDEV_EVENT_RESPONSE
0356:  * @request:            Valid if @common.type == %FW_CDEV_EVENT_REQUEST
0357:  * @request2:           Valid if @common.type == %FW_CDEV_EVENT_REQUEST2
0358:  * @iso_interrupt:      Valid if @common.type == %FW_CDEV_EVENT_ISO_INTERRUPT
0359:  * @iso_interrupt_mc:   Valid if @common.type ==
0360:  *                              %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL
0361:  * @iso_resource:       Valid if @common.type ==
0362:  *                              %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED or
0363:  *                              %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED
0364:  * @phy_packet:         Valid if @common.type ==
0365:  *                              %FW_CDEV_EVENT_PHY_PACKET_SENT or
0366:  *                              %FW_CDEV_EVENT_PHY_PACKET_RECEIVED
0367:  *
0368:  * Convenience union for userspace use.  Events could be read(2) into an
0369:  * appropriately aligned char buffer and then cast to this union for further
0370:  * processing.  Note that for a request, response or iso_interrupt event,
0371:  * the data[] or header[] may make the size of the full event larger than
0372:  * sizeof(union fw_cdev_event).  Also note that if you attempt to read(2)
0373:  * an event into a buffer that is not large enough for it, the data that does
0374:  * not fit will be discarded so that the next read(2) will return a new event.
0375:  */
0376: union fw_cdev_event {
0377:         struct fw_cdev_event_common             common;
0378:         struct fw_cdev_event_bus_reset          bus_reset;
0379:         struct fw_cdev_event_response           response;
0380:         struct fw_cdev_event_request            request;
0381:         struct fw_cdev_event_request2           request2;               /* added in 2.6.36 */
0382:         struct fw_cdev_event_iso_interrupt      iso_interrupt;
0383:         struct fw_cdev_event_iso_interrupt_mc   iso_interrupt_mc;       /* added in 2.6.36 */
0384:         struct fw_cdev_event_iso_resource       iso_resource;           /* added in 2.6.30 */
0385:         struct fw_cdev_event_phy_packet         phy_packet;             /* added in 2.6.36 */
0386: };
0387: 
0388: /* available since kernel version 2.6.22 */
0389: #define FW_CDEV_IOC_GET_INFO           _IOWR('#', 0x00, struct fw_cdev_get_info)
0390: #define FW_CDEV_IOC_SEND_REQUEST        _IOW('#', 0x01, struct fw_cdev_send_request)
0391: #define FW_CDEV_IOC_ALLOCATE           _IOWR('#', 0x02, struct fw_cdev_allocate)
0392: #define FW_CDEV_IOC_DEALLOCATE          _IOW('#', 0x03, struct fw_cdev_deallocate)
0393: #define FW_CDEV_IOC_SEND_RESPONSE       _IOW('#', 0x04, struct fw_cdev_send_response)
0394: #define FW_CDEV_IOC_INITIATE_BUS_RESET  _IOW('#', 0x05, struct fw_cdev_initiate_bus_reset)
0395: #define FW_CDEV_IOC_ADD_DESCRIPTOR     _IOWR('#', 0x06, struct fw_cdev_add_descriptor)
0396: #define FW_CDEV_IOC_REMOVE_DESCRIPTOR   _IOW('#', 0x07, struct fw_cdev_remove_descriptor)
0397: #define FW_CDEV_IOC_CREATE_ISO_CONTEXT _IOWR('#', 0x08, struct fw_cdev_create_iso_context)
0398: #define FW_CDEV_IOC_QUEUE_ISO          _IOWR('#', 0x09, struct fw_cdev_queue_iso)
0399: #define FW_CDEV_IOC_START_ISO           _IOW('#', 0x0a, struct fw_cdev_start_iso)
0400: #define FW_CDEV_IOC_STOP_ISO            _IOW('#', 0x0b, struct fw_cdev_stop_iso)
0401: 
0402: /* available since kernel version 2.6.24 */
0403: #define FW_CDEV_IOC_GET_CYCLE_TIMER     _IOR('#', 0x0c, struct fw_cdev_get_cycle_timer)
0404: 
0405: /* available since kernel version 2.6.30 */
0406: #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE       _IOWR('#', 0x0d, struct fw_cdev_allocate_iso_resource)
0407: #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE      _IOW('#', 0x0e, struct fw_cdev_deallocate)
0408: #define FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE   _IOW('#', 0x0f, struct fw_cdev_allocate_iso_resource)
0409: #define FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE _IOW('#', 0x10, struct fw_cdev_allocate_iso_resource)
0410: #define FW_CDEV_IOC_GET_SPEED                     _IO('#', 0x11) /* returns speed code */
0411: #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST       _IOW('#', 0x12, struct fw_cdev_send_request)
0412: #define FW_CDEV_IOC_SEND_STREAM_PACKET           _IOW('#', 0x13, struct fw_cdev_send_stream_packet)
0413: 
0414: /* available since kernel version 2.6.34 */
0415: #define FW_CDEV_IOC_GET_CYCLE_TIMER2   _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2)
0416: 
0417: /* available since kernel version 2.6.36 */
0418: #define FW_CDEV_IOC_SEND_PHY_PACKET    _IOWR('#', 0x15, struct fw_cdev_send_phy_packet)
0419: #define FW_CDEV_IOC_RECEIVE_PHY_PACKETS _IOW('#', 0x16, struct fw_cdev_receive_phy_packets)
0420: #define FW_CDEV_IOC_SET_ISO_CHANNELS    _IOW('#', 0x17, struct fw_cdev_set_iso_channels)
0421: 
0422: /*
0423:  * ABI version history
0424:  *  1  (2.6.22)  - initial version
0425:  *     (2.6.24)  - added %FW_CDEV_IOC_GET_CYCLE_TIMER
0426:  *  2  (2.6.30)  - changed &fw_cdev_event_iso_interrupt.header if
0427:  *                 &fw_cdev_create_iso_context.header_size is 8 or more
0428:  *               - added %FW_CDEV_IOC_*_ISO_RESOURCE*,
0429:  *                 %FW_CDEV_IOC_GET_SPEED, %FW_CDEV_IOC_SEND_BROADCAST_REQUEST,
0430:  *                 %FW_CDEV_IOC_SEND_STREAM_PACKET
0431:  *     (2.6.32)  - added time stamp to xmit &fw_cdev_event_iso_interrupt
0432:  *     (2.6.33)  - IR has always packet-per-buffer semantics now, not one of
0433:  *                 dual-buffer or packet-per-buffer depending on hardware
0434:  *               - shared use and auto-response for FCP registers
0435:  *  3  (2.6.34)  - made &fw_cdev_get_cycle_timer reliable
0436:  *               - added %FW_CDEV_IOC_GET_CYCLE_TIMER2
0437:  *  4  (2.6.36)  - added %FW_CDEV_EVENT_REQUEST2, %FW_CDEV_EVENT_PHY_PACKET_*,
0438:  *                 and &fw_cdev_allocate.region_end
0439:  *               - implemented &fw_cdev_event_bus_reset.bm_node_id
0440:  *               - added %FW_CDEV_IOC_SEND_PHY_PACKET, _RECEIVE_PHY_PACKETS
0441:  *               - added %FW_CDEV_EVENT_ISO_INTERRUPT_MULTICHANNEL,
0442:  *                 %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL, and
0443:  *                 %FW_CDEV_IOC_SET_ISO_CHANNELS
0444:  */
0445: 
0446: /**
0447:  * struct fw_cdev_get_info - General purpose information ioctl
0448:  * @version:    The version field is just a running serial number.  Both an
0449:  *              input parameter (ABI version implemented by the client) and
0450:  *              output parameter (ABI version implemented by the kernel).
0451:  *              A client shall fill in the ABI @version for which the client
0452:  *              was implemented.  This is necessary for forward compatibility.
0453:  * @rom_length: If @rom is non-zero, up to @rom_length bytes of Configuration
0454:  *              ROM will be copied into that user space address.  In either
0455:  *              case, @rom_length is updated with the actual length of the
0456:  *              Configuration ROM.
0457:  * @rom:        If non-zero, address of a buffer to be filled by a copy of the
0458:  *              device's Configuration ROM
0459:  * @bus_reset:  If non-zero, address of a buffer to be filled by a
0460:  *              &struct fw_cdev_event_bus_reset with the current state
0461:  *              of the bus.  This does not cause a bus reset to happen.
0462:  * @bus_reset_closure: Value of &closure in this and subsequent bus reset events
0463:  * @card:       The index of the card this device belongs to
0464:  *
0465:  * The %FW_CDEV_IOC_GET_INFO ioctl is usually the very first one which a client
0466:  * performs right after it opened a /dev/fw* file.
0467:  *
0468:  * As a side effect, reception of %FW_CDEV_EVENT_BUS_RESET events to be read(2)
0469:  * is started by this ioctl.
0470:  */
0471: struct fw_cdev_get_info {
0472:         __u32 version;
0473:         __u32 rom_length;
0474:         __u64 rom;
0475:         __u64 bus_reset;
0476:         __u64 bus_reset_closure;
0477:         __u32 card;
0478: };
0479: 
0480: /**
0481:  * struct fw_cdev_send_request - Send an asynchronous request packet
0482:  * @tcode:      Transaction code of the request
0483:  * @length:     Length of outgoing payload, in bytes
0484:  * @offset:     48-bit offset at destination node
0485:  * @closure:    Passed back to userspace in the response event
0486:  * @data:       Userspace pointer to payload
0487:  * @generation: The bus generation where packet is valid
0488:  *
0489:  * Send a request to the device.  This ioctl implements all outgoing requests.
0490:  * Both quadlet and block request specify the payload as a pointer to the data
0491:  * in the @data field.  Once the transaction completes, the kernel writes an
0492:  * &fw_cdev_event_response event back.  The @closure field is passed back to
0493:  * user space in the response event.
0494:  */
0495: struct fw_cdev_send_request {
0496:         __u32 tcode;
0497:         __u32 length;
0498:         __u64 offset;
0499:         __u64 closure;
0500:         __u64 data;
0501:         __u32 generation;
0502: };
0503: 
0504: /**
0505:  * struct fw_cdev_send_response - Send an asynchronous response packet
0506:  * @rcode:      Response code as determined by the userspace handler
0507:  * @length:     Length of outgoing payload, in bytes
0508:  * @data:       Userspace pointer to payload
0509:  * @handle:     The handle from the &fw_cdev_event_request
0510:  *
0511:  * Send a response to an incoming request.  By setting up an address range using
0512:  * the %FW_CDEV_IOC_ALLOCATE ioctl, userspace can listen for incoming requests.  An
0513:  * incoming request will generate an %FW_CDEV_EVENT_REQUEST, and userspace must
0514:  * send a reply using this ioctl.  The event has a handle to the kernel-side
0515:  * pending transaction, which should be used with this ioctl.
0516:  */
0517: struct fw_cdev_send_response {
0518:         __u32 rcode;
0519:         __u32 length;
0520:         __u64 data;
0521:         __u32 handle;
0522: };
0523: 
0524: /**
0525:  * struct fw_cdev_allocate - Allocate a CSR in an address range
0526:  * @offset:     Start offset of the address range
0527:  * @closure:    To be passed back to userspace in request events
0528:  * @length:     Length of the CSR, in bytes
0529:  * @handle:     Handle to the allocation, written by the kernel
0530:  * @region_end: First address above the address range (added in ABI v4, 2.6.36)
0531:  *
0532:  * Allocate an address range in the 48-bit address space on the local node
0533:  * (the controller).  This allows userspace to listen for requests with an
0534:  * offset within that address range.  Every time when the kernel receives a
0535:  * request within the range, an &fw_cdev_event_request2 event will be emitted.
0536:  * (If the kernel or the client implements ABI version <= 3, an
0537:  * &fw_cdev_event_request will be generated instead.)
0538:  *
0539:  * The @closure field is passed back to userspace in these request events.
0540:  * The @handle field is an out parameter, returning a handle to the allocated
0541:  * range to be used for later deallocation of the range.
0542:  *
0543:  * The address range is allocated on all local nodes.  The address allocation
0544:  * is exclusive except for the FCP command and response registers.  If an
0545:  * exclusive address region is already in use, the ioctl fails with errno set
0546:  * to %EBUSY.
0547:  *
0548:  * If kernel and client implement ABI version >= 4, the kernel looks up a free
0549:  * spot of size @length inside [@offset..@region_end) and, if found, writes
0550:  * the start address of the new CSR back in @offset.  I.e. @offset is an
0551:  * in and out parameter.  If this automatic placement of a CSR in a bigger
0552:  * address range is not desired, the client simply needs to set @region_end
0553:  * = @offset + @length.
0554:  *
0555:  * If the kernel or the client implements ABI version <= 3, @region_end is
0556:  * ignored and effectively assumed to be @offset + @length.
0557:  *
0558:  * @region_end is only present in a kernel header >= 2.6.36.  If necessary,
0559:  * this can for example be tested by #ifdef FW_CDEV_EVENT_REQUEST2.
0560:  */
0561: struct fw_cdev_allocate {
0562:         __u64 offset;
0563:         __u64 closure;
0564:         __u32 length;
0565:         __u32 handle;
0566:         __u64 region_end;       /* available since kernel version 2.6.36 */
0567: };
0568: 
0569: /**
0570:  * struct fw_cdev_deallocate - Free a CSR address range or isochronous resource
0571:  * @handle:     Handle to the address range or iso resource, as returned by the
0572:  *              kernel when the range or resource was allocated
0573:  */
0574: struct fw_cdev_deallocate {
0575:         __u32 handle;
0576: };
0577: 
0578: #define FW_CDEV_LONG_RESET      0
0579: #define FW_CDEV_SHORT_RESET     1
0580: 
0581: /**
0582:  * struct fw_cdev_initiate_bus_reset - Initiate a bus reset
0583:  * @type:       %FW_CDEV_SHORT_RESET or %FW_CDEV_LONG_RESET
0584:  *
0585:  * Initiate a bus reset for the bus this device is on.  The bus reset can be
0586:  * either the original (long) bus reset or the arbitrated (short) bus reset
0587:  * introduced in 1394a-2000.
0588:  *
0589:  * The ioctl returns immediately.  A subsequent &fw_cdev_event_bus_reset
0590:  * indicates when the reset actually happened.  Since ABI v4, this may be
0591:  * considerably later than the ioctl because the kernel ensures a grace period
0592:  * between subsequent bus resets as per IEEE 1394 bus management specification.
0593:  */
0594: struct fw_cdev_initiate_bus_reset {
0595:         __u32 type;
0596: };
0597: 
0598: /**
0599:  * struct fw_cdev_add_descriptor - Add contents to the local node's config ROM
0600:  * @immediate:  If non-zero, immediate key to insert before pointer
0601:  * @key:        Upper 8 bits of root directory pointer
0602:  * @data:       Userspace pointer to contents of descriptor block
0603:  * @length:     Length of descriptor block data, in quadlets
0604:  * @handle:     Handle to the descriptor, written by the kernel
0605:  *
0606:  * Add a descriptor block and optionally a preceding immediate key to the local
0607:  * node's Configuration ROM.
0608:  *
0609:  * The @key field specifies the upper 8 bits of the descriptor root directory
0610:  * pointer and the @data and @length fields specify the contents. The @key
0611:  * should be of the form 0xXX000000. The offset part of the root directory entry
0612:  * will be filled in by the kernel.
0613:  *
0614:  * If not 0, the @immediate field specifies an immediate key which will be
0615:  * inserted before the root directory pointer.
0616:  *
0617:  * @immediate, @key, and @data array elements are CPU-endian quadlets.
0618:  *
0619:  * If successful, the kernel adds the descriptor and writes back a @handle to
0620:  * the kernel-side object to be used for later removal of the descriptor block
0621:  * and immediate key.  The kernel will also generate a bus reset to signal the
0622:  * change of the Configuration ROM to other nodes.
0623:  *
0624:  * This ioctl affects the Configuration ROMs of all local nodes.
0625:  * The ioctl only succeeds on device files which represent a local node.
0626:  */
0627: struct fw_cdev_add_descriptor {
0628:         __u32 immediate;
0629:         __u32 key;
0630:         __u64 data;
0631:         __u32 length;
0632:         __u32 handle;
0633: };
0634: 
0635: /**
0636:  * struct fw_cdev_remove_descriptor - Remove contents from the Configuration ROM
0637:  * @handle:     Handle to the descriptor, as returned by the kernel when the
0638:  *              descriptor was added
0639:  *
0640:  * Remove a descriptor block and accompanying immediate key from the local
0641:  * nodes' Configuration ROMs.  The kernel will also generate a bus reset to
0642:  * signal the change of the Configuration ROM to other nodes.
0643:  */
0644: struct fw_cdev_remove_descriptor {
0645:         __u32 handle;
0646: };
0647: 
0648: #define FW_CDEV_ISO_CONTEXT_TRANSMIT                    0
0649: #define FW_CDEV_ISO_CONTEXT_RECEIVE                     1
0650: #define FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL        2 /* added in 2.6.36 */
0651: 
0652: /**
0653:  * struct fw_cdev_create_iso_context - Create a context for isochronous I/O
0654:  * @type:       %FW_CDEV_ISO_CONTEXT_TRANSMIT or %FW_CDEV_ISO_CONTEXT_RECEIVE or
0655:  *              %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL
0656:  * @header_size: Header size to strip in single-channel reception
0657:  * @channel:    Channel to bind to in single-channel reception or transmission
0658:  * @speed:      Transmission speed
0659:  * @closure:    To be returned in &fw_cdev_event_iso_interrupt or
0660:  *              &fw_cdev_event_iso_interrupt_multichannel
0661:  * @handle:     Handle to context, written back by kernel
0662:  *
0663:  * Prior to sending or receiving isochronous I/O, a context must be created.
0664:  * The context records information about the transmit or receive configuration
0665:  * and typically maps to an underlying hardware resource.  A context is set up
0666:  * for either sending or receiving.  It is bound to a specific isochronous
0667:  * @channel.
0668:  *
0669:  * In case of multichannel reception, @header_size and @channel are ignored
0670:  * and the channels are selected by %FW_CDEV_IOC_SET_ISO_CHANNELS.
0671:  *
0672:  * For %FW_CDEV_ISO_CONTEXT_RECEIVE contexts, @header_size must be at least 4
0673:  * and must be a multiple of 4.  It is ignored in other context types.
0674:  *
0675:  * @speed is ignored in receive context types.
0676:  *
0677:  * If a context was successfully created, the kernel writes back a handle to the
0678:  * context, which must be passed in for subsequent operations on that context.
0679:  *
0680:  * Limitations:
0681:  * No more than one iso context can be created per fd.
0682:  * The total number of contexts that all userspace and kernelspace drivers can
0683:  * create on a card at a time is a hardware limit, typically 4 or 8 contexts per
0684:  * direction, and of them at most one multichannel receive context.
0685:  */
0686: struct fw_cdev_create_iso_context {
0687:         __u32 type;
0688:         __u32 header_size;
0689:         __u32 channel;
0690:         __u32 speed;
0691:         __u64 closure;
0692:         __u32 handle;
0693: };
0694: 
0695: /**
0696:  * struct fw_cdev_set_iso_channels - Select channels in multichannel reception
0697:  * @channels:   Bitmask of channels to listen to
0698:  * @handle:     Handle of the mutichannel receive context
0699:  *
0700:  * @channels is the bitwise or of 1ULL << n for each channel n to listen to.
0701:  *
0702:  * The ioctl fails with errno %EBUSY if there is already another receive context
0703:  * on a channel in @channels.  In that case, the bitmask of all unoccupied
0704:  * channels is returned in @channels.
0705:  */
0706: struct fw_cdev_set_iso_channels {
0707:         __u64 channels;
0708:         __u32 handle;
0709: };
0710: 
0711: #define FW_CDEV_ISO_PAYLOAD_LENGTH(v)   (v)
0712: #define FW_CDEV_ISO_INTERRUPT           (1 << 16)
0713: #define FW_CDEV_ISO_SKIP                (1 << 17)
0714: #define FW_CDEV_ISO_SYNC                (1 << 17)
0715: #define FW_CDEV_ISO_TAG(v)              ((v) << 18)
0716: #define FW_CDEV_ISO_SY(v)               ((v) << 20)
0717: #define FW_CDEV_ISO_HEADER_LENGTH(v)    ((v) << 24)
0718: 
0719: /**
0720:  * struct fw_cdev_iso_packet - Isochronous packet
0721:  * @control:    Contains the header length (8 uppermost bits),
0722:  *              the sy field (4 bits), the tag field (2 bits), a sync flag
0723:  *              or a skip flag (1 bit), an interrupt flag (1 bit), and the
0724:  *              payload length (16 lowermost bits)
0725:  * @header:     Header and payload in case of a transmit context.
0726:  *
0727:  * &struct fw_cdev_iso_packet is used to describe isochronous packet queues.
0728:  * Use the FW_CDEV_ISO_ macros to fill in @control.
0729:  * The @header array is empty in case of receive contexts.
0730:  *
0731:  * Context type %FW_CDEV_ISO_CONTEXT_TRANSMIT:
0732:  *
0733:  * @control.HEADER_LENGTH must be a multiple of 4.  It specifies the numbers of
0734:  * bytes in @header that will be prepended to the packet's payload.  These bytes
0735:  * are copied into the kernel and will not be accessed after the ioctl has
0736:  * returned.
0737:  *
0738:  * The @control.SY and TAG fields are copied to the iso packet header.  These
0739:  * fields are specified by IEEE 1394a and IEC 61883-1.
0740:  *
0741:  * The @control.SKIP flag specifies that no packet is to be sent in a frame.
0742:  * When using this, all other fields except @control.INTERRUPT must be zero.
0743:  *
0744:  * When a packet with the @control.INTERRUPT flag set has been completed, an
0745:  * &fw_cdev_event_iso_interrupt event will be sent.
0746:  *
0747:  * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE:
0748:  *
0749:  * @control.HEADER_LENGTH must be a multiple of the context's header_size.
0750:  * If the HEADER_LENGTH is larger than the context's header_size, multiple
0751:  * packets are queued for this entry.
0752:  *
0753:  * The @control.SY and TAG fields are ignored.
0754:  *
0755:  * If the @control.SYNC flag is set, the context drops all packets until a
0756:  * packet with a sy field is received which matches &fw_cdev_start_iso.sync.
0757:  *
0758:  * @control.PAYLOAD_LENGTH defines how many payload bytes can be received for
0759:  * one packet (in addition to payload quadlets that have been defined as headers
0760:  * and are stripped and returned in the &fw_cdev_event_iso_interrupt structure).
0761:  * If more bytes are received, the additional bytes are dropped.  If less bytes
0762:  * are received, the remaining bytes in this part of the payload buffer will not
0763:  * be written to, not even by the next packet.  I.e., packets received in
0764:  * consecutive frames will not necessarily be consecutive in memory.  If an
0765:  * entry has queued multiple packets, the PAYLOAD_LENGTH is divided equally
0766:  * among them.
0767:  *
0768:  * When a packet with the @control.INTERRUPT flag set has been completed, an
0769:  * &fw_cdev_event_iso_interrupt event will be sent.  An entry that has queued
0770:  * multiple receive packets is completed when its last packet is completed.
0771:  *
0772:  * Context type %FW_CDEV_ISO_CONTEXT_RECEIVE_MULTICHANNEL:
0773:  *
0774:  * Here, &fw_cdev_iso_packet would be more aptly named _iso_buffer_chunk since
0775:  * it specifies a chunk of the mmap()'ed buffer, while the number and alignment
0776:  * of packets to be placed into the buffer chunk is not known beforehand.
0777:  *
0778:  * @control.PAYLOAD_LENGTH is the size of the buffer chunk and specifies room
0779:  * for header, payload, padding, and trailer bytes of one or more packets.
0780:  * It must be a multiple of 4.
0781:  *
0782:  * @control.HEADER_LENGTH, TAG and SY are ignored.  SYNC is treated as described
0783:  * for single-channel reception.
0784:  *
0785:  * When a buffer chunk with the @control.INTERRUPT flag set has been filled
0786:  * entirely, an &fw_cdev_event_iso_interrupt_mc event will be sent.
0787:  */
0788: struct fw_cdev_iso_packet {
0789:         __u32 control;
0790:         __u32 header[0];
0791: };
0792: 
0793: /**
0794:  * struct fw_cdev_queue_iso - Queue isochronous packets for I/O
0795:  * @packets:    Userspace pointer to an array of &fw_cdev_iso_packet
0796:  * @data:       Pointer into mmap()'ed payload buffer
0797:  * @size:       Size of the @packets array, in bytes
0798:  * @handle:     Isochronous context handle
0799:  *
0800:  * Queue a number of isochronous packets for reception or transmission.
0801:  * This ioctl takes a pointer to an array of &fw_cdev_iso_packet structs,
0802:  * which describe how to transmit from or receive into a contiguous region
0803:  * of a mmap()'ed payload buffer.  As part of transmit packet descriptors,
0804:  * a series of headers can be supplied, which will be prepended to the
0805:  * payload during DMA.
0806:  *
0807:  * The kernel may or may not queue all packets, but will write back updated
0808:  * values of the @packets, @data and @size fields, so the ioctl can be
0809:  * resubmitted easily.
0810:  *
0811:  * In case of a multichannel receive context, @data must be quadlet-aligned
0812:  * relative to the buffer start.
0813:  */
0814: struct fw_cdev_queue_iso {
0815:         __u64 packets;
0816:         __u64 data;
0817:         __u32 size;
0818:         __u32 handle;
0819: };
0820: 
0821: #define FW_CDEV_ISO_CONTEXT_MATCH_TAG0           1
0822: #define FW_CDEV_ISO_CONTEXT_MATCH_TAG1           2
0823: #define FW_CDEV_ISO_CONTEXT_MATCH_TAG2           4
0824: #define FW_CDEV_ISO_CONTEXT_MATCH_TAG3           8
0825: #define FW_CDEV_ISO_CONTEXT_MATCH_ALL_TAGS      15
0826: 
0827: /**
0828:  * struct fw_cdev_start_iso - Start an isochronous transmission or reception
0829:  * @cycle:      Cycle in which to start I/O.  If @cycle is greater than or
0830:  *              equal to 0, the I/O will start on that cycle.
0831:  * @sync:       Determines the value to wait for for receive packets that have
0832:  *              the %FW_CDEV_ISO_SYNC bit set
0833:  * @tags:       Tag filter bit mask.  Only valid for isochronous reception.
0834:  *              Determines the tag values for which packets will be accepted.
0835:  *              Use FW_CDEV_ISO_CONTEXT_MATCH_ macros to set @tags.
0836:  * @handle:     Isochronous context handle within which to transmit or receive
0837:  */
0838: struct fw_cdev_start_iso {
0839:         __s32 cycle;
0840:         __u32 sync;
0841:         __u32 tags;
0842:         __u32 handle;
0843: };
0844: 
0845: /**
0846:  * struct fw_cdev_stop_iso - Stop an isochronous transmission or reception
0847:  * @handle:     Handle of isochronous context to stop
0848:  */
0849: struct fw_cdev_stop_iso {
0850:         __u32 handle;
0851: };
0852: 
0853: /**
0854:  * struct fw_cdev_get_cycle_timer - read cycle timer register
0855:  * @local_time:   system time, in microseconds since the Epoch
0856:  * @cycle_timer:  Cycle Time register contents
0857:  *
0858:  * Same as %FW_CDEV_IOC_GET_CYCLE_TIMER2, but fixed to use %CLOCK_REALTIME
0859:  * and only with microseconds resolution.
0860:  *
0861:  * In version 1 and 2 of the ABI, this ioctl returned unreliable (non-
0862:  * monotonic) @cycle_timer values on certain controllers.
0863:  */
0864: struct fw_cdev_get_cycle_timer {
0865:         __u64 local_time;
0866:         __u32 cycle_timer;
0867: };
0868: 
0869: /**
0870:  * struct fw_cdev_get_cycle_timer2 - read cycle timer register
0871:  * @tv_sec:       system time, seconds
0872:  * @tv_nsec:      system time, sub-seconds part in nanoseconds
0873:  * @clk_id:       input parameter, clock from which to get the system time
0874:  * @cycle_timer:  Cycle Time register contents
0875:  *
0876:  * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 ioctl reads the isochronous cycle timer
0877:  * and also the system clock.  This allows to correlate reception time of
0878:  * isochronous packets with system time.
0879:  *
0880:  * @clk_id lets you choose a clock like with POSIX' clock_gettime function.
0881:  * Supported @clk_id values are POSIX' %CLOCK_REALTIME and %CLOCK_MONOTONIC
0882:  * and Linux' %CLOCK_MONOTONIC_RAW.
0883:  *
0884:  * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and
0885:  * 12 bits cycleOffset, in host byte order.  Cf. the Cycle Time register
0886:  * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394.
0887:  */
0888: struct fw_cdev_get_cycle_timer2 {
0889:         __s64 tv_sec;
0890:         __s32 tv_nsec;
0891:         __s32 clk_id;
0892:         __u32 cycle_timer;
0893: };
0894: 
0895: /**
0896:  * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth
0897:  * @closure:    Passed back to userspace in corresponding iso resource events
0898:  * @channels:   Isochronous channels of which one is to be (de)allocated
0899:  * @bandwidth:  Isochronous bandwidth units to be (de)allocated
0900:  * @handle:     Handle to the allocation, written by the kernel (only valid in
0901:  *              case of %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctls)
0902:  *
0903:  * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE ioctl initiates allocation of an
0904:  * isochronous channel and/or of isochronous bandwidth at the isochronous
0905:  * resource manager (IRM).  Only one of the channels specified in @channels is
0906:  * allocated.  An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED is sent after
0907:  * communication with the IRM, indicating success or failure in the event data.
0908:  * The kernel will automatically reallocate the resources after bus resets.
0909:  * Should a reallocation fail, an %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event
0910:  * will be sent.  The kernel will also automatically deallocate the resources
0911:  * when the file descriptor is closed.
0912:  *
0913:  * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE ioctl can be used to initiate
0914:  * deallocation of resources which were allocated as described above.
0915:  * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
0916:  *
0917:  * The %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE ioctl is a variant of allocation
0918:  * without automatic re- or deallocation.
0919:  * An %FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED event concludes this operation,
0920:  * indicating success or failure in its data.
0921:  *
0922:  * The %FW_CDEV_IOC_DEALLOCATE_ISO_RESOURCE_ONCE ioctl works like
0923:  * %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE except that resources are freed
0924:  * instead of allocated.
0925:  * An %FW_CDEV_EVENT_ISO_RESOURCE_DEALLOCATED event concludes this operation.
0926:  *
0927:  * To summarize, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE allocates iso resources
0928:  * for the lifetime of the fd or @handle.
0929:  * In contrast, %FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE_ONCE allocates iso resources
0930:  * for the duration of a bus generation.
0931:  *
0932:  * @channels is a host-endian bitfield with the least significant bit
0933:  * representing channel 0 and the most significant bit representing channel 63:
0934:  * 1ULL << c for each channel c that is a candidate for (de)allocation.
0935:  *
0936:  * @bandwidth is expressed in bandwidth allocation units, i.e. the time to send
0937:  * one quadlet of data (payload or header data) at speed S1600.
0938:  */
0939: struct fw_cdev_allocate_iso_resource {
0940:         __u64 closure;
0941:         __u64 channels;
0942:         __u32 bandwidth;
0943:         __u32 handle;
0944: };
0945: 
0946: /**
0947:  * struct fw_cdev_send_stream_packet - send an asynchronous stream packet
0948:  * @length:     Length of outgoing payload, in bytes
0949:  * @tag:        Data format tag
0950:  * @channel:    Isochronous channel to transmit to
0951:  * @sy:         Synchronization code
0952:  * @closure:    Passed back to userspace in the response event
0953:  * @data:       Userspace pointer to payload
0954:  * @generation: The bus generation where packet is valid
0955:  * @speed:      Speed to transmit at
0956:  *
0957:  * The %FW_CDEV_IOC_SEND_STREAM_PACKET ioctl sends an asynchronous stream packet
0958:  * to every device which is listening to the specified channel.  The kernel
0959:  * writes an &fw_cdev_event_response event which indicates success or failure of
0960:  * the transmission.
0961:  */
0962: struct fw_cdev_send_stream_packet {
0963:         __u32 length;
0964:         __u32 tag;
0965:         __u32 channel;
0966:         __u32 sy;
0967:         __u64 closure;
0968:         __u64 data;
0969:         __u32 generation;
0970:         __u32 speed;
0971: };
0972: 
0973: /**
0974:  * struct fw_cdev_send_phy_packet - send a PHY packet
0975:  * @closure:    Passed back to userspace in the PHY-packet-sent event
0976:  * @data:       First and second quadlet of the PHY packet
0977:  * @generation: The bus generation where packet is valid
0978:  *
0979:  * The %FW_CDEV_IOC_SEND_PHY_PACKET ioctl sends a PHY packet to all nodes
0980:  * on the same card as this device.  After transmission, an
0981:  * %FW_CDEV_EVENT_PHY_PACKET_SENT event is generated.
0982:  *
0983:  * The payload @data[] shall be specified in host byte order.  Usually,
0984:  * @data[1] needs to be the bitwise inverse of @data[0].  VersaPHY packets
0985:  * are an exception to this rule.
0986:  *
0987:  * The ioctl is only permitted on device files which represent a local node.
0988:  */
0989: struct fw_cdev_send_phy_packet {
0990:         __u64 closure;
0991:         __u32 data[2];
0992:         __u32 generation;
0993: };
0994: 
0995: /**
0996:  * struct fw_cdev_receive_phy_packets - start reception of PHY packets
0997:  * @closure: Passed back to userspace in phy packet events
0998:  *
0999:  * This ioctl activates issuing of %FW_CDEV_EVENT_PHY_PACKET_RECEIVED due to
1000:  * incoming PHY packets from any node on the same bus as the device.
1001:  *
1002:  * The ioctl is only permitted on device files which represent a local node.
1003:  */
1004: struct fw_cdev_receive_phy_packets {
1005:         __u64 closure;
1006: };
1007: 
1008: #define FW_CDEV_VERSION 3 /* Meaningless legacy macro; don't use it. */
1009: 
1010: #endif /* _LINUX_FIREWIRE_CDEV_H */
1011: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/