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

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

Various modifications to support IO Bridge,
and MEMC configuration interface.

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