eMMC instant read-write verification method and device, readable storage medium and electronic equipment

Through the Java reflection mechanism and the underlying access interface, the real-time read and write verification of eMMC is realized in the Java application layer, which solves the problem of the inability to read and write in real time in the Android Java application layer and improves the efficiency and accuracy of eMMC performance testing.

CN120256229BActive Publication Date: 2025-10-21CHENGDU BIWIN STORAGE TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510732761.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-04
Publication Date
2025-10-21
Estimated Expiration
2045-06-04

AI Technical Summary

Technical Problem

Instant read and write verification of eMMC cannot be achieved in the Android Java application layer, and existing methods are limited and complex.

Method used

The Java reflection mechanism is used to obtain the flag, define the underlying access interface and direct access eMMC operation class, and combine the underlying access function to perform instant read and write verification.

Benefits of technology

Implement instant read and write verification of eMMC at the Java application layer, reducing test complexity, improving test efficiency, and ensuring read and write accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120256229B_ABST
    Figure CN120256229B_ABST
Patent Text Reader

Abstract

The application discloses an eMMC instant read-write verification method and device, a readable storage medium and electronic equipment. A Java reflection mechanism is used to obtain a flag for direct input and output, a bottom access interface including a bottom access function set is defined in a Java application layer, the bottom access function set includes an opening function, a reading function, a writing function and a memory alignment allocation function, a direct access eMMC operation class is defined in the Java application layer, and the bottom access interface is integrated by using the direct access eMMC operation class. Based on the flag, the direct access eMMC operation class is used to perform instant read-write verification on the eMMC, and a verification result is obtained. In this way, a tester does not need to perform C / C++ coding, and can perform instant read-write verification on the eMMC without caching in the Android Java application layer. The eMMC verification is transferred from the development level to the application level, the time for writing and debugging the bottom driver is saved, the eMMC performance is tested more efficiently, and the test complexity is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of embedded storage technology, and in particular to an eMMC instant read and write verification method, device, readable storage medium and electronic equipment. Background Art

[0002] Instant read and write verification of eMMCs (embedded multimedia cards) within the Android Java application layer is crucial for testing and developing eMMC reliability and stability. However, direct eMMC read and write operations are not permitted within Android Java applications. This is because this involves Android system permissions and underlying hardware. The Java APIs abstracted by the Android system are all cached, making it impossible to perform real-time read and write operations on the underlying eMMC. The following are common methods and drawbacks for existing Android Java application layer eMMC read and write operations:

[0003] (1) File read and write operations are performed through the File class, RandomAccessFile class, and related interfaces provided in the Android SDK (Software Development Kit). Disadvantages: Only files are supported and eMMC devices cannot be directly operated. Data cache cannot be read and written immediately.

[0004] (2) Use JNI (Java Native Interface) to call the read and write operations in the underlying C / C++ code to read and write to the eMMC. Disadvantage: Requires custom C / C++ coding and cannot be implemented in the Java application layer.

[0005] (3) By executing system shell commands in Android Java, calling system or third-party tools to complete read and write operations on the eMMC block device, such as the dd tool (command line tool) and the cat tool (computer-aided translation tool). Disadvantage: Due to the limitations of third-party tools, it is impossible to freely complete read and write operations on the eMMC device.

[0006] From the above information, it can be seen that there are significant limitations in implementing non-cached, real-time read and write verification of eMMC in the Android Java application layer. Summary of the Invention

[0007] The technical problem to be solved by the present invention is to provide an eMMC instant read and write verification method, device, readable storage medium and electronic device, which can more efficiently test the eMMC performance and reduce the test complexity.

[0008] In order to solve the above technical problems, a technical solution adopted by the present invention is:

[0009] An eMMC instant read and write verification method includes the following steps:

[0010] Use Java reflection to get flags for direct input and output;

[0011] Defining a bottom-level access interface including a bottom-level access function set in a Java application layer, wherein the bottom-level access function set includes an open function, a read function, a write function, and a memory alignment allocation function;

