Bool mem_wr_protect (U8 lun)
{
Bool wr_protect;

    if (!Ctrl_access_lock ())
        return TRUE;

    if (lun == 1)
    {
        wr_protect = TRUE;
    }

    wr_protect =
#if MAX_LUN
        (lun < MAX_LUN) ? lun_desc[lun].wr_protect () :
#endif
#if LUN_USB == ENABLE
        Lun_usb_wr_protect (lun - LUN_ID_USB);
#else
        TRUE;
#endif

    Ctrl_access_unlock ();

    return wr_protect;
}
//! This fonction return is the write protected mode
//!
//! @param lun        Logical unit number
//!
//! Only used by memory removal with a HARDWARE SPECIFIC write protected detection
//! !!! The customer must be unplug the card for change this write protected mode.
//!
//! @return TRUE  -> the memory is protected
//!
Bool  mem_wr_protect( U8 lun )
{
   switch( lun )
   {
#     if (LUN_0 == ENABLE)
      case LUN_ID_0:
         return Lun_0_wr_protect();
         break;
#     endif
#     if (LUN_1 == ENABLE)
      case LUN_ID_1:
         return Lun_1_wr_protect();
         break;
#     endif
#     if (LUN_2 == ENABLE)
      case LUN_ID_2:
         return Lun_2_wr_protect();
         break;
#     endif
#     if (LUN_3 == ENABLE)
      case LUN_ID_3:
         return Lun_3_wr_protect();
         break;
#     endif
#     if (LUN_4 == ENABLE)
      case LUN_ID_4:
         return Lun_4_wr_protect();
         break;
#     endif
#     if (LUN_5 == ENABLE)
      case LUN_ID_5:
         return Lun_5_wr_protect();
         break;
#     endif
#     if (LUN_6 == ENABLE)
      case LUN_ID_6:
         return Lun_6_wr_protect();
         break;
#     endif
#     if (LUN_7 == ENABLE)
      case LUN_ID_7:
         return Lun_7_wr_protect();
         break;
#     endif
#     if (LUN_USB == ENABLE)
      default:
         return Lun_usb_wr_protect(lun - LUN_ID_USB);
         break;
#     endif
   }
   return   CTRL_FAIL;
}
示例#3
0
bool mem_wr_protect(U8 lun)
{
  bool wr_protect;

  if (!Ctrl_access_lock()) return true;

  wr_protect =
#if MAX_LUN
             (lun < MAX_LUN) ? lun_desc[lun].wr_protect() :
#endif
#if LUN_USB == ENABLE
                                 Lun_usb_wr_protect(lun - LUN_ID_USB);
#else
                                 true;
#endif

  Ctrl_access_unlock();

  return wr_protect;
}