Summary of the invention
Fundamental purpose of the present invention is method and the device that a kind of detection system reset types is provided, and through the output signal of power management chip being judged the reset types of system, makes detection simple and flexible to the system reset type, and can reduce cost.
The present invention provides a kind of method of detection system reset types, comprising:
Receive the look-at-me that power management chip sends, the pairing output signal of said look-at-me is sampled, obtain sampled signal, and analyze the state of said sampled signal;
Confirm the reset types of system according to the state of said sampled signal, and said reset types is preserved, confirm the reason that resets for CPU according to said reset types.
Preferably, the look-at-me that said reception power management chip sends is sampled to the pairing output signal of said look-at-me, obtains sampled signal, and the state of analyzing said sampled signal comprises:
When system reset, receive the look-at-me that power management chip sends, and the output signal of power management chip is sampled when resetting, and obtains sampled signal;
According to the default situation of said output signal, said sampled signal is analyzed to obtain the state of sampled signal.
Preferably, said state according to sampled signal is confirmed the reset types of system, and said reset types preserved comprises:
Signal condition preset in the state of said sampled signal and the program is compared, and the reset types according to the result of contrast confirms system generates the reset types code simultaneously;
Said reset types code is saved in the register, said reset types code is read for after the system.
Preferably, confirm the reset types of system carrying out said state, and after said reset types preserved, also comprise according to sampled signal:
After system restarts, from register, read said reset types code, and said reset types code is reported CPU, confirm the reason that resets according to said reset types for CPU.
The present invention also provides a kind of device of detection system reset types, comprising:
Sampling module is used to receive the look-at-me that power management chip sends, and the pairing output signal of said look-at-me is sampled, and obtains sampled signal, and analyzes the state of said sampled signal;
Determination module is used for confirming according to the state of said sampled signal the reset types of system, and said reset types is preserved, and confirms the reason that resets according to said reset types for CPU.
Preferably, said sampling module comprises:
Sampling unit is used for when system reset, receives the look-at-me that power management chip sends, and the output signal of power management chip is sampled when resetting, and obtains sampled signal;
Analytic unit is used for the default situation according to said output signal, and said sampled signal is analyzed to obtain the state of sampled signal.
Preferably, said determination module comprises:
The contrast unit is used for the state and the preset signal condition of program of said sampled signal are compared, and the reset types according to the result of contrast confirms system generates the reset types code simultaneously;
Preserve the unit, be used for said reset types code is saved to register, said reset types code is read for after the system.
Preferably, the device of detection system reset types also comprises:
Reporting module is used for after system restarts, and from register, reads said reset types code, and said reset types code is reported CPU, confirms the reason that resets according to said reset types for CPU.
The method of detection system reset types provided by the present invention; Variation through the monitored output signal waveform in the system reset restarting process of power management chip in the detection system; Pairing output signal is sampled when promptly power management chip being sent look-at-me; And the state of the resulting sampled signal of sampling analyzed, confirming the reset types of system through the setting in the system, the result with determined reset types preserves at last.Like this, when reason that the needs analysis this time resets, CPU just can analyze the reset types that has carried out preserving, thus definite reason that resets.Adopt this method, make, reduce and detect cost the detection simple and flexible of system reset type; And can the accurate in locating reset circuit, improve determination rate of accuracy, reduce error.
Embodiment
Should be appreciated that specific embodiment described herein only in order to explanation the present invention, and be not used in qualification the present invention.
With reference to Fig. 1, method one embodiment of detection system reset types of the present invention is proposed, this method comprises:
Step S101 receives the look-at-me that power management chip sends, and the pairing output signal of said look-at-me is sampled, and obtains sampled signal, and analyzes the state of said sampled signal;
In the present embodiment, a kind of method of detection system reset types is provided, the variation of the output signal waveform in the system reset restarting process through power management chip in the detection system knows that this system reset restarts whether by due to the power down.When system resets; Power management chip can send a look-at-me; After receiving this look-at-me; Just need be according to the low level time-delay that sets in the system, the waveform of its monitored output signal was sampled when power management chip was sent look-at-me, and this moment is through the resulting sampled signal that is of over-sampling.Then, the sampled signal of sampling gained is analyzed, promptly the level according to each included monitor signal of output signal obtains its pairing state.
The output signal that power management chip is monitored that sets in the system can be exported the RESET signal of WDO signal, power down output order PFO signal and system for house dog.And in actual conditions, might default monitoring to certain signal, in to program, reset when the pairing signal condition of reset types is set when taking place, the state of this signal will be set to 0, and other signals are as the criterion with the sampled signal that obtains.Like this; Sampled signal through sampling is obtained is analyzed; The state that just can judge each included monitor signal of this sampled signal is 0 or 1, thus can obtain this time resetting the time according to exporting the sample state of the sampled signal that obtains of signal.
Step S102 confirms the reset types of system according to the state of said sampled signal, and said reset types is preserved, and confirms the reason that resets according to said reset types for CPU.
When the monitored output signal of power management chip is sampled; Obtain sampled signal and sampled signal is analyzed; After drawing the state of each included monitor signal of sampled signal; Just can be according to the state of sampled signal, and confirm the reset types of system through the pairing signal condition of the reset types that sets in the system.Behind the reset types of having confirmed system, need the result of the reset types of confirming be preserved, like this; After system restart; During reason of obtaining this time resetting like need, just CPU can analyze the reset types that has carried out preserving, thereby confirm the reason that this resets.
The method of detection system reset types provided by the present invention; Variation through the monitored output signal waveform in the system reset restarting process of power management chip in the detection system; Pairing output signal is sampled when promptly power management chip being sent look-at-me; And the state of the resulting sampled signal of sampling analyzed, confirming the reset types of system through the setting in the system, the result with determined reset types preserves at last.Like this, when reason that the needs analysis this time resets, CPU just can analyze the reset types that has carried out preserving, thus definite reason that resets.Adopt this method, make, reduce and detect cost the detection simple and flexible of system reset type; And can the accurate in locating reset circuit, improve determination rate of accuracy, reduce error.
With reference to Fig. 2, in method one embodiment of detection system reset types of the present invention, step S101 comprises:
Step S1011 when system reset, receives the look-at-me that power management chip sends, and the output signal of power management chip is sampled when resetting, and obtains sampled signal;
When system resets; The output signal of power management chip just can be undergone mutation; This moment, power management chip will send a corresponding look-at-me, after receiving this look-at-me, just began the pulse edge according to output signal monitored output signal of power management chip when undergoing mutation; Waveform to output signal is at this moment sampled, and the resulting signal in sampling back is sampled signal.
Step S1012 according to the default situation of said output signal, analyzes to obtain the state of sampled signal said sampled signal.
To the waveform of output signal monitored output signal of power management chip when undergoing mutation sample obtain sampled signal after; This sampled signal is analyzed; It is the state of analytical sampling signal; Whether the signals such as RESET signal of judging wherein included signal such as house dog output WDO signal, power down output order PFO signal and system are by default monitor signal; And will be designated as 0 by the state of default monitor signal, and like this, the state of the sampled signal that obtains of just can obtaining when system reset, sampling.
When system resets; When the output signal of power management chip is undergone mutation, receive its look-at-me of sending after, the waveform of the output signal of the power management chip in this time is sampled; And according to the whether default situation of each signal in the sampled signal; Judge the state of each monitor signal, thereby obtain the state of sampled signal, confirm reset types according to the state of this sampled signal for system.Like this; Only use the output signal of power management chip is sampled; And the resulting sampled signal of sampling analyzed; Just can judge the reset types of system through the result who analyzes, this has just further reduced the detection cost, and has further guaranteed the detection of system reset type simple.
With reference to Fig. 3, in method one embodiment of detection system reset types of the present invention, step S102 comprises:
Step S1021 compares signal condition preset in the state of said sampled signal and the program, and the reset types according to the result of contrast confirms system generates the reset types code simultaneously;
In the present embodiment, the reset types of system might be power-off restoration, under-voltage reset, watchdog reset and manual reset.In the veneer of system, possible reset types in the time of can resetting according to system, and the output signal of the power management chip of this system of being directed against are preset respectively the state of every kind of monitor signal in the output signal under these four kinds of reset types.When the state of the output signal under the reset types is preset, also each reset types is encoded, i.e. the corresponding reset types code of each reset types.With reference to Fig. 4, wherein listed the state of every kind of signal in the output signal under each reset types, and the pairing reset types code of this reset types.
When power management chip sends look-at-me; To its output signal sampling and after analyzing the state of sampled signal; Just can be according to corresponding order; The state of each monitor signal that sampled signal is included compares with the state of preset this signal respectively, according to comparing result, just can judge and confirm the reset types of system at this moment; Behind the reset types of judging system, just can generate a reset types code pairing to the reset types of being judged according to default reset types code in the system with it.
Step S1022 is saved to said reset types code in the register, for after the system said reset types code is read.
When according to the state contrast of preset output signal and determine the reset types of system, generated the reset types code simultaneously after, need this reset types code be preserved, be about to it and be saved in the high-end reservation specified register in the system.High-end reservation specified register is used to store the reset types code of the system that obtains through analyzing; Determined reset types code was stored when it can be to system reset repeatedly; These different reset types codes can adopt the time of storage to carry out mark; And can not be eliminated, so just can guarantee when system restarts, as required from wherein reading the reset types code of being stored when certain once resets.
State to the output signal of power management chip in system is preset; When system resets, according to the sampled signal of sampling and obtaining, the state of wherein each monitor signal is analyzed; Compare with preset signal condition then; Result according to contrast just can confirm this reset types of resetting of system, and will preserve according to the reset types code that this reset types generated, and just can be used for when system restarts next time; As required from wherein reading the reset types code of being stored when resetting, thereby judge the reason that resets through CPU.Like this, just can further guarantee accurate location, and can improve determination rate of accuracy, reduce error reset circuit.
With reference to Fig. 5, the another embodiment of method of detection system reset types of the present invention is proposed, this method also comprises:
Step S103 after system restarts, reads said reset types code, and said reset types code is reported CPU from register, confirm the reason that resets according to said reset types for CPU.
During according to system reset the output signal determining of power management chip reset types of this time resetting of system; And the pairing reset types code of this reset types is kept in the register, like this, after system restarts next time; When the reset circuit that certain primary system is resetted like need is analyzed; The pairing reset types code of time that this time that just can from this register, read wherein to be stored resets and take place then, reports CPU with this reset types code; Also can it be reported webmaster; After CPU or webmaster receive this reset types code, just can analyze, thereby further confirm the reason that resets it.
To preserve according to the time of taking place that resets according to the reset types code that reset types generated of system reset; To guarantee after system restart; In the time of need analyzing certain reason that once resets; Can read corresponding reset types code according to the time of taking place that resets easily, thereby the reason that this time resets is analyzed.The high-end reservation specified register that utilizes in the system to be carried; Can realize steadiness storage to the reset types code; This has just guaranteed the convenience that the reset circuit to system detects to a great extent, has reduced the cost to the system reset type detection simultaneously.
With reference to Fig. 6, device one embodiment of detection system reset types of the present invention is proposed, this device comprises:
Sampling module 10 is used to receive the look-at-me that power management chip sends, and the pairing output signal of said look-at-me is sampled, and obtains sampled signal, and analyzes the state of said sampled signal;
Determination module 20 is used for confirming according to the state of said sampled signal the reset types of system, and said reset types is preserved, and confirms the reason that resets according to said reset types for CPU.
In the present embodiment, a kind of method of detection system reset types is provided, the variation of the output signal waveform in the system reset restarting process through power management chip in the detection system knows that this system reset restarts whether by due to the power down.When system resets; Power management chip can send a look-at-me; After receiving this look-at-me; Samplingmodule 10 just need be according to the low level time-delay that sets in the system, and the waveform of its monitored output signal was sampled when power management chip was sent look-at-me, and this moment is through the resulting sampled signal that is of over-sampling.Then, the sampled signal of sampling gained is analyzed, promptly the level according to each included monitor signal of output signal obtains its pairing state.
The output signal that power management chip is monitored that sets in the system can be exported the RESET signal of WDO signal, power down output order PFO signal and system for house dog.And in actual conditions; Might default monitoring to certain signal, in to program, reset when the pairing signal condition of reset types is set when taking place, the state of this signal will be set to 0; Like this; Sampled signal through sampling is obtained is analyzed, and the state that just can judge each included monitor signal of this sampled signal is 0 or 1, thus can obtain this time resetting the time according to exporting the sample state of the sampled signal that obtains of signal.
When the monitored output signal of power management chip is sampled; Obtain sampled signal and sampled signal is analyzed; After drawing the state of each included monitor signal of sampled signal;Determination module 20 just can be according to the state of sampled signal, and confirms the reset types of system through the pairing signal condition of the reset types that sets in the system.Behind the reset types of having confirmed system, need the result of the reset types of confirming be preserved, like this; After system restart; During reason of obtaining this time resetting like need, just CPU can analyze the reset types that has carried out preserving, thereby confirm the reason that this resets.
The device of detection system reset types provided by the present invention; Variation through the monitored output signal waveform in the system reset restarting process of power management chip in the detection system; Pairing output signal is sampled when promptly power management chip being sent look-at-me; And the state of the resulting sampled signal of sampling analyzed, confirming the reset types of system through the setting in the system, the result with determined reset types preserves at last.Like this, when reason that the needs analysis this time resets, CPU just can analyze the reset types that has carried out preserving, thus definite reason that resets.Adopt this method, make, reduce and detect cost the detection simple and flexible of system reset type; And can the accurate in locating reset circuit, improve determination rate of accuracy, reduce error.
With reference to Fig. 7, in device one embodiment of detection system reset types of the present invention,sampling module 10 comprises:
Samplingunit 11 is used for when system reset, receives the look-at-me that power management chip sends, and the output signal of power management chip is sampled when resetting, and obtains sampled signal;
Analytic unit 12 is used for the default situation according to said output signal, and said sampled signal is analyzed to obtain the state of sampled signal.
When system resets; The output signal of power management chip just can be undergone mutation; This moment, power management chip will send a corresponding look-at-me, and after receiving this look-at-me, samplingunit 11 just begins the pulse edge according to output signal monitored output signal of power management chip when undergoing mutation; Waveform to output signal is at this moment sampled, and the resulting signal in sampling back is sampled signal.
To the waveform of output signal monitored output signal of power management chip when undergoing mutation sample obtain sampled signal after; 12 pairs of these sampled signals of analytic unit are analyzed; It is the state of analytical sampling signal; Whether the signals such as RESET signal of judging wherein included signal such as house dog output WDO signal, power down output order PFO signal and system are by default monitor signal; And will be designated as 0 by the state of default monitor signal, and like this, the state of the sampled signal that obtains of just can obtaining when system reset, sampling.
When system resets; When the output signal of power management chip is undergone mutation, receive its look-at-me of sending after, the waveform of the output signal of the power management chip in this time is sampled; And according to the whether default situation of each signal in the sampled signal; Judge the state of each monitor signal, thereby obtain the state of sampled signal, confirm reset types according to the state of this sampled signal for system.Like this; Only use the output signal of power management chip is sampled; And the resulting sampled signal of sampling analyzed; Just can judge the reset types of system through the result who analyzes, this has just further reduced the detection cost, and has further guaranteed the detection of system reset type simple.
With reference to Fig. 8, in device one embodiment of detection system reset types of the present invention,determination module 20 comprises:
Contrast unit 21 is used for the state and the preset signal condition of program of said sampled signal are compared, and the reset types according to the result of contrast confirms system generates the reset types code simultaneously;
Preserveunit 22, be used for said reset types code is saved to register, said reset types code is read for after the system.
In the present embodiment, the reset types of system might be power-off restoration, under-voltage reset, watchdog reset and manual reset.In the veneer of system, possible reset types in the time of can resetting according to system, and the output signal of the power management chip of this system of being directed against are preset respectively the state of every kind of monitor signal in the output signal under these four kinds of reset types.When the state of the output signal under the reset types is preset, also each reset types is encoded, i.e. the corresponding reset types code of each reset types.With reference to Fig. 4, wherein listed the state of every kind of signal in the output signal under each reset types, and the pairing reset types code of this reset types.
When power management chip sends look-at-me; To its output signal sampling and after analyzing the state of sampled signal;Contrast unit 21 just can be according to corresponding order; The state of each monitor signal that sampled signal is included compares with the state of preset this signal respectively, according to comparing result, just can judge and confirm the reset types of system at this moment; Behind the reset types of judging system, just can generate a reset types code pairing to the reset types of being judged according to default reset types code in the system with it.
When the reset types that contrasts and determine system according to the state of preset output signal; After having generated the reset types code simultaneously; Preservingunit 22 need preserve this reset types code, is about to it and is saved in the high-end reservation specified register in the system.High-end reservation specified register is used to store the reset types code of the system that obtains through analyzing; Determined reset types code was stored when it can be to system reset repeatedly; These different reset types codes can adopt the time of storage to carry out mark; And can not be eliminated, so just can guarantee when system restarts, as required from wherein reading the reset types code of being stored when certain once resets.
State to the output signal of power management chip in system is preset; When system resets, according to the sampled signal of sampling and obtaining, the state of wherein each monitor signal is analyzed; Compare with preset signal condition then; Result according to contrast just can confirm this reset types of resetting of system, and will preserve according to the reset types code that this reset types generated, and just can be used for when system restarts next time; As required from wherein reading the reset types code of being stored when resetting, thereby judge the reason that resets through CPU.Like this, just can further guarantee accurate location, and can improve determination rate of accuracy, reduce error reset circuit.
With reference to Fig. 9, the another embodiment of device of detection system reset types of the present invention is proposed, this device also comprises:
Reporting module 30 is used for after system restarts, and from register, reads said reset types code, and said reset types code is reported CPU, confirms the reason that resets according to said reset types for CPU.
During according to system reset the output signal determining of power management chip reset types of this time resetting of system; And the pairing reset types code of this reset types is kept in the register, like this, after system restarts next time; When the reset circuit that certain primary system is resetted like need is analyzed; The pairing reset types code of time that this time that just can from this register, read wherein to be stored resets and take place, then, reportingmodule 30 reports CPU with this reset types code; Also can it be reported webmaster; After CPU or webmaster receive this reset types code, just can analyze, thereby further confirm the reason that resets it.
To preserve according to the time of taking place that resets according to the reset types code that reset types generated of system reset; To guarantee after system restart; In the time of need analyzing certain reason that once resets; Can read corresponding reset types code according to the time of taking place that resets easily, thereby the reason that this time resets is analyzed.The high-end reservation specified register that utilizes in the system to be carried; Can realize steadiness storage to the reset types code; This has just guaranteed the convenience that the reset circuit to system detects to a great extent, has reduced the cost to the system reset type detection simultaneously.
The above is merely the preferred embodiments of the present invention; Be not so limit claim of the present invention; Every equivalent structure or equivalent flow process conversion that utilizes instructions of the present invention and accompanying drawing content to be done; Or directly or indirectly be used in other relevant technical fields, all in like manner be included in scope of patent protection of the present invention.