The purpose of this application is to allow easy manipulation of the QSPI file system from a PC

Dependencies:   EALib USBDevice mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers USBMSD_RAMFS.h Source File

USBMSD_RAMFS.h

00001 #ifndef USBMSDRAMFS_H
00002 #define USBMSDRAMFS_H
00003 
00004 #include "mbed.h"
00005 #include "USBMSD.h"
00006 #include "RAMFileSystem.h"
00007 #include <stdint.h>
00008 
00009 /**
00010  * USBMSD_RAMFS class: Allows the mbed board to expose a FAT file system in SDRAM as a USB memory stick
00011  */
00012 class USBMSD_RAMFS : public USBMSD {
00013 public:
00014 
00015     /**
00016     * Constructor
00017     *
00018     * @param ramfs The RAM file system
00019     * @param vendor_id Your vendor_id
00020     * @param product_id Your product_id
00021     * @param product_release Your preoduct_release
00022     */
00023     USBMSD_RAMFS(RAMFileSystem* ramfs, uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001);
00024 
00025 protected:
00026 
00027     /*
00028     * read one or more blocks on a storage chip
00029     *
00030     * @param data pointer where will be stored read data
00031     * @param block starting block number
00032     * @param count number of blocks to read
00033     * @returns 0 if successful
00034     */
00035     virtual int disk_read(uint8_t* data, uint64_t block, uint8_t count);
00036 
00037     /*
00038     * write one or more blocks on a storage chip
00039     *
00040     * @param data data to write
00041     * @param block starting block number
00042     * @param count number of blocks to write
00043     * @returns 0 if successful
00044     */
00045     virtual int disk_write(const uint8_t* data, uint64_t block, uint8_t count);
00046 
00047     /*
00048     * Disk initilization
00049     */
00050     virtual int disk_initialize();
00051 
00052     /*
00053     * Return the number of blocks
00054     *
00055     * @returns number of blocks
00056     */
00057     virtual uint64_t disk_sectors();
00058 
00059     /*
00060     * Return memory size
00061     *
00062     * @returns memory size
00063     */
00064     virtual uint64_t disk_size();
00065 
00066 
00067     /*
00068     * To check the status of the storage chip
00069     *
00070     * @returns status: 0: OK, 1: disk not initialized, 2: no medium in the drive, 4: write protected
00071     */
00072     virtual int disk_status();
00073 
00074 protected:
00075 
00076     RAMFileSystem* ramfs;
00077 };
00078 
00079 #endif
00080