1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup mpc55xx |
---|
5 | * |
---|
6 | * @brief Documentation for this file |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2008 |
---|
11 | * Embedded Brains GmbH |
---|
12 | * Obere Lagerstr. 30 |
---|
13 | * D-82178 Puchheim |
---|
14 | * Germany |
---|
15 | * rtems@embedded-brains.de |
---|
16 | * |
---|
17 | * The license and distribution terms for this file may be found in the file |
---|
18 | * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE. |
---|
19 | */ |
---|
20 | |
---|
21 | /** |
---|
22 | * @defgroup mpc55xx BSP for MPC55xx boards |
---|
23 | */ |
---|
24 | |
---|
25 | /** |
---|
26 | * @defgroup mpc55xx_config Configuration files |
---|
27 | * |
---|
28 | * @ingroup mpc55xx |
---|
29 | * |
---|
30 | * Makefiles, configure scripts etc. |
---|
31 | */ |
---|
32 | |
---|
33 | /** |
---|
34 | * @page mpc55xx_ext_doc External Documentation |
---|
35 | * |
---|
36 | * @section mpc55xx_ext_doc_mpc5567rm_1 MPC5567 Microcontroller Reference Manual (Rev. 1, January 2007, Volume 1 of 2) |
---|
37 | * @section mpc55xx_ext_doc_mpc5567rm_2 MPC5567 Microcontroller Reference Manual (Rev. 1, January 2007, Volume 2 of 2) |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef LIBCPU_POWERPC_MPC55XX_H |
---|
41 | #define LIBCPU_POWERPC_MPC55XX_H |
---|
42 | |
---|
43 | #include <stddef.h> |
---|
44 | #include <stdint.h> |
---|
45 | |
---|
46 | /* Defined in copy.S */ |
---|
47 | int mpc55xx_copy_8( const void *src, void *dest, size_t n); |
---|
48 | |
---|
49 | /* Defined in copy.S */ |
---|
50 | int mpc55xx_zero_8( void *dest, size_t n); |
---|
51 | |
---|
52 | /* Defined in copy.S */ |
---|
53 | int mpc55xx_zero_32( void *dest, size_t n); |
---|
54 | |
---|
55 | /* Defined in fmpll.S */ |
---|
56 | void mpc55xx_fmpll_reset_config(); |
---|
57 | |
---|
58 | /* Defined in fmpll.S */ |
---|
59 | void mpc55xx_fmpll_wait_for_lock(); |
---|
60 | |
---|
61 | /* Defined in fmpll.S */ |
---|
62 | int mpc55xx_get_system_clock(); |
---|
63 | |
---|
64 | /* Defined in fmpll.S */ |
---|
65 | void mpc55xx_system_reset(); |
---|
66 | |
---|
67 | /* Defined in flash.S */ |
---|
68 | void mpc55xx_flash_config(); |
---|
69 | |
---|
70 | #define MPC55XX_CACHE_ALIGNED_MASK ((uintptr_t) 0x1f) |
---|
71 | |
---|
72 | #define MPC55XX_CACHE_LINE_SIZE 32 |
---|
73 | |
---|
74 | /** |
---|
75 | * @brief Returns true if the buffer starting at @a s of size @a n is cache aligned. |
---|
76 | */ |
---|
77 | static inline int mpc55xx_is_cache_aligned( const void *s, size_t n) |
---|
78 | { |
---|
79 | return !(((uintptr_t) s & MPC55XX_CACHE_ALIGNED_MASK) || (n & MPC55XX_CACHE_ALIGNED_MASK)); |
---|
80 | } |
---|
81 | |
---|
82 | static inline void* mpc55xx_cache_aligned_start( const void *s) |
---|
83 | { |
---|
84 | return ((uintptr_t) s & MPC55XX_CACHE_ALIGNED_MASK) ? (((uintptr_t) s & ~MPC55XX_CACHE_ALIGNED_MASK) + MPC55XX_CACHE_LINE_SIZE) : s; |
---|
85 | } |
---|
86 | |
---|
87 | static inline size_t mpc55xx_non_cache_aligned_size( const void *s) |
---|
88 | { |
---|
89 | return (uintptr_t) mpc55xx_cache_aligned_start( s) - (uintptr_t) s; |
---|
90 | } |
---|
91 | |
---|
92 | static inline size_t mpc55xx_cache_aligned_size( const void *s, size_t n) |
---|
93 | { |
---|
94 | return (n - mpc55xx_non_cache_aligned_size( s)) & ~MPC55XX_CACHE_ALIGNED_MASK; |
---|
95 | } |
---|
96 | |
---|
97 | /** |
---|
98 | * @brief Returns the number of leading zeros. |
---|
99 | */ |
---|
100 | static inline uint32_t mpc55xx_count_leading_zeros( uint32_t value) |
---|
101 | { |
---|
102 | uint32_t count; |
---|
103 | asm ( |
---|
104 | "cntlzw %0, %1;" |
---|
105 | : "=r" (count) |
---|
106 | : "r" (value) |
---|
107 | ); |
---|
108 | return count; |
---|
109 | } |
---|
110 | |
---|
111 | #endif /* LIBCPU_POWERPC_MPC55XX_H */ |
---|