Subversion Repositories freemyipod

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 theseven 1
//
2
//
3
//    Copyright 2010 TheSeven
4
//
5
//
427 farthen 6
//    This file is part of emCORE.
2 theseven 7
//
427 farthen 8
//    emCORE is free software: you can redistribute it and/or
2 theseven 9
//    modify it under the terms of the GNU General Public License as
10
//    published by the Free Software Foundation, either version 2 of the
11
//    License, or (at your option) any later version.
12
//
427 farthen 13
//    emCORE is distributed in the hope that it will be useful,
2 theseven 14
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
//    See the GNU General Public License for more details.
17
//
18
//    You should have received a copy of the GNU General Public License along
427 farthen 19
//    with emCORE.  If not, see <http://www.gnu.org/licenses/>.
2 theseven 20
//
21
//
22
 
23
 
24
#include "global.h"
25
#include "mmu.h"
26
 
27
 
28
void clean_dcache()
29
{
30
    asm volatile(
31
        "MOV R0, #0                \n\t"
32
        "clean_dcache_loop:        \n\t"
33
        "MCR p15, 0, R0,c7,c10,2   \n\t"
34
        "ADD R1, R0, #0x10         \n\t"
35
        "MCR p15, 0, R1,c7,c10,2   \n\t"
36
        "ADD R1, R1, #0x10         \n\t"
37
        "MCR p15, 0, R1,c7,c10,2   \n\t"
38
        "ADD R1, R1, #0x10         \n\t"
39
        "MCR p15, 0, R1,c7,c10,2   \n\t"
40
        "ADDS R0, R0, #0x04000000  \n\t"
41
        "BNE clean_dcache_loop     \n\t"
42
        "MCR p15, 0, R0,c7,c10,4   \n\t"
43
        "MOV PC, LR                \n\t"
44
    );
45
}
46
 
47
void invalidate_dcache()
48
{
49
    asm volatile(
50
        "MOV R0, #0                \n\t"
51
        "invalidate_dcache_loop:   \n\t"
52
        "MCR p15, 0, R0,c7,c14,2   \n\t"
53
        "ADD R1, R0, #0x10         \n\t"
54
        "MCR p15, 0, R1,c7,c14,2   \n\t"
55
        "ADD R1, R1, #0x10         \n\t"
56
        "MCR p15, 0, R1,c7,c14,2   \n\t"
57
        "ADD R1, R1, #0x10         \n\t"
58
        "MCR p15, 0, R1,c7,c14,2   \n\t"
59
        "ADDS R0, R0, #0x04000000  \n\t"
60
        "BNE invalidate_dcache_loop\n\t"
61
        "MCR p15, 0, R0,c7,c10,4   \n\t"
62
        "MOV PC, LR                \n\t"
63
    );
64
}
35 theseven 65
 
66
void invalidate_icache()
67
{
68
    asm volatile(
69
        "MOV R0, #0                \n\t"
70
        "MCR p15, 0, R0,c7,c5,0    \n\t"
71
        "MOV PC, LR                \n\t"
72
    );
73
}