Command sending method and electronic device

CN117827704BActive Publication Date: 2026-10-27HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311631603.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-19
Publication Date
2026-10-27
Estimated Expiration
2042-07-19

AI Technical Summary

Technical Problem

[0004]目前,一些芯片针对某个或某些命令进行了特殊设置,导致这些芯片作为电子设备主机时,在发送命令集中的某个或某些命令时出错

Benefits of technology

[0005]为了解决上述技术问题,本申请提供一种命令发送方法及电子设备,针对进行了特殊命令设置的芯片,提供一种新的命令发送方法,避免芯片在发送相关命令时因受到特殊命令设置的影响而出错。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117827704B_ABST
    Figure CN117827704B_ABST
Patent Text Reader

Abstract

The application provides a command sending method and an electronic device. The method comprises the following steps: determining whether a command to be sent to a kernel layer is a first command, the first command being a command related to multi-block operation; if yes, shielding a function of automatically enabling a second command by the kernel layer, the second command being a command capable of aborting or interrupting the first command; and sending the first command to the kernel layer. In this way, after the function of automatically enabling the second command by the kernel layer is shielded, the first command is sent to the kernel layer, and since the function of automatically enabling the second command is shielded, the kernel layer is not disturbed by the second command when interpreting the first command, so that the correct first command can be sent to an eMMC device, thereby avoiding errors of the chip when sending related commands due to the influence of special commands.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application of the invention patent application filed with the Chinese Patent Office with application number 202210848089.1, filing date July 19, 2022, entitled "Command Transmission Method and Electronic Device". Technical Field

[0002] This application relates to the field of terminal equipment, and more particularly to a command sending method and an electronic device. Background Technology

[0003] Electronic devices generally consist of a host and devices. The host can read data from or write data to the devices through a communication connection. Typically, the chip that serves as the host of an electronic device supports industry-recognized protocols and all corresponding command sets.

[0004] Currently, some chips have special settings for one or more commands, which causes these chips to malfunction when sending one or more commands in the command set when acting as the host of an electronic device. Summary of the Invention

[0005] To address the aforementioned technical problems, this application provides a command sending method and an electronic device. Specifically, it provides a new command sending method for chips with special command settings, thereby preventing errors caused by the special command settings when the chip sends relevant commands.

[0006] Firstly, this application provides a command sending method. This method is applied to an electronic device. The method includes: determining whether the command to be sent to the kernel layer is a first command, wherein the first command is a command related to multi-block operations; if so, disabling the kernel layer's automatic enabling function for a second command, wherein the second command is a command capable of suspending or interrupting the first command, and sending the first command to the kernel layer. In this way, after disabling the kernel layer's automatic enabling function for the second command, sending the first command to the kernel layer prevents interference from the second command when interpreting the first command, thus enabling the correct first command to be sent to the eMMC device. This avoids errors caused by special command settings affecting the chip's command transmission.

[0007] According to the first aspect, disabling the kernel layer's automatic enabling of the second command includes: setting a first transmission mode and a second transmission mode in the kernel layer, wherein in the first transmission mode, the kernel layer automatically enables the second command and disables the third command; in the second transmission mode, the kernel layer automatically enables the third command and disables the second command; the kernel layer uses the first transmission mode when the first structure is empty, and uses the second transmission mode when the first structure is not empty; the third command is encapsulated into the first structure to obtain a first target structure; and the first target structure is sent to the kernel layer. In this way, the kernel layer's automatic enabling of the second command can be successfully disabled before the first command is sent to the kernel layer.

[0008] According to the first aspect, disabling the kernel layer's ability to automatically enable the second command includes sending a disable instruction to the kernel layer, which instructs the kernel layer to disable the automatic enabling of the second command. This allows the automatic enabling of the second command to be successfully disabled before the first command is sent to the kernel layer.

[0009] According to the first aspect, after sending the first command to the kernel layer, the process also includes: determining whether the kernel layer has finished executing the first command; and after the kernel layer has finished executing the first command, restoring the kernel layer's ability to automatically enable the second command. This avoids affecting the chip's processing flow for other commands.

