Microchip® Advanced Software Framework

host_mass_storage_task.c File Reference
#include "conf_usb.h"
#include "board.h"
#include "FreeRTOS.h"
#include "task.h"
#include "usb_drv.h"
#include "usb_host_enum.h"
#include "usb_host_task.h"
#include "host_mem.h"
#include "ctrl_access.h"
#include "navigation.h"
#include "fsaccess.h"
#include "host_mass_storage_task.h"

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_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
 
volatile bool ms_new_device_connected
 
static char ms_str [MAX_FILE_PATH_LENGTH]
 
static U16 sof_cnt
 

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_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().

char ms_str[MAX_FILE_PATH_LENGTH]
static
U16 sof_cnt
static