Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #ifndef _IEEE1394_TRANSACTIONS_H |
| 2 | #define _IEEE1394_TRANSACTIONS_H |
| 3 | |
| 4 | #include "ieee1394_core.h" |
| 5 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | int hpsb_get_tlabel(struct hpsb_packet *packet); |
| 7 | void hpsb_free_tlabel(struct hpsb_packet *packet); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | struct hpsb_packet *hpsb_make_readpacket(struct hpsb_host *host, nodeid_t node, |
| 9 | u64 addr, size_t length); |
| 10 | struct hpsb_packet *hpsb_make_lockpacket(struct hpsb_host *host, nodeid_t node, |
Stefan Richter | e1d118f | 2006-07-03 12:02:28 -0400 | [diff] [blame^] | 11 | u64 addr, int extcode, quadlet_t *data, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 12 | quadlet_t arg); |
Stefan Richter | e1d118f | 2006-07-03 12:02:28 -0400 | [diff] [blame^] | 13 | struct hpsb_packet *hpsb_make_lock64packet(struct hpsb_host *host, |
| 14 | nodeid_t node, u64 addr, int extcode, |
| 15 | octlet_t *data, octlet_t arg); |
| 16 | struct hpsb_packet *hpsb_make_phypacket(struct hpsb_host *host, quadlet_t data); |
| 17 | struct hpsb_packet *hpsb_make_isopacket(struct hpsb_host *host, int length, |
| 18 | int channel, int tag, int sync); |
| 19 | struct hpsb_packet *hpsb_make_writepacket(struct hpsb_host *host, |
| 20 | nodeid_t node, u64 addr, |
| 21 | quadlet_t *buffer, size_t length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | struct hpsb_packet *hpsb_make_streampacket(struct hpsb_host *host, u8 *buffer, |
Stefan Richter | e1d118f | 2006-07-03 12:02:28 -0400 | [diff] [blame^] | 23 | int length, int channel, int tag, |
| 24 | int sync); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | |
| 26 | /* |
| 27 | * hpsb_packet_success - Make sense of the ack and reply codes and |
| 28 | * return more convenient error codes: |
| 29 | * 0 success |
| 30 | * -EBUSY node is busy, try again |
| 31 | * -EAGAIN error which can probably resolved by retry |
| 32 | * -EREMOTEIO node suffers from an internal error |
| 33 | * -EACCES this transaction is not allowed on requested address |
| 34 | * -EINVAL invalid address at node |
| 35 | */ |
| 36 | int hpsb_packet_success(struct hpsb_packet *packet); |
| 37 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 38 | /* |
Stefan Richter | e1d118f | 2006-07-03 12:02:28 -0400 | [diff] [blame^] | 39 | * The generic read and write functions. All recognize the local node ID |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | * and act accordingly. Read and write automatically use quadlet commands if |
| 41 | * length == 4 and and block commands otherwise (however, they do not yet |
| 42 | * support lengths that are not a multiple of 4). You must explicitly specifiy |
| 43 | * the generation for which the node ID is valid, to avoid sending packets to |
| 44 | * the wrong nodes when we race with a bus reset. |
| 45 | */ |
| 46 | int hpsb_read(struct hpsb_host *host, nodeid_t node, unsigned int generation, |
| 47 | u64 addr, quadlet_t *buffer, size_t length); |
| 48 | int hpsb_write(struct hpsb_host *host, nodeid_t node, unsigned int generation, |
| 49 | u64 addr, quadlet_t *buffer, size_t length); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | |
| 51 | #endif /* _IEEE1394_TRANSACTIONS_H */ |