This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320C6678: how to list and traverse all files in a host file system directory ?

Part Number: TMS320C6678

hi,

I am creating application logs on my laptop hosting a TMDSEVM6678LE   DSP .... I need to be able to list all log files and delete them on the host machine. On pc I use dirent.h to do the file system management job, on DSP I have no clue how that is possible.

Please let me know if you have any comments. 

Regards

  • Hi,

    As my understanding, there is no file system management on DSP, unless you port one and implement on DSP. But I think that is not your purpose, the best way is you manage the file on the host PC, not from DSP.

    Regards, Eric 

  • I meant how I can read list of files on the HOST machine from DSP (TMDSEVM6678LE   which is an evaluation module ... )

    fopen/fclose/fwrite does the task of creat/read/write files pretty perfectly (except it is slow a little ....)

    What I need to do is to traverse list of all files on specific folder on the HOST machine (my laptop) FROM DSP (TMDSEVM6678LE )... and remove some of the files if I need to ....

    sth like this ... 

    
    

    #ifndef COMPILER_TIC6000
    #include <dirent.h>
    #endif

    int loginit()
    {
    #ifndef COMPILER_TIC6000
        DIR *dir;
        struct dirent *ent;
        if ((dir = opendir (LOG_DIR)) != NULL) {
            char buf[256];
            while ((ent = readdir (dir)) != NULL) {
                sprintf(buf, "%s%s", LOG_DIR, ent->d_name);
                if (strcmp(ent->d_name, ".") != 0 && strcmp(ent->d_name, "..") != 0){
                    ASSERT_SHORT(remove(buf) == 0);
                }
            }
          closedir (dir);
          return 0;
        } else {
          perror ("loginit: could not open directory!");
          return -1;
        }
    #else
        return 0;
    #endif
    }
    

    Regards,

  • Hi,

    DSP is not design for such file system house keeping work. It is mainly a data processing work horse. We may use fread/fwrite to do some file I/O, it is very slow. We may host some file system like FATFS for USB or MMCSD, if the DSP HW and SW driver support this. 

    For DSP to operate the host PC's file system, like you mentioned opendir/readdir/, I don't think DSP understand those APIs. There is no such file system implementation on DSP, unless you find something (like FTAFS) and port to DSP.

    Regards, Eric

  • Thanks .... much appreciate the details ...