OpenCores
URL https://opencores.org/ocsvn/pcie_ds_dma/pcie_ds_dma/trunk

Subversion Repositories pcie_ds_dma

[/] [pcie_ds_dma/] [trunk/] [soft/] [linux/] [application/] [adm_test/] [src/] [work/] [tf_teststrm.cpp] - Diff between revs 23 and 27

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 23 Rev 27
Line 9... Line 9...
#include <sys/stat.h>
#include <sys/stat.h>
#include <pthread.h>
#include <pthread.h>
#include "utypes.h"
#include "utypes.h"
#include "tf_teststrm.h"
#include "tf_teststrm.h"
#include "cl_ambpex.h"
#include "cl_ambpex.h"
 
#include "sys/time.h"
 
 
#define BUFSIZEPKG 62
#define BUFSIZEPKG 62
 
 
#define TRDIND_MODE0                                    0x0
#define TRDIND_MODE0                                    0x0
#define TRDIND_MODE1                                    0x9
#define TRDIND_MODE1                                    0x9
Line 28... Line 29...
#define TRDIND_CONTROL1                                 0x17
#define TRDIND_CONTROL1                                 0x17
#define TRDIND_DELAY_CTRL                               0x1F
#define TRDIND_DELAY_CTRL                               0x1F
 
 
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
 
 
int GetTickCount(void)
long GetTickCount(void)
{
{
    return time( NULL);
 //   return time( NULL);
 
    struct timeval tv;
 
    struct timezone tz;
 
    gettimeofday(&tv, &tz);
 
    long ret=tv.tv_sec*1000 + tv.tv_usec/1000;
 
    return ret;
}
}
 
 
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
 
 
TF_TestStrm::TF_TestStrm( char* fname,  CL_AMBPEX *pex )
TF_TestStrm::TF_TestStrm( char* fname,  CL_AMBPEX *pex )
Line 136... Line 142...
    rd0.testBuf.check_result( &rd0.BlockOk , &rd0.BlockError, NULL, NULL, NULL );
    rd0.testBuf.check_result( &rd0.BlockOk , &rd0.BlockError, NULL, NULL, NULL );
 
 
    U32 status = pBrd->RegPeekDir( rd0.trd, 0 ) & 0xFFFF;
    U32 status = pBrd->RegPeekDir( rd0.trd, 0 ) & 0xFFFF;
 
 
    U32 cnt_rd=rd0.BlockRd;
    U32 cnt_rd=rd0.BlockRd;
    if( isRestart )
 
        cnt_rd = cntRestart;
 
 
 
    BRDC_fprintf( stderr, "%6s %3d %10d %10d %10d %10d  %9.1f %10.1f     0x%.4X  %d %4d\r", "TRD :", rd0.trd, rd0.BlockWr, cnt_rd, rd0.BlockOk, rd0.BlockError, rd0.VelocityCurrent, rd0.VelocityAvarage, status, IsviStatus, IsviCnt );
    long currentTime = GetTickCount();
 
    int min, sec_all, sec;
 
    sec_all= currentTime-rd0.time_start;
 
    sec_all/=1000;
 
    sec=sec_all%60;
 
    min=sec_all/60;
 
 
 
 
 
 
 
 
 
    BRDC_fprintf( stderr, "%6s %3d %10d %10d %10d %10d  %9.1f %10.1f     0x%.4X       %u:%.2u \r", "TRD :", rd0.trd, rd0.BlockWr, cnt_rd, rd0.BlockOk, rd0.BlockError, rd0.VelocityCurrent, rd0.VelocityAvarage, status, min, sec );
 
 
    if( isSystemMonitor )
    if( isSystemMonitor )
    {
    {
        unsigned temp;
        unsigned temp;
        float ty;
        float ty;
Line 171... Line 185...
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
 
 
void TF_TestStrm::GetResult( void )
void TF_TestStrm::GetResult( void )
{
{
    BRDC_fprintf( stderr, "\n\nResult of receiving data from trd %d \n", trdNo );
    BRDC_fprintf( stderr, "\n\nResult of receiving data from trd %d \n", trdNo );
    if(rd0.BlockRd!=0 && rd0.BlockError!=0)
 
        printf("%s\n", rd0.testBuf.report_word_error());
    BRDC_fprintf( stderr, "\n Recieved blocks :   %d \n",  rd0.BlockRd );
 
    BRDC_fprintf( stderr,   " Correct blocks  :   %d \n",  rd0.BlockOk );
 
    BRDC_fprintf( stderr,   " Incorrect blocks:   %d \n",  rd0.BlockError );
 
    BRDC_fprintf( stderr,   " Total errors    :   %d \n\n", rd0.TotalError );
 
    BRDC_fprintf( stderr,   " Speed           :   %.1f [Mbytes/s] \n", rd0.VelocityAvarage );
 
 
 
    long currentTime = GetTickCount();
 
    int min, sec_all, sec;
 
    sec_all= currentTime-rd0.time_start;
 
    sec_all/=1000;
 
    sec=sec_all%60;
 
    min=sec_all/60;
 
 
 
    BRDC_fprintf( stderr,   " Time of test    :   %d min %.2d sec\n\n", min, sec );
 
 
 
 
 
    if(rd0.BlockRd!=0 && rd0.BlockError==0)
 
    {
 
        BRDC_fprintf( stderr,"All data is correct. No error\n" );
 
    } else if( rd0.BlockRd==0 )
 
    {
 
        BRDC_fprintf( stderr,"Error - data is not received \n" );
 
 
 
    } else
 
    {
 
        BRDC_fprintf( stderr,"List of error:\n" );
 
        BRDC_fprintf( stderr,"%s\n", rd0.testBuf.report_word_error());
 
    }
 
 
    BRDC_fprintf( stderr, "\n\n" );
    BRDC_fprintf( stderr, "\n\n" );
}
}
 
 
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
Line 304... Line 345...
 
 
    if( isAdmReg2 ) {
    if( isAdmReg2 ) {
        PrepareAdmReg( fnameAdmReg2 );
        PrepareAdmReg( fnameAdmReg2 );
    }
    }
 
 
    pBrd->RegPokeInd( 4, 0, 0x2038 );
 
 
 
    rd0.time_last=rd0.time_start=GetTickCount();
    rd0.time_last=rd0.time_start=GetTickCount();
 
 
 
    isDmaStart=1;
 
 
    for( ; ; )
    for( ; ; )
    {
    {
        if( Terminate )
        if( Terminate )
        {
        {
Line 383... Line 424...
            pr->freeCycle++;
            pr->freeCycle++;
            break;
            break;
        }
        }
    }
    }
 
 
    U32 currentTime = GetTickCount();
    long currentTime = GetTickCount();
    if( (currentTime - pr->time_last)>10 )
    if( (currentTime - pr->time_last)>4000 )
    {
    {
        float t1 = currentTime - pr->time_last;
        float t1 = currentTime - pr->time_last;
        float t2 = currentTime - pr->time_start;
        float t2 = currentTime - pr->time_start;
        float v = 1.0*(pr->BlockRd-pr->BlockLast)*SizeBlockOfBytes/t1;
        float v = 1000.0*(pr->BlockRd-pr->BlockLast)*SizeBlockOfBytes/t1;
        v/=1024*1024;
        v/=1024*1024;
        pr->VelocityCurrent=v;
        pr->VelocityCurrent=v;
 
 
        v = 1.0*(pr->BlockRd)*SizeBlockOfBytes/t2;
        v = 1000.0*(pr->BlockRd)*SizeBlockOfBytes/t2;
        v/=1024*1024;
        v/=1024*1024;
        pr->VelocityAvarage=v;
        pr->VelocityAvarage=v;
        pr->time_last = currentTime;
        pr->time_last = currentTime;
        pr->BlockLast = pr->BlockRd;
        pr->BlockLast = pr->BlockRd;
        pr->freeCycleZ=pr->freeCycle;
        pr->freeCycleZ=pr->freeCycle;
        pr->freeCycle=0;
        pr->freeCycle=0;
    }
    }
 
    //Sleep(1);
}
}
 
 
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
 
 
void TF_TestStrm::PrepareAdm( void )
void TF_TestStrm::PrepareAdm( void )
Line 627... Line 669...
 
 
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//! Подготовка TEST_CTRL
//! Подготовка TEST_CTRL
void TF_TestStrm::PrepareTestCtrl( void )
void TF_TestStrm::PrepareTestCtrl( void )
{
{
    BRDC_fprintf( stderr, "\nПодготовка тетрады TEST_CTRL\n" );
    BRDC_fprintf( stderr, "\nPrepare trd TEST_CTRL\n" );
 
 
    BlockMode = DataType <<8;
    BlockMode = DataType <<8;
    BlockMode |= DataFix <<7;
    BlockMode |= DataFix <<7;
 
 
    if( !isFifoRdy )
    if( !isFifoRdy )
Line 656... Line 698...
 
 
    pBrd->RegPokeInd( TRD_CTRL, REG_GEN_SIZE, val );
    pBrd->RegPokeInd( TRD_CTRL, REG_GEN_SIZE, val );
 
 
    if( block_mode & 0x80 )
    if( block_mode & 0x80 )
    {
    {
        BRDC_fprintf( stderr, "Используется сокращённая тестовая последовательность\r\n" );
        BRDC_fprintf( stderr, "Use a short test sequence\r\n" );
    } else
    } else
    {
    {
        BRDC_fprintf( stderr, "Используется полная тестовая последовательность\r\n" );
        BRDC_fprintf( stderr, "Use a full test sequence\r\n" );
    }
    }
 
 
 
 
    if( Cnt1 || Cnt2 )
    if( Cnt1 || Cnt2 )
    {
    {
        pBrd->RegPokeInd( TRD_CTRL, REG_GEN_CNT1, Cnt1 );
        pBrd->RegPokeInd( TRD_CTRL, REG_GEN_CNT1, Cnt1 );
        pBrd->RegPokeInd( TRD_CTRL, REG_GEN_CNT2, Cnt2 );
        pBrd->RegPokeInd( TRD_CTRL, REG_GEN_CNT2, Cnt2 );
        float sp=1907.348632812 * (Cnt1-1)/(Cnt1+Cnt2-2);
        float sp=1907.348632812 * (Cnt1-1)/(Cnt1+Cnt2-2);
        BRDC_fprintf( stderr, "Установлено ограничение скорости формирования потока:  %6.1f МБайт/с \r\n"
        BRDC_fprintf( stderr, "Set limit of speed:  %6.1f Mbytes/s \r\n"
                      "REG_CNT1=%d  REGH_CNT2=%d   \r\n", sp, Cnt1, Cnt2 );
                      "REG_CNT1=%d  REGH_CNT2=%d   \r\n", sp, Cnt1, Cnt2 );
        if( block_mode&0x1000 )
        if( block_mode&0x1000 )
        {
        {
            BRDC_fprintf( stderr, "Установлен режим без ожидания готовности FIFO\r\n\r\n" );
            BRDC_fprintf( stderr, "Set mode without wait of FIFO ready\r\n\r\n" );
        } else
        } else
        {
        {
            BRDC_fprintf( stderr, "Установлено ожидание готовности FIFO \r\n\r\n"        );
            BRDC_fprintf( stderr, "Set mode with wait of FIFO ready \r\n\r\n"        );
        }
        }
    }  else
    }  else
    {
    {
        pBrd->RegPokeInd( TRD_CTRL, REG_GEN_CNT1, 0 );
        pBrd->RegPokeInd( TRD_CTRL, REG_GEN_CNT1, 0 );
        pBrd->RegPokeInd( TRD_CTRL, REG_GEN_CNT2, 0 );
        pBrd->RegPokeInd( TRD_CTRL, REG_GEN_CNT2, 0 );
        BRDC_fprintf( stderr, "Установлено формирование потока на максимальной скорости: 1907 МБайт/с \r\n"
        BRDC_fprintf( stderr, "Set max speed of data transfer: 1907 Mbytes/s \r\n"
                      "Установлено ожидание готовности FIFO \r\n\r\n"        );
                      "Set mode with wait of FIFO ready \r\n\r\n"        );
    }
    }
}
}
 
 
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//! Запуск TestCtrl
//! Запуск TestCtrl

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.