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

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [libl4/] [include/] [l4lib/] [arch/] [arm/] [utcb.h] - 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
 * Copyright (C) 2009 Bahadir Bilgehan Balban
3
 */
4
#ifndef __ARM_UTCB_H__
5
#define __ARM_UTCB_H__
6
 
7
#define USER_UTCB_REF           0xFF000050
8
#define L4_KIP_ADDRESS          0xFF000000
9
#define UTCB_KIP_OFFSET         0x50
10
 
11
#ifndef __ASSEMBLY__
12
#include <l4lib/types.h>
13
#include <l4/macros.h>
14
#include <l4/lib/math.h>
15
#include INC_GLUE(message.h)
16
#include INC_GLUE(memory.h)
17
#include <string.h>
18
#include <stdio.h>
19
#include L4LIB_INC_SUBARCH(utcb.h)
20
 
21
/*
22
 * See kernel glue/arch/message.h for utcb details
23
 */
24
extern struct kip *kip;
25
 
26
 
27
 
28
 
29
/* Functions to read/write utcb registers */
30
static inline unsigned int read_mr(int offset)
31
{
32
        if (offset < MR_TOTAL)
33
                return l4_get_utcb()->mr[offset];
34
        else
35
                return l4_get_utcb()->mr_rest[offset - MR_TOTAL];
36
}
37
 
38
static inline void write_mr(unsigned int offset, unsigned int val)
39
{
40
        if (offset < MR_TOTAL)
41
                l4_get_utcb()->mr[offset] = val;
42
        else
43
                l4_get_utcb()->mr_rest[offset - MR_TOTAL] = val;
44
}
45
 
46
 
47
static inline void *utcb_full_buffer()
48
{
49
        return &l4_get_utcb()->mr_rest[0];
50
}
51
 
52
static inline char *utcb_full_strcpy_from(const char *src)
53
{
54
        return strncpy((char *)&l4_get_utcb()->mr_rest[0], src,
55
                       L4_UTCB_FULL_BUFFER_SIZE);
56
}
57
 
58
static inline void *utcb_full_memcpy_from(const char *src, int size)
59
{
60
        return memcpy(&l4_get_utcb()->mr_rest[0], src,
61
                      min(size, L4_UTCB_FULL_BUFFER_SIZE));
62
}
63
 
64
static inline char *utcb_full_strcpy_to(char *dst)
65
{
66
        return strncpy(dst, (char *)&l4_get_utcb()->mr_rest[0],
67
                       L4_UTCB_FULL_BUFFER_SIZE);
68
}
69
 
70
static inline void *utcb_full_memcpy_to(char *dst, int size)
71
{
72
        return memcpy(dst, &l4_get_utcb()->mr_rest[0],
73
                      min(size, L4_UTCB_FULL_BUFFER_SIZE));
74
}
75
 
76
#endif /* !__ASSEMBLY__ */
77
 
78
#endif /* __ARM_UTCB_H__ */

powered by: WebSVN 2.1.0

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