source: rtems/bsps/sparc/include/bsp/gpiolib.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: 2.5 KB
Line 
1/*  GPIO Library interface
2 *
3 *  COPYRIGHT (c) 2009.
4 *  Cobham Gaisler AB.
5 *
6 *  The license and distribution terms for this file may be
7 *  found in the file LICENSE in this distribution or at
8 *  http://www.rtems.org/license/LICENSE.
9 */
10
11#ifndef __GPIOLIB_H__
12#define __GPIOLIB_H__
13
14#ifdef __cplusplus
15extern "C" {
16#endif
17
18/* GPIO Config of one GPIO port */
19struct gpiolib_config {
20        char            mask;           /* 0=Masked/1=Unmasked IRQ */
21        char            irq_level;      /* Edge or Level triggered IRQ */
22        char            irq_polarity;   /* Polarity of IRQ */
23};
24
25#define GPIOLIB_IRQ_EDGE 0
26#define GPIOLIB_IRQ_LEVEL 1
27
28#define GPIOLIB_IRQ_POL_LOW 0
29#define GPIOLIB_IRQ_POL_HIGH 1
30
31/* Libarary initialize function must be called befor any other */
32extern int gpiolib_initialize(void);
33
34/*** User Interface ***/
35
36extern void *gpiolib_open(int port);
37extern void *gpiolib_open_by_name(char *devName);
38extern void gpiolib_close(void *handle);
39
40/* Show the current status one or all GPIO ports in the system.
41 * Int port is port nunber, if port = -1 selects all ports.
42 *
43 * If port != -1, handle is used to get port.
44 * If port != -1, handle == NULL, then port is used as port number
45 */
46extern void gpiolib_show(int port, void *handle);
47
48extern int gpiolib_set_config(void *handle, struct gpiolib_config *cfg);
49extern int gpiolib_set(void *handle, int dir, int val);
50extern int gpiolib_get(void *handle, int *inval);
51extern int gpiolib_irq_clear(void *handle);
52extern int gpiolib_irq_enable(void *handle);
53extern int gpiolib_irq_disable(void *handle);
54extern int gpiolib_irq_mask(void *handle);
55extern int gpiolib_irq_unmask(void *handle);
56extern int gpiolib_irq_force(void *handle);
57extern int gpiolib_irq_register(void *handle, void *func, void *arg);
58
59/*** Driver Interface ***/
60
61struct gpiolib_info {
62        char            devName[64];
63};
64
65struct gpiolib_drv_ops {
66        int             (*config)(void *handle, struct gpiolib_config *cfg);
67        int             (*get)(void *handle, int *val);
68        int             (*irq_opts)(void *handle, unsigned int options);
69        int             (*irq_register)(void *handle, void *func, void *arg);
70        int             (*open)(void *handle);
71        int             (*set)(void *handle, int dir, int outval);
72        int             (*show)(void *handle);
73        int             (*get_info)(void *handle, struct gpiolib_info *pinfo);
74};
75
76#define GPIOLIB_IRQ_ENABLE  0x01
77#define GPIOLIB_IRQ_DISABLE 0x02
78#define GPIOLIB_IRQ_CLEAR   0x04
79#define GPIOLIB_IRQ_FORCE   0x08
80#define GPIOLIB_IRQ_MASK    0x10
81#define GPIOLIB_IRQ_UNMASK  0x20
82
83struct gpiolib_drv {
84        struct gpiolib_drv_ops  *ops;
85};
86
87/* Register a GPIO port */
88extern int gpiolib_drv_register(struct gpiolib_drv *drv, void *handle);
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif
Note: See TracBrowser for help on using the repository browser.