File system

Discussion to talk about software related topics only.
Post Reply
SeeCwriter
Posts: 606
Joined: Mon May 12, 2008 10:55 am

File system

Post by SeeCwriter »

I have run example program EFF-FPT on a MOD5441X, and it runs fine. But I'm trying to understand why/how the following snippet of code works.
In UserMain(), part of the initialization is this:

Code: Select all

   f_enterFS();

   // We now must also enter the file system for the FTP task
   OSChangePrio( FTP_PRIO );
   f_enterFS();
   OSChangePrio( MAIN_PRIO );
I understand that each task must call f_enterFS() in order to access the file system. What I don't understand is
why calling OSChangePrio() causes the following call to f_enterFS() to be part of the FTP Task, especially since the FTP
Task hasn't even been started yet. That doesn't happen until later on in the initialization process.

Also, does changing the priority for UserMain have to follow the FTP priority change? Could main's priority have been changed before changing FTP's?

In addition, as I'm going through the code for the example program, in function FTPD_SendFileToClient() (ftp_f.cpp) there are a
series of conditional compiles based on the type of device being accessed. All the conditional compile sections
have this same construct:

Code: Select all

#ifdef USE_MMC
   if ( strcmp( file_name, "_mmc" ) == 0 )
   {
      //iprintf( "Change to MMC.\r\n" );
      f_chdrive( MMC_DRV_NUM );
      return( FTPD_FAIL );
   }
#endif /* USE_MMC */
Every code section returns a fail code without testing the return of the change directory call. Is this correct?
rnixon
Posts: 833
Joined: Thu Apr 24, 2008 3:59 pm

Re: File system

Post by rnixon »

My understanding is each task (and therefore each task priority) needs to have it's own path information for the file system. Otherwise task A could change the path for task B. I don't think the order matters for changing priorities, except for the fact if you switched the order of OSChangePrio() and called ftp last in usermain, usermain would be at the ftp priority (since usermain is actually a task). Seems like it would be better form to call the fs enter stuff for the ftp task after it was created though.

In regards to the send file function, those look like commands to me to make the file system change modes. In that case a file would not be sent, so maybe the fail return value is correct since a file was not sent? Not 100% sure though.

Always good to check return values. Examples tend to miss that sometimes. Does the example work?
Post Reply