source: rtems/bsps/powerpc/include/mpc55xx/mpc55xx.h @ d7c232f

5
Last change on this file since d7c232f 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: 4.3 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup mpc55xx
5 *
6 * @brief Documentation for this file
7 */
8
9/*
10 * Copyright (c) 2008-2012 embedded brains GmbH.  All rights reserved.
11 *
12 *  embedded brains GmbH
13 *  Obere Lagerstr. 30
14 *  82178 Puchheim
15 *  Germany
16 *  <rtems@embedded-brains.de>
17 *
18 * The license and distribution terms for this file may be
19 * found in the file LICENSE in this distribution or at
20 * http://www.rtems.org/license/LICENSE.
21 */
22
23/**
24 * @defgroup mpc55xx BSP for MPC55xx boards
25 */
26
27/**
28 * @defgroup mpc55xx_config Configuration files
29 *
30 * @ingroup mpc55xx
31 *
32 * Makefiles, configure scripts etc.
33 */
34
35/**
36 * @page mpc55xx_ext_doc External Documentation
37 *
38 * @section mpc55xx_ext_doc_mpc5567rm_1 MPC5567 Microcontroller Reference Manual (Rev. 1, January 2007, Volume 1 of 2)
39 * @section mpc55xx_ext_doc_mpc5567rm_2 MPC5567 Microcontroller Reference Manual (Rev. 1, January 2007, Volume 2 of 2)
40 */
41
42#ifndef LIBCPU_POWERPC_MPC55XX_H
43#define LIBCPU_POWERPC_MPC55XX_H
44
45#include <mpc55xx/regs.h>
46#include <mpc55xx/regs-mmu.h>
47
48#include <libcpu/powerpc-utility.h>
49
50#ifdef __cplusplus
51extern "C" {
52#endif /* __cplusplus */
53
54int mpc55xx_flash_copy(void *dest, const void *src, size_t nbytes);
55int mpc55xx_flash_copy_op(void *rdest, const void *src, size_t nbytes,
56  uint32_t opmask, uint32_t *p_fail_addr);
57int mpc55xx_flash_size(uint32_t *p_size);
58int mpc55xx_flash_writable(void);
59uint32_t mpc55xx_flash_address(void);
60void mpc55xx_flash_set_read_only(void);
61void mpc55xx_flash_set_read_write(void);
62
63int mpc55xx_physical_address(const void *addr, uint32_t *p_result);
64int mpc55xx_mapped_address(const void *addr, uint32_t *p_result);
65
66/* Bits for opmask. */
67#define MPC55XX_FLASH_BLANK_CHECK 0x01
68#define MPC55XX_FLASH_UNLOCK      0x02
69#define MPC55XX_FLASH_ERASE       0x04
70#define MPC55XX_FLASH_PROGRAM     0x08
71#define MPC55XX_FLASH_VERIFY      0x10
72
73/* Error returns.  CONFIG or SIZE might mean you just
74 * need to check for new configuration bits.
75 * SIZE and RANGE mean you are outside of a known flash region.
76 * ERASE means the erase failed,
77 * PROGRAM means the program failed,
78 * BLANK means it wasn't blank and BLANK_CHECK was specified,
79 * VERIFY means VERIFY was set and it didn't match the source,
80 * and LOCK means either the locking failed or you needed to
81 * specify MPC55XX_FLASH_UNLOCK and didn't.
82 */
83#define MPC55XX_FLASH_CONFIG_ERR    (-1)
84#define MPC55XX_FLASH_SIZE_ERR      (-2)
85#define MPC55XX_FLASH_RANGE_ERR     (-3)
86#define MPC55XX_FLASH_ERASE_ERR     (-4)
87#define MPC55XX_FLASH_PROGRAM_ERR   (-5)
88#define MPC55XX_FLASH_NOT_BLANK_ERR (-6)
89#define MPC55XX_FLASH_VERIFY_ERR    (-7)
90#define MPC55XX_FLASH_LOCK_ERR      (-8)
91
92#define MPC55XX_CACHE_ALIGNED_MASK ((uintptr_t) 0x1f)
93
94#define MPC55XX_CACHE_LINE_SIZE 32
95
96/**
97 * @brief Returns true if the buffer starting at @a s of size @a n is cache aligned.
98 */
99static inline int mpc55xx_is_cache_aligned( const void *s, size_t n)
100{
101        return !(((uintptr_t) s & MPC55XX_CACHE_ALIGNED_MASK) || (n & MPC55XX_CACHE_ALIGNED_MASK));
102}
103
104static inline uintptr_t mpc55xx_cache_aligned_start( const void *s)
105{
106        return ((uintptr_t) s & MPC55XX_CACHE_ALIGNED_MASK) ? (((uintptr_t) s & ~MPC55XX_CACHE_ALIGNED_MASK) + MPC55XX_CACHE_LINE_SIZE) : (uintptr_t)s;
107}
108
109static inline size_t mpc55xx_non_cache_aligned_size( const void *s)
110{
111        return (uintptr_t) mpc55xx_cache_aligned_start( s) - (uintptr_t) s;
112}
113
114static inline size_t mpc55xx_cache_aligned_size( const void *s, size_t n)
115{
116        return (n - mpc55xx_non_cache_aligned_size( s)) & ~MPC55XX_CACHE_ALIGNED_MASK;
117}
118
119/**
120 * @brief Returns the number of leading zeros.
121 */
122static inline uint32_t mpc55xx_count_leading_zeros( uint32_t value)
123{
124        uint32_t count;
125        __asm__ (
126                "cntlzw %0, %1;"
127                : "=r" (count)
128                : "r" (value)
129        );
130        return count;
131}
132
133static inline void mpc55xx_wait_for_interrupt(void)
134{
135  #ifdef MPC55XX_HAS_WAIT_INSTRUCTION
136    __asm__ volatile ("wait");
137  #else
138    __asm__ volatile ("");
139  #endif
140}
141
142static inline void mpc55xx_mmu_apply_config(const struct MMU_tag *config)
143{
144  PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS0, config->MAS0.R);
145  PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1, config->MAS1.R);
146  PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS2, config->MAS2.R);
147  PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS3, config->MAS3.R);
148  __asm__ volatile ("tlbwe");
149}
150
151#ifdef __cplusplus
152}
153#endif /* __cplusplus */
154
155#endif /* LIBCPU_POWERPC_MPC55XX_H */
Note: See TracBrowser for help on using the repository browser.