[0012] Defining a direct access eMMC operation class in the Java application layer, and integrating the underlying access interface using the direct access eMMC operation class;

[0013] Based on the flag, the direct access eMMC operation class is used to perform instant read and write verification on the eMMC to obtain a verification result.

[0014] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0015] An eMMC instant read and write verification device, comprising:

[0016] The flag acquisition module is used to obtain flags for direct input and output using the Java reflection mechanism;

[0017] An interface definition module is used to define a low-level access interface including a low-level access function set in the Java application layer, wherein the low-level access function set includes an open function, a read function, a write function, and a memory alignment allocation function;

[0018] A class definition module, configured to define a direct access eMMC operation class in the Java application layer, and integrate the underlying access interface using the direct access eMMC operation class;

[0019] The verification module is used to perform instant read and write verification on the eMMC using the direct access eMMC operation class based on the flag to obtain a verification result.

[0020] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0021] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the various steps of the above-mentioned eMMC instant read and write verification method.

[0022] In order to solve the above technical problems, another technical solution adopted by the present invention is:

[0023] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step in the above-mentioned eMMC instant read and write verification method is implemented.

[0024] The beneficial effects of the present invention are: using the Java reflection mechanism to obtain flags for direct input and output, defining a bottom-level access interface including a bottom-level access function set in the Java application layer, the bottom-level access function set including an open function, a read function, a write function and a memory alignment allocation function, defining a direct access eMMC operation class in the Java application layer, and using the direct access eMMC operation class to integrate the bottom-level access interface, performing instant read and write verification on the eMMC based on the flag using the direct access eMMC operation class to obtain a verification result, so that the tester does not need to perform C / C++ coding, and can realize non-cached and instant read and write verification of the eMMC in the Android Java application layer, transferring the eMMC verification from the development level to the application level, saving the time of writing and debugging the bottom-level driver, thereby more efficiently testing the eMMC performance and reducing the test complexity. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 This is a flowchart of the steps of an eMMC instant read and write verification method according to an embodiment of the present invention;

[0026] Figure 2 This is a structural diagram of an eMMC instant read and write verification device according to an embodiment of the present invention;

[0027] Figure 3 The figure is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0028] To illustrate the technical content, achieved objectives and effects of the present invention in detail, the following description is given in conjunction with the embodiments and accompanying drawings.

[0029] Please refer to Figure 1 , an eMMC instant read and write verification method, comprising the steps of:

[0030] Use Java reflection to get flags for direct input and output;

[0031] Defining a bottom-level access interface including a bottom-level access function set in a Java application layer, wherein the bottom-level access function set includes an open function, a read function, a write function, and a memory alignment allocation function;

[0032] Defining a direct access eMMC operation class in the Java application layer, and integrating the underlying access interface using the direct access eMMC operation class;

[0033] Based on the flag, the direct access eMMC operation class is used to perform instant read and write verification on the eMMC to obtain a verification result.

[0034] From the above description, it can be seen that the beneficial effects of the present invention are: using the Java reflection mechanism to obtain flags for direct input and output, defining a bottom-level access interface including a bottom-level access function set in the Java application layer, the bottom-level access function set including an open function, a read function, a write function and a memory alignment allocation function, defining a direct access eMMC operation class in the Java application layer, and using the direct access eMMC operation class to integrate the bottom-level access interface, performing instant read and write verification on the eMMC based on the flag using the direct access eMMC operation class to obtain a verification result, so that the tester does not need to perform C / C++ coding, and can realize non-cached and instant read and write verification of the eMMC in the Android Java application layer, transferring the eMMC verification from the development level to the application level, saving the time of writing and debugging the bottom-level driver, thereby more efficiently testing the eMMC performance and reducing the test complexity.

[0035] Furthermore, the direct access eMMC operation class includes a construction method, a method for obtaining the eMMC sector size, a method for writing data, a method for reading data, and a method for comparing and verifying data;

[0036] The instant read and write verification of the eMMC is performed using the direct access eMMC operation class based on the flag, and the verification result obtained includes:

