Changeset 345 for soft/giet_vm/giet_drivers/dma_driver.c
- Timestamp:
- Jun 25, 2014, 2:19:37 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/dma_driver.c
r343 r345 32 32 #include <vmem.h> 33 33 #include <utils.h> 34 #include <io.h> 34 35 35 36 #if !defined(X_SIZE) … … 61 62 #endif 62 63 63 extern unsigned int _ptabs_vaddr[]; 64 extern volatile unsigned int _ptabs_vaddr[]; 65 66 /////////////////////////////////////////////////////////////////////////////// 67 // This low level function returns the value contained in register "index" 68 // in the DMA component contained in cluster "cluster_xy" 69 /////////////////////////////////////////////////////////////////////////////// 70 static 71 unsigned int _dma_get_register( unsigned int cluster_xy, // cluster index 72 unsigned int channel_id, // channel index 73 unsigned int index ) // register index 74 { 75 unsigned int vaddr = 76 SEG_DMA_BASE + 77 (cluster_xy * PERI_CLUSTER_INCREMENT) + 78 (channel_id * DMA_SPAN) + 79 (index << 2); 80 81 return ioread32( (void*)vaddr ); 82 } 83 84 /////////////////////////////////////////////////////////////////////////////// 85 // This low level function sets a new value in register "index" 86 // in the DMA component contained in cluster "cluster_xy" 87 /////////////////////////////////////////////////////////////////////////////// 88 static 89 void _dma_set_register( unsigned int cluster_xy, // cluster index 90 unsigned int channel_id, // channel index 91 unsigned int index, // register index 92 unsigned int value ) // value to be written 93 { 94 unsigned int vaddr = 95 SEG_DMA_BASE + 96 (cluster_xy * PERI_CLUSTER_INCREMENT) + 97 (channel_id * DMA_SPAN) + 98 (index << 2); 99 100 iowrite32( (void*)vaddr, value ); 101 } 64 102 65 103 ////////////////////////////////////////////////////////////////////////////////// … … 81 119 if (channel_id >= NB_DMA_CHANNELS) return 1; 82 120 83 // compute DMA base address84 unsigned int* dma_address = (unsigned int*) ( SEG_DMA_BASE +85 (cluster_xy * PERI_CLUSTER_INCREMENT) );86 87 121 // disable interrupt for selected channel 88 dma_address[channel_id * DMA_SPAN + DMA_IRQ_DISABLE] = 1;122 _dma_set_register(cluster_xy, channel_id, DMA_IRQ_DISABLE, 1); 89 123 return 0; 90 124 #else … … 109 143 if (channel_id >= NB_DMA_CHANNELS) return 1; 110 144 111 // compute DMA base address112 unsigned int* dma_address = (unsigned int*) ( SEG_DMA_BASE +113 (cluster_xy * PERI_CLUSTER_INCREMENT) );114 115 145 // reset selected channel 116 dma_address[channel_id * DMA_SPAN + DMA_RESET] = 0;146 _dma_set_register(cluster_xy, channel_id, DMA_RESET, 0); 117 147 return 0; 118 148 #else … … 136 166 if (channel_id >= NB_DMA_CHANNELS) return 1; 137 167 138 // compute DMA base address139 unsigned int * dma_address = (unsigned int *) ( SEG_DMA_BASE +140 (cluster_xy * PERI_CLUSTER_INCREMENT) );141 142 168 // get selected channel status 143 return dma_address[channel_id * DMA_SPAN + DMA_LEN];169 return _dma_get_register(cluster_xy, channel_id, DMA_LEN); 144 170 #else 145 171 return DMA_IDLE; … … 160 186 #if NB_DMA_CHANNELS > 0 161 187 162 // compute DMA base address163 unsigned int * dma_address = (unsigned int *) ( SEG_DMA_BASE +164 (cluster_xy * PERI_CLUSTER_INCREMENT) );165 166 188 // selected channel configuration and lauching 167 dma_address[channel_id * DMA_SPAN + DMA_SRC] = (unsigned int)(src_paddr); 168 dma_address[channel_id * DMA_SPAN + DMA_SRC_EXT] = (unsigned int)(src_paddr>>32); 169 dma_address[channel_id * DMA_SPAN + DMA_DST] = (unsigned int)(dst_paddr); 170 dma_address[channel_id * DMA_SPAN + DMA_DST_EXT] = (unsigned int)(dst_paddr>>32); 171 dma_address[channel_id * DMA_SPAN + DMA_LEN] = (unsigned int)size; 189 _dma_set_register(cluster_xy, channel_id, DMA_SRC, 190 (unsigned int)(src_paddr)); 191 _dma_set_register(cluster_xy, channel_id, DMA_SRC_EXT, 192 (unsigned int)(src_paddr>>32)); 193 _dma_set_register(cluster_xy, channel_id, DMA_DST, 194 (unsigned int)(dst_paddr)); 195 _dma_set_register(cluster_xy, channel_id, DMA_DST_EXT, 196 (unsigned int)(dst_paddr>>32)); 197 _dma_set_register(cluster_xy, channel_id, DMA_LEN, 198 (unsigned int)size); 172 199 173 200 #endif … … 312 339 313 340 // get vspace page table pointer 314 unsigned int pt = 341 unsigned int pt = _ptabs_vaddr[vspace_id]; 315 342 316 343 // get src_paddr buffer physical addresse
Note: See TracChangeset
for help on using the changeset viewer.