source: soft/giet_vm/giet_drivers/pic_driver.c @ 648

Last change on this file since 648 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: 1.8 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////
2// File     : pic_driver.c
3// Date     : 05/03/2014
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7
8#include <pic_driver.h>
9#include <giet_config.h>
10#include <hard_config.h>
11#include <utils.h>
12
13#if !defined(SEG_PIC_BASE)
14# error: You must define SEG_PIC_BASE in the hard_config.h file
15#endif
16
17/////////////////////////////////////////////////////
18unsigned int _pic_get_register( unsigned int channel,
19                                unsigned int index )
20{
21    unsigned int* vaddr = (unsigned int*)SEG_PIC_BASE + channel*IOPIC_SPAN + index;
22    return _io_extended_read( vaddr );
23}
24
25/////////////////////////////////////////////
26void _pic_set_register( unsigned int channel,
27                        unsigned int index,
28                        unsigned int value )
29{
30    unsigned int* vaddr = (unsigned int*)SEG_PIC_BASE + channel*IOPIC_SPAN + index;
31    _io_extended_write( vaddr, value );
32}
33
34
35/////////////////////////////////////
36void _pic_init( unsigned int channel,      // source PIC HWI channel
37                unsigned int vaddr,        // dest XCU WTI address
38                unsigned int extend )      // dest XCU cluster_xy
39{
40    _pic_set_register( channel, IOPIC_ADDRESS, vaddr );
41    _pic_set_register( channel, IOPIC_EXTEND, extend );
42    _pic_set_register( channel, IOPIC_MASK, 1 );
43}
44
45////////////////////////////////////////////////////
46unsigned int _pic_get_status( unsigned int channel )
47{
48    return _pic_get_register( channel, IOPIC_STATUS );
49}
50
51
52// Local Variables:
53// tab-width: 4
54// c-basic-offset: 4
55// c-file-offsets:((innamespace . 0)(inline-open . 0))
56// indent-tabs-mode: nil
57// End:
58// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
59
Note: See TracBrowser for help on using the repository browser.