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

Last change on this file since 827 was 728, checked in by alain, 9 years ago

bloup

File size: 4.4 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 running modes
52///////////////////////////////////////////////////////////////////////////////////
53
54enum CMA_modes_e
55{
56    MODE_IDLE           = 0,
57    MODE_NORMAL         = 1,
58    MODE_NO_DST_SYNC    = 2,
59    MODE_NO_SRC_SYNC    = 4,
60};
61
62///////////////////////////////////////////////////////////////////////////////////
63//  CMA channel status values
64///////////////////////////////////////////////////////////////////////////////////
65
66enum CMA_status_e
67{
68    CHANNEL_IDLE,
69
70    CHANNEL_DATA_ERROR,
71    CHANNEL_SRC_DESC_ERROR,
72    CHANNEL_DST_DESC_ERROR,
73    CHANNEL_SRC_STATUS_ERROR,
74    CHANNEL_DST_STATUS_ERROR,
75
76    CHANNEL_READ_SRC_DESC,
77    CHANNEL_READ_SRC_DESC_WAIT,
78    CHANNEL_READ_SRC_STATUS,
79    CHANNEL_READ_SRC_STATUS_WAIT,
80    CHANNEL_READ_SRC_STATUS_DELAY,
81
82    CHANNEL_READ_DST_DESC,
83    CHANNEL_READ_DST_DESC_WAIT,
84    CHANNEL_READ_DST_STATUS,
85    CHANNEL_READ_DST_STATUS_WAIT,
86    CHANNEL_READ_DST_STATUS_DELAY,
87
88    CHANNEL_BURST,
89    CHANNEL_READ_REQ,
90    CHANNEL_READ_REQ_WAIT,
91    CHANNEL_RSP_WAIT,
92    CHANNEL_WRITE_REQ,
93    CHANNEL_WRITE_REQ_WAIT,
94    CHANNEL_BURST_RSP_WAIT,
95
96    CHANNEL_SRC_STATUS_WRITE,
97    CHANNEL_SRC_STATUS_WRITE_WAIT,
98    CHANNEL_DST_STATUS_WRITE,
99    CHANNEL_DST_STATUS_WRITE_WAIT,
100    CHANNEL_NEXT_BUFFERS,
101};
102
103
104///////////////////////////////////////////////////////////////////////////////////
105//    access functions
106///////////////////////////////////////////////////////////////////////////////////
107
108extern unsigned int _cma_get_register( unsigned int channel,
109                                       unsigned int index );
110
111extern void _cma_set_register( unsigned int channel,
112                               unsigned int index,
113                               unsigned int value );
114
115extern void _cma_isr( unsigned int irq_type,
116                      unsigned int irq_id,
117                      unsigned int channel );
118
119#endif
120
121// Local Variables:
122// tab-width: 4
123// c-basic-offset: 4
124// c-file-offsets:((innamespace . 0)(inline-open . 0))
125// indent-tabs-mode: nil
126// End:
127// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
128
Note: See TracBrowser for help on using the repository browser.