The method and apparatus that lamp in a kind of pair of equipment is controlled
Technical field
The present invention relates to smart machine field, in particular to method and apparatus that the lamp in a kind of pair of equipment is controlled.
Background technique
The smart machines such as current smart television interact in start process with user, can pass through LED
The state that (Light Emitting Diode, light emitting diode) indicator light prompt user equipment is presently in, LED light effect
Fruit has different brightness, goes out, flashes, breathing, wherein flashing, the realization of breath light effect need CPU (Central
Processing Unit, central processing unit) overall process participation control.
The smart machines such as TV booting when, core pass through software phase include booting guidance, system starting in, system
After start completion;The smart machines such as TV prepare it is standby when, core pass through software phase include system enter journey prepare to
It is machine, standby.
In booting bootup process, software is single thread mode;During the system startup process, multi-thread environment is also not ready to
It is good;System enter journey prepare it is standby when, LED control process can also be killed;When standby, core no longer works.
In these software flows, only after system start completion, thread can be enabled and be responsible for LED control, in addition to this
Other processes are unable to control LED, and will lead in this way can not lamp in continuous control equipment.
It, can not be in continuous control equipment in conclusion the prior art is in system starting process or in standby
Lamp.
Summary of the invention
The present invention provides the method and apparatus that the lamp in a kind of pair of equipment is controlled, to solve the prior art in system
Start-up course or in standby, can not lamp in continuous control equipment the problem of.
In a first aspect, the embodiment of the present invention provides the method that the lamp in a kind of pair of equipment is controlled, this method comprises:
The first core in multi-core processor is in equipment running process, and according to equipment, the current operation phase determines light
Information;The light information that the second core in the multi-core processor is determined according to the first core is to the lamp in the equipment
It is controlled.
The above method, the first core in multi-core processor is in equipment running process, according to the current operation rank of equipment
Section determines light information;Then the light information that the second core in multi-core processor is determined according to the first core is to described
Lamp in equipment is controlled.In this way, can determine light by the first core in system starting process or in standby
Message, then the lamp in equipment is controlled according to determining light message by the second core, since the second core is not run
The influence in stage, therefore lamp in equipment can be controlled in system starting process or continuously in standby.
In a kind of possible embodiment, the first core in the multi-core processor is in equipment running process, root
After determining light information according to the equipment current operation phase, the second core in the multi-core processor is true according to the first core
Before the fixed light information controls the lamp in the equipment, further includes: first core believes the light
Breath is sent to second core;Or first core stores the light information into memory;Second core
The light information is read from the memory.
The above method can be directly transmitted when the second core obtains the light information that the first core determines by the first core
To the second core;It is first stored in memory after light information can also being determined by the first core, then by the second core from depositing
The light information is obtained in reservoir, the second core controls the lamp in equipment according to obtained light information later.
In a kind of possible embodiment, the light information is light flag bit;Second core is according to light
The binding relationship of flag bit and effect information determines the corresponding effect information of light flag bit that first core determines;Institute
The second core is stated to control the lamp in the equipment according to the determining effect information.
The above method, the first core determine that light information is light flag bit, and the second core can be according to light flag bit
With the binding relationship of effect information, corresponding lighting effects are determined, and the lamp in equipment is carried out according to determining lighting effects
Control, such second core can be according to the light informations that the first core determines in system starting process or in standby
Realize the continuous control to lamp.
In a kind of possible embodiment, second core is according to presetting or the operation phase pair of user setting
The effect information answered generates operation phase corresponding light flag bit;Second core by the light flag bit of generation with
The effect information is bound.
The above method, the second core is according to presetting or the operation phase of user setting corresponding effect information generates fortune
The corresponding light flag bit of row order section, and the light flag bit of generation is bound with effect information, in this way, the second core exists
After getting the light flag bit that the first core determines, the light mark and lamp that can be determined according to the first core got
Binding relationship between light flag bit and effect information determines the corresponding effect information of light mark that the first core determines, and
Further the lamp in equipment is controlled according to effect information.
In a kind of possible embodiment, second core is according to presetting or the operation phase pair of user setting
The effect information answered generates after operation phase corresponding light flag bit, further includes:
Second core notifies operation phase corresponding light flag bit to first core;Or
Second core is by operation phase corresponding light flag bit storage into memory;
First core obtains the operation phase corresponding light flag bit from the memory.
The above method, after the second core determines operation phase corresponding light flag bit, by the determining operation phase pair
The light flag bit answered is notified to first core, in order to which the first core determines corresponding light mark according to the operation phase
Will position, and light flag bit is notified to the second core, and then the second core can be to the control of the lamp in equipment.
In a kind of possible embodiment, institute that the second core in the multi-core processor is determined according to the first core
It states after light information controls the lamp in the equipment, first core starts in the subject thread for controlling lamp
Afterwards, the lamp in the equipment is controlled by the subject thread, and second core is notified to stop to the equipment
On lamp controlled;Second core stops controlling the lamp in the equipment after receiving the notice.
The above method, after the subject thread starting for controlling lamp, the first core of multi-core processor can pass through mesh
Graticule journey controls the lamp in equipment, while the stopping of the second core being notified to control the lamp in equipment;Second core
Stop controlling the lamp in equipment after receiving notice.In this way, the first core can be by subject thread to equipment
On lamp when being controlled, the second core can stop controlling the lamp in equipment, so reduce the power consumption of core, save
Processor resource.
Second aspect, the embodiment of the present invention also provide a kind of equipment, and the equipment includes the in multi-core processor
One core and the second core, the equipment have the function of realizing each embodiment of above-mentioned first aspect.
In addition, technical effect brought by implementation in second aspect can be found in different implementations in first aspect
Brought technical effect, details are not described herein again.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the invention, for this
For the those of ordinary skill in field, without any creative labor, it can also be obtained according to these attached drawings
His attached drawing.
Fig. 1 provides the flow diagram for the method that the lamp in a kind of pair of equipment is controlled for the embodiment of the present invention;
Fig. 2 provides the flow diagram for the method that the first controls the lamp in equipment for the embodiment of the present invention;
Fig. 3 provides the flow diagram for the method that the lamp in second pair of equipment is controlled for the embodiment of the present invention;
Fig. 4 provides the flow diagram for the method that the third controls the lamp in equipment for the embodiment of the present invention;
Fig. 5 provides the flow diagram of the 4th kind of method controlled the lamp in equipment for the embodiment of the present invention;
Fig. 6 provides a kind of structural schematic diagram of equipment for the embodiment of the present invention;
Fig. 7 provides a kind of structural schematic diagram of specific equipment for the embodiment of the present invention.
Specific embodiment
It is related at least two cores of multi-core processor in the embodiment of the present invention, one of core is responsible for specially to setting
Standby to carry out the operation such as starting, another core controls the lamp in equipment.
The embodiment of the present invention will transfer to the second core of multi-core processor to be responsible for the control of the lamp in equipment, and the first core
The heart then needs to provide the light information for corresponding to the operation phase to the second core according to the operation phase, so that the second core can be with
The lamp in equipment is controlled according to light information.Lamp is controlled due to not needing offer process, thus executing
When entering journey, it can also continue to equity and controlled.
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention make into
It is described in detail to one step, it is clear that the described embodiments are only some of the embodiments of the present invention, rather than whole implementation
Example.Based on the embodiments of the present invention, obtained by those of ordinary skill in the art without making creative efforts
All other embodiment, shall fall within the protection scope of the present invention.
As described in Figure 1, the method that the lamp in a kind of pair of equipment is controlled, this method packet are provided in the embodiment of the present invention
It includes:
Step 100, the first core in multi-core processor is in equipment running process, according to the equipment current operation phase
Determine light information;
Step 101, the light information that the second core in the multi-core processor is determined according to the first core is to institute
The lamp stated in equipment is controlled.
The above method, the first core in multi-core processor is in equipment running process, according to the current operation rank of equipment
Section determines light information;Then the light information that the second core in multi-core processor is determined according to the first core is to described
Lamp in equipment is controlled.In this way, can determine light by the first core in system starting process or in standby
Message, then the lamp in equipment is controlled according to determining light message by the second core, since the second core is not run
The influence in stage, therefore lamp in equipment can be controlled in system starting process or continuously in standby.
Wherein, the software phase that the core of smart machine is passed through include booting guidance, in system starting, system started
Journey, which is entered, at, system prepares this standby, standby five states.Wherein, in booting bootup process, software is single thread mode;
During the system startup process, multi-thread environment is not yet ready for;System enter journey prepare it is standby when, control the subject thread of lamp
Also it can be killed;When standby, core no longer works;When in this four operation phase, the first core cannot connect
The lamp in equipment is controlled continuously, must be responsible for continuously controlling the lamp in equipment at this time by the second core of multi-core processor.
And after system start completion, the subject thread for controlling lamp, which can enable, to be responsible for controlling the lamp in equipment.This
When, the lamp in equipment can both be controlled by the second core, it can also be by the subject thread of control lamp to the lamp in equipment
It is controlled.
The embodiment of the present invention will be described in detail below.
The first core in multi-core processor is in equipment running process, and according to equipment, the current operation phase determines lamp
Before optical information, first have to determine the binding relationship between operation phase and effect information.
Wherein, the binding relationship between operation phase and effect information, which can be, is set by manufacturer when factory, can also
To be user according to itself fancy setting.
It will be bound between operation phase and effect information in the above method, operation that so can be current according to system
Stage determines required effect message, so according to the operation phase of current system in equipment etc. control, keep lamp real
Now corresponding lighting effects.
After determining the binding relationship between operation phase and effect information, it is also necessary to determine operation phase corresponding effect
Binding relationship between fruit information light flag bit corresponding with the operation phase.
Wherein, the light information can be light flag bit.
Correspondingly, second core is according to presetting or the operation phase of user setting corresponding effect information generates
Operation phase corresponding light flag bit;
Second core binds the light flag bit of generation with the effect information.
The above method, the second core is according to presetting or the operation phase of user setting corresponding effect information generates fortune
The corresponding light flag bit of row order section, and the light flag bit of generation is bound with effect information, in this way, the second core exists
After getting the light flag bit that the first core determines, the light mark and lamp that can be determined according to the first core got
Binding relationship between light flag bit and effect information determines the corresponding effect information of light mark that the first core determines, and
Further the lamp in equipment is controlled according to effect information.
Specifically, after determining the binding relationship between light flag bit and effect information needing that process pair will be run
The light flag bit answered notifies the first core.
Mode one, the second core is according to presetting or the operation phase of user setting corresponding effect information generates operation
After stage corresponding light flag bit, operation phase corresponding light flag bit is notified to first core.
The above method, after the second core determines operation phase corresponding light flag bit, by the determining operation phase pair
The light flag bit answered is notified to first core, in order to which the first core determines corresponding light mark according to the operation phase
Will position, and by the second core of light flag bit, and then realize the control to the lamp in equipment.It simultaneously will compared to by the second core
Operation phase, corresponding light flag bit storage was into memory;The operation is obtained from the memory by the first core again
Stage corresponding light flag bit, in the present solution, the first core can faster determine operation phase corresponding light mark
Position.
Mode two, the second core is by operation phase corresponding light flag bit storage into memory;Again by the first core
The operation phase corresponding light flag bit is obtained from memory.
The above method, after the second core determines operation phase corresponding light flag bit, by the determining operation phase pair
The light flag bit answered is notified to first core, in order to which the first core determines corresponding light mark according to the operation phase
Will position, and by the second core of light flag bit, and then realize the control to the lamp in equipment.
In an implementation, the equipment further includes the memory for storing light flag bit;For controlling the memory of memory
Controller, a lamp group controlled, and control lamp group GPIO (General Purpose Input Output, it is general
Input/output) controller.
Wherein, the first core can be stored light flag bit in memory by Memory Controller;Second core
Light flag bit can be obtained in memory by Memory Controller, the lamp group controlled by GPIO controller is specific to tie
Structure may refer to Fig. 7.
It is determining between binding relationship and operation phase and light flag bit between operation phase and effect information
Binding relationship after, when equipment boots up starting, so that it may according to the binding relationship between operation phase and effect information with
And the binding relationship between operation phase and light flag bit determines corresponding light information, and controls to the lamp in equipment
System, to realize corresponding effect.
In specific implementation, the first core in multi-core processor is in equipment running process, according to the current operation of equipment
Stage determines light information.
The above method, the first core in multi-core processor determine corresponding light information according to the operation phase of equipment,
So when the lamp to equipment controls, current system operation phase, Jin Erke can be determined according to according to light flag bit
To determine current system operation phase corresponding lighting effects.
In the operation phase corresponding light information for determining equipment, the light information that will be determined is needed to be transferred to the second core
The heart.
At this point, light information is transferred to the second core, there are two types of modes, and one is the first cores, and light information is direct
It is sent to the second core;Another kind is the first core first by light information storage into memory, then by the second core from storage
The light information is read in device.
Light information is transmitted directly to the second core by mode one, the first core.
Specifically, the first core in the multi-core processor is in equipment running process, according to the current operation of equipment
After stage determines light information, the light information is sent to second core;Then in the multi-core processor
Second core controls the lamp in the equipment according to the light information that the first core determines.
Light information is transmitted directly to the second core without memory, can so saved by the above method, the first core
The time for going intermediate data to transmit improves and obtains efficiency.
Mode two, the first core first read light information storage into memory, then by the second core from memory
The light information.
Specifically, the first core in the multi-core processor is in equipment running process, according to the current operation of equipment
After stage determines light information, first by light information storage into memory;Then second core is deposited from described
The light information is read in reservoir, the light information determined further according to the first core controls the lamp in the equipment
System.
The above method, the first core in multi-core processor determine equipment current operation phase corresponding light letter
Breath obtains light message storage into memory, then by the second core from memory, so that the second core can be according to
The lamp in equipment is controlled according to the light message of acquisition.
Such as: core A is the first core for being responsible for the control operation phase, and core B be responsible for controlling lamp in equipment the
Two cores can be by bus by light after the first core determines equipment current operation phase corresponding light information
For information preservation into memory, subsequent second core obtains the light letter saved in memory by bus from memory
Breath.
The second core root after the second core gets corresponding light message of current operation phase, in multi-core processor
The lamp in the equipment is controlled according to the light information that the first core determines.
Specifically, when the light information is light flag bit;The second core in the multi-core processor is according to first
When the light information that core determines controls the lamp in the equipment, first according to light flag bit and effect information
Binding relationship, determine the corresponding effect information of light flag bit that first core determines;Then according to determining
Effect information controls the lamp in the equipment.
The above method, the second core are first determined according to the light flag bit of acquisition when controlling the lamp in equipment
Corresponding effect information controls the lamp in equipment further according to effect information.So can in system starting process or
The lamp continuously controlled in equipment is realized in standby.
Such as: lighting effects is flashings when setting booting guidance, and corresponding flag bit is 00001000 at this time, then when first
When core determines that the current operation phase is in booting boot state, flag bit 00001000 is sent to the second core, the second core
The heart determines that the current operation phase is booting guidance according to flag bit 00001000, and then flashes according to the lamp in control equipment.
Specifically, the light information that the second core in the multi-core processor is determined according to the first core is to equipment
On lamp controlled after, first core for controlling lamp subject thread starting after, pass through the subject thread
Lamp in the equipment is controlled, and the second core stopping is notified to control the lamp in the equipment;
Correspondingly, second core stops controlling the lamp in the equipment after receiving the notice.
In specific implementation, after controlling the target process starting of lamp, can still there be the second core to be responsible for in equipment at this time
Lamp controlled, can also be by being responsible for controlling the lamp in equipment for controlling the target process of lamp after starting, phase
Compared with by the lamp on the second core control equipment, core resource can be saved by the lamp in target process control equipment.
As shown in Fig. 2, the entire flow figure that the lamp in a kind of pair of equipment provided in an embodiment of the present invention is controlled.
Step 200, the second core is according to presetting or the operation phase of user setting corresponding effect information generates fortune
The corresponding light flag bit of row order section;
Step 201, the second core binds the light flag bit of generation with the effect information;
Step 202, operation phase corresponding light flag bit is transmitted directly to the first core by the second core;
Step 203, the first core is in equipment running process, according to equipment current operation phase corresponding light mark
Position;
Step 204, the light flag bit is sent to second core by the first core;
Step 205, the light flag bit that the second core is sent according to the first core controls the lamp in the equipment.
As shown in figure 3, the entire flow figure that the lamp in a kind of pair of equipment provided in an embodiment of the present invention is controlled.
Step 300, according to presetting or the operation phase of user setting corresponding effect information generates the operation phase pair
The light flag bit answered;
Step 301, the second core binds the light flag bit of generation with the effect information;
Step 302, operation phase corresponding light flag bit is transmitted directly to the first core by the second core;
Step 303, the first core is in equipment running process, according to equipment current operation phase corresponding light mark
Position;
Step 304, after judging whether the current operation phase is in system start completion, if it is, executing 306;Otherwise
Execute 307;
Step 305, the first core controls the lamp in equipment by subject thread, and notifies the stopping pair of the second core
Lamp in the equipment is controlled;
Step 306, the second core stops controlling the lamp in the equipment after receiving the notice;
Step 307, the light flag bit is sent to second core by the first core;
Step 308, the light flag bit that the second core is sent according to the first core controls the lamp in the equipment.
As shown in figure 4, the entire flow figure that the lamp in a kind of pair of equipment provided in an embodiment of the present invention is controlled.
Step 400, the second core is according to presetting or the operation phase of user setting corresponding effect information generates fortune
The corresponding light flag bit of row order section;
Step 401, the second core binds the light flag bit of generation with the effect information;
Step 402, the second core is by operation phase corresponding light flag bit storage into memory;
Step 403, the first core obtains the operation phase corresponding light flag bit from the memory;
Step 404, the first core is in equipment running process, according to equipment current operation phase corresponding light mark
Position;
Step 405, the first core stores the light flag bit into memory;
Step 406, the second core reads the light flag bit from the memory;
Step 407, the light flag bit that the second core is sent according to the first core controls the lamp in the equipment.
As shown in figure 5, the entire flow figure that the lamp in a kind of pair of equipment provided in an embodiment of the present invention is controlled.
Step 500, according to presetting or the operation phase of user setting corresponding effect information generates the operation phase pair
The light flag bit answered;
Step 501, the second core binds the light flag bit of generation with the effect information;
Step 502, the second core is by operation phase corresponding light flag bit storage into memory;
Step 503, the first core obtains the operation phase corresponding light flag bit from the memory;
Step 504, the first core is in equipment running process, according to equipment current operation phase corresponding light mark
Position;
Step 505, after judging whether the current operation phase is in system start completion, if it is, executing 506;Otherwise
Execute 508;
Step 506, the first core controls the lamp in equipment by subject thread, and the second core is notified to stop to institute
The lamp stated in equipment is controlled;
Step 507, the second core stops controlling the lamp in the equipment after receiving the notice;
Step 508, the first core stores the light flag bit into memory;
Step 509, the second core reads the light flag bit from the memory;
Step 510, the light flag bit that the second core is sent according to the first core controls the lamp in the equipment.
Based on the same inventive concept, a kind of equipment is additionally provided in the embodiment of the present invention, since the equipment includes positioned at more
The first core, the second core in core processor are the first core of the multi-core processor in the method in the embodiment of the present invention
Second core of the heart, multi-core processor, and the principle that the equipment solves the problems, such as is similar to this method, therefore the implementation started to write
It may refer to the implementation of method, overlaps will not be repeated.
As shown in fig. 6, the embodiment of the present invention provides a kind of equipment, the equipment includes multi-core processor 60 and lamp group 61,
Wherein lamp group 61 includes at least one lamp, and the first core 600 and the second core 601 in multi-core processor;
First core 600, for determining that light is believed according to the equipment current operation phase in equipment running process
Breath;
Second core 601, for according to the first core determine the light information to the lamp in the equipment into
Row control.
Optionally, first core 600 is also used to:
In equipment running process, after determining light information according to the equipment current operation phase, the multicore processing
Before the second core in device controls the lamp in the equipment according to the light information that the first core determines, by institute
It states light information and is sent to second core;Or by light information storage into memory;
Second core 601 is also used to:
The light information is read from the memory.
Optionally, the light information is light flag bit;Second core 601 is specifically used for:
According to the binding relationship of light flag bit and effect information, the light flag bit pair that first core determines is determined
The effect information answered;The lamp in the equipment is controlled according to the determining effect information.
Optionally, second core 601 is also used to:
According to presetting or the operation phase of user setting corresponding effect information generates operation phase corresponding light
Flag bit;The light flag bit of generation is bound with the effect information.
Optionally, second core 601 is also used to:
It is preset in basis or the operation phase of user setting corresponding effect information generates operation phase corresponding lamp
After light flag bit, operation phase corresponding light flag bit is notified to first core;Or it is the operation phase is corresponding
Light flag bit is stored into memory;
First core 600 is also used to:
The operation phase corresponding light flag bit is obtained from the memory.
Optionally, first core 600 is also used to:
After the light information determined according to the first core controls the lamp in the equipment, for controlling
After the subject thread starting of lamp processed, the lamp in the equipment is controlled by the subject thread, and notify described second
Core stopping controls the lamp in the equipment;
Second core 601 is also used to:
Stop controlling the lamp in the equipment after receiving the notice.
As shown in fig. 7, a kind of equipment in the embodiment of the present invention, the equipment include multi-core processor, lamp group, memory,
GPIO controller and Memory Controller.Wherein, there is N number of core in multi-core processor, there is core A and core B in N number of core.
In an implementation, can have at least one core in N number of core is core A;Core B can be core in N number of core
At least one core except heart A.
In equipment running process, core A determines the system current operation phase, then the operation rank current according to system
Section will determine corresponding light flag bit, and then the instruction for storing light flag bit is sent to Memory Controller by core A
And current operation phase corresponding light flag bit is stored into memory by Memory Controller;
Core B sends light flag bit to Memory Controller and reads instruction, and passes through Memory Controller from memory
It is middle to obtain current operation phase corresponding light mark;
Core B determines corresponding effect information according to the light flag bit got, and sending to GPIO controller should
The corresponding instruction of effect information, so that lamp group realizes corresponding lighting effects.
It should be noted that the structure of Fig. 7 is merely illustrative, it is any can be by the core in multi-core processor to lamp
The structure controlled is all suitable for the embodiment of the present invention.
The embodiment of the present invention is directed to the method controlled the lamp in equipment and also provides a kind of calculating device-readable storage
Medium, that is, content is not lost after powering off.Software program, including program code are stored in the storage medium, when program code is being counted
When running in calculation equipment, which can realize in the embodiment of the present invention when being read and executed by one or more processors
The scheme that face any one controls the lamp in equipment.
Above by reference to showing according to the method, apparatus (system) of the embodiment of the present application and/or the frame of computer program product
Figure and/or flow chart describe the application.It should be understood that can realize that block diagram and or flow chart is shown by computer program instructions
The combination of the block of a block and block diagram and or flow chart diagram for figure.These computer program instructions can be supplied to logical
With the core and/or other programmable data processing units of computer, special purpose computer, to generate machine, so that via calculating
The instruction that machine core and/or other programmable data processing units execute creates for realizing institute in block diagram and or flow chart block
The method of specified function action.
Correspondingly, the application can also be implemented with hardware and/or software (including firmware, resident software, microcode etc.).More
Further, the application can take computer usable or the shape of the computer program product on computer readable storage medium
Formula has the computer realized in the medium usable or computer readable program code, to be made by instruction execution system
It is used with or in conjunction with instruction execution system.In the present context, computer can be used or computer-readable medium can be with
It is arbitrary medium, may include, stores, communicates, transmits or transmit program, is made by instruction execution system, device or equipment
With, or instruction execution system, device or equipment is combined to use.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art
Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to include these modifications and variations.