IPS(Interpreter for Process Structures) for mbed

Dependencies:   ConfigFile FATFileSystem mbed

IPS port from linux/unix version.

mbed_blinky.ips

0 VAR led1
" LED1 " DigitalOut led1 !
: main
    ANFANG
    1 JA?
      1 led1 @ write
      200 wait_ms
      0 led1 @ write
      200 wait_ms
    DANN/NOCHMAL
;
main
Committer:
va009039
Date:
Sun May 24 21:29:48 2015 +0900
Revision:
4:b62b40563944
Parent:
1:e74530ad6b9e
fix I2C

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 1:e74530ad6b9e 1 /* mbed Microcontroller Library
va009039 1:e74530ad6b9e 2 * Copyright (c) 2006-2012 ARM Limited
va009039 1:e74530ad6b9e 3 *
va009039 1:e74530ad6b9e 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
va009039 1:e74530ad6b9e 5 * of this software and associated documentation files (the "Software"), to deal
va009039 1:e74530ad6b9e 6 * in the Software without restriction, including without limitation the rights
va009039 1:e74530ad6b9e 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
va009039 1:e74530ad6b9e 8 * copies of the Software, and to permit persons to whom the Software is
va009039 1:e74530ad6b9e 9 * furnished to do so, subject to the following conditions:
va009039 1:e74530ad6b9e 10 *
va009039 1:e74530ad6b9e 11 * The above copyright notice and this permission notice shall be included in
va009039 1:e74530ad6b9e 12 * all copies or substantial portions of the Software.
va009039 1:e74530ad6b9e 13 *
va009039 1:e74530ad6b9e 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
va009039 1:e74530ad6b9e 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
va009039 1:e74530ad6b9e 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
va009039 1:e74530ad6b9e 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
va009039 1:e74530ad6b9e 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
va009039 1:e74530ad6b9e 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
va009039 1:e74530ad6b9e 20 * SOFTWARE.
va009039 1:e74530ad6b9e 21 */
va009039 1:e74530ad6b9e 22 #ifndef MBED_SDFILESYSTEM_H
va009039 1:e74530ad6b9e 23 #define MBED_SDFILESYSTEM_H
va009039 1:e74530ad6b9e 24
va009039 1:e74530ad6b9e 25 #include "mbed.h"
va009039 1:e74530ad6b9e 26 #include "FATFileSystem.h"
va009039 1:e74530ad6b9e 27 #include <stdint.h>
va009039 1:e74530ad6b9e 28
va009039 1:e74530ad6b9e 29 /** Access the filesystem on an SD Card using SPI
va009039 1:e74530ad6b9e 30 *
va009039 1:e74530ad6b9e 31 * @code
va009039 1:e74530ad6b9e 32 * #include "mbed.h"
va009039 1:e74530ad6b9e 33 * #include "SDFileSystem.h"
va009039 1:e74530ad6b9e 34 *
va009039 1:e74530ad6b9e 35 * SDFileSystem sd(p5, p6, p7, p12, "sd"); // mosi, miso, sclk, cs
va009039 1:e74530ad6b9e 36 *
va009039 1:e74530ad6b9e 37 * int main() {
va009039 1:e74530ad6b9e 38 * FILE *fp = fopen("/sd/myfile.txt", "w");
va009039 1:e74530ad6b9e 39 * fprintf(fp, "Hello World!\n");
va009039 1:e74530ad6b9e 40 * fclose(fp);
va009039 1:e74530ad6b9e 41 * }
va009039 1:e74530ad6b9e 42 */
va009039 1:e74530ad6b9e 43 class SDFileSystem : public FATFileSystem {
va009039 1:e74530ad6b9e 44 public:
va009039 1:e74530ad6b9e 45
va009039 1:e74530ad6b9e 46 /** Create the File System for accessing an SD Card using SPI
va009039 1:e74530ad6b9e 47 *
va009039 1:e74530ad6b9e 48 * @param mosi SPI mosi pin connected to SD Card
va009039 1:e74530ad6b9e 49 * @param miso SPI miso pin conencted to SD Card
va009039 1:e74530ad6b9e 50 * @param sclk SPI sclk pin connected to SD Card
va009039 1:e74530ad6b9e 51 * @param cs DigitalOut pin used as SD Card chip select
va009039 1:e74530ad6b9e 52 * @param name The name used to access the virtual filesystem
va009039 1:e74530ad6b9e 53 */
va009039 1:e74530ad6b9e 54 SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
va009039 1:e74530ad6b9e 55 virtual int disk_initialize();
va009039 1:e74530ad6b9e 56 virtual int disk_status();
va009039 1:e74530ad6b9e 57 virtual int disk_read(uint8_t* buffer, uint64_t block_number, uint8_t count);
va009039 1:e74530ad6b9e 58 virtual int disk_write(const uint8_t* buffer, uint64_t block_number, uint8_t count);
va009039 1:e74530ad6b9e 59 virtual int disk_sync();
va009039 1:e74530ad6b9e 60 virtual uint64_t disk_sectors();
va009039 1:e74530ad6b9e 61
va009039 1:e74530ad6b9e 62 protected:
va009039 1:e74530ad6b9e 63
va009039 1:e74530ad6b9e 64 int _cmd(int cmd, int arg);
va009039 1:e74530ad6b9e 65 int _cmdx(int cmd, int arg);
va009039 1:e74530ad6b9e 66 int _cmd8();
va009039 1:e74530ad6b9e 67 int _cmd58();
va009039 1:e74530ad6b9e 68 int initialise_card();
va009039 1:e74530ad6b9e 69 int initialise_card_v1();
va009039 1:e74530ad6b9e 70 int initialise_card_v2();
va009039 1:e74530ad6b9e 71
va009039 1:e74530ad6b9e 72 int _read(uint8_t * buffer, uint32_t length);
va009039 1:e74530ad6b9e 73 int _write(const uint8_t *buffer, uint32_t length);
va009039 1:e74530ad6b9e 74 uint64_t _sd_sectors();
va009039 1:e74530ad6b9e 75 uint64_t _sectors;
va009039 1:e74530ad6b9e 76
va009039 1:e74530ad6b9e 77 void set_init_sck(uint32_t sck) { _init_sck = sck; }
va009039 1:e74530ad6b9e 78 // Note: The highest SPI clock rate is 20 MHz for MMC and 25 MHz for SD
va009039 1:e74530ad6b9e 79 void set_transfer_sck(uint32_t sck) { _transfer_sck = sck; }
va009039 1:e74530ad6b9e 80 uint32_t _init_sck;
va009039 1:e74530ad6b9e 81 uint32_t _transfer_sck;
va009039 1:e74530ad6b9e 82
va009039 1:e74530ad6b9e 83 SPI _spi;
va009039 1:e74530ad6b9e 84 DigitalOut _cs;
va009039 1:e74530ad6b9e 85 int cdv;
va009039 1:e74530ad6b9e 86 int _is_initialized;
va009039 1:e74530ad6b9e 87 };
va009039 1:e74530ad6b9e 88
va009039 1:e74530ad6b9e 89 #endif