1/*
2 * Copyright (c) 2014 ETH Zurich.
3 * All rights reserved.
4 *
5 * This file is distributed under the terms in the attached LICENSE file.
6 * If you do not find this file, copies can be found by writing to:
7 * ETH Zurich D-INFK, Universitaetsstrasse 6, CH-8092 Zurich. Attn: Systems Group.
8 */
9
10#ifndef LIB_DMA_CLIENT_REQUEST_H
11#define LIB_DMA_CLIENT_REQUEST_H
12
13#include <dma/dma_request.h>
14
15struct dma_client_device;
16struct dma_client_channel;
17struct dma_client_request;
18
19/**
20 * \brief pointer type conversion
21 */
22static inline struct dma_client_request *dma_request_to_ioat(struct dma_request *req)
23{
24    return (struct dma_client_request *)req;
25}
26
27/*
28 * ----------------------------------------------------------------------------
29 * DMA Memory Registration / De-Registration
30 * ----------------------------------------------------------------------------
31 */
32
33/**
34 * \brief registers a memory region with a specified client connection
35 *
36 * \param chan  DMA client channel
37 * \param frame the memory frame to register
38 *
39 * \returns SYS_ERR_OK on success
40 */
41errval_t dma_client_register_memory_chan(struct dma_channel *chan,
42                                         struct capref frame);
43
44/**
45 * \brief registers a memory region with a specified client connection
46 *
47 * \param dev   DMA client device
48 * \param frame the memory frame to register
49 *
50 * \returns SYS_ERR_OK on success
51 */
52errval_t dma_client_register_memory(struct dma_device *dev,
53                                    struct capref frame);
54
55/**
56 * \brief deregisters a previously registered memory region from the connection
57 *
58 * \param chan  DMA client channel
59 * \param frame the memory frame to deregister
60 *
61 * \returns SYS_ERR_OK on success
62 */
63errval_t dma_client_deregister_memory_chan(struct dma_channel *chan,
64                                           struct capref frame);
65
66/**
67 * \brief deregisters a previously registered memory region from the connection
68 *
69 * \param dev   DMA client device
70 * \param frame the memory frame to deregister
71 *
72 * \returns SYS_ERR_OK on success
73 */
74errval_t dma_client_deregister_memory(struct dma_device *dev,
75                                      struct capref frame);
76
77/*
78 * ----------------------------------------------------------------------------
79 * Request Execution
80 * ----------------------------------------------------------------------------
81 */
82
83/**
84 * \brief issues a memcopy request to the service using the connection
85 *
86 * \param chan  DMA client channel
87 * \param setup DMA request setup information
88 * \param id    Returns the assigned DMA request ID
89 *
90 * \returns SYS_ERR_OK on success
91 */
92errval_t dma_client_request_memcpy_chan(struct dma_channel *chan,
93                                        struct dma_req_setup *setup,
94                                        dma_req_id_t *id);
95
96/**
97 * \brief issues a memcopy request to the service using the connection
98 *
99 * \param dev   DMA client device
100 * \param setup DMA request setup information
101 * \param id    Returns the assigned DMA request ID
102 *
103 * \returns SYS_ERR_OK on success
104 */
105errval_t dma_client_request_memcpy(struct dma_device *dev,
106                                   struct dma_req_setup *setup,
107                                   dma_req_id_t *id);
108
109
110/*
111 * ----------------------------------------------------------------------------
112 * Getters / Setters
113 * ----------------------------------------------------------------------------
114 */
115
116
117
118#endif  /* LIB_DMA_CLIENT_REQUEST_H */
119