summaryrefslogtreecommitdiff
path: root/libcpu/arm/s3c44b0/cpu.c
blob: e64c6769d6fd9fcdf04ed4a4dfe72be2f521834a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * 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()
{
    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;
}

/**
 * This function will disable I-Cache of CPU
 *
 */
void rt_hw_cpu_icache_disable()
{
    rt_base_t reg;

    reg = SYSCFG;
    reg &= ~0x00000006; /* 8kB */
    SYSCFG = reg;
}

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

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

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

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

/**
 * this function will reset CPU
 *
 */
rt_weak void rt_hw_cpu_reset()
{
}

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

    while (1);
}

/*@}*/