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

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

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

File size: 4.1 KB
Line 
1///////////////////////////////////////////////////////////////////////////////////
2// File     : cma_driver.h
3// Date     : 01/11/2013
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// 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///////////////////////////////////////////////////////////////////////////////////
24
25#ifndef _GIET_CMA_DRIVERS_H_
26#define _GIET_CMA_DRIVERS_H_
27
28///////////////////////////////////////////////////////////////////////////////////
29//  CMA channel registers offsets
30///////////////////////////////////////////////////////////////////////////////////
31
32enum CMA_registers_e
33{
34    CHBUF_RUN           = 0,    // write-only : channel activated
35    CHBUF_STATUS        = 1,    // read-only  : channel fsm state
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 
41    CHBUF_PERIOD        = 7,    // read/write : period for status polling
42    CHBUF_SRC_EXT       = 8,    // read/write : source chbuf pbase extension
43    CHBUF_DST_EXT       = 9,    // read/write : dest chbuf pbase extension
44    CHBUF_SRC_INDEX     = 10,   // read-only  : source chbuf : buffer index
45    CHBUF_DST_INDEX     = 11,   // read-only  : destination chbuf : buffer index
46    /****/
47    CHBUF_CHANNEL_SPAN  = 1024,
48};
49
50///////////////////////////////////////////////////////////////////////////////////
51//  CMA channel status values
52///////////////////////////////////////////////////////////////////////////////////
53
54enum CMA_status_e
55{
56    CHANNEL_IDLE,
57
58    CHANNEL_DATA_ERROR,
59    CHANNEL_SRC_DESC_ERROR,
60    CHANNEL_DST_DESC_ERROR,
61    CHANNEL_SRC_STATUS_ERROR,
62    CHANNEL_DST_STATUS_ERROR,
63
64    CHANNEL_READ_SRC_DESC,
65    CHANNEL_READ_SRC_DESC_WAIT,
66    CHANNEL_READ_SRC_STATUS,
67    CHANNEL_READ_SRC_STATUS_WAIT,
68    CHANNEL_READ_SRC_STATUS_DELAY,
69
70    CHANNEL_READ_DST_DESC,
71    CHANNEL_READ_DST_DESC_WAIT,
72    CHANNEL_READ_DST_STATUS,
73    CHANNEL_READ_DST_STATUS_WAIT,
74    CHANNEL_READ_DST_STATUS_DELAY,
75
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,
83
84    CHANNEL_SRC_STATUS_WRITE,
85    CHANNEL_SRC_STATUS_WRITE_WAIT,
86    CHANNEL_DST_STATUS_WRITE,
87    CHANNEL_DST_STATUS_WRITE_WAIT,
88    CHANNEL_NEXT_BUFFERS,
89};
90
91///////////////////////////////////////////////////////////////////////////////////
92//    access functions
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
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.