Ignore:
Timestamp:
Apr 3, 2014, 2:00:10 PM (11 years ago)
Author:
alain
Message:

Introducing pic driver and rdk driver

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_drivers/iob_driver.c

    r258 r298  
    88// This driver supports the TSAR vci_io_bridge, that is a bridge to access
    99// The external peripherals, implementing an IO_MMU.
     10// This component can be instanciated in more than one cluster.
    1011///////////////////////////////////////////////////////////////////////////////////
    1112// The seg_iob_base virtual base addresses must be defined in giet_vsegs.ld file.
     13// The physical base address is supposed to be (cluster_xy << 32) | seg_iob_base.
    1214///////////////////////////////////////////////////////////////////////////////////
    1315
     
    2426#endif
    2527
     28
    2629///////////////////////////////////////////////////////////////////////////////
    27 //      _iob_inval_tlb_entry()
     30// This low level function returns the value contained in register "index"
     31// in the IOB component contained in cluster "cluster_xy"
     32///////////////////////////////////////////////////////////////////////////////
     33unsigned int _iob_get_register( unsigned int cluster_xy,   // cluster index
     34                                unsigned int index )       // register index
     35{
     36    unsigned long long paddr = (unsigned long long)(unsigned int)&seg_iob_base +
     37                               ((unsigned long long)cluster_xy << 32) +
     38                               ((unsigned long long)index << 2);
     39
     40    return _physical_read( paddr );
     41}
     42///////////////////////////////////////////////////////////////////////////////
     43// This low level function sets a new value in register "index"
     44// in the IOB component contained in cluster "cluster_xy"
     45///////////////////////////////////////////////////////////////////////////////
     46void _iob_set_register( unsigned int cluster_xy,       // cluster index
     47                        unsigned int index,            // register index
     48                        unsigned int value )           // value to be written
     49{
     50    unsigned long long paddr = (unsigned long long)(unsigned int)&seg_iob_base +
     51                               ((unsigned long long)cluster_xy << 32) +
     52                               ((unsigned long long)index << 2);
     53
     54    _physical_write( paddr, value );
     55}
     56
     57
     58
     59
     60///////////////////////////////////////////////////////////////////////////////
    2861// This function invalidates a TLB entry identified by a virtual address.
    29 // Returns 0 if success, returns 1 if failure
    3062///////////////////////////////////////////////////////////////////////////////
    31 unsigned int _iob_inval_tlb_entry( unsigned int vaddr )
     63void _iob_inval_tlb_entry( unsigned int cluster_xy,
     64                           unsigned int vaddr )
    3265{
    33 #if USE_IOB
     66    _iob_set_register( cluster_xy,
     67                       IOB_INVAL_PTE,
     68                       vaddr );
     69}
    3470
    35     unsigned int * iob_address = (unsigned int *) &seg_iob_base ;
    36     iob_address[IOB_INVAL_PTE] = vaddr;
    37     return 0;
     71///////////////////////////////////////////////////////////////////////////////
     72// This function sets a new value in IOB_IOMMU_PTPR register.
     73///////////////////////////////////////////////////////////////////////////////
     74void _iob_set_iommu_ptpr( unsigned int cluster_xy,
     75                          unsigned int value )
     76{
     77    _iob_set_register( cluster_xy,
     78                       IOB_IOMMU_PTPR,
     79                       value );
     80}
    3881
    39 #else
     82///////////////////////////////////////////////////////////////////////////////
     83// This function sets a new value in IOB_XICU_BASE register.
     84///////////////////////////////////////////////////////////////////////////////
     85void _iob_set_xicu_base( unsigned int cluster_xy,
     86                         unsigned int value )
     87{
     88    _iob_set_register( cluster_xy,
     89                       IOB_XICU_BASE,
     90                       value );
     91}
    4092
    41     return 1;
     93///////////////////////////////////////////////////////////////////////////////
     94// This function sets a new value in IOB_XICU_SIZE register.
     95///////////////////////////////////////////////////////////////////////////////
     96void _iob_set_xicu_size( unsigned int cluster_xy,
     97                         unsigned int value )
     98{
     99    _iob_set_register( cluster_xy,
     100                       IOB_XICU_SIZE,
     101                       value );
     102}
    42103
    43 #endif
    44 }
    45104
    46105
Note: See TracChangeset for help on using the changeset viewer.