⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpu.c

📁 RT-Thread是发展中的下一代微内核嵌入式实时操作系统
💻 C
字号:
/*
 * File      : cpu.c
 * This file is part of RT-Thread RTOS
 * COPYRIGHT (C) 2006, RT-Thread Develop Team
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.fayfayspace.org/license/LICENSE.
 *
 * Change Logs:
 * Date           Author       Notes
 * 2006-03-13     Bernard      first version
 */

#include <rtthread.h>
#include "s3c4510.h"

/*!
 * \addtogroup xgs3c4510
 */
/*@{*/

/*!
 * \brief enable I-Cache of cpu
 *
 * this function will enable I-Cache of CPU
 *
 */
void rt_hw_cpu_icache_enable()
{
	rt_base_t reg;
	volatile int i;

	/* flush cache before enable */
	rt_uint32 *tagram = (rt_uint32 *)S3C4510_SRAM_ADDR;

	SYSCFG &= ~(1<<1);	/* Disable cache */

	for(i=0; i < 256; i++) 
	{
		*tagram = 0x00000000;
		tagram += 1; 
	}

	/*
		Enable chache
	*/
	reg = SYSCFG;
	reg |= (1 << 1);
	SYSCFG = reg;
}

/*!
 * \brief disable I-Cache of cpu
 *
 * this function will disable I-Cache of CPU
 *
 */
void rt_hw_cpu_icache_disable()
{
	rt_base_t reg;

	reg = SYSCFG;
	reg &= ~(1<<1);
	SYSCFG = reg;
}

/*!
 * \brief get the status of I-Cache
 *
 * this function will get the status of I-Cache
 *
 */
int rt_hw_cpu_icache_status()
{
	return 0;
}

/*!
 * \brief enable D-Cache of cpu
 *
 * this function will enable D-Cache of CPU
 *
 */
void rt_hw_cpu_dcache_enable()
{
	rt_hw_cpu_icache_enable();
}

/*!
 * \brief disable D-Cache of cpu
 *
 * this function will disable D-Cache of CPU
 *
 */
void rt_hw_cpu_dcache_disable()
{
	rt_hw_cpu_icache_disable();
}

/*!
 * \brief get the status of D-Cache
 *
 * this function will get the status of D-Cache
 *
 */
int rt_hw_cpu_dcache_status()
{
	return rt_hw_cpu_icache_status();
}

/*!
 * \brief reset CPU
 *
 * this function will reset CPU
 *
 */
void rt_hw_cpu_reset()
{
}

/*!
 * \brief shutdown CPU
 *
 * this function will shutdown CPU
 *
 */
void rt_hw_cpu_shutdown()
{
	rt_kprintf("shutdown...\n");

	while (1);
}

/*@}*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -