bufdma_rand.c 1.11 KB
#include "pi_util.h"
#include "pi_tests.h"

void IoTestBufDma(char *flashInitFileName,int verify)
{
    int dramSize;
    u32 dramStartAddr;
    char *s;
    unsigned int seed;
    int i;

    FILE *fp;
    
    do_keep_alive_socket(1);

    /* some log output settings hardcoded for now */
    Dflags |= DLOG | DSTATUS | DERROR;

    /* XXX: assume we're in secure mode */

    s = (char *)getenv("IOSIM_SEED");
    if(s==NULL){
        seed = getpid();
    }
    else{
        seed = atoi(s);
    }
    srand(seed);
    printf("Random Seed = %08x.\n",seed);

    s = (char *)getenv("IOSIM_ADDR");
    if(s==NULL){
        printf("IOSIM_ADDR not defined...\n");
        printf("Random PI Buffer DMA test: ");
        OUTPUT_TEST_PASSFAIL(TESTERROR);
        return;
    }
    dramStartAddr = (u32)atoi(s);

    s = (char *)getenv("IOSIM_MEM_SIZE");
    if(s==NULL){
        printf("IOSIM_MEM_SIZE not defined...\n");
        printf("Random PI Buffer DMA test: ");
        OUTPUT_TEST_PASSFAIL(TESTERROR);
        return;
    }
    dramSize = (u32)atoi(s);

    piBufDmaRand(dramStartAddr,dramSize,verify);

    do_keep_alive_socket(0);
}