CN111857843A - Method and device for SD card partition switching - Google Patents
Method and device for SD card partition switching Download PDFInfo
- Publication number
- CN111857843A CN111857843A CN202010552083.0A CN202010552083A CN111857843A CN 111857843 A CN111857843 A CN 111857843A CN 202010552083 A CN202010552083 A CN 202010552083A CN 111857843 A CN111857843 A CN 111857843A
- Authority
- CN
- China
- Prior art keywords
- partition
- card
- fat
- file
- controller
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000005192 partition Methods 0.000 title claims abstract description 107
- 238000000034 method Methods 0.000 title claims abstract description 19
- 238000004364 calculation method Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000005540 biological transmission Effects 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/4401—Bootstrapping
- G06F9/4411—Configuring for operating with peripheral devices; Loading of device drivers
- G06F9/4413—Plug-and-play [PnP]
Abstract
A method and a device for SD card partition switching are provided. When the SD card is powered on, the controller reads DBR data of the current default loading partition, judges the format of a partition file system, and an analysis system reserves the number of sectors, the number of sectors in each cluster, the number of FAT tables and the number of sectors occupied by each FAT, then calculates the position of a root directory, reads data under the root directory and analyzes files under the root directory; resolving to a specific file, the controller reads the corresponding partition head address, sets the partition as a default loading partition, and deletes the specific file from the old default partition. The method is used for SD card partition switching.
Description
The technical field is as follows:
the invention relates to a method and equipment for switching SD card partitions.
Background art:
an SD card (secure digital card) is a very small flash memory card, a new generation of memory devices based on semiconductor flash memory, and is widely used in portable devices such as electronic dictionaries, mobile phones, digital cameras, car navigation systems due to its excellent characteristics of small size, fast data transmission speed, hot-swappable, and the like.
The card can realize a plurality of FAT (file allocation table) partitions, however, the SD card can only load one FAT partition when being powered on, and the common way of loading other FAT partitions is to use APP (application program) to issue a specific instruction, the SD card controller marks the partition to be loaded when being powered on, and the specified partition is loaded when being powered on again, so that the purpose of switching the partitions is achieved.
However, devices supporting the SD card are various, and different devices are equipped with different operating systems. The use of multiple partitions on different devices can be realized only by developing multiple APPs, and the application of multiple partitions of the SD card is greatly limited.
The invention content is as follows:
the invention aims to provide a method and equipment for switching the partitions of an SD card, which can be separated from an application program APP and complete the function of switching between the partitions.
The above purpose is realized by the following technical scheme:
a method for switching SD card partition includes that when an SD card is powered on, a controller reads DBR data of relative decibels of a current default loading partition, judges a partition file system format, an analysis system reserves sector number, sector number of each cluster, FAT table number and sector number occupied by each FAT, then calculates the position of a root directory, reads data under the root directory and analyzes files under the root directory; resolving to a specific file, the controller reads the corresponding partition head address, sets the partition as a default loading partition, and deletes the specific file from the old default partition.
According to the method for switching the SD card partitions, when the SD card is powered on and before a system loads a FAT partition, a controller analyzes the FAT information of a partition to be loaded at present, a partition root directory file is searched, when a specific file is searched, the controller loads a corresponding partition, the partition is set as a powered-on default loading partition, and the specific file in an old default partition is deleted.
According to the method for switching the partitions of the SD card, if other partitions are used, only specific files corresponding to the other partitions are created in the current partition, and then the SD card is plugged again to complete partition switching without APP participation.
The device for the SD card partition switching method comprises the following steps: the SD card comprises an SD controller, the SD controller is connected with a Flash memory, and the Flash memory comprises a FAT partition 1, a FAT partition 2 and a FAT partition 3.
Has the advantages that:
1. the invention can complete the purpose of switching the partitions without independently developing the Host (Host) end application program APP.
The invention judges the existing specific file by analyzing the FAT subarea and loads the corresponding subarea so as to achieve the aim of switching the subareas.
Description of the drawings:
FIG. 1 is a diagram of a multi-partition SD card architecture of the present invention.
FIG. 2 is a flow chart of the present invention.
Fig. 3 is a FAT partition format diagram of the present invention.
The specific implementation mode is as follows:
the technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings of the present invention.
Example 1:
a method for switching SD card partition includes reading DBR (system boot record sector) data of current default loading partition by a controller when SD card is powered on, judging partition file system format, analyzing sector number reserved by system, sector number of each cluster, FAT (file allocation table) table number and sector number occupied by each FAT (file allocation table), calculating position of root directory, reading data under root directory and analyzing file under root directory; resolving to a specific file, the controller reads the corresponding partition head address, sets the partition as a default loading partition, and deletes the specific file from the old default partition.
Example 2:
in the method for switching partitions of an SD card in embodiment 1, when the SD card is powered on, before a system loads a FAT (file allocation table) partition, a controller analyzes the FAT (file allocation table) information of a partition to be currently loaded, retrieves a partition root directory file, and when a specific file is retrieved, the controller loads a partition corresponding to the partition, sets the partition as a powered-on default loaded partition, and deletes the specific file in an old default partition.
Example 3:
in the method for switching partitions of an SD card described in embodiment 1, if other partitions are used, only specific files corresponding to the other partitions need to be created in the current partition, and then the SD card is plugged again to complete the partition switching without participation of an APP.
Example 4:
the device of the SD card partition switching method according to embodiment 1 includes: the SD card comprises an SD controller, the SD controller is connected with a Flash memory, and the Flash memory comprises a FAT (file allocation table) partition 1, a FAT (file allocation table) partition 2 and a FAT (file allocation table) partition 3.
Example 5:
in the method for switching partitions of an SD card according to the above embodiment, when the SD card is powered on, the FAT (file allocation table) information in the current default loaded partition is analyzed, and if a file with a specific name exists, the specified partition is loaded, so that the purpose of switching partitions is achieved; if no specific file is found, the default partition is loaded. This application can make the SD card break away from APP, reaches the purpose of switching the subregion.
Example 6:
the method for switching the partition of the SD card according to the above embodiment includes analyzing relative decibel DBR information,
The present invention supports only a file system of FAT (file allocation table) format.
The 0x1FE and 0x1FF positions of the relative decibel DBR are signature names (SignatureWord), FAT (file allocation table) signature names 0x55 and 0 xAA;
0x0E and 0x 0F: indicates the reserved sector number ReservedSector;
0x 36-0 x 4A: a value of "FAT 16" indicates that the partition is in FAT16 format;
0x 52-0 x 56: a value of "FAT 32" indicates that the partition is in FAT32 format;
0x0D position: indicating how many Sector sectors sectorstand per Cluster;
0x 10: the number of FAT (File Allocation Table);
0X 2C-0X 2F: the starting cluster number.
Root directory start sector calculation:
root directory start sector = number of reserved sectors + number of hidden sectors + number of sectors x2 + (start cluster number-2) x of FAT (file allocation table) per cluster.
Document parsing of the two parties
In consideration of the timeliness of the upper disk, the card reader is overtime caused by too long time, so that the invention only supports specific file operation under the root directory, and the file name adopts a short file name of 83 naming system, so that the directory entry of the short file name can be analyzed.
Reading root directory data, analyzing according to a short file name directory entry by taking 32 bytes as a unit, and judging whether a specific file exists or not; if so, the controller reads the corresponding FAT (File configuration Table) partition and returns the data to the Host. Deleting the specific file in the old partition in a deleting mode: the first byte of the short filename directory entry is assigned 0xE5 and written back to the old partition. Finally deleting the specific file from the old FAT (file allocation table) information;
Analyzing the initial cluster number of the file from the directory entry of the short filename, and calculating the sector position of the file in the FAT (file allocation table), wherein the calculation method comprises the following steps:
ulFatSectorAddress = (ulFatStartSector + (ulFileStartCluster*4/512));
ulFatSectorrAddress: sector address for file storage
ulFatStartSector: sector address at the beginning of FAT (File Allocation Table) area
ulFileStartCluster: file start cluster address
Reading FAT (file allocation table) sector where the file is located, clearing the position of the file, writing back the FAT (file allocation table) table and completely deleting the specific file.
If no specific file is found, the current default partition is loaded.
Claims (4)
1. A method for switching SD card partitions is characterized in that when an SD card is powered on, a controller reads DBR data of relative decibels of a current default loading partition, judges a partition file system format, an analysis system reserves the number of sectors, the number of sectors of each cluster, the number of FAT tables and the number of sectors occupied by each FAT, then calculates the position of a root directory, reads data under the root directory and analyzes files under the root directory; resolving to a specific file, the controller reads the corresponding partition head address, sets the partition as a default loading partition, and deletes the specific file from the old default partition.
2. The method as claimed in claim 1, wherein when the SD card is powered on and before the system loads the FAT partition, the controller analyzes the FAT information of the partition to be loaded currently, retrieves the partition root directory file, and when a specific file is retrieved, the controller loads the partition corresponding to the specific file, sets the partition as a powered default loaded partition, and deletes the specific file in the old default partition.
3. The method for switching the partitions of the SD card as claimed in claim 1, wherein if other partitions are used, the partition switching can be completed only by creating specific files corresponding to the other partitions in the current partition and then plugging the SD card again without participation of an APP.
4. The apparatus of claim 1, comprising: the Host terminal is characterized in that the Host terminal is connected with an SD card, the SD card comprises an SD controller, the SD controller is connected with a Flash memory, and the Flash memory comprises an FAT partition 1, an FAT partition 2 and an FAT partition 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010552083.0A CN111857843A (en) | 2020-06-17 | 2020-06-17 | Method and device for SD card partition switching |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010552083.0A CN111857843A (en) | 2020-06-17 | 2020-06-17 | Method and device for SD card partition switching |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111857843A true CN111857843A (en) | 2020-10-30 |
Family
ID=72986746
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010552083.0A Pending CN111857843A (en) | 2020-06-17 | 2020-06-17 | Method and device for SD card partition switching |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111857843A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2005017757A1 (en) * | 2003-08-07 | 2005-02-24 | Matsushita Electric Industrial Co., Ltd. | Information storage device having a divided area in memory area |
US20110252191A1 (en) * | 2010-04-07 | 2011-10-13 | Phison Electronics Corp. | Method of dynamically switching partitions, memory card controller and memory card storage system |
CN102280134A (en) * | 2011-06-17 | 2011-12-14 | 苏州国芯科技有限公司 | Method for improving data security in removable storage device |
CN104978231A (en) * | 2015-07-10 | 2015-10-14 | 上海斐讯数据通信技术有限公司 | Multisystem device based on internal storage partitions and loading and switching method thereof |
CN105045528A (en) * | 2015-06-24 | 2015-11-11 | 武汉烽火众智数字技术有限责任公司 | Fast FAT32 disk partition traversal and file searching method |
-
2020
- 2020-06-17 CN CN202010552083.0A patent/CN111857843A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2005017757A1 (en) * | 2003-08-07 | 2005-02-24 | Matsushita Electric Industrial Co., Ltd. | Information storage device having a divided area in memory area |
US20110252191A1 (en) * | 2010-04-07 | 2011-10-13 | Phison Electronics Corp. | Method of dynamically switching partitions, memory card controller and memory card storage system |
CN102280134A (en) * | 2011-06-17 | 2011-12-14 | 苏州国芯科技有限公司 | Method for improving data security in removable storage device |
CN105045528A (en) * | 2015-06-24 | 2015-11-11 | 武汉烽火众智数字技术有限责任公司 | Fast FAT32 disk partition traversal and file searching method |
CN104978231A (en) * | 2015-07-10 | 2015-10-14 | 上海斐讯数据通信技术有限公司 | Multisystem device based on internal storage partitions and loading and switching method thereof |
Non-Patent Citations (1)
Title |
---|
毛明: "《计算机病毒原理与反病毒工具》", 科学技术文献出版社, pages: 1 - 17 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6823417B2 (en) | Memory controller for memory card manages file allocation table | |
CN108090168B (en) | Universal F2FS file system parsing method, terminal device and storage medium | |
EP2146293B1 (en) | Mobile terminal having function of managing file and folder | |
US8977802B2 (en) | Access device, information recording device, controller, real time information recording system, access method, and program | |
WO2005050453A1 (en) | File recording device | |
CN101582084B (en) | Method and device for data storage | |
CN109284252B (en) | Lightweight file system management method in communication equipment | |
CN101983376A (en) | Access device, information recording device, information recording system, file management method, and program | |
EP1826663A2 (en) | Apparatus, method and computer program for processing information | |
KR20140093505A (en) | Method and apparatus for extending memory in terminal | |
CN107391038A (en) | Method for writing data, flash memory and the storage medium of data storage type flash memory | |
US20140258247A1 (en) | Electronic apparatus for data access and data access method therefor | |
CN103729418B (en) | Vehicular platform media file managing method | |
CN106709014B (en) | File system conversion method and device | |
KR20160048173A (en) | Storage processing method, device and terminal | |
CN102591797A (en) | Auxiliary storage device and processing method thereof | |
KR20090031102A (en) | Method and apparatus for formatting for a potable storage device | |
US20120260022A1 (en) | Handling commands within a write-once read-many storage device configuration | |
CN111857843A (en) | Method and device for SD card partition switching | |
EP2835737A1 (en) | Data terminal running mode switching method, device, and data terminal | |
US6959309B2 (en) | Interface between programming languages and method therefor | |
CN101089842A (en) | Method for duplicating file in embedded equipment | |
CN113242321B (en) | Data transmission method for mobile storage device | |
CN114936189A (en) | Application program operation method and device, computer equipment and readable storage medium | |
WO2012019388A1 (en) | Method, system and device for file download |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |