Changeset 253


Ignore:
Timestamp:
Aug 14, 2013, 11:19:29 PM (11 years ago)
Author:
alain
Message:

1/ introducing support to display images on the frame buffer
with the vci_chbuf_dma (in stdio.c and drivers.c)
2/ introducing support for mem_cache configuration segment
as the memory cache is considered as another addressable peripheral type
(in drivers.c)
3/ Introducing the new "increment" parameter in the mapping header.
This parameter define the virtual address increment for the vsegs
associated to the replicated peripherals (ICU, XICU, MDMA, TIMER, MMC).
This parameter is mandatory, and all map.xml files the "mappings"
directory have been updated.

Location:
soft/giet_vm
Files:
2 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/Makefile

    r252 r253  
    55DU = mipsel-unknown-elf-objdump
    66
    7 MAP_XML       = mappings/1c_4p_gameoflife.xml
     7MAP_XML      = mappings/4c_1p_iob.xml
    88
    99SYS_OBJS     = build/sys/vm_handler.o \
  • soft/giet_vm/boot/boot_init.c

    r249 r253  
    806806{
    807807    mapping_header_t * header = (mapping_header_t *) & seg_mapping_base;
    808     mapping_cluster_t * cluster = boot_get_cluster_base(header);
    809     mapping_periph_t * periph = boot_get_periph_base(header);
    810808
    811809    // checking mapping availability
     
    835833        boot_exit();
    836834    }
    837     // checking hardware
    838     unsigned int periph_id;
    839     unsigned int cluster_id;
    840     unsigned int tty_found = 0;
    841     unsigned int nic_found = 0;
    842     for (cluster_id = 0; cluster_id < NB_CLUSTERS; cluster_id++)
    843     {
    844         // NB_PROCS_MAX
    845         if (cluster[cluster_id].procs > NB_PROCS_MAX)
    846         {
    847             boot_puts("\n[BOOT ERROR] too many processors in cluster ");
    848             boot_putd(cluster_id);
    849             boot_puts(" : procs = ");
    850             boot_putd(cluster[cluster_id].procs);
    851             boot_puts("\n");
    852             boot_exit();
    853         }
    854 
    855         for (periph_id = cluster[cluster_id].periph_offset;
    856                 periph_id < cluster[cluster_id].periph_offset + cluster[cluster_id].periphs;
    857                 periph_id++)
    858         {
    859             // NB_TTY_CHANNELS
    860             if (periph[periph_id].type == PERIPH_TYPE_TTY)
    861             {
    862                 if (tty_found)
    863                 {
    864                     boot_puts("\n[BOOT ERROR] TTY component should not be replicated\n");
    865                     boot_exit();
    866                 }
    867                 if (periph[periph_id].channels > NB_TTY_CHANNELS)
    868                 {
    869                     boot_puts("\n[BOOT ERROR] Wrong NB_TTY_CHANNELS in cluster ");
    870                     boot_putd(cluster_id);
    871                     boot_puts(" : ttys = ");
    872                     boot_putd(periph[periph_id].channels);
    873                     boot_puts("\n");
    874                     boot_exit();
    875                 }
    876                 tty_found = 1;
    877             }
    878             // NB_NIC_CHANNELS
    879             if (periph[periph_id].type == PERIPH_TYPE_NIC)
    880             {
    881                 if (nic_found)
    882                 {
    883                     boot_puts("\n[BOOT ERROR] NIC component should not be replicated\n");
    884                     boot_exit();
    885                 }
    886                 if (periph[periph_id].channels != NB_NIC_CHANNELS)
    887                 {
    888                     boot_puts("\n[BOOT ERROR] Wrong NB_NIC_CHANNELS in cluster ");
    889                     boot_putd(cluster_id);
    890                     boot_puts(" : nics = ");
    891                     boot_putd(periph[periph_id].channels);
    892                     boot_puts("\n");
    893                     boot_exit();
    894                 }
    895                 nic_found = 1;
    896             }
    897             // NB_TIMERS
    898             if (periph[periph_id].type == PERIPH_TYPE_TIM)
    899             {
    900                 if (periph[periph_id].channels > NB_TIM_CHANNELS)
    901                 {
    902                     boot_puts("\n[BOOT ERROR] Too much user timers in cluster ");
    903                     boot_putd(cluster_id);
    904                     boot_puts(" : timers = ");
    905                     boot_putd(periph[periph_id].channels);
    906                     boot_puts("\n");
    907                     boot_exit();
    908                 }
    909             }
    910             // NB_DMAS
    911             if (periph[periph_id].type == PERIPH_TYPE_DMA)
    912             {
    913                 if (periph[periph_id].channels > NB_DMA_CHANNELS)
    914                 {
    915                     boot_puts("\n[BOOT ERROR] Too much DMA channels in cluster ");
    916                     boot_putd(cluster_id);
    917                     boot_puts(" : channels = ");
    918                     boot_putd(periph[periph_id].channels);
    919                     boot_puts(" - NB_DMA_CHANNELS : ");
    920                     boot_putd(NB_DMA_CHANNELS);
    921                     boot_puts("\n");
    922                     boot_exit();
    923                 }
    924             }
    925         } // end for periphs
    926     } // end for clusters
     835
     836#if BOOT_DEBUG_MAPPING
     837boot_puts("\nclusters  = ");
     838boot_putd( header->clusters );
     839boot_puts("\nprocs     = ");
     840boot_putd( header->procs );
     841boot_puts("\nperiphs   = ");
     842boot_putd( header->periphs );
     843boot_puts("\nvspaces   = ");
     844boot_putd( header->vspaces );
     845boot_puts("\ntasks     = ");
     846boot_putd( header->tasks );
     847boot_puts("\n");
     848
     849unsigned int        cluster_id;
     850mapping_cluster_t * cluster = boot_get_cluster_base(header);
     851for (cluster_id = 0; cluster_id < NB_CLUSTERS; cluster_id++)
     852{
     853boot_puts("\n cluster = ");
     854boot_putd( cluster_id );
     855boot_puts("\n procs   = ");
     856boot_putd( cluster[cluster_id].procs );
     857boot_puts("\n psegs   = ");
     858boot_putd( cluster[cluster_id].psegs );
     859boot_puts("\n periphs = ");
     860boot_putd( cluster[cluster_id].periphs );
     861boot_puts("\n");
     862}
     863#endif
     864
     865    boot_puts("\n[BOOT] Mapping check completed at cycle ");
     866    boot_putd(boot_proctime());
     867    boot_puts(" for ");
     868    boot_puts( header->name );
     869    boot_puts("\n");
     870
    927871} // end boot_check_mapping()
    928872
     
    971915        }
    972916    }
     917
     918    boot_puts("\n[BOOT] Pseg allocators initialisation completed at cycle ");
     919    boot_putd(boot_proctime());
     920    boot_puts("\n");
     921
    973922} // end boot_psegs_init()
    974923
     
    1037986#endif
    1038987    }
     988
     989    boot_puts("\n[BOOT] Page Tables initialisation completed at cycle ");
     990    boot_putd(boot_proctime());
     991    boot_puts("\n");
     992
    1039993} // end boot_pt_init()
    1040994
     
    12161170        }
    12171171    } // end loop on vspaces
     1172
     1173    boot_puts("\n[BOOT] Vobjs initialisation completed at cycle : ");
     1174    boot_putd(boot_proctime());
     1175    boot_puts("\n");
     1176
    12181177} // end boot_vobjs_init()
    12191178
     
    14231382        } // end for coprocs
    14241383    } // end for clusters
     1384
     1385    boot_puts("\n[BOOT] Peripherals initialisation completed at cycle ");
     1386    boot_putd(boot_proctime());
     1387    boot_puts("\n");
     1388
    14251389} // end boot_peripherals_init()
    14261390
     
    18581822        } // end loop on tasks
    18591823    } // end loop on vspaces
     1824
     1825    boot_puts("\n[BOOT] Schedulers initialisation completed at cycle ");
     1826    boot_putd(boot_proctime());
     1827    boot_puts("\n");
     1828
    18601829} // end boot_schedulers_init()
    18611830
     
    18791848    boot_check_mapping();
    18801849
    1881     boot_puts("\n[BOOT] Mapping check completed at cycle ");
    1882     boot_putd(boot_proctime());
    1883     boot_puts("\n");
    1884 
    18851850    // pseg allocators initialisation
    18861851    boot_psegs_init();
    18871852
    1888     boot_puts("\n[BOOT] Pseg allocators initialisation completed at cycle ");
    1889     boot_putd(boot_proctime());
    1890     boot_puts("\n");
    1891 
    18921853    // page table building
    18931854    boot_pt_init();
    18941855
    1895     boot_puts("\n[BOOT] Page Tables initialisation completed at cycle ");
    1896     boot_putd(boot_proctime());
    1897     boot_puts("\n");
    1898 
    1899     // mmu activation ( with page table [Ø] )
     1856    // mmu activation ( with page table [0] )
    19001857    boot_set_mmu_ptpr((unsigned int) (boot_ptabs_paddr[0] >> 13));
    19011858    boot_set_mmu_mode(0xF);
     
    19051862    boot_puts("\n");
    19061863
    1907 
    19081864    // vobjs initialisation
    19091865    boot_vobjs_init();
    19101866
    1911     boot_puts("\n[BOOT] Vobjs initialisation completed at cycle : ");
    1912     boot_putd(boot_proctime());
    1913     boot_puts("\n");
    1914 
    19151867    // peripherals initialisation
    19161868    boot_peripherals_init();
    19171869
    1918     boot_puts("\n[BOOT] Peripherals initialisation completed at cycle ");
    1919     boot_putd(boot_proctime());
    1920     boot_puts("\n");
    1921 
    19221870    // schedulers initialisation
    19231871    boot_schedulers_init();
    1924 
    1925     boot_puts("\n[BOOT] Schedulers initialisation completed at cycle ");
    1926     boot_putd(boot_proctime());
    1927     boot_puts("\n");
    19281872
    19291873    // start all processors
  • soft/giet_vm/giet_config.h

    r249 r253  
    1515/* Debug parameters */
    1616
    17 #define BOOT_DEBUG_PERI          0                      /* trace peripherals initialisation */
     17#define BOOT_DEBUG_MAPPING       1                      /* trace map_info checking */
    1818#define BOOT_DEBUG_PT                0                  /* trace page tables initialisation */
    1919#define BOOT_DEBUG_VOBJS             0                  /* trace vobjs initialisation */
     20#define BOOT_DEBUG_PERI          0                      /* trace peripherals initialisation */
    2021#define BOOT_DEBUG_SCHED             0                  /* trace schedulers initialisation */
    2122
     
    2930/* software parameters */
    3031
    31 #define GIET_CLUSTER_INCREMENT   0x100000       /* address increment for replicated peripherals */
    3232#define GIET_NB_VSPACE_MAX           64                 /* max number of virtual spaces */
    3333#define GIET_TICK_VALUE          0x100000       /* context switch period (number of cycles) */
  • soft/giet_vm/libs/mwmr_channel.h

    r228 r253  
    1515///////////////////////////////////////////////////////////////////////////////////
    1616
    17 typedef struct mwmr_channel_s {
     17typedef struct mwmr_channel_s
     18{
    1819    unsigned int ptr;        // index of the first valid data word
    1920    unsigned int ptw;        // index of the first empty slot
  • soft/giet_vm/libs/stdio.c

    r238 r253  
    1313#include <stdio.h>
    1414
    15 #define SYSCALL_PROCID          0x00
    16 #define SYSCALL_PROCTIME        0x01
    17 #define SYSCALL_TTY_WRITE       0x02
    18 #define SYSCALL_TTY_READ        0x03
    19 #define SYSCALL_TIMER_START     0x04
    20 #define SYSCALL_TIMER_STOP      0x05
    21 #define SYSCALL_GCD_WRITE       0x06
    22 #define SYSCALL_GCD_READ        0x07
    23 #define SYSCALL_HEAP_INFO       0x08
    24 #define SYSCALL_PROC_TASK_ID    0x09
    25 #define SYSCALL_GLOBAL_TASK_ID  0x0A
    26 #define SYSCALL_CTX_SWITCH      0x0D
    27 #define SYSCALL_EXIT            0x0E
    28 #define SYSCALL_PROC_NUMBER     0x0F
    29 #define SYSCALL_FB_SYNC_WRITE   0x10
    30 #define SYSCALL_FB_SYNC_READ    0x11
    31 #define SYSCALL_FB_WRITE        0x12
    32 #define SYSCALL_FB_READ         0x13
    33 #define SYSCALL_FB_COMPLETED    0x14
    34 #define SYSCALL_IOC_WRITE       0x15
    35 #define SYSCALL_IOC_READ        0x16
    36 #define SYSCALL_IOC_COMPLETED   0x17
    37 #define SYSCALL_IOC_BLOCK_SIZE  0x18
    38 #define SYSCALL_VOBJ_GET_VBASE  0x1A
    39 #define SYSCALL_NIC_WRITE       0x1B
    40 #define SYSCALL_NIC_READ        0x1C
    41 #define SYSCALL_NIC_COMPLETED   0x1D
     15#define SYSCALL_PROCID            0x00
     16#define SYSCALL_PROCTIME          0x01
     17#define SYSCALL_TTY_WRITE         0x02
     18#define SYSCALL_TTY_READ          0x03
     19#define SYSCALL_TIMER_START       0x04
     20#define SYSCALL_TIMER_STOP        0x05
     21#define SYSCALL_GCD_WRITE         0x06
     22#define SYSCALL_GCD_READ          0x07
     23#define SYSCALL_HEAP_INFO         0x08
     24#define SYSCALL_LOCAL_TASK_ID     0x09
     25#define SYSCALL_GLOBAL_TASK_ID    0x0A
     26#define SYSCALL_FB_CMA_INIT       0x0B
     27#define SYSCALL_FB_CMA_WRITE      0x0C
     28#define SYSCALL_FB_CMA_STOP       0x0D
     29#define SYSCALL_EXIT              0x0E
     30#define SYSCALL_PROC_NUMBER       0x0F
     31#define SYSCALL_FB_SYNC_WRITE     0x10
     32#define SYSCALL_FB_SYNC_READ      0x11
     33#define SYSCALL_FB_DMA_WRITE      0x12
     34#define SYSCALL_FB_DMA_READ       0x13
     35#define SYSCALL_FB_DMA_COMPLETED  0x14
     36#define SYSCALL_IOC_WRITE         0x15
     37#define SYSCALL_IOC_READ          0x16
     38#define SYSCALL_IOC_COMPLETED     0x17
     39#define SYSCALL_IOC_BLOCK_SIZE    0x18
     40#define SYSCALL_CTX_SWITCH        0x19
     41#define SYSCALL_VOBJ_GET_VBASE    0x1A
     42#define SYSCALL_NIC_CMA_RX_INIT   0x1B
     43#define SYSCALL_NIC_CMA_TX_INIT   0x1C
     44#define SYSCALL_NIC_CMA_STOP      0x1D
     45#define SYSCALL_NIC_SYNC_READ     0x1E
     46#define SYSCALL_NIC_SYNC_WRITE    0x1F
    4247
    4348//////////////////////////////////////////////////////////////////////////////////
     
    4752// and tells GCC what has been modified by system call execution.
    4853//////////////////////////////////////////////////////////////////////////////////
    49 static inline unsigned int sys_call(unsigned int call_no,
    50         unsigned int arg_0,
    51         unsigned int arg_1,
    52         unsigned int arg_2,
    53         unsigned int arg_3) {
     54static inline unsigned int sys_call( unsigned int call_no,
     55                                     unsigned int arg_0,
     56                                     unsigned int arg_1,
     57                                     unsigned int arg_2,
     58                                     unsigned int arg_3 )
     59{
    5460    register unsigned int reg_no_and_output asm("v0") = call_no;
    5561    register unsigned int reg_a0 asm("a0") = arg_0;
     
    109115
    110116
    111 //////     TTY device related system calls /////
     117//////  TTY device related system calls /////
    112118
    113119////////////////////////////////////////////////////////////////////////////////////
     
    123129    return sys_call(SYSCALL_TTY_WRITE, (unsigned int) (&byte), 1, 0, 0);
    124130}
    125 
    126 
    127131////////////////////////////////////////////////////////////////////////////////////
    128132// giet_tty_puts()
     
    140144    return sys_call(SYSCALL_TTY_WRITE, (unsigned int) buf, length, 0, 0);
    141145}
    142 
    143 
    144146////////////////////////////////////////////////////////////////////////////////////
    145147// giet_tty_putw()
     
    161163    return sys_call(SYSCALL_TTY_WRITE, (unsigned int) buf, 10, 0, 0);
    162164}
    163 
    164 
    165165////////////////////////////////////////////////////////////////////////////////////
    166166// giet_tty_getc()
     
    180180    return 0;
    181181}
    182 
    183 
    184182////////////////////////////////////////////////////////////////////////////////////
    185183// giet_tty_gets()
     
    226224    return 0;
    227225}
    228 
    229 
    230226////////////////////////////////////////////////////////////////////////////////////
    231227// giet_tty_getw()
     
    325321    return 0;
    326322}
    327 
    328 
    329323////////////////////////////////////////////////////////////////////////////////////
    330324// giet_tty_printf()
     
    448442// - Returns 0 if success, > 0 if error.
    449443//////////////////////////////////////////////////////////////////////////////////
    450 unsigned int giet_timer_start() {
     444unsigned int giet_timer_start()
     445{
    451446    return sys_call(SYSCALL_TIMER_START, 0, 0, 0, 0);
    452447}
    453 
    454 
    455448//////////////////////////////////////////////////////////////////////////////////
    456449// giet_timer_stop()
     
    459452// - Returns 0 if success, > 0 if error.
    460453//////////////////////////////////////////////////////////////////////////////////
    461 unsigned int giet_timer_stop() {
     454unsigned int giet_timer_stop()
     455{
    462456    return sys_call(SYSCALL_TIMER_STOP, 0, 0, 0, 0);
    463457}
     
    477471// - Returns 0 if success, > 0 if error.
    478472//////////////////////////////////////////////////////////////////////////////////
    479 unsigned int giet_gcd_set_opa(unsigned int val) {
     473unsigned int giet_gcd_set_opa(unsigned int val)
     474{
    480475    return sys_call(SYSCALL_GCD_WRITE, GCD_OPA, val, 0, 0);
    481476}
    482 
    483 
    484477//////////////////////////////////////////////////////////////////////////////////
    485478//     giet_gcd_set_opb()
     
    488481// - Returns 0 if success, > 0 if error.
    489482//////////////////////////////////////////////////////////////////////////////////
    490 unsigned int giet_gcd_set_opb(unsigned int val) {
     483unsigned int giet_gcd_set_opb(unsigned int val)
     484{
    491485    return sys_call(SYSCALL_GCD_WRITE, GCD_OPB, val, 0, 0);
    492486}
    493 
    494 
    495487//////////////////////////////////////////////////////////////////////////////////
    496488//     giet_gcd_start()
     
    499491// - Returns 0 if success, > 0 if error.
    500492//////////////////////////////////////////////////////////////////////////////////
    501 unsigned int giet_gcd_start() {
     493unsigned int giet_gcd_start()
     494{
    502495    return sys_call(SYSCALL_GCD_WRITE, GCD_START, 0, 0, 0);
    503496}
    504 
    505 
    506497//////////////////////////////////////////////////////////////////////////////////
    507498//     giet_gcd_get_status()
     
    510501// - The value is 0 when the coprocessor is idle (computation completed).
    511502//////////////////////////////////////////////////////////////////////////////////
    512 unsigned int giet_gcd_get_status(unsigned int * val) {
     503unsigned int giet_gcd_get_status(unsigned int * val)
     504{
    513505    return sys_call(SYSCALL_GCD_READ, GCD_STATUS, (unsigned int) val, 0, 0);
    514506}
    515 
    516 
    517507//////////////////////////////////////////////////////////////////////////////////
    518508//     giet_gcd_get_result()
     
    520510// This function gets the result of the computation from the GCD coprocessor.
    521511//////////////////////////////////////////////////////////////////////////////////
    522 unsigned int giet_gcd_get_result(unsigned int * val) {
     512unsigned int giet_gcd_get_result(unsigned int * val)
     513{
    523514    return sys_call(SYSCALL_GCD_READ, GCD_OPA, (unsigned int) val, 0, 0);
    524515}
     
    536527// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    537528//////////////////////////////////////////////////////////////////////////////////
    538 unsigned int giet_ioc_write( unsigned int lba, void * buffer, unsigned int count) {
     529unsigned int giet_ioc_write( unsigned int lba,
     530                             void *       buffer,
     531                             unsigned int count)
     532{
    539533    return sys_call(SYSCALL_IOC_WRITE, lba, (unsigned int) buffer, count, 0);
    540534}
    541 
    542 
    543535//////////////////////////////////////////////////////////////////////////////////
    544536// giet_ioc_read()
     
    550542// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    551543//////////////////////////////////////////////////////////////////////////////////
    552 unsigned int giet_ioc_read(unsigned int lba, void * buffer, unsigned int count) {
     544unsigned int giet_ioc_read( unsigned int lba,
     545                            void *       buffer,
     546                            unsigned int count )
     547{
    553548    return sys_call(SYSCALL_IOC_READ, lba, (unsigned int) buffer, count, 0);
    554549}
    555 
    556 
    557550//////////////////////////////////////////////////////////////////////////////////
    558551// giet_ioc_completed()
     
    561554// successfully completed, and returns 1 if an address error has been detected.
    562555//////////////////////////////////////////////////////////////////////////////////
    563 unsigned int giet_ioc_completed() {
     556unsigned int giet_ioc_completed()
     557{
    564558    return sys_call(SYSCALL_IOC_COMPLETED, 0, 0, 0, 0);
    565559}
    566 
    567 
    568560//////////////////////////////////////////////////////////////////////////////////
    569561// giet_ioc_block_size()
     
    571563// This blocking function returns the block_size (in bytes) of the block device
    572564//////////////////////////////////////////////////////////////////////////////////
    573 unsigned int giet_ioc_block_size() {
     565unsigned int giet_ioc_block_size()
     566{
    574567    return sys_call(SYSCALL_IOC_BLOCK_SIZE, 0, 0, 0, 0);
    575568}
     
    588581// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    589582//////////////////////////////////////////////////////////////////////////////////
    590 unsigned int giet_fb_sync_write(unsigned int offset, void * buffer, unsigned int length) {
     583unsigned int giet_fb_sync_write( unsigned int offset,
     584                                 void *       buffer,
     585                                 unsigned int length )
     586{
    591587    return sys_call(SYSCALL_FB_SYNC_WRITE, offset, (unsigned int) buffer, length, 0);
    592588}
    593 
    594 
    595589//////////////////////////////////////////////////////////////////////////////////
    596590// giet_fb_sync_read()
     
    603597// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    604598//////////////////////////////////////////////////////////////////////////////////
    605 unsigned int giet_fb_sync_read(unsigned int offset, void * buffer, unsigned int length) {
     599unsigned int giet_fb_sync_read( unsigned int offset,
     600                                void *       buffer,
     601                                unsigned int length )
     602{
    606603    return sys_call(SYSCALL_FB_SYNC_READ, offset, (unsigned int) buffer, length, 0);
    607604}
    608 
    609 
    610 //////////////////////////////////////////////////////////////////////////////////
    611 // giet_fb_write()
     605//////////////////////////////////////////////////////////////////////////////////
     606// giet_fb_dma_write()
    612607//////////////////////////////////////////////////////////////////////////////////
    613608// This non-blocking function use the DMA coprocessor to transfer data from a
     
    620615// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    621616//////////////////////////////////////////////////////////////////////////////////
    622 unsigned int giet_fb_write(unsigned int offset, void * buffer, unsigned int length) {
    623     return sys_call(SYSCALL_FB_WRITE, offset, (unsigned int) buffer, length, 0);
    624 }
    625 
    626 
    627 //////////////////////////////////////////////////////////////////////////////////
    628 // giet_fb_read()
     617unsigned int giet_fb_dma_write( unsigned int offset,
     618                                void *       buffer,
     619                                unsigned int length )
     620{
     621    return sys_call(SYSCALL_FB_DMA_WRITE, offset, (unsigned int) buffer, length, 0);
     622}
     623//////////////////////////////////////////////////////////////////////////////////
     624// giet_fb_dma_read()
    629625//////////////////////////////////////////////////////////////////////////////////
    630626// This non-blocking function use the DMA coprocessor to transfer data from the
     
    637633// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    638634//////////////////////////////////////////////////////////////////////////////////
    639 unsigned int giet_fb_read(unsigned int offset, void * buffer, unsigned int length) {
    640     return sys_call(SYSCALL_FB_READ, offset, (unsigned int) buffer, length, 0);
    641 }
    642 
    643 
    644 //////////////////////////////////////////////////////////////////////////////////
    645 // giet_fb_completed()
     635unsigned int giet_fb_dma_read( unsigned int offset,
     636                               void *       buffer,
     637                               unsigned int length )
     638{
     639    return sys_call(SYSCALL_FB_DMA_READ, offset, (unsigned int) buffer, length, 0);
     640}
     641//////////////////////////////////////////////////////////////////////////////////
     642// giet_fb_dma_completed()
    646643//////////////////////////////////////////////////////////////////////////////////
    647644// This blocking function returns when the transfer is completed.
    648645// - Returns 0 if success, > 0 if error.
    649646//////////////////////////////////////////////////////////////////////////////////
    650 unsigned int giet_fb_completed() {
    651     return sys_call(SYSCALL_FB_COMPLETED, 0, 0, 0, 0);
    652 }
    653 
    654 
    655 //////////////////////////////////////////////////////////////////////////////////
    656 // giet_nic_write()
    657 //////////////////////////////////////////////////////////////////////////////////
    658 // This non-blocking function use the DMA coprocessor to transfer data from the
    659 // NIC device to an user buffer.
    660 // - offset : offset (in bytes) in the NIC
    661 // - buffer : base address of the memory buffer
    662 // - length : number of bytes to be transfered
    663 // The transfer completion is signaled by an IRQ, and must be tested by the
    664 // nic_completed() function.
     647unsigned int giet_fb_dma_completed()
     648{
     649    return sys_call(SYSCALL_FB_DMA_COMPLETED, 0, 0, 0, 0);
     650}
     651//////////////////////////////////////////////////////////////////////////////////
     652// giet_fb_cma_init()
     653//////////////////////////////////////////////////////////////////////////////////
     654// This function initializes the two chbuf SRC an DST used by the CMA controller
     655// and activates the CMA channel allocated to the calling task.
     656// - buf0   : first user buffer virtual address
     657// - buf0   : second user buffer virtual address
     658// - length : buffer size (bytes)
     659// - Returns 0 if success, > 0 if error.
     660//////////////////////////////////////////////////////////////////////////////////
     661unsigned int giet_fb_cma_init( void *       buf0,
     662                               void *       buf1,
     663                               unsigned int length )
     664{
     665    return sys_call(SYSCALL_FB_CMA_INIT, (unsigned int)buf0, (unsigned int)buf1, length, 0);
     666}
     667//////////////////////////////////////////////////////////////////////////////////
     668// giet_fb_cma_write()
     669//////////////////////////////////////////////////////////////////////////////////
     670// This function set the valid status for one of the SRC user buffer.
     671// and reset the valid status for the DST frame buffer.
     672// - bufffer_id : 0 => buf0 valid is set / not 0  => buf1 valid is set
     673// - Returns 0 if success, > 0 if error.
     674//////////////////////////////////////////////////////////////////////////////////
     675unsigned int giet_fb_cma_write( unsigned int buffer_id )
     676{
     677    return sys_call(SYSCALL_FB_CMA_WRITE, buffer_id, 0, 0, 0);
     678}
     679//////////////////////////////////////////////////////////////////////////////////
     680// giet_fb_cma_stop()
     681//////////////////////////////////////////////////////////////////////////////////
     682// This function desactivates the CMA channel allocated to the calling task.
     683// - Returns 0 if success, > 0 if error.
     684//////////////////////////////////////////////////////////////////////////////////
     685unsigned int giet_fb_cma_stop( )
     686{
     687    return sys_call(SYSCALL_FB_CMA_STOP, 0, 0, 0, 0);
     688}
     689
     690
     691//////// NIC related system calls ////////
     692
     693//////////////////////////////////////////////////////////////////////////////////
     694// giet_nic_cma_rx_init()
     695//////////////////////////////////////////////////////////////////////////////////
     696// This function initializes the two chbuf SRC an DST used by the CMA controller
     697// and activates the NIC RX channel allocated to the calling task, and the
     698// CMA channel used for RX transfer.
     699// - buf0   : first user buffer virtual address
     700// - buf0   : second user buffer virtual address
     701// - length : buffer size (bytes)
    665702// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    666703//////////////////////////////////////////////////////////////////////////////////
    667 
    668 unsigned int giet_nic_write(unsigned int offset, void * buffer, unsigned int length) {
    669     return sys_call(SYSCALL_NIC_WRITE, offset, (unsigned int) buffer, length, 0);
    670 }
    671 
    672 
    673 //////////////////////////////////////////////////////////////////////////////////
    674 // giet_nic_read()
    675 //////////////////////////////////////////////////////////////////////////////////
    676 // This non-blocking function use the DMA coprocessor to transfer data from the
    677 // NIC device to an user buffer.
    678 // - offset : offset (in bytes) in the NIC
    679 // - buffer : base address of the memory buffer
    680 // - length : number of bytes to be transfered
    681 // The transfer completion is signaled by an IRQ, and must be tested by the
    682 // nic_completed() function.
     704unsigned int giet_nic_cma_rx_init( void *       buf0,
     705                                   void *       buf1,
     706                                   unsigned int length )
     707{
     708    return sys_call(SYSCALL_NIC_CMA_RX_INIT, (unsigned int)buf0, (unsigned int)buf1, length, 0);
     709}
     710//////////////////////////////////////////////////////////////////////////////////
     711// giet_nic_cma_tx_init()
     712//////////////////////////////////////////////////////////////////////////////////
     713// This function initializes the two chbuf SRC an DST used by the CMA controller
     714// and activates the NIC TX channel allocated to the calling task, and the two
     715// CMA channel used for TX transfer.
     716// - buf0   : first user buffer virtual address
     717// - buf0   : second user buffer virtual address
     718// - length : buffer size (bytes)
    683719// - Returns 0 if success, > 0 if error (e.g. memory buffer not in user space).
    684720//////////////////////////////////////////////////////////////////////////////////
    685 
    686 unsigned int giet_nic_read(unsigned int offset, void * buffer, unsigned int length) {
    687     return sys_call(SYSCALL_NIC_READ, offset, (unsigned int) buffer, length, 0);
    688 }
    689 
    690 
    691 //////////////////////////////////////////////////////////////////////////////////
    692 // giet_nic_completed()
    693 //////////////////////////////////////////////////////////////////////////////////
    694 // This blocking function returns when the transfer is completed.
    695 // - Returns 0 if success, > 0 if error.
    696 //////////////////////////////////////////////////////////////////////////////////
    697 unsigned int giet_nic_completed() {
    698     return sys_call(SYSCALL_NIC_COMPLETED, 0, 0, 0, 0);
    699 }
    700 
    701 
    702 ///// Miscellaneous related system calls /////
     721unsigned int giet_nic_cma_tx_init( void *       buf0,
     722                                   void *       buf1,
     723                                   unsigned int length )
     724{
     725    return sys_call(SYSCALL_NIC_CMA_TX_INIT, (unsigned int)buf0, (unsigned int)buf1, length, 0);
     726}
     727//////////////////////////////////////////////////////////////////////////////////
     728// giet_nic_cma_stop()
     729//////////////////////////////////////////////////////////////////////////////////
     730// This function desactivates the NIC channel and the two CMA channels
     731// allocated to the calling task.
     732// - Returns 0 if success, > 0 if error.
     733//////////////////////////////////////////////////////////////////////////////////
     734unsigned int giet_nic_cma_stop( )
     735{
     736    return sys_call(SYSCALL_NIC_CMA_STOP, 0, 0, 0, 0);
     737}
     738
     739
     740///// Miscellaneous system calls /////
    703741
    704742//////////////////////////////////////////////////////////////////////////////////
     
    711749// - Returns the address if success,  0 if error ( not defined or wrong type )
    712750//////////////////////////////////////////////////////////////////////////////////
    713 unsigned int giet_vobj_get_vbase(char * vspace_name, char * vobj_name, unsigned int vobj_type, unsigned int * vobj_vaddr) {
     751unsigned int giet_vobj_get_vbase( char*         vspace_name,
     752                                  char*         vobj_name,
     753                                  unsigned int  vobj_type,
     754                                  unsigned int* vobj_vaddr )
     755{
    714756    return sys_call(SYSCALL_VOBJ_GET_VBASE,
    715757            (unsigned int) vspace_name,
     
    718760            (unsigned int) vobj_vaddr);
    719761}
    720 
    721 
    722762////////////////////////////////////////////////////////////////////////////////////
    723763// giet_proc_number()
     
    727767// - Returns 0 if success, > 0 if error ( cluster index too large )
    728768////////////////////////////////////////////////////////////////////////////////////
    729 unsigned int giet_proc_number(unsigned int cluster_id, unsigned int * buffer) {
     769unsigned int giet_proc_number( unsigned int  cluster_id,
     770                               unsigned int* buffer )
     771{
    730772    return sys_call(SYSCALL_PROC_NUMBER, cluster_id, (unsigned int) buffer, 0, 0);
    731773}
    732 
    733 
    734 /////  Miscellaneous system calls /////
    735 
    736 //////////////////////////////////////////////////////////////////////////////////
    737 // giet_task_exit()
     774//////////////////////////////////////////////////////////////////////////////////
     775// giet_exit()
    738776//////////////////////////////////////////////////////////////////////////////////
    739777// This function stops execution of the calling task with a TTY message,
    740 // and enter an infinite loop.
    741 // The task is blocked, but it still consume processor cycles ...
    742 //////////////////////////////////////////////////////////////////////////////////
    743 void giet_exit() {
     778// and the task is descheduled and becomes not runable.
     779// It does not consume processor cycles anymore.
     780//////////////////////////////////////////////////////////////////////////////////
     781void giet_exit()
     782{
    744783    sys_call(SYSCALL_EXIT, 0, 0, 0, 0);
    745784}
    746 
     785//////////////////////////////////////////////////////////////////////////////////
     786// giet_context_switch()
     787// The user task calling this function is descheduled and
     788// the processor is allocated to another task.
     789//////////////////////////////////////////////////////////////////////////////////
     790unsigned int giet_context_switch()
     791{
     792    return sys_call(SYSCALL_CTX_SWITCH, 0, 0, 0, 0);
     793}
     794//////////////////////////////////////////////////////////////////////////////////
     795// giet_proc_task_id()
     796// This functions returns the local task id, i.e. the processor task id (ranging
     797// from 0 to n-1(p) for each processor if p has n tasks)
     798//////////////////////////////////////////////////////////////////////////////////
     799unsigned int giet_proc_task_id()
     800{
     801    return sys_call(SYSCALL_LOCAL_TASK_ID, 0, 0, 0, 0);
     802}
     803//////////////////////////////////////////////////////////////////////////////////
     804// giet_heap_info()
     805// This function returns the base address and size of the current task's heap
     806//////////////////////////////////////////////////////////////////////////////////
     807unsigned int giet_heap_info( unsigned int* vaddr,
     808                             unsigned int* length)
     809{
     810    return sys_call(SYSCALL_HEAP_INFO, (unsigned int)vaddr, (unsigned int)length, 0, 0);
     811}
     812//////////////////////////////////////////////////////////////////////////////////
     813// giet_global_task_id()
     814// This functions returns the global task id, which is unique in all the giet.
     815//////////////////////////////////////////////////////////////////////////////////
     816unsigned int giet_global_task_id()
     817{
     818    return sys_call(SYSCALL_GLOBAL_TASK_ID, 0, 0, 0, 0);
     819}
     820///////////////////////////////////////////////////////////////////////////////////
     821// giet_assert()
     822// This function
     823///////////////////////////////////////////////////////////////////////////////////
     824void giet_assert( unsigned int condition,
     825                  char*        string )
     826{
     827    if ( condition == 0 )
     828    {
     829        giet_tty_puts( string );
     830        giet_exit();
     831    }
     832}
     833
     834////// Pseudo system calls (no syscall instruction) ///////
    747835
    748836///////////////////////////////////////////////////////////////////////////////////
     
    751839// count. This value is comprised between 0 & 65535.
    752840///////////////////////////////////////////////////////////////////////////////////
    753 unsigned int giet_rand() {
     841unsigned int giet_rand()
     842{
    754843    unsigned int x = sys_call(SYSCALL_PROCTIME, 0, 0, 0, 0);
    755844    if ((x & 0xF) > 7) {
     
    761850}
    762851
    763 
    764 //////////////////////////////////////////////////////////////////////////////////
    765 // giet_context_switch()
    766 // The user task calling this function is descheduled and
    767 // the processor is allocated to another task.
    768 //////////////////////////////////////////////////////////////////////////////////
    769 unsigned int giet_context_switch() {
    770     return sys_call(SYSCALL_CTX_SWITCH, 0, 0, 0, 0);
    771 }
    772 
    773 //////////////////////////////////////////////////////////////////////////////////
    774 // giet_proc_task_id()
    775 // This functions returns the local task id, i.e. the processor task id (ranging
    776 // from 0 to n-1(p) for each processor if p has n tasks)
    777 //////////////////////////////////////////////////////////////////////////////////
    778 unsigned int giet_proc_task_id() {
    779     return sys_call(SYSCALL_PROC_TASK_ID, 0, 0, 0, 0);
    780 }
    781 
    782 //////////////////////////////////////////////////////////////////////////////////
    783 // giet_heap_info()
    784 // This function returns the base address and size of the current task's heap
    785 //////////////////////////////////////////////////////////////////////////////////
    786 unsigned int giet_heap_info(unsigned int * vaddr, unsigned int * length) {
    787     return sys_call(SYSCALL_HEAP_INFO, (unsigned int) vaddr, (unsigned int) length, 0, 0);
    788 }
    789 
    790 
    791 //////////////////////////////////////////////////////////////////////////////////
    792 // giet_global_task_id()
    793 // This functions returns the global task id, which is unique in all the giet
    794 //////////////////////////////////////////////////////////////////////////////////
    795 unsigned int giet_global_task_id() {
    796     return sys_call(SYSCALL_GLOBAL_TASK_ID, 0, 0, 0, 0);
    797 }
    798852
    799853// Local Variables:
  • soft/giet_vm/libs/stdio.h

    r237 r253  
    1515/* TTY device related functions */
    1616unsigned int giet_tty_putc(char byte);
    17 unsigned int giet_tty_puts(char * buf);
     17unsigned int giet_tty_puts(char* buf);
    1818unsigned int giet_tty_putw(unsigned int val);
    19 unsigned int giet_tty_getc_no_irq(char * byte);
    20 unsigned int giet_tty_getc(char * byte);
    21 unsigned int giet_tty_gets(char * buf, unsigned int bufsize);
    22 unsigned int giet_tty_getw(unsigned int * val);
    23 unsigned int giet_tty_printf(char * format,...);
     19unsigned int giet_tty_getc_no_irq(char* byte);
     20unsigned int giet_tty_getc(char* byte);
     21unsigned int giet_tty_gets(char* buf, unsigned int bufsize);
     22unsigned int giet_tty_getw(unsigned int* val);
     23unsigned int giet_tty_printf(char* format,...);
    2424
     25/* TIMER device related functions */
     26unsigned int giet_timer_start();
     27unsigned int giet_timer_stop();
     28 
    2529/* GCD coprocessor related functions */
    2630unsigned int giet_gcd_set_opa(unsigned int val);
    2731unsigned int giet_gcd_set_opb(unsigned int val);
    2832unsigned int giet_gcd_start();
    29 unsigned int giet_gcd_get_result(unsigned int * val);
    30 unsigned int giet_gcd_get_status(unsigned int * val);
     33unsigned int giet_gcd_get_result(unsigned int* val);
     34unsigned int giet_gcd_get_status(unsigned int* val);
    3135
    3236/* Block device related functions */
    33 unsigned int giet_ioc_read(unsigned int lba, void * buffer, unsigned int count);
    34 unsigned int giet_ioc_write(unsigned int lba, void * buffer, unsigned int count);
     37unsigned int giet_ioc_read(unsigned int lba, void* buffer, unsigned int count);
     38unsigned int giet_ioc_write(unsigned int lba, void* buffer, unsigned int count);
    3539unsigned int giet_ioc_completed();
    3640unsigned int giet_ioc_block_size();
    3741
    3842/* Frame buffer device related functions */
    39 unsigned int giet_fb_sync_read(unsigned int offset, void * buffer, unsigned int length );
    40 unsigned int giet_fb_sync_write(unsigned int offset, void * buffer, unsigned int length);
    41 unsigned int giet_fb_read(unsigned int offset, void * buffer, unsigned int length);
    42 unsigned int giet_fb_write(unsigned int offset, void * buffer, unsigned int length);
    43 unsigned int giet_nic_write(unsigned int offset, void * buffer, unsigned int length);
    44 unsigned int giet_nic_read(unsigned int offset, void * buffer, unsigned int length);
    45 unsigned int giet_fb_completed();
    46 unsigned int giet_nic_completed();
     43unsigned int giet_fb_sync_read(unsigned int offset, void* buffer, unsigned int length );
     44unsigned int giet_fb_sync_write(unsigned int offset, void* buffer, unsigned int length);
     45unsigned int giet_fb_dma_read(unsigned int offset, void* buffer, unsigned int length);
     46unsigned int giet_fb_dma_write(unsigned int offset, void* buffer, unsigned int length);
     47unsigned int giet_fb_dma_completed();
     48unsigned int giet_fb_cma_init(void* buf0, void* buf1, unsigned int length);
     49unsigned int giet_fb_cma_write(unsigned int buf_id);
     50unsigned int giet_fb_cma_stop();
     51
     52/* Network controller relate functions */
     53unsigned int giet_nic_cma_rx_init(void* buf0, void* buf1, unsigned int length);
     54unsigned int giet_nic_cma_tx_init(void* buf0, void* buf1, unsigned int length);
     55unsigned int giet_nic_cma_stop();
    4756
    4857/* Misc */
    49 unsigned int giet_vobj_get_vbase(char * vspace_name, char * vobj_name, unsigned int vobj_type, unsigned int * vobj_vaddr);
     58unsigned int giet_vobj_get_vbase(char* vspace_name, char* vobj_name,
     59                                 unsigned int vobj_type, unsigned int* vobj_vaddr);
     60unsigned int giet_procnumber();
    5061void giet_exit();
    51 unsigned int giet_rand();
    5262unsigned int giet_context_switch();
    5363unsigned int giet_proc_task_id();
    54 unsigned int giet_heap_info(unsigned int * vaddr, unsigned int * size);
     64unsigned int giet_heap_info(unsigned int* vaddr, unsigned int* size);
    5565unsigned int giet_global_task_id();
    56 
    57 unsigned int giet_procnumber();
     66void giet_assert( unsigned int, char* string);
     67unsigned int giet_rand();
    5868
    5969#endif
  • soft/giet_vm/mappings/1c_4p_four.xml

    r235 r253  
    11<?xml version="1.0"?>
    22
    3 <mapping_info   signature = "0xdeadbeef" name = "1c_4p_four" cluster_x = "1" cluster_y = "1" vspaces  = "4" >
     3<mapping_info   signature = "0xdeadbeef"
     4                name      = "1c_4p_four"
     5                cluster_x = "1"
     6                cluster_y = "1"
     7                vspaces   = "4"
     8                increment = "0x10000" >
    49
    510*** This section describes an instance of the "caba_vgsb_xicu_mmu" generic architecture
     
    7075            <periph type = "TTY" psegname = "PSEG_TTY" channels  = "8" />
    7176            <periph type = "DMA" psegname = "PSEG_DMA" channels  = "1" />
    72             <periph type = "XICU" psegname = "PSEG_ICU" channels  = "5" />
     77            <periph type = "XCU" psegname = "PSEG_ICU" channels  = "5" />
    7378            <periph type = "FBF" psegname = "PSEG_FBF" />
    7479
  • soft/giet_vm/mappings/1c_4p_four_dhrystone.xml

    r241 r253  
    11<?xml version="1.0"?>
    22
    3 <mapping_info   signature = "0xdeadbeef" name = "1c_4p_four_dhrystone" cluster_x = "1" cluster_y = "1" vspaces  = "4" >
     3<mapping_info   signature = "0xdeadbeef"
     4                name      = "1c_4p_four_dhrystone"
     5                cluster_x = "1"
     6                cluster_y = "1"
     7                vspaces   = "4"
     8                increment = "0x10000" >
    49
    510    <clusterset>
     
    914
    1015            <pseg name = "PSEG_RAM"  type  = "RAM"  base = "0x0000000000" length = "0x0010000000" />
    11             <pseg name = "PSEG_XICU" type  = "PERI" base = "0x00B0000000" length = "0x0000001000" />
     16            <pseg name = "PSEG_XCU" type  = "PERI" base = "0x00B0000000" length = "0x0000001000" />
    1217            <pseg name = "PSEG_DMA"  type  = "PERI" base = "0x00B1000000" length = "0x0000001000" />
    1318            <pseg name = "PSEG_FBF"  type  = "PERI" base = "0x00B2000000" length = "0x0000200000" />
     
    6166            <periph type = "TTY" psegname = "PSEG_TTY" channels  = "8" />
    6267            <periph type = "DMA" psegname = "PSEG_DMA" channels  = "1" />
    63             <periph type = "XICU" psegname = "PSEG_XICU" channels  = "5" />
     68            <periph type = "XCU"  psegname = "PSEG_XCU" channels  = "5" />
    6469            <periph type = "FBF" psegname = "PSEG_FBF" />
    6570
     
    103108
    104109*** XICU / A[31:28] = 0xE
    105         <vseg name = "seg_icu"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XICU" >
     110        <vseg name = "seg_icu"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XCU" >
    106111            <vobj name = "icu"          type = "PERI" length  = "0x00001000" />
    107112        </vseg>
  • soft/giet_vm/mappings/1c_4p_gameoflife.xml

    r251 r253  
    11<?xml version="1.0"?>
    22
    3 <mapping_info   signature = "0xdeadbeef" name = "1c_4p_gameoflife" cluster_x = "1" cluster_y = "1" vspaces  = "1" >
     3<mapping_info   signature = "0xdeadbeef"
     4                name      = "1c_4p_gameoflife"
     5                cluster_x = "1"
     6                cluster_y = "1"
     7                vspaces   = "1"
     8                increment = "0x10000 >
    49
    510    <clusterset>
     
    914
    1015            <pseg name = "PSEG_RAM"  type  = "RAM"  base = "0x0000000000" length = "0x0010000000" />
    11             <pseg name = "PSEG_XICU" type  = "PERI" base = "0x00B0000000" length = "0x0000001000" />
     16            <pseg name = "PSEG_XCU" type  = "PERI" base = "0x00B0000000" length = "0x0000001000" />
    1217            <pseg name = "PSEG_DMA"  type  = "PERI" base = "0x00B1000000" length = "0x0000001000" />
    1318            <pseg name = "PSEG_FBF"  type  = "PERI" base = "0x00B2000000" length = "0x0000200000" />
     
    6469            <periph type = "TTY" psegname = "PSEG_TTY" channels  = "2" />
    6570            <periph type = "DMA" psegname = "PSEG_DMA" channels  = "1" />
    66             <periph type = "XICU" psegname = "PSEG_XICU" channels  = "5" />
     71            <periph type = "XCU" psegname = "PSEG_XCU" channels  = "5" />
    6772            <periph type = "FBF" psegname = "PSEG_FBF" />
    6873
     
    109114        </vseg>
    110115
    111 *** XICU / A[31:28] = 0xE
    112         <vseg name = "seg_icu"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XICU" >
     116*** XCU / A[31:28] = 0xE
     117        <vseg name = "seg_icu"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XCU" >
    113118            <vobj name = "icu"          type = "PERI" length  = "0x00001000" />
    114119        </vseg>
  • soft/giet_vm/mappings/4c_1p_40.xml

    r245 r253  
    55              cluster_x    = "2"
    66              cluster_y    = "2"
    7               vspaces      = "4">
     7              vspaces      = "4"
     8              increment    = "0x0010000" >
    89
    910*** This first section describes an instance of the "tsar_generic_xbar" architecture
     
    1415        <cluster index = "0" >
    1516            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0x0000000000" length = "0x0010000000" />
    16             <pseg name = "PSEG_XICU" type = "PERI" base = "0x00B0000000" length = "0x0000002000" />
     17            <pseg name = "PSEG_XCU" type = "PERI" base = "0x00B0000000" length = "0x0000002000" />
    1718            <pseg name = "PSEG_DMA"  type = "PERI" base = "0x00B1000000" length = "0x0000008000" />
    1819
     
    4546                <irq type = "HARD" icuid = "29" isr = "ISR_TTY" channel = "13" />
    4647                <irq type = "HARD" icuid = "30" isr = "ISR_TTY" channel = "14" />
    47                 <irq type = "HARD" icuid = "31" isr = "ISR_IOC" />
     48                <irq type = "HARD" icuid = "31" isr = "ISR_IOC" channel = "0" />
    4849            </proc>
    4950
    5051            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4" />
    51             <periph type = "XICU" psegname = "PSEG_XICU" channels = "18" />
     52            <periph type = "XCU"  psegname = "PSEG_XCU"  channels = "1" />
    5253            <periph type = "IOC"  psegname = "PSEG_IOC"  channels = "1" />
    5354            <periph type = "TTY"  psegname = "PSEG_TTY"  channels = "8" />
     
    5859        <cluster index = "1" >
    5960            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0x4000000000" length = "0x0010000000" />
    60             <pseg name = "PSEG_XICU" type = "PERI" base = "0x40B0000000" length = "0x0000002000" />
     61            <pseg name = "PSEG_XCU" type = "PERI" base = "0x40B0000000" length = "0x0000002000" />
    6162            <pseg name = "PSEG_DMA"  type = "PERI" base = "0x40B1000000" length = "0x0000008000" />
    6263
     
    6768
    6869            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4" />
    69             <periph type = "XICU" psegname = "PSEG_XICU" channels = "2" />
     70            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "2" />
    7071        </cluster>
    7172
    7273        <cluster index = "2" >
    7374            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0x8000000000" length = "0x0010000000" />
    74             <pseg name = "PSEG_XICU" type = "PERI" base = "0x80B0000000" length = "0x0000002000" />
     75            <pseg name = "PSEG_XCU" type = "PERI" base = "0x80B0000000" length = "0x0000002000" />
    7576            <pseg name = "PSEG_DMA"  type = "PERI" base = "0x80B1000000" length = "0x0000008000" />
    7677
     
    8182
    8283            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4" />
    83             <periph type = "XICU" psegname = "PSEG_XICU" channels = "2" />
     84            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "2" />
    8485        </cluster>
    8586
    8687        <cluster index = "3" >
    8788            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0xC000000000" length = "0x0010000000" />
    88             <pseg name = "PSEG_XICU" type = "PERI" base = "0xC0B0000000" length = "0x0000002000" />
     89            <pseg name = "PSEG_XCU" type = "PERI" base = "0xC0B0000000" length = "0x0000002000" />
    8990            <pseg name = "PSEG_DMA"  type = "PERI" base = "0xC0B1000000" length = "0x0000008000" />
    9091
     
    9596
    9697            <periph  type = "DMA" psegname = "PSEG_DMA"  channels = "4" />
    97             <periph type = "XICU" psegname = "PSEG_XICU" channels = "2" />
     98            <periph  type = "XCU" psegname = "PSEG_XCU" channels = "2" />
    9899        </cluster>
    99100    </clusterset>
    100 
    101 
    102101
    103102    <globalset>
     
    148147        </vseg>
    149148
    150 *** Replicated ICUS / A[31:28] = 0xE / Increment = 0x100000             
    151 
    152         <vseg name = "seg_icu_0"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XICU" >
     149*** Replicated ICUS / A[31:28] = 0xE / Increment = 0x10000             
     150
     151        <vseg name = "seg_icu_0"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XCU" >
    153152            <vobj name = "icu_0"          type = "PERI" length  = "0x00001000" />
    154153        </vseg>
    155         <vseg name = "seg_icu_1"          vbase = "0xE0100000" mode = "__W_" clusterid = "1" psegname = "PSEG_XICU" >
     154        <vseg name = "seg_icu_1"          vbase = "0xE0010000" mode = "__W_" clusterid = "1" psegname = "PSEG_XCU" >
    156155            <vobj name = "icu_1"          type = "PERI" length  = "0x00001000" />
    157156        </vseg>
    158         <vseg name = "seg_icu_2"          vbase = "0xE0200000" mode = "__W_" clusterid = "2" psegname = "PSEG_XICU" >
     157        <vseg name = "seg_icu_2"          vbase = "0xE0020000" mode = "__W_" clusterid = "2" psegname = "PSEG_XCU" >
    159158            <vobj name = "icu_2"          type = "PERI" length  = "0x00001000" />
    160159        </vseg>
    161         <vseg name = "seg_icu_3"          vbase = "0xE0300000" mode = "__W_" clusterid = "3" psegname = "PSEG_XICU" >
     160        <vseg name = "seg_icu_3"          vbase = "0xE0030000" mode = "__W_" clusterid = "3" psegname = "PSEG_XCU" >
    162161            <vobj name = "icu_3"          type = "PERI" length  = "0x00001000" />
    163162        </vseg>
    164163
    165 *** Replicated DMAs / A[31:28] = 0xD / Increment = 0x100000
     164*** Replicated DMAs / A[31:28] = 0xD / Increment = 0x10000
    166165
    167166        <vseg name = "seg_dma_0"          vbase = "0xD0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_DMA" >
    168167            <vobj name = "dma_0"          type = "PERI" length  = "0x00008000" />
    169168        </vseg>
    170         <vseg name = "seg_dma_1"          vbase = "0xD0100000" mode = "__W_" clusterid = "1" psegname = "PSEG_DMA" >
     169        <vseg name = "seg_dma_1"          vbase = "0xD0010000" mode = "__W_" clusterid = "1" psegname = "PSEG_DMA" >
    171170            <vobj name = "dma_1"          type = "PERI" length  = "0x00008000" />
    172171        </vseg>
    173         <vseg name = "seg_dma_2"          vbase = "0xD0200000" mode = "__W_" clusterid = "2" psegname = "PSEG_DMA" >
     172        <vseg name = "seg_dma_2"          vbase = "0xD0020000" mode = "__W_" clusterid = "2" psegname = "PSEG_DMA" >
    174173            <vobj name = "dma_2"          type = "PERI" length  = "0x00008000" />
    175174        </vseg>
    176         <vseg name = "seg_dma_3"          vbase = "0xD0300000" mode = "__W_" clusterid = "3" psegname = "PSEG_DMA" >
     175        <vseg name = "seg_dma_3"          vbase = "0xD0030000" mode = "__W_" clusterid = "3" psegname = "PSEG_DMA" >
    177176            <vobj name = "dma_3"          type = "PERI" length  = "0x00008000" />
    178177        </vseg>
    179178
    180 *** Replicated schedulers / A[31:28] = 0xF / Increment = 0x100000
     179*** Replicated schedulers / A[31:28] = 0xF / Increment = 0x10000
    181180
    182181        <vseg name = "seg_sched_0"        vbase = "0xF0000000" mode = "C_W_" clusterid = "0" psegname = "PSEG_RAM" >
    183182            <vobj name = "sched_0"        type = "SCHED" length  = "0x00008000" />
    184183        </vseg>
    185         <vseg name = "seg_sched_1"        vbase = "0xF0100000" mode = "C_W_" clusterid = "1" psegname = "PSEG_RAM" >
     184        <vseg name = "seg_sched_1"        vbase = "0xF0010000" mode = "C_W_" clusterid = "1" psegname = "PSEG_RAM" >
    186185            <vobj name = "sched_1"        type = "SCHED" length  = "0x00008000" />
    187186        </vseg>
    188         <vseg name = "seg_sched_2"        vbase = "0xF0200000" mode = "C_W_" clusterid = "2" psegname = "PSEG_RAM" >
     187        <vseg name = "seg_sched_2"        vbase = "0xF0020000" mode = "C_W_" clusterid = "2" psegname = "PSEG_RAM" >
    189188            <vobj name = "sched_2"        type = "SCHED" length  = "0x00008000" />
    190189        </vseg>
    191         <vseg name = "seg_sched_3"        vbase = "0xF0300000" mode = "C_W_" clusterid = "3" psegname = "PSEG_RAM" >
     190        <vseg name = "seg_sched_3"        vbase = "0xF0030000" mode = "C_W_" clusterid = "3" psegname = "PSEG_RAM" >
    192191            <vobj name = "sched_3"        type = "SCHED" length  = "0x00008000" />
    193192        </vseg>
  • soft/giet_vm/mappings/4c_1p_display.xml

    r249 r253  
    55              cluster_x    = "2"
    66              cluster_y    = "2"
    7               vspaces      = "1">
     7              vspaces      = "1"
     8              increment    = "0x10000 >
    89
    910*** This first section describes an instance of the "tsar_generic_iob" architecture
     
    1415        <cluster index = "0" >
    1516            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0x0000000000" length = "0x0010000000" />
    16             <pseg name = "PSEG_XICU" type = "PERI" base = "0x00B0000000" length = "0x0000002000" />
     17            <pseg name = "PSEG_XCU" type = "PERI" base = "0x00B0000000" length = "0x0000002000" />
    1718            <pseg name = "PSEG_DMA"  type = "PERI" base = "0x00B1000000" length = "0x0000008000" />
    1819            <pseg name = "PSEG_MMC"  type = "PERI" base = "0x00B2000000" length = "0x0000001000" />
     
    5051
    5152            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4"  />
    52             <periph type = "XICU" psegname = "PSEG_XICU" channels = "18" />
     53            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "18" />
    5354            <periph type = "MMC"  psegname = "PSEG_MMC" channels = "1"  />
    5455            <periph type = "IOC"  psegname = "PSEG_IOC"  channels = "1"  />
     
    6263        <cluster index = "1" >
    6364            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0x4000000000" length = "0x0010000000" />
    64             <pseg name = "PSEG_XICU" type = "PERI" base = "0x40B0000000" length = "0x0000002000" />
     65            <pseg name = "PSEG_XCU" type = "PERI" base = "0x40B0000000" length = "0x0000002000" />
    6566            <pseg name = "PSEG_DMA"  type = "PERI" base = "0x40B1000000" length = "0x0000008000" />
    6667            <pseg name = "PSEG_MMC"  type = "PERI" base = "0x40B2000000" length = "0x0000001000" />
     
    7273
    7374            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4" />
    74             <periph type = "XICU" psegname = "PSEG_XICU" channels = "2" />
     75            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "2" />
    7576            <periph type = "MMC"  psegname = "PSEG_MMC"  channels = "1" />
    7677        </cluster>
     
    7879        <cluster index = "2" >
    7980            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0x8000000000" length = "0x0010000000" />
    80             <pseg name = "PSEG_XICU" type = "PERI" base = "0x80B0000000" length = "0x0000002000" />
     81            <pseg name = "PSEG_XCU" type = "PERI" base = "0x80B0000000" length = "0x0000002000" />
    8182            <pseg name = "PSEG_DMA"  type = "PERI" base = "0x80B1000000" length = "0x0000008000" />
    8283            <pseg name = "PSEG_MMC"  type = "PERI" base = "0x80B2000000" length = "0x0000001000" />
     
    8889
    8990            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4" />
    90             <periph type = "XICU" psegname = "PSEG_XICU" channels = "2" />
     91            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "2" />
    9192            <periph type = "MMC"  psegname = "PSEG_MMC"  channels = "1" />
    9293        </cluster>
     
    9495        <cluster index = "3" >
    9596            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0xC000000000" length = "0x0010000000" />
    96             <pseg name = "PSEG_XICU" type = "PERI" base = "0xC0B0000000" length = "0x0000002000" />
     97            <pseg name = "PSEG_XCU" type = "PERI" base = "0xC0B0000000" length = "0x0000002000" />
    9798            <pseg name = "PSEG_DMA"  type = "PERI" base = "0xC0B1000000" length = "0x0000008000" />
    9899            <pseg name = "PSEG_MMC"  type = "PERI" base = "0xC0B2000000" length = "0x0000001000" />
     
    104105
    105106            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4" />
    106             <periph type = "XICU" psegname = "PSEG_XICU" channels = "2" />
     107            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "2" />
    107108            <periph type = "MMC"  psegname = "PSEG_MMC"  channels = "1" />
    108109        </cluster>
     
    163164        </vseg>
    164165
    165 *** segments for replicated ICUS / A[31:28] = 0xE / Increment = 0x100000             
    166 
    167         <vseg name = "seg_icu_0"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XICU" >
     166*** segments for replicated ICUS / A[31:28] = 0xE / Increment = 0x10000             
     167
     168        <vseg name = "seg_icu_0"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XCU" >
    168169            <vobj name = "icu_0"          type = "PERI" length  = "0x00001000" />
    169170        </vseg>
    170         <vseg name = "seg_icu_1"          vbase = "0xE0100000" mode = "__W_" clusterid = "1" psegname = "PSEG_XICU" >
     171        <vseg name = "seg_icu_1"          vbase = "0xE0010000" mode = "__W_" clusterid = "1" psegname = "PSEG_XCU" >
    171172            <vobj name = "icu_1"          type = "PERI" length  = "0x00001000" />
    172173        </vseg>
    173         <vseg name = "seg_icu_2"          vbase = "0xE0200000" mode = "__W_" clusterid = "2" psegname = "PSEG_XICU" >
     174        <vseg name = "seg_icu_2"          vbase = "0xE0020000" mode = "__W_" clusterid = "2" psegname = "PSEG_XCU" >
    174175            <vobj name = "icu_2"          type = "PERI" length  = "0x00001000" />
    175176        </vseg>
    176         <vseg name = "seg_icu_3"          vbase = "0xE0300000" mode = "__W_" clusterid = "3" psegname = "PSEG_XICU" >
     177        <vseg name = "seg_icu_3"          vbase = "0xE0030000" mode = "__W_" clusterid = "3" psegname = "PSEG_XCU" >
    177178            <vobj name = "icu_3"          type = "PERI" length  = "0x00001000" />
    178179        </vseg>
    179180
    180 *** segments for replicated DMAs / A[31:28] = 0xD / Increment = 0x100000
     181*** segments for replicated DMAs / A[31:28] = 0xD / Increment = 0x10000
    181182
    182183        <vseg name = "seg_dma_0"          vbase = "0xD0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_DMA" >
    183184            <vobj name = "dma_0"          type = "PERI" length  = "0x00008000" />
    184185        </vseg>
    185         <vseg name = "seg_dma_1"          vbase = "0xD0100000" mode = "__W_" clusterid = "1" psegname = "PSEG_DMA" >
     186        <vseg name = "seg_dma_1"          vbase = "0xD0010000" mode = "__W_" clusterid = "1" psegname = "PSEG_DMA" >
    186187            <vobj name = "dma_1"          type = "PERI" length  = "0x00008000" />
    187188        </vseg>
    188         <vseg name = "seg_dma_2"          vbase = "0xD0200000" mode = "__W_" clusterid = "2" psegname = "PSEG_DMA" >
     189        <vseg name = "seg_dma_2"          vbase = "0xD0020000" mode = "__W_" clusterid = "2" psegname = "PSEG_DMA" >
    189190            <vobj name = "dma_2"          type = "PERI" length  = "0x00008000" />
    190191        </vseg>
    191         <vseg name = "seg_dma_3"          vbase = "0xD0300000" mode = "__W_" clusterid = "3" psegname = "PSEG_DMA" >
     192        <vseg name = "seg_dma_3"          vbase = "0xD0030000" mode = "__W_" clusterid = "3" psegname = "PSEG_DMA" >
    192193            <vobj name = "dma_3"          type = "PERI" length  = "0x00008000" />
    193194        </vseg>
    194195
    195 *** segments for replicated MMC / A[31:28] = 0xC / Increment = 0x100000
     196*** segments for replicated MMC / A[31:28] = 0xC / Increment = 0x10000
    196197
    197198        <vseg name = "seg_memc_0"         vbase = "0xC0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_MMC" >
    198199            <vobj name = "memc_0"         type = "PERI" length  = "0x00001000" />
    199200        </vseg>
    200         <vseg name = "seg_memc_1"         vbase = "0xC0100000" mode = "__W_" clusterid = "1" psegname = "PSEG_MMC" >
     201        <vseg name = "seg_memc_1"         vbase = "0xC0010000" mode = "__W_" clusterid = "1" psegname = "PSEG_MMC" >
    201202            <vobj name = "memc_1"         type = "PERI" length  = "0x00001000" />
    202203        </vseg>
    203         <vseg name = "seg_memc_2"         vbase = "0xC0200000" mode = "__W_" clusterid = "2" psegname = "PSEG_MMC" >
     204        <vseg name = "seg_memc_2"         vbase = "0xC0020000" mode = "__W_" clusterid = "2" psegname = "PSEG_MMC" >
    204205            <vobj name = "memc_2"         type = "PERI" length  = "0x00001000" />
    205206        </vseg>
    206         <vseg name = "seg_memc_3"         vbase = "0xC0300000" mode = "__W_" clusterid = "3" psegname = "PSEG_MMC" >
     207        <vseg name = "seg_memc_3"         vbase = "0xC0030000" mode = "__W_" clusterid = "3" psegname = "PSEG_MMC" >
    207208            <vobj name = "memc_3"         type = "PERI" length  = "0x00001000" />
    208209        </vseg>
    209210
    210 *** segments for replicated schedulers / A[31:28] = 0xF / Increment = 0x100000
     211*** segments for replicated schedulers / A[31:28] = 0xF / Increment = 0x10000
    211212
    212213        <vseg name = "seg_sched_0"        vbase = "0xF0000000" mode = "C_W_" clusterid = "0" psegname = "PSEG_RAM" >
    213214            <vobj name = "sched_0"        type = "SCHED" length  = "0x00008000" />
    214215        </vseg>
    215         <vseg name = "seg_sched_1"        vbase = "0xF0100000" mode = "C_W_" clusterid = "1" psegname = "PSEG_RAM" >
     216        <vseg name = "seg_sched_1"        vbase = "0xF0010000" mode = "C_W_" clusterid = "1" psegname = "PSEG_RAM" >
    216217            <vobj name = "sched_1"        type = "SCHED" length  = "0x00008000" />
    217218        </vseg>
    218         <vseg name = "seg_sched_2"        vbase = "0xF0200000" mode = "C_W_" clusterid = "2" psegname = "PSEG_RAM" >
     219        <vseg name = "seg_sched_2"        vbase = "0xF0020000" mode = "C_W_" clusterid = "2" psegname = "PSEG_RAM" >
    219220            <vobj name = "sched_2"        type = "SCHED" length  = "0x00008000" />
    220221        </vseg>
    221         <vseg name = "seg_sched_3"        vbase = "0xF0300000" mode = "C_W_" clusterid = "3" psegname = "PSEG_RAM" >
     222        <vseg name = "seg_sched_3"        vbase = "0xF0030000" mode = "C_W_" clusterid = "3" psegname = "PSEG_RAM" >
    222223            <vobj name = "sched_3"        type = "SCHED" length  = "0x00008000" />
    223224        </vseg>
  • soft/giet_vm/mappings/4c_1p_iob.xml

    r252 r253  
    55              cluster_x    = "2"
    66              cluster_y    = "2"
    7               vspaces      = "4">
     7              vspaces      = "4"
     8              increment    = "0x10000" >
    89
    910*** This first section describes an instance of the "tsar_generic_iob" architecture
     
    1415        <cluster index = "0" >
    1516            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0x0000000000" length = "0x0010000000" />
    16             <pseg name = "PSEG_XICU" type = "PERI" base = "0x00B0000000" length = "0x0000002000" />
     17            <pseg name = "PSEG_XCU" type = "PERI" base = "0x00B0000000" length = "0x0000002000" />
    1718            <pseg name = "PSEG_DMA"  type = "PERI" base = "0x00B1000000" length = "0x0000008000" />
    1819            <pseg name = "PSEG_MMC"  type = "PERI" base = "0x00B2000000" length = "0x0000001000" />
     
    5051
    5152            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4"  />
    52             <periph type = "XICU" psegname = "PSEG_XICU" channels = "18" />
     53            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "18" />
    5354            <periph type = "MMC"  psegname = "PSEG_MMC" channels = "1"  />
    5455            <periph type = "IOC"  psegname = "PSEG_IOC"  channels = "1"  />
     
    6364        <cluster index = "1" >
    6465            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0x4000000000" length = "0x0010000000" />
    65             <pseg name = "PSEG_XICU" type = "PERI" base = "0x40B0000000" length = "0x0000002000" />
     66            <pseg name = "PSEG_XCU" type = "PERI" base = "0x40B0000000" length = "0x0000002000" />
    6667            <pseg name = "PSEG_DMA"  type = "PERI" base = "0x40B1000000" length = "0x0000008000" />
    6768            <pseg name = "PSEG_MMC"  type = "PERI" base = "0x40B2000000" length = "0x0000001000" />
     
    7374
    7475            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4" />
    75             <periph type = "XICU" psegname = "PSEG_XICU" channels = "2" />
     76            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "2" />
    7677            <periph type = "MMC"  psegname = "PSEG_MMC"  channels = "1" />
    7778        </cluster>
     
    7980        <cluster index = "2" >
    8081            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0x8000000000" length = "0x0010000000" />
    81             <pseg name = "PSEG_XICU" type = "PERI" base = "0x80B0000000" length = "0x0000002000" />
     82            <pseg name = "PSEG_XCU" type = "PERI" base = "0x80B0000000" length = "0x0000002000" />
    8283            <pseg name = "PSEG_DMA"  type = "PERI" base = "0x80B1000000" length = "0x0000008000" />
    8384            <pseg name = "PSEG_MMC"  type = "PERI" base = "0x80B2000000" length = "0x0000001000" />
     
    8990
    9091            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4" />
    91             <periph type = "XICU" psegname = "PSEG_XICU" channels = "2" />
     92            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "2" />
    9293            <periph type = "MMC"  psegname = "PSEG_MMC"  channels = "1" />
    9394        </cluster>
     
    9596        <cluster index = "3" >
    9697            <pseg name = "PSEG_RAM"  type = "RAM"  base = "0xC000000000" length = "0x0010000000" />
    97             <pseg name = "PSEG_XICU" type = "PERI" base = "0xC0B0000000" length = "0x0000002000" />
     98            <pseg name = "PSEG_XCU" type = "PERI" base = "0xC0B0000000" length = "0x0000002000" />
    9899            <pseg name = "PSEG_DMA"  type = "PERI" base = "0xC0B1000000" length = "0x0000008000" />
    99100            <pseg name = "PSEG_MMC"  type = "PERI" base = "0xC0B2000000" length = "0x0000001000" />
     
    105106
    106107            <periph type = "DMA"  psegname = "PSEG_DMA"  channels = "4" />
    107             <periph type = "XICU" psegname = "PSEG_XICU" channels = "2" />
     108            <periph type = "XCU"  psegname = "PSEG_XCU" channels = "2" />
    108109            <periph type = "MMC"  psegname = "PSEG_MMC"  channels = "1" />
    109110        </cluster>
     
    163164        </vseg>
    164165
    165 *** segments for replicated ICUS / A[31:28] = 0xE / Increment = 0x100000             
    166 
    167         <vseg name = "seg_icu_0"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XICU" >
     166*** segments for replicated ICUS / A[31:28] = 0xE / Increment = 0x10000             
     167
     168        <vseg name = "seg_icu_0"          vbase = "0xE0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_XCU" >
    168169            <vobj name = "icu_0"          type = "PERI" length  = "0x00001000" />
    169170        </vseg>
    170         <vseg name = "seg_icu_1"          vbase = "0xE0100000" mode = "__W_" clusterid = "1" psegname = "PSEG_XICU" >
     171        <vseg name = "seg_icu_1"          vbase = "0xE0010000" mode = "__W_" clusterid = "1" psegname = "PSEG_XCU" >
    171172            <vobj name = "icu_1"          type = "PERI" length  = "0x00001000" />
    172173        </vseg>
    173         <vseg name = "seg_icu_2"          vbase = "0xE0200000" mode = "__W_" clusterid = "2" psegname = "PSEG_XICU" >
     174        <vseg name = "seg_icu_2"          vbase = "0xE0020000" mode = "__W_" clusterid = "2" psegname = "PSEG_XCU" >
    174175            <vobj name = "icu_2"          type = "PERI" length  = "0x00001000" />
    175176        </vseg>
    176         <vseg name = "seg_icu_3"          vbase = "0xE0300000" mode = "__W_" clusterid = "3" psegname = "PSEG_XICU" >
     177        <vseg name = "seg_icu_3"          vbase = "0xE0030000" mode = "__W_" clusterid = "3" psegname = "PSEG_XCU" >
    177178            <vobj name = "icu_3"          type = "PERI" length  = "0x00001000" />
    178179        </vseg>
    179180
    180 *** segments for replicated DMAs / A[31:28] = 0xD / Increment = 0x100000
     181*** segments for replicated DMAs / A[31:28] = 0xD / Increment = 0x10000
    181182
    182183        <vseg name = "seg_dma_0"          vbase = "0xD0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_DMA" >
    183184            <vobj name = "dma_0"          type = "PERI" length  = "0x00008000" />
    184185        </vseg>
    185         <vseg name = "seg_dma_1"          vbase = "0xD0100000" mode = "__W_" clusterid = "1" psegname = "PSEG_DMA" >
     186        <vseg name = "seg_dma_1"          vbase = "0xD0010000" mode = "__W_" clusterid = "1" psegname = "PSEG_DMA" >
    186187            <vobj name = "dma_1"          type = "PERI" length  = "0x00008000" />
    187188        </vseg>
    188         <vseg name = "seg_dma_2"          vbase = "0xD0200000" mode = "__W_" clusterid = "2" psegname = "PSEG_DMA" >
     189        <vseg name = "seg_dma_2"          vbase = "0xD0020000" mode = "__W_" clusterid = "2" psegname = "PSEG_DMA" >
    189190            <vobj name = "dma_2"          type = "PERI" length  = "0x00008000" />
    190191        </vseg>
    191         <vseg name = "seg_dma_3"          vbase = "0xD0300000" mode = "__W_" clusterid = "3" psegname = "PSEG_DMA" >
     192        <vseg name = "seg_dma_3"          vbase = "0xD0030000" mode = "__W_" clusterid = "3" psegname = "PSEG_DMA" >
    192193            <vobj name = "dma_3"          type = "PERI" length  = "0x00008000" />
    193194        </vseg>
    194195
    195 *** segments for replicated MMC / A[31:28] = 0xC / Increment = 0x100000
     196*** segments for replicated MMC / A[31:28] = 0xC / Increment = 0x10000
    196197
    197198        <vseg name = "seg_memc_0"         vbase = "0xC0000000" mode = "__W_" clusterid = "0" psegname = "PSEG_MMC" >
    198199            <vobj name = "memc_0"         type = "PERI" length  = "0x00001000" />
    199200        </vseg>
    200         <vseg name = "seg_memc_1"         vbase = "0xC0100000" mode = "__W_" clusterid = "1" psegname = "PSEG_MMC" >
     201        <vseg name = "seg_memc_1"         vbase = "0xC0010000" mode = "__W_" clusterid = "1" psegname = "PSEG_MMC" >
    201202            <vobj name = "memc_1"         type = "PERI" length  = "0x00001000" />
    202203        </vseg>
    203         <vseg name = "seg_memc_2"         vbase = "0xC0200000" mode = "__W_" clusterid = "2" psegname = "PSEG_MMC" >
     204        <vseg name = "seg_memc_2"         vbase = "0xC0020000" mode = "__W_" clusterid = "2" psegname = "PSEG_MMC" >
    204205            <vobj name = "memc_2"         type = "PERI" length  = "0x00001000" />
    205206        </vseg>
    206         <vseg name = "seg_memc_3"         vbase = "0xC0300000" mode = "__W_" clusterid = "3" psegname = "PSEG_MMC" >
     207        <vseg name = "seg_memc_3"         vbase = "0xC0030000" mode = "__W_" clusterid = "3" psegname = "PSEG_MMC" >
    207208            <vobj name = "memc_3"         type = "PERI" length  = "0x00001000" />
    208209        </vseg>
    209210
    210 *** segments for replicated schedulers / A[31:28] = 0xF / Increment = 0x100000
     211*** segments for replicated schedulers / A[31:28] = 0xF / Increment = 0x10000
    211212
    212213        <vseg name = "seg_sched_0"        vbase = "0xF0000000" mode = "C_W_" clusterid = "0" psegname = "PSEG_RAM" >
    213214            <vobj name = "sched_0"        type = "SCHED" length  = "0x00008000" />
    214215        </vseg>
    215         <vseg name = "seg_sched_1"        vbase = "0xF0100000" mode = "C_W_" clusterid = "1" psegname = "PSEG_RAM" >
     216        <vseg name = "seg_sched_1"        vbase = "0xF0010000" mode = "C_W_" clusterid = "1" psegname = "PSEG_RAM" >
    216217            <vobj name = "sched_1"        type = "SCHED" length  = "0x00008000" />
    217218        </vseg>
    218         <vseg name = "seg_sched_2"        vbase = "0xF0200000" mode = "C_W_" clusterid = "2" psegname = "PSEG_RAM" >
     219        <vseg name = "seg_sched_2"        vbase = "0xF0020000" mode = "C_W_" clusterid = "2" psegname = "PSEG_RAM" >
    219220            <vobj name = "sched_2"        type = "SCHED" length  = "0x00008000" />
    220221        </vseg>
    221         <vseg name = "seg_sched_3"        vbase = "0xF0300000" mode = "C_W_" clusterid = "3" psegname = "PSEG_RAM" >
     222        <vseg name = "seg_sched_3"        vbase = "0xF0030000" mode = "C_W_" clusterid = "3" psegname = "PSEG_RAM" >
    222223            <vobj name = "sched_3"        type = "SCHED" length  = "0x00008000" />
    223224        </vseg>
     
    314315            </vseg>
    315316
    316             <task name = "main_display" clusterid = "3" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" usedma = "1" />
     317            <task name = "main_display" clusterid = "3" proclocid = "0" stackname = "stack" heapname = "heap" startid = "0" usetty = "1" usecma = "1" />
    317318        </vspace>
    318319    </vspaceset>
  • soft/giet_vm/sys/common.h

    r249 r253  
    2222extern _ld_symbol_t seg_nic_base;
    2323extern _ld_symbol_t seg_icu_base;
     24extern _ld_symbol_t seg_xcu_base;
    2425extern _ld_symbol_t seg_tim_base;
    2526extern _ld_symbol_t seg_tty_base;
     
    2930extern _ld_symbol_t seg_ioc_base;
    3031extern _ld_symbol_t seg_mmc_base;
     32extern _ld_symbol_t seg_cma_base;
     33
     34extern _ld_symbol_t vseg_cluster_increment;
    3135
    3236extern _ld_symbol_t seg_mapping_base;
  • soft/giet_vm/sys/drivers.c

    r249 r253  
    55// Copyright (c) UPMC-LIP6
    66///////////////////////////////////////////////////////////////////////////////////
    7 // The drivers.c and drivers.h files are part ot the GIET-VM nano kernel.
     7// The drivers.c and drivers.h files are part ot the GIET-VM kernel.
     8//
    89// They contains the drivers for the peripherals available in the SoCLib library:
    910// - vci_multi_tty
     
    1112// - vci_multi_dma
    1213// - vci_multi_icu
    13 // - vci_xicu & vci_multi_icu
     14// - vci_xicu
    1415// - vci_gcd
    1516// - vci_frame_buffer
    1617// - vci_block_device
    17 //
    18 // For the peripherals replicated in each cluster (ICU, TIMER, DMA),
     18// - vci_multi_nic
     19// - vci_chbuf_dma
     20//
     21// For the peripherals replicated in each cluster (ICU, TIMER, XCU, DMA, MMC),
    1922// the corresponding (virtual) base addresses must be completed by an offset
    2023// depending on the cluster index.
    21 //
    22 // The following global parameter must be defined in the giet_config.h file:
    23 // - GIET_CLUSTER_INCREMENT
    2424//
    2525// The following global parameters must be defined in the hard_config.h file:
     
    3232// The following virtual base addresses must be defined in the giet_vsegs.ld file:
    3333// - seg_icu_base
     34// - seg_xcu_base
    3435// - seg_tim_base
    3536// - seg_dma_base
     
    4243// - seg_iob_base
    4344// - seg_mmc_base
    44 //
     45// - vseg_cluster_increment
    4546///////////////////////////////////////////////////////////////////////////////////
    4647
     
    6869#if (NB_PROCS_MAX > 8)
    6970# error: NB_PROCS_MAX cannot be larger than 8!
    70 #endif
    71 
    72 #if !defined(GIET_CLUSTER_INCREMENT)
    73 # error: You must define GIET_CLUSTER_INCREMENT in the giet_config.h file
    7471#endif
    7572
     
    153150// The (virtual) base address of the associated segment is:
    154151//
    155 //       timer_address = seg_icu_base + cluster_id * GIET_CLUSTER_INCREMENT
    156 //
    157 // - cluster id is an explicit argument of all access functions
    158 // - seg_icu_base must be defined in the giet_vsegs.ld file
    159 // - GIET_CLUSTER_INCREMENT must be defined in the giet_config.h file
     152//       timer_address = seg_tim_base + cluster_id * vseg_cluster_increment
     153//   or  timer_address = seg_xcu_base + cluster_id * vseg_cluster_increment
     154//
    160155////////////////////////////////////////////////////////////////////////////////
    161156
     
    184179
    185180#if USE_XICU
    186     unsigned int * timer_address = (unsigned int *) ((char *) &seg_icu_base +
    187                                                      (cluster_id * GIET_CLUSTER_INCREMENT));
     181    unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
     182                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
    188183
    189184    timer_address[XICU_REG(XICU_PTI_PER, local_id)] = period;
    190185#else
    191     unsigned int* timer_address = (unsigned int *) ((char *) &seg_tim_base +
    192                                                     (cluster_id * GIET_CLUSTER_INCREMENT));
     186    unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
     187                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
    193188
    194189    timer_address[local_id * TIMER_SPAN + TIMER_PERIOD] = period;
     
    212207
    213208#if USE_XICU
    214     unsigned int * timer_address = (unsigned int *) ((char *) &seg_icu_base +
    215                                                      (cluster_id * GIET_CLUSTER_INCREMENT));
     209    unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
     210                                   (cluster_id * (unsigned int)&vseg_cluster_increment));
    216211
    217212    timer_address[XICU_REG(XICU_PTI_PER, local_id)] = 0;
    218213#else
    219     unsigned int* timer_address = (unsigned int *) ((char *) &seg_tim_base +
    220                                                     (cluster_id * GIET_CLUSTER_INCREMENT));
     214    unsigned int* timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
     215                                  (cluster_id * (unsigned int)&vseg_cluster_increment));
    221216
    222217    timer_address[local_id * TIMER_SPAN + TIMER_MODE] = 0;
     
    224219    return 0;
    225220}
    226 
    227221
    228222//////////////////////////////////////////////////////////////////////////////
     
    242236
    243237#if USE_XICU
    244     unsigned int * timer_address = (unsigned int *) ((char *) &seg_icu_base +
    245                                                      (cluster_id * GIET_CLUSTER_INCREMENT));
     238    unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
     239                                   (cluster_id * (unsigned int)&vseg_cluster_increment));
    246240
    247241    unsigned int bloup = timer_address[XICU_REG(XICU_PTI_ACK, local_id)];
    248242    bloup++; // to avoid a warning
    249243#else
    250     unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base +
    251             (cluster_id * GIET_CLUSTER_INCREMENT));
     244    unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
     245                                   (cluster_id * (unsigned int)&vseg_cluster_increment));
    252246
    253247    timer_address[local_id * TIMER_SPAN + TIMER_RESETIRQ] = 0;
     
    255249    return 0;
    256250}
    257 
    258 
    259251
    260252///////////////////////////////////////////////////////////////////////
     
    263255// This function resets the period at the end of which
    264256// an interrupt is sent. To do so, we re-write the period
    265 // ini the proper register, what causes the count to restart.
     257// in the proper register, what causes the count to restart.
    266258// The period value is read from the same (TIMER_PERIOD) register,
    267259// this is why in appearance we do nothing useful (read a value
     
    269261// This function is called during a context switch (user or preemptive)
    270262///////////////////////////////////////////////////////////////////////
    271 unsigned int _timer_reset_irq_cpt(unsigned int cluster_id, unsigned int local_id) {
     263unsigned int _timer_reset_irq_cpt( unsigned int cluster_id,
     264                                   unsigned int local_id) {
    272265    // parameters checking
    273266    if (cluster_id >= NB_CLUSTERS) {
     
    279272
    280273#if USE_XICU
    281     unsigned int * timer_address = (unsigned int *) ((char *) &seg_icu_base + (cluster_id * GIET_CLUSTER_INCREMENT));
     274    unsigned int * timer_address = (unsigned int *) ((unsigned int) &seg_xcu_base +
     275                                   (cluster_id * (unsigned int)&vseg_cluster_increment));
     276
    282277    unsigned int timer_period = timer_address[XICU_REG(XICU_PTI_PER, local_id)];
    283278
    284     // we write 0 first because if the timer is currently running, the corresponding timer counter is not reset
     279    // we write 0 first because if the timer is currently running,
     280    //the corresponding timer counter is not reset
    285281    timer_address[XICU_REG(XICU_PTI_PER, local_id)] = 0;
    286282    timer_address[XICU_REG(XICU_PTI_PER, local_id)] = timer_period;
    287283#else
    288284    // We suppose that the TIMER_MODE register value is 0x3
    289     unsigned int * timer_address = (unsigned int *) ((char *) &seg_tim_base + (cluster_id * GIET_CLUSTER_INCREMENT));
     285    unsigned int * timer_address = (unsigned int *) ((unsigned int)&seg_tim_base +
     286                                   (cluster_id * (unsigned int)&vseg_cluster_increment));
     287
    290288    unsigned int timer_period = timer_address[local_id * TIMER_SPAN + TIMER_PERIOD];
    291289
     
    295293    return 0;
    296294}
    297 
    298295
    299296/////////////////////////////////////////////////////////////////////////////////
     
    412409// This hardware component is replicated in all clusters.
    413410// There is one vci_multi_icu (or vci_xicu) component per cluster,
    414 // and the number of independant ICUs is equal to NB_PROCS_MAX,
     411// and the number of ICU channels is equal to NB_PROCS_MAX,
    415412// because there is one private interrupt controler per processor.
    416413////////////////////////////////////////////////////////////////////////////////
    417414// The (virtual) base address of the associated segment is:
    418415//
    419 //       icu_address = seg_icu_base + cluster_id * GIET_CLUSTER_INCREMENT
    420 //
    421 // - cluster id is an explicit argument of all access functions
    422 // - seg_icu_base must be defined in the giet_vsegs.ld file
    423 // - GIET_CLUSTER_INCREMENT must be defined in the giet_config.h file
     416//       icu_address = seg_icu_base + cluster_id * vseg_cluster_increment
     417//  or   icu_address = seg_xcu_base + cluster_id * vseg_cluster_increment
     418//
    424419////////////////////////////////////////////////////////////////////////////////
    425420
     
    434429                            unsigned int proc_id,
    435430                            unsigned int value,
    436                             unsigned int is_timer)
     431                            unsigned int is_PTI)
    437432{
    438433    // parameters checking
     
    440435    if (proc_id >= NB_PROCS_MAX)   return 1;
    441436
    442     unsigned int * icu_address = (unsigned int *) ((char *) &seg_icu_base +
    443                                                    (cluster_id * GIET_CLUSTER_INCREMENT));
    444437#if USE_XICU
    445     if (is_timer)
     438    unsigned int * icu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
     439                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
     440    if (is_PTI)
    446441    {
    447442        icu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value;
     
    452447    }
    453448#else
     449    unsigned int * icu_address = (unsigned int *) ((unsigned int)&seg_icu_base +
     450                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
     451
    454452    icu_address[proc_id * ICU_SPAN + ICU_MASK_SET] = value;
    455453#endif
    456454    return 0;
    457455}
    458 
    459456
    460457////////////////////////////////////////////////////////////////////////////////
     
    473470    if (proc_id >= NB_PROCS_MAX)    return 1;
    474471
    475     unsigned int * icu_address = (unsigned int *) ((char *) &seg_icu_base +
    476                                                    (cluster_id * GIET_CLUSTER_INCREMENT));
    477472#if USE_XICU
     473    unsigned int * icu_address = (unsigned int *) ((unsigned int)&seg_xcu_base +
     474                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
     475
    478476    unsigned int prio = icu_address[XICU_REG(XICU_PRIO, proc_id)];
    479477    unsigned int pti_ok = (prio & 0x00000001);
     
    488486    else             { *buffer = 32; }
    489487#else
     488    unsigned int * icu_address = (unsigned int *) ((unsigned int)&seg_icu_base +
     489                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
     490
    490491    *buffer = icu_address[proc_id * ICU_SPAN + ICU_IT_VECTOR];
    491492#endif
    492493    return 0;
    493494}
    494 
    495495
    496496////////////////////////////////////////////////////////////////////////////////
     
    912912// The (virtual) base address of the associated segment is:
    913913//
    914 //       dma_address = seg_dma_base + cluster_id * GIET_CLUSTER_INCREMENT
    915 //
    916 // - seg_dma_base  must be defined in the giet_vsegs.ld file
    917 // - GIET_CLUSTER_INCREMENT  must be defined in the giet_config.h file
     914//       dma_address = seg_dma_base + cluster_id * vseg_cluster_increment
     915//
    918916////////////////////////////////////////////////////////////////////////////////
    919917
     
    942940
    943941    // compute DMA base address
    944     unsigned int * dma_address = (unsigned int *) ((char *) &seg_dma_base +
    945                                                    (cluster_id * GIET_CLUSTER_INCREMENT));
     942    unsigned int * dma_address = (unsigned int *) ((unsigned int)&seg_dma_base +
     943                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
    946944
    947945    dma_address[channel_id * DMA_SPAN + DMA_RESET] = 0;           
     
    951949#endif
    952950}
    953 
    954951
    955952//////////////////////////////////////////////////////////////////////////////////
     
    966963
    967964    // compute DMA base address
    968     unsigned int * dma_address = (unsigned int *) ((char *) &seg_dma_base +
    969                                                    (cluster_id * GIET_CLUSTER_INCREMENT));
     965    unsigned int * dma_address = (unsigned int *) ((unsigned int)&seg_dma_base +
     966                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
    970967
    971968    *status = dma_address[channel_id * DMA_SPAN + DMA_LEN];
     
    975972#endif
    976973}
    977 
    978974
    979975//////////////////////////////////////////////////////////////////////////////////
     
    10311027    unsigned int cluster_id  = dma_id / NB_DMA_CHANNELS;
    10321028    unsigned int channel_id  = dma_id % NB_DMA_CHANNELS;
    1033     unsigned int * dma_vbase  = (unsigned int *) ((char *) &seg_dma_base +
    1034                                                 (cluster_id * GIET_CLUSTER_INCREMENT));
     1029    unsigned int * dma_vbase = (unsigned int *) ((unsigned int)&seg_dma_base +
     1030                               (cluster_id * (unsigned int)&vseg_cluster_increment));
    10351031    // get page table address
    10361032    unsigned int user_ptab = _get_context_slot(CTX_PTAB_ID);
     
    11961192}  // end _dma_transfer() 
    11971193
    1198 
    11991194//////////////////////////////////////////////////////////////////////////////////
    12001195// _dma_completed()
     
    12571252//     VciFrameBuffer driver
    12581253//////////////////////////////////////////////////////////////////////////////////
    1259 // The vci_frame_buffer device can be accessed directly by software with memcpy(),
    1260 // or it can be accessed through a multi-channels DMA component:
     1254// There three methods to access the VciFrameBuffer device:
    12611255// 
    1262 // The '_fb_sync_write' and '_fb_sync_read' functions use a memcpy strategy to
    1263 // implement the transfer between a data buffer (user space) and the frame
     1256// 1) The _fb_sync_write() and _fb_sync_read() functions use a memcpy strategy
     1257// to implement the transfer between a data buffer (user space) and the frame
    12641258// buffer (kernel space). They are blocking until completion of the transfer.
    12651259//
    1266 // The '_fb_write()', '_fb_read()' and '_fb_completed()' functions use the
    1267 // VciMultiDma components (distributed in the clusters) to transfer data
    1268 // between the user buffer and the frame buffer. A DMA channel is
    1269 // allocated to each task requesting it in the mapping_info data structure.
     1260// 2) The _fb_dma_write(), _fb_dma_read() and _fb_mdma_completed() functions use
     1261// the VciMultiDma components (distributed in the clusters) to transfer data
     1262// between the user buffer and the frame buffer.
     1263// A DMA channel is allocated to the task requesting it in the mapping_info,
     1264// and stored in the task context.
     1265//
     1266// 3) The _fb_cma_init(), _fb_cma_write() and _fb_cma_stop() functions use
     1267// the VciChbufDma component (non replicated) to transfer a flow of images from
     1268// an user space chained buffer (two buffers) to the frame buffer.
     1269// A CMA channel is allocated to the task requesting it in the mapping_info,
     1270// and stored in the task context.
    12701271//////////////////////////////////////////////////////////////////////////////////
    12711272
     
    13061307
    13071308//////////////////////////////////////////////////////////////////////////////////
    1308 // _fb_write()
     1309// _fb_dma_write()
    13091310// Transfer data from a memory buffer to the frame_buffer device using  DMA.
    13101311// - offset : offset (in bytes) in the frame buffer.
     
    13131314// Returns 0 if success, > 0 if error.
    13141315//////////////////////////////////////////////////////////////////////////////////
    1315 unsigned int _fb_write( unsigned int   offset,
    1316                         const void*    buffer,
    1317                         unsigned int   length)
     1316unsigned int _fb_dma_write( unsigned int   offset,
     1317                            const void*    buffer,
     1318                            unsigned int   length)
    13181319{
    13191320    return _dma_transfer( 0,             // frame buffer
     
    13231324                          length );
    13241325}
    1325 
    1326 
    1327 //////////////////////////////////////////////////////////////////////////////////
    1328 // _fb_read()
     1326//////////////////////////////////////////////////////////////////////////////////
     1327// _fb_dma_read()
    13291328// Transfer data from the frame_buffer device to a memory buffer using  DMA.
    13301329// - offset : offset (in bytes) in the frame buffer.
    1331 // - buffer : base address of the memory buffer.
    1332 // - length : number of bytes to be transfered.
     1330// - buffer : virtual base address of the user buffer.
     1331// - length : buffer size (number of bytes)
    13331332// Returns 0 if success, > 0 if error.
    13341333//////////////////////////////////////////////////////////////////////////////////
    1335 unsigned int _fb_read( unsigned int   offset,
    1336                        const void*    buffer,
    1337                        unsigned int   length )
     1334unsigned int _fb_dma_read( unsigned int   offset,
     1335                           const void*    buffer,
     1336                           unsigned int   length )
    13381337{
    13391338    return _dma_transfer( 0,    // frame buffer
     
    13431342                          length );
    13441343}
    1345 
    1346 
    13471344//////////////////////////////////////////////////////////////////////////////////
    13481345// _fb_completed()
     
    13521349// (1 == read error / 2 == DMA idle error / 3 == write error)
    13531350//////////////////////////////////////////////////////////////////////////////////
    1354 unsigned int _fb_completed()
     1351unsigned int _fb_dma_completed()
    13551352{
    13561353    return _dma_completed();
    13571354}
    13581355
     1356// This structure contains two chbuf descriptors that can be used by
     1357// the VciChbufDma component to tranfer a flow of images:
     1358// - The SRC chbuf descriptor contain two slots (two user buffers)
     1359// - The DST chbuf descriptor contains only one slot (frame buffer)
     1360typedef struct fb_cma_channel_s
     1361{
     1362    paddr_t buf0;   // physical address + status for user buffer 0
     1363    paddr_t buf1;   // physical address + status for user buffer 1
     1364    paddr_t fbf;    // physical address + status for frame buffer
     1365} fb_cma_channel_t;
     1366
     1367in_unckdata volatile fb_cma_channel_t _fb_cma_channel[NB_CMA_CHANNELS];
     1368
     1369//////////////////////////////////////////////////////////////////////////////////
     1370// _fb_cma_init()
     1371// This function does two things:
     1372// 1) Initialises the SRC chbuf descriptor (two buffers), and the DST
     1373//    chbuf descriptor (one single frame buffer), after translating 
     1374//    virtual addresses to physical addresses, and checking access rights.
     1375// 2) Starts the CMA hardware channel, that will permanently try to display
     1376//    images as soon as the SRC buffers are filled.
     1377// Arguments are:
     1378// - vbase0 : virtual base address of the first user buffer.
     1379// - vbase1 : virtual base address of the second user buffer.
     1380// - length : user buffer size (number of bytes)
     1381// Returns 0 if success, > 0 if error
     1382//////////////////////////////////////////////////////////////////////////////////
     1383unsigned int _fb_cma_init( const void*  vbase0,
     1384                           const void*  vbase1,
     1385                           unsigned int length )
     1386{
     1387#if NB_CMA_CHANNELS > 0
     1388
     1389    unsigned int  channel_id;       // CMA channel index
     1390    unsigned int  user_ptab;        // page table virtual address
     1391    unsigned int  ko;               // unsuccessfull V2P translation
     1392    unsigned int  vpn;              // virtual page number
     1393    unsigned int  flags;            // protection flags
     1394    unsigned int  ppn;              // physical page number
     1395    paddr_t       src_chbuf_pbase;  // physical address for SRC chbuf descriptor
     1396    paddr_t       dst_chbuf_pbase;  // physical address for SRC chbuf descriptor
     1397
     1398    // get CMA channel index
     1399    channel_id = _get_context_slot(CTX_CMA_ID);
     1400    if ( channel_id >= NB_CMA_CHANNELS )
     1401    {
     1402        _get_lock(&_tty_put_lock);
     1403        _puts("\n[GIET ERROR] in _fb_cma_init() : CMA channel index too large\n");
     1404        _release_lock(&_tty_put_lock);
     1405        return 1;
     1406    }
     1407
     1408    // check user buffer virtual addresses and length alignment
     1409    if ( ((unsigned int)vbase0 & 0x3) || ((unsigned int)vbase1 & 0x3) || (length & 0x3) )
     1410    {
     1411        _get_lock(&_tty_put_lock);
     1412        _puts("\n[GIET ERROR] in _fb_cma_init() : user buffer not word aligned\n");
     1413        _release_lock(&_tty_put_lock);
     1414        return 1;
     1415    }
     1416
     1417    // get page table virtual address
     1418    user_ptab = _get_context_slot(CTX_PTAB_ID);
     1419
     1420    // get frame buffer virtual address
     1421
     1422    // compute and register frame buffer physical address
     1423    vpn = ((unsigned int)&seg_fbf_base) >> 12;
     1424    ko = _v2p_translate( (page_table_t*) user_ptab,
     1425                         vpn,
     1426                         &ppn,
     1427                         &flags );
     1428    if (ko)
     1429    {
     1430        _get_lock(&_tty_put_lock);
     1431        _puts("\n[GIET ERROR] in _fb_cma_init() : frame buffer unmapped\n");
     1432        _release_lock(&_tty_put_lock);
     1433        return 1;
     1434    }
     1435    _fb_cma_channel[channel_id].fbf = ((paddr_t)ppn << 12) | (vpn & 0x00000FFF);
     1436
     1437    // Compute and register first user buffer physical address
     1438    vpn = (unsigned int)vbase0 >> 12;
     1439    ko = _v2p_translate( (page_table_t*) user_ptab,
     1440                         vpn,
     1441                         &ppn,
     1442                         &flags );
     1443    if (ko)
     1444    {
     1445        _get_lock(&_tty_put_lock);
     1446        _puts("\n[GIET ERROR] in _fb_cma_init() : user buffer 0 unmapped\n");
     1447        _release_lock(&_tty_put_lock);
     1448        return 1;
     1449    }
     1450    if ((flags & PTE_U) == 0)
     1451    {
     1452        _get_lock(&_tty_put_lock);
     1453        _puts("[GIET ERROR] in _fb_cma_init() : user buffer 0 not in user space\n");
     1454        _release_lock(&_tty_put_lock);
     1455        return 1;
     1456    }
     1457    _fb_cma_channel[channel_id].buf0 = ((paddr_t)ppn << 12) | (vpn & 0x00000FFF);
     1458
     1459    // Compute and register second user buffer physical address
     1460    vpn = (unsigned int)vbase1 >> 12;
     1461    ko = _v2p_translate( (page_table_t*) user_ptab,
     1462                         vpn,
     1463                         &ppn,
     1464                         &flags );
     1465    if (ko)
     1466    {
     1467        _get_lock(&_tty_put_lock);
     1468        _puts("\n[GIET ERROR] in _fb_cma_init() : user buffer 1 unmapped\n");
     1469        _release_lock(&_tty_put_lock);
     1470        return 1;
     1471    }
     1472    if ((flags & PTE_U) == 0)
     1473    {
     1474        _get_lock(&_tty_put_lock);
     1475        _puts("[GIET ERROR] in _fb_cma_init() : user buffer 1 not in user space\n");
     1476        _release_lock(&_tty_put_lock);
     1477        return 1;
     1478    }
     1479    _fb_cma_channel[channel_id].buf1 = ((paddr_t)ppn << 12) | (vpn & 0x00000FFF);
     1480
     1481    // Compute physical adress of the SRC chbuf descriptor
     1482    vpn = ((unsigned int)(&_fb_cma_channel[channel_id].buf0)) >> 12;
     1483    ko = _v2p_translate( (page_table_t*) user_ptab,
     1484                         vpn,
     1485                         &ppn,
     1486                         &flags );
     1487    if (ko)
     1488    {
     1489        _get_lock(&_tty_put_lock);
     1490        _puts("\n[GIET ERROR] in _fb_cma_init() : SRC chbuf descriptor unmapped\n");
     1491        _release_lock(&_tty_put_lock);
     1492        return 1;
     1493    }
     1494    src_chbuf_pbase = (((paddr_t)ppn) << 12) | (vpn & 0x00000FFF);
     1495
     1496    // Compute physical adress of the DST chbuf descriptor
     1497    vpn = ((unsigned int)(&_fb_cma_channel[channel_id].fbf)) >> 12;
     1498    ko = _v2p_translate( (page_table_t*) user_ptab,
     1499                         vpn,
     1500                         &ppn,
     1501                         &flags );
     1502    if (ko)
     1503    {
     1504        _get_lock(&_tty_put_lock);
     1505        _puts("\n[GIET ERROR] in _fb_cma_init() : DST chbuf descriptor unmapped\n");
     1506        _release_lock(&_tty_put_lock);
     1507        return 1;
     1508    }
     1509    dst_chbuf_pbase = (((paddr_t)ppn) << 12) | (vpn & 0x00000FFF);
     1510
     1511    // CMA channel activation
     1512    unsigned int* cma_vbase = (unsigned int *)&seg_cma_base;
     1513    unsigned int  offset     = channel_id * CHBUF_CHANNEL_SPAN;
     1514
     1515    cma_vbase[offset + CHBUF_SRC_DESC]  = (unsigned int)(src_chbuf_pbase & 0xFFFFFFFF);
     1516    cma_vbase[offset + CHBUF_SRC_EXT]   = (unsigned int)(src_chbuf_pbase >> 32);
     1517    cma_vbase[offset + CHBUF_SRC_NBUFS] = 2;
     1518    cma_vbase[offset + CHBUF_DST_DESC]  = (unsigned int)(dst_chbuf_pbase & 0xFFFFFFFF);
     1519    cma_vbase[offset + CHBUF_DST_EXT]   = (unsigned int)(dst_chbuf_pbase >> 32);
     1520    cma_vbase[offset + CHBUF_DST_NBUFS] = 1;
     1521    cma_vbase[offset + CHBUF_BUF_SIZE]  = length;
     1522    cma_vbase[offset + CHBUF_PERIOD]    = 300;
     1523    cma_vbase[offset + CHBUF_RUN]       = 1;
     1524
     1525    return 0;
     1526
     1527#else
     1528
     1529    _get_lock(&_tty_put_lock);
     1530    _puts("\n[GIET ERROR] in _fb_cma_init() : no CMA channel allocated\n");
     1531    _release_lock(&_tty_put_lock);
     1532
     1533    return 1;
     1534#endif
     1535}
     1536//////////////////////////////////////////////////////////////////////////////////
     1537// _fb_cma_write()
     1538// This function updates the status of the SRC and DST chbuf descriptors
     1539// to allows the CMA component to transfer another buffer.
     1540// - buffer_id : user buffer index (0 => buf0 / not 0 => buf1)
     1541// Returns 0 if success, > 0 if error
     1542//////////////////////////////////////////////////////////////////////////////////
     1543unsigned int _fb_cma_write( unsigned int buffer_id )
     1544{
     1545#if NB_CMA_CHANNELS > 0
     1546
     1547    // get CMA channel index
     1548    unsigned int channel_id = _get_context_slot(CTX_CMA_ID);
     1549    if ( channel_id >= NB_CMA_CHANNELS )
     1550    {
     1551        _get_lock(&_tty_put_lock);
     1552        _puts("\n[GIET ERROR] in _fb_cma_write() : CMA channel index too large\n");
     1553        _release_lock(&_tty_put_lock);
     1554        return 1;
     1555    }
     1556    // set SRC full
     1557    if ( buffer_id == 0 )
     1558    _fb_cma_channel[channel_id].buf0 = _fb_cma_channel[channel_id].buf0
     1559                                       | 0x8000000000000000ULL;
     1560    else
     1561    _fb_cma_channel[channel_id].buf1 = _fb_cma_channel[channel_id].buf1
     1562                                       | 0x8000000000000000ULL;
     1563    // set DST empty
     1564    _fb_cma_channel[channel_id].fbf  = _fb_cma_channel[channel_id].fbf
     1565                                       & 0x7FFFFFFFFFFFFFFFULL;
     1566    return 0;
     1567
     1568#else
     1569
     1570    _get_lock(&_tty_put_lock);
     1571    _puts("\n[GIET ERROR] in _fb_cma_channel() : no CMA channel allocated\n");
     1572    _release_lock(&_tty_put_lock);
     1573    return 1;
     1574
     1575#endif
     1576}
     1577//////////////////////////////////////////////////////////////////////////////////
     1578// _fb_cma_stop()
     1579// This function desactivates the CMA channel allocated to the calling task.
     1580// Returns 0 if success, > 0 if error
     1581//////////////////////////////////////////////////////////////////////////////////
     1582unsigned int _fb_cma_stop( unsigned int buffer_id )
     1583{
     1584#if NB_CMA_CHANNELS > 0
     1585
     1586    // get CMA channel allocated
     1587    unsigned int channel_id = _get_context_slot(CTX_CMA_ID);
     1588    if ( channel_id >= NB_CMA_CHANNELS )
     1589    {
     1590        _get_lock(&_tty_put_lock);
     1591        _puts("\n[GIET ERROR] in _fb_cma_stop() : CMA channel index too large\n");
     1592        _release_lock(&_tty_put_lock);
     1593        return 1;
     1594    }
     1595    // CMA channel desactivation
     1596    unsigned int* cma_vbase = (unsigned int *)&seg_cma_base;
     1597    unsigned int  offset     = channel_id * CHBUF_CHANNEL_SPAN;
     1598    cma_vbase[offset + CHBUF_RUN] = 0;
     1599    return 0;
     1600
     1601#else
     1602
     1603    _get_lock(&_tty_put_lock);
     1604    _puts("\n[GIET ERROR] in _fb_cma_stop() : no CMA channel allocated\n");
     1605    _release_lock(&_tty_put_lock);
     1606    return 1;
     1607
     1608#endif
     1609}
     1610   
    13591611//////////////////////////////////////////////////////////////////////////////////
    13601612//     VciMultiNic driver
    13611613//////////////////////////////////////////////////////////////////////////////////
    13621614// The VciMultiNic device can be accessed directly by software with memcpy(),
    1363 // or it can be accessed through a multi-channels DMA component:
     1615// or it can be accessed through a multi-channels CMA component:
    13641616// 
    13651617// The '_nic_sync_write' and '_nic_sync_read' functions use a memcpy strategy to
     
    13671619// buffer (kernel space). They are blocking until completion of the transfer.
    13681620//
    1369 // The '_nic_write()', '_nic_read()' and '_nic_completed()' functions use the
    1370 // VciMultiDma components (distributed in the clusters) to transfer data
    1371 // between the user buffer and the NIC. A  NIDMA channel is allocated to each
    1372 // task requesting it in the mapping_info data structure.
     1621// The _nic_cma_init() and _nic_cma_stop() functions use the VciChbufDma component
     1622// to transfer a flow of packets from the NIC RX hard chbuf (two containers)
     1623// to an user RX chbuf (two containers), and to transfer another flow of packets
     1624// from an user TX chbuf (two containers) to the NIC TX chbuf (two containers).
     1625// One NIC channel and two CMA channels must be allocated to the task
     1626// in the mapping_info data structure.
    13731627//////////////////////////////////////////////////////////////////////////////////
    13741628
     
    13761630// _nic_sync_write()
    13771631// Transfer data from an memory buffer to the NIC device using a memcpy.
    1378 // - offset : offset (in bytes) in the frame buffer.
    13791632// - buffer : base address of the memory buffer.
    13801633// - length : number of bytes to be transfered.
    13811634//////////////////////////////////////////////////////////////////////////////////
    1382 unsigned int _nic_sync_write( unsigned int   offset,
    1383                               const void*    buffer,
     1635unsigned int _nic_sync_write( const void*    buffer,
    13841636                              unsigned int   length )
    13851637{
    1386     unsigned char* nic_address = (unsigned char *) &seg_nic_base + offset;
    1387     memcpy((void *) nic_address, (void *) buffer, length);
    1388     return 0;
    1389 }
    1390 
    1391 
     1638    // To be defined
     1639    // unsigned char* nic_address = (unsigned char *) &seg_nic_base;
     1640    // memcpy((void *) nic_address, (void *) buffer, length);
     1641    return 0;
     1642}
    13921643//////////////////////////////////////////////////////////////////////////////////
    13931644// _nic_sync_read()
    13941645// Transfer data from the NIC device to a memory buffer using a memcpy.
    1395 // - offset : offset (in bytes) in the frame buffer.
    13961646// - buffer : base address of the memory buffer.
    13971647// - length : number of bytes to be transfered.
    13981648//////////////////////////////////////////////////////////////////////////////////
    1399 unsigned int _nic_sync_read(unsigned int offset, const void * buffer, unsigned int length) {
    1400     unsigned char *nic_address = (unsigned char *) &seg_nic_base + offset;
    1401     memcpy((void *) buffer, (void *) nic_address, length);
    1402     return 0;
    1403 }
    1404 
    1405 
    1406 //////////////////////////////////////////////////////////////////////////////////
    1407 // _nic_write()
    1408 // Transfer data from a memory buffer to the NIC device using  DMA.
    1409 // - offset : offset (in bytes) in the frame buffer.
    1410 // - buffer : base address of the memory buffer.
    1411 // - length : number of bytes to be transfered.
     1649unsigned int _nic_sync_read( const void*    buffer,
     1650                             unsigned int   length )
     1651{
     1652    // To be defined
     1653    // unsigned char* nic_address = (unsigned char *) &seg_nic_base;
     1654    // memcpy((void *) buffer, (void *) nic_address, length);
     1655    return 0;
     1656}
     1657//////////////////////////////////////////////////////////////////////////////////
     1658// _nic_cma_rx_init()
    14121659// Returns 0 if success, > 0 if error.
    14131660//////////////////////////////////////////////////////////////////////////////////
    1414 unsigned int _nic_write(unsigned int offset, const void * buffer, unsigned int length) {
    1415     return _dma_transfer(
    1416             1,            // NIC
    1417             0,            // write
    1418             offset,
    1419             (unsigned int) buffer,
    1420             length );   
    1421 }
    1422 
    1423 
    1424 //////////////////////////////////////////////////////////////////////////////////
    1425 // _nic_read()
    1426 // Transfer data from the NIC device to a memory buffer using  DMA.
    1427 // - offset : offset (in bytes) in the frame buffer.
    1428 // - buffer : base address of the memory buffer.
    1429 // - length : number of bytes to be transfered.
     1661unsigned int _nic_cma_rx_init( const void*  buf0,
     1662                               const void*  buf1,
     1663                               unsigned int length )
     1664{
     1665    // to be defined
     1666    // unsigned char* nic_address = (unsigned char *) &seg_nic_base;
     1667    return 0;
     1668}
     1669//////////////////////////////////////////////////////////////////////////////////
     1670// _nic_cma_tx_init()
    14301671// Returns 0 if success, > 0 if error.
    14311672//////////////////////////////////////////////////////////////////////////////////
    1432 unsigned int _nic_read(unsigned int offset, const void * buffer, unsigned int length) {
    1433     return _dma_transfer(
    1434             1,            // NIC
    1435             1,            // read
    1436             offset,
    1437             (unsigned int) buffer,
    1438             length );   
    1439 }
    1440 
    1441 
    1442 //////////////////////////////////////////////////////////////////////////////////
    1443 // _nic_completed()
    1444 // This function checks completion of a DMA transfer to or fom a NIC channel.
    1445 // As it is a blocking call, the processor is busy waiting.
    1446 // Returns 0 if success, > 0 if error
    1447 // (1 == read error / 2 == DMA idle error / 3 == write error)
    1448 //////////////////////////////////////////////////////////////////////////////////
    1449 unsigned int _nic_completed()
    1450 {
    1451     return _dma_completed();
    1452 }
     1673unsigned int _nic_cma_tx_init( const void*  buf0,
     1674                               const void*  buf1,
     1675                               unsigned int length )
     1676{
     1677    // to be defined
     1678    // unsigned char* nic_address = (unsigned char *) &seg_nic_base;
     1679    return 0;
     1680}//////////////////////////////////////////////////////////////////////////////////
     1681// _nic_cma_stop()
     1682// Returns 0 if success, > 0 if error.
     1683//////////////////////////////////////////////////////////////////////////////////
     1684unsigned int _nic_cma_stop()
     1685{
     1686    // to be defined
     1687    // unsigned char* nic_address = (unsigned char *) &seg_nic_base;
     1688    return 0;
     1689}
     1690
    14531691
    14541692//////////////////////////////////////////////////////////////////////////////////
     
    14581696// as a set of uncached, memory mapped registers.
    14591697///////////////////////////////////////////////////////////////////////////////////
     1698// The (virtual) base address of the associated segment is:
     1699//
     1700//       mmc_address = seg_mmc_base + cluster_id * vseg_cluster_increment
     1701//
     1702////////////////////////////////////////////////////////////////////////////////
    14601703
    14611704///////////////////////////////////////////////////////////////////////////////////
     
    14701713    unsigned int cluster_id    = (unsigned int)((buf_paddr>>32)/(256/NB_CLUSTERS));
    14711714
    1472     unsigned int * mmc_address = (unsigned int *) ((char *) &seg_mmc_base +
    1473                                                    (cluster_id * GIET_CLUSTER_INCREMENT));
     1715    unsigned int * mmc_address = (unsigned int *) ((unsigned int)&seg_mmc_base +
     1716                                 (cluster_id * (unsigned int)&vseg_cluster_increment));
    14741717
    14751718    // get the lock protecting exclusive access to MEMC
     
    14851728    mmc_address[MEMC_LOCK] = 0;
    14861729}
     1730
    14871731///////////////////////////////////////////////////////////////////////////////////
    14881732// _heap_info()
  • soft/giet_vm/sys/drivers.h

    r249 r253  
    6262
    6363///////////////////////////////////////////////////////////////////////////////////
    64 // Multi DMA variables            (vci_multi_dma)
     64// Multi DMA variables and access functions  (vci_multi_dma)
    6565///////////////////////////////////////////////////////////////////////////////////
    6666
     
    7474unsigned int _dma_get_status(unsigned int cluster_id, unsigned int local_id, unsigned int * status);
    7575
    76 unsigned int _dma_transfer(
    77         unsigned int dev_type,
    78         unsigned int to_user,
    79         unsigned int offset,
    80         unsigned int user_vaddr,
    81         unsigned int length);
     76unsigned int _dma_transfer( unsigned int dev_type,
     77                            unsigned int to_user,
     78                            unsigned int offset,
     79                            unsigned int user_vaddr,
     80                            unsigned int length );
    8281
    8382unsigned int _dma_completed();
     
    8786///////////////////////////////////////////////////////////////////////////////////
    8887
    89 unsigned int _fb_sync_write(unsigned int offset, const void * buffer, unsigned int length);
    90 unsigned int _fb_sync_read( unsigned int offset, const void * buffer, unsigned int length);
    91 unsigned int _fb_write(     unsigned int offset, const void * buffer, unsigned int length);
    92 unsigned int _fb_read(      unsigned int offset, const void * buffer, unsigned int length);
     88unsigned int _fb_sync_write( unsigned int offset,
     89                             const void * buffer,
     90                             unsigned int length);
     91unsigned int _fb_sync_read(  unsigned int offset,
     92                             const void * buffer,
     93                             unsigned int length);
    9394
    94 unsigned int _fb_completed();
     95unsigned int _fb_dma_write(  unsigned int offset,
     96                             const void * buffer,
     97                             unsigned int length);
     98unsigned int _fb_dma_read(   unsigned int offset,
     99                             const void * buffer,
     100                             unsigned int length);
     101unsigned int _fb_dma_completed();
     102
     103unsigned int _fb_cma_init( const void*  vbase0,
     104                           const void*  vbase1,
     105                           unsigned int length );
     106unsigned int _fb_cma_write( unsigned int buffer_id );
     107unsigned int _fb_cma_stop();
    95108
    96109///////////////////////////////////////////////////////////////////////////////////
     
    98111///////////////////////////////////////////////////////////////////////////////////
    99112
    100 unsigned int _nic_sync_write(unsigned int offset, const void * buffer, unsigned int length);
    101 unsigned int _nic_sync_read( unsigned int offset, const void * buffer, unsigned int length);
    102 unsigned int _nic_write(     unsigned int offset, const void * buffer, unsigned int length);
    103 unsigned int _nic_read(      unsigned int offset, const void * buffer, unsigned int length);
     113unsigned int _nic_sync_write( const void*  buffer,
     114                              unsigned int length);
     115unsigned int _nic_sync_read(  const void*  buffer,
     116                              unsigned int length);
    104117
    105 unsigned int _nic_completed();
     118unsigned int _nic_cma_rx_init( const void*  buf0,
     119                               const void*  buf1,
     120                               unsigned int length );
     121unsigned int _nic_cma_tx_init( const void*  buf0,
     122                               const void*  buf1,
     123                               unsigned int length );
     124unsigned int _nic_cma_stop();
    106125
    107126///////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/sys/hwr_mapping.h

    r252 r253  
    4949    DMA_END         = 7,
    5050    DMA_SPAN        = 8,
     51};
     52
     53/* CMA */
     54enum CMA_registers
     55{
     56    CHBUF_RUN           = 0,    // write-only : channel activated
     57    CHBUF_STATUS        = 1,    // read-only  : channel fsm state
     58    CHBUF_SRC_DESC      = 2,    // read/write : source chbuf : descriptor base address
     59    CHBUF_DST_DESC      = 3,    // read/write : destination chbuf : descriptor base address,
     60    CHBUF_SRC_NBUFS     = 4,    // read/write : source chbuf : number of buffers,
     61    CHBUF_DST_NBUFS     = 5,    // read/write : destination chbuf : number of buffers,
     62    CHBUF_BUF_SIZE      = 6,    // read/write : buffer size for both source & destination 
     63    CHBUF_PERIOD        = 7,    // read/write : period for status polling
     64    CHBUF_SRC_EXT       = 8,    // read/write : source chbuf : descriptor base address
     65    CHBUF_DST_EXT       = 9,    // read/write : destination chbuf : descriptor base address,
     66    /****/
     67    CHBUF_CHANNEL_SPAN  = 1024,
    5168};
    5269
  • soft/giet_vm/sys/sys_handler.c

    r238 r253  
    2121//    Initialize the syscall vector with syscall handlers
    2222////////////////////////////////////////////////////////////////////////////
    23 const void * _syscall_vector[32] = {
     23const void * _syscall_vector[32] =
     24{
    2425    &_procid,              /* 0x00 */
    2526    &_proctime,            /* 0x01 */
     
    3334    &_local_task_id,       /* 0x09 */
    3435    &_global_task_id,      /* 0x0A */
    35     &_sys_ukn,             /* 0x0B */
    36     &_sys_ukn,             /* 0x0C */
    37     &_context_switch,      /* 0x0D */
     36    &_fb_cma_init,         /* 0x0B */
     37    &_fb_cma_write,        /* 0x0C */
     38    &_fb_cma_stop,         /* 0x0D */
    3839    &_exit,                /* 0x0E */
    3940    &_procs_number,        /* 0x0F */
    4041    &_fb_sync_write,       /* 0x10 */
    4142    &_fb_sync_read,        /* 0x11 */
    42     &_fb_write,            /* 0x12 */
    43     &_fb_read,             /* 0x13 */
    44     &_fb_completed,        /* 0x14 */
     43    &_fb_dma_write,        /* 0x12 */
     44    &_fb_dma_read,         /* 0x13 */
     45    &_fb_dma_completed,    /* 0x14 */
    4546    &_ioc_write,           /* 0x15 */
    4647    &_ioc_read,            /* 0x16 */
    4748    &_ioc_completed,       /* 0x17 */
    4849    &_ioc_get_block_size,  /* 0x18 */
    49     &_sys_ukn,             /* 0x19 */
     50    &_ctx_switch,          /* 0x19 */
    5051    &_vobj_get_vbase,      /* 0x1A */
    51     &_nic_write,           /* 0x1B */
    52     &_nic_read,            /* 0x1C */
    53     &_nic_completed,       /* 0x1D */
    54     &_sys_ukn,             /* 0x1E */
    55     &_sys_ukn,             /* 0x1F */
     52    &_nic_cma_rx_init,     /* 0x1B */
     53    &_nic_cma_tx_init,     /* 0x1C */
     54    &_nic_cma_stop,        /* 0x1D */
     55    &_nic_sync_read,       /* 0x1E */
     56    &_nic_sync_write,      /* 0x1F */
    5657};
    5758
  • soft/giet_vm/xml/mapping_info.h

    r249 r253  
    55// Copyright (c) UPMC-LIP6
    66////////////////////////////////////////////////////////////////////////////
    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
     7// The MAPPING_INFO data structure, used by the GIET_VM kernel contains:
     8//
     9// 1) a description of a clusterized hardware architecture.
     10// The number of cluster is variable (can be one). The number of processors
     11// per cluster is variable (can be one). The number of peripherals per cluser
     12// and coprocessor per cluster is variable. The number of physical memory
     13// banks per cluster is variable.
     14//
     15// 2/ a description of the applications (called vspaces) to be - statically -
     16// launched on the platform. The number of parallel tasks per application is
     17// variable (can be one). Multi-Writer/Multi-Reader communication channels
     18// betwwen tasks are supported. Each vspace contains a variable number
     19// of virtual segments (called vsegs).
     20//
     21// 3/ the mapping directives: both tasks on processors, and software objects
     22// (vobjs and vsegs) on the physical memory banks (called psegs).
    1023// and a variable number of tasks. The number of virtual space can be one.
    1124//
    12 // The mapping table data structure is organised as the concatenation of
    13 // a fixed size header, and 6 variable size arrays:
     25// The mapping_info data structure is organised as the concatenation of
     26// a fixed size header, and 11 variable size arrays:
    1427//
    1528// - mapping_cluster_t  cluster[] 
     
    1932// - mapping_vseg_t     vobj[]   
    2033// - mapping_task_t     task[] 
    21 // - mapping_irq_t      irq[irqs]   
     34// - mapping_proc_t     proc[] 
     35// - mapping_irq_t      irq[]   
    2236// - mapping_coproc_t   coproc[]
    2337// - mapping_cp_port_t  cp_port[]
    2438// - mapping_periph_t   periph[]
    2539//
    26 // It is intended to be stored in the boot ROM at address MAPPING_BOOT_BASE.
     40// It is intended to be stored in memory at address MAPPING_BOOT_BASE.
    2741////////////////////////////////////////////////////////////////////////////
    2842
     
    7589};
    7690
     91// The enum definitions for psegType and periphType must be kept
     92// consistent with the definitions in the xml_driver.c file...
    7793
    7894enum periphType
     
    8298    PERIPH_TYPE_DMA       = 2,
    8399    PERIPH_TYPE_MMC       = 3,
    84 
    85100    PERIPH_TYPE_CMA       = 4,
    86101    PERIPH_TYPE_IOC       = 5,
     
    90105    PERIPH_TYPE_IOB       = 9,
    91106    PERIPH_TYPE_GCD       = 10,
    92 
    93     PERIPH_TYPE_MAX_VALUE = 11,
     107    PERIPH_TYPE_XCU       = 11,
     108
     109    PERIPH_TYPE_MAX_VALUE = 12,
    94110};
    95111
     
    112128    unsigned int globals;            // number of vsegs mapped in all vspaces
    113129    unsigned int vspaces;            // number of virtual spaces
     130    unsigned int increment;          // vseg cluster increment for replicated periphs
    114131
    115132    unsigned int tty_cluster;        // index of cluster containing TTY controler
     
    270287typedef struct __attribute__((packed))  mapping_periph_s
    271288{
    272     unsigned int type;           // IOC / TTY / TIM / DMA / FBF / NIC / IOB
     289    unsigned int type;         
    273290    unsigned int psegid;         // pseg index in cluster
    274291    unsigned int channels;       // number of channels
  • soft/giet_vm/xml/xml_driver.c

    r238 r253  
    6161        "ICU",
    6262        "TIM",
    63         "XICU",
    6463        "DMA",
     64        "MMC",
     65        "CMA",
    6566        "IOC",
    6667        "TTY",
     
    6869        "NIC",
    6970        "IOB",
     71        "GCD",
     72        "XCU",
    7073    };
    7174
  • soft/giet_vm/xml/xml_parser.c

    r249 r253  
    66///////////////////////////////////////////////////////////////////////////////////////
    77// This program translate a "map.xml" source file to a binary file "map.bin" that
    8 // can be directly loaded in the boot ROM and used by the GIET-VM operating system.
     8// can be directly loaded in memory and used by the GIET-VM operating system.
    99//
    1010// This map.xml file contains :
     
    1414// The corresponding C structures are defined in the "mapping_info.h" file.
    1515//
    16 // This program also generates the "hard_config.h" and the "giet_vsegs.ld" files,
     16// This parser also generates the "hard_config.h" and the "giet_vsegs.ld" files,
    1717// required  to compile the GIET-VM code.
    1818///////////////////////////////////////////////////////////////////////////////////////
     
    100100char found_timer = 0;
    101101char found_icu   = 0;
     102char found_xcu   = 0;
    102103char found_dma   = 0;
    103104char found_mmc   = 0;
     
    122123
    123124unsigned int use_iob          = 0; // using IOB component
    124 unsigned int use_xicu         = 0; // using XICU (not ICU)
     125unsigned int use_xcu          = 0; // using XCU (not ICU)
    125126
    126127
     
    130131
    131132unsigned int periph_vbase_array[PERIPH_TYPE_MAX_VALUE]
    132          = { [0 ... (PERIPH_TYPE_MAX_VALUE - 1)] = 0xFFFFFFFF };
     133         = { [0 ... (PERIPH_TYPE_MAX_VALUE - 1)] = 0xFFF00000 };
    133134
    134135//////////////////////////////////////////////////////////////////////
     
    278279} // end getStringValue()
    279280
    280 ///////////////////////////////////////////////////////
    281 void set_periph_vbase_array( unsigned int vseg_index )
    282 {
    283     unsigned int vbase  = vseg[vseg_index]->vbase;  // peripheral vbase address
    284     unsigned int psegid = vseg[vseg_index]->psegid; // pseg global index
    285     unsigned int type;                              // peripheral type
    286     unsigned int periph_id;
    287 
    288     for ( periph_id = 0 ; periph_id < header->periphs ; periph_id++)
    289     {
    290         if( periph[periph_id]->psegid == psegid )
    291         {
    292             type = periph[periph_id]->type;
    293             if ( periph_vbase_array[type] == 0xFFFFFFFF )
    294                  periph_vbase_array[type] = vbase;   
    295         }
     281///////////////////////////////////////////////////////////////////////////////////
     282// This function set the vbase address for all peripheral types.
     283// For replicated peripherals with the same type the virtual base address must be:
     284//   vbase = seg_type_base & 0XFFF00000 +
     285//          (cluster_id * vbase_cluster_increment) & 0x000FFFFF
     286void set_periph_vbase_array()
     287{
     288    unsigned int vseg_id;      // vseg global index
     289    unsigned int periph_id;    // periph global index
     290    unsigned int pseg_id;      // pseg global index
     291    unsigned int cluster_id;   // cluster global index
     292    unsigned int type;         // peripheral type
     293
     294    unsigned int msb_mask = 0xFFF00000;
     295    unsigned int lsb_mask = 0x000FFFFF;
     296
     297    // We are looking for any vseg matching a peripheral
     298    // (i.e. they are associated to the same pseg)
     299
     300    // scan all vsegs
     301    for (vseg_id = 0 ; vseg_id < header->vsegs ; vseg_id++)
     302    {
     303        // keep only vseg corresponding to a periph       
     304        if ( vobj[vseg[vseg_id]->vobj_offset]->type == VOBJ_TYPE_PERI )
     305        {
     306            pseg_id = vseg[vseg_id]->psegid;
     307            cluster_id = pseg[pseg_id]->cluster;
     308
     309            // scan all periphs
     310            for ( periph_id = 0 ; periph_id < header->periphs ; periph_id++)
     311            {
     312                if( periph[periph_id]->psegid == pseg_id ) // matching !!!
     313                {
     314                    type = periph[periph_id]->type;
     315                    if ( periph_vbase_array[type] == 0xFFF00000 )  // vbase not set
     316                    {
     317                        periph_vbase_array[type] = vseg[vseg_id]->vbase;   
     318                    }
     319                    else                                 // vbase already set
     320                    {
     321                        // checking 12 MSB bits for replicated peripherals
     322                        if( (vseg[vseg_id]->vbase & msb_mask) !=
     323                            (periph_vbase_array[type] & msb_mask) )
     324                        {
     325                            printf("[XML ERROR] All peripherals with same type ");
     326                            printf(" should share the same 12 MSB for vbase address\n");
     327                            printf("periph index = %d / periph type = %d / vbase = %x\n",
     328                                    periph_id, type, vseg[vseg_id]->vbase);
     329                            exit(1);
     330                        }
     331                        // checking 20 LSB bits for replicated peripherals
     332                        if( (vseg[vseg_id]->vbase & lsb_mask) !=
     333                            (header->increment * cluster_id) )
     334                        {
     335                            printf("[XML ERROR] All peripherals with same type ");
     336                            printf(" must have the 20 LSB bits = cluster_id * increment");
     337                            printf("periph index = %d / periph type = %d / vbase = %x\n",
     338                                    periph_id, type, vseg[vseg_id]->vbase);
     339                            exit(1);
     340                        }
     341                    }
     342                }
     343            }
     344        }   
    296345    }
    297346}  // end set_periph_vbase_array()
     
    336385    unsigned int vobj_max = vobj_min + vspace_max;
    337386
    338     for (vobj_id = vobj_min; vobj_id < vobj_max; vobj_id++) {
    339         if (strcmp(vobj[vobj_id]->name, vobj_name) == 0) {
    340             return (vobj_id - vobj_min);
    341         }
     387    for (vobj_id = vobj_min; vobj_id < vobj_max; vobj_id++)
     388    {
     389        if (strcmp(vobj[vobj_id]->name, vobj_name) == 0) return (vobj_id - vobj_min);
    342390    }
    343391    return -1;
    344392}
    345393
    346 
    347 /////////////////////////////////////////
     394//////////////////////////////////////
    348395void taskNode(xmlTextReaderPtr reader)
    349396{
     
    352399    char * str;
    353400
    354     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { return; }
     401    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    355402
    356403    if (task_index >= MAX_TASKS)
    357404    {
    358405        printf("[XML ERROR] The number of tasks is larger than %d\n", MAX_TASKS);
     406        exit(1);
    359407    }
    360408
     
    540588} // end taskNode()
    541589
    542 
    543590//////////////////////////////////////
    544591void vobjNode(xmlTextReaderPtr reader)
     
    548595    char * str;
    549596
    550     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { return; }
     597    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    551598
    552599    if (vobj_index >= MAX_VOBJS)
     
    583630printf("        type = %s\n", str);
    584631#endif
    585     if (ok && (strcmp(str, "ELF") == 0))
    586     {
    587         vobj[vobj_index]->type = VOBJ_TYPE_ELF;
    588 
    589         assert( (vobj_count == 0) && "[XML ERROR] an ELF vobj must be alone in a vseg");
    590     }
    591     else if (ok && (strcmp(str, "PERI")     == 0))
    592     {
    593         vobj[vobj_index]->type = VOBJ_TYPE_PERI;     
    594 
    595         assert( (vobj_count == 0) && "[XML ERROR] a PERI vobj must be alone in a vseg");
    596 
    597         // fill the peripheral base address array
    598         set_periph_vbase_array( vseg_index );
    599     }
     632
     633    if      (ok && (strcmp(str, "ELF")      == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_ELF;      }
     634    else if (ok && (strcmp(str, "PERI")     == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_PERI;     }
    600635    else if (ok && (strcmp(str, "BLOB")     == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_BLOB;     }
    601636    else if (ok && (strcmp(str, "PTAB")     == 0)) { vobj[vobj_index]->type = VOBJ_TYPE_PTAB;     }
     
    613648        exit(1);
    614649    }
     650    // some more checking
     651    if ( (vobj[vobj_index]->type == VOBJ_TYPE_ELF) ||
     652         (vobj[vobj_index]->type == VOBJ_TYPE_PERI) )
     653    {
     654        assert( (vobj_count == 0) &&
     655        "[XML ERROR] an ELF or PERI vobj must be alone in a vseg");
     656    }
     657       
    615658
    616659    ////////// get length attribute
     
    680723} // end vobjNode()
    681724
    682 
    683725//////////////////////////////////////
    684726void vsegNode(xmlTextReaderPtr reader)
     
    690732    vobj_count = 0;
    691733
    692     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { return; }
     734    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    693735
    694736    if (vseg_index >= MAX_VSEGS)
     
    833875            return;
    834876        }
    835         else {
     877        else
     878        {
    836879            printf("[XML ERROR] Unknown tag %s", tag);
    837880            exit(1);
     
    841884} // end vsegNode()
    842885
    843 
    844 //////////////////////////////////////////
    845 void vspaceNode(xmlTextReaderPtr reader) {
     886////////////////////////////////////////
     887void vspaceNode(xmlTextReaderPtr reader)
     888{
    846889    char * str;
    847890    unsigned int ok;
     
    852895    task_loc_index = 0;
    853896
    854     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
    855         return;
    856     }
     897    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    857898
    858899    // checking source file consistency
     
    877918        strncpy(vspace[vspace_index]->name, str, 31);
    878919    }
    879     else {
     920    else
     921    {
    880922        printf("[XML ERROR] illegal or missing <name> attribute for vspace %d\n",
    881923                vspace_index);
     
    899941        //used after parsing the vobjs
    900942    }
    901     else {
     943    else
     944    {
    902945        printf("[XML ERROR] illegal or missing <startname> attribute for vspace %s\n",
    903946                vspace[vspace_index]->name);
     
    925968            // get index of the vobj containing the start vector
    926969            int index = getVobjLocId(vspace_index, str , vobj_loc_index);
    927             if (index == -1) {
     970            if (index == -1)
     971            {
    928972                printf("[XML ERROR] vobj containing start vector not found in vspace %s\n",
    929973                        vspace[vspace_index]->name);
    930                 exit(-1);
    931             }
    932             else {
     974                exit(1);
     975            }
     976            else
     977            {
    933978                vspace[vspace_index]->start_offset = index;
    934979#if XML_PARSER_DEBUG
     
    944989            int task_max = task_min + vspace[vspace_index]->tasks;
    945990            for (task_id = task_min; task_id < task_max; task_id++) {
    946                 if (task[task_id]->startid >= vspace[vspace_index]->tasks) {
     991                if (task[task_id]->startid >= vspace[vspace_index]->tasks)
     992                {
    947993                    printf("[XML ERROR] <startid> too large for task (%d,%d)\n",
    948994                            vspace_index, task_id );
     
    9551001            return;
    9561002        }
    957         else {
     1003        else
     1004        {
    9581005            printf("[XML ERROR] Unknown tag %s", tag);
    9591006            exit(1);
     
    9631010} // end vspaceNode()
    9641011
    965 
    966 ///////////////////////////////////////////
    967 void cpPortNode(xmlTextReaderPtr reader) {
     1012////////////////////////////////////////
     1013void cpPortNode(xmlTextReaderPtr reader)
     1014{
    9681015    char * str;
    9691016    unsigned int ok;
    9701017
    971     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
    972         return;
    973     }
    974 
    975     if (cp_port_index >= MAX_CP_PORTS) {
    976         printf("[XML ERROR] The number of ports (for coprocs) is larger than %d\n", MAX_CP_PORTS);
     1018    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
     1019
     1020    if (cp_port_index >= MAX_CP_PORTS)
     1021    {
     1022        printf("[XML ERROR] The number of ports (for coprocs) is larger than %d\n",
     1023                 MAX_CP_PORTS);
     1024        exit(1);
    9771025    }
    9781026
     
    9841032    cp_port_vobj_ref[cp_port_index] = (vobj_ref_t *) malloc(sizeof(vobj_ref_t));
    9851033
    986 
    987 
    9881034    ///////// get direction attribute
    9891035    str = getStringValue(reader, "direction", &ok);
    990     if (ok) {
     1036    if (ok)
     1037    {
    9911038#if XML_PARSER_DEBUG
    9921039        printf("      direction = %s\n", str);
    9931040#endif
    994         if (strcmp(str, "TO_COPROC")   ==  0) {
     1041        if (strcmp(str, "TO_COPROC")   ==  0)
     1042        {
    9951043            cp_port[cp_port_index]->direction = PORT_TO_COPROC;
    9961044        }
    997         else if (strcmp(str, "FROM_COPROC") ==  0) {
     1045        else if (strcmp(str, "FROM_COPROC") ==  0)
     1046        {
    9981047            cp_port[cp_port_index]->direction = PORT_FROM_COPROC;
    9991048        }
    1000         else {
     1049        else
     1050        {
    10011051            printf("[XML ERROR] illegal <direction> for cp_port %d in cluster %d\n",
    10021052                    cp_port_index, cluster_index);
     
    10041054        }
    10051055    } 
    1006     else {
     1056    else
     1057    {
    10071058        printf("[XML ERROR] missing <direction> for cp_port %d in cluster %d\n",
    10081059                cp_port_index, cluster_index);
     
    10151066    printf("      vspacename = %s\n", str);
    10161067#endif
    1017     if (ok) {
     1068    if (ok)
     1069    {
    10181070        strncpy(cp_port_vobj_ref[cp_port_index]->vspace_name, str, 31);
    10191071    }
    1020     else {
     1072    else
     1073    {
    10211074        printf("[XML ERROR] missing <vspacename> for cp_port %d in cluster %d\n",
    10221075                cp_port_index, cluster_index);
     
    10291082    printf("      vobjname = %s\n", str);
    10301083#endif
    1031     if (ok) {
     1084    if (ok)
     1085    {
    10321086        strncpy(cp_port_vobj_ref[cp_port_index]->vobj_name, str, 31);
    10331087    }
    1034     else {
     1088    else
     1089    {
    10351090        printf("[XML ERROR] missing <vobjname> for cp_port %d in cluster %d\n",
    10361091                cp_port_index, cluster_index);
    10371092        exit(1);
    10381093    }
    1039 
    10401094    cp_port_index++;
    10411095    cp_port_loc_index++;
    1042 
    10431096} // end cpPortNode()
    1044 
    10451097
    10461098////////////////////////////////////////
     
    10511103    unsigned int ok;
    10521104
    1053     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { return; }
     1105    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    10541106
    10551107    if (periph_index >= MAX_PERIPHS)
    10561108    {
    10571109        printf("[XML ERROR] The number of periphs is larger than %d\n", MAX_PERIPHS);
     1110        exit(1);
    10581111    }
    10591112
     
    11941247                cma_channels = periph[periph_index]->channels;
    11951248            }
    1196             else if (header->nic_cluster_bis == 0xFFFFFFFF)
     1249            else if (header->cma_cluster_bis == 0xFFFFFFFF)
    11971250            {
    11981251                header->cma_cluster_bis = cluster_index;
     
    12211274        }
    12221275        // The TIM, ICU, XICU, DMA, MEMC peripherals are replicated in all clusters
    1223         // but only one component per cluster
     1276        // but it must exist only one component of each type per cluster
    12241277        else if (strcmp(str, "TIM") == 0 )
    12251278        {
    12261279            periph[periph_index]->type = PERIPH_TYPE_TIM;
    1227             if (found_timer || use_xicu)  error = 1;
     1280            if (found_timer || use_xcu)  error = 1;
    12281281            found_timer = 1;
    12291282            if (tim_channels < periph[periph_index]->channels)
     
    12351288        {
    12361289            periph[periph_index]->type = PERIPH_TYPE_ICU;
    1237             if (found_icu)  error = 1;
     1290            if (found_icu || use_xcu)  error = 1;
    12381291            found_icu = 1;
    12391292        }
    1240         else if (strcmp(str, "XICU") == 0)
    1241         {
    1242             periph[periph_index]->type = PERIPH_TYPE_ICU;
     1293        else if (strcmp(str, "XCU") == 0)
     1294        {
     1295            periph[periph_index]->type = PERIPH_TYPE_XCU;
    12431296            if (found_icu || found_timer)  error = 1;
    1244             found_icu = 1;
    1245             if (tim_channels == 0)
    1246             {
    1247                 tim_channels = 32;
    1248             }
    1249             use_xicu = 1;
     1297            found_xcu    = 1;
     1298            found_timer  = 1;
     1299            tim_channels = 32;
     1300            use_xcu      = 1;
    12501301        }
    12511302        else if (strcmp(str, "DMA") == 0)
     
    12911342} // end periphNode
    12921343
    1293 
    1294 /////////////////////////////////////////
    1295 void coprocNode(xmlTextReaderPtr reader) {
     1344////////////////////////////////////////
     1345void coprocNode(xmlTextReaderPtr reader)
     1346{
    12961347    char * str;
    12971348    unsigned int ok;
     
    12991350    cp_port_loc_index = 0;
    13001351
    1301     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
    1302         return;
    1303     }
    1304 
    1305     if (coproc_index >= MAX_COPROCS) {
     1352    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
     1353
     1354    if (coproc_index >= MAX_COPROCS)
     1355    {
    13061356        printf("[XML ERROR] The number of coprocs is larger than %d\n", MAX_COPROCS);
     1357        exit(1);
    13071358    }
    13081359
     
    13151366    /////////// get name attribute
    13161367    str = getStringValue(reader, "name", &ok);
    1317     if (ok) {
     1368    if (ok)
     1369    {
    13181370#if XML_PARSER_DEBUG
    13191371        printf("      name = %s\n", str);
     
    13211373        strncpy(coproc[coproc_index]->name, str, 31);
    13221374    }
    1323     else {
     1375    else
     1376    {
    13241377        printf("[XML ERROR] illegal or missing <name> for coproc %d in cluster %d\n",
    13251378                coproc_index, cluster_index);
     
    13291382    /////////// get psegname attribute
    13301383    str = getStringValue(reader, "psegname", &ok);
    1331     if (ok == 0) {
     1384    if (ok == 0)
     1385    {
    13321386        printf("[XML ERROR] illegal or missing <psegname> for coproc %d in cluster %d\n",
    13331387                coproc_index, cluster_index);
     
    13371391    /////////// set psegid attribute
    13381392    int index = getPsegId(cluster_index, str);
    1339     if (index >= 0) {
     1393    if (index >= 0)
     1394    {
    13401395#if XML_PARSER_DEBUG
    13411396        printf("      clusterid = %d\n", cluster_index);
     
    13461401        assert(pseg[index]->type == PSEG_TYPE_PERI && "coproc psegname attribute must refer to a pseg of type PERI" );
    13471402    }
    1348     else {
     1403    else
     1404    {
    13491405        printf("[XML ERROR] pseg not found for coproc %d / clusterid = %d / psegname = %s\n",
    13501406                coproc_index, cluster_index, str );
     
    13601416
    13611417    int status = xmlTextReaderRead(reader);
    1362     while (status == 1) {
     1418    while (status == 1)
     1419    {
    13631420        const char * tag = (const char *) xmlTextReaderConstName(reader);
    13641421
    1365         if (strcmp(tag, "port") == 0 ) {
     1422        if (strcmp(tag, "port") == 0 )
     1423        {
    13661424            cpPortNode(reader);
    13671425        }
    13681426        else if (strcmp(tag, "#text")    == 0 ) { }
    13691427        else if (strcmp(tag, "#comment") == 0 ) { }
    1370         else if (strcmp(tag, "coproc") == 0 ) {
     1428        else if (strcmp(tag, "coproc") == 0 )
     1429        {
    13711430            coproc[coproc_index]->ports = cp_port_loc_index;
    13721431            cluster[cluster_index]->coprocs++;
     
    13751434            return;
    13761435        }
    1377         else {
     1436        else
     1437        {
    13781438            printf("[XML ERROR] Unknown tag %s", tag);
    13791439            exit(1);
     
    13841444
    13851445
    1386 ///////////////////////////////////////
    1387 void irqNode(xmlTextReaderPtr reader) {
     1446/////////////////////////////////////
     1447void irqNode(xmlTextReaderPtr reader)
     1448{
    13881449    unsigned int ok;
    13891450    unsigned int value;
    13901451    char * str;
    13911452
    1392     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
    1393         return;
    1394     }
     1453    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    13951454
    13961455    if (irq_index >= MAX_IRQS) {
     
    14061465    ///////// get type attribute
    14071466    str = getStringValue(reader, "type", &ok);
    1408     if (ok) {
     1467    if (ok)
     1468    {
    14091469#if XML_PARSER_DEBUG
    14101470        printf("        type    = %s\n", str);
    14111471#endif
    1412         if (strcmp(str, "HARD") == 0 ) {
    1413             irq[irq_index]->type = 0;
    1414         }
    1415         else {
    1416             irq[irq_index]->type = 1;
    1417         }
    1418     }
    1419     else {
     1472        if (strcmp(str, "HARD") == 0 ) irq[irq_index]->type = 0;
     1473        else                           irq[irq_index]->type = 1;
     1474    }
     1475    else
     1476    {
    14201477        printf("[XML ERROR] missing IRQ <type> for processor %d in cluster %d\n",
    14211478                cluster_index, proc_loc_index);
     
    14251482    ///////// get icuid attribute
    14261483    value = getIntValue(reader, "icuid", &ok);
    1427     if (ok) {
     1484    if (ok)
     1485    {
    14281486#if XML_PARSER_DEBUG
    14291487        printf("        icuid   = %d\n", value);
    14301488#endif
    14311489        irq[irq_index]->icuid = value;
    1432         if (value >= 32) {
     1490        if (value >= 32)
     1491        {
    14331492            printf("[XML ERROR] IRQ <icuid> too large for processor %d in cluster %d\n",
    14341493                    cluster_index, proc_loc_index);
     
    14361495        }
    14371496    }
    1438     else {
     1497    else
     1498    {
    14391499        printf("[XML ERROR] missing IRQ <icuid> for processor %d in cluster %d\n",
    14401500                cluster_index, proc_loc_index);
     
    14441504    ///////// get isr attribute
    14451505    str = getStringValue(reader, "isr", &ok);
    1446     if (ok) {
     1506    if (ok)
     1507    {
    14471508#if XML_PARSER_DEBUG
    14481509        printf("        isr     = %s\n", str);
     
    14531514        else if (strcmp(str, "ISR_TTY"    ) == 0) { irq[irq_index]->isr = ISR_TTY; }
    14541515        else if (strcmp(str, "ISR_TIMER"  ) == 0) { irq[irq_index]->isr = ISR_TIMER; }
    1455         else {
     1516        else
     1517        {
    14561518            printf("[XML ERROR] illegal IRQ <isr> for processor %d in cluster %d\n",
    14571519                    cluster_index, proc_loc_index);
     
    14621524#endif
    14631525    } 
    1464     else {
     1526    else
     1527    {
    14651528        printf("[XML ERROR] missing IRQ <isr> for processor %d in cluster %d\n",
    14661529                cluster_index, proc_loc_index);
     
    14701533    ///////// get channel attribute (optionnal : 0 if missing)
    14711534    value = getIntValue(reader, "channel", &ok);
    1472     if (ok) {
     1535    if (ok)
     1536    {
    14731537#if XML_PARSER_DEBUG
    14741538        printf("        channel = %d\n", value);
     
    14761540        irq[irq_index]->channel = value;
    14771541    }
    1478     else {
     1542    else
     1543    {
    14791544        irq[irq_index]->channel = 0;
    14801545    }
     
    14861551
    14871552
    1488 /////////////////////////////////////////
    1489 void procNode(xmlTextReaderPtr reader) {
     1553//////////////////////////////////////
     1554void procNode(xmlTextReaderPtr reader)
     1555{
    14901556    unsigned int ok;
    14911557    unsigned int value;
     
    14931559    irq_loc_index = 0;
    14941560
    1495     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
    1496         return;
    1497     }
    1498 
    1499     if (proc_index >= MAX_PROCS) {
     1561    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
     1562
     1563    if (proc_index >= MAX_PROCS)
     1564    {
    15001565        printf("[XML ERROR] The number of procs is larger than %d\n", MAX_PROCS);
     1566        exit(1);
    15011567    }
    15021568
     
    15061572
    15071573    proc[proc_index] = (mapping_proc_t *) malloc(sizeof(mapping_proc_t));
    1508 
    15091574
    15101575    /////////// get index attribute (optional)
    15111576    value = getIntValue(reader, "index", &ok);
    1512     if (ok && (value != proc_loc_index)) {
     1577    if (ok && (value != proc_loc_index))
     1578    {
    15131579        printf("[XML ERROR] wrong proc index / expected value is %d",
    15141580                proc_loc_index);
     
    15241590
    15251591    int status = xmlTextReaderRead(reader);
    1526     while (status == 1) {
     1592    while (status == 1)
     1593    {
    15271594        const char * tag = (const char *) xmlTextReaderConstName(reader);
    15281595
    1529         if (strcmp(tag, "irq") == 0) {
     1596        if (strcmp(tag, "irq") == 0)
     1597        {
    15301598            irqNode(reader);
    15311599        }
    15321600        else if (strcmp(tag, "#text")    == 0) { }
    15331601        else if (strcmp(tag, "#comment") == 0) { }
    1534         else if (strcmp(tag, "proc")     == 0) {
     1602        else if (strcmp(tag, "proc")     == 0)
     1603        {
    15351604            proc[proc_index]->irqs = irq_loc_index;
    15361605            cluster[cluster_index]->procs++;
     
    15391608            return;
    15401609        }
    1541         else {
     1610        else
     1611        {
    15421612            printf("[XML ERROR] Unknown tag %s", tag);
    15431613            exit(1);
     
    15481618
    15491619
    1550 //////////////////////////////////////////
    1551 void psegNode(xmlTextReaderPtr reader) {
     1620//////////////////////////////////////
     1621void psegNode(xmlTextReaderPtr reader)
     1622{
    15521623    unsigned int ok;
    15531624    paddr_t      ll_value;
    15541625    char * str;
    15551626
    1556     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
    1557         return;
    1558     }
    1559 
    1560     if (pseg_index >= MAX_PSEGS) {
     1627    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
     1628
     1629    if (pseg_index >= MAX_PSEGS)
     1630    {
    15611631        printf("[XML ERROR] The number of psegs is larger than %d\n", MAX_PSEGS);
    15621632        exit(1);
     
    15741644    printf("      name = %s\n", str);
    15751645#endif
    1576     if (ok) {
     1646    if (ok)
     1647    {
    15771648        strncpy(pseg[pseg_index]->name, str, 31);
    15781649    }
    1579     else {
     1650    else
     1651    {
    15801652        printf("[XML ERROR] illegal or missing <name> for pseg %d in cluster %d\n",
    15811653                pseg_index, cluster_index);
     
    15911663    else if (ok && (strcmp(str, "ROM" ) == 0)) { pseg[pseg_index]->type = PSEG_TYPE_ROM; }
    15921664    else if (ok && (strcmp(str, "PERI") == 0)) { pseg[pseg_index]->type = PSEG_TYPE_PERI; }
    1593     else {
     1665    else
     1666    {
    15941667        printf("[XML ERROR] illegal or missing <type> for pseg %s in cluster %d\n",
    15951668                pseg[pseg_index]->name, cluster_index);
     
    16021675    printf("      base = 0x%llx\n", ll_value);
    16031676#endif
    1604     if (ok) {
     1677    if (ok)
     1678    {
    16051679        pseg[pseg_index]->base = ll_value;
    16061680    }
     
    16161690    printf("      length = 0x%llx\n", ll_value);
    16171691#endif
    1618     if (ok) {
     1692    if (ok)
     1693    {
    16191694        pseg[pseg_index]->length = ll_value;
    16201695    } 
    1621     else {
     1696    else
     1697    {
    16221698        printf("[XML ERROR] illegal or missing <length> for pseg %s in cluster %d\n",
    16231699                pseg[pseg_index]->name, cluster_index);
     
    16591735    found_timer = 0;
    16601736    found_icu   = 0;
     1737    found_xcu   = 0;
    16611738    found_dma   = 0;
    16621739    found_mmc   = 0;
     
    16671744
    16681745    // checking source file consistency
    1669     if (cluster_index >= header->clusters) {
     1746    if (cluster_index >= header->clusters)
     1747    {
    16701748        printf("[XML ERROR] The cluster index is too large : %d\n", cluster_index);
    16711749        exit(1);
     
    16791757    /////////// check cluster index attribute (optional)
    16801758    value = getIntValue(reader, "index", &ok);
    1681     if (ok && (value != cluster_index)) {
     1759    if (ok && (value != cluster_index))
     1760    {
    16821761        printf("[XML ERROR] wrong cluster index / expected value is %d",
    16831762                cluster_index);
     
    17141793        {
    17151794
    1716             ////////////////// peripherals checks /////////////////////////
    1717             if ((found_timer  && use_xicu) || (!found_timer  && !use_xicu))
    1718             {
    1719                 printf("[XML ERROR] illegal or missing timer peripheral in cluster %d\n", cluster_index);
     1795            ///////// TIMER and ICU peripheral are mandatory //////////////
     1796            if (!found_timer && !found_xcu)
     1797            {
     1798                printf("[XML ERROR] missing timer peripheral in cluster %d\n", cluster_index);
    17201799                exit(1);
    17211800            }
    17221801
    1723             if (!found_icu)
    1724             {
    1725                 printf("[XML ERROR] illegal or missing icu peripheral in cluster %d\n", cluster_index);
     1802            if (!found_icu && !found_xcu)
     1803            {
     1804                printf("[XML ERROR] missing icu peripheral in cluster %d\n", cluster_index);
    17261805                exit(1);
    17271806            }
    1728 
    1729             if (!found_dma)
    1730             {
    1731                 printf("[XML ERROR] illegal or missing dma peripheral in cluster %d\n", cluster_index);
    1732                 exit(1);
    1733             }
    1734 
    17351807
    17361808            if (nb_proc_max < cluster[cluster_index]->procs)
     
    17571829void clusterSetNode(xmlTextReaderPtr reader)
    17581830{
    1759     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { return; }
     1831    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    17601832
    17611833#if XML_PARSER_DEBUG
     
    17981870            return;
    17991871        }
    1800         else {
     1872        else
     1873        {
    18011874            printf("[XML ERROR] Unknown tag in clusterset node : %s",tag);
    18021875            exit(1);
     
    18071880
    18081881
    1809 /////////////////////////////////////////////
    1810 void globalSetNode(xmlTextReaderPtr reader) {
    1811     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
    1812         return;
    1813     }
     1882///////////////////////////////////////////
     1883void globalSetNode(xmlTextReaderPtr reader)
     1884{
     1885    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    18141886
    18151887#if XML_PARSER_DEBUG
     
    18251897        else if (strcmp(tag, "#text")     == 0) { }
    18261898        else if (strcmp(tag, "#comment")  == 0) { }
    1827         else if (strcmp(tag, "globalset") == 0) {
     1899        else if (strcmp(tag, "globalset") == 0)
     1900        {
    18281901#if XML_PARSER_DEBUG
    18291902            printf("  end global set\n\n");
     
    18331906            return;
    18341907        }
    1835         else {
     1908        else
     1909        {
    18361910            printf("[XML ERROR] Unknown tag in globalset node : %s",tag);
    18371911            exit(1);
     
    18421916
    18431917
    1844 /////////////////////////////////////////////
    1845 void vspaceSetNode(xmlTextReaderPtr reader) {
     1918///////////////////////////////////////////
     1919void vspaceSetNode(xmlTextReaderPtr reader)
     1920{
    18461921    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
    18471922        return;
     
    18611936        else if (strcmp(tag, "#text"    ) == 0 ) { }
    18621937        else if (strcmp(tag, "#comment" ) == 0 ) { }
    1863         else if (strcmp(tag, "vspaceset") == 0 ) {
     1938        else if (strcmp(tag, "vspaceset") == 0 )
     1939        {
    18641940            // checking source file consistency
    1865             if (vspace_index != header->vspaces) {
     1941            if (vspace_index != header->vspaces)
     1942            {
    18661943                printf("[XML ERROR] Wrong number of vspaces\n");
    18671944                exit(1);
    18681945            }
    1869             else {
     1946            else
     1947            {
    18701948                header->vsegs = vseg_index;
    18711949                header->vobjs = vobj_index;
     
    18741952            }
    18751953        }
    1876         else {
     1954        else
     1955        {
    18771956            printf("[XML ERROR] Unknown tag in vspaceset node : %s",tag);
    18781957            exit(1);
     
    18831962
    18841963
    1885 //////////////////////////////////////////
     1964////////////////////////////////////////
    18861965void headerNode(xmlTextReaderPtr reader)
    18871966{
     
    18901969    unsigned int ok;
    18911970
    1892     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) { return; }
     1971    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    18931972
    18941973#if XML_PARSER_DEBUG
     
    19001979    ////////// get name attribute
    19011980    name = getStringValue(reader, "name", &ok);
    1902     if (ok) {
     1981    if (ok)
     1982    {
    19031983#if XML_PARSER_DEBUG
    19041984        printf("  name = %s\n", name);
     
    19061986        strncpy( header->name, name, 31);
    19071987    }
    1908     else {
     1988    else
     1989    {
    19091990        printf("[XML ERROR] illegal or missing <name> attribute in header\n");
    19101991        exit(1);
     
    19131994    /////////// get cluster_x attribute
    19141995    cluster_x = getIntValue(reader, "cluster_x", &ok);
    1915     if (ok) {
     1996    if (ok)
     1997    {
    19161998#if XML_PARSER_DEBUG
    19171999        printf("  cluster_x = %d\n", cluster_x);
     
    19192001        header->cluster_x = cluster_x;
    19202002    }
    1921     else {
     2003    else
     2004    {
    19222005        printf("[XML ERROR] illegal or missing <cluster_x> attribute in header\n");
    19232006        exit(1);
     
    19262009    /////////// get cluster_y attribute
    19272010    cluster_y = getIntValue(reader, "cluster_y", &ok);
    1928     if (ok) {
     2011    if (ok)
     2012    {
    19292013#if XML_PARSER_DEBUG
    19302014        printf("  cluster_y = %d\n", cluster_y);
     
    19322016        header->cluster_y = cluster_y;
    19332017    }
    1934     else {
     2018    else
     2019    {
    19352020        printf("[XML ERROR] illegal or missing <cluster_y> attribute in header\n");
    19362021        exit(1);
     
    19392024    //check the number of cluster
    19402025    value = cluster_x * cluster_y;
    1941     if (value >= MAX_CLUSTERS) {
     2026    if (value >= MAX_CLUSTERS)
     2027    {
    19422028        printf("[XML ERROR] The number of clusters is larger than %d\n", MAX_CLUSTERS);
    19432029        exit(1);
     
    19522038    ///////// get vspaces attribute
    19532039    value = getIntValue(reader, "vspaces", &ok);
    1954     if (ok) {
    1955         if (value >= MAX_VSPACES) {
     2040    if (ok)
     2041    {
     2042        if (value >= MAX_VSPACES)
     2043        {
    19562044            printf("[XML ERROR] The number of vspaces is larger than %d\n", MAX_VSPACES);
    19572045            exit(1);
     
    19622050        header->vspaces  = value;
    19632051    }
    1964     else {
     2052    else
     2053    {
    19652054        printf("[XML ERROR] illegal or missing <vspaces> attribute in mapping\n");
     2055        exit(1);
     2056    }
     2057
     2058    ///////// get increment attribute
     2059    value = getIntValue(reader, "increment", &ok);
     2060    if (ok)
     2061    {
     2062        if ( (value != 0x10000) && (value != 0x8000) &&
     2063             (value != 0x4000)  && (value != 0x2000) )
     2064       
     2065        {
     2066            printf("[XML ERROR] The vseg increment must be one of the following: ");
     2067            printf(" 0x00010000 / 0x00008000 / 0x00004000 / 0x00002000");
     2068            exit(1);
     2069        }
     2070#if XML_PARSER_DEBUG
     2071        printf("  increment = %d\n", value);
     2072#endif
     2073        header->increment  = value;
     2074    }
     2075    else
     2076    {
     2077        printf("[XML ERROR] illegal or missing <increment> attribute in mapping\n");
    19662078        exit(1);
    19672079    }
     
    19852097
    19862098    int status = xmlTextReaderRead(reader);
    1987     while (status == 1) {
     2099    while (status == 1)
     2100    {
    19882101        const char * tag = (const char *) xmlTextReaderConstName(reader);
    19892102
    1990         if (strcmp(tag, "clusterset") == 0) {
     2103        if (strcmp(tag, "clusterset") == 0)
     2104        {
    19912105            clusterSetNode(reader);
    19922106        }
     
    19952109        else if (strcmp(tag, "#text")        == 0) { }
    19962110        else if (strcmp(tag, "#comment")     == 0) { }
    1997         else if (strcmp(tag, "mapping_info") == 0) {
     2111        else if (strcmp(tag, "mapping_info") == 0)
     2112        {
    19982113#if XML_PARSER_DEBUG
    19992114            printf("end mapping_info\n");
     
    20012116            return;
    20022117        }
    2003         else {
     2118        else
     2119        {
    20042120            printf("[XML ERROR] Unknown tag in header node : %s\n",tag);
    20052121            exit(1);
     
    20122128///////////////////////////////////////
    20132129void BuildTable(int fdout, const char * type, unsigned int nb_elem,
    2014                 unsigned int elem_size, char ** table) {
     2130                unsigned int elem_size, char ** table)
     2131{
    20152132    unsigned int i;
    20162133    // write element
     
    20272144}
    20282145
    2029 
    2030 int open_file(const char * file_path) {
    2031 
     2146/////////////////////////////////////
     2147int open_file(const char * file_path)
     2148{
    20322149    //open file
    20332150    int fdout = open( file_path, (O_CREAT | O_RDWR), (S_IWUSR | S_IRUSR) );
    2034     if (fdout < 0) {
     2151    if (fdout < 0)
     2152    {
    20352153        perror("open");
    20362154        exit(1);
     
    20382156
    20392157    //reinitialise the file
    2040     if (ftruncate(fdout, 0)) {
     2158    if (ftruncate(fdout, 0))
     2159    {
    20412160        perror("truncate");
    20422161        exit(1);
     
    20512170
    20522171
    2053 ///////////////////////////
    2054 void buildBin(const char * file_path) {
     2172/////////////////////////////////////
     2173void buildBin(const char * file_path)
     2174{
    20552175    unsigned int length;
    20562176
    20572177    int fdout = open_file(file_path);
     2178
     2179#if XML_PARSER_DEBUG
     2180printf("Building map.bin for %s\n", header->name);
     2181printf("signature = %x\n", header->signature);
     2182printf("clusters  = %d\n", header->clusters);
     2183printf("vspaces   = %d\n", header->vspaces);
     2184printf("psegs     = %d\n", header->psegs);
     2185printf("vobjs     = %d\n", header->vobjs);
     2186printf("vsegs     = %d\n", header->vsegs);
     2187printf("tasks     = %d\n", header->tasks);
     2188printf("procs     = %d\n", header->procs);
     2189printf("irqs      = %d\n", header->irqs);
     2190printf("coprocs   = %d\n", header->coprocs);
     2191printf("periphs   = %d\n", header->periphs);
     2192#endif
    20582193
    20592194    // write header to binary file
    20602195    length = write(fdout, (char *) header, sizeof(mapping_header_t));
    2061     if (length != sizeof(mapping_header_t)) {
     2196    if (length != sizeof(mapping_header_t))
     2197    {
    20622198        printf("write header error : length = %d \n", length);
    20632199        exit(1);
     
    21602296    int fdout = open_file(file_path);
    21612297
    2162     char * prol   = "/* Generated from the mapping_info file */\n\n";
    2163     char * ifdef  = "#ifndef _HD_CONFIG_H\n#define _HD_CONFIG_H\n\n";
    2164     char * epil   = "\n#endif //_HD_CONFIG_H";
     2298    char prol[80];
     2299    sprintf(prol, "/* Generated from file %s.xml */\n\n",header->name);
     2300
     2301    char * ifdef  = "#ifndef _HARD_CONFIG_H\n#define _HARDD_CONFIG_H\n\n";
     2302    char * epil   = "\n#endif //_HARD_CONFIG_H";
    21652303
    21662304    file_write(fdout, prol);
     
    21872325    file_write(fdout, "\n");
    21882326
    2189     def_int_write(fdout, "USE_XICU          ", use_xicu);
     2327    def_int_write(fdout, "USE_XICU          ", use_xcu);
    21902328    def_int_write(fdout, "USE_IOB           ", use_iob);
    21912329
     
    22102348    unsigned int vseg_id;
    22112349
    2212     char * prol = "/* Generated from the mapping_info file */\n\n";
     2350    char prol[80];
     2351    sprintf(prol, "/* Generated from file %s.xml */\n\n",header->name);
     2352
    22132353    file_write(fdout, prol);
    22142354
     
    22732413    file_write(fdout, "\n");
    22742414
     2415    // fill the peripheral base address array
     2416    set_periph_vbase_array();
     2417
    22752418    // non replicated peripherals
    22762419    ld_write(fdout, "seg_cma_base            ",   periph_vbase_array[PERIPH_TYPE_CMA]);
     
    22852428
    22862429    // replicated peripherals
     2430    ld_write(fdout, "seg_xcu_base            ",   periph_vbase_array[PERIPH_TYPE_XCU]);
    22872431    ld_write(fdout, "seg_icu_base            ",   periph_vbase_array[PERIPH_TYPE_ICU]);
    22882432    ld_write(fdout, "seg_tim_base            ",   periph_vbase_array[PERIPH_TYPE_TIM]);
    22892433    ld_write(fdout, "seg_dma_base            ",   periph_vbase_array[PERIPH_TYPE_DMA]);
    22902434    ld_write(fdout, "seg_mmc_base            ",   periph_vbase_array[PERIPH_TYPE_MMC]);
     2435
     2436    file_write(fdout, "\n");
     2437
     2438    ld_write(fdout, "vseg_cluster_increment  ",   header->increment);
    22912439
    22922440    close(fdout);
     
    23232471    }
    23242472
    2325 
    23262473    char * map_path = buildPath(argv[2], "map.bin");
    23272474    char * ld_path = buildPath(argv[2], "giet_vsegs.ld");
     
    23332480    xmlTextReaderPtr reader = xmlReaderForFile(argv[1], NULL, 0);
    23342481
    2335     if (reader != NULL) {
     2482    if (reader != NULL)
     2483    {
    23362484        status = xmlTextReaderRead (reader);
    2337         while (status == 1) {
     2485        while (status == 1)
     2486        {
    23382487            const char * tag = (const char *) xmlTextReaderConstName(reader);
    23392488
    2340             if (strcmp(tag, "mapping_info") == 0) {
     2489            if (strcmp(tag, "mapping_info") == 0)
     2490            {
    23412491                headerNode(reader);
    23422492                prepareBuild();
     
    23452495                genLd(ld_path);
    23462496            }
    2347             else {
     2497            else
     2498            {
    23482499                printf("[XML ERROR] Wrong file type: \"%s\"\n", argv[1]);
    23492500                return 1;
     
    23532504        xmlFreeTextReader(reader);
    23542505
    2355         if (status != 0) {
     2506        if (status != 0)
     2507        {
    23562508            printf("[XML ERROR] Wrong Syntax in \"%s\" file\n", argv[1]);
    23572509            return 1;
Note: See TracChangeset for help on using the changeset viewer.