[0010] According to the first aspect, sending the first command to the kernel layer includes: sending the first command to the kernel layer via the ioctl function.

[0011] According to the first aspect, the first command is a multi-block read command CMD18 or a multi-block write command CMD25, and the second command is a stop transmission command CMD12.

[0012] According to the first aspect, the first command is a combination command including the multi-block write command CMD25 and the command CMD23 for setting the number of read / write blocks, and the second command is the stop transmission command CMD12.

[0013] According to the first aspect, the third command is CMD23, ​​which sets the number of read / write blocks.

[0014] In a second aspect, this application provides an electronic device, including: a memory and a processor, wherein the memory is coupled to the processor; the memory stores program instructions, and when the program instructions are executed by the processor, the electronic device performs the command sending method of any one of the first aspects.

[0015] Thirdly, this application provides a computer-readable storage medium including a computer program that, when run on an electronic device, causes the electronic device to execute the command sending method described in any of the first aspects above. Attached Figure Description

[0016] Figure 1 This is a schematic diagram of the structure of an electronic device 100 as an example.

[0017] Figure 2 This is a software structure block diagram of an electronic device 100 according to an embodiment of this application, which is an example shown.

[0018] Figure 3 This is an exemplary schematic diagram illustrating the communication between a host and an eMMC device in an electronic device.

[0019] Figure 4 This is an example flowchart illustrating a command sending method. Detailed Implementation

[0020] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0021] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone.

[0022] The terms "first" and "second," etc., used in the specification and claims of this application are used to distinguish different objects, not to describe a specific order of objects. For example, "first target object" and "second target object," etc., are used to distinguish different target objects, not to describe a specific order of target objects.

[0023] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0024] In the description of the embodiments in this application, unless otherwise stated, "multiple" means two or more. For example, multiple processing units means two or more processing units; multiple systems means two or more systems.

[0025] The hardware of electronic devices typically includes a host and devices. The host is usually a chip. Devices can be, for example, memory. The host and devices can communicate with each other via a communication interface, such as an eMMC bus.

[0026] Among them, the device is one that supports the eMMC (embedded MultiMedia Card) protocol.

[0027] The host can read data from the device or write data to the device by sending commands conforming to the eMMC protocol.

[0028] In related technologies, some chips have special settings for one or more commands, which causes these chips to malfunction when executing one or more commands in the command set when acting as the host of an electronic device.

[0029] For example, when chip A incorporates eMMC memory, the host computer and the eMMC memory communicate via the eMMC bus. Chip A sends the CMD23+CMD25 command to the eMMC memory to obtain its health information. However, after sending the CMD23+CMD25 command, chip A receives a CRC (Cyclic Redundancy Check) error, and the eMMC memory does not return health information. Therefore, an error occurred when chip A sent the CMD23+CMD25 command to the eMMC memory.

[0030] This application provides a command sending method, which is a new command sending method for chips with special command settings, to avoid errors caused by the special command settings when the chip sends relevant commands.

[0031] The command sending method in this application embodiment can be applied to electronic devices, such as smartphones, tablets, and other electronic devices. The structure of the electronic device can be as follows: Figure 1 As shown.

[0032] Figure 1 This is a schematic diagram illustrating the structure of an electronic device 100 as an example. It should be understood that... Figure 1 The electronic device 100 shown is merely an example of an electronic device, and the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations. Figure 1 The various components shown can be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application-specific integrated circuits.

[0033] Please see Figure 1 The electronic device 100 may include: a processor 110, internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, an indicator 192, a camera 193, etc.

[0034] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, memory, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0035] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.

[0036] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory.

[0037] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0038] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0039] In this embodiment, the processor 110 is located on the chip and can serve as the host in this embodiment. The eMMC memory can communicate with the processor 110 via the eMMC bus.

[0040] The software system of the electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses the layered architecture Android system as an example to illustrate the software structure of the electronic device 100.

[0041] Figure 2 The above is a software structure block diagram of an electronic device 100 according to an embodiment of this application.

