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

Introducing support for RAMDISK in giet_tsar

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.