SD card example code for Seeed Wio 3G

Fork of Wio_3G-example-sd-driver by Toyomasa Watarai

Committer:
MACRUM
Date:
Thu Aug 09 01:42:53 2018 +0000
Revision:
0:8eedb2495d52
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 0:8eedb2495d52 1 /** @file fsfat_test.h
MACRUM 0:8eedb2495d52 2 *
MACRUM 0:8eedb2495d52 3 * mbed Microcontroller Library
MACRUM 0:8eedb2495d52 4 * Copyright (c) 2006-2016 ARM Limited
MACRUM 0:8eedb2495d52 5 *
MACRUM 0:8eedb2495d52 6 * Licensed under the Apache License, Version 2.0 (the "License");
MACRUM 0:8eedb2495d52 7 * you may not use this file except in compliance with the License.
MACRUM 0:8eedb2495d52 8 * You may obtain a copy of the License at
MACRUM 0:8eedb2495d52 9 *
MACRUM 0:8eedb2495d52 10 * http://www.apache.org/licenses/LICENSE-2.0
MACRUM 0:8eedb2495d52 11 *
MACRUM 0:8eedb2495d52 12 * Unless required by applicable law or agreed to in writing, software
MACRUM 0:8eedb2495d52 13 * distributed under the License is distributed on an "AS IS" BASIS,
MACRUM 0:8eedb2495d52 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 0:8eedb2495d52 15 * See the License for the specific language governing permissions and
MACRUM 0:8eedb2495d52 16 * limitations under the License.
MACRUM 0:8eedb2495d52 17 *
MACRUM 0:8eedb2495d52 18 * Header file for test support data structures and function API.
MACRUM 0:8eedb2495d52 19 */
MACRUM 0:8eedb2495d52 20 #ifndef __FSFAT_TEST_H
MACRUM 0:8eedb2495d52 21 #define __FSFAT_TEST_H
MACRUM 0:8eedb2495d52 22
MACRUM 0:8eedb2495d52 23 #include <stdint.h>
MACRUM 0:8eedb2495d52 24 #include <stdlib.h>
MACRUM 0:8eedb2495d52 25 #include <stdbool.h>
MACRUM 0:8eedb2495d52 26
MACRUM 0:8eedb2495d52 27 #ifdef __cplusplus
MACRUM 0:8eedb2495d52 28 extern "C" {
MACRUM 0:8eedb2495d52 29 #endif
MACRUM 0:8eedb2495d52 30
MACRUM 0:8eedb2495d52 31 /* Defines */
MACRUM 0:8eedb2495d52 32 //#define FSFAT_INIT_1_TABLE_HEAD { "a", ""}
MACRUM 0:8eedb2495d52 33 #define FSFAT_INIT_1_TABLE_MID_NODE { "/sd/01234567.txt", "abcdefghijklmnopqrstuvwxyz"}
MACRUM 0:8eedb2495d52 34 //#define FSFAT_INIT_1_TABLE_TAIL { "/sd/fopentst/hello/world/animal/wobbly/dog/foot/backrght.txt", "present"}
MACRUM 0:8eedb2495d52 35 #define FSFAT_TEST_RW_TABLE_SENTINEL 0xffffffff
MACRUM 0:8eedb2495d52 36 #define FSFAT_TEST_BYTE_DATA_TABLE_SIZE 256
MACRUM 0:8eedb2495d52 37 #define FSFAT_UTEST_MSG_BUF_SIZE 256
MACRUM 0:8eedb2495d52 38 #define FSFAT_UTEST_DEFAULT_TIMEOUT_MS 10000
MACRUM 0:8eedb2495d52 39 #define FSFAT_MBED_HOSTTEST_TIMEOUT 60
MACRUM 0:8eedb2495d52 40 #define FSFAT_MAX_FILE_BASENAME 8
MACRUM 0:8eedb2495d52 41 #define FSFAT_MAX_FILE_EXTNAME 3
MACRUM 0:8eedb2495d52 42 #define FSFAT_BUF_MAX_LENGTH 64
MACRUM 0:8eedb2495d52 43 #define FSFAT_FILENAME_MAX_LENGTH 255
MACRUM 0:8eedb2495d52 44
MACRUM 0:8eedb2495d52 45
MACRUM 0:8eedb2495d52 46 /* support macro for make string for utest _MESSAGE macros, which dont support formatted output */
MACRUM 0:8eedb2495d52 47 #define FSFAT_TEST_UTEST_MESSAGE(_buf, _max_len, _fmt, ...) \
MACRUM 0:8eedb2495d52 48 do \
MACRUM 0:8eedb2495d52 49 { \
MACRUM 0:8eedb2495d52 50 snprintf((_buf), (_max_len), (_fmt), __VA_ARGS__); \
MACRUM 0:8eedb2495d52 51 }while(0);
MACRUM 0:8eedb2495d52 52
MACRUM 0:8eedb2495d52 53
MACRUM 0:8eedb2495d52 54 /*
MACRUM 0:8eedb2495d52 55 * Structures
MACRUM 0:8eedb2495d52 56 */
MACRUM 0:8eedb2495d52 57
MACRUM 0:8eedb2495d52 58 /* kv data for test */
MACRUM 0:8eedb2495d52 59 typedef struct fsfat_kv_data_t {
MACRUM 0:8eedb2495d52 60 const char* filename;
MACRUM 0:8eedb2495d52 61 const char* value;
MACRUM 0:8eedb2495d52 62 } fsfat_kv_data_t;
MACRUM 0:8eedb2495d52 63
MACRUM 0:8eedb2495d52 64
MACRUM 0:8eedb2495d52 65 extern const uint8_t fsfat_test_byte_data_table[FSFAT_TEST_BYTE_DATA_TABLE_SIZE];
MACRUM 0:8eedb2495d52 66
MACRUM 0:8eedb2495d52 67 int32_t fsfat_test_create(const char* filename, const char* data, size_t len);
MACRUM 0:8eedb2495d52 68 int32_t fsfat_test_delete(const char* key_name);
MACRUM 0:8eedb2495d52 69 int32_t fsfat_test_filename_gen(char* name, const size_t len);
MACRUM 0:8eedb2495d52 70 #ifdef __cplusplus
MACRUM 0:8eedb2495d52 71 }
MACRUM 0:8eedb2495d52 72 #endif
MACRUM 0:8eedb2495d52 73
MACRUM 0:8eedb2495d52 74 #endif /* __FSFAT_TEST_H */