Subdirectory provided by Embedded Artists
Dependencies: DM_FATFileSystem DM_HttpServer DM_USBHost EthernetInterface USBDevice mbed-rpc mbed-rtos mbed-src
Dependents: lpc4088_displaymodule_hello_world_Sept_2018
Fork of DMSupport by
FileSystems/USBMSD_RAMFS.h@0:6b68dac0d986, 2014-11-21 (annotated)
- Committer:
- embeddedartists
- Date:
- Fri Nov 21 11:42:51 2014 +0000
- Revision:
- 0:6b68dac0d986
- Child:
- 9:a33326afd686
First version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
embeddedartists | 0:6b68dac0d986 | 1 | #ifndef USBMSDRAMFS_H |
embeddedartists | 0:6b68dac0d986 | 2 | #define USBMSDRAMFS_H |
embeddedartists | 0:6b68dac0d986 | 3 | |
embeddedartists | 0:6b68dac0d986 | 4 | #include "mbed.h" |
embeddedartists | 0:6b68dac0d986 | 5 | #include "USBMSD.h" |
embeddedartists | 0:6b68dac0d986 | 6 | #include "RAMFileSystem.h" |
embeddedartists | 0:6b68dac0d986 | 7 | #include <stdint.h> |
embeddedartists | 0:6b68dac0d986 | 8 | |
embeddedartists | 0:6b68dac0d986 | 9 | /** |
embeddedartists | 0:6b68dac0d986 | 10 | * USBMSD_RAMFS class: Allows the mbed board to expose a FAT file system in SDRAM as a USB memory stick |
embeddedartists | 0:6b68dac0d986 | 11 | */ |
embeddedartists | 0:6b68dac0d986 | 12 | class USBMSD_RAMFS : public USBMSD { |
embeddedartists | 0:6b68dac0d986 | 13 | public: |
embeddedartists | 0:6b68dac0d986 | 14 | |
embeddedartists | 0:6b68dac0d986 | 15 | /** |
embeddedartists | 0:6b68dac0d986 | 16 | * Constructor |
embeddedartists | 0:6b68dac0d986 | 17 | * |
embeddedartists | 0:6b68dac0d986 | 18 | * @param ramfs The RAM file system |
embeddedartists | 0:6b68dac0d986 | 19 | * @param vendor_id Your vendor_id |
embeddedartists | 0:6b68dac0d986 | 20 | * @param product_id Your product_id |
embeddedartists | 0:6b68dac0d986 | 21 | * @param product_release Your preoduct_release |
embeddedartists | 0:6b68dac0d986 | 22 | */ |
embeddedartists | 0:6b68dac0d986 | 23 | USBMSD_RAMFS(RAMFileSystem* ramfs, uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001); |
embeddedartists | 0:6b68dac0d986 | 24 | |
embeddedartists | 0:6b68dac0d986 | 25 | protected: |
embeddedartists | 0:6b68dac0d986 | 26 | |
embeddedartists | 0:6b68dac0d986 | 27 | /* |
embeddedartists | 0:6b68dac0d986 | 28 | * read one or more blocks on a storage chip |
embeddedartists | 0:6b68dac0d986 | 29 | * |
embeddedartists | 0:6b68dac0d986 | 30 | * @param data pointer where will be stored read data |
embeddedartists | 0:6b68dac0d986 | 31 | * @param block starting block number |
embeddedartists | 0:6b68dac0d986 | 32 | * @param count number of blocks to read |
embeddedartists | 0:6b68dac0d986 | 33 | * @returns 0 if successful |
embeddedartists | 0:6b68dac0d986 | 34 | */ |
embeddedartists | 0:6b68dac0d986 | 35 | virtual int disk_read(uint8_t* data, uint64_t block, uint8_t count); |
embeddedartists | 0:6b68dac0d986 | 36 | |
embeddedartists | 0:6b68dac0d986 | 37 | /* |
embeddedartists | 0:6b68dac0d986 | 38 | * write one or more blocks on a storage chip |
embeddedartists | 0:6b68dac0d986 | 39 | * |
embeddedartists | 0:6b68dac0d986 | 40 | * @param data data to write |
embeddedartists | 0:6b68dac0d986 | 41 | * @param block starting block number |
embeddedartists | 0:6b68dac0d986 | 42 | * @param count number of blocks to write |
embeddedartists | 0:6b68dac0d986 | 43 | * @returns 0 if successful |
embeddedartists | 0:6b68dac0d986 | 44 | */ |
embeddedartists | 0:6b68dac0d986 | 45 | virtual int disk_write(const uint8_t* data, uint64_t block, uint8_t count); |
embeddedartists | 0:6b68dac0d986 | 46 | |
embeddedartists | 0:6b68dac0d986 | 47 | /* |
embeddedartists | 0:6b68dac0d986 | 48 | * Disk initilization |
embeddedartists | 0:6b68dac0d986 | 49 | */ |
embeddedartists | 0:6b68dac0d986 | 50 | virtual int disk_initialize(); |
embeddedartists | 0:6b68dac0d986 | 51 | |
embeddedartists | 0:6b68dac0d986 | 52 | /* |
embeddedartists | 0:6b68dac0d986 | 53 | * Return the number of blocks |
embeddedartists | 0:6b68dac0d986 | 54 | * |
embeddedartists | 0:6b68dac0d986 | 55 | * @returns number of blocks |
embeddedartists | 0:6b68dac0d986 | 56 | */ |
embeddedartists | 0:6b68dac0d986 | 57 | virtual uint64_t disk_sectors(); |
embeddedartists | 0:6b68dac0d986 | 58 | |
embeddedartists | 0:6b68dac0d986 | 59 | /* |
embeddedartists | 0:6b68dac0d986 | 60 | * Return memory size |
embeddedartists | 0:6b68dac0d986 | 61 | * |
embeddedartists | 0:6b68dac0d986 | 62 | * @returns memory size |
embeddedartists | 0:6b68dac0d986 | 63 | */ |
embeddedartists | 0:6b68dac0d986 | 64 | virtual uint64_t disk_size(); |
embeddedartists | 0:6b68dac0d986 | 65 | |
embeddedartists | 0:6b68dac0d986 | 66 | |
embeddedartists | 0:6b68dac0d986 | 67 | /* |
embeddedartists | 0:6b68dac0d986 | 68 | * To check the status of the storage chip |
embeddedartists | 0:6b68dac0d986 | 69 | * |
embeddedartists | 0:6b68dac0d986 | 70 | * @returns status: 0: OK, 1: disk not initialized, 2: no medium in the drive, 4: write protected |
embeddedartists | 0:6b68dac0d986 | 71 | */ |
embeddedartists | 0:6b68dac0d986 | 72 | virtual int disk_status(); |
embeddedartists | 0:6b68dac0d986 | 73 | |
embeddedartists | 0:6b68dac0d986 | 74 | protected: |
embeddedartists | 0:6b68dac0d986 | 75 | |
embeddedartists | 0:6b68dac0d986 | 76 | RAMFileSystem* ramfs; |
embeddedartists | 0:6b68dac0d986 | 77 | }; |
embeddedartists | 0:6b68dac0d986 | 78 | |
embeddedartists | 0:6b68dac0d986 | 79 | #endif |
embeddedartists | 0:6b68dac0d986 | 80 |