Changeset 631


Ignore:
Timestamp:
Feb 12, 2014, 1:42:52 PM (11 years ago)
Author:
alain
Message:

Introducing support for RAMDISK in giet_tsar

Location:
trunk/softs
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/softs/giet_tsar/stdio.c

    r629 r631  
    8787extern struct plouf seg_ioc_base;
    8888extern struct plouf seg_mmc_base;
     89extern struct plouf seg_ramdisk_base;
    8990
    9091////////////////////////////////////////////////////////////////////////////////////////
     
    915916//   BLOCK_DEVICE (IOC)
    916917//////////////////////////////////////////////////////////////////////////////////////////
     918// The block size is 512 bytes.
    917919// The functions below use the three variables _ioc_lock _ioc_done,
    918920// and _ioc_status for synchronisation.
     
    933935//  (x = X_SIZE-1 / y = Y_SIZE), which requires and extended address access.
    934936//  If USE_EXT_IO not set, we use the IOC contrÃŽler in cluster (0,0).
     937//
     938//  If USE_RAMDISK is set, we access a "virtual" block device controler  implemented
     939//  as a memory-mapped segment in cluster [0,0] at address seg_ramdisk_base.
     940//  The tranfer being fully synchronous, the IOC interrupt is not activated.
    935941///////////////////////////////////////////////////////////////////////////////////////
    936942
     
    967973    _ioc_get_lock();
    968974
    969     if ( USE_EXT_IO )   // extended addressing to cluster_io
     975    if ( USE_RAMDISK )  // we use an extended_memcpy
     976    {
     977        unsigned int  src_address = (unsigned int)buffer;
     978        unsigned int  src_cluster = ext;
     979        unsigned int  dst_address = (unsigned int)&seg_ramdisk_base + lba*512;
     980        unsigned int  dst_cluster = 0;
     981
     982        _extended_memcpy( dst_cluster,
     983                          dst_address,
     984                          src_cluster,
     985                          src_address,
     986                          count*512 );
     987       
     988        _ioc_status = BLOCK_DEVICE_WRITE_SUCCESS;
     989        _ioc_done   = 1;
     990    }
     991    else if ( USE_EXT_IO )   // extended addressing to cluster_io
    970992    {
    971993        unsigned int    cluster = ((X_SIZE-1)<<Y_WIDTH) + Y_SIZE;
     
    10071029    _ioc_get_lock();
    10081030
    1009     if ( USE_EXT_IO )   // extended addressing to cluster_io
     1031    if ( USE_RAMDISK )  // we use an extended_memcpy
     1032    {
     1033        unsigned int  dst_address = (unsigned int)buffer;
     1034        unsigned int  dst_cluster = ext;
     1035        unsigned int  src_address = (unsigned int)&seg_ramdisk_base + lba*512;
     1036        unsigned int  src_cluster = 0;
     1037
     1038        _extended_memcpy( dst_cluster,
     1039                          dst_address,
     1040                          src_cluster,
     1041                          src_address,
     1042                          count*512 );
     1043
     1044        _ioc_status = BLOCK_DEVICE_READ_SUCCESS;
     1045        _ioc_done   = 1;
     1046    }
     1047    else if ( USE_EXT_IO )   // extended addressing to cluster_io
    10101048    {
    10111049        unsigned int    cluster = ((X_SIZE-1)<<Y_WIDTH) + Y_SIZE;
     
    10811119
    10821120//////////////////////////////////////////////////////////////////////////////////////
    1083 //  This ISR must be executed when an IRQ is activated by MEMC to signal
    1084 //  an error detected by the TSAR memory cache after a write transaction.
    1085 //  It displays an error message on the TTY terminal allocated to the processor
    1086 //  executing the ISR.
    1087 //////////////////////////////////////////////////////////////////////////////////////
    1088 in_drivers void _mmc_isr()
    1089 {
    1090     int*         mmc_address = (int*)&seg_mmc_base;
    1091     unsigned int cluster_xy  = _procid() / NB_PROCS_MAX;
    1092    
    1093     _tty_printf( "WRITE ERROR signaled by Memory Cache in cluster %x\n", cluster_xy );
    1094 }
    1095 
    1096 //////////////////////////////////////////////////////////////////////////////////////
    10971121//  FRAME_BUFFER
    10981122//////////////////////////////////////////////////////////////////////////////////////
     
    11501174                      src_address,
    11511175                      length );
     1176}
     1177
     1178//////////////////////////////////////////////////////////////////////////////////////
     1179//  This ISR must be executed when an IRQ is activated by MEMC to signal
     1180//  an error detected by the TSAR memory cache after a write transaction.
     1181//  It displays an error message on the TTY terminal allocated to the processor
     1182//  executing the ISR.
     1183//////////////////////////////////////////////////////////////////////////////////////
     1184in_drivers void _mmc_isr()
     1185{
     1186    int*         mmc_address = (int*)&seg_mmc_base;
     1187    unsigned int cluster_xy  = _procid() / NB_PROCS_MAX;
     1188   
     1189    _tty_printf( "WRITE ERROR signaled by Memory Cache in cluster %x\n", cluster_xy );
    11521190}
    11531191
  • trunk/softs/soft_hello_giet/hard_config.h

    r629 r631  
    1212#define  Y_WIDTH             4
    1313
    14 #define  NB_PROCS_MAX        4
     14#define  NB_PROCS_MAX        1
    1515
    16 #define  USE_EXT_IO          1
     16#define  USE_RAMDISK         1
     17#define  USE_EXT_IO          0
    1718
    1819#define  NB_DMA_CHANNELS     0
     
    2122#define  NB_CMA_CHANNELS     0
    2223
    23 #define  NB_TTY_CHANNELS     4
     24#define  NB_TTY_CHANNELS     1
    2425
    2526#endif //_HARD_CONFIG_H
  • trunk/softs/soft_hello_giet/ldscript

    r629 r631  
    1010peripherals are not present in the architecture */
    1111
    12 seg_reset_base  = 0x00000000;       /* boot code */
     12seg_reset_base   = 0x00000000;       /* boot code                  */
    1313
    14 seg_kcode_base  = 0x00010000;       /* kernel code */
    15 seg_kdata_base  = 0x00020000;       /* kernel cacheable data */
    16 seg_kunc_base   = 0x00030000;       /* kernel uncacheable data */
     14seg_kcode_base   = 0x00010000;       /* kernel code                */
     15seg_kdata_base   = 0x00020000;       /* kernel cacheable data      */
     16seg_kunc_base    = 0x00030000;       /* kernel uncacheable data    */
    1717
    18 seg_code_base   = 0x00040000;       /* application code */
    19 seg_data_base   = 0x00050000;       /* application data */
     18seg_code_base    = 0x00040000;       /* application code            */
     19seg_data_base    = 0x00050000;       /* application data            */
    2020
    21 seg_heap_base   = 0x00100000;       /* heaps for application tasks */
    22 seg_stack_base  = 0x00300000;       /* stacks */
     21seg_heap_base    = 0x00100000;       /* heaps for applications      */
     22seg_stack_base   = 0x00300000;       /* stacks ifor applications    */
    2323
    24 seg_xcu_base    = 0xF0000000;       /* controler XCU */
    25 seg_tty_base    = 0xF4000000;       /* controler TTY */
    26 seg_fbf_base    = 0xF3000000;       /* controler FBF */
    27 seg_ioc_base    = 0xF2000000;       /* controler IOC */
    28 seg_nic_base    = 0xF7000000;       /* controler NIC */
    29 seg_cma_base    = 0xF8000000;       /* controler CMA */
    30 seg_pic_base    = 0xF9000000;       /* controler PIC */
    31 seg_mmc_base    = 0xE0000000;       /* config    MMC */
     24seg_ramdisk_base = 0x00800000;       /* virtual disk                */
     25
     26seg_xcu_base     = 0xF0000000;       /* controler XCU               */
     27seg_tty_base     = 0xF4000000;       /* controler TTY               */
     28seg_fbf_base     = 0xF3000000;       /* controler FBF               */
     29seg_ioc_base     = 0xF2000000;       /* controler IOC               */
     30seg_nic_base     = 0xF7000000;       /* controler NIC               */
     31seg_cma_base     = 0xF8000000;       /* controler CMA               */
     32seg_pic_base     = 0xF9000000;       /* controler PIC               */
     33seg_mmc_base     = 0xE0000000;       /* config    MMC               */
    3234
    3335
  • trunk/softs/soft_sort_giet/hard_config.h

    r629 r631  
    1212#define  Y_WIDTH             4
    1313
    14 #define  NB_PROCS_MAX        4
     14#define  NB_PROCS_MAX        1
    1515
    16 #define  USE_EXT_IO          1
     16#define  USE_RAMDISK         1
     17#define  USE_EXT_IO          0
    1718
    1819#define  NB_DMA_CHANNELS     0
     
    2122#define  NB_CMA_CHANNELS     0
    2223
    23 #define  NB_TTY_CHANNELS     4
     24#define  NB_TTY_CHANNELS     1
    2425
    2526#endif //_HARD_CONFIG_H
  • trunk/softs/soft_sort_giet/ldscript

    r629 r631  
    1010peripherals are not present in the architecture */
    1111
    12 seg_reset_base  = 0x00000000;       /* boot code */
     12seg_reset_base   = 0x00000000;       /* boot code                  */
    1313
    14 seg_kcode_base  = 0x00010000;       /* kernel code */
    15 seg_kdata_base  = 0x00020000;       /* kernel cacheable data */
    16 seg_kunc_base   = 0x00030000;       /* kernel uncacheable data */
     14seg_kcode_base   = 0x00010000;       /* kernel code                */
     15seg_kdata_base   = 0x00020000;       /* kernel cacheable data      */
     16seg_kunc_base    = 0x00030000;       /* kernel uncacheable data    */
    1717
    18 seg_code_base   = 0x00040000;       /* application code */
    19 seg_data_base   = 0x00050000;       /* application data */
     18seg_code_base    = 0x00040000;       /* application code            */
     19seg_data_base    = 0x00050000;       /* application data            */
    2020
    21 seg_heap_base   = 0x00100000;       /* heaps for application tasks */
    22 seg_stack_base  = 0x00300000;       /* stacks */
     21seg_heap_base    = 0x00100000;       /* heaps for applications      */
     22seg_stack_base   = 0x00300000;       /* stacks ifor applications    */
    2323
    24 seg_xcu_base    = 0xF0000000;       /* controler XCU */
    25 seg_tty_base    = 0xF4000000;       /* controler TTY */
    26 seg_fbf_base    = 0xF3000000;       /* controler FBF */
    27 seg_ioc_base    = 0xF2000000;       /* controler IOC */
    28 seg_nic_base    = 0xF7000000;       /* controler NIC */
    29 seg_cma_base    = 0xF8000000;       /* controler CMA */
    30 seg_pic_base    = 0xF9000000;       /* controler PIC */
    31 seg_mmc_base    = 0xE0000000;       /* config    MMC */
     24seg_ramdisk_base = 0x00800000;       /* virtual disk                */
     25
     26seg_xcu_base     = 0xF0000000;       /* controler XCU               */
     27seg_tty_base     = 0xF4000000;       /* controler TTY               */
     28seg_fbf_base     = 0xF3000000;       /* controler FBF               */
     29seg_ioc_base     = 0xF2000000;       /* controler IOC               */
     30seg_nic_base     = 0xF7000000;       /* controler NIC               */
     31seg_cma_base     = 0xF8000000;       /* controler CMA               */
     32seg_pic_base     = 0xF9000000;       /* controler PIC               */
     33seg_mmc_base     = 0xE0000000;       /* config    MMC               */
    3234
    3335
  • trunk/softs/soft_transpose_giet/ldscript

    r629 r631  
    1010peripherals are not present in the architecture */
    1111
    12 seg_reset_base  = 0x00000000;       /* boot code */
     12seg_reset_base   = 0x00000000;       /* boot code                  */
    1313
    14 seg_kcode_base  = 0x00010000;       /* kernel code */
    15 seg_kdata_base  = 0x00020000;       /* kernel cacheable data */
    16 seg_kunc_base   = 0x00030000;       /* kernel uncacheable data */
     14seg_kcode_base   = 0x00010000;       /* kernel code                */
     15seg_kdata_base   = 0x00020000;       /* kernel cacheable data      */
     16seg_kunc_base    = 0x00030000;       /* kernel uncacheable data    */
    1717
    18 seg_code_base   = 0x00040000;       /* application code */
    19 seg_data_base   = 0x00050000;       /* application data */
     18seg_code_base    = 0x00040000;       /* application code            */
     19seg_data_base    = 0x00050000;       /* application data            */
    2020
    21 seg_heap_base   = 0x00100000;       /* heaps for application tasks */
    22 seg_stack_base  = 0x00300000;       /* stacks */
     21seg_heap_base    = 0x00100000;       /* heaps for applications      */
     22seg_stack_base   = 0x00300000;       /* stacks ifor applications    */
    2323
    24 seg_xcu_base    = 0xF0000000;       /* controler XCU */
    25 seg_tty_base    = 0xF4000000;       /* controler TTY */
    26 seg_fbf_base    = 0xF3000000;       /* controler FBF */
    27 seg_ioc_base    = 0xF2000000;       /* controler IOC */
    28 seg_nic_base    = 0xF7000000;       /* controler NIC */
    29 seg_cma_base    = 0xF8000000;       /* controler CMA */
    30 seg_pic_base    = 0xF9000000;       /* controler PIC */
    31 seg_mmc_base    = 0xE0000000;       /* config    MMC */
     24seg_ramdisk_base = 0x00800000;       /* virtual disk                */
     25
     26seg_xcu_base     = 0xF0000000;       /* controler XCU               */
     27seg_tty_base     = 0xF4000000;       /* controler TTY               */
     28seg_fbf_base     = 0xF3000000;       /* controler FBF               */
     29seg_ioc_base     = 0xF2000000;       /* controler IOC               */
     30seg_nic_base     = 0xF7000000;       /* controler NIC               */
     31seg_cma_base     = 0xF8000000;       /* controler CMA               */
     32seg_pic_base     = 0xF9000000;       /* controler PIC               */
     33seg_mmc_base     = 0xE0000000;       /* config    MMC               */
    3234
    3335
  • trunk/softs/soft_transpose_giet/main.c

    r629 r631  
    88#define NP              128
    99#define NB_IMAGES       5
    10 
     10 
     11// Only processor 0 in each cluster access TTY
    1112#define PRINTF(...)      ({ if (lpid == 0) { _tty_printf(__VA_ARGS__); } })
    1213
    13 #define DISPLAY_OK
    14 
    15 // tricks to read parameters from ldscript
     14#define DISPLAY_OK          1   // enable display on frame buffer when non zero
     15#define CHECK_VERBOSE       1   // display a detailed check on TTY  when non zero
     16#define INSTRUMENTATION_OK  0   // display statistcs on TTY when non zero
     17
     18// tricks to read some addresses from ldscript
    1619extern struct plaf seg_ioc_base;
    1720extern struct plaf seg_heap_base;
     
    1922// global variables stored in seg_data (cluster 0)
    2023
    21 // instrumentation counters for each processor
     24// instrumentation counters (for each processor)
    2225unsigned int LOAD_START[256][4];
    2326unsigned int LOAD_END  [256][4];
     
    2730unsigned int DISP_END  [256][4];
    2831
    29 // checksum variables
     32// checksum variables (used by proc(0,0,0) only
    3033unsigned check_line_before[NL];
    3134unsigned check_line_after[NL];
     
    5861    unsigned int cluster_id  = (x * Y_SIZE) + y;               
    5962
    60     PRINTF("\n *** Proc 0 in cluster [%d,%d] enters main at cycle %d ***\n\n",
     63    PRINTF("\n *** Proc [%d,%d,0] enters main at cycle %d ***\n\n",
    6164           x, y, _proctime());
    6265
     
    9699   _barrier_init(3, ntasks);
    97100
    98    PRINTF("*** Proc 0 in cluster [%d,%d] completes barrier init at cycle %d\n",
     101   PRINTF("*** Proc [%d,%d,0] completes barrier init at cycle %d\n",
    99102          x, y, _proctime());
    100103
     
    109112      if (lpid == 0)
    110113      {
     114         PRINTF("\n*** Proc [%d,%d,0] starts load for image %d at cycle %d\n",
     115                x, y, image, _proctime() );
     116
    111117         _ioc_read( ((image * nblocks) + ((nblocks * cluster_id) / nclusters)),
    112118                    buf_in,
     
    114120                    cluster_xy );
    115121
    116          PRINTF("\n*** Proc 0 in cluster [%d,%d] starts load for image %d at cycle %d\n",
    117                 x, y, image, _proctime() );
    118 
    119122         _ioc_completed();
    120123
    121          PRINTF("*** Proc 0 in cluster [%d,%d] completes load for image %d at cycle %d\n",
     124         PRINTF("*** Proc [%d,%d,0] completes load for image %d at cycle %d\n",
    122125                x, y, image, _proctime() );
    123126      }
     
    131134      // (p,l) are the pixel coordinates in the source image
    132135
    133       PRINTF("\n*** proc 0 in cluster [%d,%d] starts transpose for image %d at cycle %d\n",
     136      PRINTF("\n*** proc [%d,%d,0] starts transpose for image %d at cycle %d\n",
    134137             x, y, image, _proctime());
    135138
     
    203206      }
    204207
    205       PRINTF("*** proc 0 in cluster [%d,%d] complete transpose for image %d at cycle %d\n",
     208      PRINTF("*** proc [%d,%d,0] complete transpose for image %d at cycle %d\n",
    206209             x, y, image, _proctime() );
    207210
     
    212215      // optional parallel display from local buf_out to frame buffer
    213216
    214 #ifdef DISPLAY_OK
    215 
    216       PRINTF("\n*** proc 0 in cluster [%d,%d] starts display for image %d at cycle %d\n",
    217              x, y, image, _proctime() );
    218 
    219       DISP_START[cluster_id][lpid] = _proctime();
    220 
    221       unsigned int npxt = npixels / ntasks;   // number of pixels per task
    222       unsigned int buffer = (unsigned int)buf_out + npxt*lpid;
    223 
    224       _fb_sync_write( npxt * task_id, buffer, npxt, cluster_xy );
    225 
    226       PRINTF("*** Proc 0 in cluster [%d,%d] completes display for image %d at cycle %d\n",
    227              x, y, image, _proctime() );
    228 
    229       DISP_END[cluster_id][lpid] = _proctime();
    230 
    231       _barrier_wait(2);
    232 
    233 #endif
    234 
    235       // Instrumentation and checksum (done by processor 0 in cluster 0)
    236       if (proc_id == 0)
    237       { 
    238          PRINTF("\n*** Proc [0,0,0] starts checks for image %d at cycle %d\n\n",
    239                   image, _proctime() );
     217      if ( DISPLAY_OK )
     218      {
     219          PRINTF("\n*** proc [%d,%d,0] starts display for image %d at cycle %d\n",
     220                 x, y, image, _proctime() );
     221
     222          DISP_START[cluster_id][lpid] = _proctime();
     223
     224          unsigned int npxt = npixels / ntasks;   // number of pixels per task
     225          unsigned int buffer = (unsigned int)buf_out + npxt*lpid;
     226
     227          _fb_sync_write( npxt * task_id, buffer, npxt, cluster_xy );
     228
     229          PRINTF("*** Proc [%d,%d,0] completes display for image %d at cycle %d\n",
     230                 x, y, image, _proctime() );
     231
     232          DISP_END[cluster_id][lpid] = _proctime();
     233
     234          _barrier_wait(2);
     235      }
     236
     237      // checksum (done by processor 0 in each cluster)
     238
     239      if ( lpid == 0 )
     240      {
     241         PRINTF("\n*** Proc [%d,%d,0] starts checks for image %d at cycle %d\n\n",
     242                x, y, image, _proctime() );
    240243
    241244         unsigned int success = 1;
    242 
    243          for ( l = 0 ; l < NL ; l++ )
     245         unsigned int start   = cluster_id * (NL / nclusters);
     246         unsigned int stop    = start + (NL / nclusters);
     247
     248         for ( l = start ; l < stop ; l++ )
    244249         {
    245250            check_line_after[l] = 0;
     
    258263            }
    259264
    260             PRINTF(" - l = %d / before = %d / after = %d \n",
    261                    l, check_line_before[l], check_line_after[l] );
     265            if( CHECK_VERBOSE )
     266            {
     267                PRINTF(" - l = %d / before = %d / after = %d \n",
     268                       l, check_line_before[l], check_line_after[l] );
     269            }
    262270
    263271            if ( check_line_before[l] != check_line_after[l] ) success = 0;
    264272         }
    265273
    266          if ( success ) PRINTF("\n*** proc [0,0,0] : CHECKSUM OK \n\n");
    267          else           PRINTF("\n*** proc [0,0,0] : CHECKSUM KO \n\n");
    268 
     274         if ( success ) PRINTF("\n*** proc [%d,%d,0] : CHECKSUM OK \n\n", x, y);
     275         else           PRINTF("\n*** proc [%d,%d,0] : CHECKSUM KO \n\n", x, y);
     276      }
     277
     278      // instrumentation ( done by processor [0,0,0]
     279
     280      if ( (proc_id == 0) && INSTRUMENTATION_OK )
     281      {
    269282         int cc, pp;
    270283         unsigned int min_load_start = INT_MAX;
Note: See TracChangeset for help on using the changeset viewer.