CN115017073B - Enabling method and device of communication controller, electronic equipment and storage medium - Google Patents

Enabling method and device of communication controller, electronic equipment and storage medium Download PDF

Info

Publication number
CN115017073B
CN115017073B CN202110244871.8A CN202110244871A CN115017073B CN 115017073 B CN115017073 B CN 115017073B CN 202110244871 A CN202110244871 A CN 202110244871A CN 115017073 B CN115017073 B CN 115017073B
Authority
CN
China
Prior art keywords
enabling
value
communication controller
enable
bit
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.)
Active
Application number
CN202110244871.8A
Other languages
Chinese (zh)
Other versions
CN115017073A (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.)
Loongson Technology Corp Ltd
Original Assignee
Loongson Technology Corp 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 Loongson Technology Corp Ltd filed Critical Loongson Technology Corp Ltd
Priority to CN202110244871.8A priority Critical patent/CN115017073B/en
Publication of CN115017073A publication Critical patent/CN115017073A/en
Application granted granted Critical
Publication of CN115017073B publication Critical patent/CN115017073B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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/382Information transfer, e.g. on bus using universal interface adapter
    • G06F13/385Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F1/00Details not covered by groups G06F3/00 - G06F13/00 and G06F21/00
    • G06F1/24Resetting means
    • 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/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • G06F13/4291Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus using a clocked protocol
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F5/00Methods or arrangements for data conversion without changing the order or content of the data handled
    • G06F5/06Methods or arrangements for data conversion without changing the order or content of the data handled for changing the speed of data flow, i.e. speed regularising or timing, e.g. delay lines, FIFO buffers; over- or underrun control therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]

Abstract

The embodiment of the invention provides a method and a device for enabling a communication controller, electronic equipment and a storage medium, and relates to the technical field of electronics. The method comprises the following steps: and in response to an enabling trigger instruction of the communication controller, writing an enabling value into the enabling bit to start the communication controller, starting timing, continuously detecting the enabling bit to acquire a state value of the enabling bit, and ending the enabling operation of the communication controller if the state value is inconsistent with the enabling value when the timing time reaches a preset ending time. In the process of enabling the OTG controller, if the electronic equipment determines that the enabling operation of the OTG controller fails when the preset ending time is reached, the enabling operation can be directly ended so as to continue to carry out other steps after the enabling operation, the problem that the initialization of the OTG controller cannot be completed due to the enabling failure can be solved, and therefore the electronic equipment can be started normally.

Description

