| | 1 | [wiki:Component SocLib Components General Index] |
| | 2 | |
| | 3 | = !VciMultiDma = |
| | 4 | |
| | 5 | == 1) Functional Description == |
| | 6 | |
| | 7 | As the !VciDma component, this component moves data from |
| | 8 | a source memory buffer to a destination memory buffer. |
| | 9 | It is both a target and an initiator. |
| | 10 | * It is addressed as a target to be configured for a transfer. |
| | 11 | * It is acting as an initiator to do the transfer. |
| | 12 | |
| | 13 | This hardware component supports up to 16 simultaneous DMA transfers, |
| | 14 | corresponding to 16 independant DMA channels. |
| | 15 | |
| | 16 | As there is only one VCI port, the general arbitration policy between the |
| | 17 | active channels is round-robin. |
| | 18 | |
| | 19 | Each channet has its own set of memory mapped registers, and for each |
| | 20 | channel a specific IRQ can be is optionally asserted when transfer is completed. |
| | 21 | |
| | 22 | This hardware component checks for segmentation violation, and can be used |
| | 23 | as a default target. |
| | 24 | |
| | 25 | This component has 5 memory-mapped registers : |
| | 26 | |
| | 27 | * '''DMA_SRC''' (Read / Write) |
| | 28 | It defines the physical address of the source buffer. |
| | 29 | |
| | 30 | * '''DMA_DST''' (Read / Write) |
| | 31 | It defines the physical address of the destination buffer. |
| | 32 | |
| | 33 | * '''DMA_LEN''' (Read / Write) |
| | 34 | It defines the length of transfer, in bytes. This register must be written after writing into |
| | 35 | registers DMA_SRC & DMA_DST, as the writing into the DMA_LEN register starts the transfer. |
| | 36 | This register gets back to 0 when transfer is finished. |
| | 37 | This register can be used to test the DMA coprocessor status. |
| | 38 | |
| | 39 | * '''DMA_RESET''' (Write-only) |
| | 40 | Writing any value into this pseudo-register makes a clean re-initialisation of the DMA coprocessor: |
| | 41 | The on-going VCI transaction is completed before the coprocessor returns the IDLE state. |
| | 42 | This write access must be used by the software ISR to aknowledge the DMA IRQ. |
| | 43 | |
| | 44 | * '''DMA_IRQ_DISABLED''' (Read / Write) |
| | 45 | A non zero value disables the IRQ line. The RESET value is zero. |
| | 46 | |
| | 47 | For extensibility issues, you should access the DMA using globally-defined offsets. |
| | 48 | |
| | 49 | You should include file `soclib/dma.h` from your software, it |
| | 50 | defines `DMA_SRC`, `DMA_DST`, `DMA_LEN`, `DMA_RESET`, `DMA_IRQ_DISABLED`. |
| | 51 | |
| | 52 | Sample code: |
| | 53 | {{{ |
| | 54 | #include "soclib/dma.h" |
| | 55 | |
| | 56 | static const volatile void* dma = 0xc0000000; |
| | 57 | |
| | 58 | void * memcpy(void *dst, const void *src, const size_t len) |
| | 59 | { |
| | 60 | soclib_io_set( dma, DMA_DST, dst ); |
| | 61 | soclib_io_set( dma, DMA_SRC, src ); |
| | 62 | soclib_io_set( dma, DMA_LEN, len ); |
| | 63 | while( soclib_io_get( dma, DMA_LEN ) ) |
| | 64 | ; |
| | 65 | return dst; |
| | 66 | } |
| | 67 | |
| | 68 | }}} |
| | 69 | |
| | 70 | (add -I/path/to/soclib/include to your compilation command-line) |
| | 71 | |
| | 72 | == 2) Component definition & usage == |
| | 73 | |
| | 74 | source:trunk/soclib/soclib/module/infrastructure_component/dma_infrastructure/vci_dma/caba/metadata/vci_dma.sd |
| | 75 | |
| | 76 | See [wiki:SoclibCc/VciParameters SoclibCc/VciParameters] |
| | 77 | {{{ |
| | 78 | Uses( 'vci_dma' ) |
| | 79 | }}} |
| | 80 | |
| | 81 | == 3) CABA Implementation == |
| | 82 | |
| | 83 | === CABA sources === |
| | 84 | |
| | 85 | * interface : source:trunk/soclib/soclib/module/infrastructure_component/dma_infrastructure/vci_dma/caba/source/include/vci_dma.h |
| | 86 | * implementation : source:trunk/soclib/soclib/module/infrastructure_component/dma_infrastructure/vci_dma/caba/source/src/vci_dma.cpp |
| | 87 | |
| | 88 | === CABA Constructor parameters === |
| | 89 | {{{ |
| | 90 | VciDma( |
| | 91 | sc_module_name name, // Component Name |
| | 92 | const soclib::common::MappingTable &mt, // MappingTable |
| | 93 | const soclib::common::IntTab &srcid, // Initiator index |
| | 94 | const soclib::common::IntTab &tgtid, // Target index |
| | 95 | const size_t burst_size ); // Number of bytes transfered in a burst |
| | 96 | }}} |
| | 97 | |
| | 98 | === CABA Ports === |
| | 99 | |
| | 100 | * sc_in<bool> '''p_resetn''' : Global system reset |
| | 101 | * sc_in<bool> '''p_clk''' : Global system clock |
| | 102 | * soclib::caba::!VciTarget<vci_param> '''p_vci_target''' : The VCI target port |
| | 103 | * soclib::caba::!VciInitiator<vci_param> '''p_vci_initiator''' : The VCI initiator port |
| | 104 | * sc_out<bool> '''p_irq''' : Interrupt port |
| | 105 | |
| | 106 | == 4) TLM-DT implementation == |
| | 107 | |
| | 108 | The TLM-DT implementation is not available yet. |