Ignore:
Timestamp:
Sep 17, 2012, 10:47:46 AM (12 years ago)
Author:
karaoui
Message:

New components are now mandotory in the XML description:

The files giet_vsegs.ld and hard_config.h are now autogenerated by the xml2bin tool.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sys/drivers.c

    r213 r215  
    1717//
    1818// The following global parameters must be defined in the giet_config.h file:
    19 // - CLUSTER_IO_ID
    2019// - CLUSTER_SIZE
    2120// - NB_CLUSTERS   
     
    4847
    4948#if !defined(NB_CLUSTERS)
    50 # error: You must define NB_CLUSTERS in 'giet_config.h' file
     49# error: You must define NB_CLUSTERS in the configs file
    5150#endif
    5251
    5352#if !defined(NB_PROCS_MAX)
    54 # error: You must define NB_PROCS_MAX in 'giet_config.h' file
     53# error: You must define NB_PROCS_MAX in the configs file
    5554#endif
    5655
     
    6059
    6160#if !defined(CLUSTER_SIZE)
    62 # error: You must define CLUSTER_SIZE in 'giet_config.h' file
     61# error: You must define CLUSTER_SIZE in the configs file
    6362#endif
    6463
    6564#if !defined(NB_TTYS)
    66 # error: You must define NB_TTYS in 'giet_config.h' file
     65# error: You must define NB_TTYS in the configs file
    6766#endif
    6867
     
    8483
    8584#if !defined(NB_IOCS)
    86 # error: You must define NB_IOCS in 'giet_config.h' file
     85# error: You must define NB_IOCS in the configs file
    8786#endif
    8887
    8988#if ( NB_IOCS > 1 )
    9089# error: NB_IOCS cannot be larger than 1
     90#endif
     91
     92#if !defined( USE_XICU )
     93# error: You must define USE_XICU in the configs file
     94#endif
     95
     96#if !defined( IOMMU_ACTIVE )
     97# error: You must define IOMMU_ACTIVE in the configs file
    9198#endif
    9299
     
    98105//////////////////////////////////////////////////////////////////////////////
    99106// The timers can be implemented in a vci_timer component or in a vci_xicu
    100 // component (depending on the GIET_USE_XICU parameter).
     107// component (depending on the USE_XICU parameter).
    101108// There is one timer (or xicu) component per cluster.
    102109// There is two types of timers:
     
    132139    if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1;
    133140
    134 #if GIET_USE_XICU
     141#if USE_XICU
    135142    unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base +
    136143                                  (cluster_id * CLUSTER_SIZE) );
     
    160167    if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1;
    161168
    162 #if GIET_USE_XICU
     169#if USE_XICU
    163170    unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base +
    164171                                  (cluster_id * CLUSTER_SIZE) );
     
    189196    if ( local_id >= NB_TIMERS_MAX + NB_PROCS_MAX ) return 1;
    190197
    191 #if GIET_USE_XICU
     198#if USE_XICU
    192199    unsigned int* timer_address = (unsigned int*)((char*)&seg_icu_base +
    193200                                  (cluster_id * (unsigned)CLUSTER_SIZE) );
     
    260267    }
    261268
    262     unsigned int*       tty_address = (unsigned int*)( (char*)&seg_tty_base +
    263                                   (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     269    unsigned int*       tty_address = (unsigned int*) &seg_tty_base;
    264270
    265271    for (nwritten = 0; nwritten < length; nwritten++)
     
    322328
    323329    // compute terminal base address
    324     unsigned int *tty_address = (unsigned int*)( (char*)&seg_tty_base +
    325                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     330    unsigned int *tty_address = (unsigned int*) &seg_tty_base;
    326331
    327332    *buffer = (unsigned char)tty_address[tty_id*TTY_SPAN + TTY_READ];
     
    355360    unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base +
    356361                                (cluster_id * (unsigned)CLUSTER_SIZE) );
    357 #if GIET_USE_XICU
     362#if USE_XICU
    358363    if ( is_timer ) icu_address[XICU_REG(XICU_MSK_PTI_ENABLE, proc_id)] = value;
    359364    else            icu_address[XICU_REG(XICU_MSK_HWI_ENABLE, proc_id)] = value;
     
    381386    unsigned int* icu_address = (unsigned int*)( (char*)&seg_icu_base +
    382387                                (cluster_id * (unsigned)CLUSTER_SIZE) );
    383 #if GIET_USE_XICU
     388#if USE_XICU
    384389    unsigned int prio   = icu_address[XICU_REG(XICU_PRIO, proc_id)];
    385390    unsigned int pti_ok = (prio & 0x00000001);
     
    420425        return 1;
    421426
    422     unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base +
    423                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     427    unsigned int* gcd_address = (unsigned int*) &seg_gcd_base;
    424428
    425429    gcd_address[register_index] = value; // write word
     
    438442        return 1;
    439443
    440     unsigned int* gcd_address = (unsigned int*)( (char*)&seg_gcd_base +
    441                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     444    unsigned int* gcd_address = (unsigned int*) &seg_gcd_base;
    442445
    443446    *buffer = gcd_address[register_index]; // read word
     
    530533    if ( (unsigned int)user_vaddr & 0x3 ) return 1;
    531534
    532     unsigned int*       ioc_address = (unsigned int*)( (char*)&seg_ioc_base +
    533                                   (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     535    unsigned int*       ioc_address = (unsigned int*) &seg_ioc_base ;
    534536
    535537    unsigned int        block_size   = ioc_address[BLOCK_DEVICE_BLOCK_SIZE];
     
    561563        if ( ix2 == 0 ) ppn_first = ppn;
    562564
    563         if ( GIET_IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
     565        if ( IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
    564566        {
    565567            // check buffer length < 2 Mbytes
     
    588590
    589591    // compute buffer base address for IOC depending on IOMMU activation
    590     if ( GIET_IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF);
     592    if ( IOMMU_ACTIVE ) addr = (_ioc_iommu_ix1) << 21 | (user_vaddr & 0xFFF);
    591593    else                     addr = (ppn_first << 12) | (user_vaddr & 0xFFF);
    592594
     
    622624
    623625    // unmap the buffer from IOMMU page table if IOMMU is activated
    624     if ( GIET_IOMMU_ACTIVE )
    625     {
    626         unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base +
    627                                     (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     626    if ( IOMMU_ACTIVE )
     627    {
     628        unsigned int* iob_address = (unsigned int*) &seg_iob_base;
    628629
    629630        for ( ix2 = 0 ; ix2 < _ioc_iommu_npages ; ix2++ )
     
    691692{
    692693    // get IOC base address
    693     unsigned int* ioc_address = (unsigned int*)( (char*)&seg_ioc_base +
    694                                 (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     694    unsigned int* ioc_address = (unsigned int*) &seg_ioc_base;
    695695
    696696    *status = ioc_address[BLOCK_DEVICE_STATUS]; // read status & reset IRQ
     
    891891
    892892    // compute frame buffer pbase address
    893     unsigned int fb_vaddr = (unsigned int)&seg_fbf_base +
    894                             (CLUSTER_IO_ID * (unsigned int)CLUSTER_SIZE) + offset;
     893    unsigned int fb_vaddr = (unsigned int)&seg_fbf_base + offset;
    895894
    896895    ko = _v2p_translate( (page_table_t*)user_ptab,
     
    962961        if ( ix2 == 0 ) ppn_first = ppn;
    963962
    964         if ( GIET_IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
     963        if ( IOMMU_ACTIVE )    // the user buffer must be remapped in the I/0 space
    965964        {
    966965            // check buffer length < 2 Mbytes
     
    10711070   
    10721071    // unmap the buffer from IOMMU page table if IOMMU is activated
    1073     if ( GIET_IOMMU_ACTIVE )
    1074     {
    1075         unsigned int* iob_address = (unsigned int*)( (char*)&seg_iob_base +
    1076                                     (CLUSTER_IO_ID * (unsigned)CLUSTER_SIZE) );
     1072    if ( IOMMU_ACTIVE )
     1073    {
     1074        unsigned int* iob_address = (unsigned int*) &seg_iob_base;
    10771075
    10781076        unsigned int  ix1         = _dma_iommu_ix1 + dma_id;
Note: See TracChangeset for help on using the changeset viewer.