| 1 |
786 |
skrzyp |
#ifndef CYGONCE_VAR_CACHE_H
|
| 2 |
|
|
#define CYGONCE_VAR_CACHE_H
|
| 3 |
|
|
|
| 4 |
|
|
//=============================================================================
|
| 5 |
|
|
//
|
| 6 |
|
|
// var_cache.h
|
| 7 |
|
|
//
|
| 8 |
|
|
// HAL cache control API
|
| 9 |
|
|
//
|
| 10 |
|
|
//=============================================================================
|
| 11 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
| 12 |
|
|
// -------------------------------------------
|
| 13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
| 14 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
| 15 |
|
|
//
|
| 16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
| 17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
| 18 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
| 19 |
|
|
// version.
|
| 20 |
|
|
//
|
| 21 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
| 22 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 23 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 24 |
|
|
// for more details.
|
| 25 |
|
|
//
|
| 26 |
|
|
// You should have received a copy of the GNU General Public License
|
| 27 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
| 28 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
| 29 |
|
|
//
|
| 30 |
|
|
// As a special exception, if other files instantiate templates or use
|
| 31 |
|
|
// macros or inline functions from this file, or you compile this file
|
| 32 |
|
|
// and link it with other works to produce a work based on this file,
|
| 33 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
| 34 |
|
|
// the GNU General Public License. However the source code for this file
|
| 35 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
| 36 |
|
|
// General Public License v2.
|
| 37 |
|
|
//
|
| 38 |
|
|
// This exception does not invalidate any other reasons why a work based
|
| 39 |
|
|
// on this file might be covered by the GNU General Public License.
|
| 40 |
|
|
// -------------------------------------------
|
| 41 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
| 42 |
|
|
//=============================================================================
|
| 43 |
|
|
//#####DESCRIPTIONBEGIN####
|
| 44 |
|
|
//
|
| 45 |
|
|
// Author(s): msalter
|
| 46 |
|
|
// Contributors: msalter
|
| 47 |
|
|
// Date: 2001-02-12
|
| 48 |
|
|
// Purpose: Cache control API
|
| 49 |
|
|
// Description: The macros defined here provide the HAL APIs for handling
|
| 50 |
|
|
// cache control operations.
|
| 51 |
|
|
// Usage:
|
| 52 |
|
|
// #include <cyg/hal/var_cache.h>
|
| 53 |
|
|
// ...
|
| 54 |
|
|
//
|
| 55 |
|
|
//
|
| 56 |
|
|
//####DESCRIPTIONEND####
|
| 57 |
|
|
//
|
| 58 |
|
|
//=============================================================================
|
| 59 |
|
|
|
| 60 |
|
|
#include <pkgconf/hal.h>
|
| 61 |
|
|
#include <cyg/infra/cyg_type.h>
|
| 62 |
|
|
|
| 63 |
|
|
#include <cyg/hal/hal_arch.h>
|
| 64 |
|
|
#include <cyg/hal/plf_cache.h>
|
| 65 |
|
|
#include <cyg/hal/var_arch.h>
|
| 66 |
|
|
|
| 67 |
|
|
|
| 68 |
|
|
//-----------------------------------------------------------------------------
|
| 69 |
|
|
// Cache dimensions
|
| 70 |
|
|
|
| 71 |
|
|
// Data cache
|
| 72 |
|
|
//#define HAL_DCACHE_SIZE 0 // Size of data cache in bytes
|
| 73 |
|
|
//#define HAL_DCACHE_LINE_SIZE 0 // Size of a data cache line
|
| 74 |
|
|
//#define HAL_DCACHE_WAYS 0 // Associativity of the cache
|
| 75 |
|
|
|
| 76 |
|
|
// Instruction cache
|
| 77 |
|
|
//#define HAL_ICACHE_SIZE 0 // Size of cache in bytes
|
| 78 |
|
|
//#define HAL_ICACHE_LINE_SIZE 0 // Size of a cache line
|
| 79 |
|
|
//#define HAL_ICACHE_WAYS 0 // Associativity of the cache
|
| 80 |
|
|
|
| 81 |
|
|
//#define HAL_DCACHE_SETS 0
|
| 82 |
|
|
//#define HAL_ICACHE_SETS 0
|
| 83 |
|
|
|
| 84 |
|
|
//#define HAL_DCACHE_WRITETHRU_MODE 1
|
| 85 |
|
|
//#define HAL_DCACHE_WRITEBACK_MODE 0
|
| 86 |
|
|
|
| 87 |
|
|
//-----------------------------------------------------------------------------
|
| 88 |
|
|
// Global control of data cache
|
| 89 |
|
|
|
| 90 |
|
|
// Invalidate the entire cache
|
| 91 |
|
|
#define HAL_DCACHE_INVALIDATE_ALL_DEFINED
|
| 92 |
|
|
#define HAL_DCACHE_INVALIDATE_ALL()
|
| 93 |
|
|
|
| 94 |
|
|
// Synchronize the contents of the cache with memory.
|
| 95 |
|
|
#define HAL_DCACHE_SYNC_DEFINED
|
| 96 |
|
|
#define HAL_DCACHE_SYNC()
|
| 97 |
|
|
|
| 98 |
|
|
// Set the data cache refill burst size
|
| 99 |
|
|
//#define HAL_DCACHE_BURST_SIZE(_asize_)
|
| 100 |
|
|
|
| 101 |
|
|
// Set the data cache write mode
|
| 102 |
|
|
//#define HAL_DCACHE_WRITE_MODE( _mode_ )
|
| 103 |
|
|
|
| 104 |
|
|
// Load the contents of the given address range into the data cache
|
| 105 |
|
|
// and then lock the cache so that it stays there.
|
| 106 |
|
|
#define HAL_DCACHE_LOCK_DEFINED
|
| 107 |
|
|
#define HAL_DCACHE_LOCK(_base_, _asize_)
|
| 108 |
|
|
|
| 109 |
|
|
// Undo a previous lock operation
|
| 110 |
|
|
#define HAL_DCACHE_UNLOCK_DEFINED
|
| 111 |
|
|
#define HAL_DCACHE_UNLOCK(_base_, _asize_)
|
| 112 |
|
|
|
| 113 |
|
|
// Unlock entire cache
|
| 114 |
|
|
#define HAL_DCACHE_UNLOCK_ALL_DEFINED
|
| 115 |
|
|
#define HAL_DCACHE_UNLOCK_ALL()
|
| 116 |
|
|
|
| 117 |
|
|
|
| 118 |
|
|
//-----------------------------------------------------------------------------
|
| 119 |
|
|
// Data cache line control
|
| 120 |
|
|
|
| 121 |
|
|
// Allocate cache lines for the given address range without reading its
|
| 122 |
|
|
// contents from memory.
|
| 123 |
|
|
//#define HAL_DCACHE_ALLOCATE( _base_ , _asize_ )
|
| 124 |
|
|
|
| 125 |
|
|
// Write dirty cache lines to memory and invalidate the cache entries
|
| 126 |
|
|
// for the given address range.
|
| 127 |
|
|
#define HAL_DCACHE_FLUSH_DEFINED
|
| 128 |
|
|
#define HAL_DCACHE_FLUSH( _base_ , _asize_ )
|
| 129 |
|
|
|
| 130 |
|
|
|
| 131 |
|
|
// Write dirty cache lines to memory for the given address range.
|
| 132 |
|
|
#define HAL_DCACHE_STORE_DEFINED
|
| 133 |
|
|
#define HAL_DCACHE_STORE( _base_ , _asize_ )
|
| 134 |
|
|
|
| 135 |
|
|
// Invalidate cache lines in the given range without writing to memory.
|
| 136 |
|
|
#define HAL_DCACHE_INVALIDATE_DEFINED
|
| 137 |
|
|
#define HAL_DCACHE_INVALIDATE( _base_ , _asize_ )
|
| 138 |
|
|
|
| 139 |
|
|
|
| 140 |
|
|
//-----------------------------------------------------------------------------
|
| 141 |
|
|
// Global control of Instruction cache
|
| 142 |
|
|
|
| 143 |
|
|
// Invalidate the entire cache
|
| 144 |
|
|
#define HAL_ICACHE_INVALIDATE_ALL_DEFINED
|
| 145 |
|
|
#define HAL_ICACHE_INVALIDATE_ALL()
|
| 146 |
|
|
|
| 147 |
|
|
// Synchronize the contents of the cache with memory.
|
| 148 |
|
|
#define HAL_ICACHE_SYNC_DEFINED
|
| 149 |
|
|
#define HAL_ICACHE_SYNC()
|
| 150 |
|
|
|
| 151 |
|
|
// Set the instruction cache refill burst size
|
| 152 |
|
|
//#define HAL_ICACHE_BURST_SIZE(_asize_)
|
| 153 |
|
|
|
| 154 |
|
|
// Load the contents of the given address range into the data cache
|
| 155 |
|
|
// and then lock the cache so that it stays there.
|
| 156 |
|
|
#define HAL_ICACHE_LOCK_DEFINED
|
| 157 |
|
|
#define HAL_ICACHE_LOCK(_base_, _asize_)
|
| 158 |
|
|
|
| 159 |
|
|
// Undo a previous lock operation
|
| 160 |
|
|
#define HAL_ICACHE_UNLOCK_DEFINED
|
| 161 |
|
|
#define HAL_ICACHE_UNLOCK(_base_, _asize_)
|
| 162 |
|
|
|
| 163 |
|
|
// Unlock entire cache
|
| 164 |
|
|
#define HAL_ICACHE_UNLOCK_ALL_DEFINED
|
| 165 |
|
|
#define HAL_ICACHE_UNLOCK_ALL()
|
| 166 |
|
|
|
| 167 |
|
|
//-----------------------------------------------------------------------------
|
| 168 |
|
|
// Instruction cache line control
|
| 169 |
|
|
|
| 170 |
|
|
// Invalidate cache lines in the given range without writing to memory.
|
| 171 |
|
|
#define HAL_ICACHE_INVALIDATE_DEFINED
|
| 172 |
|
|
#define HAL_ICACHE_INVALIDATE( _base_ , _asize_ )
|
| 173 |
|
|
|
| 174 |
|
|
//-----------------------------------------------------------------------------
|
| 175 |
|
|
// For the flash driver.
|
| 176 |
|
|
|
| 177 |
|
|
#define HAL_FLASH_CACHES_WANT_OPTIMAL
|
| 178 |
|
|
|
| 179 |
|
|
//-----------------------------------------------------------------------------
|
| 180 |
|
|
#endif // ifndef CYGONCE_VAR_CACHE_H
|
| 181 |
|
|
// End of var_cache.h
|