source: soft/giet_vm/giet_drivers/cma_driver.h @ 705

Last change on this file since 705 was 704, checked in by guerin, 9 years ago

drivers: cma: update registers definition for soclib [2636]

File size: 4.1 KB
RevLine 
[258]1///////////////////////////////////////////////////////////////////////////////////
2// File     : cma_driver.h
3// Date     : 01/11/2013
4// Author   : alain greiner
5// Copyright (c) UPMC-LIP6
6///////////////////////////////////////////////////////////////////////////////////
[437]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// RX or TX packets between NIC and memory buffers.
14//
15// The SEG_CMA_BASE address must be defined in the hard_config.h file
16//
17// All accesses to CMA registers are done by the two _cma_set_register()
18// and _cma_get_register() low-level functions, that are handling virtual
19// to physical extended addressing.
20//
21// The higher level access functions are defined in the fbf_driver
22// and nic_driver files.
23///////////////////////////////////////////////////////////////////////////////////
[258]24
25#ifndef _GIET_CMA_DRIVERS_H_
26#define _GIET_CMA_DRIVERS_H_
27
28///////////////////////////////////////////////////////////////////////////////////
[448]29//  CMA channel registers offsets
[258]30///////////////////////////////////////////////////////////////////////////////////
31
[448]32enum CMA_registers_e
[258]33{
34    CHBUF_RUN           = 0,    // write-only : channel activated
35    CHBUF_STATUS        = 1,    // read-only  : channel fsm state
[506]36    CHBUF_SRC_DESC      = 2,    // read/write : source chbuf pbase address
37    CHBUF_DST_DESC      = 3,    // read/write : dest chbuf pbase address
38    CHBUF_SRC_NBUFS     = 4,    // read/write : source chbuf number of buffers
39    CHBUF_DST_NBUFS     = 5,    // read/write : dest chbuf number of buffers
40    CHBUF_BUF_SIZE      = 6,    // read/write : buffer size for source & dest 
[258]41    CHBUF_PERIOD        = 7,    // read/write : period for status polling
[506]42    CHBUF_SRC_EXT       = 8,    // read/write : source chbuf pbase extension
43    CHBUF_DST_EXT       = 9,    // read/write : dest chbuf pbase extension
[704]44    CHBUF_SRC_INDEX     = 10,   // read-only  : source chbuf : buffer index
45    CHBUF_DST_INDEX     = 11,   // read-only  : destination chbuf : buffer index
[258]46    /****/
47    CHBUF_CHANNEL_SPAN  = 1024,
48};
49
[295]50///////////////////////////////////////////////////////////////////////////////////
[448]51//  CMA channel status values
52///////////////////////////////////////////////////////////////////////////////////
53
54enum CMA_status_e
55{
56    CHANNEL_IDLE,
57
[612]58    CHANNEL_DATA_ERROR,
[448]59    CHANNEL_SRC_DESC_ERROR,
60    CHANNEL_DST_DESC_ERROR,
[612]61    CHANNEL_SRC_STATUS_ERROR,
62    CHANNEL_DST_STATUS_ERROR,
[448]63
[612]64    CHANNEL_READ_SRC_DESC,
65    CHANNEL_READ_SRC_DESC_WAIT,
[448]66    CHANNEL_READ_SRC_STATUS,
67    CHANNEL_READ_SRC_STATUS_WAIT,
68    CHANNEL_READ_SRC_STATUS_DELAY,
69
[612]70    CHANNEL_READ_DST_DESC,
71    CHANNEL_READ_DST_DESC_WAIT,
[448]72    CHANNEL_READ_DST_STATUS,
73    CHANNEL_READ_DST_STATUS_WAIT,
74    CHANNEL_READ_DST_STATUS_DELAY,
75
[612]76    CHANNEL_BURST,
77    CHANNEL_READ_REQ,
78    CHANNEL_READ_REQ_WAIT,
79    CHANNEL_RSP_WAIT,
80    CHANNEL_WRITE_REQ,
81    CHANNEL_WRITE_REQ_WAIT,
82    CHANNEL_BURST_RSP_WAIT,
[448]83
84    CHANNEL_SRC_STATUS_WRITE,
85    CHANNEL_SRC_STATUS_WRITE_WAIT,
86    CHANNEL_DST_STATUS_WRITE,
87    CHANNEL_DST_STATUS_WRITE_WAIT,
[612]88    CHANNEL_NEXT_BUFFERS,
[448]89};
90
91///////////////////////////////////////////////////////////////////////////////////
[437]92//    access functions
[295]93///////////////////////////////////////////////////////////////////////////////////
94
95extern unsigned int _cma_get_register( unsigned int channel,
96                                       unsigned int index );
97
98extern void _cma_set_register( unsigned int channel,
99                               unsigned int index,
100                               unsigned int value );
101
102extern void _cma_isr( unsigned int irq_type,
103                      unsigned int irq_id,
104                      unsigned int channel );
105
[258]106#endif
107
108// Local Variables:
109// tab-width: 4
110// c-basic-offset: 4
111// c-file-offsets:((innamespace . 0)(inline-open . 0))
112// indent-tabs-mode: nil
113// End:
114// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
115
Note: See TracBrowser for help on using the repository browser.