source: rtems/bsps/arm/atsam/include/libchip/include/twid.h @ 71c5552f

Last change on this file since 71c5552f was 2afb22b, checked in by Chris Johns <chrisj@…>, on Dec 23, 2017 at 7:18:56 AM

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: 5.0 KB
Line 
1/* ---------------------------------------------------------------------------- */
2/*                  Atmel Microcontroller Software Support                      */
3/*                       SAM Software Package License                           */
4/* ---------------------------------------------------------------------------- */
5/* Copyright (c) 2015, Atmel Corporation                                        */
6/*                                                                              */
7/* All rights reserved.                                                         */
8/*                                                                              */
9/* Redistribution and use in source and binary forms, with or without           */
10/* modification, are permitted provided that the following condition is met:    */
11/*                                                                              */
12/* - Redistributions of source code must retain the above copyright notice,     */
13/* this list of conditions and the disclaimer below.                            */
14/*                                                                              */
15/* Atmel's name may not be used to endorse or promote products derived from     */
16/* this software without specific prior written permission.                     */
17/*                                                                              */
18/* DISCLAIMER:  THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR   */
19/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE   */
21/* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT,      */
22/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,  */
24/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF    */
25/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING         */
26/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                           */
28/* ---------------------------------------------------------------------------- */
29
30#ifndef _TWID_
31#define _TWID_
32
33/*----------------------------------------------------------------------------
34 *        Headers
35 *----------------------------------------------------------------------------*/
36
37#include "chip.h"
38
39#include <stdint.h>
40
41/*----------------------------------------------------------------------------
42 *        Definition
43 *----------------------------------------------------------------------------*/
44
45/** TWI driver is currently busy. */
46#define TWID_ERROR_BUSY              1
47
48/** Transfer is still pending.*/
49#define ASYNC_STATUS_PENDING        0xFF
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54/*----------------------------------------------------------------------------
55 *        Types
56 *----------------------------------------------------------------------------*/
57
58/*----------------------------------------------------------------------------
59*        Type
60*----------------------------------------------------------------------------*/
61/** \brief Asynchronous transfer descriptor. */
62typedef struct _Async {
63        /** Asynchronous transfer status.*/
64        volatile uint32_t status;
65        /** Callback function to invoke when transfer completes or fails.*/
66        void *callback;
67        /** Driver storage area; do not use.*/
68        uint8_t pStorage[9];
69} Async;
70
71/** \brief TWI driver structure. Holds the internal state of the driver.*/
72typedef struct _Twid {
73        /** Pointer to the underlying TWI peripheral.*/
74        Twihs *pTwi;
75        /** Current asynchronous transfer being processed.*/
76        Async *pTransfer;
77} Twid;
78
79/** \brief TWI driver structure. Holds the internal state of the driver.*/
80typedef struct {
81        uint8_t Twi_id;
82        /** Pointer to the underlying TWI driver.*/
83        Twid *pTwid;
84        /** Pointer to the underlying DMA driver for TWI.*/
85        sXdmad *pTwiDma;
86} TwihsDma;
87
88/*----------------------------------------------------------------------------
89 *        Export functions
90 *----------------------------------------------------------------------------*/
91extern void TWID_Initialize(Twid *pTwid, Twihs *pTwi);
92extern void TWID_DmaInitialize(TwihsDma *pTwidma, Twihs *pTwi,
93                                                           uint8_t bPolling);
94
95extern void TWID_Handler(Twid *pTwid);
96
97extern uint32_t ASYNC_IsFinished(Async *pAsync);
98
99extern uint8_t TWID_Read(
100        Twid *pTwid,
101        uint8_t address,
102        uint32_t iaddress,
103        uint8_t isize,
104        uint8_t *pData,
105        uint32_t num,
106        Async *pAsync);
107
108extern uint8_t TWID_Write(
109        Twid *pTwid,
110        uint8_t address,
111        uint32_t iaddress,
112        uint8_t isize,
113        uint8_t *pData,
114        uint32_t num,
115        Async *pAsync);
116
117extern uint8_t TWID_DmaRead(
118        TwihsDma *pTwiXdma,
119        uint8_t address,
120        uint32_t iaddress,
121        uint8_t isize,
122        uint8_t *pData,
123        uint32_t num,
124        Async *pAsync);
125
126extern uint8_t TWID_DmaWrite(
127        TwihsDma *pTwiXdma,
128        uint8_t address,
129        uint32_t iaddress,
130        uint8_t isize,
131        uint8_t *pData,
132        uint32_t num,
133        Async *pAsync);
134
135#ifdef __cplusplus
136}
137#endif
138
139#endif //#ifndef TWID_H
140
Note: See TracBrowser for help on using the repository browser.