Arrow / Mbed OS DAPLink Reset
Embed: (wiki syntax)

« Back to documentation index

vfs_user.c File Reference

vfs_user.c File Reference

Implementation of vfs_user.h. More...

Go to the source code of this file.

Typedefs

typedef enum _magic_file magic_file_t
 Constants for magic action or config files.
typedef struct _magic_file_info magic_file_info_t
 Mapping from filename string to magic file enum.

Enumerations

enum  _magic_file {
  kDAPLinkModeActionFile, kTestAssertActionFile, kRefreshActionFile, kEraseActionFile,
  kAutoResetConfigFile, kHardResetConfigFile, kAutomationOnConfigFile, kAutomationOffConfigFile,
  kOverflowOnConfigFile, kOverflowOffConfigFile, kMSDOnConfigFile, kMSDOffConfigFile,
  kPageEraseActionFile, kChipEraseActionFile
}
 

Constants for magic action or config files.

More...

Functions

__WEAK bool vfs_user_file_change_handler_hook (const vfs_filename_t filename, vfs_file_change_t change, vfs_file_t file, vfs_file_t new_file_data)
 Hook for file changes in root directory.
__WEAK bool vfs_user_magic_file_hook (const vfs_filename_t filename, bool *do_remount)
 Hook for magic files.

Variables

static const magic_file_info_t s_magic_file_info []
 Table of magic files and their names.

Detailed Description

Implementation of vfs_user.h.

DAPLink Interface Firmware Copyright (c) 2009-2020, ARM Limited, All Rights Reserved Copyright 2019, Cypress Semiconductor Corporation or a subsidiary of Cypress Semiconductor Corporation. SPDX-License-Identifier: Apache-2.0

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file vfs_user.c.


Typedef Documentation

typedef struct _magic_file_info magic_file_info_t

Mapping from filename string to magic file enum.

typedef enum _magic_file magic_file_t

Constants for magic action or config files.

The "magic files" are files with a special name that if created on the USB MSC volume, will cause an event. There are two classes of magic files: action files and config files. The former causes a given action to take place, while the latter changes a persistent configuration setting to a predetermined value.

See s_magic_file_info for the mapping of filenames to these enums.


Enumeration Type Documentation

Constants for magic action or config files.

The "magic files" are files with a special name that if created on the USB MSC volume, will cause an event. There are two classes of magic files: action files and config files. The former causes a given action to take place, while the latter changes a persistent configuration setting to a predetermined value.

See s_magic_file_info for the mapping of filenames to these enums.

Enumerator:
kDAPLinkModeActionFile 

Switch between interface and bootloader.

kTestAssertActionFile 

Force an assertion for testing.

kRefreshActionFile 

Force a remount.

kEraseActionFile 

Erase the target flash.

kAutoResetConfigFile 

Enable reset after flash.

kHardResetConfigFile 

Disable reset after flash.

kAutomationOnConfigFile 

Enable automation.

kAutomationOffConfigFile 

Disable automation.

kOverflowOnConfigFile 

Enable UART overflow reporting.

kOverflowOffConfigFile 

Disable UART overflow reporting.

kMSDOnConfigFile 

Enable USB MSC. Uh....

kMSDOffConfigFile 

Disable USB MSC.

kPageEraseActionFile 

Enable page programming and sector erase for drag and drop.

kChipEraseActionFile 

Enable page programming and chip erase for drag and drop.

Definition at line 56 of file vfs_user.c.


Function Documentation

__WEAK bool vfs_user_file_change_handler_hook ( const vfs_filename_t  filename,
vfs_file_change_t  change,
vfs_file_t  file,
vfs_file_t  new_file_data 
)

Hook for file changes in root directory.

Parameters:
filenameName of the file that has changed.
changeType of change.
file
new_file_dataData being written to the file if _change_ is VFS_FILE_CHANGED.
Return values:
trueThe hook handled the change notification, the caller should do nothing else.
falseThe hook did nothing, continue with normal behaviour.

Definition at line 179 of file vfs_user.c.

__WEAK bool vfs_user_magic_file_hook ( const vfs_filename_t  filename,
bool *  do_remount 
)

Hook for magic files.

This hook is intended to simplify checking for magic files. In addition to allowing support for new magic files, you can also change the behaviour of or disable standard magic files.

Parameters:
filenameName of the file that was created.
[out]do_remountWhether the caller should remount the MSD volume. Only applies if true is returned. The default is true, so if the hook does not modify this parameter and returns true, a remount is performed.
Return values:
trueThe hook handled the specified file. A remount will be performed if requested, but otherwise no other standard behaviour is applied.
falseThe hook did not handle the file; continue with canonical behaviour.

Definition at line 186 of file vfs_user.c.


Variable Documentation

Initial value:
 {
        { daplink_mode_file_name, kDAPLinkModeActionFile },
        { "ASSERT  ACT", kTestAssertActionFile      },
        { "REFRESH ACT", kRefreshActionFile         },
        { "ERASE   ACT", kEraseActionFile           },
        { "AUTO_RSTCFG", kAutoResetConfigFile       },
        { "HARD_RSTCFG", kHardResetConfigFile       },
        { "AUTO_ON CFG", kAutomationOnConfigFile    },
        { "AUTO_OFFCFG", kAutomationOffConfigFile   },
        { "OVFL_ON CFG", kOverflowOnConfigFile      },
        { "OVFL_OFFCFG", kOverflowOffConfigFile     },
        { "MSD_ON  CFG", kMSDOnConfigFile           },
        { "MSD_OFF CFG", kMSDOffConfigFile          },
        { "PAGE_ON ACT", kPageEraseActionFile       },
        { "PAGE_OFFACT", kChipEraseActionFile       },
    }

Table of magic files and their names.

Definition at line 100 of file vfs_user.c.