1 #ifndef _IEEE1394_TRANSACTIONS_H
2 #define _IEEE1394_TRANSACTIONS_H
4 #include "ieee1394_core.h"
8 * Utility functions to fill out packet headers.
10 void fill_async_readquad(struct hpsb_packet
*packet
, u64 addr
);
11 void fill_async_readquad_resp(struct hpsb_packet
*packet
, int rcode
,
13 void fill_async_readblock(struct hpsb_packet
*packet
, u64 addr
, int length
);
14 void fill_async_readblock_resp(struct hpsb_packet
*packet
, int rcode
,
16 void fill_async_writequad(struct hpsb_packet
*packet
, u64 addr
, quadlet_t data
);
17 void fill_async_writeblock(struct hpsb_packet
*packet
, u64 addr
, int length
);
18 void fill_async_write_resp(struct hpsb_packet
*packet
, int rcode
);
19 void fill_async_lock(struct hpsb_packet
*packet
, u64 addr
, int extcode
,
21 void fill_async_lock_resp(struct hpsb_packet
*packet
, int rcode
, int extcode
,
23 void fill_iso_packet(struct hpsb_packet
*packet
, int length
, int channel
,
27 * Get and free transaction labels.
29 int get_tlabel(struct hpsb_host
*host
, nodeid_t nodeid
, int wait
);
30 void free_tlabel(struct hpsb_host
*host
, nodeid_t nodeid
, int tlabel
);
32 struct hpsb_packet
*hpsb_make_readqpacket(struct hpsb_host
*host
, nodeid_t node
,
34 struct hpsb_packet
*hpsb_make_readbpacket(struct hpsb_host
*host
, nodeid_t node
,
35 u64 addr
, size_t length
);
36 struct hpsb_packet
*hpsb_make_writeqpacket(struct hpsb_host
*host
,
37 nodeid_t node
, u64 addr
,
39 struct hpsb_packet
*hpsb_make_writebpacket(struct hpsb_host
*host
,
40 nodeid_t node
, u64 addr
,
42 struct hpsb_packet
*hpsb_make_lockpacket(struct hpsb_host
*host
, nodeid_t node
,
43 u64 addr
, int extcode
);
47 * hpsb_packet_success - Make sense of the ack and reply codes and
48 * return more convenient error codes:
50 * -EBUSY node is busy, try again
51 * -EAGAIN error which can probably resolved by retry
52 * -EREMOTEIO node suffers from an internal error
53 * -EACCES this transaction is not allowed on requested address
54 * -EINVAL invalid address at node
56 int hpsb_packet_success(struct hpsb_packet
*packet
);
60 * The generic read, write and lock functions. All recognize the local node ID
61 * and act accordingly. Read and write automatically use quadlet commands if
62 * length == 4 and and block commands otherwise (however, they do not yet
63 * support lengths that are not a multiple of 4).
65 int hpsb_read(struct hpsb_host
*host
, nodeid_t node
, u64 addr
,
66 quadlet_t
*buffer
, size_t length
);
67 int hpsb_write(struct hpsb_host
*host
, nodeid_t node
, u64 addr
,
68 quadlet_t
*buffer
, size_t length
);
69 int hpsb_lock(struct hpsb_host
*host
, nodeid_t node
, u64 addr
, int extcode
,
70 quadlet_t
*data
, quadlet_t arg
);
72 #endif /* _IEEE1394_TRANSACTIONS_H */