[0037] Calling the construction method and the opening function based on the flag to open and access the eMMC in a direct and immediate manner;

[0038] Calling the method for obtaining the eMMC sector size and the read function to obtain the sector size of the eMMC;

[0039] Calling the data writing method, the memory alignment allocation function, and the write function based on the sector size to write data to the eMMC;

[0040] Calling the data reading method, the memory alignment allocation function, and the read function based on the sector size to read data from the eMMC;

[0041] The data comparison and verification method is called to compare and verify the written data and the read data to obtain a verification result.

[0042] As can be seen from the above description, direct access to the eMMC operation class combined with the constructed set of underlying access functions can achieve instant access to the eMMC storage device. The automated data comparison and verification mechanism verifies the integrity of the read data immediately after writing, which can quickly discover and correct potential storage errors or transmission problems. At the same time, instant read and write verification of the eMMC is implemented at the Android Java application layer, simplifying the complexity of testing.

[0043] Furthermore, calling the construction method based on the flag and the opening function to open and access the eMMC in a direct and immediate manner includes:

[0044] The open function is called in the construction method, and the flag and the path of the eMMC are input into the open function as input parameters, so as to open and access the eMMC in a direct and immediate manner.

[0045] From the above description, we can see that the flag obtained above is used to set the mode for the system to access the eMMC. By calling the open function in the construction method and entering the flag and the eMMC path as input parameters into the open function, we can directly access the eMMC and improve the efficiency of the eMMC performance test.

[0046] Furthermore, the calling of the method for obtaining the eMMC sector size and the reading function to obtain the sector size of the eMMC includes:

[0047] In the method for obtaining the eMMC sector size, the preset sector size is used as an array element to define an array;

[0048] The read function is called, and the array elements in the array are respectively input into the read function as input parameters, and the array element successfully read for the first time is determined as the sector size of the eMMC.

[0049] As can be seen from the above description, the preset sector sizes are common sector sizes. They are input into the read function respectively, and the physical sector sizes of different eMMC devices are automatically adapted through dynamic detection. There is no need to pre-hardcode specific values, which improves the compatibility and portability of the code. The validity of each candidate sector size is verified through actual read operations to ensure the accuracy of the detection results and avoid read and write errors caused by differences in device specifications.

[0050] Furthermore, calling the data writing method, the memory alignment allocation function, and the write function based on the sector size to write data to the eMMC includes:

[0051] In the data writing method, detecting whether the size of the data buffer is a multiple of the sector size, and if so, calling the memory alignment allocation function to apply for a write memory block aligned according to the sector size, and copying the data in the data buffer to the write memory block, so that the data aligned according to the sector size in the write memory block is in a ready state;

[0052] The write function is called, and the write memory block is input into the write function as an input parameter, so as to immediately write the data in the write memory block into the eMMC.

[0053] From the above description, it can be seen that in the data write method, the size of the data buffer is detected to see if it is a multiple of the sector size. If so, the memory alignment allocation function is called to apply for a write memory block aligned according to the sector size. This fundamentally avoids system call failures or performance degradation caused by unaligned access, ensures that each write operation complies with the physical sector characteristics of the storage device, and bypasses the kernel cache through the instant write mechanism of the write function, achieving low-latency operation of data directly reaching the storage medium.

[0054] Furthermore, calling the data reading method, the memory alignment allocation function, and the read function based on the sector size to read data from the eMMC includes:

[0055] In the data reading method, detecting whether the size of the data buffer is a multiple of the sector size, and if so, calling the memory alignment allocation function to apply for a read memory block aligned according to the sector size;

[0056] The read function is called, and the read memory block is input into the read function as an input parameter, so as to immediately read the data in the eMMC into the read memory block.

[0057] From the above description, it can be seen that in the data reading method, whether the size of the data buffer is a multiple of the sector size is detected. If so, the memory alignment allocation function is called to apply for a read memory block aligned according to the sector size, ensuring that the direct I / O read operation fully complies with the physical characteristics requirements of the storage device, avoiding read failures or performance losses caused by memory misalignment, and inputting the read memory block as an input parameter into the read function to immediately read the data in the eMMC into the read memory block, so that the data can be efficiently and reliably transferred directly from the eMMC device to the user space.

