source: soft/giet_vm/sys/common.h @ 254

Last change on this file since 254 was 253, checked in by alain, 11 years ago

1/ introducing support to display images on the frame buffer
with the vci_chbuf_dma (in stdio.c and drivers.c)
2/ introducing support for mem_cache configuration segment
as the memory cache is considered as another addressable peripheral type
(in drivers.c)
3/ Introducing the new "increment" parameter in the mapping header.
This parameter define the virtual address increment for the vsegs
associated to the replicated peripherals (ICU, XICU, MDMA, TIMER, MMC).
This parameter is mandatory, and all map.xml files the "mappings"
directory have been updated.

File size: 4.3 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////
2// File     : common.h
3// Date     : 01/04/2012
4// Author   : alain greiner and joel porquet
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7
8#ifndef _COMMON_H
9#define _COMMON_H
10
11#include <mapping_info.h>
12#include <giet_config.h>
13#include <ctx_handler.h>
14
15///////////////////////////////////////////////////////////////////////////////////
16// For retrieving base addresses defined in seg.ld file.
17///////////////////////////////////////////////////////////////////////////////////
18
19typedef struct _ld_symbol_s _ld_symbol_t;
20
21extern _ld_symbol_t seg_iob_base;
22extern _ld_symbol_t seg_nic_base;
23extern _ld_symbol_t seg_icu_base;
24extern _ld_symbol_t seg_xcu_base;
25extern _ld_symbol_t seg_tim_base;
26extern _ld_symbol_t seg_tty_base;
27extern _ld_symbol_t seg_gcd_base;
28extern _ld_symbol_t seg_dma_base;
29extern _ld_symbol_t seg_fbf_base;
30extern _ld_symbol_t seg_ioc_base;
31extern _ld_symbol_t seg_mmc_base;
32extern _ld_symbol_t seg_cma_base;
33
34extern _ld_symbol_t vseg_cluster_increment;
35
36extern _ld_symbol_t seg_mapping_base;
37extern _ld_symbol_t seg_kernel_pt_base;
38
39///////////////////////////////////////////////////////////////////////////////////
40//     Prototypes of common functions
41///////////////////////////////////////////////////////////////////////////////////
42
43void                 _puts(char *string);
44void                 _putx(unsigned int val);
45void                 _putd(unsigned int val);
46void                 _putl(paddr_t val);
47
48unsigned int         _strncmp(const char * s1, 
49                              const char * s2, 
50                              unsigned int n);
51
52void                 _dcache_buf_invalidate(const void * buffer, 
53                                            unsigned int size);
54
55void                 _dtlb_off(void);
56void                 _dtlb_on(void);
57
58void                 _it_mask(void);
59void                 _it_restore(void);
60void                 _it_disable(void);
61void                 _it_enable(void);
62
63unsigned int         _get_epc(void);
64unsigned int         _get_ptpr(void);
65unsigned int         _get_bvar(void);
66unsigned int         _get_cr(void);
67
68static_scheduler_t*  _get_sched(void);
69
70unsigned int         _get_context_slot( unsigned int slot );
71
72void                 _set_context_slot( unsigned int slot,
73                                        unsigned int value );
74
75unsigned int         _get_task_slot( unsigned int ltid,
76                                     unsigned int slot );
77
78void                 _set_task_slot( unsigned int ltid,
79                                     unsigned int slot,
80                                     unsigned int value );
81
82void                 _get_lock(unsigned int * lock);
83void                 _release_lock(unsigned int * lock);
84
85mapping_cluster_t *  _get_cluster_base(mapping_header_t* header);
86mapping_pseg_t *     _get_pseg_base(mapping_header_t* header);
87mapping_vspace_t *   _get_vspace_base(mapping_header_t* header);
88mapping_vseg_t *     _get_vseg_base(mapping_header_t* header);
89mapping_vobj_t *     _get_vobj_base(mapping_header_t* header);
90mapping_task_t *     _get_task_base(mapping_header_t* header);
91
92
93///////////////////////////////////////////////////////////////////////////////////
94// memcpy() function
95// This function is likely not called directly by the GIET,
96// but GCC can automatically issue call to it during compilation,
97// so we must provide it.
98// Code taken from MutekH.
99///////////////////////////////////////////////////////////////////////////////////
100static inline void * memcpy(void * _dst, const void * _src, unsigned int size) {
101    unsigned int * dst = _dst;
102    const unsigned int * src = _src;
103
104    /* if source and destination buffer are word-aligned,
105     * then copy word-by-word */
106    if (!((unsigned int) dst & 3) && !((unsigned int) src & 3)) {
107        while (size > 3) {
108            *dst++ = *src++;
109            size -= 4;
110        }
111    }
112
113    unsigned char * cdst = (unsigned char *) dst;
114    unsigned char * csrc = (unsigned char *) src;
115
116    /* byte-by-byte copy */
117    while (size--) {
118        *cdst++ = *csrc++;
119    }
120    return _dst;
121}
122
123#endif
124
125// Local Variables:
126// tab-width: 4
127// c-basic-offset: 4
128// c-file-offsets:((innamespace . 0)(inline-open . 0))
129// indent-tabs-mode: nil
130// End:
131// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
132
Note: See TracBrowser for help on using the repository browser.