test for export
Dependents: F401RE_USBMSD_RAM_copy
Fork of RAM_DISK by
USBMSD_Ram.h@0:ba333853266b, 2012-03-03 (annotated)
- Committer:
- samux
- Date:
- Sat Mar 03 07:55:24 2012 +0000
- Revision:
- 0:ba333853266b
- Child:
- 1:3d0c421fe52b
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
samux | 0:ba333853266b | 1 | /* mbed USBMSD_Ram Library, for providing file access to SD cards |
samux | 0:ba333853266b | 2 | * Copyright (c) 2008-2010, sford |
samux | 0:ba333853266b | 3 | * |
samux | 0:ba333853266b | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
samux | 0:ba333853266b | 5 | * of this software and associated documentation files (the "Software"), to deal |
samux | 0:ba333853266b | 6 | * in the Software without restriction, including without limitation the rights |
samux | 0:ba333853266b | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
samux | 0:ba333853266b | 8 | * copies of the Software, and to permit persons to whom the Software is |
samux | 0:ba333853266b | 9 | * furnished to do so, subject to the following conditions: |
samux | 0:ba333853266b | 10 | * |
samux | 0:ba333853266b | 11 | * The above copyright notice and this permission notice shall be included in |
samux | 0:ba333853266b | 12 | * all copies or substantial portions of the Software. |
samux | 0:ba333853266b | 13 | * |
samux | 0:ba333853266b | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
samux | 0:ba333853266b | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
samux | 0:ba333853266b | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
samux | 0:ba333853266b | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
samux | 0:ba333853266b | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
samux | 0:ba333853266b | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
samux | 0:ba333853266b | 20 | * THE SOFTWARE. |
samux | 0:ba333853266b | 21 | */ |
samux | 0:ba333853266b | 22 | |
samux | 0:ba333853266b | 23 | #ifndef USBMSD_RAM_H |
samux | 0:ba333853266b | 24 | #define USBMSD_RAM_H |
samux | 0:ba333853266b | 25 | |
samux | 0:ba333853266b | 26 | #include "mbed.h" |
samux | 0:ba333853266b | 27 | #include "USBMSD.h" |
samux | 0:ba333853266b | 28 | |
samux | 0:ba333853266b | 29 | /** Use the SDcard as mass storage device using the USBMSD class |
samux | 0:ba333853266b | 30 | * |
samux | 0:ba333853266b | 31 | * @code |
samux | 0:ba333853266b | 32 | * #include "mbed.h" |
samux | 0:ba333853266b | 33 | * #include "USBMSD_Ram.h" |
samux | 0:ba333853266b | 34 | * |
samux | 0:ba333853266b | 35 | * USBMSD_Ram sd(p5, p6, p7, p8); |
samux | 0:ba333853266b | 36 | * |
samux | 0:ba333853266b | 37 | * int main() { |
samux | 0:ba333853266b | 38 | * while(1); |
samux | 0:ba333853266b | 39 | * } |
samux | 0:ba333853266b | 40 | * |
samux | 0:ba333853266b | 41 | * @endcode |
samux | 0:ba333853266b | 42 | */ |
samux | 0:ba333853266b | 43 | class USBMSD_Ram : public USBMSD { |
samux | 0:ba333853266b | 44 | public: |
samux | 0:ba333853266b | 45 | |
samux | 0:ba333853266b | 46 | /** Create the File System for accessing an SD Card using SPI |
samux | 0:ba333853266b | 47 | * |
samux | 0:ba333853266b | 48 | * @param mosi SPI mosi pin connected to SD Card |
samux | 0:ba333853266b | 49 | * @param miso SPI miso pin conencted to SD Card |
samux | 0:ba333853266b | 50 | * @param sclk SPI sclk pin connected to SD Card |
samux | 0:ba333853266b | 51 | * @param cs DigitalOut pin used as SD Card chip select |
samux | 0:ba333853266b | 52 | * @param name The name used to access the virtual filesystem |
samux | 0:ba333853266b | 53 | */ |
samux | 0:ba333853266b | 54 | USBMSD_Ram(); |
samux | 0:ba333853266b | 55 | virtual int disk_initialize(); |
samux | 0:ba333853266b | 56 | virtual int disk_write(const char *buffer, int block_number); |
samux | 0:ba333853266b | 57 | virtual int disk_read(char *buffer, int block_number); |
samux | 0:ba333853266b | 58 | virtual int disk_status(); |
samux | 0:ba333853266b | 59 | virtual int disk_sync(); |
samux | 0:ba333853266b | 60 | virtual int disk_sectors(); |
samux | 0:ba333853266b | 61 | virtual int disk_size(); |
samux | 0:ba333853266b | 62 | |
samux | 0:ba333853266b | 63 | protected: |
samux | 0:ba333853266b | 64 | int _status; |
samux | 0:ba333853266b | 65 | char disk_image[512*32]; |
samux | 0:ba333853266b | 66 | |
samux | 0:ba333853266b | 67 | }; |
samux | 0:ba333853266b | 68 | |
samux | 0:ba333853266b | 69 | #endif |