source: soft/giet_vm/giet_drivers/cma_driver.c @ 318

Last change on this file since 318 was 298, checked in by alain, 11 years ago

Introducing pic driver and rdk driver

File size: 2.9 KB
RevLine 
[298]1///////////////////////////////////////////////////////////////////////////////////
2// File      : cma_driver.c
3// Date      : 01/03/2014
4// Author    : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
7// The cma_driver.c and cma_driver.h files are part ot the GIET-VM kernel.
8// This driver supports the SocLib vci_chbuf_dma component, that is
9// a multi channels, chained buffer DMA controller.
10//
11// This component can be used in conjonction with the SocLib vci_frame_buffer
12// to display images, or with the SocLib vci_multi_nic controller to tranfer
13// both RX and TX packets between NIC and memory buffers.
14///////////////////////////////////////////////////////////////////////////////////
15// Implementation notes:
16// 1. The higher level access functions can be found in the fbf_driver and
17//    nic_driver files.
18// 2. All accesses to CMA registers are done by the two
19//    _cma_set_register() and _cma_get_register() low-level functions,
20//    that are handling virtual / physical extended addressing.
21///////////////////////////////////////////////////////////////////////////////////
22
23#include <cma_driver.h>
24#include <utils.h>                  // for seg_cma_base
25#include <hard_config.h>            // for X_IO / Y_IO
26
27///////////////////////////////////////////////////////////////////////////////
28// This low_level function returns the value contained in register (index).
29///////////////////////////////////////////////////////////////////////////////
30unsigned int _cma_get_register( unsigned int channel,
31                                unsigned int index )
32{
33    unsigned int* vaddr = (unsigned int*)&seg_cma_base + 
34                           CHBUF_CHANNEL_SPAN*channel + index;
35    return _io_extended_read( vaddr );
36}
37
38///////////////////////////////////////////////////////////////////////////////
39// This low-level function set a new value in register (index).
40///////////////////////////////////////////////////////////////////////////////
41void _cma_set_register( unsigned int channel,
42                        unsigned int index,
43                        unsigned int value ) 
44{
45    unsigned int* vaddr = (unsigned int*)&seg_cma_base + 
46                           CHBUF_CHANNEL_SPAN*channel + index;
47    _io_extended_write( vaddr, value );
48}
49
50///////////////////////////////////////////////////////////////////////////////
51// This ISR handles the IRQ generated by a CMA channel.
52///////////////////////////////////////////////////////////////////////////////
53void _cma_isr( unsigned int irq_type,
54               unsigned int irq_id,
55               unsigned int channel )
56{
57    _printf("\n[GIET ERROR] _cma_isr() nor implemented\n");
58    _exit();
59}
60
61// Local Variables:
62// tab-width: 4
63// c-basic-offset: 4
64// c-file-offsets:((innamespace . 0)(inline-open . 0))
65// indent-tabs-mode: nil
66// End:
67// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
68
Note: See TracBrowser for help on using the repository browser.