raw1394.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. #ifndef IEEE1394_RAW1394_H
  2. #define IEEE1394_RAW1394_H
  3. /* header for the raw1394 API that is exported to user-space */
  4. #define RAW1394_KERNELAPI_VERSION 4
  5. /* state: opened */
  6. #define RAW1394_REQ_INITIALIZE 1
  7. /* state: initialized */
  8. #define RAW1394_REQ_LIST_CARDS 2
  9. #define RAW1394_REQ_SET_CARD 3
  10. /* state: connected */
  11. #define RAW1394_REQ_ASYNC_READ 100
  12. #define RAW1394_REQ_ASYNC_WRITE 101
  13. #define RAW1394_REQ_LOCK 102
  14. #define RAW1394_REQ_LOCK64 103
  15. #define RAW1394_REQ_ISO_SEND 104
  16. #define RAW1394_REQ_ASYNC_SEND 105
  17. #define RAW1394_REQ_ASYNC_STREAM 106
  18. #define RAW1394_REQ_ISO_LISTEN 200
  19. #define RAW1394_REQ_FCP_LISTEN 201
  20. #define RAW1394_REQ_RESET_BUS 202
  21. #define RAW1394_REQ_GET_ROM 203
  22. #define RAW1394_REQ_UPDATE_ROM 204
  23. #define RAW1394_REQ_ECHO 205
  24. #define RAW1394_REQ_MODIFY_ROM 206
  25. #define RAW1394_REQ_ARM_REGISTER 300
  26. #define RAW1394_REQ_ARM_UNREGISTER 301
  27. #define RAW1394_REQ_ARM_SET_BUF 302
  28. #define RAW1394_REQ_ARM_GET_BUF 303
  29. #define RAW1394_REQ_RESET_NOTIFY 400
  30. #define RAW1394_REQ_PHYPACKET 500
  31. /* kernel to user */
  32. #define RAW1394_REQ_BUS_RESET 10000
  33. #define RAW1394_REQ_ISO_RECEIVE 10001
  34. #define RAW1394_REQ_FCP_REQUEST 10002
  35. #define RAW1394_REQ_ARM 10003
  36. #define RAW1394_REQ_RAWISO_ACTIVITY 10004
  37. /* error codes */
  38. #define RAW1394_ERROR_NONE 0
  39. #define RAW1394_ERROR_COMPAT (-1001)
  40. #define RAW1394_ERROR_STATE_ORDER (-1002)
  41. #define RAW1394_ERROR_GENERATION (-1003)
  42. #define RAW1394_ERROR_INVALID_ARG (-1004)
  43. #define RAW1394_ERROR_MEMFAULT (-1005)
  44. #define RAW1394_ERROR_ALREADY (-1006)
  45. #define RAW1394_ERROR_EXCESSIVE (-1020)
  46. #define RAW1394_ERROR_UNTIDY_LEN (-1021)
  47. #define RAW1394_ERROR_SEND_ERROR (-1100)
  48. #define RAW1394_ERROR_ABORTED (-1101)
  49. #define RAW1394_ERROR_TIMEOUT (-1102)
  50. /* arm_codes */
  51. #define ARM_READ 1
  52. #define ARM_WRITE 2
  53. #define ARM_LOCK 4
  54. #define RAW1394_LONG_RESET 0
  55. #define RAW1394_SHORT_RESET 1
  56. /* busresetnotify ... */
  57. #define RAW1394_NOTIFY_OFF 0
  58. #define RAW1394_NOTIFY_ON 1
  59. #include <asm/types.h>
  60. struct raw1394_request {
  61. __u32 type;
  62. __s32 error;
  63. __u32 misc;
  64. __u32 generation;
  65. __u32 length;
  66. __u64 address;
  67. __u64 tag;
  68. __u64 sendb;
  69. __u64 recvb;
  70. };
  71. struct raw1394_khost_list {
  72. __u32 nodes;
  73. __u8 name[32];
  74. };
  75. typedef struct arm_request {
  76. __u16 destination_nodeid;
  77. __u16 source_nodeid;
  78. __u64 destination_offset;
  79. __u8 tlabel;
  80. __u8 tcode;
  81. __u8 extended_transaction_code;
  82. __u32 generation;
  83. __u16 buffer_length;
  84. __u8 __user *buffer;
  85. } *arm_request_t;
  86. typedef struct arm_response {
  87. __s32 response_code;
  88. __u16 buffer_length;
  89. __u8 __user *buffer;
  90. } *arm_response_t;
  91. typedef struct arm_request_response {
  92. struct arm_request __user *request;
  93. struct arm_response __user *response;
  94. } *arm_request_response_t;
  95. /* rawiso API */
  96. #include "ieee1394-ioctl.h"
  97. /* per-packet metadata embedded in the ringbuffer */
  98. /* must be identical to hpsb_iso_packet_info in iso.h! */
  99. struct raw1394_iso_packet_info {
  100. __u32 offset;
  101. __u16 len;
  102. __u16 cycle; /* recv only */
  103. __u8 channel; /* recv only */
  104. __u8 tag;
  105. __u8 sy;
  106. };
  107. /* argument for RAW1394_ISO_RECV/XMIT_PACKETS ioctls */
  108. struct raw1394_iso_packets {
  109. __u32 n_packets;
  110. struct raw1394_iso_packet_info __user *infos;
  111. };
  112. struct raw1394_iso_config {
  113. /* size of packet data buffer, in bytes (will be rounded up to PAGE_SIZE) */
  114. __u32 data_buf_size;
  115. /* # of packets to buffer */
  116. __u32 buf_packets;
  117. /* iso channel (set to -1 for multi-channel recv) */
  118. __s32 channel;
  119. /* xmit only - iso transmission speed */
  120. __u8 speed;
  121. /* The mode of the dma when receiving iso data. Must be supported by chip */
  122. __u8 dma_mode;
  123. /* max. latency of buffer, in packets (-1 if you don't care) */
  124. __s32 irq_interval;
  125. };
  126. /* argument to RAW1394_ISO_XMIT/RECV_INIT and RAW1394_ISO_GET_STATUS */
  127. struct raw1394_iso_status {
  128. /* current settings */
  129. struct raw1394_iso_config config;
  130. /* number of packets waiting to be filled with data (ISO transmission)
  131. or containing data received (ISO reception) */
  132. __u32 n_packets;
  133. /* approximate number of packets dropped due to overflow or
  134. underflow of the packet buffer (a value of zero guarantees
  135. that no packets have been dropped) */
  136. __u32 overflows;
  137. /* cycle number at which next packet will be transmitted;
  138. -1 if not known */
  139. __s16 xmit_cycle;
  140. };
  141. #endif /* IEEE1394_RAW1394_H */