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

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

+ removing some bugs from:

  • xml_parser.c: check that strcmp == 0 for coproc direction
  • mwmr_channel.c: mwmr->ptr to ptr.
  • utils.h double definition of memcpy fonction.

+ mapping_info.h : naming the enums
+ boot_init.c: changing the order of initialisation in order

to initialise the coproc with the mwmr channel values( depth, width...).
Note that the vobjs are now physically initialised.

+ mwmr_channel.h: changing the order argument definition to suit vci_mwmr_channel Soclib componnent.
+ hwr_mapping.h: adding the register description of the vci_mwmr_controller .

File size: 9.7 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_cluster_t  cluster[] 
16// - mapping_pseg_t     pseg[]       
17// - mapping_vspace_t   vspace[] 
18// - mapping_vseg_t     vseg[]     
19// - mapping_vseg_t     vobj[]   
20// - mapping_task_t     task[] 
21// - mapping_irq_t      irq[irqs]   
22// - mapping_coproc_t   coproc[]
23// - mapping_cp_port_t  cp_port[]
24// - mapping_periph_t   periph[]
25//
26// It is intended to be stored in the boot ROM at address MAPPING_BOOT_BASE.
27////////////////////////////////////////////////////////////////////////////
28
29#ifndef _MAPPING_INFO_H_
30#define _MAPPING_INFO_H_
31
32#define MAPPING_HEADER_SIZE     sizeof(mapping_header_t)
33#define MAPPING_CLUSTER_SIZE    sizeof(mapping_cluster_t)
34#define MAPPING_VSPACE_SIZE     sizeof(mapping_vspace_t)
35#define MAPPING_VSEG_SIZE           sizeof(mapping_vseg_t)
36#define MAPPING_VOBJ_SIZE           sizeof(mapping_vobj_t)
37#define MAPPING_PSEG_SIZE           sizeof(mapping_pseg_t)
38#define MAPPING_TASK_SIZE           sizeof(mapping_task_t)
39#define MAPPING_PROC_SIZE           sizeof(mapping_proc_t)
40#define MAPPING_IRQ_SIZE            sizeof(mapping_irq_t)
41#define MAPPING_COPROC_SIZE         sizeof(mapping_coproc_t)
42#define MAPPING_CP_PORT_SIZE    sizeof(mapping_cp_port_t)
43
44#define C_MODE_MASK     0b1000      // cacheable
45#define X_MODE_MASK     0b0100      // executable
46#define W_MODE_MASK     0b0010      // writable
47#define U_MODE_MASK     0b0001      // user access
48
49#define IN_MAPPING_SIGNATURE    0xDEADBEEF
50#define OUT_MAPPING_SIGNATURE   0xBABEF00D
51
52enum vobjType
53{
54    VOBJ_TYPE_ELF     = 0,     // loadable code/data object of elf files
55    VOBJ_TYPE_BLOB    = 1,     // loadable blob object
56    VOBJ_TYPE_PTAB    = 2,     // page table
57    VOBJ_TYPE_PERI    = 3,     // hardware component
58    VOBJ_TYPE_MWMR    = 4,     // MWMR channel
59    VOBJ_TYPE_LOCK    = 5,     // Lock
60    VOBJ_TYPE_BUFFER  = 6,     // Any "no intialiasation needed" objects (stacks...)
61    VOBJ_TYPE_BARRIER = 7,     // Barrier
62};
63
64enum psegType
65{
66    PSEG_TYPE_RAM     = 0,
67    PSEG_TYPE_ROM     = 1,
68    PSEG_TYPE_PERI    = 2,
69};
70
71enum periphType
72{
73    PERIPH_TYPE_IOC   = 0,
74    PERIPH_TYPE_TTY   = 1,
75    PERIPH_TYPE_TIM   = 2,
76    PERIPH_TYPE_DMA   = 3,
77    PERIPH_TYPE_FBF   = 4,
78    PERIPH_TYPE_NIC   = 5,
79    PERIPH_TYPE_IOB   = 6,
80};
81
82enum mwmrPortDirection
83{
84    PORT_TO_COPROC    = 0,          // status register
85    PORT_FROM_COPROC  = 1,          // config register
86};
87
88///////////////////////////////
89
90typedef struct mapping_header_s
91{
92    unsigned int    signature;      // must contain MAPPING_SIGNATURE
93        unsigned int    clusters;           // number of clusters
94        unsigned int    globals;                // number of vsegs mapped in all vspaces
95        unsigned int    vspaces;                // number of virtual spaces
96
97    unsigned int    tty_clusterid;  // index of cluster containing TTY controler
98    unsigned int    ioc_clusterid;  // index of cluster containing IOC controler
99    unsigned int    nic_clusterid;  // index of cluster containing NIC controler
100    unsigned int    fbf_clusterid;  // index of cluster containing FBF controler
101
102    unsigned int    psegs;          // total number of physical segments (for all clusters)
103        unsigned int    vsegs;                  // total number of virtual segments (for all vspaces)
104        unsigned int    vobjs;                  // total number of virtual objects (for all vspaces)
105        unsigned int    tasks;                  // total number of tasks (for all vspaces)
106        unsigned int    procs;                  // total number of procs (for all clusters)
107        unsigned int    irqs;           // total number of irqs (for all processors)
108        unsigned int    coprocs;                // total number of coprocs (for all clusters)
109        unsigned int    cp_ports;               // total number of cp_ports (for all coprocs)
110    unsigned int    periphs;        // total number of peripherals (for all clusters)
111
112    char            name[32];       // mapping name
113} mapping_header_t;
114
115////////////////////////////////
116typedef struct mapping_cluster_s
117{
118    unsigned int    psegs;          // number of psegs in cluster
119    unsigned int    pseg_offset;    // index of first pseg in pseg set
120
121    unsigned int    procs;          // number of processors in cluster
122    unsigned int    proc_offset;    // index of first proc in proc set
123
124    unsigned int    coprocs;        // number of coprocessors in cluster
125    unsigned int    coproc_offset;  // index of first coproc in coproc set
126
127    unsigned int    periphs;        // number of peripherals in cluster
128    unsigned int    periph_offset;  // index of first coproc in coproc set
129} mapping_cluster_t;
130
131/////////////////////////////
132typedef struct mapping_pseg_s
133{
134    char            name[32];       // pseg name (unique in a cluster)
135        unsigned int    base;           // base address in physical space
136        unsigned int    length;         // size (bytes)
137    unsigned int    type;           // RAM / ROM / PERI
138    unsigned int    cluster;        // index of cluster containing pseg
139    unsigned int    next_base;      // first free page base address
140} mapping_pseg_t;
141
142///////////////////////////////
143typedef struct mapping_vspace_s
144{
145    char            name[32];       // virtual space name
146    unsigned int    start_offset;   // offset of the vobj containing the start vector
147        unsigned int    vsegs;              // number of vsegs in vspace
148        unsigned int    vobjs;              // number of vobjs in vspace
149        unsigned int    tasks;              // number of tasks in vspace
150    unsigned int    vseg_offset;    // index of first vseg in vspace
151    unsigned int    vobj_offset;    // index of first vobjs in vspace
152    unsigned int    task_offset;    // index of first task in vspace
153} mapping_vspace_t;
154
155/////////////////////////////
156typedef struct mapping_vseg_s
157{
158        char            name[32];       // vseg name (unique in vspace)
159        unsigned int    vbase;          // base address in virtual space (hexa)
160        unsigned int    pbase;          // base address in physical space (hexa)
161        unsigned int    length;         // size (bytes)
162        unsigned int    psegid;         // physical segment global index
163        unsigned int    mode;           // C-X-W-U flags
164    unsigned int    ident;          // identity mapping if non zero
165        unsigned int    vobjs;              // number of vobjs in vseg
166    unsigned int    vobj_offset;    // index of first vobjs in vseg
167} mapping_vseg_t;
168
169/////////////////////////////
170typedef struct mapping_task_s
171{
172        char            name[32];       // task name (unique in vspace)
173        unsigned int    clusterid;          // physical cluster index
174        unsigned int    proclocid;      // processor local index (inside cluster)
175    unsigned int    vobjlocid;      // stack vobj index in vspace
176    unsigned int    startid;        // index in start_vector
177    unsigned int    use_tty;        // TTY terminal required (global)
178    unsigned int    use_nic;        // NIC channel required (global)
179    unsigned int    use_timer;      // user timer required (local)
180    unsigned int    use_fbdma;      // DMA channel to frame buffer required (local)
181} mapping_task_t;
182
183/////////////////////////////
184typedef struct mapping_vobj_s
185{
186    char            name[32];       // vobj name (unique in a vspace)
187    char            binpath[64];    // path for the binary code ("*.elf")
188        unsigned int    type;           // type of vobj
189        unsigned int    length;         // size (bytes)
190        unsigned int    align;          // required alignement (logarithm of 2)
191        unsigned int    vaddr;          // virtual base addresse of the vobj
192        unsigned int    paddr;          // physical base addresse of the vobj
193        unsigned int    init;           // init value (used by barrier or mwmr channel)
194} mapping_vobj_t;
195
196/////////////////////////////
197typedef struct mapping_proc_s
198{
199    unsigned int    irqs;           // number of IRQs allocated to processor
200    unsigned int    irq_offset;     // index of first IRQ allocated to processor
201} mapping_proc_t;
202
203/////////////////////////////
204typedef struct mapping_irq_s
205{
206    unsigned int    type;           // 0 => HW_IRQ  / 1 => SW_IRQ
207    unsigned int    icuid;          // IRQ Index for the ICU component
208    unsigned int    isr;            // Interrupt Service Routine Index
209    unsigned int    channel;        // Channel Index (for multi-cannels peripherals)
210} mapping_irq_t;
211
212///////////////////////////////
213typedef struct mapping_coproc_s
214{
215    char            name[32];       // coprocessor name
216    unsigned int    psegid;         // global pseg index
217    unsigned int    ports;          // number of MWMR ports used by coprocessor
218    unsigned int    port_offset;    // index of first MWMR port used by coprocessor
219} mapping_coproc_t;
220
221////////////////////////////////
222typedef struct mapping_cp_port_s
223{
224    unsigned int    direction;      // TO_COPROC == 0 / FROM_COPROC == 1
225    unsigned int    vspaceid;       // index of the vspace containing the MWMR channel
226    unsigned int    vobjlocid;      // local index of the vobj containing the MWMR channel
227} mapping_cp_port_t;
228
229///////////////////////////////
230typedef struct mapping_periph_s
231{
232    unsigned int    type;           // IOC / TTY / TIM / DMA / FBF / NIC / IOB
233    unsigned int    psegid;         // pseg index in cluster
234    unsigned int    channels;       // number of channels
235} mapping_periph_t;
236
237
238#endif
239
240// Local Variables:
241// tab-width: 4
242// c-basic-offset: 4
243// c-file-offsets:((innamespace . 0)(inline-open . 0))
244// indent-tabs-mode: nil
245// End:
246
247// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
248
Note: See TracBrowser for help on using the repository browser.