Enabling method and device of communication controller, electronic equipment and storage medium
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a method and apparatus for enabling a communication controller, an electronic device, and a storage medium.
Background
The universal serial bus (Universal Serial Bus, USB) protocol is a serial interface standard applied to the field of computers, and has the characteristics of high transmission speed, hot plug support and the like. The USB OTG (On-The-Go) protocol is a complementary protocol to The USB protocol, which is implemented by a communication controller, i.e., OTG controller. When the OTG controller is integrated in the electronic equipment, in the USB communication process, the OTG controller can control the electronic equipment to be used as a master device and can also control the electronic equipment to be used as a slave device, and the electronic equipment can conveniently communicate with other electronic equipment of different types.
In the prior art, an electronic device integrated with an OTG controller needs to initialize the OTG controller during a start-up process, and when initializing the OTG controller, an enabling operation needs to be performed on the OTG controller to start up the OTG controller. When the OTG controller is enabled, if the enabling fails, the enabling operation is continuously executed, and the enabling operation cannot be ended, so that the initialization of the OTG controller cannot be completed, and the electronic equipment cannot be started normally.
Disclosure of Invention
In view of the foregoing, embodiments of the present invention have been made to provide an enabling method of a communication controller that overcomes or at least partially solves the foregoing problems, so as to solve the problem that initialization of an OTG controller cannot be completed due to an enabling failure.
Correspondingly, the embodiment of the invention also provides an enabling device of the communication controller, electronic equipment and a storage medium, which are used for ensuring the realization and application of the method.
In order to solve the above problems, an embodiment of the present invention discloses an enabling method of a communication controller, including:
writing an enable value into an enable bit of a communication controller to start the communication controller and starting timing in response to an enable trigger instruction of the communication controller;
continuously detecting the enable bit written into the enable value to acquire a state value of the enable bit;
when the timing time reaches the preset ending time, if the state value is inconsistent with the enabling value, determining that the enabling operation of the communication controller fails;
ending the detection of the enable bit to end the enabling operation of the communication controller.
The embodiment of the invention also discloses an enabling device of the communication controller, which comprises:
the writing module is used for responding to an enabling trigger instruction of the communication controller, writing an enabling value into an enabling bit of the communication controller to start the communication controller, and starting timing;
the detection module is used for continuously detecting the enable bit written with the enable value so as to acquire the state value of the enable bit;
the determining module is used for determining that the enabling operation of the communication controller fails if the state value is inconsistent with the enabling value when the timing time reaches the preset ending time;
and the ending module is used for ending the detection of the enabling bit so as to end the enabling operation of the communication controller.
The embodiment of the invention also discloses an electronic device which comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors, and the one or more programs comprise instructions for:
writing an enable value into an enable bit of a communication controller to start the communication controller and starting timing in response to an enable trigger instruction of the communication controller;
continuously detecting the enable bit written into the enable value to acquire a state value of the enable bit;
when the timing time reaches the preset ending time, if the state value is inconsistent with the enabling value, determining that the enabling operation of the communication controller fails;
ending the detection of the enable bit to end the enabling operation of the communication controller.
The embodiment of the invention also discloses a readable storage medium, and when the instructions in the storage medium are executed by a processor of the electronic device, the electronic device can execute the enabling method of one or more communication controllers in the embodiment of the invention.
The embodiment of the invention has the following advantages:
in the embodiment of the invention, the electronic equipment responds to the enabling trigger instruction of the communication controller, writes the enabling value into the enabling bit of the communication controller to start the communication controller, starts timing, continuously detects the enabling bit of the writing enabling value to acquire the state value of the enabling bit, determines that the enabling operation of the communication controller fails if the state value is inconsistent with the enabling value when the timing time reaches the preset ending time, and ends the detection of the enabling bit to end the enabling operation of the communication controller. In the process of enabling the OTG controller, if the electronic equipment determines that the enabling operation of the OTG controller fails when the preset ending time is reached, the enabling operation can be directly ended so as to continue to carry out other steps after the enabling operation, the problem that the initialization of the OTG controller cannot be completed due to the enabling failure can be solved, and therefore the electronic equipment can be started normally.
Drawings
FIG. 1 is a flow chart illustrating steps of a prior art method of enabling a communication controller;
FIG. 2 is a flow chart showing the steps of a method of enabling a communication controller of the present invention;
FIG. 3 is a flow chart illustrating steps of another method of enabling a communication controller of the present invention;
FIG. 4 shows a block diagram of an embodiment of an enabling device of a communication controller of the present invention;
fig. 5 is a block diagram of an electronic device, according to an example embodiment.
Detailed Description
In order that the above-recited objects, features and advantages of the present invention will become more readily apparent, a more particular description of the invention will be rendered by reference to the appended drawings and appended detailed description.
Before describing embodiments of the present invention in detail, a description is first given of a current method for enabling a communication controller.
Referring to fig. 1, a flowchart illustrating steps of a method for enabling a communication controller in the prior art is shown, where the electronic device may be an electronic device integrated with an embedded real-time operating system, such as a vxWorks operating system, and the electronic device may be integrated with an OTG controller for USB communication. In the starting process of the electronic device, the electronic device needs to perform an initializing operation on the OTG controller, after triggering the initializing operation on the OTG controller, the electronic device may reset a port physical layer (Port Physical Layer, PHY) clock of the OTG controller first, and then may set a depth of a receiving first-in first-out queue (First Input First Output, FIFO) and a depth of a transmitting FIFO of the OTG controller, write a depth value of the FIFO into a receiving capacity register, write a depth value of the FIFO into a transmitting capacity register, and clear a buffer of the receiving FIFO and a buffer of the transmitting FIFO. After the receive FIFO buffer and the transmit FIFO buffer are cleared, an enable operation to the OTG controller may be triggered, writing an enable value to an enable bit in a characteristic register of the OTG controller to enable OTG control. After writing the enable value into the enable bit, continuously reading the characteristic register to acquire the state value of the enable bit, and when the state value is consistent with the enable value, determining that the enabling operation of the OTG controller is successful, and starting the OTG controller, wherein the detection can be ended to end the enabling operation of the OTG controller. In contrast, when the state value is detected to be inconsistent with the enabling value, the characteristic register is continuously read until the state value is consistent with the enabling value, the detection is ended, and the enabling operation is ended.
As shown in fig. 1, when the state value of the enable bit is always inconsistent with the enable value, the enabling operation of the OTG controller fails, the electronic device may cycle through the characteristic register, acquire the state value of the enable bit, and compare the acquired state value with the enable value. At this time, the electronic device cannot end the enabling operation, and other steps after the enabling operation cannot be continued, so that the electronic device cannot be started normally.
One of the core concepts of the embodiments of the present invention is that an end time is set for an enabling operation, after an enabling value is written into an enabling bit, a timer is started, when the timer time reaches a preset end time, if the enabling operation fails, the enabling operation is directly ended, so that other steps after the enabling operation can be continued, and the electronic device can be started normally.
It should be noted that, the enabling operation is one step in the initializing process of the OTG controller, and before the enabling operation, the initializing steps such as resetting the PHY clock, setting the depth of the receive FIFO, setting the depth of the transmit FIFO, clearing the buffer of the receive FIFO, clearing the buffer of the transmit FIFO, and the like may be set, and at the same time, after the enabling operation is finished, other initializing steps may also be performed on the OTG controller continuously. After the initialization of the OTG controller is completed, the initialization of other devices such as a display, a network card, a keyboard and the like in the electronic device may be continued to start the whole electronic device. The initialization process of the OTG controller and the initialization process of the electronic device may be specifically set according to the requirements, which is not limited in this embodiment.
Referring to fig. 2, a flowchart illustrating steps of a method for enabling a communication controller according to the present invention may specifically include the following steps:
step 201, in response to an enabling trigger instruction of the communication controller, an enabling value is written into an enabling bit of the communication controller to start the communication controller, and timing is started.
The enabling trigger instruction is used for starting enabling operation on the OTG controller, and the enabling trigger instruction can be an enabling trigger instruction generated after the buffer memory of the receiving FIFO and the buffer memory of the sending FIFO are cleared in the initialization process of the OTG controller; alternatively, the enable trigger instruction may be generated after writing the depth value of the FIFO into the transmission capacity register. The enabling trigger instruction generating process may be specifically set according to the initializing process of the OTG controller, which is not limited in this embodiment.
Illustratively, the OTG controller's enable bit defaults to 0 and when the enable bit is set to 1, the OTG controller is enabled. The electronic device may write an enable value to the enable bit, i.e., the enable position is 1, in response to the enable trigger instruction. While the enabled position is 1, the electronic device may create and initiate a watchdog (watch) program that controls the watchdog program to start timing from zero. In practical applications, the electronic device may also perform timing in other manners, and the timing manner is not particularly limited in this embodiment.
Step 202, detecting the enable bit of the write enable value continuously to obtain the state value of the enable bit.
In this embodiment, after writing the enable value to the enable bit and starting the timer, the electronic device may continuously read the characteristic register to detect the state value of the enable bit, where the state value is the value of the enable bit in the current state. For example, after writing the enable value, the electronic device may read the characteristic register once every 1 millisecond, acquiring the state value of the enable bit once. After the state value is obtained, the state value of the enable bit may be compared with the enable value to determine whether the enable value and the state value agree. In combination with the above example, if the state value of the enable bit is 1, it may be determined that the state value of the enable bit is consistent with the enable value, and at this time, it may be determined that the enable bit is set, and the OTG controller is normally started; conversely, if the state value of the enable bit is 0, it may be determined that the state value of the enable bit is inconsistent with the enable value, at which point it may be determined that the enable bit is not set and the OTG controller is not enabled. The process of continuously detecting the enable bit by the electronic device may be set according to requirements, which is not limited in this embodiment.
Optionally, before the timing time reaches the preset end time, if the state value is consistent with the enabling value, determining that the enabling operation on the communication controller is successful;
the detection of the enable bit is ended to end the enabling operation of the communication controller.
In this embodiment, before the timing time reaches the preset end time, if it is determined that the state value of the enable bit is consistent with the enable value, the electronic device may determine that the enabling operation of the OTG controller is successful, and the OTG controller is normally started, and may end the detection of the enable bit at this time to end the enabling operation of the OTG controller. In contrast, before the timing time reaches the preset end time, if the state value of the enabling bit is inconsistent with the enabling value, the electronic device can determine that the enabling operation of the OTG controller fails, the OTG controller is not normally started, at this time, the characteristic register can be continuously read, the state value of the enabling bit is obtained, and the state value and the enabling value are continuously compared.
Step 203, when the timing time reaches the preset end time, if the state value is inconsistent with the enable value, determining that the enable operation of the communication controller fails.
Step 204, ending the detection of the enable bit to end the enabling operation of the communication controller.
For example, the preset end time may be 1 second, and in combination with step 101, if the timing time of the watchdog program reaches 1 second, it is detected that the state value of the enable bit is still 0 and is inconsistent with the enable value, it may be determined that the enabling operation of the OTG controller fails, and the OTG controller is not started normally. At this time, the electronic device may stop reading the characteristic register, ending the detection of the enable bit, to end the enabling operation of the OTG controller. After finishing the enabling operation of the OTG controller, the electronic device may continue to perform other steps after the enabling operation, and set other characteristics of the OTG controller to complete the initialization of the OTG controller. And after the initialization of the OTG controller is completed, the devices such as the display, the network card and the keyboard can be continuously initialized so as to start the whole electronic equipment.
In the embodiment of the invention, the electronic equipment responds to the enabling trigger instruction of the communication controller, writes the enabling value into the enabling bit of the communication controller to start the communication controller, starts timing, continuously detects the enabling bit of the writing enabling value to acquire the state value of the enabling bit, determines that the enabling operation of the communication controller fails if the state value is inconsistent with the enabling value when the timing time reaches the preset ending time, and ends the detection of the enabling bit to end the enabling operation of the communication controller. In the process of enabling the OTG controller, if the electronic equipment determines that the enabling operation of the OTG controller fails when the preset ending time is reached, the enabling operation can be directly ended so as to continue to carry out other steps after the enabling operation, the problem that the initialization of the OTG controller cannot be completed due to the enabling failure can be solved, and therefore the electronic equipment can be started normally.
Meanwhile, before the electronic device is preset to end the time, if the enabling operation of the OTG controller is determined to be successful, the enabling operation can be directly ended, other steps after the enabling operation are continued, and the electronic device is started normally.
Referring to fig. 3, a flowchart illustrating steps of another method for enabling a communication controller according to the present invention may specifically include the following steps:
step 301, in response to an enabling trigger instruction of the communication controller, writing an enabling value into an enabling bit of the communication controller to start the communication controller, and starting timing.
Step 302, detecting the enable bit when the timing time reaches the preset detection time, and obtaining the state value.
The preset detection time is smaller than the preset ending time.
In one embodiment, the electronic device may detect the enable bit at a preset detection time to reduce the number of times the enable bit is detected. In combination with the above examples, the preset detection time may be 0.2 seconds, 0.4 seconds, 0.6 seconds, and 0.8 seconds. The electronic device may read the primary characteristic register when the timing time reaches 0.2 seconds, detect the state value of the primary enable bit, and read the primary characteristic register when 0.6 seconds and 0.8 seconds, respectively, to detect the state value of the enable bit during the timing process of starting the watchdog program. The preset detection time may be specifically set according to requirements, which is not limited in this embodiment.
In practical application, after writing the enable value into the enable bit, the OTG controller needs a certain time to enable the enable bit 1, and the electronic device detects the enable bit in a preset detection time, so that frequent detection of the enable bit can be avoided, and power consumption of the electronic device can be reduced.
Step 303, if the status value is inconsistent with the enable value before the timing time reaches the preset end time, the enable value is rewritten into the enable bit to restart the communication controller.
In one embodiment, before the preset end time, if the electronic device detects that the state value of the enable bit is inconsistent with the enable value, the enable value may be rewritten into the enable bit to restart the OTG controller once again. In combination with step 302, if the state value obtained by the electronic device in 0.2 seconds is inconsistent with the enable value, the enable value may be rewritten to the enable bit to restart the OTG controller.
In practical application, before the preset end time, if the state value of the enabling bit is detected to be inconsistent with the enabling value, the enabling value can be written into the enabling bit again, so that the problem that the enabling value cannot be written due to writing errors is avoided.
Alternatively, step 303 may be implemented as follows:
when the timing time reaches the preset writing time, if the state value is inconsistent with the enabling value, the enabling value is rewritten into the enabling bit so as to restart the communication controller.
Wherein the preset writing time is smaller than the preset ending time.
In one embodiment, one or more preset write times may be set before the preset end time, and when the counted time reaches the preset write time, if it is detected that the state value is inconsistent with the enable value, the enable value may be rewritten to the enable bit. For example, the preset writing time may be 0.3 seconds, 0.5 seconds, 0.7 seconds, and 0.9 seconds, and when the electronic device reaches the timing time of 0.3 seconds, 0.5 seconds, 0.7 seconds, and 0.9 seconds, if the state value of the enable bit is detected to be inconsistent with the enable value, the enable value may be written to the enable bit again, so as to restart the OTG controller.
In practical application, in the rewriting process of the enabling value, the enabling value can be rewritten at a preset writing time point, and the enabling value can be prevented from being rewritten for many times, so that the power consumption of the electronic device is reduced. The number of writing of the enable value may be set according to the requirement, which is not limited in this embodiment.
And 304, when the timing time reaches the preset end time, if the state value is inconsistent with the enabling value, determining that the enabling operation of the communication controller fails.
Step 305, ending the detection of the enable bit to end the enabling operation of the communication controller.
In the embodiment of the invention, the electronic equipment responds to the enabling trigger instruction of the communication controller, writes the enabling value into the enabling bit of the communication controller to start the communication controller, starts timing, continuously detects the enabling bit of the writing enabling value to acquire the state value of the enabling bit, determines that the enabling operation of the communication controller fails if the state value is inconsistent with the enabling value when the timing time reaches the preset ending time, and ends the detection of the enabling bit to end the enabling operation of the communication controller. In the process of enabling the OTG controller, if the electronic equipment determines that the enabling operation of the OTG controller fails when the preset ending time is reached, the enabling operation can be directly ended so as to continue to carry out other steps after the enabling operation, the problem that the initialization of the OTG controller cannot be completed due to the enabling failure can be solved, and therefore the electronic equipment can be started normally.
Optionally, the method may further comprise, after step 305:
if the communication controller is detected to be connected to the universal serial bus device, rewriting an enabling value into the enabling bit to restart the communication controller;
upon detecting that the status value coincides with the enable value, it is determined that the enabling operation of the communication controller is completed.
In this embodiment, after finishing the enabling operation of the OTG controller, if it is detected that the OTG controller is connected to the USB device, the enable value may be written into the enable bit of the OTG controller again, so as to restart the OTG controller. For example, after the electronic device is started, the state of the OTG controller may be monitored, if it is monitored that the OTG controller is connected to the USB device, the electronic device may write the enable value into the enable bit of the OTG controller again, so as to start the OTG controller again, and when it is detected that the state value is consistent with the enable value, it is determined that the enabling operation of the OTG controller is completed. The detection method of the USB device may set this embodiment according to the requirement, which is not limited.
In practical application, after determining that the enabling operation of the OTG controller fails, if the USB device is detected to be connected, the electronic device may write the enabling value into the enabling bit of the OTG controller again, restart the OTG controller, and restart the OTG device under the condition that the OTG controller is connected to the USB device.
Optionally, the method may further include:
and when the state value is inconsistent with the enabling value, outputting prompt information to prompt that the enabling operation of the communication controller fails.
In this embodiment, when determining that the enabling operation of the communication controller fails, the electronic device may output a prompt message to remind the user. For example, the prompt information may be text information, and when the electronic device determines that the state value is inconsistent with the enable value, the electronic device may display a character string "OTG controller start failure" through the display screen, so as to remind the user of the OTG controller start failure. The specific type of the prompt information can be set according to the requirement, and the embodiment is not limited to this.
In practical application, when the OTG controller fails to be enabled, the electronic device outputs corresponding prompt information, so that a user can know the state of the OTG controller conveniently, and the user can conveniently adjust the using method of the electronic device.
It should be noted that, for simplicity of description, the method embodiments are shown as a series of acts, but it should be understood by those skilled in the art that the embodiments are not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred embodiments, and that the acts are not necessarily required by the embodiments of the invention.
Referring to fig. 4, which shows a block diagram of an embodiment of an enabling device of a communication controller according to the present invention, a device 400 may specifically comprise the following modules:
the writing module 401 is configured to write an enable value to an enable bit of the communication controller to start the communication controller and start timing in response to an enable trigger instruction of the communication controller.
The detection module 402 is configured to continuously detect the enable bit of the write enable value, so as to obtain a state value of the enable bit.
A determining module 403, configured to determine that the enabling operation of the communication controller fails when the timing time reaches the preset end time and if the status value is inconsistent with the enabling value.
An end module 404 for ending the detection of the enable bit to end the enabling operation of the communication controller.
Optionally, the determining module 403 is further configured to determine that the enabling operation on the communication controller is successful if the status value is consistent with the enabling value before the counted time reaches the preset end time;
the end module 404 is further configured to end detection of the enable bit to end the enabling operation of the communication controller.
Optionally, the detecting module 402 is specifically configured to detect the enable bit when the timing time reaches a preset detection time, so as to obtain a state value; the preset detection time is less than the preset end time.
Optionally, the writing module 401 is further configured to, if it is detected that the communication controller is connected to the universal serial bus device, re-write the enable value to the enable bit to restart the communication controller;
the determining module 403 is further configured to determine that the enabling operation of the communication controller is completed when the status value is detected to be consistent with the enable value.
Optionally, the writing module 401 is further configured to re-write the enable value to the enable bit to restart the communication controller if the status value is inconsistent with the enable value before the counted time reaches the preset end time.
Optionally, the writing module 401 is specifically configured to, when the counted time reaches the preset writing time, re-write the enable value into the enable bit to restart the communication controller if the status value is inconsistent with the enable value; the preset writing time is smaller than the preset ending time.
Optionally, the apparatus 400 may further include: and the output module is used for outputting prompt information to prompt failure of enabling operation of the communication controller when the state value is inconsistent with the enabling value.
In the embodiment of the invention, the electronic equipment responds to the enabling trigger instruction of the communication controller, writes the enabling value into the enabling bit of the communication controller to start the communication controller, starts timing, continuously detects the enabling bit of the writing enabling value to acquire the state value of the enabling bit, determines that the enabling operation of the communication controller fails if the state value is inconsistent with the enabling value when the timing time reaches the preset ending time, and ends the detection of the enabling bit to end the enabling operation of the communication controller. In the process of enabling the OTG controller, if the electronic equipment determines that the enabling operation of the OTG controller fails when the preset ending time is reached, the enabling operation can be directly ended so as to continue to carry out other steps after the enabling operation, the problem that the initialization of the OTG controller cannot be completed due to the enabling failure can be solved, and therefore the electronic equipment can be started normally.
For the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments for relevant points.
Fig. 5 is a block diagram of an electronic device, according to an example embodiment. For example, electronic device 500 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, exercise device, personal digital assistant, or the like.
Referring to fig. 5, an electronic device 500 may include one or more of the following components: a processing component 502, a memory 504, a power supply component 506, a multimedia component 508, an audio component 510, an input/output (I/O) interface 512, a sensor component 514, and a communication component 516.
The processing component 502 generally controls overall operation of the electronic device 500, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to perform all or part of the steps of the methods described above. Further, the processing component 502 can include one or more modules that facilitate interactions between the processing component 502 and other components. For example, the processing component 502 can include a multimedia module to facilitate interaction between the multimedia component 508 and the processing component 502.
Memory 504 is configured to store various types of data to support operations at device 500. Examples of such data include instructions for any application or method operating on the electronic device 500, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 504 may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk.
The power supply component 506 provides power to the various components of the electronic device 500. The power components 506 may include a power management system, one or more power sources, and other components associated with generating, managing, and distributing power for the electronic device 500.
The multimedia component 508 includes a screen between the electronic device 500 and the user that provides an output interface. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may sense not only the boundary of a touch or slide action, but also the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front-facing camera and/or a rear-facing camera. When the electronic device 500 is in an operational mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
The audio component 510 is configured to output and/or input audio signals. For example, the audio component 510 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 500 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may be further stored in the memory 504 or transmitted via the communication component 516. In some embodiments, the audio component 510 further comprises a speaker for outputting audio signals.
The I/O interface 512 provides an interface between the processing component 502 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: homepage button, volume button, start button, and lock button.
The sensor assembly 514 includes one or more sensors for providing status assessment of various aspects of the electronic device 500. For example, the sensor assembly 514 may detect the on/off state of the device 500, the relative positioning of components, such as a display and keypad of the electronic device 500, the sensor assembly 514 may also detect a change in position of the electronic device 500 or a component of the electronic device 500, the presence or absence of a user's contact with the electronic device 500, the orientation or acceleration/deceleration of the electronic device 500, and a change in temperature of the electronic device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscopic sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 516 is configured to facilitate communication between the electronic device 500 and other devices, either wired or wireless. The electronic device 500 may access a wireless network based on a communication standard, such as WiFi,2G, or 3G, or a combination thereof. In one exemplary embodiment, the communication component 516 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 further includes a Near Field Communication (NFC) module to facilitate short range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, ultra Wideband (UWB) technology, bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), digital Signal Processors (DSPs), digital Signal Processing Devices (DSPDs), programmable Logic Devices (PLDs), field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic elements for executing the methods described above.
In an exemplary embodiment, a non-transitory computer readable storage medium is also provided, such as memory 504, including instructions executable by processor 520 of electronic device 500 to perform the above-described method. For example, the non-transitory computer readable storage medium may be ROM, random Access Memory (RAM), CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
A non-transitory computer readable storage medium, which when executed by a processor of an electronic device, causes the electronic device to perform a method of enabling a communication controller, the method comprising:
in response to an enabling trigger instruction of the communication controller, writing an enabling value into an enabling bit of the communication controller to start the communication controller, and starting timing;
continuously detecting the enable bit written with the enable value to acquire the state value of the enable bit;
when the timing time reaches the preset ending time, if the state value is inconsistent with the enabling value, determining that the enabling operation of the communication controller fails;
the detection of the enable bit is ended to end the enabling operation of the communication controller.
Optionally, the method may further include: before the timing time reaches the preset ending time, if the state value is consistent with the enabling value, the enabling operation of the communication controller is determined to be successful;
the detection of the enable bit is ended to end the enabling operation of the communication controller.
Optionally, detecting the enable bit of the write enable value to obtain the state value of the enable bit includes: detecting the enable bit when the timing time reaches the preset detection time to obtain a state value; the preset detection time is less than the preset end time.
Optionally, after ending the detection of the enable bit to end the enabling operation of the communication controller, the method may further comprise: if the communication controller is detected to be connected to the universal serial bus device, rewriting an enabling value into the enabling bit to restart the communication controller;
upon detecting that the status value coincides with the enable value, it is determined that the enabling operation of the communication controller is completed.
Optionally, the method may further include: and before the timing time reaches the preset ending time, if the state value is inconsistent with the enabling value, rewriting the enabling value into the enabling bit so as to restart the communication controller.
Optionally, before the timing time reaches the preset end time, if the state value is inconsistent with the enable value, rewriting the enable value to the enable bit to restart the communication controller may include: when the timing time reaches the preset writing time, if the state value is inconsistent with the enabling value, the enabling value is rewritten into the enabling bit so as to restart the communication controller; the preset writing time is smaller than the preset ending time.
Optionally, the method may further include: and when the state value is inconsistent with the enabling value, outputting prompt information to prompt that the enabling operation of the communication controller fails.
In the embodiment of the invention, the electronic equipment responds to the enabling trigger instruction of the communication controller, writes the enabling value into the enabling bit of the communication controller to start the communication controller, starts timing, continuously detects the enabling bit of the writing enabling value to acquire the state value of the enabling bit, determines that the enabling operation of the communication controller fails if the state value is inconsistent with the enabling value when the timing time reaches the preset ending time, and ends the detection of the enabling bit to end the enabling operation of the communication controller. In the process of enabling the OTG controller, if the electronic equipment determines that the enabling operation of the OTG controller fails when the preset ending time is reached, the enabling operation can be directly ended so as to continue to carry out other steps after the enabling operation, the problem that the initialization of the OTG controller cannot be completed due to the enabling failure can be solved, and therefore the electronic equipment can be started normally.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described by differences from other embodiments, and identical and similar parts between the embodiments are all enough to be referred to each other.
It will be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the invention may take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. It is therefore intended that the following claims be interpreted as including the preferred embodiment and all such alterations and modifications as fall within the scope of the embodiments of the invention.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or terminal device comprising the element.
The foregoing has described in detail the enabling method and apparatus of a communication controller, an electronic device and a storage medium provided by the present invention, and specific examples have been applied to illustrate the principles and embodiments of the present invention, and the above examples are only used to help understand the method and core idea of the present invention; meanwhile, as those skilled in the art will have variations in the specific embodiments and application scope in accordance with the ideas of the present invention, the present description should not be construed as limiting the present invention in view of the above.

