OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [src/] [api/] [cache.c] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Low level cache control functions.
3
 *
4
 * Copyright (C) 2009 - 2010 B Labs Ltd.
5
 *
6
 * Author: Bahadir Balban
7
 */
8
#include <l4/lib/printk.h>
9
#include <l4/api/errno.h>
10
#include <l4/generic/tcb.h>
11
#include <l4/api/cache.h>
12
#include <l4/generic/capability.h>
13
#include INC_GLUE(cache.h)
14
 
15
int sys_cache_control(unsigned long start, unsigned long end,
16
                      unsigned int flags)
17
{
18
        int ret = 0;
19
 
20
        if ((ret = cap_cache_check(start, end, flags)) < 0)
21
                return ret;
22
 
23
        switch (flags) {
24
        case L4_INVALIDATE_ICACHE:
25
                arch_invalidate_icache(start, end);
26
                break;
27
 
28
        case L4_INVALIDATE_DCACHE:
29
                arch_invalidate_dcache(start, end);
30
                break;
31
 
32
        case L4_CLEAN_DCACHE:
33
                arch_clean_dcache(start, end);
34
                break;
35
 
36
        case L4_CLEAN_INVALIDATE_DCACHE:
37
                arch_clean_invalidate_dcache(start, end);
38
                break;
39
 
40
        case L4_INVALIDATE_TLB:
41
                arch_invalidate_tlb(start, end);
42
                break;
43
 
44
        default:
45
                ret = -EINVAL;
46
        }
47
 
48
        return ret;
49
}
50
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.