Check the disk state
[Examples]

Two routines are necessary to check the disk.
nav_drive_set() or nav_drive_nb() allows to detect the presence of a memory driver.
The memory driver may always be present or present only when memory can be accessed (e.g. memory card or USB disk).
nav_partition_mount() checks the presence of memory and tries to mount partition.

Bool check_disk( U8 lun )
{
   nav_select(0); // Select navigator ID 0 for this sequence

   if( !nav_drive_set(lun) )
   {
      printf("Driver memory no available\n");
      return FALSE;
   }
   // Here the memory is selected
   
   if( !nav_partition_mount() )
   {
      switch( fs_g_status )
      {
         case FS_ERR_HW_NO_PRESENT:
         printf("Disk not present\n");
         break;
         case FS_ERR_HW:
         printf("Disk access error\n");
         break;
         case FS_ERR_NO_FORMAT:
         printf("Disk no formated\n");
         break;
         case FS_ERR_NO_PART:
         printf("No partition available on disk\n");
         break;
         case FS_ERR_NO_SUPPORT_PART:
         printf("Partition no supported\n");
         break;
         default :
         printf("Other system error\n");
         break;
      }
      return FALSE;
   }
   // Here the partition on memory is mounted and the navigator is on root dir
   
   return TRUE;
}


Generated on Fri Feb 19 02:29:01 2010 for AVR32 - FAT Services by  doxygen 1.5.5