ELEC351 SUBMISSION - Same as on the DLE

/media/uploads/Luka_Danilovic/elec_315_prototype_assembly.jpg

Committer:
Luka_Danilovic
Date:
Wed Jan 10 09:49:43 2018 +0000
Revision:
0:c66224a27cf8
ELEC351 SUBMISSION - SAme as on the DLE

Who changed what in which revision?

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