source: rtems/bsps/sparc/include/bsp/grpci2dma.h @ 2afb22b

5
Last change on this file since 2afb22b was 2afb22b, checked in by Chris Johns <chrisj@…>, on 12/23/17 at 07:18:56

Remove make preinstall

A speciality of the RTEMS build system was the make preinstall step. It
copied header files from arbitrary locations into the build tree. The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

  • The make preinstall step itself needs time and disk space.
  • Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error.
  • There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult.
  • The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit.
  • An introduction of a new build system is difficult.
  • Include paths specified by the -B option are system headers. This may suppress warnings.
  • The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step. All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

  • cpukit/include
  • cpukit/score/cpu/@RTEMS_CPU@/include
  • cpukit/libnetworking

The new BSP include directories are:

  • bsps/include
  • bsps/@RTEMS_CPU@/include
  • bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed. The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.

  • Property mode set to 100644
File size: 7.9 KB
Line 
1/*
2 *  GRPCI2 DMA Driver
3 *
4 *  COPYRIGHT (c) 2017
5 *  Cobham Gaisler AB
6 *
7 *  The license and distribution terms for this file may be
8 *  found in the file LICENSE in this distribution or at
9 *  http://www.rtems.org/license/LICENSE.
10 *
11 *  OVERVIEW
12 *  ========
13 *  This driver controls the DMA on the GRPCI2 device, located
14 *  at an on-chip AMBA.
15 */
16
17#ifndef __GRPCI2DMA_H__
18#define __GRPCI2DMA_H__
19
20#include <stdint.h>
21#include <stdio.h>
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Error return codes */
28#define GRPCI2DMA_ERR_OK 0
29#define GRPCI2DMA_ERR_WRONGPTR -1
30#define GRPCI2DMA_ERR_NOINIT -2
31#define GRPCI2DMA_ERR_TOOMANY -3
32#define GRPCI2DMA_ERR_ERROR -4
33#define GRPCI2DMA_ERR_STOPDMA -5
34#define GRPCI2DMA_ERR_NOTFOUND -6
35
36/* Size of a dma descriptors */
37#define GRPCI2DMA_BD_CHAN_SIZE 0x10
38#define GRPCI2DMA_BD_DATA_SIZE 0x10
39
40/* Alignment of dma descriptors */
41#define GRPCI2DMA_BD_CHAN_ALIGN 0x10
42#define GRPCI2DMA_BD_DATA_ALIGN 0x10
43
44/* User-helper functions to allocate/deallocate
45 * channel and data descriptors
46 */
47extern void * grpci2dma_channel_new(int number);
48extern void grpci2dma_channel_delete(void * chanbd);
49extern void * grpci2dma_data_new(int number);
50extern void grpci2dma_data_delete(void * databd);
51
52/* Function:
53 *  -grpci2dma_prepare
54 * Description:
55 *  -Prepare a transfer, initializing the required data descriptors
56 * Parameters:
57 *  -pci_start: Where in PCI/remote starts the transfer
58 *  -ahb_start: Where in AHB/local starts the transfer
59 *  -dir: Direction of the transfer (AHBTOPCI or PCITOAHB)
60 *  -endianness: Endianness of the transfer (LITTLEENDIAN or BIGENDIAN)
61 *  -size: Size in bytes of the transfer (the function will calculate if there
62 *  are enough descriptors)
63 *  -databd: Pointer to the data descriptor buffer
64 *  -bdindex: Where in the buffer to start the transfer
65 *  -bdmax: Maximum index for the data descriptor buffer
66 *  -block_size: Size in bytes for each PCI transaction (or block). Guaranteed
67 *  to be at least smaller that this value. Put 0 to use default.
68 *  Default is maximum, which is 0x10000*4 bytes.
69 * Returns:
70 *  -WRONGPTR: Wrong input parameters
71 *  -TOOMANY: Not enough data descriptors in the buffer
72 *  -value > 0: A positive return value means the number of data descriptors
73 *  prepared/used in the buffer, starting from index.
74 */
75#define GRPCI2DMA_AHBTOPCI 1
76#define GRPCI2DMA_PCITOAHB 0
77#define GRPCI2DMA_LITTLEENDIAN 1
78#define GRPCI2DMA_BIGENDIAN 0
79extern int grpci2dma_prepare(
80        uint32_t pci_start, uint32_t ahb_start, int dir, int endianness,
81        int size, void * databd, int bdindex, int bdmax, int block_size);
82
83/* Function:
84 *  -grpci2dma_status
85 * Description:
86 *  -Status of an transfer:
87 * Parameters:
88 *  -databd: Pointer to the data descriptor buffer
89 *  -bdindex: Where in the buffer starts the transfer
90 *  -bdsize: Number of descriptors used by the transfer
91 * Returns:
92 *  -WRONGPTR: Wrong input parameters
93 *  -GRPCI2DMA_BD_DATA_STATUS_ERR: If at least one of the descriptors has an
94 *  error
95 *  -GRPCI2DMA_BD_DATA_STATUS_ENABLED: If at least one of the descriptors is
96 *  enabled, which means that the transfer is still not finished.
97 *  -GRPCI2DMA_BD_DATA_STATUS_DISABLED: If all the descriptors are disabled,
98 *  which means that either the transfer finished or it was never prepared.
99 */
100#define GRPCI2DMA_BD_STATUS_DISABLED 0
101#define GRPCI2DMA_BD_STATUS_ENABLED 1
102#define GRPCI2DMA_BD_STATUS_ERR 2
103extern int grpci2dma_status(void *databd, int bdindex, int bdsize);
104
105/* Function Interrupt-Code ISR callback prototype.
106 * arg     - Custom arg provided by user
107 * cid     - Channel ID that got the interrupt
108 * status  - Error status of the DMA core
109 */
110typedef void (*grpci2dma_isr_t)(void *arg, int cid, unsigned int status);
111
112/* Function:
113 *  -grpci2dma_isr_register
114 * Description:
115 *  -Register an ISR for a channel (and enable interrupts if disabled)
116 * Parameters:
117 *  -chan_no: ID of the channel
118 *  -dmaisr: ISR
119 *  -arg: Argument to pass to the ISR when called
120 * Returns:
121 *  -NOINIT: GRPCI2 DMA not initialized
122 *  -WRONGPTR: Wrong input parameters
123 *  -OK (=0): Done
124 */
125extern int grpci2dma_isr_register(
126        int chan_no, grpci2dma_isr_t dmaisr, void *arg);
127
128/* Function:
129 *  -grpci2dma_isr_unregister
130 * Description:
131 *  -Unregister an ISR for a channel (and enable interrupts if disabled)
132 * Parameters:
133 *  -chan_no: ID of the channel
134 * Returns:
135 *  -NOINIT: GRPCI2 DMA not initialized
136 *  -WRONGPTR: Wrong input parameters
137 *  -OK (=0): Done
138 */
139extern int grpci2dma_isr_unregister(int chan_no);
140
141/* Function:
142 *  -grpci2dma_open
143 * Description:
144 *  -Open a channel (and allocate the descriptor if the user does not provide
145 *  one).
146 * Parameters:
147 *  -chan: Descriptor for the channel (must be aligned to 0x10)
148 * Returns:
149 *  -NOINIT: GRPCI2 DMA not initialized
150 *  -TOOMANY: Maximum number of channels already opened.
151 *  -WRONGPTR: Wrong input parameters
152 *  -ERROR: Inconsistent state found in driver
153 *  -value > 0: A positive return value means the id for the channel.
154 */
155extern int grpci2dma_open(void * chan);
156
157/* Function:
158 *  -grpci2dma_close
159 * Description:
160 *  -Stop and close a channel (and deallocate it if the user did not provide a
161 *  pointer when opening it)
162 * Parameters:
163 *  -chan_no: Id of the channel
164 * Returns:
165 *  -NOINIT: GRPCI2 DMA not initialized
166 *  -NOTFOUND: Channel not opened.
167 *  -STOPDMA: Cannot stop channel.
168 *  -WRONGPTR: Wrong input parameters
169 *  -OK (=0): Done.
170 */
171extern int grpci2dma_close(int chan_no);
172
173/* Function:
174 *  -grpci2dma_start
175 * Description:
176 *  -Start a channel
177 * Parameters:
178 *  -chan_no: Id of the channel
179 *  -options: Maximum number of data descriptors to be executed before moving
180 *  to next channel (up to 0x10000)
181 * Returns:
182 *  -NOINIT: GRPCI2 DMA not initialized
183 *  -WRONGPTR: Wrong input parameters
184 *  -ERROR: Inconsistent state found in driver
185 *  -OK (=0): Done.
186 */
187extern int grpci2dma_start(int chan_no, int options);
188
189/* Function:
190 *  -grpci2dma_stop
191 * Description:
192 *  -Start a channel
193 * Parameters:
194 *  -chan_no: Id of the channel
195 * Returns:
196 *  -NOINIT: GRPCI2 DMA not initialized
197 *  -WRONGPTR: Wrong input parameters
198 *  -ERROR: Inconsistent state found in driver
199 *  -OK (=0): Done.
200 */
201extern int grpci2dma_stop(int chan_no);
202
203/* Function:
204 *  -grpci2dma_push
205 * Description:
206 *  -Push a transfer into a channel (already started or not)
207 * Parameters:
208 *  -chan_no: Id of the channel
209 *  -databd: Pointer to the data descriptor buffer
210 *  -bdindex: Where in the buffer starts the transfer
211 *  -bdsize: Number of descriptors used by the transfer
212 * Returns:
213 *  -NOINIT: GRPCI2 DMA not initialized
214 *  -WRONGPTR: Wrong input parameters
215 *  -NOTFOUND: Channel not opened.
216 *  -OK (=0): Done.
217 */
218extern int grpci2dma_push(int chan_no, void *databd, int bdindex, int bdsize);
219
220/* Function:
221 *  -grpci2dma_active
222 * Description:
223 *  -Check if dma is active
224 * Parameters:
225 * Returns:
226 *  -(!=0): Active.
227 *  -(=0): Not active.
228 */
229extern int grpci2dma_active(void);
230
231/* Function:
232 *  -grpci2dma_interrupt_enable
233 * Description:
234 *  -Enable interrupt for a transfer
235 * Parameters:
236 *  -databd: Pointer to the data descriptor buffer
237 *  -bdindex: Where in the buffer starts the transfer
238 *  -bdmax: Upper limit for index. index < bdmax
239 *  -options:
240 *      (=GRPCI2DMA_OPTIONS_ALL)=Enable interrupt on all transfer descriptors.
241 *      (=GRPCI2DMA_OPTIONS_ONE)=Enable interrupt on transfer descriptor
242 *              indicated by bdindex.
243 * Returns:
244 *  -NOINIT: GRPCI2 DMA not initialized
245 *  -WRONGPTR: Wrong input parameters
246 *  -ERROR: Inconsistent state found in driver
247 *  -OK (=0): Done.
248 */
249#define GRPCI2DMA_OPTIONS_ALL 1
250#define GRPCI2DMA_OPTIONS_ONE 0
251extern int grpci2dma_interrupt_enable(
252        void *databd, int bdindex, int bdmax, int options);
253
254/* Debug function: print dma channel and associated data descriptors.
255 * Only prints if driver internal DEBUG flag is defined. */
256extern int grpci2dma_print(int chan_no);
257extern int grpci2dma_print_bd(void * data);
258
259#ifdef __cplusplus
260}
261#endif
262
263#endif /* __GRPCI2DMA_H__ */
Note: See TracBrowser for help on using the repository browser.