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_IOAT_DMA_REQUEST_H
11#define LIB_IOAT_DMA_REQUEST_H
12
13#include <dma/dma_request.h>
14
15struct ioat_dma_device;
16struct ioat_dma_channel;
17struct ioat_dma_request;
18
19/**
20 * \brief pointer type conversion
21 */
22static inline struct ioat_dma_request *dma_request_to_ioat(struct dma_request *req)
23{
24    return (struct ioat_dma_request *)req;
25}
26
27/*
28 * ----------------------------------------------------------------------------
29 * Request Execution
30 * ----------------------------------------------------------------------------
31 */
32
33/**
34 * \brief issues a memcpy request to the given channel
35 *
36 * \param chan  IOAT DMA channel
37 * \param setup request setup information
38 * \param id    returns the generated request id
39 *
40 * \returns SYS_ERR_OK on success
41 *          errval on failure
42 */
43errval_t ioat_dma_request_memcpy_chan(struct dma_channel *chan,
44                                      struct dma_req_setup *setup,
45                                      dma_req_id_t *id);
46
47/**
48 * \brief issues a memcpy request to a channel of the given device
49 *
50 * \param dev   IOAT DMA device
51 * \param setup request setup information
52 * \param id    returns the generated request id
53 *
54 * \returns SYS_ERR_OK on success
55 *          errval on failure
56 */
57errval_t ioat_dma_request_memcpy(struct dma_device *dev,
58                                 struct dma_req_setup *setup,
59                                 dma_req_id_t *id);
60
61/**
62 * \brief issues a memcpy request to the given channel
63 *
64 * \param chan  IOAT DMA channel
65 * \param setup request setup information
66 * \param id    returns the generated request id
67 *
68 * \returns SYS_ERR_OK on success
69 *          errval on failure
70 */
71errval_t ioat_dma_request_memset_chan(struct dma_channel *chan,
72                                      struct dma_req_setup *setup,
73                                      dma_req_id_t *id);
74/**
75 * \brief issues a memset request to a channel of the given device
76 *
77 * \param dev   IOAT DMA device
78 * \param setup request setup information
79 * \param id    returns the generated request id
80 *
81 * \returns SYS_ERR_OK on success
82 *          errval on failure
83 */
84errval_t ioat_dma_request_memset(struct dma_device *dev,
85                                 struct dma_req_setup *setup,
86                                 dma_req_id_t *id);
87/**
88 * \brief issues a NOP / NULL descriptor request on the given channel
89 *
90 * \param chan  IOAT DMA channel
91 * \param setup request setup information
92 */
93void ioat_dma_request_nop_chan(struct ioat_dma_channel *chan);
94
95/**
96 * \brief issues a NOP / NULL descriptor request on the given device
97 *
98 * \param dev   IOAT DMA device
99 * \param setup request setup information
100 *
101 * \returns SYS_ERR_OK on success
102 *          errval on failure
103 */
104void ioat_dma_request_nop(struct ioat_dma_device *dev);
105
106/*
107 * ----------------------------------------------------------------------------
108 * Getters / Setters
109 * ----------------------------------------------------------------------------
110 */
111
112
113
114#endif  /* LIB_IOAT_DMA_DEVICE_H */
115