当前位置: 首页>>代码示例>>C++>>正文


C++ Ctrl_access_unlock函数代码示例

本文整理汇总了C++中Ctrl_access_unlock函数的典型用法代码示例。如果您正苦于以下问题:C++ Ctrl_access_unlock函数的具体用法?C++ Ctrl_access_unlock怎么用?C++ Ctrl_access_unlock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Ctrl_access_unlock函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ram_2_memory

Ctrl_status ram_2_memory(U8 lun, U32 addr, const void *ram)
{
  Ctrl_status status;
#if MAX_LUN==0
  UNUSED(lun);
#endif

  if (!Ctrl_access_lock()) return CTRL_FAIL;

  memory_start_write_action(1);
  status =
#if MAX_LUN
           (lun < MAX_LUN) ? lun_desc[lun].ram_2_mem(addr, ram) :
#endif
#if LUN_USB == ENABLE
                             Lun_usb_ram_2_mem(addr, ram);
#else
                             CTRL_FAIL;
#endif
  memory_stop_write_action();

  Ctrl_access_unlock();

  return status;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:25,代码来源:ctrl_access.c

示例2: mem_unload

bool mem_unload(U8 lun, bool unload)
{
  bool unloaded;
#if !MAX_LUN || !defined(Lun_usb_unload)
  UNUSED(lun);
#endif

  if (!Ctrl_access_lock()) return false;

  unloaded =
#if MAX_LUN
          (lun < MAX_LUN) ?
              (lun_desc[lun].unload ?
                  lun_desc[lun].unload(unload) : !unload) :
#endif
#if LUN_USB == ENABLE
# if defined(Lun_usb_unload)
              Lun_usb_unload(lun - LUN_ID_USB, unload);
# else
              !unload; /* Can not unload: load success, unload fail */
# endif
#else
              false; /* No mem, unload/load fail */
#endif

  Ctrl_access_unlock();

  return unloaded;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:29,代码来源:ctrl_access.c

示例3: mem_wr_protect

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;
}
开发者ID:Nitrokey,项目名称:nitrokey-storage-firmware,代码行数:26,代码来源:ctrl_access.c

示例4: memory_2_ram

Ctrl_status memory_2_ram(U8 lun, U32 addr, void *ram, uint32_t numBlocks)
{
  Ctrl_status status;
#if MAX_LUN==0
  UNUSED(lun);
#endif

  if (!Ctrl_access_lock()) return CTRL_FAIL;

  memory_start_read_action(1);
  status =
#if MAX_LUN
           (lun < MAX_LUN) ? lun_desc[lun].mem_2_ram(addr, ram, numBlocks) :
#endif
#if LUN_USB == ENABLE
                             Lun_usb_mem_2_ram(addr, ram, numBlocks);
#else
                             CTRL_FAIL;
#endif
  memory_stop_read_action();

  Ctrl_access_unlock();

  return status;
}
开发者ID:agamenmon,项目名称:CoreNG,代码行数:25,代码来源:ctrl_access.c

示例5: mem_test_unit_ready

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;
}
开发者ID:Nitrokey,项目名称:nitrokey-storage-firmware,代码行数:25,代码来源:ctrl_access.c

示例6: get_nb_lun

U8 get_nb_lun(void)
{
#if MEM_USB == ENABLE
  U8 nb_lun;

  if (!Ctrl_access_lock()) return MAX_LUN;

  nb_lun = MAX_LUN + host_get_lun();

  Ctrl_access_unlock();

  return nb_lun;
#else
  return MAX_LUN;
#endif
}
开发者ID:derkling,项目名称:adplayer,代码行数:16,代码来源:ctrl_access.c

示例7: usb_2_memory

Ctrl_status usb_2_memory(U8 lun, U32 addr, U16 nb_sector)
{
  Ctrl_status status;

  if (!Ctrl_access_lock()) return CTRL_FAIL;

  memory_start_write_action(nb_sector);
  status =
#if MAX_LUN
           (lun < MAX_LUN) ? lun_desc[lun].usb_write_10(addr, nb_sector) :
#endif
                             CTRL_FAIL;
  memory_stop_write_action();

  Ctrl_access_unlock();

  return status;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:18,代码来源:ctrl_access.c

示例8: get_nb_lun

U8 get_nb_lun(void)
{
#if MEM_USB == ENABLE
#  ifndef Lun_usb_get_lun
#    define Lun_usb_get_lun()  host_get_lun()
#  endif
  U8 nb_lun;

  if (!Ctrl_access_lock()) return MAX_LUN;

  nb_lun = MAX_LUN + Lun_usb_get_lun();

  Ctrl_access_unlock();

  return nb_lun;
#else
  return MAX_LUN;
#endif
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:19,代码来源:ctrl_access.c

示例9: mem_wr_protect

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;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:20,代码来源:ctrl_access.c

示例10: mem_sector_size

U8 mem_sector_size(U8 lun)
{
  U8 sector_size;

  if (!Ctrl_access_lock()) return 0;

  sector_size =
#if MAX_LUN
              (lun < MAX_LUN) ? 1 :
#endif
#if LUN_USB == ENABLE
                                  Lun_usb_read_sector_size(lun - LUN_ID_USB);
#else
                                  0;
#endif

  Ctrl_access_unlock();

  return sector_size;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:20,代码来源:ctrl_access.c

示例11: mem_read_capacity

Ctrl_status mem_read_capacity(U8 lun, U32 *u32_nb_sector)
{
  Ctrl_status status;

  if (!Ctrl_access_lock()) return CTRL_FAIL;

  status =
#if MAX_LUN
         (lun < MAX_LUN) ? lun_desc[lun].read_capacity(u32_nb_sector) :
#endif
#if LUN_USB == ENABLE
                             Lun_usb_read_capacity(lun - LUN_ID_USB, u32_nb_sector);
#else
                             CTRL_FAIL;
#endif

  Ctrl_access_unlock();

  return status;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:20,代码来源:ctrl_access.c

示例12: mem_test_unit_ready

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;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:20,代码来源:ctrl_access.c

示例13: mem_removal

Bool mem_removal(U8 lun)
{
  Bool removal;

  if (!Ctrl_access_lock()) return TRUE;

  removal =
#if MAX_LUN
            (lun < MAX_LUN) ? lun_desc[lun].removal() :
#endif
#if LUN_USB == ENABLE
                              Lun_usb_removal();
#else
                              TRUE;
#endif

  Ctrl_access_unlock();

  return removal;
}
开发者ID:derkling,项目名称:adplayer,代码行数:20,代码来源:ctrl_access.c

示例14: mem_removal

bool mem_removal(U8 lun)
{
  bool removal;
#if MAX_LUN==0
  UNUSED(lun);
#endif

  if (!Ctrl_access_lock()) return true;

  removal =
#if MAX_LUN
          (lun < MAX_LUN) ? lun_desc[lun].removal() :
#endif
#if LUN_USB == ENABLE
                              Lun_usb_removal();
#else
                              true;
#endif

  Ctrl_access_unlock();

  return removal;
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:23,代码来源:ctrl_access.c

示例15: usb_2_memory

Ctrl_status usb_2_memory (U8 lun, U32 addr, U16 nb_sector)
{
Ctrl_status status;

    if (!Ctrl_access_lock ())
        return CTRL_FAIL;

    memory_start_write_action (nb_sector);
    status =
#if MAX_LUN
        (lun < MAX_LUN) ? lun_desc[lun].usb_write_10 (addr, nb_sector) :
#endif
        CTRL_FAIL;
    memory_stop_write_action ();

    Ctrl_access_unlock ();

    USB_Log_st.MSD_WriteCalls_u32++;
    USB_Log_st.MSD_BytesWrite_u32 += nb_sector;
    time ((time_t *) & USB_Log_st.MSD_LastWriteAccess_u32);

    return status;
}
开发者ID:Nitrokey,项目名称:nitrokey-storage-firmware,代码行数:23,代码来源:ctrl_access.c


注:本文中的Ctrl_access_unlock函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。