#ifndef _SYS_1394_CMD1394_H
#define _SYS_1394_CMD1394_H
#include <sys/types.h>
#include <sys/stream.h>
#include <sys/note.h>
#include <sys/1394/s1394_impl.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
CMD1394_ASYNCH_RD_QUAD = 0,
CMD1394_ASYNCH_WR_QUAD = 1,
CMD1394_ASYNCH_RD_BLOCK = 2,
CMD1394_ASYNCH_WR_BLOCK = 3,
CMD1394_ASYNCH_LOCK_32 = 4,
CMD1394_ASYNCH_LOCK_64 = 5
} cmd1394_cmd_type_t;
typedef enum {
CMD1394_CANCEL_ON_BUS_RESET = (1 << 0),
CMD1394_OVERRIDE_ADDR = (1 << 1),
CMD1394_OVERRIDE_MAX_PAYLOAD = (1 << 2),
CMD1394_DISABLE_ADDR_INCREMENT = (1 << 3),
CMD1394_BLOCKING = (1 << 4),
CMD1394_OVERRIDE_SPEED = (1 << 5)
} cmd1394_flags_t;
typedef enum {
CMD1394_LOCK_MASK_SWAP = 0x0001,
CMD1394_LOCK_COMPARE_SWAP = 0x0002,
CMD1394_LOCK_FETCH_ADD = 0x0003,
CMD1394_LOCK_LITTLE_ADD = 0x0004,
CMD1394_LOCK_BOUNDED_ADD = 0x0005,
CMD1394_LOCK_WRAP_ADD = 0x0006,
CMD1394_LOCK_BIT_AND = 0x10000,
CMD1394_LOCK_BIT_OR = 0x10001,
CMD1394_LOCK_BIT_XOR = 0x10002,
CMD1394_LOCK_INCREMENT = 0x10003,
CMD1394_LOCK_DECREMENT = 0x10004,
CMD1394_LOCK_ADD = 0x10005,
CMD1394_LOCK_SUBTRACT = 0x10006,
CMD1394_LOCK_THRESH_ADD = 0x10007,
CMD1394_LOCK_THRESH_SUBTRACT = 0x10008,
CMD1394_LOCK_CLIP_ADD = 0x10009,
CMD1394_LOCK_CLIP_SUBTRACT = 0x1000A
} cmd1394_lock_type_t;
typedef struct cmd1394_quadlet {
uint32_t quadlet_data;
} cmd1394_quadlet_t;
typedef struct cmd1394_block {
mblk_t *data_block;
size_t blk_length;
size_t bytes_transferred;
uint_t max_payload;
} cmd1394_block_t;
typedef struct cmd1394_lock32 {
uint32_t old_value;
uint32_t data_value;
uint32_t arg_value;
uint_t num_retries;
cmd1394_lock_type_t lock_type;
} cmd1394_lock32_t;
typedef struct cmd1394_lock64 {
uint64_t old_value;
uint64_t data_value;
uint64_t arg_value;
uint_t num_retries;
cmd1394_lock_type_t lock_type;
} cmd1394_lock64_t;
typedef struct cmd1394_cmd
{
int cmd_version;
volatile int cmd_result;
cmd1394_flags_t cmd_options;
cmd1394_cmd_type_t cmd_type;
void (*completion_callback)(struct cmd1394_cmd *);
opaque_t cmd_callback_arg;
uint64_t cmd_addr;
uint_t cmd_speed;
uint_t bus_generation;
uint_t nodeID;
uint_t broadcast;
union {
cmd1394_quadlet_t q;
cmd1394_block_t b;
cmd1394_lock32_t l32;
cmd1394_lock64_t l64;
} cmd_u;
} cmd1394_cmd_t;
#define CMD1394_ENULL_MBLK (-10)
#define CMD1394_EMBLK_TOO_SMALL (-11)
#define CMD1394_ESTALE_GENERATION (-12)
#define CMD1394_EDEVICE_REMOVED (-13)
#define CMD1394_EINVALID_CONTEXT (-14)
#define CMD1394_EINVALID_COMMAND (-15)
#define CMD1394_EUNKNOWN_ERROR (-16)
#define CMD1394_NOSTATUS (-17)
#define CMD1394_EFATAL_ERROR (-18)
#define CMD1394_ENO_ATREQ (-19)
#define CMD1394_EDEVICE_ERROR (-20)
#define CMD1394_CMDSUCCESS (0)
#define CMD1394_EDEVICE_BUSY (-30)
#define CMD1394_ERETRIES_EXCEEDED (-31)
#define CMD1394_ETYPE_ERROR (-32)
#define CMD1394_EDATA_ERROR (-33)
#define CMD1394_EBUSRESET (-34)
#define CMD1394_EADDRESS_ERROR (-35)
#define CMD1394_ETIMEOUT (-36)
#define CMD1394_ERSRC_CONFLICT (-37)
#define CMD1394_ERR_FIRST CMD1394_CMDSUCCESS
#define CMD1394_ERR_LAST CMD1394_ERSRC_CONFLICT
_NOTE(SCHEME_PROTECTS_DATA("One per call", cmd1394_cmd_t))
#ifdef __cplusplus
}
#endif
#endif