Mercurial > flash_v2
diff packages/hal/sh/arch/current/include/hal_cache.h @ 128:0c2b7be0d798 ecos-sw-2000-10-12
Merge from eCos master repository on 2000-10-12-08:46:24-BST
| author | jlarmour |
|---|---|
| date | Thu, 12 Oct 2000 20:31:43 +0000 |
| parents | 489eb5632bc3 |
| children | d2f49caf9e38 |
line wrap: on
line diff
--- a/packages/hal/sh/arch/current/include/hal_cache.h +++ b/packages/hal/sh/arch/current/include/hal_cache.h @@ -88,6 +88,8 @@ externC void cyg_hal_cache_enable(void); externC void cyg_hal_cache_disable(void); externC void cyg_hal_cache_invalidate_all(void); externC void cyg_hal_cache_sync(void); +externC void cyg_hal_cache_sync_region(cyg_haladdress base, + cyg_haladdrword len); externC void cyg_hal_cache_write_mode(int mode); // Enable the cache @@ -113,11 +115,23 @@ externC void cyg_hal_cache_write_mode(in //#define HAL_UCACHE_BURST_SIZE(_size_) // Set the cache write mode -#define HAL_UCACHE_WRITE_MODE( _mode_ ) cyg_hal_cache_write_mode(_mode_) +#define HAL_UCACHE_WRITE_MODE( _mode_ ) \ + CYG_MACRO_START \ + cyg_uint32 _m_; \ + if (HAL_UCACHE_WRITETHRU_MODE == _mode_) \ + _m_ = CYGARC_REG_CCR_WT; \ + else \ + _m_ = CYGARC_REG_CCR_CB; \ + cyg_hal_cache_write_mode(_m_); \ + CYG_MACRO_END #define HAL_UCACHE_WRITETHRU_MODE 0 #define HAL_UCACHE_WRITEBACK_MODE 1 +// This macro allows the client to specify separate modes for the two +// regions. +#define HAL_UCACHE_WRITE_MODE_SH( _mode_ ) cyg_hal_cache_write_mode(_mode_) + // Load the contents of the given address range into the cache // and then lock the cache so that it stays there. //#define HAL_UCACHE_LOCK(_base_, _size_) @@ -137,7 +151,8 @@ externC void cyg_hal_cache_write_mode(in // Write dirty cache lines to memory and invalidate the cache entries // for the given address range. -//#define HAL_UCACHE_FLUSH( _base_ , _size_ ) +#define HAL_UCACHE_FLUSH( _base_ , _size_ ) \ + cyg_hal_cache_sync_region(_base_, _size_) // Invalidate cache lines in the given range without writing to memory. //#define HAL_UCACHE_INVALIDATE( _base_ , _size_ ) @@ -145,6 +160,7 @@ externC void cyg_hal_cache_write_mode(in // Write dirty cache lines to memory for the given address range. //#define HAL_UCACHE_STORE( _base_ , _size_ ) + // Preread the given range into the cache with the intention of reading // from it later. //#define HAL_UCACHE_READ_HINT( _base_ , _size_ ) @@ -211,7 +227,7 @@ externC void cyg_hal_cache_write_mode(in // Write dirty cache lines to memory and invalidate the cache entries // for the given address range. -//#define HAL_DCACHE_FLUSH( _base_ , _size_ ) +#define HAL_DCACHE_FLUSH( _base_ , _size_ ) HAL_UCACHE_FLUSH( _base_, _size_ ) // Invalidate cache lines in the given range without writing to memory. //#define HAL_DCACHE_INVALIDATE( _base_ , _size_ )
