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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [test_suite0/] [src/] [api/] [cap.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Test capability control system call
3
 *
4
 * Copyright (C) 2010 B Labs Ltd.
5
 *
6
 * Author: Bahadir Balban
7
 */
8
#include <l4lib/macros.h>
9
#include <l4lib/lib/cap.h>
10
#include L4LIB_INC_ARCH(syscalls.h)
11
 
12
#define TOTAL_CAPS                              32
13
 
14
struct capability cap_array[TOTAL_CAPS];
15
 
16
/*
17
 * Read number of capabilities
18
 */
19
int test_cap_read(void)
20
{
21
        int ncaps;
22
        int err;
23
 
24
        /* Read number of capabilities */
25
        if ((err = l4_capability_control(CAP_CONTROL_NCAPS,
26
                                         0, &ncaps)) < 0) {
27
                printf("l4_capability_control() reading # of"
28
                       " capabilities failed.\n Could not "
29
                       "complete CAP_CONTROL_NCAPS request.\n");
30
                return err;
31
        }
32
 
33
        /* Read all capabilities */
34
        if ((err = l4_capability_control(CAP_CONTROL_READ,
35
                                         0, cap_array)) < 0) {
36
                printf("l4_capability resource_control() reading of "
37
                       "capabilities failed.\n Could not "
38
                       "complete CAP_CONTROL_READ_CAPS request.\n");
39
                return err;
40
        }
41
        //cap_array_print(ncaps, caparray);
42
 
43
        return 0;
44
}
45
 
46
 
47
int test_api_capctrl(void)
48
{
49
        int err;
50
 
51
        if ((err = test_cap_read()) < 0)
52
                return err;
53
 
54
        return 0;
55
}
56
 

powered by: WebSVN 2.1.0

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