source: asp3_tinet_ecnl_arm/trunk/ntshell/fatfs/sdfs.h@ 352

Last change on this file since 352 was 352, checked in by coas-nagasima, 6 years ago

arm向けASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 2.6 KB
Line 
1/* mbed Microcontroller Library
2 * Copyright (c) 2006-2012 ARM Limited
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22#ifndef MBED_SDFILESYSTEM_H
23#define MBED_SDFILESYSTEM_H
24
25#include <stdint.h>
26//#include <time.h>
27#define __NEED_time_t
28#include "../musl-1.1.18/include/bits/alltypes.h"
29#include "gpio_api.h"
30#include "spi_api.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/** Access the filesystem on an SD Card using SPI
37 *
38 * @code
39 * #include "mbed.h"
40 * #include "SDFileSystem.h"
41 *
42 * SDFileSystem sd(p5, p6, p7, p12, "sd"); // MOSI, MISO, SCLK, SSEL
43 *
44 * int main() {
45 * FILE *fp = fopen("/sd/mbed.txt", "w");
46 * fprintf(fp, "Hello World!\n");
47 * fclose(fp);
48 * }
49 * @endcode
50 */
51typedef struct sdfs_s{
52 const char* name;
53 uint64_t _sectors;
54 spi_t _spi;
55 gpio_t _cs;
56 int cdv;
57 uint32_t _init_sck;
58 uint32_t _transfer_sck;
59 int _is_initialized;
60} sdfs_t;
61
62/** Create the File System for accessing an SD Card using SPI
63 *
64 * @param mosi SPI mosi pin connected to SD Card
65 * @param miso SPI miso pin conencted to SD Card
66 * @param sclk SPI sclk pin connected to SD Card
67 * @param cs DigitalOut pin used as SD Card chip select
68 * @param name The name used to access the virtual filesystem
69 */
70sdfs_init(sdfs_t *obj, PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name);
71
72int sdfs_initialize(sdfs_t *obj);
73int sdfs_status(sdfs_t *obj);
74int sdfs_read(sdfs_t *obj, uint8_t * buffer, uint32_t sector, uint32_t count);
75int sdfs_write(sdfs_t *obj, const uint8_t * buffer, uint32_t sector, uint32_t count);
76int sdfs_sync(sdfs_t *obj);
77uint64_t sdfs_sectors(sdfs_t *obj);
78
79#ifdef __cplusplus
80}
81#endif
82
83#endif
Note: See TracBrowser for help on using the repository browser.