パラメータを適応変化させる事により圧縮率を向上させた動的ライス・ゴロム符号を利用した可逆圧縮方式。圧縮ソフト、圧縮率のMATLABシミュレーションは詳細はInterface誌2011年8月号に掲載されるRX62Nマイコン連動特集にて掲載予定。
SDHCFileSystem.h@0:d920d64db582, 2011-03-30 (annotated)
- Committer:
- lynxeyed_atsu
- Date:
- Wed Mar 30 06:05:24 2011 +0000
- Revision:
- 0:d920d64db582
alpha
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lynxeyed_atsu | 0:d920d64db582 | 1 | /* mbed SDFileSystem Library, for providing file access to SD cards |
lynxeyed_atsu | 0:d920d64db582 | 2 | * Copyright (c) 2008-2010, sford |
lynxeyed_atsu | 0:d920d64db582 | 3 | * |
lynxeyed_atsu | 0:d920d64db582 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
lynxeyed_atsu | 0:d920d64db582 | 5 | * of this software and associated documentation files (the "Software"), to deal |
lynxeyed_atsu | 0:d920d64db582 | 6 | * in the Software without restriction, including without limitation the rights |
lynxeyed_atsu | 0:d920d64db582 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
lynxeyed_atsu | 0:d920d64db582 | 8 | * copies of the Software, and to permit persons to whom the Software is |
lynxeyed_atsu | 0:d920d64db582 | 9 | * furnished to do so, subject to the following conditions: |
lynxeyed_atsu | 0:d920d64db582 | 10 | * |
lynxeyed_atsu | 0:d920d64db582 | 11 | * The above copyright notice and this permission notice shall be included in |
lynxeyed_atsu | 0:d920d64db582 | 12 | * all copies or substantial portions of the Software. |
lynxeyed_atsu | 0:d920d64db582 | 13 | * |
lynxeyed_atsu | 0:d920d64db582 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
lynxeyed_atsu | 0:d920d64db582 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
lynxeyed_atsu | 0:d920d64db582 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
lynxeyed_atsu | 0:d920d64db582 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
lynxeyed_atsu | 0:d920d64db582 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
lynxeyed_atsu | 0:d920d64db582 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
lynxeyed_atsu | 0:d920d64db582 | 20 | * THE SOFTWARE. |
lynxeyed_atsu | 0:d920d64db582 | 21 | */ |
lynxeyed_atsu | 0:d920d64db582 | 22 | |
lynxeyed_atsu | 0:d920d64db582 | 23 | #ifndef MBED_SDHCFILESYSTEM_H |
lynxeyed_atsu | 0:d920d64db582 | 24 | #define MBED_SDHCFILESYSTEM_H |
lynxeyed_atsu | 0:d920d64db582 | 25 | |
lynxeyed_atsu | 0:d920d64db582 | 26 | #include "mbed.h" |
lynxeyed_atsu | 0:d920d64db582 | 27 | #include "FATFileSystem.h" |
lynxeyed_atsu | 0:d920d64db582 | 28 | |
lynxeyed_atsu | 0:d920d64db582 | 29 | /* Double Words */ |
lynxeyed_atsu | 0:d920d64db582 | 30 | typedef unsigned long long uint64_t; |
lynxeyed_atsu | 0:d920d64db582 | 31 | typedef long long sint64_t; |
lynxeyed_atsu | 0:d920d64db582 | 32 | |
lynxeyed_atsu | 0:d920d64db582 | 33 | /** Access the filesystem on an SD Card using SPI |
lynxeyed_atsu | 0:d920d64db582 | 34 | * |
lynxeyed_atsu | 0:d920d64db582 | 35 | * @code |
lynxeyed_atsu | 0:d920d64db582 | 36 | * #include "mbed.h" |
lynxeyed_atsu | 0:d920d64db582 | 37 | * #include "SDFileSystem.h" |
lynxeyed_atsu | 0:d920d64db582 | 38 | * |
lynxeyed_atsu | 0:d920d64db582 | 39 | * SDFileSystem sd(p5, p6, p7, p12, "sd"); // mosi, miso, sclk, cs |
lynxeyed_atsu | 0:d920d64db582 | 40 | * |
lynxeyed_atsu | 0:d920d64db582 | 41 | * int main() { |
lynxeyed_atsu | 0:d920d64db582 | 42 | * FILE *fp = fopen("/sd/myfile.txt", "w"); |
lynxeyed_atsu | 0:d920d64db582 | 43 | * fprintf(fp, "Hello World!\n"); |
lynxeyed_atsu | 0:d920d64db582 | 44 | * fclose(fp); |
lynxeyed_atsu | 0:d920d64db582 | 45 | * } |
lynxeyed_atsu | 0:d920d64db582 | 46 | */ |
lynxeyed_atsu | 0:d920d64db582 | 47 | class SDFileSystem : public FATFileSystem { |
lynxeyed_atsu | 0:d920d64db582 | 48 | public: |
lynxeyed_atsu | 0:d920d64db582 | 49 | |
lynxeyed_atsu | 0:d920d64db582 | 50 | /** Create the File System for accessing an SD Card using SPI |
lynxeyed_atsu | 0:d920d64db582 | 51 | * |
lynxeyed_atsu | 0:d920d64db582 | 52 | * @param mosi SPI mosi pin connected to SD Card |
lynxeyed_atsu | 0:d920d64db582 | 53 | * @param miso SPI miso pin conencted to SD Card |
lynxeyed_atsu | 0:d920d64db582 | 54 | * @param sclk SPI sclk pin connected to SD Card |
lynxeyed_atsu | 0:d920d64db582 | 55 | * @param cs DigitalOut pin used as SD Card chip select |
lynxeyed_atsu | 0:d920d64db582 | 56 | * @param name The name used to access the virtual filesystem |
lynxeyed_atsu | 0:d920d64db582 | 57 | */ |
lynxeyed_atsu | 0:d920d64db582 | 58 | SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name); |
lynxeyed_atsu | 0:d920d64db582 | 59 | virtual int disk_initialize(); |
lynxeyed_atsu | 0:d920d64db582 | 60 | virtual int disk_write(const char *buffer, int block_number); |
lynxeyed_atsu | 0:d920d64db582 | 61 | virtual int disk_read(char *buffer, int block_number); |
lynxeyed_atsu | 0:d920d64db582 | 62 | virtual int disk_status(); |
lynxeyed_atsu | 0:d920d64db582 | 63 | virtual int disk_sync(); |
lynxeyed_atsu | 0:d920d64db582 | 64 | virtual int disk_sectors(); |
lynxeyed_atsu | 0:d920d64db582 | 65 | |
lynxeyed_atsu | 0:d920d64db582 | 66 | protected: |
lynxeyed_atsu | 0:d920d64db582 | 67 | |
lynxeyed_atsu | 0:d920d64db582 | 68 | int _cmd(int cmd, int arg); |
lynxeyed_atsu | 0:d920d64db582 | 69 | int _cmdx(int cmd, int arg); |
lynxeyed_atsu | 0:d920d64db582 | 70 | int _cmd8(); |
lynxeyed_atsu | 0:d920d64db582 | 71 | int _cmd58(); |
lynxeyed_atsu | 0:d920d64db582 | 72 | int initialise_card(); |
lynxeyed_atsu | 0:d920d64db582 | 73 | int initialise_card_v1(); |
lynxeyed_atsu | 0:d920d64db582 | 74 | int initialise_card_v2(); |
lynxeyed_atsu | 0:d920d64db582 | 75 | |
lynxeyed_atsu | 0:d920d64db582 | 76 | int _read(char *buffer, int length); |
lynxeyed_atsu | 0:d920d64db582 | 77 | int _write(const char *buffer, int length); |
lynxeyed_atsu | 0:d920d64db582 | 78 | int _sd_sectors(); |
lynxeyed_atsu | 0:d920d64db582 | 79 | int _sectors; |
lynxeyed_atsu | 0:d920d64db582 | 80 | |
lynxeyed_atsu | 0:d920d64db582 | 81 | SPI _spi; |
lynxeyed_atsu | 0:d920d64db582 | 82 | DigitalOut _cs; |
lynxeyed_atsu | 0:d920d64db582 | 83 | int cdv; |
lynxeyed_atsu | 0:d920d64db582 | 84 | }; |
lynxeyed_atsu | 0:d920d64db582 | 85 | |
lynxeyed_atsu | 0:d920d64db582 | 86 | #endif |