source: soft/giet_vm/xml/mapping_info.h @ 158

Last change on this file since 158 was 158, checked in by alain, 12 years ago

Introducing the giet_vm and some example applications

File size: 5.9 KB
Line 
1////////////////////////////////////////////////////////////////////////////
2// File     : mapping_info.h
3// Date     : 01/04/2012
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6////////////////////////////////////////////////////////////////////////////
7// The MAPPING_INFO data structure can be used with the GIET.
8// It contains the mapping directive for one or several virtual spaces.
9// Ech virtual space contains a variable number of virtual segments
10// and a variable number of tasks. The number of virtual space can be one.
11//
12// The mapping table data structure is organised as the concatenation of
13// a fixed size header, and 6 variable size arrays:
14//
15// - mapping_header_t   header              (MAPPING_HEADER_SIZE)
16// - mapping_cluster_t  cluster[clusters]   (MAPPING_CLUSTER_SIZE * clusters)
17// - mapping_pseg_t     pseg[psegs]         (MAPPING_PSEG_SIZE * psegs)
18// - mapping_vspace_t   vspace[vspaces]     (MAPPING_VSPACE_SIZE * vspaces)
19// - mapping_vseg_t     vseg[vsegs]         (MAPPING_VSEG_SIZE * vsegs)
20// - mapping_task_t     task[tasks]         (MAPPING_TASK_SIZE * tasks)
21// - mapping_mwmr_t     mwmr[mwmrs]         (MAPPING_MWMR_SIZE * mwmrs)
22//
23// The number of clusters and the number of vspaces are defined in the header.
24// The number of psegs are defined in each cluster.
25// The number of vsegs, tasks ans mwmrs are defined in each vspace.
26//
27// It is intended to be stored in the boot ROM at address MAPPING_BOOT_BASE.
28// For each cluster, the base address of the first pseg descriptor
29// is defined by a pseg_offset relative to MAPPING_BOOT_BASE.
30// For each vspace, the base address of the first vseg descriptor
31// is defined by a vseg_offset relative to MAPPING_BOOT_BASE.
32// For each vspace, the base address of the first task desciptor
33// is defined by a task_offset relative to MAPPING_BOOT_BASE.
34// For each vspace, the base address of the first mwmr desciptor
35// is defined by a mwmr_offset relative to MAPPING_BOOT_BASE.
36////////////////////////////////////////////////////////////////////////////
37
38#ifndef _MAPPING_INFO_H_
39#define _MAPPING_INFO_H_
40
41#define MAPPING_HEADER_SIZE     sizeof(mapping_header_t)
42#define MAPPING_CLUSTER_SIZE    sizeof(mapping_cluster_t)
43#define MAPPING_VSPACE_SIZE     sizeof(mapping_vspace_t)
44#define MAPPING_VSEG_SIZE           sizeof(mapping_vseg_t)
45#define MAPPING_PSEG_SIZE           sizeof(mapping_pseg_t)
46#define MAPPING_TASK_SIZE           sizeof(mapping_task_t)
47
48#define C_MODE_MASK     0b1000      // cacheable
49#define X_MODE_MASK     0b0100      // executable
50#define W_MODE_MASK     0b0010      // writable
51#define U_MODE_MASK     0b0001      // user access
52
53#define IN_MAPPING_SIGNATURE    0xDEADBEEF
54#define OUT_MAPPING_SIGNATURE   0xBABEF00D
55
56///////////////////////////////
57typedef struct mapping_header_s
58{
59    unsigned int    signature;      // must contain MAPPING_SIGNATURE
60        unsigned int    clusters;           // number of clusters
61        unsigned int    psegs;          // number of psegs
62    unsigned int    ttys;           // number of TTY terminals
63        unsigned int    globals;                // number of vsegs mapped in all vspaces
64        unsigned int    vspaces;                // number of virtual spaces
65        unsigned int    vsegs;                  // total number of virtual segments (for all vspaces
66        unsigned int    tasks;                  // total number of tasks (for all vspaces)
67    char            name[32];       // mapping name
68    char            syspath[64];    // path for the system binary code ("sys.bin")
69} mapping_header_t;
70
71////////////////////////////////
72typedef struct mapping_cluster_s
73{
74    unsigned int    procs;          // number of processors in cluster
75    unsigned int    timers;         // number of timers in cluster
76    unsigned int    dmas;           // number of DMA channels in cluster
77} mapping_cluster_t;
78
79/////////////////////////////
80typedef struct mapping_pseg_s
81{
82    char            name[32];       // pseg name (unique in a cluster)
83        unsigned int    base;           // base address in physical space
84        unsigned int    length;         // size (bytes)
85    unsigned int    next_free_page; // physical page allocator
86} mapping_pseg_t;
87
88///////////////////////////////
89typedef struct mapping_vspace_s
90{
91    char            name[32];       // virtual space name
92    char            binpath[64];    // pathname to the binary code ("app.bin")
93        unsigned int    vsegs;              // number of private virtual segments
94        unsigned int    tasks;              // number of tasks
95        unsigned int    mwmrs;              // number of mwmr channels
96        unsigned int    ttys;               // number of required TTY terminals
97    unsigned int    vseg_offset;    // index of first vseg in vspace
98    unsigned int    task_offset;    // index of first task in vspace
99    unsigned int    mwmr_offset;    // index of first mwmr in vspace
100} mapping_vspace_t;
101
102/////////////////////////////
103typedef struct mapping_vseg_s
104{
105        char            name[32];       // vseg name (unique in vspace)
106        unsigned int    vbase;          // base address in virtual space (hexa)
107        unsigned int    pbase;          // base address in physical space (hexa)
108        unsigned int    length;         // size (bytes)
109        unsigned int    psegid;         // physical segment index
110        unsigned char   mode;           // C-X-W-U flags
111    unsigned char   ident;          // identity mapping if non zero
112    unsigned char   mwmr;           // mwmr channel if non zero
113    unsigned char   reserved;       // unused
114} mapping_vseg_t;
115
116/////////////////////////////
117typedef struct mapping_task_s
118{
119        char            name[32];       // task name (unique in vspace)
120        unsigned int    clusterid;          // physical cluster index
121        unsigned int    proclocid;      // processor local index (inside cluster)
122    unsigned int    vseglocid;      // stack vseg index in vspace
123    unsigned int    startid;        // index in start_vector (in seg_data)
124    unsigned int    ttylocid;       // tty index (inside the vspace)
125} mapping_task_t;
126
127#endif
128
129// Local Variables:
130// tab-width: 4
131// c-basic-offset: 4
132// c-file-offsets:((innamespace . 0)(inline-open . 0))
133// indent-tabs-mode: nil
134// End:
135
136// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
137
Note: See TracBrowser for help on using the repository browser.