[0042] The layered architecture of the electronic device 100 divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system may include an application layer, an application framework layer, a system layer, and a kernel layer, etc.

[0043] The application layer can include a series of application packages.

[0044] like Figure 2 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.

[0045] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0046] like Figure 2As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0047] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0048] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0049] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0050] The phone manager is used to provide communication functions for electronic device 100. For example, it manages call status (including connection and disconnection).

[0051] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0052] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0053] The Android Runtime consists of core libraries and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.

[0054] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.

[0055] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0056] A system library can include multiple functional modules. For example... Figure 2 As shown in the embodiments of this application, the system library includes a command sending module, which is used to execute the command sending method of the embodiments of this application.

[0057] It should be noted that, although Figure 2 Although not shown in the document, it is understood that the system library may also include other functional modules, such as: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0058] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0059] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

[0060] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0061] A 2D graphics engine is a graphics engine for 2D drawing. The kernel layer is the layer between hardware and software. The kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers.

[0062] The kernel layer is the layer between hardware and software.

[0063] like Figure 2 As shown, the kernel layer can include modules such as display driver, Bluetooth driver, audio driver, Wi-Fi driver, and device driver.

[0064] In the command sending method of this application embodiment, the command sent to the kernel layer is received by the device driver module, and then the device driver module sends the command to the eMMC device, such as an eMMC memory, through the eMMC bus.

[0065] Understandable Figure 2 The layers in the illustrated software structure and the components contained in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer layers than illustrated, and each layer may include more or fewer components; this application does not impose any limitations.

[0066] The present application will be described in detail below through examples.

[0067] In this embodiment, the host communicates with the eMMC device through the eMMC host controller within the host. The eMMC host controller can be... Figure 1 Part of the processor 110 shown.

[0068] Figure 3 This is a schematic diagram illustrating communication between a host and an eMMC device in an exemplary electronic device. Please refer to [link / reference]. Figure 3 The eMMC host controller in the host sends commands (CMD) to the eMMC devices via the eMMC bus, and the eMMC devices return the response information to the host via the eMMC bus.

[0069] Figure 4 This is an example flowchart illustrating a command sending method. In this embodiment, the command sending method is applied to an electronic device whose kernel layer has enabled the function of automatically enabling a second command.

[0070] like Figure 4 As shown, in this embodiment, the method may include the following steps:

[0071] S401. Determine whether the command to be sent to the kernel layer is the first command. If so, proceed to step S402; otherwise, proceed to step S403. The first command is a command related to multi-block operations.

[0072] For example, in one example, the first command could be the multi-block read command CMD18. In another example, the first command could be the multi-block write command CMD25.

[0073] S402, disable the function of automatically enabling the second command in the kernel layer, wherein the second command is a command that can suspend or interrupt the first command.

[0074] For example, if the first command is a multi-block read command CMD18 or a multi-block write command CMD25, the second command can be a stop transmission command CMD12.

[0075] In related technologies, the error occurs when a chip sends the CMD23+CMD25 command to the eMMC memory because the chip's kernel layer has the CMD12 function automatically enabled. Therefore, when the chip sends the CMD23+CMD25 command to the eMMC memory, the device driver in the chip's kernel layer actually sends a combined command of CMD23+CMD25+CMD12. Since this command combination does not exist in the eMMC protocol, the eMMC memory does not support the CMD23+CMD25+CMD12 combination command. Therefore, upon receiving the CMD23+CMD25+CMD12 combined command from the host, the eMMC memory sets the CRC status bit and returns a response to the host. The host then verifies the CRC and returns a result indicating a CRC error, meaning the verification failed.

[0076] In this embodiment, by disabling the kernel layer's automatic enabling of the second command, the first command received from the upper layer is no longer interfered with by the automatically enabled second command. This allows the kernel layer to send the correct first command to the eMMC device. Consequently, the eMMC device can correctly respond to the first command sent by the host and no longer report errors.

[0077] S403, Send the first command to the kernel layer.

[0078] This step involves sending the first command to the kernel layer after the kernel layer has already disabled the function of automatically enabling the second command. At this point, because the function of automatically enabling the second command has been disabled, the kernel layer is no longer interfered with by the second command when interpreting the first command, thus enabling it to send the correct first command to the eMMC device. This avoids errors caused by special command settings affecting the chip's command transmission.

[0079] In one example, disabling the kernel layer's ability to automatically enable second commands could include:

[0080] In the kernel layer, a first transmission mode and a second transmission mode are set. In the first transmission mode, the kernel layer automatically enables the second command and disables the third command. In the second transmission mode, the kernel layer automatically enables the third command and disables the second command. The kernel layer uses the first transmission mode when the first structure is empty and uses the second transmission mode when the first structure is not empty.

[0081] The third command is encapsulated into the first structure to obtain the first target structure;

[0082] Send the first target structure to the kernel layer.

[0083] For example, the host sets the transmission mode every time it sends a command to the device. There are two branches in the transmission mode setting: branch a and branch b.

[0084] Among them, branch a is: multiple block operations and the number of blocks operated on is greater than 1, sbc (first structure) is empty, the host enables SDHCI_AUTO_CMD12 capability, and will enable AUTO CMD12 transmission mode.

[0085] Branch b is: sbc is not empty, the host enables AUTO CMD23 capability, and enables AUTO CMD23 transfer mode.

[0086] Thus, before sending CMD25 to the kernel layer, CMD23 is encapsulated in an sbc structure and sent to the kernel layer. The kernel layer determines that the sbc structure is not empty and contains CMD23, ​​and then executes the b-branch transmission mode, enabling the AUTO CMD23 capability. Therefore, after receiving CMD25 from the upper layer, the kernel layer sends the combined CMD23+CMD25 command to the device.

[0087] In another example, disabling the kernel layer's ability to automatically enable second commands could include:

[0088] Send a shutdown command to the kernel layer, which instructs the kernel layer to disable the function of automatically enabling the second command.

[0089] For example, before sending the combined CMD23+CMD25 command to the kernel layer, the upper layer of chip A (e.g., the system library) first sends the aforementioned disable instruction to the kernel layer. Upon receiving the disable instruction, the kernel layer disables the AUTO CMD12 capability. Thus, by disabling the kernel layer's AUTO CMD12 capability before sending the combined CMD23+CMD25 command, the kernel layer is not affected by CMD12 and sends the combined CMD23+CMD25 command to the device.

[0090] In one example, after sending the first command to the kernel layer, it may also include:

[0091] Determine whether the kernel layer has finished executing the first command;

[0092] After the first command is executed at the kernel level, the function of automatically enabling the second command at the kernel level is restored.

[0093] This avoids affecting the chip's processing flow for other commands.

[0094] The command sending method of this application embodiment enables chips with special command settings to read or write data from eMMC devices normally, avoiding incompatibility between chips and eMMC devices due to special command settings.

[0095] This application also provides an electronic device, which includes a memory and a processor. The memory is coupled to the processor and stores program instructions. When the program instructions are executed by the processor, the electronic device performs a command sending method.

[0096] It is understood that, in order to achieve the above-mentioned functions, electronic devices include hardware and / or software modules that perform the respective functions. Based on the algorithmic steps of the examples described in the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.

[0097] This embodiment also provides a computer storage medium storing computer instructions. When the computer instructions are executed on an electronic device, the electronic device performs the aforementioned method steps to implement the command sending method in the above embodiment.

[0098] This embodiment also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to implement the command sending method in the above embodiment.

[0099] In addition, this application also provides an apparatus, which may specifically be a chip, component or module. The apparatus may include a connected processor and a memory. The memory is used to store computer execution instructions. When the apparatus is running, the processor can execute the computer execution instructions stored in the memory to cause the chip to execute the command sending methods in the above-described method embodiments.

[0100] In this embodiment, the electronic device, computer storage medium, computer program product or chip are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects of the corresponding method provided above, and will not be repeated here.

