source: rtems/bsps/arm/atsam/include/libchip/include/smc.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: 7.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/**
31*  \file
32*
33*  Definitions and function prototype for SMC module
34*/
35
36#ifndef _SMC_
37#define _SMC_
38
39/*----------------------------------------------------------------------------
40 *        Headers
41 *----------------------------------------------------------------------------*/
42#include "chip.h"
43
44/*----------------------------------------------------------------------------
45 *        Types
46 *----------------------------------------------------------------------------*/
47typedef union _SmcStatus {
48        uint8_t BStatus;
49        struct _SmcStatusBits {
50                uint8_t smcSts: 1,   /**< NAND Flash Controller Status */
51                                xfrDone: 1,  /**< NFC Data Transfer Terminated */
52                                cmdDone: 1,  /**< Command Done */
53                                rbEdge: 1,   /**< Ready/Busy Line 3 Edge Detected*/
54                                hammingReady: 1;  /**< Hamming ecc ready */
55        } bStatus;
56} SmcStatus;
57
58/*----------------------------------------------------------------------------
59 *        Definitions
60 *----------------------------------------------------------------------------*/
61/*
62 * NFC definitions
63 */
64
65/** Base address of NFC SRAM */
66#define NFC_SRAM_BASE_ADDRESS 0x200000
67/** Base address for NFC Address Command */
68#define NFC_CMD_BASE_ADDR     0x70000000
69
70
71/* -------- NFCADDR_CMD : NFC Address Command -------- */
72#define NFCADDR_CMD_CMD1      (0xFFu <<  2)
73/* Command Register Value for Cycle 1 */
74#define NFCADDR_CMD_CMD2      (0xFFu << 10)
75/* Command Register Value for Cycle 2 */
76#define NFCADDR_CMD_VCMD2     (0x1u << 18)
77/* Valid Cycle 2 Command */
78#define NFCADDR_CMD_ACYCLE    (0x7u << 19)
79/* Number of Address required for the current command */
80#define   NFCADDR_CMD_ACYCLE_NONE    (0x0u << 19)
81/* No address cycle */
82#define   NFCADDR_CMD_ACYCLE_ONE     (0x1u << 19)
83/* One address cycle */
84#define   NFCADDR_CMD_ACYCLE_TWO     (0x2u << 19)
85/* Two address cycles */
86#define   NFCADDR_CMD_ACYCLE_THREE   (0x3u << 19)
87/* Three address cycles */
88#define   NFCADDR_CMD_ACYCLE_FOUR    (0x4u << 19)
89/* Four address cycles */
90#define   NFCADDR_CMD_ACYCLE_FIVE    (0x5u << 19)
91/* Five address cycles */
92#define NFCADDR_CMD_CSID      (0x7u << 22)
93/* Chip Select Identifier */
94#define   NFCADDR_CMD_CSID_0                    (0x0u << 22)
95/* CS0 */
96#define   NFCADDR_CMD_CSID_1                    (0x1u << 22)
97/* CS1 */
98#define   NFCADDR_CMD_CSID_2                    (0x2u << 22)
99/* CS2 */
100#define   NFCADDR_CMD_CSID_3                    (0x3u << 22)
101/* CS3 */
102#define   NFCADDR_CMD_CSID_4                    (0x4u << 22)
103/* CS4 */
104#define   NFCADDR_CMD_CSID_5                    (0x5u << 22)
105/* CS5 */
106#define   NFCADDR_CMD_CSID_6                    (0x6u << 22)
107/* CS6 */
108#define   NFCADDR_CMD_CSID_7                    (0x7u << 22)
109/* CS7 */
110#define NFCADDR_CMD_DATAEN   (0x1u << 25)
111/* NFC Data Enable */
112#define NFCADDR_CMD_DATADIS  (0x0u << 25)
113/* NFC Data disable */
114#define NFCADDR_CMD_NFCRD    (0x0u << 26)
115/* NFC Read Enable */
116#define NFCADDR_CMD_NFCWR    (0x1u << 26)
117/* NFC Write Enable */
118#define NFCADDR_CMD_NFCCMD   (0x1u << 27)
119/* NFC Command Enable */
120
121/*
122 * ECC definitions (Hsiao Code Errors)
123 */
124
125/** A single bit was incorrect but has been recovered. */
126#define Hsiao_ERROR_SINGLEBIT         1
127
128/** The original code has been corrupted. */
129#define Hsiao_ERROR_ECC               2
130
131/** Multiple bits are incorrect in the data and they cannot be corrected. */
132#define Hsiao_ERROR_MULTIPLEBITS      3
133
134/*----------------------------------------------------------------------------
135 *        Exported functions
136 *----------------------------------------------------------------------------*/
137
138/*
139 * NFC functions
140 */
141
142extern void SMC_NFC_Configure(uint32_t mode);
143extern void SMC_NFC_Reset(void);
144extern void SMC_NFC_EnableNfc(void);
145extern void SMC_NFC_EnableSpareRead(void);
146extern void SMC_NFC_DisableSpareRead(void);
147extern void SMC_NFC_EnableSpareWrite(void);
148extern void SMC_NFC_DisableSpareWrite(void);
149extern uint8_t SMC_NFC_isSpareRead(void);
150extern uint8_t SMC_NFC_isSpareWrite(void);
151extern uint8_t SMC_NFC_isTransferComplete(void);
152extern uint8_t SMC_NFC_isReadyBusy(void);
153extern uint8_t SMC_NFC_isNfcBusy(void);
154extern uint32_t SMC_NFC_GetStatus(void);
155
156extern void SMC_NFC_SendCommand(uint32_t cmd, uint32_t addressCycle,
157                                                                uint32_t cycle0);
158extern void SMC_NFC_Wait_CommandDone(void);
159extern void SMC_NFC_Wait_XfrDone(void);
160extern void SMC_NFC_Wait_RBbusy(void);
161extern void SMC_NFC_Wait_HammingReady(void);
162
163extern void SMC_ECC_Configure(uint32_t type, uint32_t pageSize);
164extern uint32_t SMC_ECC_GetCorrectoinType(void);
165extern uint8_t SMC_ECC_GetStatus(uint8_t eccNumber);
166
167extern void SMC_ECC_GetValue(uint32_t *ecc);
168extern void SMC_ECC_GetEccParity(uint32_t pageDataSize, uint8_t *code,
169                                                                 uint8_t busWidth);
170extern uint8_t SMC_ECC_VerifyHsiao(uint8_t *data, uint32_t size,
171                                                                   const uint8_t *originalCode, const uint8_t *verifyCode, uint8_t busWidth);
172
173#endif /* #ifndef _SMC_ */
174
Note: See TracBrowser for help on using the repository browser.