[0058] Furthermore, the calling of the data comparison and verification method to compare and verify the written data and the read data to obtain the verification result includes:

[0059] Calling the data comparison and verification method, and inputting the write memory block and the read memory block as input parameters into the data comparison and verification method;

[0060] Obtaining one byte from the write memory block and the read memory block respectively in sequence;

[0061] It is determined whether the bytes obtained from the write memory block are the same as the bytes obtained from the read memory block. If not, the verification result is determined to be a failure. If so, the verification result is determined to be a success.

[0062] As can be seen from the above description, by comparing the written data and the read data byte by byte, the read and write accuracy of the eMMC can be accurately verified, any slight data difference can be detected, and the reliability of the eMMC performance test is improved.

[0063] Please refer to Figure 2 Another embodiment of the present invention provides an eMMC instant read and write verification device, comprising:

[0064] The flag acquisition module is used to obtain flags for direct input and output using the Java reflection mechanism;

[0065] An interface definition module is used to define a low-level access interface including a low-level access function set in the Java application layer, wherein the low-level access function set includes an open function, a read function, a write function, and a memory alignment allocation function;

[0066] A class definition module, configured to define a direct access eMMC operation class in the Java application layer, and integrate the underlying access interface using the direct access eMMC operation class;

[0067] The verification module is used to perform instant read and write verification on the eMMC using the direct access eMMC operation class based on the flag to obtain a verification result.

[0068] Another embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the computer program implements the various steps in the above-mentioned eMMC instant read and write verification method.

[0069] Please refer to Figure 3 Another embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, each step in the above-mentioned eMMC instant read and write verification method is implemented.

[0070] The above-mentioned eMMC instant read and write verification method, device, readable storage medium and electronic device of the present invention can be applied to the test scenario of eMMC reliability and stability, and are described below through specific embodiments:

[0071] Please refer to Figure 1 , embodiment 1 of the present invention is:

[0072] An eMMC instant read and write verification method includes the following steps:

[0073] S1. Use Java reflection mechanism to obtain flags for direct input and output (I / O).

[0074] The flag is the OsConstants.O_DIRECT flag that is hidden from Java applications in the Android framework layer. This flag is subsequently used to set the system access mode for eMMC.

[0075] S2. Define a bottom-level access interface including a bottom-level access function set in the Java application layer, where the bottom-level access function set includes an open function, a read function, a write function, and a memory alignment allocation function.

[0076] The difference between the underlying access interface and the Java native interface in the prior art is that the underlying access interface does not require C / C++ custom coding.

[0077] The input parameters of the open function include a file path and a flag, and the return value is a file descriptor used to identify the file opened by the process. The function is used to open the eMMC device and the file, which is used to store directly written data and retrieve it for verification.

[0078] The input parameters of the read function include a file descriptor, a read memory block, and a memory block size, and the return value is the number of bytes successfully read. The function is used to read data from the eMMC to the read memory block.

[0079] The input parameters of the write function include a file descriptor, a write memory block, and a memory block size, and the return value is the number of bytes successfully written. The function is used to write the data in the write memory block to the eMMC.

[0080] The memory alignment allocation (posix_memalign) function takes as input parameters a memory block, a sector size, and a memory block size, and returns a value indicating whether the operation is successful. The function is used to align and arrange memory blocks of a specified size according to the sector size.

[0081] The above function uses a C function with the same name as the function to operate the eMMC. Specifically, the com.sun.jna.Native.load() method is called to load the C runtime library of the Android operating system. This method calls the C language function of the same name.

[0082] S3. Define a direct access eMMC operation class in the Java application layer, and use the direct access eMMC operation class to integrate the underlying access interface.

[0083] The direct access eMMC operation class includes a construction method, an eMMC sector size acquisition method, a data writing method, a data reading method, and a data comparison and verification method.