[0101] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0102] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another apparatus, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0103] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0104] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0105] Any content in the various embodiments of this application, as well as any content in the same embodiment, can be freely combined. Any combination of the above content is within the scope of this application.

[0106] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0107] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

[0108] The steps of the methods or algorithms described in conjunction with the embodiments of this application can be implemented in hardware or by a processor executing software instructions. The software instructions can consist of corresponding software modules, which can be stored in random access memory (RAM), flash memory, read-only memory (ROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), registers, hard disks, portable hard disks, CD-ROMs, or any other form of storage medium well known in the art. An exemplary storage medium is coupled to a processor, enabling the processor to read information from and write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can reside in an ASIC.

[0109] Those skilled in the art will recognize that the functions described in the embodiments of this application in one or more of the above examples can be implemented using hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or code on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein communication media include any medium that facilitates the transfer of a computer program from one place to another. Storage media can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0110] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A command sending method, characterized in that, Applied to electronic devices, including: At the first moment, a first combined command is obtained, which includes a first command and a second command. The first command is used to set the number of read / write blocks, and the second command is a command related to multi-block operations, which include multi-block reads or multi-block writes. After obtaining the first combined command, the third command is disabled. The third command is a command that can suspend or interrupt the second command. In response to the first combined command, execute the first operation; At the second moment, obtain the second command; Based on the second command obtained at the second time, the third command is enabled to obtain a second combined command, which includes the second command and the third command. In response to the second combined command, perform the second operation.

2. The method according to claim 1, characterized in that, The electronic device includes a processor and an embedded multimedia card (eMMC) device. After obtaining the first combined command and disabling the third command, the process further includes: The processor's kernel layer responds to the first combined command by sending the first combined command to the eMMC device.

3. The method according to claim 1, characterized in that, The electronic device includes a processor and an eMMC device. After obtaining the second combined command based on acquiring the second command at the second time moment and enabling the third command, the method further includes: The processor's kernel layer responds to the second combined command by sending the second combined command to the eMMC device.

4. The method according to claim 1, characterized in that, The first command is CMD23, ​​the second command is CMD25 or CMD18, and the third command is CMD12.

5. The method according to claim 1, characterized in that, The electronic device includes a processor, and disabling third commands includes: The function of automatically enabling third commands in the kernel layer of the processor is disabled.

6. The method according to claim 1, characterized in that, The electronic device includes a processor, and after responding to the first combined command and performing the first operation, it further includes: Enable the function of automatically enabling third commands in the kernel layer of the processor.

7. The method according to claim 1, characterized in that, The electronic device includes a processor, and after obtaining the first combined command and disabling the third command, it further includes: The first command is encapsulated into a first structure to obtain the first target structure; Send the first target structure to the kernel layer of the processor; The second command is sent to the kernel layer of the processor.

8. The method according to claim 1, characterized in that, The electronic device includes a processor, and after obtaining the first combined command and disabling the third command, it further includes: The first combined command is sent to the kernel layer of the processor via the ioctl function.

9. The method according to claim 1, characterized in that, The electronic device includes a processor, and disabling third commands includes: In the kernel layer of the processor, a first transmission mode and a second transmission mode are set. In the first transmission mode, the kernel layer enables the third command and disables the first command. In the second transmission mode, the kernel layer enables the first command and disables the third command. The kernel layer uses the first transmission mode when the first structure is empty and uses the second transmission mode when the first structure is not empty. The first command is the command CMD23 for setting the number of read / write blocks. The first command is encapsulated into a first structure to obtain the first target structure; The first target structure is sent to the kernel layer.

10. An electronic device, characterized in that, include: A memory and a processor, wherein the memory is coupled to the processor; The memory stores program instructions that, when executed by the processor, cause the electronic device to perform the command sending method according to any one of claims 1-9.

11. A computer-readable storage medium comprising a computer program, characterized in that, When the computer program is run on an electronic device, it causes the electronic device to perform the command sending method as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Systems and methods of command authorization

    CN107787486A

  • Test method, test device and test system for storage device

    CN112579371A