Pierre Provent / USBHost

Dependents:   TEST_USB_Nucleo_F429ZI Essais_USB_Nucleo_F429ZI SID_V3_Nucleo_F429ZI SID_V4_Nucleo_F429ZI_copy

Committer:
pierreprovent
Date:
Fri Sep 25 10:17:49 2020 +0000
Revision:
0:77ca32e8e04e
Programme acquisition en enregistrement sur clef USB carte Nucleo F429ZI cours ELE118 Cnam

Who changed what in which revision?

UserRevisionLine numberNew contents of line
pierreprovent 0:77ca32e8e04e 1 /* mbed Microcontroller Library
pierreprovent 0:77ca32e8e04e 2 * Copyright (c) 2006-2012 ARM Limited
pierreprovent 0:77ca32e8e04e 3 *
pierreprovent 0:77ca32e8e04e 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
pierreprovent 0:77ca32e8e04e 5 * of this software and associated documentation files (the "Software"), to deal
pierreprovent 0:77ca32e8e04e 6 * in the Software without restriction, including without limitation the rights
pierreprovent 0:77ca32e8e04e 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
pierreprovent 0:77ca32e8e04e 8 * copies of the Software, and to permit persons to whom the Software is
pierreprovent 0:77ca32e8e04e 9 * furnished to do so, subject to the following conditions:
pierreprovent 0:77ca32e8e04e 10 *
pierreprovent 0:77ca32e8e04e 11 * The above copyright notice and this permission notice shall be included in
pierreprovent 0:77ca32e8e04e 12 * all copies or substantial portions of the Software.
pierreprovent 0:77ca32e8e04e 13 *
pierreprovent 0:77ca32e8e04e 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
pierreprovent 0:77ca32e8e04e 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
pierreprovent 0:77ca32e8e04e 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
pierreprovent 0:77ca32e8e04e 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
pierreprovent 0:77ca32e8e04e 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
pierreprovent 0:77ca32e8e04e 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
pierreprovent 0:77ca32e8e04e 20 * SOFTWARE.
pierreprovent 0:77ca32e8e04e 21 */
pierreprovent 0:77ca32e8e04e 22 #ifndef MBED_FATFILESYSTEM_H
pierreprovent 0:77ca32e8e04e 23 #define MBED_FATFILESYSTEM_H
pierreprovent 0:77ca32e8e04e 24
pierreprovent 0:77ca32e8e04e 25 #include "FileSystemLike.h"
pierreprovent 0:77ca32e8e04e 26 #include "FileHandle.h"
pierreprovent 0:77ca32e8e04e 27 #include "ff.h"
pierreprovent 0:77ca32e8e04e 28 #include <stdint.h>
pierreprovent 0:77ca32e8e04e 29
pierreprovent 0:77ca32e8e04e 30 using namespace mbed;
pierreprovent 0:77ca32e8e04e 31
pierreprovent 0:77ca32e8e04e 32 /**
pierreprovent 0:77ca32e8e04e 33 * FATFileSystem based on ChaN's Fat Filesystem library v0.8
pierreprovent 0:77ca32e8e04e 34 */
pierreprovent 0:77ca32e8e04e 35 class FATFileSystem : public FileSystemLike {
pierreprovent 0:77ca32e8e04e 36 public:
pierreprovent 0:77ca32e8e04e 37
pierreprovent 0:77ca32e8e04e 38 FATFileSystem(const char* n);
pierreprovent 0:77ca32e8e04e 39 virtual ~FATFileSystem();
pierreprovent 0:77ca32e8e04e 40
pierreprovent 0:77ca32e8e04e 41 static FATFileSystem * _ffs[_VOLUMES]; // FATFileSystem objects, as parallel to FatFs drives array
pierreprovent 0:77ca32e8e04e 42 FATFS _fs; // Work area (file system object) for logical drive
pierreprovent 0:77ca32e8e04e 43 char _fsid[2];
pierreprovent 0:77ca32e8e04e 44
pierreprovent 0:77ca32e8e04e 45 /**
pierreprovent 0:77ca32e8e04e 46 * Opens a file on the filesystem
pierreprovent 0:77ca32e8e04e 47 */
pierreprovent 0:77ca32e8e04e 48 virtual FileHandle *open(const char* name, int flags);
pierreprovent 0:77ca32e8e04e 49 virtual int open(FileHandle **file, const char *name, int flags);
pierreprovent 0:77ca32e8e04e 50
pierreprovent 0:77ca32e8e04e 51 /**
pierreprovent 0:77ca32e8e04e 52 * Removes a file path
pierreprovent 0:77ca32e8e04e 53 */
pierreprovent 0:77ca32e8e04e 54 virtual int remove(const char *filename);
pierreprovent 0:77ca32e8e04e 55
pierreprovent 0:77ca32e8e04e 56 /**
pierreprovent 0:77ca32e8e04e 57 * Renames a file
pierreprovent 0:77ca32e8e04e 58 */
pierreprovent 0:77ca32e8e04e 59 virtual int rename(const char *oldname, const char *newname);
pierreprovent 0:77ca32e8e04e 60
pierreprovent 0:77ca32e8e04e 61 /**
pierreprovent 0:77ca32e8e04e 62 * Formats a logical drive, FDISK artitioning rule, 512 bytes per cluster
pierreprovent 0:77ca32e8e04e 63 */
pierreprovent 0:77ca32e8e04e 64 virtual int format();
pierreprovent 0:77ca32e8e04e 65
pierreprovent 0:77ca32e8e04e 66 /**
pierreprovent 0:77ca32e8e04e 67 * Opens a directory on the filesystem
pierreprovent 0:77ca32e8e04e 68 */
pierreprovent 0:77ca32e8e04e 69 virtual DirHandle *opendir(const char *name);
pierreprovent 0:77ca32e8e04e 70 virtual int open(DirHandle **dir, const char *name);
pierreprovent 0:77ca32e8e04e 71
pierreprovent 0:77ca32e8e04e 72 /**
pierreprovent 0:77ca32e8e04e 73 * Creates a directory path
pierreprovent 0:77ca32e8e04e 74 */
pierreprovent 0:77ca32e8e04e 75 virtual int mkdir(const char *name, mode_t mode);
pierreprovent 0:77ca32e8e04e 76
pierreprovent 0:77ca32e8e04e 77 /**
pierreprovent 0:77ca32e8e04e 78 * Mounts the filesystem
pierreprovent 0:77ca32e8e04e 79 */
pierreprovent 0:77ca32e8e04e 80 virtual int mount();
pierreprovent 0:77ca32e8e04e 81
pierreprovent 0:77ca32e8e04e 82 /**
pierreprovent 0:77ca32e8e04e 83 * Unmounts the filesystem
pierreprovent 0:77ca32e8e04e 84 */
pierreprovent 0:77ca32e8e04e 85 virtual int unmount();
pierreprovent 0:77ca32e8e04e 86
pierreprovent 0:77ca32e8e04e 87 virtual int disk_initialize() { return 0; }
pierreprovent 0:77ca32e8e04e 88 virtual int disk_status() { return 0; }
pierreprovent 0:77ca32e8e04e 89 virtual int disk_read(uint8_t *buffer, uint32_t sector, uint32_t count) = 0;
pierreprovent 0:77ca32e8e04e 90 virtual int disk_write(const uint8_t *buffer, uint32_t sector, uint32_t count) = 0;
pierreprovent 0:77ca32e8e04e 91 virtual int disk_sync() { return 0; }
pierreprovent 0:77ca32e8e04e 92 virtual uint32_t disk_sectors() = 0;
pierreprovent 0:77ca32e8e04e 93
pierreprovent 0:77ca32e8e04e 94 };
pierreprovent 0:77ca32e8e04e 95
pierreprovent 0:77ca32e8e04e 96 #endif