コード例 #1
0
Ctrl_status mem_test_unit_ready (U8 lun)
{
Ctrl_status status;

    if (!Ctrl_access_lock ())
        return CTRL_FAIL;

    status =
#if MAX_LUN
        (lun < MAX_LUN) ? lun_desc[lun].test_unit_ready () :
#endif
#if LUN_USB == ENABLE
        Lun_usb_test_unit_ready (lun - LUN_ID_USB);
#else
        CTRL_FAIL;
#endif

    Ctrl_access_unlock ();
    /*
       { U8 Text[10]; CI_StringOut ("STATUS "); switch (lun) { case 0: CI_StringOut (" UNCYP L0"); break; case 1: CI_StringOut (" ENCYP L1"); break;
       default: CI_StringOut (" *** ERROR LUN ***"); break; } switch (status) { case CTRL_GOOD : CI_StringOut (" CTRL_GOOD\r\n"); break; case
       CTRL_FAIL : CI_StringOut (" CTRL_FAIL\r\n"); break; case CTRL_NO_PRESENT : CI_StringOut (" CTRL_NO_PRESENT\r\n"); break; case CTRL_BUSY :
       CI_StringOut (" CTRL_BUSY\r\n"); break; } } */
    return status;
}
コード例 #2
0
//! This fonction test the state of memory, and start the initialisation of the memory
//!
//! MORE (see SPC-3 §5.2.4) : The TEST UNIT READY command allows an application client
//! to poll a logical unit until it is ready without the need to allocate space for returned data.
//! The TEST UNIT READY command may be used to check the media status of logical units with removable media.
//!
//! @param lun        Logical unit number
//!
//! @return                Ctrl_status
//!   It is ready    ->    CTRL_GOOD
//!   Memory unplug  ->    CTRL_NO_PRESENT
//!   Not initialize ->    CTRL_BUSY
//!
Ctrl_status mem_test_unit_ready( U8 lun )
{
   switch( lun )
   {
#     if (LUN_0 == ENABLE)
      case LUN_ID_0:
         return Lun_0_test_unit_ready();
         break;
#     endif
#     if (LUN_1 == ENABLE)
      case LUN_ID_1:
         return Lun_1_test_unit_ready();
         break;
#     endif
#     if (LUN_2 == ENABLE)
      case LUN_ID_2:
         return Lun_2_test_unit_ready();
         break;
#     endif
#     if (LUN_3 == ENABLE)
      case LUN_ID_3:
         return Lun_3_test_unit_ready();
         break;
#     endif
#     if (LUN_4 == ENABLE)
      case LUN_ID_4:
         return Lun_4_test_unit_ready();
         break;
#     endif
#     if (LUN_5 == ENABLE)
      case LUN_ID_5:
         return Lun_5_test_unit_ready();
         break;
#     endif
#     if (LUN_6 == ENABLE)
      case LUN_ID_6:
         return Lun_6_test_unit_ready();
         break;
#     endif
#     if (LUN_7 == ENABLE)
      case LUN_ID_7:
         return Lun_7_test_unit_ready();
         break;
#     endif
#     if (LUN_USB == ENABLE)
      default:
         return Lun_usb_test_unit_ready(lun - LUN_ID_USB);
         break;
#     endif
   }
   return   CTRL_FAIL;
}
コード例 #3
0
ファイル: ctrl_access.c プロジェクト: AndreyMostovov/asf
Ctrl_status mem_test_unit_ready(U8 lun)
{
  Ctrl_status status;

  if (!Ctrl_access_lock()) return CTRL_FAIL;

  status =
#if MAX_LUN
         (lun < MAX_LUN) ? lun_desc[lun].test_unit_ready() :
#endif
#if LUN_USB == ENABLE
                             Lun_usb_test_unit_ready(lun - LUN_ID_USB);
#else
                             CTRL_FAIL;
#endif

  Ctrl_access_unlock();

  return status;
}