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

Last change on this file since 231 was 231, checked in by joannou, 11 years ago
  • Bugfix in Interruption mechanism :
    • _it_mask() and _it_restore() functions now share a global array indexed by the proc_id (used a simple global variable before => problem with multiproc)
    • added 2 new fuctions _it_enable() and _it_disable() that only affect the IE bit of the status register in COP0
    • replaced interrupt masking/restoring arround _ctx_switch() in sys_handler by a simple interrupt disabling before the call to _ctx_switch (restoring after a _ctx_switch wouldn't restore the correct task's status register)
    • replaced the use of _ctx_switch in _exit() by a call to _context_switch() (this function actually does the interrupt disabling)
  • Added some comments in the ctx_handler.h
  • Added the delay reset in the idle task (ctx_handler.c)
  • Added a new irq type (PTI)
    • Modifications in xml_parser.c to accept PTI irq type (now used in xml mappings)
    • Added the test on the irq type in the _irq_demux() function. This leads to a different argument passed to the ISR (i.e. either channel_id or irq_id (aka icuid) )
File size: 3.7 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
14///////////////////////////////////////////////////////////////////////////////////
15// For retrieving base addresses defined in seg.ld file.
16///////////////////////////////////////////////////////////////////////////////////
17
18typedef struct _ld_symbol_s _ld_symbol_t;
19
20extern _ld_symbol_t seg_iob_base;
21extern _ld_symbol_t seg_nic_base;
22extern _ld_symbol_t seg_icu_base;
23extern _ld_symbol_t seg_tim_base;
24extern _ld_symbol_t seg_tty_base;
25extern _ld_symbol_t seg_gcd_base;
26extern _ld_symbol_t seg_dma_base;
27extern _ld_symbol_t seg_fbf_base;
28extern _ld_symbol_t seg_ioc_base;
29extern _ld_symbol_t seg_mapping_base;
30extern _ld_symbol_t seg_kernel_pt_base;
31
32///////////////////////////////////////////////////////////////////////////////////
33//     Prototypes of common functions
34///////////////////////////////////////////////////////////////////////////////////
35
36void _puts(char *string);
37void _putx(unsigned int val);
38void _putd(unsigned int val);
39
40unsigned int _strncmp(const char * s1, const char * s2, unsigned int n);
41void _dcache_buf_invalidate(const void * buffer, unsigned int size);
42
43void _dtlb_off(void);
44void _dtlb_on(void);
45
46void _it_mask(void);
47void _it_restore(void);
48void _it_disable(void);
49void _it_enable(void);
50
51unsigned int _get_epc(void);
52unsigned int _get_ptpr(void);
53unsigned int _get_bvar(void);
54unsigned int _get_cr(void);
55unsigned int _get_sched(void);
56
57unsigned int _get_context_slot(unsigned int task_id, unsigned int slot_id);
58void _set_context_slot(unsigned int task_id, unsigned int slot_id, unsigned int value);
59
60unsigned int _get_interrupt_vector_entry(unsigned int index);
61
62unsigned int _get_current_task_id(void);
63void _set_current_task_id(unsigned int value);
64
65unsigned int _get_tasks_number(void);
66
67void _get_lock(unsigned int * lock);
68void _release_lock(unsigned int * lock);
69
70mapping_cluster_t * _get_cluster_base(mapping_header_t* header);
71mapping_pseg_t * _get_pseg_base(mapping_header_t* header);
72mapping_vspace_t * _get_vspace_base(mapping_header_t* header);
73mapping_vseg_t * _get_vseg_base(mapping_header_t* header);
74mapping_vobj_t * _get_vobj_base(mapping_header_t* header);
75mapping_task_t * _get_task_base(mapping_header_t* header);
76
77
78///////////////////////////////////////////////////////////////////////////////////
79// memcpy() function
80// This function is likely not called directly by the GIET,
81// but GCC can automatically issue call to it during compilation,
82// so we must provide it.
83// Code taken from MutekH.
84///////////////////////////////////////////////////////////////////////////////////
85static inline void * memcpy(void * _dst, const void * _src, unsigned int size) {
86    unsigned int * dst = _dst;
87    const unsigned int * src = _src;
88
89    /* if source and destination buffer are word-aligned,
90     * then copy word-by-word */
91    if (!((unsigned int) dst & 3) && !((unsigned int) src & 3)) {
92        while (size > 3) {
93            *dst++ = *src++;
94            size -= 4;
95        }
96    }
97
98    unsigned char * cdst = (unsigned char *) dst;
99    unsigned char * csrc = (unsigned char *) src;
100
101    /* byte-by-byte copy */
102    while (size--) {
103        *cdst++ = *csrc++;
104    }
105    return _dst;
106}
107
108#endif
109
110// Local Variables:
111// tab-width: 4
112// c-basic-offset: 4
113// c-file-offsets:((innamespace . 0)(inline-open . 0))
114// indent-tabs-mode: nil
115// End:
116// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
117
Note: See TracBrowser for help on using the repository browser.