Changeset 297
- Timestamp:
- Mar 28, 2014, 10:48:51 AM (11 years ago)
- Location:
- soft/giet_vm
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/Makefile
r295 r297 11 11 ### partition sectors = 524832 12 12 13 MAP_XML = mappings/4c_ 4p_sort_leti_ext.xml13 MAP_XML = mappings/4c_1p_four_leti_ext.xml 14 14 15 15 ### Objects to be linked for kernel.elf -
soft/giet_vm/display/main.c
r295 r297 24 24 /////////////////////////////////////////// 25 25 fd = giet_fat_open( "misc/images.raw", 0 ); 26 if ( fd < 0 ) 27 { 28 giet_tty_printf("\n*** echec giet_fat_open for misc/images.raw at cycle %d\n", 29 giet_proctime() ); 30 giet_exit(); 31 } 32 else 33 { 34 giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", 35 giet_proctime() ); 36 } 26 if ( fd < 0 ) giet_exit("echec giet_fat_open for misc/images.raw"); 27 28 giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", 29 giet_proctime() ); 37 30 38 31 ///////////////////////////////////////// … … 40 33 { 41 34 // lecture image sur le disque 42 blocks = giet_fat_read( fd, buf, NBLOCKS, blocks_to_skip ); 43 if ( blocks != NBLOCKS ) 44 { 45 giet_tty_printf("\n*** echec giet_fat_read at cycle %d\n", 46 giet_proctime() ); 47 giet_exit(); 48 } 49 else 50 { 51 giet_tty_printf("\ngiet_fat_read for image %d completed at cycle %d \n", 52 (blocks_to_skip>>5), giet_proctime()); 53 } 35 giet_fat_read( fd, buf, NBLOCKS, blocks_to_skip ); 36 37 giet_tty_printf("\ngiet_fat_read for image %d completed at cycle %d \n", 38 (blocks_to_skip>>5), giet_proctime()); 54 39 55 40 // transfert vers le frame buffer 56 ko = giet_fb_sync_write( 0, buf, 128 * 128 ); 57 if ( ko ) 58 { 59 giet_tty_printf("\n*** echec giet_fb_sync_write at cycle %d\n", 60 giet_proctime() ); 61 giet_exit(); 62 } 63 else 64 { 65 giet_tty_printf("\ndisplay completed for image %d at cycle %d \n", 66 (blocks_to_skip>>5), giet_proctime()); 67 } 41 giet_fb_sync_write( 0, buf, 128 * 128 ); 42 43 giet_tty_printf("\ndisplay completed for image %d at cycle %d \n", 44 (blocks_to_skip>>5), giet_proctime()); 68 45 69 46 blocks_to_skip = blocks_to_skip + NBLOCKS; 70 47 } 71 48 72 giet_tty_printf("\n*** Tak display exit at cycle %d ***\n", giet_proctime()); 73 giet_exit(); 49 giet_exit("completed"); 74 50 } -
soft/giet_vm/display/main_cma.c
r295 r297 20 20 x, y, lpid, giet_proctime() ); 21 21 22 //////////////////////////////////////////23 22 fd = giet_fat_open( "misc/images.raw", 0 ); 24 if ( fd < 0 ) 25 { 26 giet_tty_printf("\n*** echec giet_fat_open for misc/images.raw at cycle %d\n", 27 giet_proctime() ); 28 giet_exit(); 29 } 30 else 31 { 32 giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", 33 giet_proctime() ); 34 } 23 if ( fd < 0 ) giet_exit("echec giet_fat_open for misc/images.raw"); 35 24 36 //////////////////////////////////////// 25 giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n", 26 giet_proctime() ); 27 37 28 giet_fb_cma_init( buf0, buf1, 128*128 ); 38 29 … … 42 33 while ( blocks_to_skip < 10 * NBLOCKS ) 43 34 { 44 ///////////////////////////////////////////////////45 35 giet_fat_read( fd, buf0, NBLOCKS, blocks_to_skip ); 46 36 … … 48 38 giet_proctime() ); 49 39 50 ///////////////////////51 40 giet_fb_cma_write( 0 ); 52 41 … … 56 45 blocks_to_skip = blocks_to_skip + NBLOCKS; 57 46 58 ///////////////////////////////////////////////////59 47 giet_fat_read( fd, buf1, NBLOCKS, blocks_to_skip ); 60 48 … … 62 50 giet_proctime() ); 63 51 64 ///////////////////////65 52 giet_fb_cma_write( 1 ); 66 53 … … 71 58 } 72 59 73 ///////////////////74 60 giet_fb_cma_stop(); 75 61 76 giet_tty_printf("\n*** Task display exit at cycle %d ***\n", giet_proctime()); 77 78 giet_exit(); 62 giet_exit("display completed"); 79 63 } -
soft/giet_vm/giet_drivers/bdv_driver.c
r295 r297 304 304 unsigned int lpid = procid % NB_PROCS_MAX; 305 305 306 // acknowledge WTI in local XCU if required 307 unsigned int value; 308 if ( irq_type == IRQ_TYPE_WTI ) _xcu_get_wti_value( cluster_xy, irq_id, &value ); 309 310 // save status in _bdv_status variable and reset IRQ 311 _bdv_status = _bdv_get_register( BLOCK_DEVICE_STATUS ); 306 // get BDV status (and reset IRQ) 307 unsigned int status = _bdv_get_register( BLOCK_DEVICE_STATUS ); 308 309 // check status: does nothing if IDLE or BUSY 310 if ( (status == BLOCK_DEVICE_IDLE) || 311 (status == BLOCK_DEVICE_BUSY) ) return; 312 313 // reset WTI in XCU if WTI type 314 if ( irq_type == IRQ_TYPE_WTI ) 315 { 316 unsigned int value; 317 _xcu_get_wti_value( cluster_xy, irq_id, &value ); 318 } 319 320 // save status in kernel buffer _bdv_status 321 _bdv_status = status; 312 322 313 323 // identify task waiting on BDV … … 315 325 unsigned int ltid = _bdv_gtid & 0xFFFF; 316 326 unsigned int remote_xy = rprocid / NB_PROCS_MAX; 327 328 // re-activates sleeping task 329 _set_task_slot( rprocid, // global processor index 330 ltid, // local task index on processor 331 CTX_RUN_ID, // CTX_RUN slot 332 1 ); // running 333 334 // requires a context switch for remote processor running the waiting task 335 _xcu_send_wti( remote_xy, // cluster index 336 lpid, // local processor index 337 0 ); // don't force context switch if not idle 317 338 318 339 #if GIET_DEBUG_IRQS // we don't take the TTY lock to avoid deadlock … … 343 364 #endif 344 365 345 // re-activates sleeping task346 _set_task_slot( rprocid, // global processor index347 ltid, // local task index on processor348 CTX_RUN_ID, // CTX_RUN slot349 1 ); // running350 351 // requires a context switch for remote processor running the waiting task352 _xcu_send_wti( remote_xy, // cluster index353 lpid, // local processor index354 0 ); // don't force context switch if not idle355 366 } 356 367 -
soft/giet_vm/giet_drivers/fbf_driver.c
r295 r297 258 258 { 259 259 // SYNC request for channel descriptor 260 _m emc_sync( desc_paddr, 32 );260 _mmc_sync( desc_paddr, 32 ); 261 261 } 262 262 … … 320 320 { 321 321 // INVAL L2 cache for the channel descriptor, 322 _m emc_inval( _fb_cma_desc_paddr[channel_id], 32 );322 _mmc_inval( _fb_cma_desc_paddr[channel_id], 32 ); 323 323 324 324 // INVAL L1 cache for the channel descriptor, … … 339 339 // SYNC request for the user buffer because 340 340 // this buffer will be read from XRAM by the CMA component 341 _m emc_sync( buf_paddr, _fb_cma_channel[channel_id].length );341 _mmc_sync( buf_paddr, _fb_cma_channel[channel_id].length ); 342 342 } 343 343 … … 356 356 // SYNC request for the channel descriptor, because 357 357 // it will be read in XRAM by the CMA component 358 _m emc_sync( _fb_cma_desc_paddr[channel_id], 32 );358 _mmc_sync( _fb_cma_desc_paddr[channel_id], 32 ); 359 359 } 360 360 -
soft/giet_vm/giet_drivers/ioc_driver.c
r295 r297 286 286 287 287 // L2 cache (only if IOB used) 288 if ( USE_IOB ) _m emc_inval( buf_paddr, length );288 if ( USE_IOB ) _mmc_inval( buf_paddr, length ); 289 289 } 290 290 else // memory read : update data caches … … 293 293 294 294 // L2 cache (only if IOB used) 295 if ( USE_IOB ) _m emc_sync( buf_paddr, length );295 if ( USE_IOB ) _mmc_sync( buf_paddr, length ); 296 296 } 297 297 -
soft/giet_vm/giet_drivers/mmc_driver.c
r295 r297 41 41 42 42 /////////////////////////////////////////////////////////////////////////////////// 43 // _memc_inval()44 43 // This function invalidates all cache lines covering a memory buffer defined 45 44 // by the physical base address, and the length. 46 45 // The buffer address MSB are used to compute the cluster index. 47 46 /////////////////////////////////////////////////////////////////////////////////// 48 void _m emc_inval( paddr_t buf_paddr,49 47 void _mmc_inval( paddr_t buf_paddr, 48 unsigned int buf_length ) 50 49 { 51 50 // compute cluster coordinates … … 78 77 } 79 78 /////////////////////////////////////////////////////////////////////////////////// 80 // _memc_sync()81 79 // This function copies to external RAM all cache lines covering a memory buffer 82 80 // defined by the physical base address, and the length, if they are dirty. 83 81 // The buffer address MSB are used to compute the cluster index. 84 82 /////////////////////////////////////////////////////////////////////////////////// 85 void _m emc_sync( paddr_t buf_paddr,86 83 void _mmc_sync( paddr_t buf_paddr, 84 unsigned int buf_length ) 87 85 { 88 86 // compute cluster coordinates … … 115 113 } 116 114 115 ////////////////////////////////////////////////////////////////////////////////// 116 // This ISR access the vci_mem_cache component to get the faulty physical 117 // address and the associated SRCID. It must also acknowledge the IRQ. 118 // 119 // TODO implement... 120 ////////////////////////////////////////////////////////////////////////////////// 121 void _mmc_isr( unsigned int irq_type, // should be HWI 122 unsigned int irq_id, // index returned by ICU 123 unsigned int channel ) // unused 124 { 125 _printf("[GIET ERROR] MMC IRQ received, but _mmc_isr() not implemented...\n"); 126 } 127 128 129 117 130 // Local Variables: 118 131 // tab-width: 4 -
soft/giet_vm/giet_drivers/mmc_driver.h
r258 r297 33 33 /////////////////////////////////////////////////////////////////////////////////// 34 34 35 extern void _m emc_inval( unsigned long long buf_paddr,36 35 extern void _mmc_inval( unsigned long long buf_paddr, 36 unsigned int buf_length ); 37 37 38 extern void _memc_sync( unsigned long long buf_paddr, 39 unsigned int buf_length); 38 extern void _mmc_sync( unsigned long long buf_paddr, 39 unsigned int buf_length); 40 41 extern void _mmc_isr( unsigned int irq_type, 42 unsigned int irq_id, 43 unsigned int channel ); 40 44 41 45 /////////////////////////////////////////////////////////////////////////////////// -
soft/giet_vm/giet_drivers/tty_driver.c
r295 r297 170 170 171 171 /////////////////////////////////////////////////////////////////////////////////// 172 // This ISR handles the IRQ signaling that the RX buffer is full.172 // This ISR handles the IRQ signaling that the RX buffer is not empty. 173 173 // IT can be an HWI or an SWI. 174 // There is one single multi_tty component controling all channels.175 174 // There is one communication buffer _tty_rx_buf[i] and one synchronisation 176 175 // variable _tty_rx_full[i] per channel. 177 // A character is lost if the buffer is full when the ISR is executed. 176 // Does nothing if the TTY_RX buffer is empty, or if the kernel buffer is full 177 // when the ISR is called. 178 178 /////////////////////////////////////////////////////////////////////////////////// 179 179 void _tty_rx_isr( unsigned int irq_type, // HWI / WTI … … 183 183 unsigned int cluster_xy = _get_procid() / NB_PROCS_MAX; 184 184 185 if ( irq_type == IRQ_TYPE_WTI ) // reset SWI in XCU if required 185 // get TTY status 186 unsigned int status = _tty_get_register( channel, TTY_STATUS ); 187 188 // check both TTY status and kernel buffer status: 189 // does nothing if kernel buffer full or tty_buffer empty 190 if ( ((status & 0x1) == 0) || 191 (_tty_rx_full[channel] != 0) ) return; 192 193 // reset WTI in XCU if WTI type 194 if ( irq_type == IRQ_TYPE_WTI ) 186 195 { 187 196 unsigned int value; 188 197 _xcu_get_wti_value( cluster_xy, irq_id, &value ); 189 198 } 190 191 // get character and reset TTY IRQ 192 _tty_rx_buf[channel] = _tty_get_register( channel, TTY_READ ); 199 200 // transfer character to kernel buffer and acknowledge TTY IRQ 201 _tty_rx_buf[channel] = _tty_get_register( channel, TTY_READ ); 202 203 // set kernel buffer status 204 asm volatile( "sync" ); 205 _tty_rx_full[channel] = 1; 193 206 194 207 #if GIET_DEBUG_IRQS // we don't take the TTY lock to avoid deadlock … … 209 222 #endif 210 223 211 // signals character available212 _tty_rx_full[channel] = 1;213 224 } 214 225 -
soft/giet_vm/giet_kernel/irq_handler.c
r294 r297 16 16 #include <nic_driver.h> 17 17 #include <cma_driver.h> 18 #include <mmc_driver.h> 18 19 #include <bdv_driver.h> 19 20 #include <dma_driver.h> … … 116 117 else if ( isr_type == ISR_NIC_TX ) _nic_tx_isr ( irq_type, irq_id, channel ); 117 118 else if ( isr_type == ISR_TIMER ) _timer_isr ( irq_type, irq_id, channel ); 119 else if ( isr_type == ISR_MMC ) _mmc_isr ( irq_type, irq_id, channel ); 118 120 else 119 121 { -
soft/giet_vm/giet_kernel/irq_handler.h
r294 r297 31 31 ISR_NIC_TX = 8, 32 32 ISR_CMA = 9, 33 ISR_MMC = 10, 33 34 }; 34 35 -
soft/giet_vm/hello/main.c
r295 r297 5 5 { 6 6 char byte; 7 unsigned int proc = giet_procid();8 9 7 unsigned int procid = giet_procid(); 10 8 unsigned int cluster_xy = procid/NB_PROCS_MAX;
Note: See TracChangeset
for help on using the changeset viewer.