source: soft/giet_vm/giet_drivers/iob_driver.c @ 709

Last change on this file since 709 was 437, checked in by alain, 10 years ago

Introducing dynamic allocation of peripheral channel(TTY, NIC, TIM, CMA)
Removint the ICU driver : ICU component not supported anymore.
Removing the FBF driver.

File size: 2.8 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////
2// File     : iob_driver.c
3// Date     : 23/05/2013
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7
8#include <giet_config.h>
9#include <iob_driver.h>
10#include <utils.h>
11
12#if !defined(SEG_IOB_BASE)
13# error: You must define SEG_IOB_BASE in the hard_config.h file
14#endif
15
16#if !defined(GIET_USE_IOMMU)
17# error: You must define GIET_USE_IOMMU in the giet_config.h file
18#endif
19
20#if !defined( USE_IOB )
21# error: You must define USE_IOB in the hard_config.h file
22#endif
23
24
25///////////////////////////////////////////////////////////////////////////////
26// This low level function returns the value contained in register "index"
27// in the IOB component contained in cluster "cluster_xy"
28///////////////////////////////////////////////////////////////////////////////
29unsigned int _iob_get_register( unsigned int cluster_xy,   // cluster index
30                                unsigned int index )       // register index
31{
32    unsigned long long paddr = (unsigned long long)SEG_IOB_BASE + 
33                               ((unsigned long long)cluster_xy << 32) +
34                               ((unsigned long long)index << 2);
35
36    return _physical_read( paddr );
37}
38///////////////////////////////////////////////////////////////////////////////
39// This low level function sets a new value in register "index"
40// in the IOB component contained in cluster "cluster_xy"
41///////////////////////////////////////////////////////////////////////////////
42void _iob_set_register( unsigned int cluster_xy,       // cluster index
43                        unsigned int index,            // register index
44                        unsigned int value )           // value to be written
45{
46    unsigned long long paddr = (unsigned long long)SEG_IOB_BASE + 
47                               ((unsigned long long)cluster_xy << 32) +
48                               ((unsigned long long)index << 2);
49
50    _physical_write( paddr, value );
51}
52
53
54
55
56///////////////////////////////////////////////////
57void _iob_inval_tlb_entry( unsigned int cluster_xy,
58                           unsigned int vaddr )
59{
60    _iob_set_register( cluster_xy,
61                       IOB_INVAL_PTE,
62                       vaddr );
63}
64
65//////////////////////////////////////////////////
66void _iob_set_iommu_ptpr( unsigned int cluster_xy,
67                          unsigned int value )
68{
69    _iob_set_register( cluster_xy,
70                       IOB_IOMMU_PTPR,
71                       value );
72}
73
74// Local Variables:
75// tab-width: 4
76// c-basic-offset: 4
77// c-file-offsets:((innamespace . 0)(inline-open . 0))
78// indent-tabs-mode: nil
79// End:
80// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
81
Note: See TracBrowser for help on using the repository browser.