diff --git a/src/kernel-raw1394.h b/src/kernel-raw1394.h index 24d00c9..b138810 100644 --- a/src/kernel-raw1394.h +++ b/src/kernel-raw1394.h @@ -1,8 +1,7 @@ #ifndef IEEE1394_RAW1394_H #define IEEE1394_RAW1394_H -#define RAW1394_DEVICE_MAJOR 171 -#define RAW1394_DEVICE_NAME "raw1394" +/* header for the raw1394 API that is exported to user-space */ #define RAW1394_KERNELAPI_VERSION 4 @@ -36,11 +35,11 @@ #define RAW1394_REQ_PHYPACKET 500 /* kernel to user */ -#define RAW1394_REQ_BUS_RESET 10000 -#define RAW1394_REQ_ISO_RECEIVE 10001 -#define RAW1394_REQ_FCP_REQUEST 10002 -#define RAW1394_REQ_ARM 10003 -#define RAW1394_REQ_RAWISO_ACTIVITY 10004 +#define RAW1394_REQ_BUS_RESET 10000 +#define RAW1394_REQ_ISO_RECEIVE 10001 +#define RAW1394_REQ_FCP_REQUEST 10002 +#define RAW1394_REQ_ARM 10003 +#define RAW1394_REQ_RAWISO_ACTIVITY 10004 /* error codes */ #define RAW1394_ERROR_NONE 0 @@ -93,23 +92,22 @@ struct raw1394_khost_list { __u8 name[32]; }; -/* moved to raw1394.h to make it available to applications typedef struct arm_request { - nodeid_t destination_nodeid; - nodeid_t source_nodeid; - nodeaddr_t destination_offset; - u8 tlabel; - u8 tcode; - u_int8_t extended_transaction_code; - u_int32_t generation; - arm_length_t buffer_length; - byte_t *buffer; + __u16 destination_nodeid; + __u16 source_nodeid; + __u64 destination_offset; + __u8 tlabel; + __u8 tcode; + __u8 extended_transaction_code; + __u32 generation; + __u16 buffer_length; + __u8 *buffer; } *arm_request_t; typedef struct arm_response { - int response_code; - arm_length_t buffer_length; - byte_t *buffer; + __s32 response_code; + __u16 buffer_length; + __u8 *buffer; } *arm_response_t; typedef struct arm_request_response { @@ -117,8 +115,6 @@ typedef struct arm_request_response { struct arm_response *response; } *arm_request_response_t; -*/ - /* rawiso API */ /* ioctls */ @@ -135,19 +131,19 @@ typedef struct arm_request_response { /* per-packet metadata embedded in the ringbuffer */ /* must be identical to hpsb_iso_packet_info in iso.h! */ struct raw1394_iso_packet_info { - unsigned short len; - unsigned short cycle; - unsigned char channel; /* recv only */ - unsigned char tag; - unsigned char sy; + __u16 len; + __u16 cycle; + __u8 channel; /* recv only */ + __u8 tag; + __u8 sy; }; struct raw1394_iso_config { - unsigned int buf_packets; - unsigned int max_packet_size; - int channel; - int speed; /* xmit only */ - int irq_interval; + __u32 buf_packets; + __u32 max_packet_size; + __u32 channel; + __u32 speed; /* xmit only */ + __u32 irq_interval; }; /* argument to RAW1394_ISO_XMIT/RECV_INIT and RAW1394_ISO_GET_STATUS */ @@ -156,98 +152,26 @@ struct raw1394_iso_status { struct raw1394_iso_config config; /* byte offset between successive packets in the buffer */ - int buf_stride; + __s32 buf_stride; /* byte offset of data payload within each packet */ - int packet_data_offset; + __s32 packet_data_offset; /* byte offset of struct iso_packet_info within each packet */ - int packet_info_offset; + __s32 packet_info_offset; /* index of next packet to fill with data (ISO transmission) or next packet containing data recieved (ISO reception) */ - unsigned int first_packet; + __u32 first_packet; /* number of packets waiting to be filled with data (ISO transmission) or containing data received (ISO reception) */ - unsigned int n_packets; + __u32 n_packets; /* approximate number of packets dropped due to overflow or underflow of the packet buffer (a value of zero guarantees that no packets have been dropped) */ - unsigned int overflows; + __u32 overflows; }; -#ifdef __KERNEL__ - -struct iso_block_store { - atomic_t refcount; - size_t data_size; - quadlet_t data[0]; -}; - -enum raw1394_iso_state { RAW1394_ISO_INACTIVE = 0, - RAW1394_ISO_RECV = 1, - RAW1394_ISO_XMIT = 2 }; - -struct file_info { - struct list_head list; - - enum { opened, initialized, connected } state; - unsigned int protocol_version; - - struct hpsb_host *host; - - struct list_head req_pending; - struct list_head req_complete; - struct semaphore complete_sem; - spinlock_t reqlists_lock; - wait_queue_head_t poll_wait_complete; - - struct list_head addr_list; - - u8 *fcp_buffer; - - /* old ISO API */ - u64 listen_channels; - quadlet_t *iso_buffer; - size_t iso_buffer_length; - - u8 notification; /* (busreset-notification) RAW1394_NOTIFY_OFF/ON */ - - /* new rawiso API */ - enum raw1394_iso_state iso_state; - struct hpsb_iso *iso_handle; -}; - -struct arm_addr { - struct list_head addr_list; /* file_info list */ - u64 start, end; - u64 arm_tag; - u8 notification_options; - u8 access_rights; - u64 recvb; - u16 rec_length; - u8 *addr_space_buffer; /* accessed by read/write/lock */ -}; - -struct pending_request { - struct list_head list; - struct file_info *file_info; - struct hpsb_packet *packet; -/* struct tq_struct tq; */ - struct iso_block_store *ibs; - quadlet_t *data; - int free_data; - struct raw1394_request req; -}; - -struct host_info { - struct list_head list; - struct hpsb_host *host; - struct list_head file_info_list; -}; - -#endif /* __KERNEL__ */ - #endif /* IEEE1394_RAW1394_H */ diff --git a/src/main.c b/src/main.c index b1c69f8..1c6f190 100644 --- a/src/main.c +++ b/src/main.c @@ -57,11 +57,11 @@ static int arm_tag_handler_default(struct raw1394_handle *handle, unsigned long void *data) { struct raw1394_arm_reqhandle *rh; - struct arm_request_response *arm_req_resp; + struct raw1394_arm_request_response *arm_req_resp; if (tag) { rh = (struct raw1394_arm_reqhandle *)tag; - arm_req_resp = (struct arm_request_response *) data; + arm_req_resp = (struct raw1394_arm_request_response *) data; return rh->arm_callback(handle, arm_req_resp, requested_length, rh->pcontext, request_type); diff --git a/src/raw1394.h b/src/raw1394.h index 8364301..7dc567d 100644 --- a/src/raw1394.h +++ b/src/raw1394.h @@ -1,9 +1,9 @@ #ifndef _LIBRAW1394_RAW1394_H #define _LIBRAW1394_RAW1394_H -#define ARM_READ 1 -#define ARM_WRITE 2 -#define ARM_LOCK 4 +#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 @@ -24,7 +24,7 @@ typedef u_int16_t arm_length_t; typedef struct raw1394_handle *raw1394handle_t; -typedef struct arm_request { +typedef struct raw1394_arm_request { nodeid_t destination_nodeid; nodeid_t source_nodeid; nodeaddr_t destination_offset; @@ -34,18 +34,18 @@ typedef struct arm_request { u_int32_t generation; arm_length_t buffer_length; byte_t *buffer; -} *arm_request_t; +} *raw1394_arm_request_t; -typedef struct arm_response { +typedef struct raw1394_arm_response { int response_code; arm_length_t buffer_length; byte_t *buffer; -} *arm_response_t; +} *raw1394_arm_response_t; -typedef struct arm_request_response { - struct arm_request *request; - struct arm_response *response; -} *arm_request_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 */ @@ -291,7 +291,7 @@ struct raw1394_reqhandle { * received, it calls the arm_callback. */ typedef int (*arm_req_callback_t) (raw1394handle_t, - struct arm_request_response *arm_req_resp, + struct raw1394_arm_request_response *arm_req_resp, unsigned int requested_length, void *pcontext, byte_t request_type);