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

Last change on this file since 549 was 506, checked in by alain, 10 years ago

Simplifying the CMA driver.

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    /****/
45    CHBUF_CHANNEL_SPAN  = 1024,
46};
47
48///////////////////////////////////////////////////////////////////////////////////
49//  CMA channel status values
50///////////////////////////////////////////////////////////////////////////////////
51
52enum CMA_status_e
53{
54    CHANNEL_IDLE,
55
56    CHANNEL_SRC_DATA_ERROR,
57    CHANNEL_DST_DATA_ERROR,
58    CHANNEL_SRC_DESC_ERROR,
59    CHANNEL_DST_DESC_ERROR,
60
61    CHANNEL_READ_SRC_STATUS,
62    CHANNEL_READ_SRC_STATUS_WAIT,
63    CHANNEL_READ_SRC_STATUS_DELAY,
64    CHANNEL_READ_SRC_BUFADDR,
65    CHANNEL_READ_SRC_BUFADDR_WAIT,
66
67    CHANNEL_READ_DST_STATUS,
68    CHANNEL_READ_DST_STATUS_WAIT,
69    CHANNEL_READ_DST_STATUS_DELAY,
70    CHANNEL_READ_DST_BUFADDR,
71    CHANNEL_READ_DST_BUFADDR_WAIT,
72
73    CHANNEL_READ_BURST,
74    CHANNEL_READ_REQ_FIRST,
75    CHANNEL_READ_WAIT_FIRST,
76    CHANNEL_READ_REQ_SECOND,
77    CHANNEL_READ_WAIT_SECOND,
78
79    CHANNEL_WRITE_BURST,
80    CHANNEL_WRITE_REQ_FIRST,
81    CHANNEL_WRITE_WAIT_FIRST,
82    CHANNEL_WRITE_REQ_SECOND,
83    CHANNEL_WRITE_WAIT_SECOND,
84
85    CHANNEL_SRC_STATUS_WRITE,
86    CHANNEL_SRC_STATUS_WRITE_WAIT,
87    CHANNEL_DST_STATUS_WRITE,
88    CHANNEL_DST_STATUS_WRITE_WAIT,
89    CHANNEL_SRC_NEXT_BUFFER,
90    CHANNEL_DST_NEXT_BUFFER,
91};
92
93///////////////////////////////////////////////////////////////////////////////////
94//    access functions
95///////////////////////////////////////////////////////////////////////////////////
96
97extern unsigned int _cma_get_register( unsigned int channel,
98                                       unsigned int index );
99
100extern void _cma_set_register( unsigned int channel,
101                               unsigned int index,
102                               unsigned int value );
103
104extern void _cma_isr( unsigned int irq_type,
105                      unsigned int irq_id,
106                      unsigned int channel );
107
108#endif
109
110// Local Variables:
111// tab-width: 4
112// c-basic-offset: 4
113// c-file-offsets:((innamespace . 0)(inline-open . 0))
114// indent-tabs-mode: nil
115// End:
116// vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4
117
Note: See TracBrowser for help on using the repository browser.