Updated to use latest headers of USBDevice
Dependents: USBMSB_Ramdisk_kl25z 14_USBMSB_Ramdisk
Fork of RAM_DISK by
USBMSD_Ram.h@1:0b8a0be40802, 2013-05-15 (annotated)
- Committer:
- ragmondo
- Date:
- Wed May 15 22:38:36 2013 +0000
- Revision:
- 1:0b8a0be40802
- Parent:
- 0:ba333853266b
updated to match latest revision of usbdevice library
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 | |
ragmondo | 1:0b8a0be40802 | 46 | |
samux | 0:ba333853266b | 47 | USBMSD_Ram(); |
samux | 0:ba333853266b | 48 | virtual int disk_initialize(); |
ragmondo | 1:0b8a0be40802 | 49 | virtual int disk_write(const uint8_t * data, uint64_t block); |
ragmondo | 1:0b8a0be40802 | 50 | virtual int disk_read(uint8_t * data, uint64_t block); |
samux | 0:ba333853266b | 51 | virtual int disk_status(); |
samux | 0:ba333853266b | 52 | virtual int disk_sync(); |
ragmondo | 1:0b8a0be40802 | 53 | virtual uint64_t disk_sectors(); |
ragmondo | 1:0b8a0be40802 | 54 | virtual uint64_t disk_size(); |
samux | 0:ba333853266b | 55 | |
samux | 0:ba333853266b | 56 | protected: |
samux | 0:ba333853266b | 57 | int _status; |
ragmondo | 1:0b8a0be40802 | 58 | char disk_image[512*5]; |
samux | 0:ba333853266b | 59 | |
samux | 0:ba333853266b | 60 | }; |
samux | 0:ba333853266b | 61 | |
samux | 0:ba333853266b | 62 | #endif |