diff options
| author | 2022-09-20 00:53:10 -0400 | |
|---|---|---|
| committer | 2022-09-20 00:58:16 -0400 | |
| commit | 48b2af0507fa99bad3b771325b232ad89e60de0a (patch) | |
| tree | d87f8679fc40e6448430e9a4c913821bc9aa9f39 /src/raw1394.h | |
| parent | configure.ac, Changelog, NEWS: update to version 2.1.2 (diff) | |
Implement virtual memory for ARM manager
Instead of allocating memory for address range mappings (ARM) and handling all
reads and writes to said memory, the new ARM manager calls a function for each
received request with the data, transaction code, and allocation information.
The ARM tag manager now must handle validation of memory accesses and
retreive/write the data. This allows implementations to use network resources
or generated data as memory.
The ARM manager no longer automatically sends response packets. It is the
responsibility of the user to send response packets using
raw1394_send_rw_response().
The interface is not implemented for raw1394 and will probably never be
implemented for raw1394. It is for firewire-cdev (modern Linux) only.
Diffstat (limited to 'src/raw1394.h')
| -rw-r--r-- | src/raw1394.h | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/src/raw1394.h b/src/raw1394.h index 7339311..e3027fd 100644 --- a/src/raw1394.h +++ b/src/raw1394.h @@ -705,9 +705,20 @@ typedef int (*tag_handler_t)(raw1394handle_t, unsigned long tag, tag_handler_t raw1394_set_tag_handler(raw1394handle_t handle, tag_handler_t new_h); -typedef int (*arm_tag_handler_t)(raw1394handle_t handle, unsigned long arm_tag, - byte_t request_type, - unsigned int requested_length, void *data); +typedef struct raw1394_arm_allocation_t { + octlet_t tag; + arm_options_t access_rights; + arm_options_t notification_options; + arm_options_t client_transactions; + nodeaddr_t offset; + size_t length; +} raw1394_arm_allocation_t; + +typedef int (*arm_tag_handler_t)( + raw1394handle_t handle, raw1394_arm_allocation_t *arm, + int tcode, unsigned long long offset, int source_node_id, + int card, unsigned kernel_handle, size_t length, void *data +); /** * raw1394_set_arm_tag_handler - set the async request handler @@ -718,11 +729,40 @@ typedef int (*arm_tag_handler_t)(raw1394handle_t handle, unsigned long arm_tag, * arrived. The default action is to call the arm_callback in the * raw1394_arm_reqhandle pointed to by arm_tag. * + * The program will not send requests for you. The kernel_handle and tcode must be + * passed to send_rw_response() along with the data to be sent. + * + * The handler must handle the reads and writes. It must also arrange to call + * send_rw_response(). It should be safe to call send_rw_response() from inside + * the loop. + * * Returns: old handler or NULL on failure (sets errno) **/ arm_tag_handler_t raw1394_set_arm_tag_handler(raw1394handle_t handle, arm_tag_handler_t new_h); +/** + * raw1394_send_rw_response - send response to ARM + * @handle: libraw1394 handle + * @tcode: tcode from ARM tag handler + * @data: data to send + * @len: length of data + * @kernel_handle: handle from ARM tag handler + * + * Send a response to a request packet. The packet may contain data if the + * request was a read request. + * + * The request can also be an error request if the tcode is changed to + * an error code. + * + * If no data should be send, set data = NULL. + * + * Returns: 0 on success or -1 on failure. + */ +int +raw1394_send_rw_response(raw1394handle_t handle, int tcode, void *data, + size_t len, unsigned kernel_handle); + typedef int (*fcp_handler_t)(raw1394handle_t, nodeid_t nodeid, int response, size_t length, unsigned char *data); @@ -779,8 +819,6 @@ struct raw1394_arm_reqhandle { * @handle: libraw1394 handle * @start: identifies address range * @length: identifies address range - * @initial_value: pointer to buffer containing (if necessary) initial value - * NULL means undefined * @arm_tag: identifier for arm_tag_handler * (usually pointer to raw1394_arm_reqhandle) * @access_rights: access-rights for registered address range handled @@ -803,7 +841,7 @@ struct raw1394_arm_reqhandle { * Returns: 0 on success or -1 on failure (sets errno) **/ int raw1394_arm_register(raw1394handle_t handle, nodeaddr_t start, - size_t length, byte_t *initial_value, + size_t length, octlet_t arm_tag, arm_options_t access_rights, arm_options_t notification_options, arm_options_t client_transactions); |
