Changeset 437 for soft/giet_vm/giet_drivers/dma_driver.h
- Timestamp:
- Nov 3, 2014, 10:53:00 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/dma_driver.h
r343 r437 5 5 // Copyright (c) UPMC-LIP6 6 6 /////////////////////////////////////////////////////////////////////////////////// 7 // The dma_driver.c and dma_driver.h files are part ot the GIET-VM nano-kernel. 8 // This driver supports the SoCLib vci_multi_dma component. 9 // 10 // It can exist several DMA controlers in the architecture (one per cluster), 11 // and each controller can contain several channels. 12 // 13 // There is (NB_CLUSTERS * NB_DMA_CHANNELS) channels, indexed by a global index: 14 // dma_id = cluster_xy * NB_DMA_CHANNELS + loc_id 15 // 16 // A DMA channel is a private ressource allocated to a given processor. 17 // It is exclusively used by the kernet to speedup data transfers, and 18 // there is no lock protecting exclusive access to the channel. 19 // As the kernel uses a polling policy on the DMA_STATUS register to detect 20 // transfer completion, the DMA IRQ is not used. 21 // 22 // The virtual base address of the segment associated to a channel is: 23 // SEG_DMA_BASE + cluster_xy * PERI_CLUSTER_INCREMENT + DMA_SPAN * channel_id 24 // 25 // The SEG_DMA_BASE virtual address mus be defined in the hard_config.h file. 26 //////////////////////////////////////////////////////////////////////////////////// 7 27 8 28 #ifndef _GIET_DMA_DRIVER_H_ … … 37 57 38 58 39 /////////////////////////////////////////////////////////////////////////////// ////40 // Multi DMA variables and access functions (vci_multi_dma)41 /////////////////////////////////////////////////////////////////////////////// ////59 /////////////////////////////////////////////////////////////////////////////// 60 // low-level access functions 61 /////////////////////////////////////////////////////////////////////////////// 42 62 43 // low level access functions 63 ////////////////////////////////////////////////////////////////////////////////// 64 // This function disables interrupts for one DMA channel in one cluster. 65 // AS the GIET-VM uses a polling policy to detect DMA transfer completion, 66 // the DMA component initialisation must disable interrupts. 67 // Returns 0 if success, returns > 0 if error. 68 ////////////////////////////////////////////////////////////////////////////////// 44 69 extern unsigned int _dma_init( unsigned int cluster_xy, 45 70 unsigned int channel_id ); 46 71 72 ////////////////////////////////////////////////////////////////////////////////// 73 // This function re-initialises one DMA channel in one cluster after transfer 74 // completion. It actually forces the channel to return in IDLE state. 75 ////////////////////////////////////////////////////////////////////////////////// 47 76 extern unsigned int _dma_reset( unsigned int cluster_xy, 48 77 unsigned int channel_id ); 49 78 79 ////////////////////////////////////////////////////////////////////////////////// 80 // This function returns the status of a DMA channel in a given cluster 81 ////////////////////////////////////////////////////////////////////////////////// 50 82 extern unsigned int _dma_get_status( unsigned int cluster_xy, 51 83 unsigned int channel_id ); 52 84 85 ////////////////////////////////////////////////////////////////////////////////// 86 // This function sets the physical address (including 64 bits extension) 87 // for the source and destination buffers in a DMA channel in a given cluster 88 // and sets the transfer size to lauch the transfer. 89 ////////////////////////////////////////////////////////////////////////////////// 53 90 extern void _dma_start_transfer( unsigned int cluster_xy, 54 91 unsigned int channel_id, … … 57 94 unsigned int size ); 58 95 59 // higher level access function 96 ////////////////////////////////////////////////////////////////////////////////// 97 // higher level access function 98 ////////////////////////////////////////////////////////////////////////////////// 99 100 /////////////////////////////////////////////////////////////////////////////////// 101 // This function copies a source memory buffer to a destination memory buffer, 102 // using directly physical addresses. 103 // This blocking function is supposed to be used by the kernel only, 104 // and uses a polling policy on DMA_STATUS register to detect completion. 105 // Therefore, the DMA_IRQ is NOT used. 106 // The source and destination buffers base addresses must be word aligned, 107 // and the buffer's size must be multiple of 4. 108 // In case of error (buffer unmapped, unaligned, or DMA_STATUS error), an error 109 // message is displayed on TTY0, and system crash. 110 /////////////////////////////////////////////////////////////////////////////////// 60 111 extern void _dma_physical_copy( unsigned int cluster_xy, 61 112 unsigned int channel_id, … … 64 115 unsigned int size ); 65 116 117 /////////////////////////////////////////////////////////////////////////////////// 118 // This function copies a source memory buffer to a destination memory buffer, 119 // making virtual to physical address translation: the MMU should be activated. 120 // This blocking function is supposed to be used by the kernel only, 121 // and uses a polling policy on DMA_STATUS register to detect completion. 122 // Therefore, the DMA_IRQ is NOT used. 123 // The source and destination buffers base addresses must be word aligned, 124 // and the buffer's size must be multiple of 4. 125 // In case of error (buffer unmapped, unaligned, or DMA_STATUS error), an error 126 // message is displayed on TTY0, and system crash. 127 /////////////////////////////////////////////////////////////////////////////////// 66 128 extern void _dma_copy( unsigned int cluster_xy, 67 129 unsigned int channel_id, … … 71 133 unsigned int size ); 72 134 135 /////////////////////////////////////////////////////////////////////////////// 136 // This ISR should not be used by the GIET_VM, because the DMA is only 137 // used by the kernel in the boot phase, with a polling strategy. 138 /////////////////////////////////////////////////////////////////////////////// 73 139 extern void _dma_isr( unsigned int irq_type, 74 140 unsigned int irq_id, 75 141 unsigned int channel ); 76 142 77 ///////////////////////////////////////////////////////////////////////////////////78 143 79 144 #endif
Note: See TracChangeset
for help on using the changeset viewer.