[0084] The present invention calls the underlying access interface by directly accessing the eMMC operation class, and the interface inherits com.sun.jna.Library.java to achieve interaction with the eMMC.

[0085] S4, based on the flag, using the direct access eMMC operation class to perform instant read and write verification on the eMMC to obtain a verification result, specifically including S41-S45:

[0086] S41: Call the construction method and the open function based on the flag to open and access the eMMC in a direct and immediate manner.

[0087] Specifically, the open function is called in the construction method, and the flag and the path of the eMMC are input into the open function as input parameters, so as to open and access the eMMC in a direct and immediate manner.

[0088] S42, calling the method for obtaining the eMMC sector size and the read function to obtain the sector size of the eMMC, specifically including S421-S422:

[0089] S421 . In the method for obtaining the eMMC sector size, define an array using the preset sector size as an array element.

[0090] The preset sector size is a common sector size of eMMC or other storage devices. In an optional implementation, the preset sector size includes 512 bytes, 2048 bytes, and 4096 bytes.

[0091] For example, in the method for obtaining the eMMC sector size, an array is generated by taking 512 bytes, 2048 bytes, and 4096 bytes as array elements in ascending order.

[0092] S422: Call the read function, input the array elements in the array as input parameters to the read function respectively, and determine the array element that is successfully read for the first time as the sector size of the eMMC.

[0093] For example, first input 512 bytes as the input parameter to the read function. If the return value is the number of bytes successfully read, the eMMC sector size is determined to be 512 bytes. Otherwise, continue to input 2048 bytes as the input parameter to the read function, and so on, until the eMMC sector size is determined.

[0094] S43, calling the data writing method, the memory alignment allocation function, and the write function based on the sector size to write data to the eMMC, specifically including S431-S432:

[0095] S431. In the data writing method, detect whether the size of the data buffer is a multiple of the sector size. If so, call the memory alignment allocation function to apply for a write memory block aligned according to the sector size, and copy the data in the data buffer to the write memory block, so that the data aligned according to the sector size in the write memory block is in a ready state.

[0096] For example, assuming the sector size determined in the previous step is 512 bytes, the write method checks whether the buffer size is a multiple of 512 bytes. If so, the memory alignment allocation function is called to request a write memory block aligned with 512 bytes, and the data in the buffer is copied to the write memory block so that the data aligned with 512 bytes in the write memory block is ready.

[0097] S432: Call the write function, and input the write memory block as an input parameter to the write function, so as to immediately write the data in the write memory block into the eMMC.

[0098] S44, calling the data reading method, the memory alignment allocation function, and the read function based on the sector size to read data from the eMMC, specifically including S441-S442:

[0099] S441. In the data reading method, whether the size of the data buffer is a multiple of the sector size is detected. If so, the memory alignment allocation function is called to apply for a read memory block aligned according to the sector size.

[0100] For example, in the data read method, check whether the buffer size is a multiple of 512 bytes. If so, call the memory alignment allocation function to apply for a read memory block aligned with 512 bytes.

[0101] S442: Call the read function and input the read memory block as an input parameter to the read function to immediately read the data in the eMMC into the read memory block.

[0102] S45, calling the data comparison and verification method to compare and verify the written data and the read data to obtain a verification result, specifically including S451-S453:

[0103] S451. Call the data comparison and verification method, and input the write memory block and the read memory block as input parameters into the data comparison and verification method.

[0104] S452. Obtain one byte from the write memory block and the read memory block respectively in sequence.

[0105] S453. Determine whether the bytes obtained from the write memory block are the same as the bytes obtained from the read memory block. If not, determine that the verification result is a failure. If so, determine that the verification result is a success.

[0106] For example, sequentially obtain a byte wb_1 from the write memory block, and then obtain a byte rb_1 from the read memory block, and determine whether the byte wb_1 is the same as the byte rb_1. If they are not the same, the verification result can be directly determined to be a failure. If they are the same, perform a comparison with the next byte, that is, obtain the next byte wb_2 from the write memory block, and then obtain the next byte rb_2 from the read memory block, and determine whether the byte wb_2 is the same as the byte rb_2. If they are not the same, the verification result is determined to be a failure. If they are the same, perform a comparison with the next byte, and so on. Only when the comparison of each pair of bytes is the same, the verification result is determined to be successful.