Claims (10)

1. A method for enabling a communication controller, comprising:
writing an enable value into an enable bit of a communication controller to start the communication controller and starting timing in response to an enable trigger instruction of the communication controller;
continuously detecting the enable bit written into the enable value to acquire a state value of the enable bit;
when the timing time reaches the preset ending time, if the state value is inconsistent with the enabling value, determining that the enabling operation of the communication controller fails;
ending the detection of the enable bit to end the enabling operation of the communication controller.
2. The method of claim 1, wherein the continuously detecting the enable bit written to the enable value to obtain the state value of the enable bit comprises:
detecting the enabling bit when the timing time reaches a preset detection time to obtain the state value; the preset detection time is smaller than the preset ending time.
3. The method according to claim 1 or 2, further comprising, after said ending the detection of the enable bit to end the enabling operation of the communication controller:
if the communication controller is detected to be connected to the universal serial bus device, rewriting the enabling value into the enabling bit so as to restart the communication controller;
and when the state value is detected to be consistent with the enabling value, determining that the enabling operation of the communication controller is completed.
4. The method as recited in claim 1, further comprising:
and before the timing time reaches the preset ending time, if the state value is inconsistent with the enabling value, rewriting the enabling value into the enabling bit so as to restart the communication controller.
5. The method of claim 4, wherein, before the timing time reaches the preset end time, if the status value is inconsistent with the enable value, re-writing the enable value to the enable bit to restart the communication controller, comprising:
when the timing time reaches a preset writing time, if the state value is inconsistent with the enabling value, rewriting the enabling value into the enabling bit to restart the communication controller; the preset writing time is smaller than the preset ending time.
6. The method as recited in claim 1, further comprising:
before the timing time reaches the preset ending time, if the state value is consistent with the enabling value, determining that the enabling operation of the communication controller is successful;
ending the detection of the enable bit to end the enabling operation of the communication controller.
7. The method according to any one of claims 1, further comprising:
and when the state value is inconsistent with the enabling value, outputting prompt information to prompt that the enabling operation of the communication controller fails.
8. An enabling device of a communication controller, comprising:
the writing module is used for responding to an enabling trigger instruction of the communication controller, writing an enabling value into an enabling bit of the communication controller to start the communication controller, and starting timing;
the detection module is used for continuously detecting the enable bit written with the enable value so as to acquire the state value of the enable bit;
the determining module is used for determining that the enabling operation of the communication controller fails if the state value is inconsistent with the enabling value when the timing time reaches the preset ending time;
and the ending module is used for ending the detection of the enabling bit so as to end the enabling operation of the communication controller.
9. An electronic device comprising a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, the one or more programs comprising instructions for:
writing an enable value into an enable bit of a communication controller to start the communication controller and starting timing in response to an enable trigger instruction of the communication controller;
continuously detecting the enable bit written into the enable value to acquire a state value of the enable bit;
when the timing time reaches the preset ending time, if the state value is inconsistent with the enabling value, determining that the enabling operation of the communication controller fails;
ending the detection of the enable bit to end the enabling operation of the communication controller.
10. A readable storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the method of enabling a communication controller according to one or more of the method claims 1-7.
CN202110244871.8A 2021-03-05 2021-03-05 Enabling method and device of communication controller, electronic equipment and storage medium Active CN115017073B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110244871.8A CN115017073B (en) 2021-03-05 2021-03-05 Enabling method and device of communication controller, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110244871.8A CN115017073B (en) 2021-03-05 2021-03-05 Enabling method and device of communication controller, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115017073A CN115017073A (en) 2022-09-06
CN115017073B true CN115017073B (en) 2023-08-29

