This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Filesystem: How to check if FAT drive is initialzed or not?

Hi,

Re: MDK-ARM CM3 Middleware FileSystem. FAT Drive on a NAND Flash ("N0:").

I'm looking for a method to check, wether a FAT drive is initialized or not! I must check, wether finit() had already been called or not.

I could not find a sufficient "high"-level Utility Routine. Thus I considered about using IO Control Interface Routines. Therfore I first had to get an id:
fs_ioc_get_id("N0:") returns drv_id = 1 on an uninitialized(!) drive which causes further fs_ioc-functions to crash.

Do anyone have an idea, how to check wether a (nonremovable NAND Flash) FAT drive is initialized or not?

Best regards
Matz

Parents Reply Children
  • Hi Vladimir,

    thanks, this will work of corse. But in my case finit is done by another (third party) modul not providing a separat status variable.
    I do not believe that it should be impossible to query the state (is finit?) directly from the file system middleware itself. Unfortunately it seems to be so.
    Or does someone else have a solution?

    Best regards.
    Matz

  • I guess there is no easy way, but linker can help us a bit: www.keil.com/.../armclang_link_pge1362065967698.htm

    uint32_t Drive_N_Initialized; //global scope
    
    extern fsStatus $Sub$$finit   (const char *drive);
    extern fsStatus $Super$$finit (const char *drive);
    
    fsStatus $Sub$$finit (const char *drive) {
      fsStatus stat;
    
      stat = $Super$$finit(drive);
    
      if ((drive[0] == 'N') && (drive[1] == '0')) {
        if (stat == fsOK) {
          Drive_N_Initialized = 1;
        } else {
          Drive_N_Initialized = 0;
        }
      }
      return (stat);
    }
    

  • Hi Vladimir,

    Great. I never get in touch with $Super$$ and $Sub$$ before. I admit that I did not learn the manual completely by heart... I'm happy that there is this forum.
    Thanks for now.

    Matz.