A kind of method of system wake-up
Technical field
The present invention relates to the control technology of the operating state of device interior system in the communications field, be specifically related to the method for system wake-up in a kind of equipment.
Background technology
Universal asynchronous reception/dispensing device (UART, Universal Asynchronous Receiver andTransmitter) serial ports is a kind of Asynchronous Serial Interface of using always.Two systems for adopting the UART serial communication can be divided into data communications equipment (DCE, Datacommunication Equipment) and data terminal equipment (DTE, Data Terminal Equipment) according to its position in network.UART serial interface signal has 8, be respectively: data send signal (TXD, Transmit Data), data reception signal (RXD, Receive Data), send request signal (RTS, Request To Send), allow to send signal (CTS, Clear To Send), DCE is ready to signal (DSR, Data Set Ready), and DTE is ready to signal (DTR, Data Terminal Ready), DCE exports to the bell signal (RI, Ring Indicator) of DTE and the data rectified signal (DCD, DataCarrier Detect) that DCE exports to DTE.Wherein, RTS, CTS, DSR, DTR, RI and DCD are the hardware flow control signals, can be used for realizing flow control.
A plurality of processors are arranged in the existing communication equipment usually, each processor with and the processor unit formed of peripheral circuit can regard a relatively independent system as, for example in mobile terminal device, baseband system that comprises baseband processor and the application system that comprises application processor are arranged.In order to reduce power consumption, system closes master clock usually and goes forward side by side into the sleep state when idle condition, and when external event takes place, system will be waken up and get back to normal condition.Because a plurality of systems normally enter sleep state separately, safe and effective for communication between the assurance system need be taked a kind of reliable sleep awakening mechanism, wakes the dormant system that is in up.In sleep state, because system closes master clock usually, so system wake-up can only adopt modes such as universal input and output port (GPIO, GeneralPurpose Input/Output) interruption, keyboard interrupt usually by asynchronous combinational logic realization.
The method of system wake-up is to realize that by increasing new sleep awakening signal Fig. 1 is the schematic diagram of system wake-up in the prior art in the prior art.Comprising two communication systems among Fig. 1, is respectively DCE and DTE.Communication between DCE and the DTE is except adopting UART serial interface signal, two groups of self-defining sleep awakening signals have also been increased, be SLEEP1, WAKEUP1, SLEEP2 and WAKEUP2, wherein SLEEP1 and SLEEP2 are the sleep index signals, and WAKEUP1 and WAKEUP2 are wake-up signals.The process that DTE wakes DCE up is: when DCE enters sleep state, SLEEP1 is arranged to a certain state, DTE inquiry SLEEP1 can be known the state of DCE; When DTE wants when being in dormant DCE and communicating by letter, the signal that sends a definite form on WAKEUP1 is realized asynchronous combinational logic, and DCE can get back to normal condition from sleep state after receiving this signal, promptly is waken up.Similarly, the DCE process of waking DTE up realizes by SLEEP2 and WAKEUP2.By said method, prior art can realize two-way the waking up between DCE and the DTE.
The prior art system awakening method is realized two-way waking up by having increased self-defining sleep index signal and wake-up signal.Because increased the outer hardware signal of serial communication, this method has obviously taken more hardware resource.Simultaneously, in order to realize arousal function, need be on software at these self-defined Design of Signal control flows and write code, this has further increased the complexity of software.
Summary of the invention
In view of this, the invention provides a kind of method of system wake-up, this method need not to increase the hardware signal port, can realize the sleep of system and wakes up.
Based on above-mentioned purpose, the invention provides a kind of method of system wake-up, be applied between two systems of communication equipment, realize communication by at least 3 signal ports between two systems, system wake-up method of the present invention may further comprise the steps:
Steps A, enter sleep state if desired, first system, first signal port is set to the down trigger source, after signal on the secondary signal port is set to disarmed state, enter sleep state, wherein, described first signal port and secondary signal port all belong to the hardware flow control signal port in asynchronous reception/dispensing device UART serial ports;
Step B, second system if detect disarmed state at the secondary signal port, then send interrupt signal at first signal port before first system sends data;
Step C, normal condition is got back to from sleep state after receiving above-mentioned interrupt signal by first system, and the signal on the secondary signal port is set to effective status, and cancels the down trigger source of first signal port;
Step D, second system promptly send data to first system after the secondary signal port detects effective status.
In the system wake-up method of the present invention, described first system is data communications equipment DCE, and second system is data terminal equipment DTE; Described first signal port is the transmission request signal RTS port of asynchronous reception/dispensing device UART serial ports, and the permission that described secondary signal port is the UART serial ports sends signal CTS port.
In the system wake-up method of the present invention, the down trigger source that is provided with described in the steps A is that the RTS port is arranged to universal input and output port GPIO, and this GPIO is set is the down trigger source; Interrupt signal described in the step B is a pulse trailing edge signal; The down trigger source of cancelling described in the step C is that recovery RTS is the hardware flow control signal.
In the system wake-up method of the present invention, described in the steps A disarmed state being set, is that the signal on the CTS is set to high level state; Described in the step C effective status being set, is that the signal on the CTS is set to low level state.
In the system wake-up method of the present invention, described first system is DTE, and second system is DCE; The bell signal RI port that described first signal port is the UART serial ports, the transmission request signal RTS port that described secondary signal port is the UART serial ports.
In the system wake-up method of the present invention, the down trigger source that is provided with described in the steps A is that the RI port is arranged to GPIO, and this GPIO is set is the down trigger source; Interrupt signal described in the step B is a pulse trailing edge signal; The down trigger source of cancelling described in the step C is that recovery RI is the hardware flow control signal.
In the system wake-up method of the present invention, described in the steps A disarmed state being set, is that the signal on the RTS is set to high level state; Described in the step C effective status being set, is that the signal on the RTS is set to low level state.
From the above as can be seen, the method for system wake-up provided by the invention need not to increase new hardware signal port and can realize the sleep of system and wake up, thereby saved the hardware resource of system.Simultaneously,, do not revise existing UART communications protocol, can not influence the characteristic of above-mentioned hardware flow control signal as flow control signal because the additional definitions of above-mentioned hardware flow control signal just is used for the sleep awakening of system.In addition, the additional definitions to the hardware flow control signal in the inventive method is very simple, thereby the invention process is got up simple and reliable.
Description of drawings
Fig. 1 is the schematic diagram of system wake-up in the prior art;
Fig. 2 wakes the schematic flow sheet of DCE embodiment up for DTE among the present invention;
Fig. 3 wakes the schematic flow sheet of DTE embodiment up for DCE among the present invention.
Embodiment
The UART serial ports is an Asynchronous Serial Interface the most frequently used in the embedded system, only needs between DCE and the DTE to adopt 2 holding wires can realize the simple communication of UART serial ports.Reliability and efficiency of information transfer in order to guarantee communication adopt the method for attachment of all 8 holding wires usually.The method of a kind of system wake-up of the present invention is not increasing under the new hardware signal situation, and the part hardware flow control signal port in the UART serial interface signal is configured, and realizes system wake-up by the UART serial ports.Below in conjunction with accompanying drawing the present invention is done detailed explanation.
In the present invention, at hardware flow control signal RTS port, CTS port and RI port carry out following configuration respectively:
RI is the wake-up signal that DCE wakes DTE up, among the present invention the RI port is arranged to GPIO, and to dispose this GPIO be the effective down trigger of trailing edge source, triggers interruption when sending the pulse trailing edge on the RI port;
CTS is that DCE is in dormant sleep index signal, when CTS shows that DCE is in sleep state during for high level, shows during low level that DCE is in normal condition;
RTS is that DTE is in dormant sleep index signal, when RTS shows that DTE is in sleep state during for high level, shows during low level that DTE is in normal condition; Simultaneously RTS also is the wake-up signal that DTE wakes DCE up, and the RTS port is arranged to GPIO, and to dispose this GPIO be the effective down trigger of trailing edge source, triggers interruption when sending the pulse trailing edge on the RTS port.
By configuration, can inquire about the other side's state between the communication system mutually and realize system wake-up above-mentioned hardware flow control signal port.It is pointed out that above additional definitions at these 3 signals, is that the bilateral system that is used between DCE and the DTE wakes up, does not change existing UART communications protocol, does not also influence the characteristic of above-mentioned 3 signals as the hardware flow control signal itself.
The method of system wake-up of the present invention comprises that DTE wakes DCE up and DCE wakes two kinds of situations of DTE up.Fig. 2 has used two signals of RTS and CTS for the schematic flow sheet that DTE among the present invention wakes DCE up among Fig. 2.Wherein, CTS is the sleep index signal of DCE, when CTS is a high level, promptly during disarmed state, shows that DCE is in sleep state; RTS is the wake-up signal that DTE wakes DCE up, before system enters sleep state, the RTS port is arranged to GPIO, and to dispose this GPIO be the effective down trigger of trailing edge source.When on the RTS port, sending the pulse trailing edge, can trigger interrupt event, thereby wake DCE up.Illustrate that below in conjunction with Fig. 2 DTE wakes the flow process of DCE up, this flow process may further comprise the steps:
Step 20, enter sleep state at every turn before, DCE RTS port is set to GPIO, and to dispose this GPIO be the effective down trigger of trailing edge source, after CTS was set to the disarmed state of high level simultaneously, DCE entered sleep state;
The above-mentioned operation that GPIO is set normally realizes by the register of configuration processor inside.For example,, then can pass through the configuration processor internal register, the RTS pin configuration is become GPIO when the RTS of processor pin can be multiplexed with GPIO; When the RTS of processor pin can not be multiplexed with GPIO, then can configuration processor pin annexation, this RTS pin is connected on other GPIO pin of processor.
Step 21, DTE if detect high level on the CTS port, knows that then DCE is in sleep state before DCE sends data, DTE is used for triggering and interrupts by sending a pulse trailing edge signal at the RTS port, wakes up to be in dormant DCE;
Step 22, DCE gets back to normal condition from sleep state after receiving above-mentioned signal, and the RTS port is reverted to the hardware flow control signal port, and CTS is set to low level effective status, shows that DCE has been ready to receive data;
Above-mentioned recovery RTS port is the operation of hardware flow control signal port, can realize by the configuration of in the cancellation step 20 processor being done.
Step 23, DTE knows that DCE is in normal condition after detecting low level on the CTS port, can begin to send data to DCE.
Fig. 3 has used two signals of RI and RTS for DCE among the present invention wakes the schematic flow sheet of DTE up among Fig. 3, wherein RTS is the sleep index signal of DTE, when RTS is a high level, promptly during disarmed state, shows that DTE is in sleep state; RI is the wake-up signal that DCE wakes DTE up, and the RI port is configured to GPIO, and to dispose this GPIO be the effective down trigger of trailing edge source.When on the RI port, sending the pulse trailing edge, trigger interrupt event, thereby wake DTE up.Illustrate that below in conjunction with Fig. 3 DCE wakes the flow process of DTE up, this flow process may further comprise the steps:
Step 30, enter sleep state at every turn before, DTE RI port is set to GPIO, and to dispose this GPIO be the effective down trigger of trailing edge source, after RTS was set to the disarmed state of high level simultaneously, DTE entered sleep state;
The above-mentioned operation that GPIO is set normally realizes by the register of configuration processor inside.For example, when the RI of processor pin can be multiplexed with GPIO, then, the RI pin configuration is become GPIO by the configuration processor internal register; When the RJ of processor pin can not be multiplexed with GPIO, then can configuration processor pin annexation, this RI pin is connected on other GPIO pin of processor.
Step 31, DCE if detect high level on the RTS port, knows that then DTE is in sleep state before DTE sends data, DCE is used for triggering and interrupts by send a pulse trailing edge signal on the RI port, wakes up to be in dormant DTE;
Step 32, DTE gets back to normal condition from sleep state after receiving above-mentioned signal, and the RI port is reverted to the hardware flow control signal port, and RTS is set to low level effective status, shows that DTE has been ready to receive data;
Above-mentioned recovery RI port is the operation of hardware flow control signal port, can realize by the configuration of in the cancellation step 30 processor being done.
Step 33, DCE knows that DTE is in normal condition after detecting low level on the RTS port, can begin to send data to DTE.
The flow process of the inventive method by UART serial ports realization system wake-up function more than has been described,, can have realized the bilateral system arousal function between DCE and the DTE by said method.The inventive method need not to increase new hardware signal port, thereby has saved the hardware resource of system.Simultaneously and since increase among the present invention the configuration of hardware flow control signal port just is used for the sleep awakening of system, do not revise existing UART communications protocol, can not influence the characteristic of above-mentioned hardware flow control signal itself as flow control signal.In addition, the configuration to the hardware flow control signal port that increases in the inventive method is very simple, thereby the invention process is got up simple and reliable.