Family

ID=83064471

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110244871.8A Active CN115017073B (en) 2021-03-05 2021-03-05 Enabling method and device of communication controller, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115017073B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115983306B (en) * 2022-12-09 2023-09-15 江苏稻源科技集团有限公司 RFID card writing method with error correction capability

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006060527A2 (en) * 2004-11-30 2006-06-08 Advanced Micro Devices, Inc. Usb on-the-go controller
CN104978300A (en) * 2015-07-16 2015-10-14 广东欧珀移动通信有限公司 Mobile terminal as well as detecting method and device for connection of mobile terminal and external equipment
WO2017088627A1 (en) * 2015-11-23 2017-06-01 深圳市中兴微电子技术有限公司 Network detection method and apparatus, digital set-top box, and storage medium
CN108052424A (en) * 2017-11-30 2018-05-18 深圳市万普拉斯科技有限公司 OTG interfaces method for detecting abnormality, device, computer equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105808480A (en) * 2016-03-01 2016-07-27 联发科技(新加坡)私人有限公司 Role switching method and system of USB (Universal Serial Bus) OTG (On-The-Go) equipment, and USB OTG equipment
CN107293057B (en) * 2017-05-05 2018-07-06 北京摩拜科技有限公司 Article uses control method, equipment, system, article and server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006060527A2 (en) * 2004-11-30 2006-06-08 Advanced Micro Devices, Inc. Usb on-the-go controller
CN104978300A (en) * 2015-07-16 2015-10-14 广东欧珀移动通信有限公司 Mobile terminal as well as detecting method and device for connection of mobile terminal and external equipment
WO2017088627A1 (en) * 2015-11-23 2017-06-01 深圳市中兴微电子技术有限公司 Network detection method and apparatus, digital set-top box, and storage medium
CN108052424A (en) * 2017-11-30 2018-05-18 深圳市万普拉斯科技有限公司 OTG interfaces method for detecting abnormality, device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN115017073A (en) 2022-09-06

