Changeset 437 for soft/giet_vm/giet_drivers/cma_driver.c
- Timestamp:
- Nov 3, 2014, 10:53:00 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/cma_driver.c
r320 r437 4 4 // Author : alain greiner 5 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 is9 // a multi channels, chained buffer DMA controller.10 //11 // This component can be used in conjonction with the SocLib vci_frame_buffer12 // to display images, or with the SocLib vci_multi_nic controller to tranfer13 // both RX and TX packets between NIC and memory buffers.14 //15 // The SEG_DMA_BASE address must be defined in the hard_config.h file16 ////////////////////////////////////////////////////////////////////////////////////17 // Implementation notes:18 // 1. The higher level access functions can be found in the fbf_driver and19 // nic_driver files.20 // 2. All accesses to CMA registers are done by the two21 // _cma_set_register() and _cma_get_register() low-level functions,22 // that are handling virtual / physical extended addressing.23 6 /////////////////////////////////////////////////////////////////////////////////// 24 7 … … 31 14 #endif 32 15 33 /////////////////////////////////////////////////////////////////////////////// 34 // This low_level function returns the value contained in register (index). 35 /////////////////////////////////////////////////////////////////////////////// 16 ///////////////////////////////////////////////////// 36 17 unsigned int _cma_get_register( unsigned int channel, 37 18 unsigned int index ) … … 42 23 } 43 24 44 /////////////////////////////////////////////////////////////////////////////// 45 // This low-level function set a new value in register (index). 46 /////////////////////////////////////////////////////////////////////////////// 25 ///////////////////////////////////////////// 47 26 void _cma_set_register( unsigned int channel, 48 27 unsigned int index, … … 54 33 } 55 34 56 /////////////////////////////////////////////////////////////////////////////// 57 // This ISR handles the IRQ generated by a CMA channel. 58 /////////////////////////////////////////////////////////////////////////////// 35 //////////////////////////////////////////////////// 36 void _cma_start_channel( unsigned int channel, 37 unsigned long long src_paddr, 38 unsigned int src_nbufs, 39 unsigned long long dst_paddr, 40 unsigned int dst_nbufs, 41 unsigned int buf_length ) 42 { 43 _cma_set_register( channel, CHBUF_SRC_DESC , (unsigned int)(src_paddr & 0xFFFFFFFF) ); 44 _cma_set_register( channel, CHBUF_SRC_EXT , (unsigned int)(src_paddr >> 32) ); 45 _cma_set_register( channel, CHBUF_SRC_NBUFS, src_nbufs ); 46 _cma_set_register( channel, CHBUF_DST_DESC , (unsigned int)(dst_paddr & 0xFFFFFFFF) ); 47 _cma_set_register( channel, CHBUF_DST_EXT , (unsigned int)(dst_paddr >> 32) ); 48 _cma_set_register( channel, CHBUF_DST_NBUFS, dst_nbufs ); 49 _cma_set_register( channel, CHBUF_BUF_SIZE , buf_length ); 50 _cma_set_register( channel, CHBUF_PERIOD , 300 ); 51 _cma_set_register( channel, CHBUF_RUN , 1 ); 52 } 53 54 ////////////////////////////////////////////// 55 void _cma_stop_channel( unsigned int channel ) 56 { 57 _cma_set_register( channel, CHBUF_RUN , 0 ); 58 } 59 60 ////////////////////////////////////// 59 61 void _cma_isr( unsigned int irq_type, 60 62 unsigned int irq_id, 61 63 unsigned int channel ) 62 64 { 63 _p rintf("\n[GIET ERROR] _cma_isr() not implemented\n");65 _puts("\n[GIET ERROR] _cma_isr() not implemented\n"); 64 66 _exit(); 65 67 }
Note: See TracChangeset
for help on using the changeset viewer.