GroupU - 05012018 1543

Fork of 352 by Elec351 MMB

Committer:
mslade
Date:
Tue Jan 09 14:53:07 2018 +0000
Revision:
1:84581acd1333
Final Version - Group U

Who changed what in which revision?

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