Similar Documents

Publication Publication Date Title
US9886264B2 (en) Method and device for upgrading firmware
EP3200116B1 (en) Method and apparatus for acquiring information via a virtual identity module from lost or stolen terminal
CN109284149B (en) Method and device for starting application program
US10572424B2 (en) Method and apparatus for switching state
US10234924B2 (en) Method and apparatus for displaying time on mobile device
CN105224349A (en) The deletion reminding method of application program and device
CN111966410B (en) Start-up processing method and device, electronic equipment and storage medium
CN104065883B (en) Image pickup method and device
CN115017073B (en) Enabling method and device of communication controller, electronic equipment and storage medium
CN105786561B (en) Method and device for calling process
EP3460717B1 (en) Method, apparatus, terminal, and computer-readable storage medium for processing fingerprints
EP3188018B1 (en) Method and apparatus for setting waiting time duration
CN107704489B (en) Processing method and device for read-write timeout and computer readable storage medium
US10671827B2 (en) Method and device for fingerprint verification
CN111383364A (en) Method, device and equipment for testing automobile data recorder and storage medium
CN109976563B (en) Misoperation determining method and device and touch operation response method and device
CN108334357B (en) Intelligent terminal and flashing method thereof
CN109451863B (en) Method and device for expanding PBCH
CN106484261B (en) Information acquisition method and device, information transmission method and device, and terminal
CN114115768A (en) Control method and device
CN108958501B (en) Character input method, character output method, character input device, character output device, readable storage medium and electronic equipment
CN110990314A (en) Electronic equipment identification method and device, terminal equipment and electronic equipment
CN113836069B (en) Chip, pin operation method, readable storage medium and electronic device
US11308197B2 (en) Intelligent device recognition using prompt frequency information
CN116737081A (en) Storage medium configuration method and device, electronic equipment and storage medium

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