2019-03-19 10:37:13 -06:00
|
|
|
/****************************************************************************
|
|
|
|
|
* include/nuttx/cache.h
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
2020-08-23 00:36:57 +08:00
|
|
|
* 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
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
2020-08-23 00:36:57 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
2020-08-23 00:36:57 +08:00
|
|
|
* 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.
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
2019-03-19 10:37:13 -06:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_NUTTX_CACHE_H
|
|
|
|
|
#define __INCLUDE_NUTTX_CACHE_H
|
2015-12-14 08:40:38 -06:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifndef __ASSEMBLY__
|
2015-12-14 08:40:38 -06:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
/****************************************************************************
|
2015-12-14 08:40:38 -06:00
|
|
|
* Included Files
|
2019-03-19 10:37:13 -06:00
|
|
|
****************************************************************************/
|
2015-12-14 08:40:38 -06:00
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <sys/types.h>
|
2015-12-14 08:40:38 -06:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
/****************************************************************************
|
2015-12-14 08:40:38 -06:00
|
|
|
* Pre-processor Definitions
|
2019-03-19 10:37:13 -06:00
|
|
|
****************************************************************************/
|
2015-12-14 08:40:38 -06:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
#define EXTERN extern "C"
|
|
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#else
|
|
|
|
|
#define EXTERN extern
|
|
|
|
|
#endif
|
2016-03-22 15:50:12 +09:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
/****************************************************************************
|
2020-08-23 01:15:21 +08:00
|
|
|
* Public Function Prototypes
|
2019-03-19 10:37:13 -06:00
|
|
|
****************************************************************************/
|
2016-03-22 15:50:12 +09:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
/****************************************************************************
|
|
|
|
|
* Name: up_enable_icache
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
* Enable the I-Cache
|
|
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
* Caution:
|
|
|
|
|
* The writable global variables aren't initialized yet.
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
2016-03-22 15:50:12 +09:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_ICACHE
|
|
|
|
|
void up_enable_icache(void);
|
|
|
|
|
#else
|
include/nuttx: Fix improper use of inline
I finally figured out why the ez80 code has gotten so big. It is because people have been put putting big inline functions in header files. That is a violation of the coding standard, since only c89 compatibility is required in all common code. But we have been tolerating inline function it because include/nuttx/compiler.h defines 'inline' to be nothing for C89 compilers.
As a result, static inline functions declared within a C file not so bad; the inline qualifier is ignored, if not supported, but otherwise all is well.
But it is catastrophic in header files. Those static inline functions are included as static functions and implemented in EVERY file that includes those header files, even if the functions are never called. That makes the code base huge!So there is another PR coming to fix some of the worst offenders.
This commit fixes two of the worst offenders I have encountered so far: include/nuttx/sempahore.h and cache.h. But there may be a few other changes needed. Under include/nuttx there are still inline functions thread.h, inclue/nuttx/list.h, mutex.h, tree.h, and include/nuttx/crypto/blake2s.h with no protection for compilers that do not handler the inline qualifier. Otherwise we are clean.
With the changes to these two header files, the size of the z20x build is reduced by about 40%. And incredible size savings.
2020-03-02 14:51:28 -06:00
|
|
|
# define up_enable_icache()
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2015-12-14 08:40:38 -06:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
/****************************************************************************
|
|
|
|
|
* 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
|
include/nuttx: Fix improper use of inline
I finally figured out why the ez80 code has gotten so big. It is because people have been put putting big inline functions in header files. That is a violation of the coding standard, since only c89 compatibility is required in all common code. But we have been tolerating inline function it because include/nuttx/compiler.h defines 'inline' to be nothing for C89 compilers.
As a result, static inline functions declared within a C file not so bad; the inline qualifier is ignored, if not supported, but otherwise all is well.
But it is catastrophic in header files. Those static inline functions are included as static functions and implemented in EVERY file that includes those header files, even if the functions are never called. That makes the code base huge!So there is another PR coming to fix some of the worst offenders.
This commit fixes two of the worst offenders I have encountered so far: include/nuttx/sempahore.h and cache.h. But there may be a few other changes needed. Under include/nuttx there are still inline functions thread.h, inclue/nuttx/list.h, mutex.h, tree.h, and include/nuttx/crypto/blake2s.h with no protection for compilers that do not handler the inline qualifier. Otherwise we are clean.
With the changes to these two header files, the size of the z20x build is reduced by about 40%. And incredible size savings.
2020-03-02 14:51:28 -06:00
|
|
|
# define up_disable_icache()
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2015-12-14 08:40:38 -06:00
|
|
|
|
|
|
|
|
/****************************************************************************
|
2019-03-19 10:37:13 -06:00
|
|
|
* Name: up_invalidate_icache
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Description:
|
2019-03-19 10:37:13 -06:00
|
|
|
* Invalidate the instruction cache within the specified region.
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* start - virtual start address of region
|
|
|
|
|
* end - virtual end address of region + 1
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_ICACHE
|
|
|
|
|
void up_invalidate_icache(uintptr_t start, uintptr_t end);
|
|
|
|
|
#else
|
2020-03-04 08:40:34 -06:00
|
|
|
# define up_invalidate_icache(start, end)
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2015-12-14 08:40:38 -06:00
|
|
|
|
|
|
|
|
/****************************************************************************
|
2019-03-19 10:37:13 -06:00
|
|
|
* Name: up_invalidate_icache_all
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Description:
|
2019-03-19 10:37:13 -06:00
|
|
|
* Invalidate the entire contents of I cache.
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_ICACHE
|
|
|
|
|
void up_invalidate_icache_all(void);
|
2015-12-14 08:40:38 -06:00
|
|
|
#else
|
include/nuttx: Fix improper use of inline
I finally figured out why the ez80 code has gotten so big. It is because people have been put putting big inline functions in header files. That is a violation of the coding standard, since only c89 compatibility is required in all common code. But we have been tolerating inline function it because include/nuttx/compiler.h defines 'inline' to be nothing for C89 compilers.
As a result, static inline functions declared within a C file not so bad; the inline qualifier is ignored, if not supported, but otherwise all is well.
But it is catastrophic in header files. Those static inline functions are included as static functions and implemented in EVERY file that includes those header files, even if the functions are never called. That makes the code base huge!So there is another PR coming to fix some of the worst offenders.
This commit fixes two of the worst offenders I have encountered so far: include/nuttx/sempahore.h and cache.h. But there may be a few other changes needed. Under include/nuttx there are still inline functions thread.h, inclue/nuttx/list.h, mutex.h, tree.h, and include/nuttx/crypto/blake2s.h with no protection for compilers that do not handler the inline qualifier. Otherwise we are clean.
With the changes to these two header files, the size of the z20x build is reduced by about 40%. And incredible size savings.
2020-03-02 14:51:28 -06:00
|
|
|
# define up_invalidate_icache_all()
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2015-12-14 08:40:38 -06:00
|
|
|
|
2021-10-19 12:15:43 +08:00
|
|
|
/****************************************************************************
|
|
|
|
|
* Name: up_lock_icache
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
* Prefetch and lock the instruction cache within the specified region.
|
|
|
|
|
* If the specified address if not present in the instruction cache,
|
|
|
|
|
* some architectures transfer the line from memory, others wait the
|
|
|
|
|
* address be read from memory, and then lock.
|
|
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* start - virtual start address of region
|
|
|
|
|
* end - virtual end address of region + 1
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_ICACHE_LOCK
|
|
|
|
|
void up_lock_icache(uintptr_t start, uintptr_t end);
|
|
|
|
|
#else
|
|
|
|
|
# define up_lock_icache()
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
* Name: up_unlock_icache
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
* Unlock 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_LOCK
|
|
|
|
|
void up_unlock_icache(uintptr_t start, uintptr_t end);
|
|
|
|
|
#else
|
|
|
|
|
# define up_unlock_icache()
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
* Name: up_unlock_icache_all
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
* Unlock the entire contents of instruction cache.
|
|
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_ICACHE_LOCK
|
|
|
|
|
void up_unlock_icache_all(void);
|
|
|
|
|
#else
|
|
|
|
|
# define up_unlock_icache_all()
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-08-23 01:15:21 +08:00
|
|
|
/****************************************************************************
|
2019-03-19 10:37:13 -06:00
|
|
|
* Name: up_enable_dcache
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Description:
|
2019-03-19 10:37:13 -06:00
|
|
|
* Enable the D-Cache
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
2019-03-19 10:37:13 -06:00
|
|
|
* Caution:
|
|
|
|
|
* The writable global variables aren't initialized yet.
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
2015-12-14 08:40:38 -06:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_DCACHE
|
|
|
|
|
void up_enable_dcache(void);
|
|
|
|
|
#else
|
include/nuttx: Fix improper use of inline
I finally figured out why the ez80 code has gotten so big. It is because people have been put putting big inline functions in header files. That is a violation of the coding standard, since only c89 compatibility is required in all common code. But we have been tolerating inline function it because include/nuttx/compiler.h defines 'inline' to be nothing for C89 compilers.
As a result, static inline functions declared within a C file not so bad; the inline qualifier is ignored, if not supported, but otherwise all is well.
But it is catastrophic in header files. Those static inline functions are included as static functions and implemented in EVERY file that includes those header files, even if the functions are never called. That makes the code base huge!So there is another PR coming to fix some of the worst offenders.
This commit fixes two of the worst offenders I have encountered so far: include/nuttx/sempahore.h and cache.h. But there may be a few other changes needed. Under include/nuttx there are still inline functions thread.h, inclue/nuttx/list.h, mutex.h, tree.h, and include/nuttx/crypto/blake2s.h with no protection for compilers that do not handler the inline qualifier. Otherwise we are clean.
With the changes to these two header files, the size of the z20x build is reduced by about 40%. And incredible size savings.
2020-03-02 14:51:28 -06:00
|
|
|
# define up_enable_dcache()
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2015-12-14 08:40:38 -06:00
|
|
|
|
|
|
|
|
/****************************************************************************
|
2019-03-19 10:37:13 -06:00
|
|
|
* Name: up_disable_dcache
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Description:
|
2019-03-19 10:37:13 -06:00
|
|
|
* Disable the D-Cache
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
2019-03-19 10:37:13 -06:00
|
|
|
* None
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_DCACHE
|
|
|
|
|
void up_disable_dcache(void);
|
|
|
|
|
#else
|
2020-03-04 08:40:34 -06:00
|
|
|
# define up_disable_dcache()
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2015-12-14 08:40:38 -06:00
|
|
|
|
|
|
|
|
/****************************************************************************
|
2019-03-19 10:37:13 -06:00
|
|
|
* Name: up_invalidate_dcache
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Description:
|
2019-03-19 10:37:13 -06:00
|
|
|
* 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.
|
2015-12-14 08:40:38 -06:00
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* start - virtual start address of region
|
|
|
|
|
* end - virtual end address of region + 1
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_DCACHE
|
|
|
|
|
void up_invalidate_dcache(uintptr_t start, uintptr_t end);
|
|
|
|
|
#else
|
2020-03-04 09:33:55 -06:00
|
|
|
# define up_invalidate_dcache(start, end)
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2015-12-14 08:40:38 -06:00
|
|
|
|
2016-03-22 15:50:12 +09:00
|
|
|
/****************************************************************************
|
2019-03-19 10:37:13 -06:00
|
|
|
* Name: up_invalidate_dcache_all
|
2016-03-22 15:50:12 +09:00
|
|
|
*
|
|
|
|
|
* Description:
|
2019-03-19 10:37:13 -06:00
|
|
|
* Invalidate the entire contents of D cache.
|
2016-03-22 15:50:12 +09:00
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_DCACHE
|
|
|
|
|
void up_invalidate_dcache_all(void);
|
|
|
|
|
#else
|
2020-03-04 08:40:34 -06:00
|
|
|
# define up_invalidate_dcache_all()
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2016-03-22 15:50:12 +09:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
/****************************************************************************
|
|
|
|
|
* 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
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
2016-03-22 15:50:12 +09:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_DCACHE
|
|
|
|
|
void up_clean_dcache(uintptr_t start, uintptr_t end);
|
|
|
|
|
#else
|
2020-03-04 08:40:34 -06:00
|
|
|
# define up_clean_dcache(start, end)
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2016-03-22 15:50:12 +09:00
|
|
|
|
|
|
|
|
/****************************************************************************
|
2019-03-19 10:37:13 -06:00
|
|
|
* 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
|
2020-03-04 08:40:34 -06:00
|
|
|
# define up_clean_dcache_all()
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2016-03-22 15:50:12 +09:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
/****************************************************************************
|
|
|
|
|
* 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
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
2016-03-22 15:50:12 +09:00
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_DCACHE
|
|
|
|
|
void up_flush_dcache(uintptr_t start, uintptr_t end);
|
|
|
|
|
#else
|
2020-03-04 08:40:34 -06:00
|
|
|
# define up_flush_dcache(start, end)
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
2016-03-22 15:50:12 +09:00
|
|
|
|
2015-12-14 08:40:38 -06:00
|
|
|
/****************************************************************************
|
2019-03-19 10:37:13 -06:00
|
|
|
* Name: up_flush_dcache_all
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
* Flush the entire data cache by cleaning and invalidating the D cache.
|
|
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
2015-12-14 08:40:38 -06:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_DCACHE
|
|
|
|
|
void up_flush_dcache_all(void);
|
2015-12-14 08:40:38 -06:00
|
|
|
#else
|
2020-03-04 08:40:34 -06:00
|
|
|
# define up_flush_dcache_all()
|
2015-12-14 08:40:38 -06:00
|
|
|
#endif
|
|
|
|
|
|
2021-10-19 12:15:43 +08:00
|
|
|
/****************************************************************************
|
|
|
|
|
* Name: up_lock_dcache
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
* Prefetch and lock the data cache within the specified region.
|
|
|
|
|
* If the specified address is not present in the data cache,
|
|
|
|
|
* some architectures transfer the line from memory, others wait the
|
|
|
|
|
* address be read from memory, and then lock.
|
|
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* start - virtual start address of region
|
|
|
|
|
* end - virtual end address of region + 1
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_DCACHE_LOCK
|
|
|
|
|
void up_lock_dcache(uintptr_t start, uintptr_t end);
|
|
|
|
|
#else
|
|
|
|
|
# define up_lock_dcache()
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
* Name: up_unlock_dcache
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
* Unlock the data 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_DCACHE_LOCK
|
|
|
|
|
void up_unlock_dcache(uintptr_t start, uintptr_t end);
|
|
|
|
|
#else
|
|
|
|
|
# define up_unlock_dcache()
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
|
* Name: up_unlock_dcache_all
|
|
|
|
|
*
|
|
|
|
|
* Description:
|
|
|
|
|
* Unlock the entire contents of data cache.
|
|
|
|
|
*
|
|
|
|
|
* Input Parameters:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
* Returned Value:
|
|
|
|
|
* None
|
|
|
|
|
*
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifdef CONFIG_ARCH_DCACHE_LOCK
|
|
|
|
|
void up_unlock_dcache_all(void);
|
|
|
|
|
#else
|
|
|
|
|
# define up_unlock_dcache_all()
|
|
|
|
|
#endif
|
|
|
|
|
|
2015-12-14 08:40:38 -06:00
|
|
|
/****************************************************************************
|
2019-03-19 10:37:13 -06:00
|
|
|
* 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
|
|
|
|
|
*
|
2015-12-14 08:40:38 -06:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#ifdef CONFIG_ARCH_ICACHE
|
|
|
|
|
void up_coherent_dcache(uintptr_t addr, size_t len);
|
|
|
|
|
#else
|
2020-03-04 08:40:34 -06:00
|
|
|
# define up_coherent_dcache(addr, len)
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif
|
|
|
|
|
|
2015-12-14 08:40:38 -06:00
|
|
|
#undef EXTERN
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2019-03-19 10:37:13 -06:00
|
|
|
|
2015-12-14 08:40:38 -06:00
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
|
|
2019-03-19 10:37:13 -06:00
|
|
|
#endif /* __INCLUDE_NUTTX_CACHE_H */
|