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

Last change on this file since 185 was 181, checked in by karaoui, 12 years ago

new version of map.xml supporting the routage and the coproc.
the xml_parser/xml_driver are also updated aproprietly.

File size: 10.6 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_vseg_t     vobj[vsegs]         (MAPPING_VOBJ_SIZE * vsegs)
21// - mapping_task_t     task[tasks]         (MAPPING_TASK_SIZE * tasks)
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_VOBJ_SIZE           sizeof(mapping_vobj_t)
46#define MAPPING_PSEG_SIZE           sizeof(mapping_pseg_t)
47#define MAPPING_TASK_SIZE           sizeof(mapping_task_t)
48#define MAPPING_PROC_SIZE           sizeof(mapping_proc_t)
49#define MAPPING_IRQ_SIZE            sizeof(mapping_irq_t)
50#define MAPPING_COPROC_SIZE         sizeof(mapping_coproc_t)
51#define MAPPING_CP_PORT_SIZE    sizeof(mapping_coproc_port_t)
52#define MAPPING_CP_REG_SIZE         sizeof(mapping_coproc_reg_t)
53
54#define C_MODE_MASK     0b1000      // cacheable
55#define X_MODE_MASK     0b0100      // executable
56#define W_MODE_MASK     0b0010      // writable
57#define U_MODE_MASK     0b0001      // user access
58
59#define IN_MAPPING_SIGNATURE    0xDEADBEEF
60#define OUT_MAPPING_SIGNATURE   0xBABEF00D
61
62enum
63{
64    VOBJ_TYPE_ELF     = 0,     // loadable code/data object of elf files
65    VOBJ_TYPE_BLOB    = 1,     // loadable blob object
66    VOBJ_TYPE_PTAB    = 2,     // page table
67    VOBJ_TYPE_PERI    = 3,     // hardware component
68    VOBJ_TYPE_MWMR    = 4,     // MWMR channel
69    VOBJ_TYPE_LOCK    = 5,     // Lock
70    VOBJ_TYPE_BUFFER  = 6,     // Any "no intialiasation needed" objects (stacks...)
71    VOBJ_TYPE_BARRIER = 7,     // Barrier
72};
73
74enum
75{
76    PSEG_TYPE_RAM     = 0,
77    PSEG_TYPE_ROM     = 1,
78    PSEG_TYPE_PERI    = 2,
79};
80
81enum
82{
83    IRQ_TYPE_HARD     = 0,          // hardware interrupt (peripheral)
84    IRQ_TYPE_SOFT     = 1,          // software interrupt (IPI)
85};
86
87enum
88{
89    ISR_SWITCH        = 0,
90    ISR_IOC           = 1,
91    ISR_FBDMA         = 2,
92    ISR_TTY           = 3,
93};
94
95enum
96{
97    REG_TYPE_STATUS   = 0,          // status register
98    REG_TYPE_CONFIG   = 1,          // config register
99};
100
101enum
102{
103    PORT_TO_COPROC    = 0,          // status register
104    PORT_FROM_COPROC  = 1,          // config register
105};
106
107///////////////////////////////
108typedef struct mapping_header_s
109{
110    unsigned int    signature;      // must contain MAPPING_SIGNATURE
111        unsigned int    clusters;           // number of clusters
112    unsigned int    ttys;           // number of TTY terminals
113    unsigned int    fbs;            // number of FBDMA channels
114        unsigned int    globals;                // number of vsegs mapped in all vspaces
115        unsigned int    vspaces;                // number of virtual spaces
116    unsigned int    psegs;          // total number of physical segments (for all clusters)
117        unsigned int    vsegs;                  // total number of virtual segments (for all vspaces)
118        unsigned int    vobjs;                  // total number of virtual objects (for all vspaces)
119        unsigned int    tasks;                  // total number of tasks (for all vspaces)
120        unsigned int    procs;                  // total number of procs
121        unsigned int    irqs;           // total number of irqs
122        unsigned int    coprocs;                // total number of coprocs
123        unsigned int    cp_ports;               // total number of cp_ports
124        unsigned int    cp_regs;                // total number of cp_regss
125    char            name[32];       // mapping name
126} mapping_header_t;
127
128////////////////////////////////
129typedef struct mapping_cluster_s
130{
131    unsigned int    procs;          // number of processors in cluster
132    unsigned int    proc_offset;    // index of first proc in proc set
133    unsigned int    coprocs;        // number of coprocessors in cluster
134    unsigned int    coproc_offset;  // index of first coproc in coproc set
135    unsigned int    psegs;          // number of psegs in cluster
136    unsigned int    pseg_offset;    // index of first pseg in pseg set
137} mapping_cluster_t;
138
139/////////////////////////////
140typedef struct mapping_pseg_s
141{
142    char            name[32];       // pseg name (unique in a cluster)
143        unsigned int    base;           // base address in physical space
144        unsigned int    length;         // size (bytes)
145    unsigned int    type;           // RAM / ROM / PERI
146    unsigned int    cluster;        // index of cluster containing pseg
147    unsigned int    next_base;      // first free page base address
148} mapping_pseg_t;
149
150///////////////////////////////
151typedef struct mapping_vspace_s
152{
153    char            name[32];       // virtual space name
154    unsigned int    start_offset;   // offset of the vobj containing the start vector
155        unsigned int    vsegs;              // number of vsegs in vspace
156        unsigned int    vobjs;              // number of vobjs in vspace
157        unsigned int    tasks;              // number of tasks in vspace
158    unsigned int    vseg_offset;    // index of first vseg in vspace
159    unsigned int    vobj_offset;    // index of first vobjs in vspace
160    unsigned int    task_offset;    // index of first task in vspace
161} mapping_vspace_t;
162
163/////////////////////////////
164typedef struct mapping_vseg_s
165{
166        char            name[32];       // vseg name (unique in vspace)
167        unsigned int    vbase;          // base address in virtual space (hexa)
168        unsigned int    pbase;          // base address in physical space (hexa)
169        unsigned int    length;         // size (bytes)
170        unsigned int    psegid;         // physical segment global index
171        unsigned int    mode;           // C-X-W-U flags
172    unsigned int    ident;          // identity mapping if non zero
173        unsigned int    vobjs;              // number of vobjs in vseg
174    unsigned int    vobj_offset;    // index of first vobjs in vseg
175} mapping_vseg_t;
176
177/////////////////////////////
178typedef struct mapping_task_s
179{
180        char            name[32];       // task name (unique in vspace)
181        unsigned int    clusterid;          // physical cluster index
182        unsigned int    proclocid;      // processor local index (inside cluster)
183    unsigned int    vobjlocid;      // stack vobj index in vspace
184    unsigned int    startid;        // index in start_vector
185    unsigned int    use_tty;        // TTY terminal required
186    unsigned int    use_fb;         // DMA channel to frame buffer required
187} mapping_task_t;
188
189/////////////////////////////
190typedef struct mapping_vobj_s
191{
192    char            name[32];       // vobj name (unique in a vspace)
193    char            binpath[64];    // path for the binary code ("*.elf")
194        unsigned int    type;           // type of vobj
195        unsigned int    length;         // size (bytes)
196        unsigned int    align;          // required alignement (logarithm of 2)
197        unsigned int    vaddr;          // virtual base addresse of the vobj
198        unsigned int    paddr;          // physical base addresse of the vobj
199        unsigned int    init;           // init value (used by barrier or mwmr channel)
200} mapping_vobj_t;
201
202/////////////////////////////
203typedef struct mapping_proc_s
204{
205    unsigned int    irqs;           // number of IRQs allocated to processor
206    unsigned int    irq_offset;     // index of first IRQ allocated to processor
207} mapping_proc_t;
208
209/////////////////////////////
210typedef struct mapping_irq_s
211{
212    unsigned int    type;           // HW_IRQ  / SW_IRQ
213    unsigned int    icuid;          // IRQ Index for the ICU component
214    unsigned int    isr;            // Interrupt Service Routine Index
215    unsigned int    channel;        // Channel Index (for multi-cannels peripherals)
216
217    unsigned int    cluster_id;     // physical cluster index
218        unsigned int    proclocid;      // processor local index (inside cluster)
219} mapping_irq_t;
220
221///////////////////////////////
222typedef struct mapping_coproc_s
223{
224    char            name[32];       // coprocessor name
225    unsigned int    psegid;         // pseg index in cluster
226    unsigned int    ports;          // number of MWMR ports used by coprocessor
227    unsigned int    port_offset;    // index of first MWMR port used by coprocessor
228    unsigned int    regs;           // number of config/status registers
229    unsigned int    reg_offset;     // index of first register
230} mapping_coproc_t;
231
232///////////////////////////////////////
233typedef struct mapping_coproc_port_s
234{
235    unsigned int    direction;      // TO_COPROC == 0 / FROM_COPROC == 1
236    unsigned int    vspaceid;      // global index of the vspace containing the MWMR channel
237    unsigned int    vobjlocid;        // local(to vspace) index of the vobj containing the MWMR channel
238} mapping_coproc_port_t;
239
240///////////////////////////////////
241typedef struct mapping_coproc_reg_s
242{
243    char            name[32];       // register name
244    unsigned int    type;           // STATUS = 0 / CONFIG == 1
245    unsigned int    loc_id;         // register index in coprocessor (word offset)
246    unsigned int    channel_id;     // channel index in coprocessor (page offset)
247    unsigned int    value;          // initialisation value
248}  mapping_coproc_reg_t;
249
250#endif
251
252// Local Variables:
253// tab-width: 4
254// c-basic-offset: 4
255// c-file-offsets:((innamespace . 0)(inline-open . 0))
256// indent-tabs-mode: nil
257// End:
258
259// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
260
Note: See TracBrowser for help on using the repository browser.