Disclosure of Invention
The present invention is directed to a mobile terminal, which is unable to use a memory card with a large capacity, for example, more than 4G, resulting in wasted memory space and inconvenient use of a user.
In order to achieve the above object, according to an aspect of the present invention, there is provided a method of applying a large-capacity memory card for a case where a capacity of the memory card is larger than a maximum capacity supported by a mobile terminal, the method including: the memory card is divided into n logical memory cards and an address mapping function of the underlying interface is set, wherein,
m is the capacity of the memory card, N is the maximum capacity supported by the mobile terminal, and the address mapping function is used for realizing the logic memory cardThe address of the memory card and the address of the memory card; allocating an independent file system for each of the n logical memory cards; operations on the logical memory card are mapped to operations on the memory card according to the address mapping function and information in the file system.
Preferably, the information in the file system includes: and the first offset block address is an offset block address taking the first block address in the logic memory card where the file is located as a reference.
Preferably, when the capacity of the memory card is judged to be larger than the maximum capacity supported by the mobile terminal, the method further includes: acquiring preset parameters of the memory card, and calculating the capacity of the memory card according to the preset parameters, wherein the preset parameters comprise: BLOCK SIZE BLOCK _ SIZE and total BLOCK number BLOCK _ NUM, M BLOCK _ SIZE BLOCK _ NUM.
Preferably, the address of the logical memory card includes: a reference number and a first offset block address of the logic memory card, wherein the value range of the reference number is 0, 1, 2. The address of the memory card comprises a second offset block address which is an offset block address taking the first address of the memory card as a reference; the address mapping function is a ═ b + (N/BLOCK _ SIZE) ×, where a is the second offset BLOCK address, b is the first offset BLOCK address, and x is the label of the logical memory card.
Preferably, after the memory card is divided into n logical memory cards, the method further includes: and displaying the n memory cards on a UI (user interface) of the mobile terminal.
Preferably, after dividing the memory card into n logical memory cards, the method further comprises: displaying 1 memory card on a UI interface of the mobile terminal, wherein the capacity of the memory card is M, and establishing a corresponding relation between a file in the memory card and a label of a logic memory card.
Preferably, the method further comprises: a separate data structure is assigned to each of the n logical memory cards.
To achieve the above object, according to the present inventionIn another aspect, there is provided a mobile terminal, including: the capacity judging module is used for judging whether the capacity of the memory card is larger than the maximum capacity supported by the mobile terminal, and if so, the presetting module is triggered; a presetting module for dividing the memory card into n logical memory cards and setting an address mapping function of the bottom layer interface, wherein,
m is the capacity of the memory card, and N is the maximum capacity supported by the mobile terminal; the distribution module is used for distributing an independent file system for each logic memory card in the n logic memory cards; and the bottom layer interface processing module is used for mapping the operation on the logic memory card into the operation on the memory card according to the address mapping function and the information in the file system.
Preferably, the mobile terminal further includes: the capacity acquisition module is used for acquiring preset parameters of the memory card and calculating the capacity of the memory card according to the preset parameters, wherein the preset parameters comprise: BLOCK SIZE BLOCK _ SIZE and total BLOCK number BLOCK _ NUM, M BLOCK _ SIZE BLOCK _ NUM.
Preferably, the mobile terminal further includes: the display control module is used for determining the number of the memory cards displayed on the UI interface, and if the number of the memory cards is determined to be 1, the file mapping module is triggered; and the file mapping module is used for establishing the corresponding relation between the file in the memory card and the label of the logic memory card.
According to the invention, the memory card with the capacity exceeding the maximum capacity which can be supported by the mobile terminal is divided into the plurality of logic memory cards, the address mapping function of the bottom layer interface is set, and the single file system is distributed to each logic memory card, so that the problems that the mobile terminal cannot apply the memory card with the large capacity, for example, the memory card exceeding 4G, the storage space is wasted and the user is inconvenient to use are solved, the limitation of the system to the maximum capacity of the memory card is overcome, the capacity of the memory card is fully utilized, and the user experience is improved.
Detailed Description
Overview of the function
In view of the problems in the prior art, an embodiment of the present invention provides an application scheme of a large-capacity memory card, where the processing principle of the scheme is as follows: dividing a storage card into n logic storage cards, and setting an address mapping function of a bottom layer interface; allocating an independent file system for each of the n logical memory cards; operations on the logical memory card are mapped to operations on the memory card according to the address mapping function and information in the file system. The scheme can overcome the limitation of the system to the maximum capacity of the memory card, fully utilizes the capacity of the memory card and improves the user experience.
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
Method embodiment
According to an embodiment of the present invention, there is provided an application method of a large-capacity memory card for a case where a capacity of the memory card is greater than a maximum capacity supported by a mobile terminal, and fig. 1 is a flowchart of the application method of the large-capacity memory card according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps S102 to S108:
s102, obtaining preset parameters of a memory card, calculating the capacity of the memory card according to the preset parameters, and judging that the capacity of the memory card is larger than the maximum capacity supported by the mobile terminal, wherein the preset parameters comprise: BLOCK SIZE BLOCK _ SIZE and total BLOCK number BLOCK _ NUM, M BLOCK _ SIZE BLOCK _ NUM.
S104, dividing the memory card into n logic memory cards, and setting an address mapping function of a bottom layer interface, wherein,
m is the capacity of the memory card, N is the maximum capacity supported by the mobile terminal, and the address mapping function is used for realizing the conversion between the address of the logic memory card and the address of the memory card.
In step S104, the address of the logical memory card may include: a reference number and a first offset block address of the logic memory card, wherein the value range of the reference number may be 0, 1, 2. The address of the memory card may include a second offset block address, which is an offset block address with reference to the first address of the memory card; the address mapping function is a ═ b + (N/BLOCK _ SIZE) ×, where a is the second offset BLOCK address, b is the first offset BLOCK address, and x is the label of the logical memory card.
After the memory card is divided into n logical memory cards, the n memory cards may be displayed on the UI interface of the mobile terminal, or 1 memory card may be displayed on the UI interface of the mobile terminal, where the capacity of the memory card is M, and a correspondence relationship between a file in the memory card and a label of the logical memory card is established.
S106, assigning an independent file system to each of the n logical memory cards, and preferably, assigning an independent data structure to each of the n logical memory cards.
S108, mapping the operation of the logic memory card into the operation of the memory card according to the address mapping function and the information in the file system, wherein the information in the file system comprises: the first offset block address is an offset block address taking a first block address in a logic memory card where the file is located as a reference; and the operation may include at least one of: read, write, delete.
The following describes in detail the implementation of the embodiments of the present invention with reference to examples.
The following describes in detail an application method of a large-capacity memory card according to an embodiment of the present invention by taking a mobile phone as an example, and fig. 2 is a detailed flowchart of the application method of the large-capacity memory card according to the embodiment of the present invention, where the method mainly includes the following steps:
step 201, when the memory card is inserted, the detection signal level on the detection interface of the mobile phone changes, and the mobile phone detects the insertion of the device according to the level change. According to the protocol specification of the memory card, the mobile phone sends a device type command to request to acquire the device type on the physical interface so as to judge whether the memory card is the memory card or other devices with the same physical interface as the memory card, if the memory card is the memory card, the processing of step 203 is performed, and if the memory card is not the memory card, the processing is returned. In this example, the memory card responds, and the handset recognizes from this response information that the inserted device is a memory card.
Taking the insertion of a memory card of a TF card type as an example, after a baseband chip of a mobile phone detects that a device is inserted into an interface through a detection signal, an identification process is started, a CMD5 command is sent to identify whether the device is the TF card or other devices with the same interface as the TF card, and after judgment, the inserted device is determined to be the TF card.
Step 203, the mobile phone sends a parameter command to request to read the parameters of the memory card, the memory card responds to the request, the mobile phone obtains parameter information including the BLOCK SIZE BLOCK _ SIZE and the total BLOCK number BLOCK _ NUM, and calculates the capacity of the memory card, which is denoted by M, where M is BLOCK _ SIZE BLOCK _ NUM. And judging whether M is larger than the maximum capacity which can be supported by the system, if so, performing the processing of the step 205, and otherwise, returning. Taking the TF card as an example, after the mobile phone determines that the insertion device is the TF card, the mobile phone sends a CMD9 command to request to obtain information of the TF card, including information of the size of the block of the card, the total number of the blocks, whether the card is a high-speed card, and the like.
Step 205, according to the capacity M of the memory card and the maximum capacity (denoted by N) actually supported by the mobile phone, obtaining the total number (denoted by N) of the memory cards needing mapping,
wherein,
represents the smallest integer greater than or equal to M/N, e.g., M/N is 3.0, then
M/N is 3.5, then
N memory cards (the logical capacity of each memory card is N) or 1 memory card (the capacity of each memory card is M) are mapped on a UI interface of a mobile phone, and physically, the memory cards are divided into N areas with the size of N, each area with the size of N is mapped into an independent logical unit, also called a logical memory card, and the N logical units or the logical memory cards are respectively marked with the numbers 0, 1, 2. Each logical unit is allocated and managed using an independent file system, and operations such as reading and writing for a certain logical unit correspond to operations of each area physically. The system takes each mounted logic memory card as a common file system, and allocates an individual data structure and an individual file allocation table, wherein the file allocation table is a component of the file system and is mainly used for storing the file system, that is, basic information and address information of files in the logic memory card, and the address information can include the first offset block address which is an offset block address based on a first block address in the logic memory card where the files are located.
Specifically, after the memory card is identified, the information of the card is sent to the UI layer and displayed as a plurality of supportable spaces, i.e., logical memory cards, according to the size of the capacity, or displayed as one memory card at the UI layer, the capacity of which is the actual capacity M of the memory card. The TF card is logically mapped into n independent logical memory cards, respectively numbered 0, 1, 2. The n logical memory cards are mounted as n ordinary file systems, and simultaneously distribute a data structure and a file allocation table, and each logical memory card is maintained using an independent file allocation table. If the capacity of a TF card is 8G, the maximum capacity supported by the system is 2G, and the logical memory card labeled 1 is taken as an example, and its actual memory space is 2G-4G. The formatting, reading, writing and deleting operations of the logical memory card 1 are operations on units with physical space addresses of 2G-4G. An address mapping is made for each file in the unit, and a file allocation table is established.
In step 207, the user's operations on the logical memory card are encapsulated to the bottom layer as read, write, and erase (i.e., delete) operations on the corresponding physical unit. When the UI needs to read, write, or delete a file, the label x of the logical memory card where the current file is located and the first offset block address Base in the logical memory card are transmitted, and then the offset address Addr of the memory card is calculated as follows:
Addr=Base+(N/BLOCK_SIZE)*x
where N denotes the maximum capacity actually supported by the handset and BLOCK _ SIZE denotes the BLOCK SIZE.
Taking the TF card as an example, the basic implementation process of the reading operation is as follows: and sequentially reading the content of each logic memory card according to the file allocation table of each logic memory card. Calculating the starting address A of the logical memory card corresponding to the block of the actual memory card according to the label x of the logical memory card, wherein A is x N, the size of the block is N, then forming the parameters into a command packet format, sending a CMD18 command, reading the data of the memory card and storing the data into a buffer. The upper layer of the user can obtain the corresponding content from the buffer.
The write operation is basically the same as the read operation, the starting address a of the block corresponding to the actual memory card is calculated according to each mapping space, i.e., the label x of the logical memory card, where a is x × N and the size of the block is N, then the parameters are formed into a command packet format, a CMD25 command is sent, and the data stored in the buffer is written into the actual space.
The deletion operation is substantially the same as the above-mentioned reading process, and is not described herein again.
Through the above process, the memory card with the capacity exceeding the maximum capacity can be mapped into a plurality of logical memory cards, and the memory cards with the capacity exceeding the maximum capacity supported by the system are addressed through different labels.
In the case that the user interface is displayed as n memory cards, the logical mapping relationship between the user interface and the storage space actually corresponding to the operation is as shown in fig. 3, and if the maximum capacity supported by the system is 2GB, the memory card exceeding the maximum capacity of the system is logically divided into n spaces with a capacity of 2 GB. Each space can then be supported by the system (to which a separate file system has been allocated), and the respective mapped space can be identified by a label.
It should be noted that, in the above embodiment, a mobile phone is taken as an example to be described in detail, in practical applications, other mobile terminals may also use the method provided by the embodiment of the present invention to identify and apply a large-capacity memory card, and the principle is substantially the same, and no further description is given here.
Device embodiment
According to an embodiment of the present invention, there is provided a mobile terminal, and fig. 4 is a block diagram of a structure of a mobile terminal according to an embodiment of the present invention, as shown in fig. 4, the mobile terminal includes:
a
capacity judging module 42, configured to judge whether the capacity of the memory card is greater than the maximum capacity supported by the mobile terminal, and if so, trigger a presetting module 44; a presetting module 44 connected to the
capacity judging module 42 for dividing the memory card into n logical memory cards and setting an address mapping function of the bottom layer interface, wherein,
m is the capacity of the memory card, and N is the maximum capacity supported by the mobile terminal; an allocating module 46, connected to the presetting module 44, for allocating an independent file system for each of the n logical memory cards; and the bottom layer interface processing module 48 is connected to the presetting module 44 and the distribution module 46, and is used for mapping the operation on the logical memory card into the operation on the memory card according to the address mapping function and the information in the file system.
Fig. 5 is a detailed structural block diagram of a mobile terminal according to an embodiment of the present invention, as shown in fig. 5, based on the capacity judging module 42, the presetting module 44, the allocating module 46 and the bottom layer interface processing module 48 shown in fig. 4, the mobile terminal further includes: a capacity obtaining module 52, connected to the capacity judging module 42, for obtaining predetermined parameters of the memory card and calculating the capacity of the memory card according to the predetermined parameters, where the predetermined parameters include: BLOCK SIZE BLOCK _ SIZE and total BLOCK number BLOCK _ NUM, M BLOCK _ SIZE BLOCK _ NUM; a display control module 54 connected to the preset module 44, configured to determine the number of memory cards displayed on the UI interface, and if the number of memory cards is determined to be 1, trigger the file mapping module 56; and the file mapping module 56 is connected to the display control module 54 and the distribution module 46, and is used for establishing a corresponding relationship between the file in the memory card and the label of the logic memory card.
Compared with the prior art, the method of the embodiment of the invention can effectively overcome the limitation of the system to the maximum capacity of the memory card, greatly improve the storage capacity, and enable a user to store more songs, pictures, movies, data and the like without carrying a mobile hard disk with larger volume. The memory card has small volume and convenient carrying, and can bring greater convenience for users to use the mobile phone.
It should be noted that the steps illustrated in the flowcharts of the figures may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowcharts, in some cases, the steps illustrated or described may be performed in an order different than presented herein.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and they may alternatively be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, or fabricated separately as individual integrated circuit modules, or fabricated as a single integrated circuit module from multiple modules or steps. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.