[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 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[437] | 29 | // registers offsets |
---|
[258] | 30 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 31 | |
---|
| 32 | enum CMA_registers |
---|
| 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 : descriptor base address |
---|
| 37 | CHBUF_DST_DESC = 3, // read/write : destination chbuf : descriptor base address, |
---|
| 38 | CHBUF_SRC_NBUFS = 4, // read/write : source chbuf : number of buffers, |
---|
| 39 | CHBUF_DST_NBUFS = 5, // read/write : destination chbuf : number of buffers, |
---|
| 40 | CHBUF_BUF_SIZE = 6, // read/write : buffer size for both source & destination |
---|
| 41 | CHBUF_PERIOD = 7, // read/write : period for status polling |
---|
| 42 | CHBUF_SRC_EXT = 8, // read/write : source chbuf : descriptor base address |
---|
| 43 | CHBUF_DST_EXT = 9, // read/write : destination chbuf : descriptor base address, |
---|
| 44 | /****/ |
---|
| 45 | CHBUF_CHANNEL_SPAN = 1024, |
---|
| 46 | }; |
---|
| 47 | |
---|
[295] | 48 | /////////////////////////////////////////////////////////////////////////////////// |
---|
[437] | 49 | // access functions |
---|
[295] | 50 | /////////////////////////////////////////////////////////////////////////////////// |
---|
| 51 | |
---|
[437] | 52 | //////////////////////////////////////////////////////////// |
---|
[295] | 53 | extern unsigned int _cma_get_register( unsigned int channel, |
---|
| 54 | unsigned int index ); |
---|
| 55 | |
---|
[437] | 56 | /////////////////////////////////////////////////// |
---|
[295] | 57 | extern void _cma_set_register( unsigned int channel, |
---|
| 58 | unsigned int index, |
---|
| 59 | unsigned int value ); |
---|
| 60 | |
---|
[437] | 61 | /////////////////////////////////////////////////// |
---|
| 62 | void _cma_start_channel( unsigned int channel, |
---|
| 63 | unsigned long long src_paddr, |
---|
| 64 | unsigned int src_nbufs, |
---|
| 65 | unsigned long long dst_paddr, |
---|
| 66 | unsigned int dst_nbufs, |
---|
| 67 | unsigned int buf_length ); |
---|
| 68 | |
---|
| 69 | ////////////////////////////////////////////// |
---|
| 70 | void _cma_stop_channel( unsigned int channel ); |
---|
| 71 | |
---|
| 72 | //////////////////////////////////////////// |
---|
[295] | 73 | extern void _cma_isr( unsigned int irq_type, |
---|
| 74 | unsigned int irq_id, |
---|
| 75 | unsigned int channel ); |
---|
| 76 | |
---|
[258] | 77 | #endif |
---|
| 78 | |
---|
| 79 | // Local Variables: |
---|
| 80 | // tab-width: 4 |
---|
| 81 | // c-basic-offset: 4 |
---|
| 82 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 83 | // indent-tabs-mode: nil |
---|
| 84 | // End: |
---|
| 85 | // vim: filetype=c:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 |
---|
| 86 | |
---|