Changeset 297 for soft/giet_vm


Ignore:
Timestamp:
Mar 28, 2014, 10:48:51 AM (11 years ago)
Author:
alain
Message:

Bug fix in both _tty_rx_isr() and _bdv_isr():
The ISR must do nothing it the status indicates that
there is no pending ISR.

Location:
soft/giet_vm
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/Makefile

    r295 r297  
    1111### partition sectors    = 524832
    1212
    13 MAP_XML      = mappings/4c_4p_sort_leti_ext.xml
     13MAP_XML      = mappings/4c_1p_four_leti_ext.xml
    1414
    1515### Objects to be linked for kernel.elf
  • soft/giet_vm/display/main.c

    r295 r297  
    2424    ///////////////////////////////////////////
    2525    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() );
    3730
    3831    /////////////////////////////////////////
     
    4033    {
    4134        // 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());
    5439
    5540        // 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());
    6845
    6946        blocks_to_skip = blocks_to_skip + NBLOCKS;
    7047    }
    7148
    72     giet_tty_printf("\n*** Tak display exit at cycle %d ***\n", giet_proctime());
    73     giet_exit();
     49    giet_exit("completed");
    7450}
  • soft/giet_vm/display/main_cma.c

    r295 r297  
    2020                      x, y, lpid, giet_proctime() );
    2121
    22     //////////////////////////////////////////
    2322    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");
    3524
    36     ////////////////////////////////////////
     25    giet_tty_printf("\ngiet_fat_open completed for misc/images.raw at cycle %d\n",
     26                    giet_proctime() );
     27
    3728    giet_fb_cma_init( buf0, buf1, 128*128 );
    3829
     
    4233    while ( blocks_to_skip < 10 * NBLOCKS )
    4334    {
    44         ///////////////////////////////////////////////////
    4535        giet_fat_read( fd, buf0, NBLOCKS, blocks_to_skip );
    4636
     
    4838                            giet_proctime() );
    4939
    50         ///////////////////////
    5140        giet_fb_cma_write( 0 );
    5241
     
    5645        blocks_to_skip = blocks_to_skip + NBLOCKS;
    5746
    58         ///////////////////////////////////////////////////
    5947        giet_fat_read( fd, buf1, NBLOCKS, blocks_to_skip );
    6048
     
    6250                            giet_proctime() );
    6351
    64         ///////////////////////
    6552        giet_fb_cma_write( 1 );
    6653       
     
    7158    }
    7259
    73     ///////////////////
    7460    giet_fb_cma_stop();
    7561
    76     giet_tty_printf("\n*** Task display exit at cycle %d ***\n", giet_proctime());
    77 
    78     giet_exit();
     62    giet_exit("display completed");
    7963}
  • soft/giet_vm/giet_drivers/bdv_driver.c

    r295 r297  
    304304    unsigned int lpid       = procid % NB_PROCS_MAX;
    305305
    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;
    312322
    313323    // identify task waiting on BDV
     
    315325    unsigned int ltid       = _bdv_gtid & 0xFFFF;
    316326    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
    317338
    318339#if GIET_DEBUG_IRQS  // we don't take the TTY lock to avoid deadlock
     
    343364#endif
    344365
    345     // re-activates sleeping task
    346     _set_task_slot( rprocid,     // global processor index
    347                     ltid,        // local task index on processor
    348                     CTX_RUN_ID,  // CTX_RUN slot
    349                     1 );         // running
    350 
    351     // requires a context switch for remote processor running the waiting task
    352     _xcu_send_wti( remote_xy,    // cluster index
    353                    lpid,         // local processor index
    354                    0 );          // don't force context switch if not idle
    355366}
    356367
  • soft/giet_vm/giet_drivers/fbf_driver.c

    r295 r297  
    258258    {
    259259        // SYNC request for channel descriptor
    260         _memc_sync( desc_paddr, 32 );
     260        _mmc_sync( desc_paddr, 32 );
    261261    }
    262262
     
    320320        {
    321321            // INVAL L2 cache for the channel descriptor,
    322             _memc_inval( _fb_cma_desc_paddr[channel_id], 32 );
     322            _mmc_inval( _fb_cma_desc_paddr[channel_id], 32 );
    323323
    324324            // INVAL L1 cache for the channel descriptor,
     
    339339        // SYNC request for the user buffer because
    340340        // this buffer will be read from XRAM by the CMA component
    341         _memc_sync( buf_paddr, _fb_cma_channel[channel_id].length );
     341        _mmc_sync( buf_paddr, _fb_cma_channel[channel_id].length );
    342342    }
    343343
     
    356356        // SYNC request for the channel descriptor, because
    357357        // it will be read in XRAM by the CMA component
    358         _memc_sync( _fb_cma_desc_paddr[channel_id], 32 );
     358        _mmc_sync( _fb_cma_desc_paddr[channel_id], 32 );
    359359    }
    360360
  • soft/giet_vm/giet_drivers/ioc_driver.c

    r295 r297  
    286286
    287287        // L2 cache (only if IOB used)
    288         if ( USE_IOB ) _memc_inval( buf_paddr, length );
     288        if ( USE_IOB ) _mmc_inval( buf_paddr, length );
    289289    }
    290290    else         // memory read : update data caches
     
    293293
    294294        // L2 cache (only if IOB used)
    295         if ( USE_IOB ) _memc_sync( buf_paddr, length );
     295        if ( USE_IOB ) _mmc_sync( buf_paddr, length );
    296296    }
    297297
  • soft/giet_vm/giet_drivers/mmc_driver.c

    r295 r297  
    4141
    4242///////////////////////////////////////////////////////////////////////////////////
    43 // _memc_inval()
    4443// This function invalidates all cache lines covering a memory buffer defined
    4544// by the physical base address, and the length.
    4645// The buffer address MSB are used to compute the cluster index.
    4746///////////////////////////////////////////////////////////////////////////////////
    48 void _memc_inval( paddr_t      buf_paddr,
    49                   unsigned int buf_length )
     47void _mmc_inval( paddr_t      buf_paddr,
     48                 unsigned int buf_length )
    5049{
    5150    // compute cluster coordinates
     
    7877}
    7978///////////////////////////////////////////////////////////////////////////////////
    80 // _memc_sync()
    8179// This function copies to external RAM all cache lines covering a memory buffer
    8280// defined by the physical base address, and the length, if they are dirty.
    8381// The buffer address MSB are used to compute the cluster index.
    8482///////////////////////////////////////////////////////////////////////////////////
    85 void _memc_sync( paddr_t      buf_paddr,
    86                  unsigned int buf_length )
     83void _mmc_sync( paddr_t      buf_paddr,
     84                unsigned int buf_length )
    8785{
    8886    // compute cluster coordinates
     
    115113}
    116114
     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//////////////////////////////////////////////////////////////////////////////////
     121void _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
    117130// Local Variables:
    118131// tab-width: 4
  • soft/giet_vm/giet_drivers/mmc_driver.h

    r258 r297  
    3333///////////////////////////////////////////////////////////////////////////////////
    3434
    35 extern void _memc_inval( unsigned long long buf_paddr,
    36                          unsigned int buf_length );
     35extern void _mmc_inval( unsigned long long buf_paddr,
     36                        unsigned int buf_length );
    3737
    38 extern void _memc_sync(  unsigned long long buf_paddr,
    39                          unsigned int buf_length);
     38extern void _mmc_sync(  unsigned long long buf_paddr,
     39                        unsigned int buf_length);
     40
     41extern void _mmc_isr( unsigned int irq_type,
     42                      unsigned int irq_id,
     43                      unsigned int channel );
    4044
    4145///////////////////////////////////////////////////////////////////////////////////
  • soft/giet_vm/giet_drivers/tty_driver.c

    r295 r297  
    170170
    171171///////////////////////////////////////////////////////////////////////////////////
    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.
    173173// IT can be an HWI or an SWI.
    174 // There is one single multi_tty component controling all channels.
    175174// There is one communication buffer _tty_rx_buf[i] and one synchronisation
    176175// 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.
    178178///////////////////////////////////////////////////////////////////////////////////
    179179void _tty_rx_isr( unsigned int irq_type,   // HWI / WTI
     
    183183    unsigned int cluster_xy = _get_procid() / NB_PROCS_MAX;
    184184
    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 )
    186195    {
    187196        unsigned int value;
    188197        _xcu_get_wti_value( cluster_xy, irq_id, &value );
    189198    }
    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;
    193206
    194207#if GIET_DEBUG_IRQS  // we don't take the TTY lock to avoid deadlock
     
    209222#endif
    210223
    211     // signals character available
    212     _tty_rx_full[channel] = 1;
    213224}
    214225
  • soft/giet_vm/giet_kernel/irq_handler.c

    r294 r297  
    1616#include <nic_driver.h>
    1717#include <cma_driver.h>
     18#include <mmc_driver.h>
    1819#include <bdv_driver.h>
    1920#include <dma_driver.h>
     
    116117        else if ( isr_type == ISR_NIC_TX ) _nic_tx_isr ( irq_type, irq_id, channel );
    117118        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 );
    118120        else
    119121        {
  • soft/giet_vm/giet_kernel/irq_handler.h

    r294 r297  
    3131    ISR_NIC_TX  = 8,
    3232    ISR_CMA     = 9,
     33    ISR_MMC     = 10,
    3334};
    3435
  • soft/giet_vm/hello/main.c

    r295 r297  
    55{
    66        char                byte;
    7     unsigned int        proc = giet_procid();
    8 
    97    unsigned int    procid     = giet_procid();
    108    unsigned int    cluster_xy = procid/NB_PROCS_MAX;
Note: See TracChangeset for help on using the changeset viewer.