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, CAB F.78, Universitaetstr 6, CH-8092 Zurich.
8 */
9
10interface omap_sdma "Interface for the OMAP44xx SDMA driver" {
11
12    alias uint24 uint32;
13
14    typedef enum {
15        DATA_TYPE_8BIT,
16        DATA_TYPE_16BIT,
17        DATA_TYPE_32BIT
18    } data_type;
19
20    /**
21     * The count_2d struct is used to specify the size of the transferred
22     * frame. It is represented as a two-dimensional grid consisting of pixels.
23     * The x_count and y_count are specified as an amount of pixels.
24     *
25     *    +--->  x      The represented grid cannot exceed the boundaries of
26     *    |             frame capability found in the addr_2d struct.
27     *    v
28     *
29     *    y
30     */
31
32    typedef struct {
33        data_type pixel_size;
34
35        uint32 y_count;
36        uint32 x_count;
37    } count_2d;
38
39    /**
40     * The addr_2d struct can be used for flexible addressing. The x_start and
41     * y_start values define the start offset on each axis. The values of
42     * {x,y}_modify are used to calculate the address of consecutive accesses.
43     *
44     * For normal sequential access, set {x,y}_start to 0 and {x,y}_modify to 1.
45     *
46     * All values have the unit of one pixel, its size is defined in the
47     * count_2d struct. The following pseudo code gives a formal definition
48     * how these values are used:
49     *
50     *  pixel_t *addr; // 8, 16 or 32 bit integer pointer
51     *
52     *  addr += x_start + (y_count * y_start);
53     *  for (y = 1; y <= y_count; y++) {
54     *      for (x = 1; x <= x_count; x++) {
55     *
56     *          access( *addr );
57     *
58     *          if (x < x_count) {
59     *              // within the frame
60     *              addr += x_modify;
61     *          } else {
62     *              // at the end of a frame
63     *              addr += y_modify;
64     *          }
65     *      }
66     *  }
67     */
68
69    typedef struct {
70        cap cap;
71
72        uint32 x_start;
73        uint32 y_start;
74
75        int32 x_modify;
76        int32 y_modify;
77    } addr_2d;
78
79    /**
80     * Copies the whole content of the source frame into the destination frame.
81     */
82    rpc mem_copy(in cap dst, in cap src, out errval err);
83
84    /**
85     * Fills the whole destination frame with the specified color value.
86     */
87    rpc mem_fill(in cap dst, in uint8 color, out errval err);
88
89    /**
90     * Copies the amount of data specified by count_2d from the source frame
91     * to the destination frame. For both, source and destination, flexible
92     * address generation can be used for stride access, see above.
93     *
94     * If the 'transparent' boolean is set, the color value will be used for
95     * transparent copy mode: Source data values matching the color value will
96     * not be written to the destination. For a pixel size of 32 bits, only the
97     * lower 24 bits of the color value are used for comparison.
98     * The color value is ignored if the boolean is set to false.
99     */
100    rpc mem_copy_2d(in addr_2d dst, in addr_2d src, in count_2d count,
101                    in bool transparent, in uint24 color, out errval err);
102
103    /**
104     * Fills the destination frame with the specified color value, using
105     * the flexible, two-dimensional addressing mode described above.
106     * As the color value is 24 bits wide, the upper 8 bits are set to zero
107     * when using a pixel size of 32 bits.
108     */
109    rpc mem_fill_2d(in addr_2d dst, in uint24 color,
110                    in count_2d count, out errval err);
111
112};
113