supported callback

Dependents:   GraphicPoi

Fork of RAM_DISK by Samuel Mokrani

Committer:
okini3939
Date:
Thu Dec 01 06:29:29 2016 +0000
Revision:
3:5b6b3320c4f4
Parent:
2:69984d40fc4b
fix callback

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samux 1:3d0c421fe52b 1 /* mbed USBMSD_Ram Library
samux 0:ba333853266b 2 *
samux 0:ba333853266b 3 * Permission is hereby granted, free of charge, to any person obtaining a copy
samux 0:ba333853266b 4 * of this software and associated documentation files (the "Software"), to deal
samux 0:ba333853266b 5 * in the Software without restriction, including without limitation the rights
samux 0:ba333853266b 6 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
samux 0:ba333853266b 7 * copies of the Software, and to permit persons to whom the Software is
samux 0:ba333853266b 8 * furnished to do so, subject to the following conditions:
samux 0:ba333853266b 9 *
samux 0:ba333853266b 10 * The above copyright notice and this permission notice shall be included in
samux 0:ba333853266b 11 * all copies or substantial portions of the Software.
samux 0:ba333853266b 12 *
samux 0:ba333853266b 13 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
samux 0:ba333853266b 14 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
samux 0:ba333853266b 15 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
samux 0:ba333853266b 16 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
samux 0:ba333853266b 17 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
samux 0:ba333853266b 18 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
samux 0:ba333853266b 19 * THE SOFTWARE.
samux 0:ba333853266b 20 */
samux 0:ba333853266b 21
samux 0:ba333853266b 22 #ifndef USBMSD_RAM_H
samux 0:ba333853266b 23 #define USBMSD_RAM_H
samux 0:ba333853266b 24
samux 0:ba333853266b 25 #include "mbed.h"
samux 0:ba333853266b 26 #include "USBMSD.h"
samux 0:ba333853266b 27
okini3939 2:69984d40fc4b 28 //#define NB_SECTORS (10)
okini3939 2:69984d40fc4b 29 #define RAW_SECTORS 6
okini3939 3:5b6b3320c4f4 30 #define IMG_SECTORS 200
samux 1:3d0c421fe52b 31
samux 0:ba333853266b 32 /** Use the SDcard as mass storage device using the USBMSD class
samux 0:ba333853266b 33 *
samux 0:ba333853266b 34 * @code
samux 0:ba333853266b 35 * #include "mbed.h"
samux 0:ba333853266b 36 * #include "USBMSD_Ram.h"
samux 0:ba333853266b 37 *
samux 0:ba333853266b 38 * USBMSD_Ram sd(p5, p6, p7, p8);
samux 0:ba333853266b 39 *
samux 0:ba333853266b 40 * int main() {
samux 0:ba333853266b 41 * while(1);
samux 0:ba333853266b 42 * }
samux 0:ba333853266b 43 *
samux 0:ba333853266b 44 * @endcode
samux 0:ba333853266b 45 */
samux 0:ba333853266b 46 class USBMSD_Ram : public USBMSD {
samux 0:ba333853266b 47 public:
samux 0:ba333853266b 48
samux 1:3d0c421fe52b 49
samux 0:ba333853266b 50 USBMSD_Ram();
samux 0:ba333853266b 51 virtual int disk_initialize();
okini3939 2:69984d40fc4b 52 virtual int disk_write(const uint8_t * data, uint64_t block, uint8_t count);
okini3939 2:69984d40fc4b 53 virtual int disk_read(uint8_t * data, uint64_t block, uint8_t count);
samux 0:ba333853266b 54 virtual int disk_status();
samux 0:ba333853266b 55 virtual int disk_sync();
samux 1:3d0c421fe52b 56 virtual uint64_t disk_sectors();
samux 1:3d0c421fe52b 57 virtual uint64_t disk_size();
okini3939 2:69984d40fc4b 58 virtual int disk_ioctl (uint8_t pdrv, uint8_t cmd, void* buff);
okini3939 2:69984d40fc4b 59
okini3939 3:5b6b3320c4f4 60 void (*parseFat)(int sector, const uint8_t *buf, int len);
okini3939 2:69984d40fc4b 61
samux 0:ba333853266b 62 protected:
samux 0:ba333853266b 63 int _status;
okini3939 2:69984d40fc4b 64 char disk_image[512*RAW_SECTORS];
samux 0:ba333853266b 65
samux 0:ba333853266b 66 };
samux 0:ba333853266b 67
samux 0:ba333853266b 68 #endif