123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- /****************************************************************************
- * include/nuttx/cache.h
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership. The
- * ASF licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- *
- ****************************************************************************/
- #ifndef __INCLUDE_NUTTX_CACHE_H
- #define __INCLUDE_NUTTX_CACHE_H
- #ifndef __ASSEMBLY__
- /****************************************************************************
- * Included Files
- ****************************************************************************/
- #include <nuttx/config.h>
- #include <stdint.h>
- #include <sys/types.h>
- /****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
- #ifdef __cplusplus
- #define EXTERN extern "C"
- extern "C"
- {
- #else
- #define EXTERN extern
- #endif
- /****************************************************************************
- * Public Function Prototypes
- ****************************************************************************/
- /****************************************************************************
- * Name: up_enable_icache
- *
- * Description:
- * Enable the I-Cache
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * None
- *
- * Caution:
- * The writable global variables aren't initialized yet.
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_ICACHE
- void up_enable_icache(void);
- #else
- # define up_enable_icache()
- #endif
- /****************************************************************************
- * Name: up_disable_icache
- *
- * Description:
- * Disable the I-Cache
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_ICACHE
- void up_disable_icache(void);
- #else
- # define up_disable_icache()
- #endif
- /****************************************************************************
- * Name: up_invalidate_icache
- *
- * Description:
- * Invalidate the instruction cache within the specified region.
- *
- * Input Parameters:
- * start - virtual start address of region
- * end - virtual end address of region + 1
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_ICACHE
- void up_invalidate_icache(uintptr_t start, uintptr_t end);
- #else
- # define up_invalidate_icache(start, end)
- #endif
- /****************************************************************************
- * Name: up_invalidate_icache_all
- *
- * Description:
- * Invalidate the entire contents of I cache.
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_ICACHE
- void up_invalidate_icache_all(void);
- #else
- # define up_invalidate_icache_all()
- #endif
- /****************************************************************************
- * Name: up_enable_dcache
- *
- * Description:
- * Enable the D-Cache
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * None
- *
- * Caution:
- * The writable global variables aren't initialized yet.
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_DCACHE
- void up_enable_dcache(void);
- #else
- # define up_enable_dcache()
- #endif
- /****************************************************************************
- * Name: up_disable_dcache
- *
- * Description:
- * Disable the D-Cache
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_DCACHE
- void up_disable_dcache(void);
- #else
- # define up_disable_dcache()
- #endif
- /****************************************************************************
- * Name: up_invalidate_dcache
- *
- * Description:
- * Invalidate the data cache within the specified region; we will be
- * performing a DMA operation in this region and we want to purge old data
- * in the cache.
- *
- * Input Parameters:
- * start - virtual start address of region
- * end - virtual end address of region + 1
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_DCACHE
- void up_invalidate_dcache(uintptr_t start, uintptr_t end);
- #else
- # define up_invalidate_dcache(start, end)
- #endif
- /****************************************************************************
- * Name: up_invalidate_dcache_all
- *
- * Description:
- * Invalidate the entire contents of D cache.
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_DCACHE
- void up_invalidate_dcache_all(void);
- #else
- # define up_invalidate_dcache_all()
- #endif
- /****************************************************************************
- * Name: up_clean_dcache
- *
- * Description:
- * Clean the data cache within the specified region by flushing the
- * contents of the data cache to memory.
- *
- * Input Parameters:
- * start - virtual start address of region
- * end - virtual end address of region + 1
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_DCACHE
- void up_clean_dcache(uintptr_t start, uintptr_t end);
- #else
- # define up_clean_dcache(start, end)
- #endif
- /****************************************************************************
- * Name: up_clean_dcache_all
- *
- * Description:
- * Clean the entire data cache within the specified region by flushing the
- * contents of the data cache to memory.
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_DCACHE
- void up_clean_dcache_all(void);
- #else
- # define up_clean_dcache_all()
- #endif
- /****************************************************************************
- * Name: up_flush_dcache
- *
- * Description:
- * Flush the data cache within the specified region by cleaning and
- * invalidating the D cache.
- *
- * Input Parameters:
- * start - virtual start address of region
- * end - virtual end address of region + 1
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_DCACHE
- void up_flush_dcache(uintptr_t start, uintptr_t end);
- #else
- # define up_flush_dcache(start, end)
- #endif
- /****************************************************************************
- * Name: up_flush_dcache_all
- *
- * Description:
- * Flush the entire data cache by cleaning and invalidating the D cache.
- *
- * Input Parameters:
- * None
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_DCACHE
- void up_flush_dcache_all(void);
- #else
- # define up_flush_dcache_all()
- #endif
- /****************************************************************************
- * Name: up_coherent_dcache
- *
- * Description:
- * Ensure that the I and D caches are coherent within specified region
- * by cleaning the D cache (i.e., flushing the D cache contents to memory
- * and invalidating the I cache. This is typically used when code has been
- * written to a memory region, and will be executed.
- *
- * Input Parameters:
- * addr - virtual start address of region
- * len - Size of the address region in bytes
- *
- * Returned Value:
- * None
- *
- ****************************************************************************/
- #ifdef CONFIG_ARCH_ICACHE
- void up_coherent_dcache(uintptr_t addr, size_t len);
- #else
- # define up_coherent_dcache(addr, len)
- #endif
- #undef EXTERN
- #ifdef __cplusplus
- }
- #endif
- #endif /* __ASSEMBLY__ */
- #endif /* __INCLUDE_NUTTX_CACHE_H */
|