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 Embedded Artists

Committer:
embeddedartists
Date:
Thu Dec 11 18:23:07 2014 +0000
Revision:
9:a33326afd686
Parent:
0:6b68dac0d986
Updated documentation

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 9:a33326afd686 1 /*
embeddedartists 9:a33326afd686 2 * Copyright 2014 Embedded Artists AB
embeddedartists 9:a33326afd686 3 *
embeddedartists 9:a33326afd686 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 9:a33326afd686 5 * you may not use this file except in compliance with the License.
embeddedartists 9:a33326afd686 6 * You may obtain a copy of the License at
embeddedartists 9:a33326afd686 7 *
embeddedartists 9:a33326afd686 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 9:a33326afd686 9 *
embeddedartists 9:a33326afd686 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 9:a33326afd686 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 9:a33326afd686 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 9:a33326afd686 13 * See the License for the specific language governing permissions and
embeddedartists 9:a33326afd686 14 * limitations under the License.
embeddedartists 9:a33326afd686 15 */
embeddedartists 9:a33326afd686 16
embeddedartists 0:6b68dac0d986 17 #ifndef USBMSDRAMFS_H
embeddedartists 0:6b68dac0d986 18 #define USBMSDRAMFS_H
embeddedartists 0:6b68dac0d986 19
embeddedartists 0:6b68dac0d986 20 #include "mbed.h"
embeddedartists 0:6b68dac0d986 21 #include "USBMSD.h"
embeddedartists 0:6b68dac0d986 22 #include "RAMFileSystem.h"
embeddedartists 0:6b68dac0d986 23 #include <stdint.h>
embeddedartists 0:6b68dac0d986 24
embeddedartists 0:6b68dac0d986 25 /**
embeddedartists 0:6b68dac0d986 26 * USBMSD_RAMFS class: Allows the mbed board to expose a FAT file system in SDRAM as a USB memory stick
embeddedartists 0:6b68dac0d986 27 */
embeddedartists 0:6b68dac0d986 28 class USBMSD_RAMFS : public USBMSD {
embeddedartists 0:6b68dac0d986 29 public:
embeddedartists 0:6b68dac0d986 30
embeddedartists 0:6b68dac0d986 31 /**
embeddedartists 0:6b68dac0d986 32 * Constructor
embeddedartists 0:6b68dac0d986 33 *
embeddedartists 0:6b68dac0d986 34 * @param ramfs The RAM file system
embeddedartists 0:6b68dac0d986 35 * @param vendor_id Your vendor_id
embeddedartists 0:6b68dac0d986 36 * @param product_id Your product_id
embeddedartists 0:6b68dac0d986 37 * @param product_release Your preoduct_release
embeddedartists 0:6b68dac0d986 38 */
embeddedartists 0:6b68dac0d986 39 USBMSD_RAMFS(RAMFileSystem* ramfs, uint16_t vendor_id = 0x0703, uint16_t product_id = 0x0104, uint16_t product_release = 0x0001);
embeddedartists 0:6b68dac0d986 40
embeddedartists 0:6b68dac0d986 41 protected:
embeddedartists 0:6b68dac0d986 42
embeddedartists 0:6b68dac0d986 43 /*
embeddedartists 0:6b68dac0d986 44 * read one or more blocks on a storage chip
embeddedartists 0:6b68dac0d986 45 *
embeddedartists 0:6b68dac0d986 46 * @param data pointer where will be stored read data
embeddedartists 0:6b68dac0d986 47 * @param block starting block number
embeddedartists 0:6b68dac0d986 48 * @param count number of blocks to read
embeddedartists 0:6b68dac0d986 49 * @returns 0 if successful
embeddedartists 0:6b68dac0d986 50 */
embeddedartists 0:6b68dac0d986 51 virtual int disk_read(uint8_t* data, uint64_t block, uint8_t count);
embeddedartists 0:6b68dac0d986 52
embeddedartists 0:6b68dac0d986 53 /*
embeddedartists 0:6b68dac0d986 54 * write one or more blocks on a storage chip
embeddedartists 0:6b68dac0d986 55 *
embeddedartists 0:6b68dac0d986 56 * @param data data to write
embeddedartists 0:6b68dac0d986 57 * @param block starting block number
embeddedartists 0:6b68dac0d986 58 * @param count number of blocks to write
embeddedartists 0:6b68dac0d986 59 * @returns 0 if successful
embeddedartists 0:6b68dac0d986 60 */
embeddedartists 0:6b68dac0d986 61 virtual int disk_write(const uint8_t* data, uint64_t block, uint8_t count);
embeddedartists 0:6b68dac0d986 62
embeddedartists 0:6b68dac0d986 63 /*
embeddedartists 0:6b68dac0d986 64 * Disk initilization
embeddedartists 0:6b68dac0d986 65 */
embeddedartists 0:6b68dac0d986 66 virtual int disk_initialize();
embeddedartists 0:6b68dac0d986 67
embeddedartists 0:6b68dac0d986 68 /*
embeddedartists 0:6b68dac0d986 69 * Return the number of blocks
embeddedartists 0:6b68dac0d986 70 *
embeddedartists 0:6b68dac0d986 71 * @returns number of blocks
embeddedartists 0:6b68dac0d986 72 */
embeddedartists 0:6b68dac0d986 73 virtual uint64_t disk_sectors();
embeddedartists 0:6b68dac0d986 74
embeddedartists 0:6b68dac0d986 75 /*
embeddedartists 0:6b68dac0d986 76 * Return memory size
embeddedartists 0:6b68dac0d986 77 *
embeddedartists 0:6b68dac0d986 78 * @returns memory size
embeddedartists 0:6b68dac0d986 79 */
embeddedartists 0:6b68dac0d986 80 virtual uint64_t disk_size();
embeddedartists 0:6b68dac0d986 81
embeddedartists 0:6b68dac0d986 82
embeddedartists 0:6b68dac0d986 83 /*
embeddedartists 0:6b68dac0d986 84 * To check the status of the storage chip
embeddedartists 0:6b68dac0d986 85 *
embeddedartists 0:6b68dac0d986 86 * @returns status: 0: OK, 1: disk not initialized, 2: no medium in the drive, 4: write protected
embeddedartists 0:6b68dac0d986 87 */
embeddedartists 0:6b68dac0d986 88 virtual int disk_status();
embeddedartists 0:6b68dac0d986 89
embeddedartists 0:6b68dac0d986 90 protected:
embeddedartists 0:6b68dac0d986 91
embeddedartists 0:6b68dac0d986 92 RAMFileSystem* ramfs;
embeddedartists 0:6b68dac0d986 93 };
embeddedartists 0:6b68dac0d986 94
embeddedartists 0:6b68dac0d986 95 #endif