1 | /* cache.h |
---|
2 | * |
---|
3 | * Cache Manager |
---|
4 | * |
---|
5 | * COPYRIGHT (c) 1989-1999. |
---|
6 | * On-Line Applications Research Corporation (OAR). |
---|
7 | * |
---|
8 | * The license and distribution terms for this file may be |
---|
9 | * found in the file LICENSE in this distribution or at |
---|
10 | * http://www.OARcorp.com/rtems/license.html. |
---|
11 | * |
---|
12 | * |
---|
13 | * The functions in this file define the API to the RTEMS Cache Manager and |
---|
14 | * are divided into data cache and instruction cache functions. Data cache |
---|
15 | * functions are only meaningful if a data cache is supported. Instruction |
---|
16 | * cache functions are only meaningful if an instruction cache is supported. |
---|
17 | * |
---|
18 | * The functions below are implemented with CPU dependent support routines |
---|
19 | * implemented as part of libcpu. In the event that a CPU does not support a |
---|
20 | * specific function, the CPU dependent routine does nothing (but does exist). |
---|
21 | * |
---|
22 | * At this point, the Cache Manager makes no considerations, and provides no |
---|
23 | * support for BSP specific issues such as a secondary cache. In such a system, |
---|
24 | * the CPU dependent routines would have to be modified, or a BSP layer added |
---|
25 | * to this Manager. |
---|
26 | */ |
---|
27 | |
---|
28 | #ifndef __CACHE_h |
---|
29 | #define __CACHE_h |
---|
30 | |
---|
31 | #ifdef __cplusplus |
---|
32 | extern "C" { |
---|
33 | #endif |
---|
34 | |
---|
35 | #include <rtems/system.h> |
---|
36 | #include <sys/types.h> |
---|
37 | |
---|
38 | /* |
---|
39 | * These functions will ONLY do something if the |
---|
40 | * libcpu support includes data cache routines AND |
---|
41 | * the CPU model supports data caching. |
---|
42 | */ |
---|
43 | |
---|
44 | /* |
---|
45 | * This function is called to flush the data cache by performing cache |
---|
46 | * copybacks. It must determine how many cache lines need to be copied |
---|
47 | * back and then perform the copybacks. |
---|
48 | */ |
---|
49 | void rtems_cache_flush_multiple_data_lines( const void *, size_t ); |
---|
50 | |
---|
51 | /* |
---|
52 | * This function is responsible for performing a data cache invalidate. |
---|
53 | * It must determine how many cache lines need to be invalidated and then |
---|
54 | * perform the invalidations. |
---|
55 | */ |
---|
56 | void rtems_cache_invalidate_multiple_data_lines( const void *, size_t ); |
---|
57 | |
---|
58 | /* |
---|
59 | * This function is responsible for performing a data cache flush. |
---|
60 | * It flushes the entire cache. |
---|
61 | */ |
---|
62 | void rtems_cache_flush_entire_data( void ); |
---|
63 | |
---|
64 | /* |
---|
65 | * This function is responsible for performing a data cache |
---|
66 | * invalidate. It invalidates the entire cache. |
---|
67 | */ |
---|
68 | void rtems_cache_invalidate_entire_data( void ); |
---|
69 | |
---|
70 | /* |
---|
71 | * This function returns the data cache granularity. |
---|
72 | */ |
---|
73 | int rtems_cache_get_data_line_size( void ); |
---|
74 | |
---|
75 | /* |
---|
76 | * This function freezes the data cache. |
---|
77 | */ |
---|
78 | void rtems_cache_freeze_data( void ); |
---|
79 | |
---|
80 | /* |
---|
81 | * This function unfreezes the data cache. |
---|
82 | */ |
---|
83 | void rtems_cache_unfreeze_data( void ); |
---|
84 | |
---|
85 | /* |
---|
86 | * These functions enable/disable the data cache. |
---|
87 | */ |
---|
88 | void rtems_cache_enable_data( void ); |
---|
89 | void rtems_cache_disable_data( void ); |
---|
90 | |
---|
91 | /* |
---|
92 | * These functions will ONLY do something if the |
---|
93 | * libcpu support includes instruction cache routines AND |
---|
94 | * the CPU model supports instruction caching. |
---|
95 | */ |
---|
96 | |
---|
97 | /* |
---|
98 | * This function is responsible for performing an instruction cache |
---|
99 | * invalidate. It must determine how many cache lines need to be invalidated |
---|
100 | * and then perform the invalidations. |
---|
101 | */ |
---|
102 | void rtems_cache_invalidate_multiple_instruction_lines( const void *, size_t ); |
---|
103 | |
---|
104 | /* |
---|
105 | * This function is responsible for performing an instruction cache |
---|
106 | * invalidate. It invalidates the entire cache. |
---|
107 | */ |
---|
108 | void rtems_cache_invalidate_entire_instruction( void ); |
---|
109 | |
---|
110 | /* |
---|
111 | * This function returns the instruction cache granularity. |
---|
112 | */ |
---|
113 | int rtems_cache_get_instruction_line_size( void ); |
---|
114 | |
---|
115 | /* |
---|
116 | * This function freezes the instruction cache. |
---|
117 | */ |
---|
118 | void rtems_cache_freeze_instruction( void ); |
---|
119 | |
---|
120 | /* |
---|
121 | * This function unfreezes the instruction cache. |
---|
122 | */ |
---|
123 | void rtems_cache_unfreeze_instruction( void ); |
---|
124 | |
---|
125 | /* |
---|
126 | * These functions enable/disable the instruction cache. |
---|
127 | */ |
---|
128 | void rtems_cache_enable_instruction( void ); |
---|
129 | void rtems_cache_disable_instruction( void ); |
---|
130 | |
---|
131 | |
---|
132 | #ifdef __cplusplus |
---|
133 | } |
---|
134 | #endif |
---|
135 | |
---|
136 | #endif |
---|
137 | /* end of include file */ |
---|