Microchip® Advanced Software Framework

host_mass_storage_task.h File Reference
#include "conf_usb.h"
#include "usb_host_task.h"
#include "fs_com.h"

Macros

#define DEVICE_TO_HOST   0x01
 
#define DIR_LOCAL_IN_NAME   "IN"
 
#define DIR_LOCAL_OUT_NAME   "OUT"
 
#define DIR_USB_IN_NAME   "IN"
 
#define DIR_USB_OUT_NAME   "OUT"
 
#define FULL_SYNC   (DEVICE_TO_HOST | HOST_TO_DEVICE)
 
#define HOST_TO_DEVICE   0x02
 
#define Is_host_ms_configured()   (ms_connected && !Is_host_suspended())
 

Functions

void host_mass_storage_task (void *pvParameters)
 This function manages the host mass-storage task. More...
 
bool host_mass_storage_task_copy_tree (const char *pcdir_name, U8 sync_direction, bool bDeleteSrc)
 Synchronize the contents of two directories between the USB drive and the AT45DBX dataflash file systems. More...
 
void host_mass_storage_task_init (void)
 This function initializes the host mass-storage task. More...
 
bool host_mass_storage_task_sync_dir (Fs_index *dst_fs_idx, const char *dst_dir, Fs_index *src_fs_idx, const char *src_dir, bool bDeleteSrc)
 
bool host_mass_storage_task_sync_drives (signed short FsNavId, U8 sync_direction, const char *pcdir_name, bool bDeleteSrc)
 Synchronize the contents of two drives (limited to files). More...
 
void host_sof_action (void)
 host_sof_action More...
 

Variables

volatile bool ms_connected
 

#define DIR_LOCAL_IN_NAME   "IN"
#define DIR_LOCAL_OUT_NAME   "OUT"
#define DIR_USB_IN_NAME   "IN"
#define DIR_USB_OUT_NAME   "OUT"
#define FULL_SYNC   (DEVICE_TO_HOST | HOST_TO_DEVICE)

bool host_mass_storage_task_copy_tree ( const char *  pcdir_name,
U8  sync_direction,
bool  bDeleteSrc 
)

Synchronize the contents of two directories between the USB drive and the AT45DBX dataflash file systems.

Parameters
pcdir_nameconst char *: directory name null-terminated string
sync_directionU8: DEVICE_TO_HOST, HOST_TO_DEVICE or FULL_SYNC
bDeleteSrcbool: if true delete the src directory content.
Returns
bool: true on success else false

References COPY_BUSY, COPY_FINISH, FS_ERR_FILE_EXIST, FS_ERR_NO_DIR, FS_FIND_NEXT, fs_g_status, FS_NAME_GET, FS_NAV_ID_COPYFILE_TREE_DEST, FS_NAV_ID_COPYFILE_TREE_SRC, HOST_TO_DEVICE, LUN_ID_AT45DBX_MEM, LUN_ID_MEM_USB, MAX_FILE_PATH_LENGTH, ms_str, nav_dir_cd(), nav_dir_gotoparent(), nav_dir_make(), nav_drive_set(), nav_file_copy(), nav_file_del(), nav_file_isdir(), nav_file_name(), nav_file_paste_start(), nav_file_paste_state(), nav_filelist_findname(), nav_filelist_set(), nav_partition_mount(), and nav_select().

Referenced by host_mass_storage_task_sync_drives().

void host_mass_storage_task_init ( void  )
bool host_mass_storage_task_sync_dir ( Fs_index dst_fs_idx,
const char *  dst_dir,
Fs_index src_fs_idx,
const char *  src_dir,
bool  bDeleteSrc 
)
bool host_mass_storage_task_sync_drives ( signed short  FsNavId,
U8  sync_direction,
const char *  pcdir_name,
bool  bDeleteSrc 
)

Synchronize the contents of two drives (limited to files).

Parameters
FsNavIdsigned short: the file system navigator id to use.
sync_directionU8: DEVICE_TO_HOST, HOST_TO_DEVICE or FULL_SYNC
pcdir_nameconst char *: directory name to consider.
bDeleteSrcbool: if true delete the src directory content.
Returns
bool: true on success
Todo:
Do recursive directory copy...

References DEVICE_TO_HOST, fsaccess_give_mutex(), fsaccess_take_mutex(), host_mass_storage_task_copy_tree(), HOST_TO_DEVICE, and Is_host_ready.

Referenced by prv_e_usbsys_sync_cp_ukey().