Specific embodiment
Below in conjunction with attached drawing in the embodiment of the present invention, technical solution in the embodiment of the present invention carries out clear, completeGround description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Usually existThe component of the embodiment of the present invention described and illustrated in attached drawing can be arranged and be designed with a variety of different configurations herein.CauseThis, is not intended to limit claimed invention to the detailed description of the embodiment of the present invention provided in the accompanying drawings belowRange, but it is merely representative of selected embodiment of the invention.Based on the embodiment of the present invention, those skilled in the art are not doingEvery other embodiment obtained under the premise of creative work out, shall fall within the protection scope of the present invention.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang YiIt is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Meanwhile of the inventionIn description, term " first ", " second " etc. are only used for distinguishing description, are not understood to indicate or imply relative importance.
Fig. 1 is please referred to, Fig. 1 shows embedded system structure schematic diagram provided in an embodiment of the present invention.In Fig. 1, insertionFormula system includes first memory 10, second memory 20, processor 30, dma controller 40, external equipment 50 and system bus60, external equipment 50 includes register 501, and first memory 10, second memory 20 and register 501 are sequentially connected electrically, DMAController 40 is electrically connected with first memory 10, second memory 20 and register 501, processor 30 and second memory 20It is electrically connected with dma controller 40, first memory 10, second memory 20, processor 30, dma controller 40, external equipment50 are electrically connected with system bus 60.
First memory 10 is for being stored in advance configurations table, wherein includes according to register 501 in configurations tableThe basic value of correspondence register 501 that is arranged successively of number.First memory 10 can be non-volatile memory medium, for example,Flash storage, read-only memory, Erasable Programmable Read Only Memory EPROM etc..
Second memory 20 is used for when embedded system powers on, and stores the configurations read from first memory 10Table.Second memory 20 can be volatile storage medium, for example, Static RAM, dynamic RAM etc..
Processor 30 is for being updated the configurations table in second memory 20 according to preset rules, firstly, placeManage the default initial address for the configurations table that device 30 obtains in second memory 20;Then, processor 30 is according to preset rulesDetermine the number and updated value of register 501 to be updated;Next, processor 30 is according to initial address and register to be updated501 number determines the destination address of basic value to be updated in second memory 20;Finally, processor 30 by updated value moreNewly into the destination address, to replace basic value to be updated, to be deposited for example, Fig. 2 shows provided in an embodiment of the present invention secondThe update exemplary diagram of configurations table in reservoir 20 includes 3 basic values in configurations table, wherein 12 be 0# registerBasic value, 34 be the basic value of 1# register, 56 be 2# register basic value, each basic value is in second memory 204 bytes are accounted for, presetting address of the basic value of 0# register in second memory 20 is 0X0000_0000,1# depositThe basic value of device and the basic value of 2# register are successively stored in the address of second memory 20 respectively from 0X0000_0000In 0X0000_0004 and 0X0000_0008, processor 30 determines that the number of register 501 to be updated is 2# according to preset rules,Updated value is 11, then destination address of the 2# register in second memory 20 are as follows: 0X0000_0000+4*2=0X0000_0008, updated value 11 is updated to 0X0000_0008 in the destination address by processor 20.
Dma controller 40 is used to store the configurations table that first memory 10 stores to second memory 20, andAccording to the updated configurations table initialization register 501 stored in second memory 20, when dma controller 40 need byWhen the configurations table that first memory 10 stores is stored to second memory 20, the first DMA is initiated to processor 30 first and is askedIt asks, processor 30 responds first DMA request and the controller of system bus 60 is transferred to dma controller 40, and then DMA is controlledThe configurations table that first memory 10 stores successively is transmitted in the second memory 20 by device 40 by system bus 60The initial address of configurations table is stored, when dma controller 40 is needed according to the base in updated second memory 20When plinth allocation list initialization register 501, the second DMA request is initiated to processor 30 first, processor 30 responds the 2nd DMAThe controller of system bus 60 is transferred to dma controller 40 by request, and then dma controller 40 passes through system bus 60 for secondThe configurations table that memory 20 stores successively is transmitted in corresponding register 501, and with initialization register 501, Fig. 3 is shownConfigurations table provided in an embodiment of the present invention between first memory 10, second memory 20 and the register 501 successivelyThe exemplary diagram of transmission, in Fig. 3, register 501 shares 3 in embedded system, be respectively as follows: 0# register, 1# register and2# register, it is suitable according to the arrangement of 0# register, 1# register and 2# register in the configurations table in first memory 10Sequence successively stores the basic value 56 of the basic value 12 of 0# register, the basic value 34 of 1# register and 2# register, DMA controlDevice 40 stores the configurations table in first memory 10 into second memory 20, and processor 30 is according to preset rules byThe basic value 34 of 1# register is revised as 11 in two memories 20, and dma controller 40 will be in modified second memory 20Configurations table is successively stored into corresponding register 501, i.e., the basic value stored in 0# register is initialized to 12,1#The basic value that the basic value stored in register is initialized to store in 11,2# register is initialized to 56.
External equipment 50 can be multiple, include at least one register 501 in each external equipment 50, multiple outsides are setStandby 50 number according to preset order, and then, multiple registers 501 in each external equipment 50 are also numbered according to preset order,When there is multiple external equipments 50, the basic value of the register 501 of configurations table storage is arranged according to the number of external equipment 50Column, wherein the number of the register 501 in each external equipment 50 arranges, for example, Fig. 4 shows offer of the embodiment of the present inventionConfigurations table exemplary diagram, in Fig. 4, embedded system includes 2 external equipments 50, is respectively as follows: 0# external equipment, outside 1#Portion's equipment, 0# external equipment include 3 registers 501, are respectively as follows: 0# register, 1# register and 2# register, set outside 1#Standby includes 3 registers 501, is respectively as follows: 3# register, 4# register, then the basic value stored in configurations table is successively rightThe register 501 answered are as follows: 0# register, 1# register, 2# register, 3# register, 4# register.
System bus 60 be used under the control of dma controller 40 by the configurations table in first memory 10 store toIn second memory 20, the configurations table in modified second memory 20 is stored into corresponding register 501, mostThe initialization of register 501 is completed eventually.
Compared with prior art, the embodiment of the present invention has the advantages that
Firstly, since in embedded system the basic value of most of register 501 be it is not changed, will be embeddedThe basic value of all registers 501 in system is stored in advance into first memory 10, in the process that register 501 initializesIn, processor 30 need to carry out more according to basic value of the preset rules to some registers 501 corresponding in configurations tableNewly, the utilization rate of processor 30 is significantly reduced, allow processor 30 in embedded system initialization procedure and is distributedAt other relevant operations, the time of embedded system initialization is considerably reduced.
Secondly, use dma controller 40 to be transmitted to configurations table in second memory 20 from first memory 10, withAnd be transmitted in corresponding register 501 from second memory 20, this data transfer mode efficiency of transmission is high, reduces initialChange the processing time of register 501, and then reduces the time of embedded system initialization on the whole.
Again, since first memory 10 is nonvolatile memory, configurations table is solidificated in first memory 10In, so that configurations table will not be lost because of power down.
Finally, due to the readwrite performance of second memory 20 is higher than first memory 10, after powering on by configurations table fromFirst memory 10 is stored to second memory 20, is updated in second memory 20 according to preset rules, so that basicThe renewal speed of allocation list is fast, high-efficient.
The embedded system provided based on the above embodiment, the embodiment of the invention also provides be applied to the embedded system501 initial method of register embodiment, referring to figure 5., Fig. 5 shows a kind of register provided in an embodiment of the present inventionInitial method flow chart, the described method comprises the following steps:
Step 101, the configurations table that first memory stores is stored to second memory by dma controller.
In embodiments of the present invention, register 501 is pressed into preset order number consecutively, the register in configurations table501 basic value is arranged according to the number of register 501, in the configurations table and second memory 20 in first memory 10Configurations table in the basic value of register 501 that stores and its put in order it is completely the same, due to first memory 10Reading and writing data speed is slower than the reading and writing data speed of second memory 20, therefore, by the configurations table in first memory 10It is stored by dma controller 40 into second memory 20, processor 30 can be made to match in second memory 20 to basisSetting renewal speed when table is updated, faster, to improve the efficiency of the initialization of register 501, final realize shortens embedded systemThe purpose of system initialization time.
Step 102, the configurations table in second memory is updated according to preset rules by processor.
In embodiments of the present invention, why configurations table is updated in second memory 20, is because theThe data read-write efficiency of two memories 20 is higher than first memory 10, it is thus possible to improve processor 30 updates configurations tableEfficiency.
Step 103, deposit is initialized according to the updated configurations table in second memory by dma controllerDevice.
In embodiments of the present invention, DMA is according to corresponding to register in configurations table in updated second memory 20The arrangement sequencing of 501 basic value will successively correspond to the basis of register 501 in configurations table in second memory 20Value is transmitted to corresponding register 501, completes the initialization of corresponding register 501.
Further, processor 30 can determine the basic value of register 501 to be updated according to preset rulesAddress and updated value in two memories 20, the application provides a kind of possible implementation, and on the basis of Fig. 5, Fig. 6 is thisAnother initialization of register method flow diagram that inventive embodiments provide, referring to Fig. 6, step 102 this method specifically includes:
Step 102-1, the default initial address of the configurations table in second memory is obtained;
Step 102-2, the number and updated value of register to be updated are determined according to preset rules;
Step 102-3, the number according to initial address and register to be updated determines that basic value to be updated is deposited secondDestination address in reservoir;
Step 102-4, updated value is updated in destination address, to replace basic value to be updated.
In the embodiment of the present invention, since the quantity for the register 501 for needing to update basic value in embedded system is to account for lessSeveral, therefore, processor 30 only needs the basic value to register 501 a small number of in second memory 20 to be updated, greatlyGround reduces the utilization rate of processor 30, shortens the time-consuming of initialization register 501.
Further, the configurations table in first memory 10 can be transmitted to second memory by dma controller 40It is stored in 20, and the updated configurations table in second memory 20 is transmitted in corresponding register 501 with firstThe corresponding register 501 of beginningization, the application provides a kind of possible implementation, and on the basis of Fig. 6, Fig. 7 is that the present invention is realAnother initialization of register method flow diagram of example offer is applied, referring to Fig. 7, step 101 this method specifically includes:
Step 101-1, the first DMA request is initiated to processor, so that the first DMA request of processor response is by system busControl right transfer to dma controller;
Step 101-2, the configurations table that first memory stores is transmitted in second memory by system busStorage;
Step 103, it specifically includes:
Step 103-1, the second DMA request is initiated to processor, so that the second DMA request of processor response is by system busControl right transfer to dma controller;
Step 103-2, the configurations table that second memory stores is transmitted to by register by system bus, with initialChange register.
In embodiments of the present invention, the transmission of basic value in configurations table, pole are carried out due to using dma controller 40The earth saves configurations table and is transmitted to second memory 20 from first memory 10 and is transmitted to from second memory 20The transmission time of register 501 further reduces the time-consuming of initialization register 501.
In embodiments of the present invention, configurations table can pre-generate, in order to cooperate provided in an embodiment of the present invention postStorage initial method improves the speed for passing through configurations table initialization register 501, and the embodiment of the invention provides one kindThe step of generation method of configurations table, please refers to Fig. 8, the generation method of configurations table include:
Step 201, each register is numbered according to preset order;
In embodiments of the present invention, the number order of each register 501 can be fixed in advance according to the demand of actual sceneJustice.
Step 202, the basic value of each register is obtained, and by the basic value of each register according to preset order tissueAt configurations table so that configurations table be used to store from first memory to second memory by dma controller andFor being updated in second memory by processor according to preset rules and for passing through dma controller after updatingInitialization register.
In embodiments of the present invention, preset order be not limited to be incremented by according to number or successively decrease according to number or otherSequentially, as long as basic value and register 501 correspond in configurations table.Configurations table is in first memory 10Storage mode, the sequence that can be incremented by according to address, can also be according to the sequence of decreasing addresses, wherein is incremented by according to addressSequence carries out being stored as preferred storage mode, because the sequential storage being incremented by using address, is matched basis by dma controller 40Set biography when table is transmitted into second memory 20 from first memory 10 and is transmitted to register 501 from second memory 20Defeated speed faster, finally makes 501 initial procedure of register more efficient.
It should be noted that as an implementation, the basic value in configurations table can be aligned with 32bit to be carried outStorage, it is therefore an objective to which basic value can be quickly located in first memory according to the number of the corresponding register 501 of basic valueThus storage address in 10 improves the speed for updating configurations table.
It should also be noted that, configurations table is in the storage mode and second memory 20 in first memory 10Storage mode is consistent, and purpose is transmitted into second memory 20 also for making configurations table from first memory 10When transmission speed faster.
In conclusion a kind of initialization of register method provided by the invention, the generation method and insertion of configurations tableFormula system, the method are applied to the embedded system, and embedded system includes first memory, second memory, depositDevice, dma controller and processor, first memory, second memory and register are sequentially connected electrically, dma controller and firstMemory, second memory and register are electrically connected, and processor is electrically connected with second memory and dma controller, describedMethod includes: to be stored the configurations table that first memory stores to second memory by dma controller, wherein basisAllocation list includes the corresponding basic value of register;By processor according to preset rules to the configurations table in second memoryIt is updated;By dma controller according to the updated configurations table initialization register in second memory.With it is existingTechnology is compared, and the present invention is by being organized into configurations according to preset order for the basic value of the register in embedded systemTable, dma controller are responsible for configurations table and copy to second memory from first memory and copy to from second memoryRegister, processor is responsible in second memory being on demand updated configurations table, at the beginning of reducing embedded systemThe utilization rate of processor during beginningization, to substantially reduce the time of embedded system initialization.
In several embodiments provided herein, it should be understood that disclosed device and method can also pass throughOther modes are realized.The apparatus embodiments described above are merely exemplary, for example, flow chart and block diagram in attached drawingShow the device of multiple embodiments according to the present invention, the architectural framework in the cards of method and computer program product,Function and operation.In this regard, each box in flowchart or block diagram can represent the one of a module, section or codePart, a part of the module, section or code, which includes that one or more is for implementing the specified logical function, to be heldRow instruction.It should also be noted that function marked in the box can also be to be different from some implementations as replacementThe sequence marked in attached drawing occurs.For example, two continuous boxes can actually be basically executed in parallel, they are sometimesIt can execute in the opposite order, this depends on the function involved.It is also noted that every in block diagram and or flow chartThe combination of box in a box and block diagram and or flow chart can use the dedicated base for executing defined function or movementIt realizes, or can realize using a combination of dedicated hardware and computer instructions in the system of hardware.
In addition, each functional module in each embodiment of the present invention can integrate one independent portion of formation togetherPoint, it is also possible to modules individualism, an independent part can also be integrated to form with two or more modules.
It, can be with if the function is realized and when sold or used as an independent product in the form of software function moduleIt is stored in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially in other wordsThe part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, the meterCalculation machine software product is stored in a storage medium, including some instructions are used so that a computer equipment (can be aPeople's computer, server or network equipment etc.) it performs all or part of the steps of the method described in the various embodiments of the present invention.And storage medium above-mentioned includes: that USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), arbitrary access are depositedThe various media that can store program code such as reservoir (RAM, Random Access Memory), magnetic or disk.It needsIllustrate, herein, relational terms such as first and second and the like be used merely to by an entity or operation withAnother entity or operation distinguish, and without necessarily requiring or implying between these entities or operation, there are any this realitiesThe relationship or sequence on border.Moreover, the terms "include", "comprise" or its any other variant are intended to the packet of nonexcludabilityContain, so that the process, method, article or equipment for including a series of elements not only includes those elements, but also includingOther elements that are not explicitly listed, or further include for elements inherent to such a process, method, article, or device.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including the elementProcess, method, article or equipment in there is also other identical elements.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this fieldFor art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, made any to repairChange, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.It should also be noted that similar label and letter existSimilar terms are indicated in following attached drawing, therefore, once being defined in a certain Xiang Yi attached drawing, are then not required in subsequent attached drawingIt is further defined and explained.