diff --git a/bsp/imxrt1052-evk/drivers/SConscript b/bsp/imxrt1052-evk/drivers/SConscript index 7133fea6fb..73bcec1fd6 100644 --- a/bsp/imxrt1052-evk/drivers/SConscript +++ b/bsp/imxrt1052-evk/drivers/SConscript @@ -8,6 +8,7 @@ cwd = os.path.join(str(Dir('#')), 'drivers') src = Split(""" board.c drv_uart.c +drv_cache.c """) CPPPATH = [cwd] diff --git a/bsp/imxrt1052-evk/drivers/drv_cache.c b/bsp/imxrt1052-evk/drivers/drv_cache.c new file mode 100644 index 0000000000..5cc68c50dc --- /dev/null +++ b/bsp/imxrt1052-evk/drivers/drv_cache.c @@ -0,0 +1,75 @@ +/* + * File : drv_cache.c + * This file is part of RT-Thread RTOS + * COPYRIGHT (C) 2006, RT-Thread Development Team + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rt-thread.org/license/LICENSE + * + * Change Logs: + * Date Author Notes + * 2018-04-02 tanek first implementation + */ + +#include +#include +#include + +void rt_hw_cpu_icache_enable(void) +{ + SCB_EnableICache(); +} + +void rt_hw_cpu_icache_disable(void) +{ + SCB_DisableICache(); +} + +rt_base_t rt_hw_cpu_icache_status(void) +{ + return 0; +} + +void rt_hw_cpu_icache_ops(int ops, void* addr, int size) +{ + if (ops & RT_HW_CACHE_INVALIDATE) + { + ICACHE_InvalidateByRange((uint32_t)addr, size); + } +} + +void rt_hw_cpu_dcache_enable(void) +{ + SCB_EnableDCache(); +} + +void rt_hw_cpu_dcache_disable(void) +{ + SCB_DisableDCache(); +} + +rt_base_t rt_hw_cpu_dcache_status(void) +{ + return 0; +} + +void rt_hw_cpu_dcache_ops(int ops, void* addr, int size) +{ + if (ops & (RT_HW_CACHE_FLUSH | RT_HW_CACHE_INVALIDATE)) + { + DCACHE_CleanInvalidateByRange((uint32_t)addr, size); + } + else if (ops & RT_HW_CACHE_FLUSH) + { + DCACHE_CleanByRange((uint32_t)addr, size); + } + else if (ops & RT_HW_CACHE_INVALIDATE) + { + DCACHE_InvalidateByRange((uint32_t)addr, size); + } + else + { + RT_ASSERT(0); + } +} diff --git a/bsp/imxrt1052-evk/project.ewp b/bsp/imxrt1052-evk/project.ewp index 5443606ca3..d218142329 100644 --- a/bsp/imxrt1052-evk/project.ewp +++ b/bsp/imxrt1052-evk/project.ewp @@ -308,7 +308,7 @@ $PROJ_DIR$\Libraries\drivers $PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include $PROJ_DIR$\..\..\components\net\lwip-2.0.2\src - $PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\posix + $PROJ_DIR$\drivers $PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\ipv4 $PROJ_DIR$\. $PROJ_DIR$\..\..\libcpu\arm\cortex-m7 @@ -316,10 +316,11 @@ $PROJ_DIR$\..\..\components\dfs\filesystems\devfs $PROJ_DIR$\Libraries\CMSIS\Include $PROJ_DIR$\Libraries\utilities + $PROJ_DIR$\..\..\components\drivers\spi $PROJ_DIR$\applications $PROJ_DIR$\..\..\components\finsh $PROJ_DIR$\..\..\components\dfs\filesystems\elmfat - $PROJ_DIR$\drivers + $PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\include\posix $PROJ_DIR$\..\..\components\net\lwip-2.0.2\src\arch\include