[0107] Please refer to Figure 2 , the second embodiment of the present invention is:

[0108] An eMMC instant read and write verification device, comprising:

[0109] The flag acquisition module is used to obtain flags for direct input and output using the Java reflection mechanism;

[0110] An interface definition module is used to define a low-level access interface including a low-level access function set in the Java application layer, wherein the low-level access function set includes an open function, a read function, a write function, and a memory alignment allocation function;

[0111] A class definition module, configured to define a direct access eMMC operation class in the Java application layer, and integrate the underlying access interface using the direct access eMMC operation class;

[0112] The verification module is used to perform instant read and write verification on the eMMC using the direct access eMMC operation class based on the flag to obtain a verification result.

[0113] The third embodiment of the present invention is:

[0114] A computer-readable storage medium stores a computer program, which, when executed by a processor, can implement the various steps of the eMMC instant read and write verification method in the first embodiment.

[0115] The fourth embodiment of the present invention is:

[0116] Please refer to Figure 3 , an electronic device includes a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the computer program, each step of the eMMC instant read and write verification method in Example 1 is implemented.

[0117] In summary, the present invention provides an eMMC instant read and write verification method, device, readable storage medium and electronic device, which uses the Java reflection mechanism to obtain a flag for direct input and output, defines a bottom-level access interface including a bottom-level access function set in the Java application layer, and the bottom-level access function set includes an open function, a read function, a write function and a memory alignment allocation function, defines a direct access eMMC operation class in the Java application layer, and uses the direct access eMMC operation class to integrate the bottom-level access interface, and uses the direct access eMMC operation class to perform instant read and write verification on the eMMC based on the flag to obtain a verification result. In this way, the tester does not need to perform C / C++ coding, and can implement cache-free and instant read and write verification of the eMMC in the Android Java application layer, transferring the eMMC verification from the development level to the application level, saving the time of writing and debugging the bottom-level driver, thereby more efficiently testing the eMMC performance and reducing the test complexity; in addition, by comparing the write data and the read data byte by byte, the read and write accuracy of the eMMC can be accurately verified, any subtle data differences can be detected, and the reliability of the eMMC performance test is improved.

[0118] In the above embodiments provided in the present application, it should be understood that the disclosed methods, devices, computer-readable storage media, and electronic devices can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple components or modules can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or components or modules, which can be electrical, mechanical or other forms.

[0119] The components described as separate parts may or may not be physically separate, and the components shown as components may or may not be physical modules, that is, they may be located in one place or distributed across multiple network modules. Some or all of these components may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0120] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing module, or each component may exist physically separately, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or software functional modules.

[0121] If the integrated module is implemented as a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the portion that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.

[0122] It should be noted that for the aforementioned method embodiments, for ease of description, they are all expressed as a series of action combinations. However, those skilled in the art should be aware that the present invention is not limited by the order of the actions described, because according to the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0123] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0124] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the present invention's description and drawings, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. An eMMC instant read and write verification method, characterized in that: Including steps: Use Java reflection to get flags for direct input and output; Defining a bottom-level access interface including a bottom-level access function set in a Java application layer, wherein the bottom-level access function set includes an open function, a read function, a write function, and a memory alignment allocation function; Defining a direct access eMMC operation class in the Java application layer, and using the direct access eMMC operation class to integrate the underlying access interface, the direct access eMMC operation class including a construction method, a method for obtaining the eMMC sector size, a method for writing data, a method for reading data, and a method for comparing and verifying data; Based on the flag, the direct access eMMC operation class is used to perform instant read and write verification on the eMMC to obtain a verification result, including: Calling the construction method and the opening function based on the flag to open and access the eMMC in a direct and immediate manner; Calling the method for obtaining the eMMC sector size and the read function to obtain the sector size of the eMMC; Calling the data writing method, the memory alignment allocation function, and the write function based on the sector size to write data to the eMMC; Calling the data reading method, the memory alignment allocation function, and the read function based on the sector size to read data from the eMMC; The data comparison and verification method is called to compare and verify the written data and the read data to obtain a verification result.

