#ifndef _SYS_1394_IXL1394_H
#define _SYS_1394_IXL1394_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/note.h>
#define IXL1394_EMEM_ALLOC_FAIL (-301)
#define IXL1394_EBAD_IXL_OPCODE (-302)
#define IXL1394_EFRAGMENT_OFLO (-303)
#define IXL1394_ENO_DATA_PKTS (-304)
#define IXL1394_EMISPLACED_RECV (-305)
#define IXL1394_EMISPLACED_SEND (-306)
#define IXL1394_EPKT_HDR_MISSING (-307)
#define IXL1394_ENULL_BUFFER_ADDR (-308)
#define IXL1394_EPKTSIZE_MAX_OFLO (-309)
#define IXL1394_EPKTSIZE_RATIO (-310)
#define IXL1394_EUNAPPLIED_SET_CMD (-311)
#define IXL1394_EDUPLICATE_SET_CMD (-312)
#define IXL1394_EJUMP_NOT_TO_LABEL (-313)
#define IXL1394_EUPDATE_DISALLOWED (-314)
#define IXL1394_EBAD_SKIPMODE (-315)
#define IXL1394_EWRONG_XR_CMD_MODE (-316)
#define IXL1394_EINTERNAL_ERROR (-317)
#define IXL1394_ENOT_IMPLEMENTED (-318)
#define IXL1394_EOPCODE_MISMATCH (-319)
#define IXL1394_EOPCODE_DISALLOWED (-320)
#define IXL1394_EBAD_SKIP_LABEL (-321)
#define IXL1394_EXFER_BUF_MISSING (-322)
#define IXL1394_EXFER_BUF_CNT_DIFF (-323)
#define IXL1394_EORIG_IXL_CORRUPTED (-324)
#define IXL1394_ECOUNT_MISMATCH (-325)
#define IXL1394_EPRE_UPD_DMALOST (-326)
#define IXL1394_EPOST_UPD_DMALOST (-327)
#define IXL1394_ERISK_PROHIBITS_UPD (-328)
#define IXL1394_COMP_ERR_FIRST IXL1394_EMEM_ALLOC_FAIL
#define IXL1394_COMP_ERR_LAST IXL1394_ERISK_PROHIBITS_UPD
#define IXL1394_ENO_DMA_RESRCS (-200)
#define IXL1394_OPF_MASK 0xF800
#define IXL1394_OPF_UPDATE 0x8000
#define IXL1394_OPF_ONRECV 0x4000
#define IXL1394_OPF_ONXMIT 0x2000
#define IXL1394_OPF_ENDSXFER 0x1000
#define IXL1394_OPF_ISXFER 0x0800
#define IXL1394_OPF_ONXFER (IXL1394_OPF_ONXMIT | IXL1394_OPF_ONRECV)
#define IXL1394_OPF_ONXFER_ENDS (IXL1394_OPF_ONXFER | IXL1394_OPF_ENDSXFER)
#define IXL1394_OPF_ONRECV_ENDS (IXL1394_OPF_ONRECV | IXL1394_OPF_ENDSXFER)
#define IXL1394_OPF_ONXMIT_ENDS (IXL1394_OPF_ONXMIT | IXL1394_OPF_ENDSXFER)
#define IXL1394_OPTY_MASK 0x0600
#define IXL1394_OPTY_OTHER 0x0000
#define IXL1394_OPTY_XFER_PKT (0x0000 | IXL1394_OPF_ISXFER)
#define IXL1394_OPTY_XFER_PKT_ST (0x0200 | IXL1394_OPF_ISXFER)
#define IXL1394_OPTY_XFER_BUF_ST (0x0400 | IXL1394_OPF_ISXFER)
#define IXL1394_OPTY_XFER_SPCL_ST (0x0600 | IXL1394_OPF_ISXFER)
#define IXL1394_OP_LABEL (1 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXFER_ENDS)
#define IXL1394_OP_JUMP (2 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXFER_ENDS)
#define IXL1394_OP_CALLBACK (3 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXFER)
#define IXL1394_OP_RECV_PKT (4 | IXL1394_OPTY_XFER_PKT | IXL1394_OPF_ONRECV)
#define IXL1394_OP_RECV_PKT_ST \
(5 | IXL1394_OPTY_XFER_PKT_ST | IXL1394_OPF_ONRECV_ENDS)
#define IXL1394_OP_RECV_BUF \
(6 | IXL1394_OPTY_XFER_BUF_ST | IXL1394_OPF_ONRECV_ENDS)
#define IXL1394_OP_SEND_PKT (7 | IXL1394_OPTY_XFER_PKT | IXL1394_OPF_ONXMIT)
#define IXL1394_OP_SEND_PKT_ST \
(8 | IXL1394_OPTY_XFER_PKT_ST | IXL1394_OPF_ONXMIT_ENDS)
#define IXL1394_OP_SEND_PKT_WHDR_ST \
(9 | IXL1394_OPTY_XFER_PKT_ST | IXL1394_OPF_ONXMIT_ENDS)
#define IXL1394_OP_SEND_BUF \
(10 | IXL1394_OPTY_XFER_BUF_ST | IXL1394_OPF_ONXMIT_ENDS)
#define IXL1394_OP_SEND_HDR_ONLY \
(12 | IXL1394_OPTY_XFER_SPCL_ST | IXL1394_OPF_ONXMIT_ENDS)
#define IXL1394_OP_SEND_NO_PKT \
(13 | IXL1394_OPTY_XFER_SPCL_ST | IXL1394_OPF_ONXMIT_ENDS)
#define IXL1394_OP_STORE_TIMESTAMP \
(14 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXFER)
#define IXL1394_OP_SET_TAGSYNC \
(15 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXMIT_ENDS)
#define IXL1394_OP_SET_SKIPMODE \
(16 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONXMIT_ENDS)
#define IXL1394_OP_SET_SYNCWAIT \
(17 | IXL1394_OPTY_OTHER | IXL1394_OPF_ONRECV_ENDS)
#define IXL1394_OP_JUMP_U (IXL1394_OP_JUMP | IXL1394_OPF_UPDATE)
#define IXL1394_OP_CALLBACK_U (IXL1394_OP_CALLBACK | IXL1394_OPF_UPDATE)
#define IXL1394_OP_RECV_PKT_U (IXL1394_OP_RECV_PKT | IXL1394_OPF_UPDATE)
#define IXL1394_OP_RECV_PKT_ST_U (IXL1394_OP_RECV_PKT_ST | IXL1394_OPF_UPDATE)
#define IXL1394_OP_RECV_BUF_U (IXL1394_OP_RECV_BUF | IXL1394_OPF_UPDATE)
#define IXL1394_OP_SEND_PKT_U (IXL1394_OP_SEND_PKT | IXL1394_OPF_UPDATE)
#define IXL1394_OP_SEND_PKT_ST_U (IXL1394_OP_SEND_PKT_ST | IXL1394_OPF_UPDATE)
#define IXL1394_OP_SEND_PKT_WHDR_ST_U (IXL1394_OP_SEND_PKT_WHDR_ST | \
IXL1394_OPF_UPDATE)
#define IXL1394_OP_SEND_BUF_U (IXL1394_OP_SEND_BUF | IXL1394_OPF_UPDATE)
#define IXL1394_OP_SET_TAGSYNC_U (IXL1394_OP_SET_TAGSYNC | IXL1394_OPF_UPDATE)
#define IXL1394_OP_SET_SKIPMODE_U (IXL1394_OP_SET_SKIPMODE | IXL1394_OPF_UPDATE)
typedef struct ixl_priv_handle *ixl1394_priv_t;
typedef enum {
IXL1394_SKIP_TO_SELF = 0,
IXL1394_SKIP_TO_NEXT = 1,
IXL1394_SKIP_TO_STOP = 2,
IXL1394_SKIP_TO_LABEL = 3
} ixl1394_skip_t;
typedef struct ixl1394_command {
struct ixl1394_command *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
uint32_t operands[1];
} ixl1394_command_t;
_NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
ixl1394_command::compiler_privatep \
ixl1394_command::compiler_resv))
typedef union ixl1394_buf_u {
uint64_t _dmac_ll;
uint32_t _dmac_la[2];
} ixl1394_buf_t;
#define ixldmac_laddr _dmac_ll
#ifdef _LONG_LONG_HTOL
#define ixldmac_notused _dmac_la[0]
#define ixldmac_addr _dmac_la[1]
#else
#define ixldmac_addr _dmac_la[0]
#define ixldmac_notused _dmac_la[1]
#endif
typedef struct ixl1394_xfer_pkt {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
uint16_t size;
uint16_t resv;
ixl1394_buf_t ixl_buf;
caddr_t mem_bufp;
} ixl1394_xfer_pkt_t;
_NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
ixl1394_xfer_pkt::ixl_buf._dmac_ll \
ixl1394_xfer_pkt::ixl_buf._dmac_la \
ixl1394_xfer_pkt::mem_bufp \
ixl1394_xfer_pkt::size))
typedef struct ixl1394_xfer_buf {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
uint16_t size;
uint16_t pkt_size;
ixl1394_buf_t ixl_buf;
caddr_t mem_bufp;
} ixl1394_xfer_buf_t;
_NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
ixl1394_xfer_buf::compiler_privatep \
ixl1394_xfer_buf::ixl_buf._dmac_ll \
ixl1394_xfer_buf::ixl_buf._dmac_la \
ixl1394_xfer_buf::mem_bufp \
ixl1394_xfer_buf::pkt_size \
ixl1394_xfer_buf::size))
typedef struct ixl1394_xmit_special {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
uint16_t count;
uint16_t resv;
} ixl1394_xmit_special_t;
typedef struct ixl1394_callback {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
void (*callback)(opaque_t, struct ixl1394_callback *);
opaque_t callback_arg;
} ixl1394_callback_t;
_NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
ixl1394_callback::callback \
ixl1394_callback::callback_arg))
typedef struct ixl1394_label {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
} ixl1394_label_t;
typedef struct ixl1394_jump {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
ixl1394_command_t *label;
} ixl1394_jump_t;
_NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
ixl1394_jump::label))
typedef struct ixl1394_set_tagsync {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
uint16_t tag;
uint16_t sync;
} ixl1394_set_tagsync_t;
_NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
ixl1394_set_tagsync::sync \
ixl1394_set_tagsync::tag))
typedef struct ixl1394_set_skipmode {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
ixl1394_command_t *label;
ixl1394_skip_t skipmode;
} ixl1394_set_skipmode_t;
_NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
ixl1394_set_skipmode::compiler_privatep \
ixl1394_set_skipmode::label \
ixl1394_set_skipmode::skipmode))
typedef struct ixl1394_set_syncwait {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
} ixl1394_set_syncwait_t;
typedef struct ixl1394_store_timestamp {
ixl1394_command_t *next_ixlp;
ixl1394_priv_t compiler_privatep;
uint16_t compiler_resv;
uint16_t ixl_opcode;
uint16_t timestamp;
uint16_t resv;
} ixl1394_store_timestamp_t;
_NOTE(SCHEME_PROTECTS_DATA("Single thread modifies", \
ixl1394_store_timestamp::timestamp))
#define IXL1394_GET_IR_TIMESTAMP(PKT_QUADLET) ((PKT_QUADLET) & 0x0000FFFF)
#define IXL1394_GET_IR_DATALEN(PKT_QUADLET) (((PKT_QUADLET) & 0xFFFF0000) >> 16)
#define IXL1394_GET_IR_TAG(PKT_QUADLET) (((PKT_QUADLET) & 0x0000C000) >> 14)
#define IXL1394_GET_IR_CHAN(PKT_QUADLET) (((PKT_QUADLET) & 0x00003F00) >> 8)
#define IXL1394_GET_IR_SYNC(PKT_QUADLET) ((PKT_QUADLET) & 0x0000000F)
#ifdef __cplusplus
}
#endif
#endif