📄 raw1394.h
字号:
/* * libraw1394 - library for raw access to the 1394 bus with the Linux subsystem. * * Copyright (C) 1999-2004 Andreas Bombe, Dan Maas, Manfred Weihs, and * Christian Toegel * * This library is licensed under the GNU Lesser General Public License (LGPL), * version 2.1 or later. See the file COPYING.LIB in the distribution for * details. */#ifndef _LIBRAW1394_RAW1394_H#define _LIBRAW1394_RAW1394_H#define RAW1394_ARM_READ 1#define RAW1394_ARM_WRITE 2#define RAW1394_ARM_LOCK 4#define RAW1394_LONG_RESET 0#define RAW1394_SHORT_RESET 1/* busresetnotify ... */#define RAW1394_NOTIFY_OFF 0#define RAW1394_NOTIFY_ON 1#include <sys/types.h>typedef u_int8_t byte_t;typedef u_int32_t quadlet_t;typedef u_int64_t octlet_t;typedef u_int64_t nodeaddr_t;typedef u_int16_t nodeid_t;typedef u_int8_t phyid_t;typedef u_int8_t arm_options_t;typedef u_int16_t arm_length_t;typedef struct raw1394_handle *raw1394handle_t;typedef struct raw1394_arm_request { nodeid_t destination_nodeid; nodeid_t source_nodeid; nodeaddr_t destination_offset; u_int8_t tlabel; u_int8_t tcode; u_int8_t extended_transaction_code; u_int32_t generation; arm_length_t buffer_length; byte_t *buffer;} *raw1394_arm_request_t;typedef struct raw1394_arm_response { int response_code; arm_length_t buffer_length; byte_t *buffer;} *raw1394_arm_response_t;typedef struct raw1394_arm_request_response { struct raw1394_arm_request *request; struct raw1394_arm_response *response;} *raw1394_arm_request_response_t;/* new ISO API */enum raw1394_iso_speed { RAW1394_ISO_SPEED_100 = 0, RAW1394_ISO_SPEED_200 = 1, RAW1394_ISO_SPEED_400 = 2,};/* The dma mode when receiving iso data. Must be supported by chipset */enum raw1394_iso_dma_recv_mode { RAW1394_DMA_DEFAULT = -1, /* Use the default mode, this is BUFFERFILL for ohci */ RAW1394_DMA_BUFFERFILL = 1, /* BUFFER_FILL mode */ RAW1394_DMA_PACKET_PER_BUFFER = 2 /* PACKET_PER_BUFFER mode */};/* return values from isochronous xmit/recv handlers */enum raw1394_iso_disposition { /* continue on to the next packet */ RAW1394_ISO_OK = 0, /* no error, but return from raw1394_loop_iterate() immediately */ RAW1394_ISO_DEFER = 1, /* return from raw1394_loop_iterate() immediately, which will return an error */ RAW1394_ISO_ERROR = 2, /* return from raw1394_loop_iterate() immediately, and stop receiving packets */ RAW1394_ISO_STOP = 3, /* (transmission only) - like ISO_STOP, but don't wait for the buffer to empty */ RAW1394_ISO_STOP_NOSYNC = 4,};#ifdef __cplusplusextern "C" {#endif/* handlers for transmitting/receiving isochronous packets */typedef enum raw1394_iso_disposition (*raw1394_iso_xmit_handler_t)( raw1394handle_t handle, unsigned char *data, unsigned int *len, unsigned char *tag, unsigned char *sy, int cycle, /* -1 if unknown */ unsigned int dropped);typedef enum raw1394_iso_disposition (*raw1394_iso_recv_handler_t)( raw1394handle_t handle, unsigned char *data, unsigned int len, unsigned char channel, unsigned char tag, unsigned char sy, unsigned int cycle, unsigned int dropped);/** * raw1394_iso_xmit_init - initialize isochronous transmission * @handle: libraw1394 handle * @handler: handler function for queueing packets * @buf_packets: number of isochronous packets to buffer * @max_packet_size: largest packet you need to handle, in bytes * (not including the isochronous header) * @channel: isochronous channel on which to transmit * @speed: speed at which to transmit * @irq_interval: maximum latency of wake-ups, in packets (-1 if you don't care) * * Allocates all user and kernel resources necessary for isochronous transmission. * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_xmit_init(raw1394handle_t handle, raw1394_iso_xmit_handler_t handler, unsigned int buf_packets, unsigned int max_packet_size, unsigned char channel, enum raw1394_iso_speed speed, int irq_interval);/** * raw1394_iso_recv_init - initialize isochronous reception * @handle: libraw1394 handle * @handler: handler function for receiving packets * @buf_packets: number of isochronous packets to buffer * @max_packet_size: largest packet you need to handle, in bytes (not including * the isochronous header) * @channel: isochronous channel to receive * @mode: bufferfill or packet per buffer mode * @irq_interval: maximum latency of wake-ups, in packets * (-1 if you don't care) * * Allocates all user and kernel resources necessary for isochronous reception. * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_recv_init(raw1394handle_t handle, raw1394_iso_recv_handler_t handler, unsigned int buf_packets, unsigned int max_packet_size, unsigned char channel, enum raw1394_iso_dma_recv_mode mode, int irq_interval);/** * raw1394_iso_multichannel_recv_init - initialize multi-channel iso reception * @handle: libraw1394 handle * @handler: handler function for receiving packets * @buf_packets: number of isochronous packets to buffer * @max_packet_size: largest packet you need to handle, in bytes (not including * the isochronous header) * @speed: speed at which to receive * @irq_interval: maximum latency of wake-ups, in packets (-1 if you don't care) * * Allocates all user and kernel resources necessary for isochronous reception. * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_multichannel_recv_init(raw1394handle_t handle, raw1394_iso_recv_handler_t handler, unsigned int buf_packets, unsigned int max_packet_size, int irq_interval);/** * raw1394_iso_recv_listen_channel - listen to a specific channel in multi-channel mode * @handle: libraw1394 handle * @channel: the channel to start listening * * listen/unlisten on a specific channel (multi-channel mode ONLY) * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_recv_listen_channel(raw1394handle_t handle, unsigned char channel);/** * raw1394_iso_recv_unlisten_channel - stop listening to a specific channel in multi-channel mode * @handle: libraw1394 handle * @channel: the channel to stop listening to * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_recv_unlisten_channel(raw1394handle_t handle, unsigned char channel);/** * raw1394_iso_recv_set_channel_mask - listen or unlisten to a whole bunch of channels at once * @handle: libraw1394 handle * @mask: 64-bit mask of channels, 1 means listen, 0 means unlisten, * channel 0 is LSB, channel 63 is MSB * * for multi-channel reception mode only * * Returns: 0 on success, -1 on failure (sets errno) **/int raw1394_iso_recv_set_channel_mask(raw1394handle_t handle, u_int64_t mask);/** * raw1394_iso_xmit_start - begin isochronous transmission * @handle: libraw1394 handle * @start_on_cycle: isochronous cycle number on which to start * (-1 if you don't care) * @prebuffer_packets: number of packets to queue up before starting transmission * (-1 if you don't care) * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_xmit_start(raw1394handle_t handle, int start_on_cycle, int prebuffer_packets);/** * raw1394_iso_recv_start - begin isochronous reception * @handle: libraw1394 handle * @start_on_cycle: isochronous cycle number on which to start * (-1 if you don't care) * @tag_mask: mask of tag fields to match (-1 to receive all packets) * @sync: not used, reserved for future implementation * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_recv_start(raw1394handle_t handle, int start_on_cycle, int tag_mask, int sync);/** * raw1394_iso_xmit_write - alternative blocking-write API for ISO transmission * @handle: libraw1394 handle * @data: pointer to packet data buffer * @len: length of packet, in bytes * @tag: tag field * @sy: sync field * * write() style API - do NOT use this if you have set an xmit_handler * if buffer is full, waits for more space UNLESS the file descriptor is * set to non-blocking, in which case xmit_write() will return -1 with * errno = EAGAIN * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_xmit_write(raw1394handle_t handle, unsigned char *data, unsigned int len, unsigned char tag, unsigned char sy);/** * raw1394_iso_xmit_sync - wait until all queued packets have been sent * @handle: libraw1394 handle * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_xmit_sync(raw1394handle_t handle);/** * raw1394_iso_recv_flush - flush all already received iso packets from kernel into user space * @handle: libraw1394 handle * * If you specified an irq_interval > 1 in * iso_recv_init, you won't be notified for every single iso packet, but * for groups of them. Now e.g. if irq_interval is 100, and you were just * notified about iso packets and after them only 20 more packets arrived, * no notification will be generated (20 < 100). In the case that you know * that there should be more packets at this moment, you can call this * function and all iso packets which are already received by the kernel * will be flushed out to user space. * * Returns: 0 on success or -1 on failure (sets errno) **/int raw1394_iso_recv_flush(raw1394handle_t handle);/** * raw1394_iso_stop - halt isochronous transmission or reception * @handle: libraw1394 handle **/void raw1394_iso_stop(raw1394handle_t handle);/** * raw1394_iso_shutdown - clean up and deallocate all resources for isochronous transmission or reception * @handle: libraw1394 handle **/void raw1394_iso_shutdown(raw1394handle_t handle);typedef int raw1394_errcode_t;#define raw1394_make_errcode(ack, rcode) (((ack) << 16) | rcode)#define raw1394_internal_err(errcode) ((errcode) < 0)#define raw1394_get_ack(errcode) ((errcode) >> 16)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -