예제 #1
0
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;
}
예제 #2
0
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;
}
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;
}