Changeset 456
- Timestamp:
- Dec 5, 2014, 3:38:31 PM (10 years ago)
- Location:
- soft/giet_vm/giet_drivers
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_drivers/bdv_driver.c
r437 r456 20 20 #include <ioc_driver.h> 21 21 #include <utils.h> 22 #include <tty _driver.h>22 #include <tty0.h> 23 23 #include <ctx_handler.h> 24 24 25 #if !defined(GIET_NO_HARD_CC)26 # error: You must define GIET_NO_HARD_CC in the giet_config.h file27 #endif28 29 25 /////////////////////////////////////////////////////////////////////////////// 30 26 // BDV global variables 31 27 /////////////////////////////////////////////////////////////////////////////// 32 28 33 #define in_unckdata __attribute__((section (".unckdata"))) 34 #define in_kdata __attribute__((section (".kdata"))) 35 36 #if GIET_NO_HARD_CC 37 in_unckdata giet_lock_t _bdv_lock __attribute__((aligned(64))); 38 in_unckdata volatile unsigned int _bdv_status; 39 in_unckdata volatile unsigned int _bdv_gtid; 40 #else 41 in_kdata giet_lock_t _bdv_lock __attribute__((aligned(64))); 42 in_kdata volatile unsigned int _bdv_status; 43 in_kdata volatile unsigned int _bdv_gtid; 44 #endif 29 spin_lock_t _bdv_lock __attribute__((aligned(64))); 30 unsigned int _bdv_status; 31 unsigned int _bdv_gtid; 45 32 46 33 /////////////////////////////////////////////////////////////////////////////// … … 110 97 111 98 // get the lock protecting BDV 112 _ get_lock(&_bdv_lock);113 114 #if GIET_DEBUG_IOC_DRIVER 115 _puts("\n[BDV DEBUG] _bdv_access() : P["); 116 _putd( x ); 117 _puts(","); 118 _putd( y ); 119 _puts(","); 120 _putd( p ); 121 _puts("] get bdv_lock at cycle ");122 _pu d( _get_proctime() );99 _lock_acquire( &_bdv_lock ); 100 101 #if GIET_DEBUG_IOC_DRIVER 102 _puts("\n[BDV DEBUG] _bdv_access() : P["); 103 _putd( x ); 104 _puts(","); 105 _putd( y ); 106 _puts(","); 107 _putd( p ); 108 _puts("] get _bdv_lock at cycle "); 109 _putd( _get_proctime() ); 123 110 _puts("\n"); 124 111 #endif … … 172 159 173 160 // release lock 174 _ release_lock(&_bdv_lock);161 _lock_release( &_bdv_lock ); 175 162 } 176 163 // in USER or KERNEL mode, we deschedule the task. … … 233 220 // reset _bdv_status and release lock 234 221 _bdv_status = BLOCK_DEVICE_IDLE; 235 _ release_lock(&_bdv_lock);222 _lock_release( &_bdv_lock ); 236 223 } 237 224 … … 246 233 _putd( _get_proctime() ); 247 234 _puts(" / error = "); 248 _putd( error ) 235 _putd( error ); 249 236 _puts("\n"); 250 237 #endif -
soft/giet_vm/giet_drivers/bdv_driver.h
r437 r456 48 48 #define _GIET_BDV_DRIVER_H_ 49 49 50 #include "utils.h" 51 52 /////////////////////////////////////////////////////////////////////////////////// 53 // BDV global variables 54 /////////////////////////////////////////////////////////////////////////////////// 55 56 extern giet_lock_t _bdv_lock; // BDV is a shared ressource 57 extern volatile unsigned int _bdv_status; // required for IRQ signaling 58 extern volatile unsigned int _bdv_gtid; // descheduled task id = gpid<<16 + ltid 50 #include "locks.h" 59 51 60 52 /////////////////////////////////////////////////////////////////////////////////// … … 92 84 BLOCK_DEVICE_ERROR, 93 85 }; 86 87 /////////////////////////////////////////////////////////////////////////////// 88 // BDV global variables 89 /////////////////////////////////////////////////////////////////////////////// 90 91 extern spin_lock_t _bdv_lock; 92 extern unsigned int _bdv_status; 93 extern unsigned int _bdv_gtid; 94 94 95 95 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_drivers/cma_driver.c
r448 r456 9 9 #include <hard_config.h> 10 10 #include <utils.h> 11 #include <tty0.h> 11 12 12 13 #if !defined(SEG_CMA_BASE) … … 66 67 unsigned int status = _cma_get_register( channel, CHBUF_STATUS ); 67 68 69 _puts("\n[CMA WARNING] IRQ received for CMA channel "); 70 _putd( channel ); 71 _puts(" blocked at cycle "); 72 _putd( _get_proctime() ); 73 _puts("\nreset the CMA channel : "); 74 68 75 if (status == CHANNEL_SRC_DESC_ERROR ) 69 _printf("\n[CMA WARNING] CMA channel %d blocked at cycle %d : " 70 "impossible access to source chbuf descriptor\n", 71 channel, _get_proctime() ); 76 _puts("impossible access to source chbuf descriptor\n"); 72 77 73 78 else if (status == CHANNEL_SRC_DATA_ERROR ) 74 _printf("\n[CMA WARNING] CMA channel %d blocked at cycle %d : " 75 "impossible access to source data buffer\n", 76 channel, _get_proctime() ); 79 _puts("impossible access to source data buffer\n"); 77 80 78 81 else if (status == CHANNEL_DST_DESC_ERROR ) 79 _printf("\n[CMA WARNING] CMA channel %d blocked at cycle %d : " 80 "impossible access to destination chbuf descriptor\n", 81 channel, _get_proctime() ); 82 _puts("impossible access to destination chbuf descriptor\n"); 82 83 83 84 else if (status == CHANNEL_DST_DATA_ERROR ) 84 _printf("\n[CMA WARNING] CMA channel %d blocked at cycle %d : " 85 "impossible access to destination data buffer\n", 86 channel, _get_proctime() ); 85 _puts("impossible access to destination data buffer\n"); 87 86 88 87 else 89 _printf("\n[CMA WARNING] CMA channel %d : " 90 "... strange IRQ received, but channel not blocked...", 91 channel, _get_proctime() ); 88 _puts("strange, because channel is not blocked..."); 92 89 93 // acknowledge IRQ 90 // acknowledge IRQ and desactivates channel 94 91 _cma_set_register( channel, CHBUF_RUN, 0 ); 95 92 } -
soft/giet_vm/giet_drivers/dma_driver.c
r437 r456 9 9 #include <hard_config.h> 10 10 #include <dma_driver.h> 11 #include <tty _driver.h>11 #include <tty0.h> 12 12 #include <vmem.h> 13 13 #include <utils.h> -
soft/giet_vm/giet_drivers/hba_driver.c
r437 r456 16 16 #include <ioc_driver.h> 17 17 #include <utils.h> 18 #include <tty _driver.h>18 #include <tty0.h> 19 19 #include <iob_driver.h> 20 20 #include <ctx_handler.h> -
soft/giet_vm/giet_drivers/ioc_driver.c
r437 r456 25 25 #include <rdk_driver.h> 26 26 #include <utils.h> 27 #include <tty _driver.h>27 #include <tty0.h> 28 28 #include <iob_driver.h> 29 29 #include <ctx_handler.h> -
soft/giet_vm/giet_drivers/mmc_driver.c
r437 r456 8 8 #include <giet_config.h> 9 9 #include <mmc_driver.h> 10 #include <tty _driver.h>10 #include <tty0.h> 11 11 #include <utils.h> 12 12 #include <io.h> … … 37 37 38 38 /////////////////////////////////////////////////////////////////////////////// 39 // This low level function returns the value contained in register "index" 39 // This low level function returns the value contained in register 40 // defined by the ("func" / "index") arguments, 40 41 // in the MMC component contained in cluster "cluster_xy" 41 42 /////////////////////////////////////////////////////////////////////////////// … … 54 55 55 56 /////////////////////////////////////////////////////////////////////////////// 56 // This low level function sets a new value in register "index" 57 // This low level function sets a new value in register 58 // defined by the ("func" / "index") arguments, 57 59 // in the MMC component contained in cluster "cluster_xy" 58 60 /////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_drivers/mwr_driver.c
r437 r456 20 20 #include <mwr_driver.h> 21 21 #include <utils.h> 22 #include <tty0.h> 22 23 23 24 #if !defined(X_SIZE) -
soft/giet_vm/giet_drivers/nic_driver.c
r448 r456 10 10 #include <cma_driver.h> 11 11 #include <utils.h> 12 #include <tty0.h> 12 13 #include <ctx_handler.h> 13 14 #include <vmem.h> … … 49 50 #endif 50 51 51 #if !defined( GIET_NIC_ CHBUF_NBUFS )52 # error: You must define GIET_NIC_ CHBUF_NBUFS in the giet_config.h file53 #endif 54 55 #if !defined( GIET_NIC_ CHBUF_SIZE )56 # error: You must define GIET_NIC_ CHBUF_SIZE in the giet_config.h file57 #endif 58 59 #if !defined( GIET_NIC_ CHBUF_TIMEOUT )60 # error: You must define GIET_NIC_ CHBUF_TIMEOUT in the giet_config.h file52 #if !defined( GIET_NIC_NBUFS ) 53 # error: You must define GIET_NIC_NBUFS in the giet_config.h file 54 #endif 55 56 #if !defined( GIET_NIC_BUFSIZE ) 57 # error: You must define GIET_NIC_BUFSIZE in the giet_config.h file 58 #endif 59 60 #if !defined( GIET_NIC_TIMEOUT ) 61 # error: You must define GIET_NIC_TIMEOUT in the giet_config.h file 61 62 #endif 62 63 … … 70 71 { 71 72 unsigned int* vaddr = (unsigned int*)SEG_NIC_BASE + 72 NIC_CHANNEL_SPAN * channel + index;73 NIC_CHANNEL_SPAN * channel + 0x1000 + index; 73 74 return _io_extended_read( vaddr ); 74 75 } … … 82 83 { 83 84 unsigned int* vaddr = (unsigned int*)SEG_NIC_BASE + 84 NIC_CHANNEL_SPAN * channel + index;85 NIC_CHANNEL_SPAN * channel + 0x1000 + index; 85 86 _io_extended_write( vaddr, value ); 86 87 } … … 92 93 { 93 94 unsigned int* vaddr = (unsigned int*)SEG_NIC_BASE + 94 NIC_CHANNEL_SPAN * NB_NIC_CHANNELS+ index;95 NIC_CHANNEL_SPAN * 8 + index; 95 96 return _io_extended_read( vaddr ); 96 97 } … … 103 104 { 104 105 unsigned int* vaddr = (unsigned int*)SEG_NIC_BASE + 105 NIC_CHANNEL_SPAN * NB_NIC_CHANNELS+ index;106 NIC_CHANNEL_SPAN * 8 + index; 106 107 _io_extended_write( vaddr, value ); 107 108 } 108 109 109 110 //////////////////////////////////////////// 110 int _nic_global_init( unsigned int channels, 111 unsigned int vis, 112 unsigned int bc_enable, 113 unsigned int bypass_enable ) 114 { 115 _nic_set_global_register( NIC_G_VIS , vis ); 116 _nic_set_global_register( NIC_G_NB_CHAN , channels ); 111 int _nic_global_init( unsigned int bc_enable, 112 unsigned int bypass_enable, 113 unsigned int tdm_enable, 114 unsigned int tdm_period ) 115 { 117 116 _nic_set_global_register( NIC_G_BC_ENABLE , bc_enable ); 118 117 _nic_set_global_register( NIC_G_BYPASS_ENABLE, bypass_enable ); 119 _nic_set_global_register( NIC_G_ON , 1 ); 118 _nic_set_global_register( NIC_G_TDM_ENABLE , tdm_enable ); 119 _nic_set_global_register( NIC_G_TDM_PERIOD , tdm_period ); 120 _nic_set_global_register( NIC_G_VIS , 0 ); // channels activated later 121 _nic_set_global_register( NIC_G_ON , 1 ); 120 122 121 123 return 0; … … 128 130 unsigned int mac2 ) 129 131 { 132 unsigned int vis = _nic_get_global_register( NIC_G_VIS ); 133 vis |= (0x1 << channel ); 134 135 _nic_set_global_register( NIC_G_MAC_4 + channel, mac4 ); 136 _nic_set_global_register( NIC_G_MAC_2 + channel, mac2 ); 137 _nic_set_global_register( NIC_G_VIS , vis ); 138 130 139 unsigned int base = SEG_NIC_BASE; 131 140 unsigned int extend = (X_IO << Y_WIDTH) + Y_IO; … … 133 142 if ( is_rx ) 134 143 { 135 _nic_set_channel_register( channel, NIC_RX_DESC_LO_0 + 4096, base);136 _nic_set_channel_register( channel, NIC_RX_DESC_LO_1 + 4096, base + 0x1000 );137 _nic_set_channel_register( channel, NIC_RX_DESC_HI_0 , extend);138 _nic_set_channel_register( channel, NIC_RX_DESC_HI_1 , extend);139 _nic_set_channel_register( channel, NIC_RX_RUN , 1);144 _nic_set_channel_register( channel, NIC_RX_DESC_LO_0, base ); 145 _nic_set_channel_register( channel, NIC_RX_DESC_LO_1, base + 0x1000 ); 146 _nic_set_channel_register( channel, NIC_RX_DESC_HI_0, extend ); 147 _nic_set_channel_register( channel, NIC_RX_DESC_HI_1, extend ); 148 _nic_set_channel_register( channel, NIC_RX_RUN , 1 ); 140 149 } 141 150 else 142 151 { 143 _nic_set_channel_register( channel, NIC_TX_DESC_LO_0 + 4096, base + 0x2000 );144 _nic_set_channel_register( channel, NIC_TX_DESC_LO_1 + 4096, base + 0x3000 );145 _nic_set_channel_register( channel, NIC_TX_DESC_HI_0 , extend);146 _nic_set_channel_register( channel, NIC_TX_DESC_HI_1 , extend);147 _nic_set_channel_register( channel, NIC_TX_RUN , 1);152 _nic_set_channel_register( channel, NIC_TX_DESC_LO_0, base + 0x2000 ); 153 _nic_set_channel_register( channel, NIC_TX_DESC_LO_1, base + 0x3000 ); 154 _nic_set_channel_register( channel, NIC_TX_DESC_HI_0, extend ); 155 _nic_set_channel_register( channel, NIC_TX_DESC_HI_1, extend ); 156 _nic_set_channel_register( channel, NIC_TX_RUN , 1 ); 148 157 } 149 158 150 _nic_set_channel_register( channel, NIC_MAC_4 , mac4 );151 _nic_set_channel_register( channel, NIC_MAC_2 , mac2 );152 153 159 return 0; 154 160 } -
soft/giet_vm/giet_drivers/nic_driver.h
r448 r456 39 39 /////////////////////////////////////////////////////////////////////////////////// 40 40 41 enum SoclibMultiNicHyper viseurRegisters {41 enum SoclibMultiNicHyperRegisters { 42 42 NIC_G_VIS = 0, // bitfield : bit N = 0 -> channel N disabled 43 43 NIC_G_ON = 1, // boolean : NIC component activated 44 NIC_G_NB_CHAN = 2, // Number of channels present in this NIC(read only)44 NIC_G_NB_CHAN = 2, // Number of channels (read only) 45 45 NIC_G_BC_ENABLE = 3, // boolean : Enable Broadcast if non zero 46 46 NIC_G_TDM_ENABLE = 4, // boolean : TDM Scheduler if non zero … … 57 57 NIC_G_NPKT_RX_DES_TOO_SMALL = 35, // number of discarded too small RX packets (<60B) 58 58 NIC_G_NPKT_RX_DES_TOO_BIG = 36, // number of discarded too big RX packets (>1514B) 59 NIC_G_NPKT_RX_DES_MFIFO_FULL = 37, // number of discarded RX packets becausefifo full60 NIC_G_NPKT_RX_DES_CRC_FAIL = 38, // number of discarded RX packets becauseCRC32 failure59 NIC_G_NPKT_RX_DES_MFIFO_FULL = 37, // number of discarded RX packets fifo full 60 NIC_G_NPKT_RX_DES_CRC_FAIL = 38, // number of discarded RX packets CRC32 failure 61 61 62 62 NIC_G_NPKT_RX_DISPATCH_RECEIVED = 39, // number of packets received by RX_DISPATCH FSM 63 63 NIC_G_NPKT_RX_DISPATCH_BROADCAST = 40, // number of broadcast RX packets received 64 NIC_G_NPKT_RX_DISPATCH_DST_FAIL = 41, // number of discarded RX packets forDST MAC not found64 NIC_G_NPKT_RX_DISPATCH_DST_FAIL = 41, // number of discarded RX packets DST MAC not found 65 65 NIC_G_NPKT_RX_DISPATCH_CH_FULL = 42, // number of discarded RX packets for channel full 66 66 … … 68 68 NIC_G_NPKT_TX_DISPATCH_TOO_SMALL = 44, // number of discarded too small TX packets (<60B) 69 69 NIC_G_NPKT_TX_DISPATCH_TOO_BIG = 45, // number of discarded too big TX packets (>1514B) 70 NIC_G_NPKT_TX_DISPATCH_SRC_FAIL = 46, // number of discarded TX packets forSRC MAC failed70 NIC_G_NPKT_TX_DISPATCH_SRC_FAIL = 46, // number of discarded TX packets SRC MAC failed 71 71 NIC_G_NPKT_TX_DISPATCH_BROADCAST = 47, // number of broadcast TX packets received 72 72 NIC_G_NPKT_TX_DISPATCH_BYPASS = 48, // number of bypassed TX->RX packets … … 103 103 /////////////////////////////////////////////////////////////////////////////////// 104 104 105 extern int _nic_global_init( unsigned int channels, 106 unsigned int vis, 107 unsigned int bc_enable, 108 unsigned int bypass_enable ); 105 extern unsigned int _nic_get_channel_register( unsigned int channel, 106 unsigned int index ); 107 108 extern void _nic_set_channel_register( unsigned int channel, 109 unsigned int index, 110 unsigned int value ); 111 112 extern unsigned int _nic_get_global_register( unsigned int index ); 113 114 extern void _nic_set_global_register( unsigned int index, 115 unsigned int value ); 116 117 extern int _nic_global_init( unsigned int bc_enable, 118 unsigned int bypass_enable, 119 unsigned int tdm_enable, 120 unsigned int tdm_period ); 109 121 110 122 extern int _nic_channel_start( unsigned int channel, -
soft/giet_vm/giet_drivers/rdk_driver.c
r437 r456 11 11 #include <rdk_driver.h> 12 12 #include <utils.h> 13 #include <tty0.h> 13 14 14 15 #if !defined(SEG_RDK_BASE) -
soft/giet_vm/giet_drivers/sdc_driver.c
r437 r456 8 8 #include <hard_config.h> 9 9 #include <sdc_driver.h> 10 #include <tty _driver.h>10 #include <tty0.h> 11 11 #include <utils.h> 12 12 -
soft/giet_vm/giet_drivers/spi_driver.c
r437 r456 5 5 // Copyright (c) UPMC-LIP6 6 6 /////////////////////////////////////////////////////////////////////////////////// 7 7 8 #include <spi_driver.h> 8 9 #include <utils.h> 10 #include <tty0.h> 9 11 10 12 /////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_drivers/tim_driver.c
r437 r456 10 10 #include <tim_driver.h> 11 11 #include <utils.h> 12 #include <tty0.h> 12 13 13 14 #if !defined(SEG_TIM_BASE) -
soft/giet_vm/giet_drivers/tty_driver.c
r437 r456 12 12 #include <ctx_handler.h> 13 13 #include <utils.h> 14 #include <tty0.h> 14 15 15 16 #if !defined(SEG_TTY_BASE) … … 21 22 #endif 22 23 23 #if !defined(GIET_NO_HARD_CC)24 # error: You must define GIET_NO_HARD_CC in the giet_config.h file24 #if (NB_TTY_CHANNELS == 0) 25 # error: The NB_TTY_CHANNELS in the hard_config.h file cannot be 0 25 26 #endif 26 27 27 #if (NB_TTY_CHANNELS < 1) 28 # error: NB_TTY_CHANNELS cannot be smaller than 1! 29 #endif 28 //////////////////////////////////////////////////////////////////////////////////// 29 // global variables 30 //////////////////////////////////////////////////////////////////////////////////// 30 31 31 ////////////////////////////////////////////////////////////////////////////// 32 // global variables 33 ////////////////////////////////////////////////////////////////////////////// 32 simple_lock_t _tty_tx_lock[NB_TTY_CHANNELS] __attribute__((aligned(64))); 34 33 35 #define in_unckdata __attribute__((section (".unckdata"))) 36 #define in_kdata __attribute__((section (".kdata"))) 34 unsigned int _tty_rx_buf[NB_TTY_CHANNELS]; 35 unsigned int _tty_rx_full[NB_TTY_CHANNELS]; 37 36 38 #if GIET_NO_HARD_CC 39 in_unckdata volatile unsigned int _tty_rx_buf[NB_TTY_CHANNELS]; 40 in_unckdata volatile unsigned int _tty_rx_full[NB_TTY_CHANNELS]; 41 in_unckdata giet_lock_t _tty_lock[NB_TTY_CHANNELS] __attribute__((aligned(64))); 42 #else 43 in_kdata volatile unsigned int _tty_rx_buf[NB_TTY_CHANNELS]; 44 in_kdata volatile unsigned int _tty_rx_full[NB_TTY_CHANNELS]; 45 in_kdata giet_lock_t _tty_lock[NB_TTY_CHANNELS] __attribute__((aligned(64))); 46 #endif 47 48 ////////////////////////////////////////////////////////////////////////////// 37 //////////////////////////////////////////////////////////////////////////////////// 49 38 // access functions 50 ////////////////////////////////////////////////////////////////////////////// 39 //////////////////////////////////////////////////////////////////////////////////// 51 40 52 41 ///////////////////////////////////////////////////// … … 67 56 } 68 57 58 ////////////////////////////////////// 59 void _tty_init( unsigned int channel ) 60 { 61 _tty_rx_full[channel] = 0; 62 } 69 63 70 64 //////////////////////////////////////// -
soft/giet_vm/giet_drivers/tty_driver.h
r437 r456 24 24 #define _GIET_TTY_DRIVERS_H_ 25 25 26 #include <utils.h>26 #include "locks.h" 27 27 28 28 /////////////////////////////////////////////////////////////////////////////////// … … 40 40 }; 41 41 42 /////////////////////////////////////////////////////////////////////////////////// 43 // external variables44 /////////////////////////////////////////////////////////////////////////////////// 42 //////////////////////////////////////////////////////////////////////////////////// 43 // global variables 44 //////////////////////////////////////////////////////////////////////////////////// 45 45 46 extern volatile unsigned int _tty_rx_buf[];46 extern simple_lock_t _tty_tx_lock[]; 47 47 48 extern volatile unsigned int _tty_rx_full[]; 49 50 extern giet_lock_t _tty_lock[]; 48 extern unsigned int _tty_rx_buf[]; 49 extern unsigned int _tty_rx_full[]; 51 50 52 51 ////////////////////////////////////////////////////////////////////////////////// … … 61 60 unsigned int value ); 62 61 63 /////////////////////////////////////////////////////////////////////////////////// 62 extern void _tty_init( unsigned int channel ); 63 64 ////////////////////////////////////////////////////////////////////////////////// 64 65 // Interrupt Service Routine 65 66 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_drivers/xcu_driver.c
r437 r456 9 9 #include <giet_config.h> 10 10 #include <xcu_driver.h> 11 #include <tty _driver.h>11 #include <tty0.h> 12 12 #include <mapping_info.h> 13 13 #include <utils.h>
Note: See TracChangeset
for help on using the changeset viewer.