2009-07-03 07:18:14 +08:00
|
|
|
/*
|
2021-03-27 17:51:56 +08:00
|
|
|
* Copyright (c) 2006-2021, RT-Thread Development Team
|
2009-07-03 07:18:14 +08:00
|
|
|
*
|
2018-10-15 01:35:07 +08:00
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
2009-07-03 07:18:14 +08:00
|
|
|
*
|
|
|
|
* Change Logs:
|
|
|
|
* Date Author Notes
|
|
|
|
* 2006-09-06 XuXinming first version
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <rtthread.h>
|
|
|
|
#include "s3c44b0.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup S3C44B0
|
|
|
|
*/
|
|
|
|
/*@{*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function will enable I-Cache of CPU
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void rt_hw_cpu_icache_enable()
|
|
|
|
{
|
2021-03-27 17:51:56 +08:00
|
|
|
rt_base_t reg;
|
|
|
|
|
|
|
|
volatile int i;
|
|
|
|
/* flush cycle */
|
|
|
|
for(i = 0x10002000; i < 0x10004800; i+=16)
|
|
|
|
{
|
|
|
|
*((int *)i)=0x0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Init cache
|
|
|
|
* Non-cacheable area (everything outside RAM)
|
|
|
|
* 0x0000:0000 - 0x0C00:0000
|
|
|
|
*/
|
|
|
|
NCACHBE0 = 0xC0000000;
|
|
|
|
NCACHBE1 = 0x00000000;
|
|
|
|
|
|
|
|
/*
|
|
|
|
Enable chache
|
|
|
|
*/
|
|
|
|
reg = SYSCFG;
|
|
|
|
reg |= 0x00000006; /* 8kB */
|
|
|
|
SYSCFG = reg;
|
2009-07-03 07:18:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This function will disable I-Cache of CPU
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void rt_hw_cpu_icache_disable()
|
|
|
|
{
|
2021-03-27 17:51:56 +08:00
|
|
|
rt_base_t reg;
|
2009-07-03 07:18:14 +08:00
|
|
|
|
2021-03-27 17:51:56 +08:00
|
|
|
reg = SYSCFG;
|
|
|
|
reg &= ~0x00000006; /* 8kB */
|
|
|
|
SYSCFG = reg;
|
2009-07-03 07:18:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* this function will get the status of I-Cache
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
rt_base_t rt_hw_cpu_icache_status()
|
|
|
|
{
|
2021-03-27 17:51:56 +08:00
|
|
|
return 0;
|
2009-07-03 07:18:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* this function will enable D-Cache of CPU
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void rt_hw_cpu_dcache_enable()
|
|
|
|
{
|
2021-03-27 17:51:56 +08:00
|
|
|
rt_hw_cpu_icache_enable();
|
2009-07-03 07:18:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* this function will disable D-Cache of CPU
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
void rt_hw_cpu_dcache_disable()
|
|
|
|
{
|
2021-03-27 17:51:56 +08:00
|
|
|
rt_hw_cpu_icache_disable();
|
2009-07-03 07:18:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* this function will get the status of D-Cache
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
rt_base_t rt_hw_cpu_dcache_status()
|
|
|
|
{
|
2021-03-27 17:51:56 +08:00
|
|
|
return rt_hw_cpu_icache_status();
|
2009-07-03 07:18:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* this function will reset CPU
|
|
|
|
*
|
|
|
|
*/
|
2022-12-12 02:12:03 +08:00
|
|
|
rt_weak void rt_hw_cpu_reset()
|
2009-07-03 07:18:14 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* this function will shutdown CPU
|
|
|
|
*
|
|
|
|
*/
|
2022-12-12 02:12:03 +08:00
|
|
|
rt_weak void rt_hw_cpu_shutdown()
|
2009-07-03 07:18:14 +08:00
|
|
|
{
|
2021-03-27 17:51:56 +08:00
|
|
|
rt_kprintf("shutdown...\n");
|
2009-07-03 07:18:14 +08:00
|
|
|
|
2021-03-27 17:51:56 +08:00
|
|
|
while (1);
|
2009-07-03 07:18:14 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*@}*/
|