VSF Documented
vsf_fakefat32_mal.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_FAKEFAT32_MAL_H__
19#define __VSF_FAKEFAT32_MAL_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "../../vsf_mal_cfg.h"
24
25#if VSF_USE_MAL == ENABLED && VSF_MAL_USE_FAKEFAT32_MAL == ENABLED
26
27#include "component/fs/vsf_fs.h"
28// DO NOT REMOVE vsf_memfs.h BELOW, unless you really know what you are doing.
29// vsf_fs.h includes vsf_mal.h for malfs to use mal
30// vsf_mal.h includes vsf_fs.h for fakefat32_mal to use memfs
32
33#if defined(__VSF_FAKEFAT32_MAL_CLASS_IMPLEMENT)
34# undef __VSF_FAKEFAT32_MAL_CLASS_IMPLEMENT
35# define __VSF_CLASS_IMPLEMENT__
36#endif
37
38#include "utilities/ooc_class.h"
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
44/*============================ MACROS ========================================*/
45
46#if VSF_USE_FS != ENABLED || VSF_FS_USE_MEMFS != ENABLED || VSF_FS_USE_FATFS != ENABLED
47# error FAKEFAT32 need memfs and fatfs
48#endif
49
50/*============================ MACROFIED FUNCTIONS ===========================*/
51/*============================ TYPES =========================================*/
52
55
57 public_member(
58 implement(vk_memfs_file_t)
59 )
60
61 private_member(
62 uint32_t first_cluster;
64 struct {
65 // refer to :
66 // Microsoft Extensible Firmware Initiative FAT32 File System Specification
67 uint8_t CrtTimeTenth;
68 uint16_t CrtTime;
69 uint16_t CrtDate;
70 uint16_t LastAccDate;
71 uint16_t FstClusHI;
72 uint16_t WrtTime;
73 uint16_t WrtDate;
74 uint16_t FstClusLO;
75 } VSF_CAL_PACKED record;
76 )
77};
78
79
81 public_member(
82 implement(vk_mal_t)
83
84 uint32_t sector_number;
85 uint16_t sector_size;
86 uint8_t sectors_per_cluster;
87
88 uint32_t volume_id;
89 uint32_t disk_id;
90
92 vsf_err_t err;
93 )
94};
95
96/*============================ GLOBAL VARIABLES ==============================*/
97
99
100/*============================ PROTOTYPES ====================================*/
101
102#ifdef __cplusplus
103}
104#endif
105
106#endif // VSF_USE_MAL && VSF_MAL_USE_FAKEFAT32_MAL
107#endif // __VSF_FAKEFAT32_MAL_H__
vsf_err_t
Definition __type.h:42
Definition vsf_fakefat32_mal.h:56
Definition vsf_fakefat32_mal.h:80
mal driver
Definition vsf_mal.h:98
mal class
Definition vsf_mal.h:154
Definition vsf_memfs.h:55
#define vsf_dcl_class
Definition ooc_class.h:46
#define vsf_class(__name)
Definition ooc_class.h:48
unsigned short uint16_t
Definition stdint.h:7
unsigned uint32_t
Definition stdint.h:9
unsigned char uint8_t
Definition stdint.h:5
const vk_mal_drv_t vk_fakefat32_mal_drv
struct vk_romfs_header_t VSF_CAL_PACKED