uuu
uuu (Universal Update Utility), mfgtools 3.0
Toggle main menu visibility
Loading...
Searching...
No Matches
fat.h
Go to the documentation of this file.
1
/*
2
* Copyright 2018 NXP.
3
*
4
* Redistribution and use in source and binary forms, with or without modification,
5
* are permitted provided that the following conditions are met:
6
*
7
* Redistributions of source code must retain the above copyright notice, this
8
* list of conditions and the following disclaimer.
9
*
10
* Redistributions in binary form must reproduce the above copyright notice, this
11
* list of conditions and the following disclaimer in the documentation and/or
12
* other materials provided with the distribution.
13
*
14
* Neither the name of the NXP Semiconductor nor the names of its
15
* contributors may be used to endorse or promote products derived from this
16
* software without specific prior written permission.
17
*
18
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
* POSSIBILITY OF SUCH DAMAGE.
29
*
30
*/
31
32
#pragma once
33
34
#include "
backfile.h
"
35
#include "
buffer.h
"
36
37
#include <map>
38
39
#pragma pack(1)
40
struct
Partition
41
{
42
uint8_t
status
;
43
uint8_t
start_head
;
44
uint8_t
start_sector
;
45
uint8_t
start_cylinder
;
46
uint8_t
type
;
47
uint8_t
end_head
;
48
uint8_t
end_sector
;
49
uint8_t
end_cylinder
;
50
uint32_t
lba_start
;
51
uint32_t
lba_num
;
52
};
53
54
struct
FatDirEntry
55
{
56
uint8_t
filename
[8];
57
uint8_t
ext
[3];
58
uint8_t
attr
;
59
uint8_t
user_attr
;
60
uint8_t
delete_char
;
61
uint16_t
create_time
;
62
uint16_t
create_date
;
63
uint16_t
userid
;
64
uint16_t
access
;
65
uint16_t
modify_time
;
66
uint16_t
modify_date
;
67
uint16_t
start_cluster
;
68
uint32_t
file_size
;
69
};
70
71
struct
FatLFN
72
{
73
uint8_t
seq
;
74
uint8_t
name1
[10];
75
uint8_t
attr
;
76
uint8_t
type
;
77
uint8_t
sum
;
78
uint8_t
name2
[12];
79
uint16_t
start_cluster
;
80
uint8_t
name3
[4];
81
};
82
83
#pragma pack()
84
85
class
Fat
:
public
Backfile
86
{
87
public
:
88
void
*
get_data_buff
(shared_ptr<FileBuffer> p,
int
cluster);
89
int
get_file_buff
(
string
filename, shared_ptr<FileBuffer>p);
90
int
get_next_cluster
(shared_ptr<FileBuffer> p,
int
cluster);
91
string
lfn2string
(
FatLFN
*p);
92
int
Open
(
const
string
&filename);
93
94
map<string, FatDirEntry>
m_filemap
;
95
96
private
:
97
uint64_t
m_cluster
;
98
uint64_t
m_fat_part_start
;
99
uint64_t
m_fat_table_offset
;
100
uint64_t
m_logical_sector_perfat
;
101
int
m_num_of_rootdir
;
102
uint64_t
m_root_dir_offset
;
103
};
backfile.h
buffer.h
Backfile
Definition
backfile.h:37
Fat
Definition
fat.h:86
Fat::lfn2string
string lfn2string(FatLFN *p)
Definition
fat.cpp:185
Fat::m_cluster
uint64_t m_cluster
Definition
fat.h:97
Fat::get_file_buff
int get_file_buff(string filename, shared_ptr< FileBuffer >p)
Definition
fat.cpp:146
Fat::m_num_of_rootdir
int m_num_of_rootdir
Definition
fat.h:101
Fat::get_next_cluster
int get_next_cluster(shared_ptr< FileBuffer > p, int cluster)
Definition
fat.cpp:134
Fat::m_fat_part_start
uint64_t m_fat_part_start
Definition
fat.h:98
Fat::Open
int Open(const string &filename)
Definition
fat.cpp:41
Fat::m_filemap
map< string, FatDirEntry > m_filemap
Definition
fat.h:94
Fat::m_root_dir_offset
uint64_t m_root_dir_offset
Definition
fat.h:102
Fat::m_logical_sector_perfat
uint64_t m_logical_sector_perfat
Definition
fat.h:100
Fat::get_data_buff
void * get_data_buff(shared_ptr< FileBuffer > p, int cluster)
Definition
fat.cpp:140
Fat::m_fat_table_offset
uint64_t m_fat_table_offset
Definition
fat.h:99
FatDirEntry
Definition
fat.h:55
FatDirEntry::modify_date
uint16_t modify_date
Definition
fat.h:66
FatDirEntry::attr
uint8_t attr
Definition
fat.h:58
FatDirEntry::filename
uint8_t filename[8]
Definition
fat.h:56
FatDirEntry::create_time
uint16_t create_time
Definition
fat.h:61
FatDirEntry::create_date
uint16_t create_date
Definition
fat.h:62
FatDirEntry::access
uint16_t access
Definition
fat.h:64
FatDirEntry::user_attr
uint8_t user_attr
Definition
fat.h:59
FatDirEntry::modify_time
uint16_t modify_time
Definition
fat.h:65
FatDirEntry::start_cluster
uint16_t start_cluster
Definition
fat.h:67
FatDirEntry::file_size
uint32_t file_size
Definition
fat.h:68
FatDirEntry::ext
uint8_t ext[3]
Definition
fat.h:57
FatDirEntry::userid
uint16_t userid
Definition
fat.h:63
FatDirEntry::delete_char
uint8_t delete_char
Definition
fat.h:60
FatLFN
Definition
fat.h:72
FatLFN::start_cluster
uint16_t start_cluster
Definition
fat.h:79
FatLFN::type
uint8_t type
Definition
fat.h:76
FatLFN::name2
uint8_t name2[12]
Definition
fat.h:78
FatLFN::name1
uint8_t name1[10]
Definition
fat.h:74
FatLFN::sum
uint8_t sum
Definition
fat.h:77
FatLFN::seq
uint8_t seq
Definition
fat.h:73
FatLFN::name3
uint8_t name3[4]
Definition
fat.h:80
FatLFN::attr
uint8_t attr
Definition
fat.h:75
Partition
Definition
fat.h:41
Partition::end_head
uint8_t end_head
Definition
fat.h:47
Partition::type
uint8_t type
Definition
fat.h:46
Partition::end_sector
uint8_t end_sector
Definition
fat.h:48
Partition::start_sector
uint8_t start_sector
Definition
fat.h:44
Partition::lba_start
uint32_t lba_start
Definition
fat.h:50
Partition::start_head
uint8_t start_head
Definition
fat.h:43
Partition::lba_num
uint32_t lba_num
Definition
fat.h:51
Partition::end_cylinder
uint8_t end_cylinder
Definition
fat.h:49
Partition::status
uint8_t status
Definition
fat.h:42
Partition::start_cylinder
uint8_t start_cylinder
Definition
fat.h:45
libuuu
fat.h
Generated by
1.18.0