2. A kind of eMMC instant read and write verification method according to claim 1, it is characterized in that, The calling of the construction method based on the flag and the opening function using a direct and immediate manner to open and access the eMMC include: The open function is called in the construction method, and the flag and the path of the eMMC are input into the open function as input parameters, so as to open and access the eMMC in a direct and immediate manner.

3. A kind of eMMC instant read and write verification method according to claim 1, it is characterized in that, The calling of the method for obtaining the eMMC sector size and the reading function to obtain the sector size of the eMMC includes: In the method for obtaining the eMMC sector size, the preset sector size is used as an array element to define an array; The read function is called, and the array elements in the array are respectively input into the read function as input parameters, and the array element successfully read for the first time is determined as the sector size of the eMMC.

4. A kind of eMMC instant read and write verification method according to claim 1, it is characterized in that, The step of calling the data writing method, the memory alignment allocation function, and the write function based on the sector size to write data to the eMMC includes: In the data writing method, detecting whether the size of the data buffer is a multiple of the sector size, and if so, calling the memory alignment allocation function to apply for a write memory block aligned according to the sector size, and copying the data in the data buffer to the write memory block, so that the data aligned according to the sector size in the write memory block is in a ready state; The write function is called, and the write memory block is input into the write function as an input parameter, so as to immediately write the data in the write memory block into the eMMC.

5. An eMMC instant read and write verification method according to claim 4, characterized in that, Calling the data reading method, the memory alignment allocation function, and the read function based on the sector size to read data from the eMMC includes: In the data reading method, detecting whether the size of the data buffer is a multiple of the sector size, and if so, calling the memory alignment allocation function to apply for a read memory block aligned according to the sector size; The read function is called, and the read memory block is input into the read function as an input parameter, so as to immediately read the data in the eMMC into the read memory block.

6. An eMMC instant read and write verification method according to claim 5, characterized in that, Calling the data comparison and verification method to compare and verify the written data and the read data to obtain the verification result includes: Calling the data comparison and verification method, and inputting the write memory block and the read memory block as input parameters into the data comparison and verification method; Obtaining one byte from the write memory block and the read memory block respectively in sequence; It is determined whether the bytes obtained from the write memory block are the same as the bytes obtained from the read memory block. If not, the verification result is determined to be a failure. If so, the verification result is determined to be a success.

7. An eMMC instant read and write verification device, characterized in that: include: The flag acquisition module is used to obtain flags for direct input and output using the Java reflection mechanism; An interface definition module is used to define a low-level access interface including a low-level access function set in the Java application layer, wherein the low-level access function set includes an open function, a read function, a write function, and a memory alignment allocation function; A class definition module, configured to define a direct access eMMC operation class in the Java application layer, and use the direct access eMMC operation class to integrate the underlying access interface, wherein the direct access eMMC operation class includes a construction method, a method for obtaining the eMMC sector size, a method for writing data, a method for reading data, and a method for comparing and verifying data; A verification module is configured to perform instant read and write verification on the eMMC using the direct access eMMC operation class based on the flag to obtain a verification result, including: Calling the construction method and the opening function based on the flag to open and access the eMMC in a direct and immediate manner; Calling the method for obtaining the eMMC sector size and the read function to obtain the sector size of the eMMC; Calling the data writing method, the memory alignment allocation function, and the write function based on the sector size to write data to the eMMC; Calling the data reading method, the memory alignment allocation function, and the read function based on the sector size to read data from the eMMC; The data comparison and verification method is called to compare and verify the written data and the read data to obtain a verification result.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, each step of the eMMC instant read and write verification method according to any one of claims 1 to 6 is implemented.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, each step of the eMMC instant read and write verification method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • EMMC verification method and system and storage medium

    CN113297023A

  • Read-write method and device of eMMC device, equipment and storage medium

    CN114936173A