CN112799974A - Control method and system of memory card - Google Patents

Control method and system of memory card Download PDF

Info

Publication number
CN112799974A
CN112799974A CN202110103595.3A CN202110103595A CN112799974A CN 112799974 A CN112799974 A CN 112799974A CN 202110103595 A CN202110103595 A CN 202110103595A CN 112799974 A CN112799974 A CN 112799974A
Authority
CN
China
Prior art keywords
controller
data
memory card
processing unit
central processing
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.)
Granted
Application number
CN202110103595.3A
Other languages
Chinese (zh)
Other versions
CN112799974B (en
Inventor
赵志文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kedong Guangzhou Software Technology Co Ltd
Original Assignee
Kedong Guangzhou Software Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Kedong Guangzhou Software Technology Co Ltd filed Critical Kedong Guangzhou Software Technology Co Ltd
Priority to CN202110103595.3A priority Critical patent/CN112799974B/en
Publication of CN112799974A publication Critical patent/CN112799974A/en
Application granted granted Critical
Publication of CN112799974B publication Critical patent/CN112799974B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication
    • G06F12/0646Configuration or reconfiguration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/14Handling requests for interconnection or transfer
    • G06F13/20Handling requests for interconnection or transfer for access to input/output bus
    • G06F13/28Handling requests for interconnection or transfer for access to input/output bus using burst mode transfer, e.g. direct memory access DMA, cycle steal
    • G06F13/282Cycle stealing DMA
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/30Arrangements for executing machine instructions, e.g. instruction decode
    • G06F9/30098Register arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

The invention relates to a control method and a system of a memory card, wherein the method is applied to a central processing unit and comprises the following steps: when the central processing unit operates the file system, the memory card which completes initialization is mounted in the file system; when the file system receives a read operation aiming at the memory card, the central processing unit controls the first controller to read data from the memory card and output the data to the second controller; the second controller writes the received data into the memory space; the central processing unit responds to the data verification instruction and takes the data received by the second controller from the first controller as first data; reading data from a preset address of the memory card by using a preset reading and writing tool, and taking the data as second data; and comparing the first data with the second data to verify the correctness of the data written into the memory space according to the comparison result, thereby realizing the technical effect of improving the safety and the accuracy of the memory card in the starting and data transmission processes.

Description

Control method and system of memory card
Technical Field
The present invention relates to the field of memory card technologies, and in particular, to a method and a system for controlling a memory card.
Background
Memory cards are widely used in portable devices such as digital cameras, personal digital assistants, and multimedia players.
At present, if the memory card needs to be quickly started and the automatic transportation and verification of data in the memory card are realized, a lot of memory resources are consumed. In particular, when the memory resources are limited, the system real-time performance is likely to be degraded. Moreover, it may cause the situation that the mounting of the memory card fails or data is lost during the starting process.
Disclosure of Invention
The invention aims to provide a control method and a control system of a memory card, which achieve the technical effect of improving the safety and the accuracy of the memory card in the starting and data transmission processes.
In order to achieve the above object, a first aspect of the present application provides a method for controlling a memory card, which is applied to a central processing unit, an APB bus of the central processing unit is connected to a first controller, the first controller is externally connected to the memory card, and an AXI bus of the central processing unit is connected to a second controller, the method including:
in the starting process of hardware, the central processor initializes the first controller, the second controller and the memory card;
when the central processing unit operates a file system, mounting the initialized memory card in the file system;
when the file system receives a read operation aiming at the memory card, the central processing unit controls the first controller and the second controller to enter a read working mode;
in a reading working mode, the first controller reads data from the memory card and outputs the data to the second controller; the second controller writes the received data into a memory space;
the central processing unit receives a data verification instruction, responds to the data verification instruction, and takes data received by the second controller from the first controller as first data, wherein the received data is data read by the first controller at a preset address of a memory card;
the central processing unit reads data from a preset address of the memory card by using a preset read-write tool and uses the data as second data;
and the central processing unit compares the first data with the second data so as to verify the correctness of the data written into the memory space according to the comparison result.
Optionally, the initializing, by the central processor, the second controller, the first controller, and the memory card includes:
the central processor enables the second controller;
the central processing unit initializes the first controller;
the central processor initializes the memory card connected to the first controller;
the central processing unit configures a memory space for the second controller.
Optionally, the initializing, by the central processing unit, the first controller includes:
the central processing unit is provided with a frequency division coefficient of a clock module, and the clock module divides a clock frequency meeting the normal working requirement of the first controller from a clock provided by the clock module according to the frequency division coefficient and outputs the clock frequency to the first controller;
the central processing unit enables an interrupt register in the first controller to start an interrupt of the first controller.
Optionally, the initializing, by the central processor, the memory card connected to the first controller includes:
the central processing unit sends a memory card protocol command to the first controller so as to control the first controller to select the memory card connected to the first controller;
the central processing unit acquires the storage information and the state of the selected memory card;
the central processing unit configures a data transmission mode of the first controller.
Optionally, the configuring, by the central processing unit, a memory space for the second controller includes:
the central processing unit applies for a memory space in a real-time operating system and acquires a virtual address of the memory space;
and the central processing unit maps the virtual address into a physical address and configures the physical address in the second controller, so that the second controller can execute read-write operation on the memory space.
Optionally, when the central processing unit runs the file system, mounting the memory card that completes initialization in the file system, including:
the central processor checks the block data of the storage card based on the card information of the storage card received from the first controller;
and after the data of the block is successfully verified, the central processing unit displays the storage card in a preset directory of the file system in a file form based on the card information so as to finish mounting the storage card.
Optionally, the method further includes:
when the file system receives write operation aiming at the memory card, the central processing unit controls the first controller and the second controller to enter a write working mode;
in a writing working mode, the second controller reads data from the memory space and outputs the data to the first controller; the first controller writes the data into the memory card.
Optionally, the method further includes:
when the first controller reads out data from the memory card, the first controller determines the transmission state of the read data according to the state value of the interrupt register in the first controller.
In order to achieve the above object, a second aspect of the present application provides a control system for a memory card, comprising a central processing unit, a first controller and a second controller;
the APB bus of the central processing unit is connected with the first controller, the first controller is externally connected with a memory card, and the AXI bus of the central processing unit is connected with the second controller;
the central processing unit is used for initializing the first controller, the second controller and the memory card in the starting process of hardware;
the central processing unit is also used for mounting the initialized memory card in the file system when the file system is operated;
when the file system receives a read operation for the memory card, the central processing unit is further used for controlling the first controller and the second controller to enter a read working mode;
in a read mode of operation, the first controller is configured to read data from the memory card and output the data to the second controller; the second controller is used for writing the received data into a memory space;
the central processing unit is further configured to receive a data verification instruction, and in response to the data verification instruction, use data received by the second controller from the first controller as first data, where the received data is data read by the first controller at a preset address of a memory card;
the central processing unit is also used for reading data from the preset address of the memory card by using a preset reading and writing tool and taking the data as second data;
the central processing unit is further configured to compare the first data with the second data, and verify correctness of the data written into the memory space according to a comparison result.
Therefore, according to the technical scheme provided by the application, the central processing unit is connected with the first controller through the APB bus, the AXI bus is connected with the second controller, and the first controller and the second controller can be managed and configured in a unified mode. Specifically, after the central processing unit is powered on, the initialization of the first controller and the second controller can be completed quickly, and the memory card is mounted in the file system. Furthermore, when the second controller can be called to transmit data, too much CPU resources are not occupied in the data transmission process, and the problem of reduction of system real-time performance caused by limited memory resources is avoided, so that the success rate of mounting the memory card is improved, and the data transmission efficiency is also ensured.
Further, in the starting process, the central processing unit receives the data checking instruction and responds to the data checking instruction to check the correctness of the data, so that the accurate and effective transmission of the data can be ensured, and the safety and the accuracy of data transmission are further improved.
Drawings
Fig. 1 is a schematic structural diagram of a control system of a memory card according to an embodiment of the present invention;
fig. 2 is a flowchart of a control method of a memory card according to an embodiment of the present invention.
Detailed Description
The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
Examples
The present application provides a control system of a memory card, which may include a central processor, a first controller, and a second controller, referring to fig. 1.
The Central Processing Unit (CPU) is a final execution Unit for information Processing and program operation, and serves as an operation and control core of the computer system. Further, the central processing unit may be configured to execute computer instructions, such as executing an instruction program corresponding to the control method of the memory card.
The first controller is mainly used for externally connecting the memory card and can set and/or read and write the memory card. When the memory card is a Secure Digital (SD) card, the first controller may be a Secure Digital Input and Output (SDIO) controller, which is abbreviated as an SDIO controller, and is a peripheral interface defined in the SD standard, and may be used for externally connecting the SD card.
The second controller is mainly used for replacing a CPU (central processing unit) to execute data transmission between the memory card and the memory. The second controller may be a Direct Memory Access (DMA) controller, which is referred to as the second controller for short, and allows hardware devices with different speeds to communicate without relying on a large amount of interrupt loads of the CPU. Otherwise, the CPU needs to copy each piece of data from the source to the register and then write them back to the new place again. During this time, the CPU is unavailable for other tasks.
In this embodiment, when the second controller performs data transmission, data is copied from one address space to another address space. When the CPU initiates the transfer, the transfer itself is performed and completed by the second controller. Specifically, when data transmission is realized, the second controller directly manages the bus of the CPU, and therefore, there is a problem of transfer of the control right of the bus. That is, the CPU gives the bus control to the second controller before the data transmission, and the second controller gives the bus control back to the CPU immediately after the data transmission is finished.
For example, for the second controller to be a DMA controller, a complete data transfer process must go through 4 steps of DMA request, DMA response, DMA transfer, and DMA end.
Further, the central processing unit is provided with various buses, which may include an AHB bus, an APB bus, an AXI bus, and the like.
An Advanced High performance Bus (AHB) is an AHB Bus for short, and is mainly a Bus designed for High-efficiency, High-bandwidth and fast system modules, and can be connected with High-efficiency modules such as a microprocessor, a memory module on a chip or outside the chip, and a DMA.
Among them, an Advanced High-performance Bus (APB) is simply referred to as an APB Bus. The APB bus is mainly used for low-speed and low-power peripheral devices, and can optimize power consumption and complex interfaces for the peripheral devices, such as UART, 1284, etc., and unlike the AHB which supports multiple masters, the only master inside the APB is the APB bridge. The characteristics of the method comprise: two clock cycles transmission; no waiting period and no response signal are needed; the control logic is simple and only has four control signals. In addition, the APB provides a bridge for communication between the AHB and low bandwidth peripherals, so the APB is a secondary expansion bus for either the AHB or ASB.
Among them, an Advanced eXtensible Interface (AXI), referred to as an AXI bus for short, is an on-chip bus oriented to high performance, high bandwidth, and low latency. The address/control and data phase of the system are separated, unaligned data transmission is supported, meanwhile, in burst transmission, only a first address is needed, simultaneously, a data channel is separately read and written, and outbound transmission access and out-of-order access are supported, and time sequence convergence is easier to perform. AXI is a new high performance protocol in AMBA. The AXI technology enriches the content of the existing AMBA standard and meets the requirements of ultra-high performance and complex system on chip (SoC) design.
In an embodiment, referring to fig. 1, the central processing unit is provided with an APB bus and an AXI bus, the APB bus of the central processing unit is connected to the first controller, the first controller is externally connected to the SD card, and the AXI bus of the central processing unit is connected to the second controller.
In addition, the second controller and the central processing unit can be connected with the memory.
In this embodiment, the first controller is connected to the central processing unit through the APB bus, so that power consumption of the first controller can be optimized and the interface can be simplified. In addition, the second controller is connected with the central processing unit through the AXI bus, so that high performance, high bandwidth and low delay of communication between the second controller and the central processing unit can be guaranteed.
The application also provides a control method of the memory card, which is applied to the control system of the memory card. Specifically, referring to fig. 2, the control method may include the steps of:
s110, in the starting process of hardware, the central processing unit initializes the first controller, the second controller and the memory card.
Specifically, S110 may be detailed as steps S111 to S114 as follows, and for clarity of description, in this embodiment, the first controller is an SDIO controller, the second controller is a DMA controller, and the memory card is an SD card. However, it should be noted that the types of the first controller, the second controller, and the memory card are not limited in this embodiment.
And S111, enabling the second controller by the central processing unit.
In this embodiment, after being enabled, the second controller may receive a data transfer request, such as a DMA request, sent by the first controller, so as to further perform data transfer.
Specifically, the second controller may determine priority and mask the data transmission request, and provide the bus request to the bus arbitration logic. After the second controller obtains the bus control right, the CPU immediately suspends or only executes internal operation, and the second controller outputs a read-write command to directly control the memory to carry out data transmission with the first controller. When the specified batch data transfer is completed, the second controller releases the bus control and sends an end signal to the first controller.
And S112, initializing the first controller by the central processing unit.
In this embodiment, the method is mainly used for initializing the operating frequency of the first controller and the interrupt register in the first controller.
In an embodiment, the central processing unit may set a frequency division coefficient of the clock module, and the clock module divides a clock frequency meeting a normal operation requirement of the first controller from a clock provided by the clock module according to the frequency division coefficient and outputs the divided clock frequency to the first controller.
Specifically, for each memory card, one bit of command or data may be transmitted on a command line or data line in one clock cycle. Generally, the clock frequency of the memory card, that is, the clock frequency of the first controller, needs to be set in a proper interval to meet the normal data transmission requirement, for example, when the first controller is an SDIO controller, the clock frequency may be set between 0MHz and 25 MHz. In addition, after the memory card completes initialization, the clock period cannot exceed a preset period, such as a period corresponding to 400KHz, otherwise, communication failure may be caused due to too fast rate.
Thus, the clock frequency of the first controller may be set as follows: for example, the clock frequency is the PCLK/division factor of the CPU, where PCLK is the clock provided by the clock module of the CPU.
Further, the central processing unit may enable an interrupt register in the first controller to initiate an interrupt of the first controller.
In this embodiment, enabling the interrupt register of the first controller can ensure that the correct interrupt can be generated during data transmission and reception.
In this embodiment, when the first controller reads out data from the memory card, the first controller may determine the transfer state of the read-out data based on the state value of the interrupt register in the first controller.
For example, whether the data is completely transmitted, whether data timeout exists, whether the data receiving register CRC has an error interrupt, whether there is an error of the transmission command, and the like may be determined according to the status value.
Specifically, the state values of the interrupt registers in the first controller may correspond to various states, such as error and normal read and write states. Further, table 1 is a table of correspondence between state values and states of the interrupt registers in the first controller. Referring to table 1, a correspondence between the state values and the states may be acquired.
TABLE 1
Figure BDA0002916513460000091
Furthermore, during the operation of the first controller, no matter whether the command is sent or received or the data is transmitted, the interrupt register feeds back the completion degree of the execution at any time according to the state value, and the data transmission period is not lost.
Specifically, after the command is sent, each state value in the first controller interrupt register may be checked, and if an error occurs, the corresponding print information is prompted.
S113, the central processor initializes the memory card connected to the first controller.
In this embodiment, the central processing unit may send a memory card protocol command to the first controller to implement setting of a plurality of registers in the first controller, and further, may implement control over the first controller to perform an initialization operation on a memory card connected to the first controller.
In this embodiment, a memory card is taken as an SD card for example, all SD cards conform to the standard SD protocol specification of the industry, and the protocol versions of the SD cards with different capacities are different. Generally, there are three versions of the protocol standard, with the size below 2G being version 1.0, greater than 2G less than 32G being version 2.0, greater than 32G being version 3.0. In this embodiment, a 16G SD card is taken as an example for description, and reference may be made to a memory card protocol command in SD2.0 protocol standard.
Further, the central processing unit can send a memory card protocol command to the first controller, and can control the first controller to select the memory card connected to the first controller; moreover, the central processing unit can obtain the storage information and the state of the selected memory card; the central processing unit configures a data transmission mode of the first controller.
Specifically, the central processing unit may sequentially send the following memory card protocol commands to the first controller, including: CMD0, CMD8, ACMD41, CMD2, CMD3, CMD7, ACMD 6.
Wherein, the meaning of each memory card protocol command is as follows:
CMD 0: resetting the memory card;
CMD 8: the memory card type detection supports the card above the V2.0 protocol to support the cmd8 command;
ACMD 41: the special application instruction, generally send cmd55 first and then send cmd41, visit OCR register of the card, judge whether the working voltage of the storage card meets;
CMD 2: broadcasting the CID information of the acquisition card, and acquiring related information about the manufacturer;
CMD 3: acquiring a relative address allocated by a memory card;
CMD 7: according to the appointed RCA, selecting the memory card, if selecting another card in the state of selecting one card, then the previous card will cancel the selection automatically, if sending address 0, then representing that all cards are cancelled;
ACMD 6: for configuring whether to use 4-bit data line transmission.
Further, after the memory card protocol command is issued, the first controller operates as follows: the first controller firstly resets and then detects the type of the hardware memory card; after the type of the memory card is obtained, the CPU can access an OCR register of the memory card and judge that the working voltage of the memory card meets the requirement of normal work. After the memory card is confirmed to work correctly, a command is sent to broadcast to acquire CID information of the memory card, and then relevant information about a manufacturer and a relative address allocated by the memory card are acquired; then, according to the designated RCA, the memory card is selected.
It should be noted that if another memory card is selected in a state where one memory card is selected, the previous memory card is automatically deselected. When address 0 is transmitted, it indicates that all cards are deselected.
Finally, the CPU obtains the storage information related to the memory card, such as block size, capacity, etc., and also obtains the state of the memory card. In the last step, the transmission mode of the first controller is configured, and the transmission mode can be generally configured to be 4-bit data line transmission.
In this embodiment, after the initialization of the first controller is completed, the read/write operation and data transfer of a single piece or multiple pieces of data in the memory card can be performed. The data of the memory card is in units of blocks on the fat16 system, each block being 512 bytes.
S114, the central processing unit configures a memory space for the second controller.
In this embodiment, the central processing unit may apply for a memory space in the real-time operating system, and obtain a virtual address of the memory space; the central processing unit maps the virtual address into a physical address, and configures the physical address in the second controller, so that the second controller can execute read-write operation on the memory space.
Specifically, a dedicated memory space of the second controller may be applied through a malloc function on an application level, and further, a corresponding interface function of the system may be called, and a virtual address of the memory space may be mapped to an actual physical address, and further, the physical address of the memory space may be filled in a corresponding register in the second controller, so as to complete initialization of the second controller.
S120, when the central processing unit runs the file system, the memory card which completes initialization is mounted in the file system.
In this embodiment, the file system is a method and a data structure for specifying files on a storage device (usually a disk, or a solid state disk based on NAND Flash) or a partition by using an operating system; i.e. a method of organizing files on a storage device. The software mechanism in the operating system that is responsible for managing and storing file information is called a file management system, referred to as a file system for short. The file system consists of three parts: file system interface, software assembly for manipulating and managing objects, objects and properties. From a system perspective, a file system is a system that organizes and allocates space of a file storage device, is responsible for file storage, and protects and retrieves stored files. In particular, it is responsible for creating files for the user, storing, reading, modifying, dumping files, controlling access to files, revoking files when the user is no longer in use, etc.
Further, in a file system, when a device is to be used, for example, a device such as a formatted partition, an optical disc, a memory card, or software in a hard disk is to be read, the device must be first mapped to a directory (the directory may not be empty, but the content before the directory is available after being mapped), and the directory is called a "mount point", so that the device can be read, and the mapping action is "mount".
In this embodiment, a device such as a memory card may be mounted in a file system in the form of a file.
Specifically, the central processor may perform block data verification on the memory card based on card information of the memory card received from the first controller; and after the data block is successfully verified, the central processing unit displays the memory card in a preset directory of a file system in a file form based on the card information so as to finish mounting the memory card.
The card information may include CID information of the memory card, manufacturer-related information, and a relative address, block data size, and the like allocated by the CPU to the memory card. Further, based on the card information, the central processor may acquire a setting of a block data size in the memory card, read the block data from the memory card in the block data size, and perform a Check such as a Cyclic Redundancy Check (CRC) on the block data. Further, a file can be newly built in a preset directory of the file system, such as a root directory or a directory named as "mnt", and is associated with the relative address of the memory card, so as to complete the mounting of the memory card. Further, the file is accessed in a file system, i.e., the memory card is accessible.
Further, in this embodiment, a user may execute a read/write operation on the memory card through the file system, and the central processing unit may call the data read/write interface according to the read/write operation, so as to control the first controller and the second controller to enter a read/write operating mode.
In this embodiment, the memory card is mounted in the file system in the form of a file, and when a user performs user operations such as opening and checking attributes on the file, the file system is considered to receive a read operation for the memory card, and the central processing unit may control the first controller and the second controller to enter a read mode; when the user performs user operations such as adding data, deleting data, changing data and the like on the file, the file system is considered to receive write operations aiming at the memory card, and the central processing unit can control the first controller and the second controller to enter a write working mode.
In this embodiment, in the read/write operation mode, the data of the memory card can be carried.
In one example, data of the memory card is carried from a first address to a second address of the memory card.
Specifically, when data of the memory card is carried from a first address to a second address, the first controller may read out the data from the first address of the memory card and output the data to the second controller; the second controller writes the received data into the memory space; in a writing working mode, the second controller reads data from the memory space and outputs the data to the first controller; the first controller writes data to the second address of the memory card, and the CPU only needs to send instructions during the transfer without occupying excessive CPU resources.
Of course, in this embodiment, the correctness of the transmitted data may also be checked, and specifically, the following steps may be referred to.
S130, when the file system receives a read operation aiming at the memory card, the central processing unit controls the first controller and the second controller to enter a read working mode.
In this embodiment, when the user performs a user operation on the file, such as opening or viewing an attribute, the file system is considered to receive a read operation for the memory card.
S140, in a reading working mode, the first controller reads out data from the memory card and outputs the data to the second controller; and the second controller writes the received data into a memory space.
In this embodiment, the memory space is a space in the memory allocated to the second controller by the central processing unit in the initialization process of the second controller, and may be used to store data read from the memory card by the second controller via the first controller.
S150, the central processing unit receives a data verification instruction, and responds to the data verification instruction, and takes the data received by the second controller from the first controller as first data, wherein the received data is the data read by the first controller at the preset address of the memory card.
In this embodiment, the data verification instruction may be generated at the application layer and sent to the central processing unit. Further, the application layer may further set a transmission cycle and a transmission frequency of the data verification instruction. After the central processing unit receives the data verification instruction, the data received from the first controller in the current cycle or in the preset time period may be used as the first data. The first data is the data that needs to be checked for correctness.
And S160, the central processing unit reads data from the preset address of the memory card by using a preset read-write tool and uses the data as second data.
The preset read-write tool can be a winhex setting tool and can be used for checking data of all blocks in the memory card. Furthermore, when the correctness of the first data needs to be checked, the winhex tool can be used for reading the data of the preset address where the first data is located, and the data is used as the second data.
S170, the central processing unit compares the first data with the second data to check the correctness of the data written into the memory space according to the comparison result.
In this embodiment, when the first data is the same as the second data, it indicates that the first data is successfully verified, and the first data is correctly transmitted. When there is a difference between the first data and the second data, it indicates that there is an error in reading the data in the memory card using the second controller, possibly due to an error in the configuration of the second controller or the first controller.
In the technical solution provided in this embodiment, the central processing unit is connected to the first controller through the APB bus, and the AXI bus is connected to the second controller, so that the first controller and the second controller can be managed and configured in a unified manner. Specifically, after the central processing unit is powered on, the initialization of the first controller and the second controller can be completed quickly, and the memory card is mounted in the file system. Furthermore, when the second controller can be called to transmit data, too much CPU resources are not occupied in the data transmission process, and the problem of reduction of system real-time performance caused by limited memory resources is avoided, so that the success rate of mounting the memory card is improved, and the data transmission efficiency is also ensured.
Further, in the starting process, the central processing unit receives the data checking instruction and responds to the data checking instruction to check the correctness of the data, so that the accurate and effective transmission of the data can be ensured, and the safety and the accuracy of data transmission are further improved.
In the description herein, references to the description of the term "in an embodiment," "in another embodiment," "exemplary" or "in a particular embodiment," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although the invention has been described in detail hereinabove by way of general description, specific embodiments and experiments, it will be apparent to those skilled in the art that many modifications and improvements can be made thereto based on the invention. Accordingly, such modifications and improvements are intended to be within the scope of the invention as claimed.

Claims (9)

1. A control method of a memory card is applied to a central processing unit, an APB (advanced peripheral bus) of the central processing unit is connected with a first controller, the first controller is externally connected with the memory card, an AXI (advanced extensible interface) bus of the central processing unit is connected with a second controller, and the method comprises the following steps:
in the starting process of hardware, the central processor initializes the first controller, the second controller and the memory card;
when the central processing unit operates a file system, mounting the initialized memory card in the file system;
when the file system receives a read operation aiming at the memory card, the central processing unit controls the first controller and the second controller to enter a read working mode;
in a reading working mode, the first controller reads data from the memory card and outputs the data to the second controller; the second controller writes the received data into a memory space;
the central processing unit receives a data verification instruction, responds to the data verification instruction, and takes data received by the second controller from the first controller as first data, wherein the received data is data read by the first controller at a preset address of a memory card;
the central processing unit reads data from a preset address of the memory card by using a preset read-write tool and uses the data as second data;
and the central processing unit compares the first data with the second data so as to verify the correctness of the data written into the memory space according to the comparison result.
2. The control method of claim 1, wherein the central processor initializing the second controller, the first controller and the memory card comprises:
the central processor enables the second controller;
the central processing unit initializes the first controller;
the central processor initializes the memory card connected to the first controller;
the central processing unit configures a memory space for the second controller.
3. The control method of claim 2, wherein the central processor initializing the first controller comprises:
the central processing unit is provided with a frequency division coefficient of a clock module, and the clock module divides a clock frequency meeting the normal working requirement of the first controller from a clock provided by the clock module according to the frequency division coefficient and outputs the clock frequency to the first controller;
the central processing unit enables an interrupt register in the first controller to start an interrupt of the first controller.
4. The control method according to claim 2, wherein the central processor initializing the memory card connected to the first controller includes:
the central processing unit sends a memory card protocol command to the first controller so as to control the first controller to select the memory card connected to the first controller;
the central processing unit acquires the storage information and the state of the selected memory card;
the central processing unit configures a data transmission mode of the first controller.
5. The control method of claim 2, wherein the cpu allocates a memory space for the second controller, comprising:
the central processing unit applies for a memory space in a real-time operating system and acquires a virtual address of the memory space;
and the central processing unit maps the virtual address into a physical address and configures the physical address in the second controller, so that the second controller can execute read-write operation on the memory space.
6. The method according to claim 1, wherein the mounting, by the central processor, the initialized memory card in the file system when the file system is executed comprises:
the central processor checks the block data of the storage card based on the card information of the storage card received from the first controller;
and after the data of the block is successfully verified, the central processing unit displays the storage card in a preset directory of the file system in a file form based on the card information so as to finish mounting the storage card.
7. The control method according to claim 1, characterized by further comprising:
when the file system receives write operation aiming at the memory card, the central processing unit controls the first controller and the second controller to enter a write working mode;
in a writing working mode, the second controller reads data from the memory space and outputs the data to the first controller; the first controller writes the data into the memory card.
8. The control method according to any one of claims 1 to 7, wherein when the first controller reads out data from the memory card, the first controller determines a transfer state of the read data based on a state value of an interrupt register in the first controller.
9. A control system of a memory card is characterized by comprising a central processing unit, a first controller and a second controller;
the APB bus of the central processing unit is connected with the first controller, the first controller is externally connected with a memory card, and the AXI bus of the central processing unit is connected with the second controller;
the central processing unit is used for initializing the first controller, the second controller and the memory card in the starting process of hardware;
the central processing unit is also used for mounting the initialized memory card in the file system when the file system is operated;
when the file system receives a read operation for the memory card, the central processing unit is further used for controlling the first controller and the second controller to enter a read working mode;
in a read mode of operation, the first controller is configured to read data from the memory card and output the data to the second controller; the second controller is used for writing the received data into a memory space;
the central processing unit is further configured to receive a data verification instruction, and in response to the data verification instruction, use data received by the second controller from the first controller as first data, where the received data is data read by the first controller at a preset address of a memory card;
the central processing unit is also used for reading data from the preset address of the memory card by using a preset reading and writing tool and taking the data as second data;
the central processing unit is further configured to compare the first data with the second data, and verify correctness of the data written into the memory space according to a comparison result.
CN202110103595.3A 2021-01-26 2021-01-26 Control method and system of memory card Active CN112799974B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110103595.3A CN112799974B (en) 2021-01-26 2021-01-26 Control method and system of memory card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110103595.3A CN112799974B (en) 2021-01-26 2021-01-26 Control method and system of memory card

Publications (2)

Publication Number Publication Date
CN112799974A true CN112799974A (en) 2021-05-14
CN112799974B CN112799974B (en) 2021-12-03

Family

ID=75811816

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110103595.3A Active CN112799974B (en) 2021-01-26 2021-01-26 Control method and system of memory card

Country Status (1)

Country Link
CN (1) CN112799974B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1253310A (en) * 1998-11-04 2000-05-17 佳能株式会社 Data fetch equipment
US20040264254A1 (en) * 2003-06-24 2004-12-30 Micron Technology, Inc. Erase block data splitting
CN1622056A (en) * 2004-12-24 2005-06-01 北京中星微电子有限公司 Method for accessing files
CN1714408A (en) * 2002-11-22 2005-12-28 皇家飞利浦电子股份有限公司 Circuit arrangement with non-volatile memory module and method for registering light-attacks on the non-volatile memory module
CN1725190A (en) * 2004-07-20 2006-01-25 华为技术有限公司 Detection method for failure of address bus
CN102486719A (en) * 2010-12-06 2012-06-06 普天信息技术研究院有限公司 Intelligent memory card and transaction-writing method thereof
US20140157053A1 (en) * 2012-12-05 2014-06-05 Christopher P. Mozak Memory subsystem data bus stress testing
CN106815166A (en) * 2016-12-27 2017-06-09 深圳市安云信息科技有限公司 A kind of method that file is transmitted between dual controller
CN110955545A (en) * 2018-09-26 2020-04-03 深信服科技股份有限公司 Data integrity checking method, system and related equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1253310A (en) * 1998-11-04 2000-05-17 佳能株式会社 Data fetch equipment
CN1714408A (en) * 2002-11-22 2005-12-28 皇家飞利浦电子股份有限公司 Circuit arrangement with non-volatile memory module and method for registering light-attacks on the non-volatile memory module
US20040264254A1 (en) * 2003-06-24 2004-12-30 Micron Technology, Inc. Erase block data splitting
CN1725190A (en) * 2004-07-20 2006-01-25 华为技术有限公司 Detection method for failure of address bus
CN1622056A (en) * 2004-12-24 2005-06-01 北京中星微电子有限公司 Method for accessing files
CN102486719A (en) * 2010-12-06 2012-06-06 普天信息技术研究院有限公司 Intelligent memory card and transaction-writing method thereof
US20140157053A1 (en) * 2012-12-05 2014-06-05 Christopher P. Mozak Memory subsystem data bus stress testing
CN106815166A (en) * 2016-12-27 2017-06-09 深圳市安云信息科技有限公司 A kind of method that file is transmitted between dual controller
CN110955545A (en) * 2018-09-26 2020-04-03 深信服科技股份有限公司 Data integrity checking method, system and related equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
李胜蓝 等: "基于 PCIe 的多路传输系统的 DMA 控制器设计", 《计算机应用》 *
陈赜: "《嵌入式软件助理工程师认证复习指南》", 30 November 2010 *

Also Published As

Publication number Publication date
CN112799974B (en) 2021-12-03

Similar Documents

Publication Publication Date Title
US5978862A (en) PCMCIA card dynamically configured in first mode to program FPGA controlling application specific circuit and in second mode to operate as an I/O device
US5412798A (en) System for enabling access to device driver residing in resource memory corresponding to coupled resource by allowing memory mapping to device driver to be executed
US5911084A (en) System and method for accessing peripheral devices on a non-functional controller
US6529989B1 (en) Intelligent expansion ROM sharing bus subsystem
US8850086B2 (en) SD switch box in a cellular handset
KR20080075110A (en) Initialization of flash storage via an embedded controller
CN108268414B (en) SD card driver based on SPI mode and control method thereof
CN112256601A (en) Data access control method, embedded storage system and embedded equipment
US20100169546A1 (en) Flash memory access circuit
US11068283B2 (en) Semiconductor apparatus, operation method thereof, and stacked memory apparatus having the same
US8677095B2 (en) System and method for optimal dynamic resource allocation in a storage system
KR102365312B1 (en) Storage controller, computational storage device, and operation method of computational storage device
US7725621B2 (en) Semiconductor device and data transfer method
US6446139B1 (en) Multiple chip single image BIOS
US6016549A (en) Peripheral unit having at least two sequencer circuits configured to control data transfers for power saving
CN111782154A (en) Data moving method, device and system
WO2022052883A1 (en) Method for saving memory resource of dual system on chip and dual system on chip
US20150177816A1 (en) Semiconductor integrated circuit apparatus
CN112799974B (en) Control method and system of memory card
WO2009115058A1 (en) Mainboard for providing flash storage function and storage method thereof
CN111597137A (en) Dynamic debugging method, device and system based on SPI protocol
CN111338998B (en) FLASH access processing method and device based on AMP system
US6813697B1 (en) Data processor and data processing system
JP3206585B2 (en) Bus control device, master device, slave device, and bus control method
US20060047934A1 (en) Integrated circuit capable of memory access control

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
GR01 Patent grant
GR01 Patent grant