Background technology
All comprise the chip with data processing function in a lot of digital products, such as digital signal processor (DSP).Because the at present restriction of DSP internal storage space, the data that DSP adopts external memorizer to deposit self loading procedure or need power down to preserve more.The storer that is used for this kind application has EPROM, EEPROM, Flash etc.
Please refer to Fig. 1, Fig. 1 is a kind of module diagram of data-storage system of prior art.This data-storage system 1 comprises a processor 11 and a storer 12 of communicating by letter with processor 11.The operations such as storer 12 is preserved the program of processor 11 operation, and processor 11 can carry out reading and writing to storer 12, wipe.
Processor 11 has a group address pin 111, one group of data pin 112 and a plurality of control pin 110.A plurality of control pins 110 comprise that first universal input output (GPIO) pin 113, one read to enable (RE) pin 114, one and write and enable (WE) pin 115 and second a universal input output pin 116.Storer 12 has an address pin 121, one group of data pin 122 and a plurality of controlled pin 120.A plurality of controlled pins 120 comprise that sheet choosing (CE) pin 123, an output enable (OE) pin 124, one are write and enable (WE) pin 125 and a write-protect (WP) pin 126.
Address pin 111 and 121 corresponding linking to each other of address pin; data pin 112 and data pin 122 corresponding connections; the first universal input output pin 113 selects pin 123 to be connected with sheet; reading enable pin 114 is connected with output enable pin 124; write enable pin 115 and write enable pin 125 and be connected, the second universal input output pin 116 is connected with write-protect pin 126.
The write-protect pin 126 of storer 12 has an effective status (low level) and a disarmed state (high level).When write-protect pin 126 is in effective status, storer 12 will be forbidden the data that processor 11 is revised on it, namely forbid storer 12 is carried out write operation and erase operation.
The sheet of storer 12 selects pin 123 to have an effective status and a disarmed state.When needs operate this storer 12, sheet need to be selected pin 123 place effective status, select this storer 12.
The enable pin 125 of writing of storer 12 has an effective status and a disarmed state.When with the writing enable pin 125 and place effective status of storer 12, then expression can be carried out write operation and erase operation to the storage element of assigned address.
The output enable pin 124 of storer 12 has an effective status and a disarmed state.When the output enable pin 124 with storer 12 placed effective status, then expression can be carried out read operation to the storage element of assigned address.
When processor 11 carries out read operation at needs to storer 12, thereby select pin 123 to place effectively word-select memory 12 sheet by the first universal input output pin 113; Thereby output enable pin 124 is placed the authority of the read operation of the storer 12 of effectively performing fighting by reading enable pin 114; The access unit address that needs is read by address pin 111 sends to storer 12; By data pin 112 the required data that read are read back.
When processor 11 carries out write operation at needs to storer 12, thereby select pin 123 to place effectively word-select memory 12 sheet by the first universal input output pin 113; Thereby will write the authority that enable pin 125 places the write operation of the storer 12 of effectively performing fighting by writing enable pin 115; The access unit address that needs is write by address pin 111 sends to storer 12; By data pin 112 the required data that write are written on the corresponding storage unit.
But, because the enable pin 125 direct enable pin 115 of writing of being connected with processor of writing of storer 12 connect, therefore processor 11 only depends on and writes enable pin 115 and do not need to add the authority that any control or checking namely can have been controlled storer 12 write operations, cause data on the storer 12 to be modified because of maloperation or lose may be higher, namely the security of data is relatively poor on the storer 12.
Summary of the invention
In order to solve the relatively poor problem of conventional data storage system data security, be necessary the data-storage system that provides a kind of data security higher.
A kind of data-storage system, comprise a processor and a storer that is connected with described processor, described data-storage system also comprises an arbitration circuit that is connected with described storer with described processor, be preset with an operation in the described arbitration circuit pre-conditioned, described processor can send a functional check code to described arbitration circuit when needs operate described storer, described arbitration circuit satisfies described operation at described functional check code makes described storer to described processor open operation authority when pre-conditioned.
In the middle of the data-storage system of the present invention, described storer can be the electronic component that FLASH, EPROM or EEPROM etc. have data storage capacities.
In the middle of the data-storage system of the present invention, described arbitration circuit can be CPLD (CPLD), programmable logic array (PLA), field programmable logic array (FPLA) (FPLA), generic array logic (GAL) or field programmable gate array (FPGA).
In the middle of the data-storage system of the present invention, described open operation authority refers to allow processor that storer is operated.
In the middle of a better embodiment of data-storage system of the present invention, be preset with an operation code presupposition in this arbitration circuit, described operation is pre-conditioned to be that described functional check code is identical with described operation code presupposition.
Data-storage system of the present invention is owing to the operation that utilizes described arbitration circuit that described processor is asked is verified, checking is by just opening the operating right of described storer, so that described processor can not directly obtain the operating right of described storer, and then so that on the described storer security of data higher.
The data access method that the present invention also provides described data-storage system to adopt simultaneously.
The data access method that a kind of data-storage system of the present invention adopts, it comprises the steps:
Processor is to arbitration circuit transmit operation request;
Processor is to arbitration circuit transmit operation check code;
It is pre-conditioned whether the decision operation check code meets operation, if eligible, then the operating right of open memory and notification processor can operate, continue to carry out follow-up step, if ineligible, then notification processor cannot operate, and no longer carries out follow-up step;
Processor operates storer.
Data access method of the present invention is owing to the operation that utilizes described arbitration circuit that described processor is asked is verified, checking is by just opening the operating right of described storer, so that described processor can not directly obtain the operating right of described storer, and then so that adopt the security of data on the storer of this method higher.
Embodiment
Please refer to Fig. 2, Fig. 2 is the module diagram of data-storage system one better embodiment of the present invention.This data-storage system 2 comprises a processor 21, storer 22, arbitration circuit 23, one group of data bus 24 and a group address bus 25.This processor 21 is DSP, and this storer 22 is Flash, and this arbitration circuit 23 is CPLD.
As other embodiment, this processor 21 can be the chip that CPU or MCU etc. have the program executive capability.This storer 22 can be the electronic component that EPROM or EEPROM etc. have data storage capacities.This arbitration circuit 23 can be programmable logic array, field programmable logic array (FPLA), generic array logic or field programmable gate array.
This processor 21 comprises one group of data pin 211, a group address pin 212 and a plurality of control pin 210.These a plurality of control pins 210 comprise that first a universal input output pin 213, second universal input output pin 214, one write enable pin 215 and one and read enable pin 216.
This storer 22 comprises one group of data pin 221, a group address pin 222 and a plurality of controlled pin 220.These a plurality of controlled pins 220 comprise that writing enable pin 223, a write-protect pin 224, a sheet for one selects pin 225 and an output enable pin 226.
Described arbitration circuit 23 comprises a plurality of input and output pins 230.
First 233 in a plurality of input and output pins 230 of the address pin 212 of this processor 21, the address pin 222 of this storer 22 and this arbitration circuit 23 all is connected on this address bus 25.Second portion 234 in a plurality of input and output pins 230 of the data pin 211 of this processor 21, the data pin 221 of this storer 22 and this arbitration circuit 23 all is connected on this data bus 24.This first universal input output pin 213, the second universal input output pin 214, write enable pin 215 and read on the third part 235 of a plurality of input and output pins 230 that enable pin 216 all is connected to arbitration circuit 23 correspondingly.The write enable pin 223, write-protect pin 224, sheet of this storer 22 select pin 225 and output enable pin 226 all to be connected to correspondingly on the 4th part 236 of a plurality of input and output pins 230 of arbitration circuit 23.Above-mentioned connected mode is so that the processor 21 controlled pin 220 of Direct Attached Storage device 22 not, but the control pin 210 of processor 21 and the controlled pin 220 of storer 22 all are connected to arbitration circuit 23, judged whether the authority of carrying out various operations to 21 pairs of storeies of preprocessor 22 by arbitration circuit 23 unifications.
The enable pin 215 of writing of this processor 21 is effective status when this processor 21 is carried out write operation, otherwise is in disarmed state.Reading enable pin 216 is effective status when this processor 21 is carried out read operation, otherwise is in disarmed state.The first universal input output pin 213 is configured to come word-select memory 22 for sending chip selection signal.The second universal input output pin 214 is configured to for sending whether write-protect of write protect signal control store 22.
The write-protect pin 224 of storer 22 has an effective status (low level) and a disarmed state (high level).When write-protect pin 224 is in effective status, will carry out write-protect to storer 22, otherwise with not write-protect.Wherein, write-protect refers to that storer 22 will forbid that processor 21 or other elements revise the data on it, namely forbids storer 22 is carried out write operation or erase operation.
The sheet of storer 22 selects pin 225 to have an effective status and a disarmed state.When selected this storer 22 of needs operates, sheet need to be selected pin 225 place effective status, select this storer 22.
The enable pin 223 of writing of storer 22 has an effective status and a disarmed state.When with the writing enable pin 223 and place effective status of storer 22, then expression can be carried out write operation or erase operation to the storage element of assigned address.
The output enable pin 226 of storer 22 has an effective status and a disarmed state.When the output enable pin 124 with storer 12 placed effective status, then expression can be carried out read operation to the storage element of assigned address.
Arbitration circuit 23 has inner ROM (or external ROM) and RAM, mode that can be by programming within it section to be preset with the pre-conditioned and a plurality of shutoff operations of a plurality of operations pre-conditioned and with its operation.And above-mentioned programming to arbitration circuit 23 is cured among the inside ROM (or external ROM) of arbitration circuit 23 by downloading wire or editing machine after can be on PC programming being finished, and automatically load operating powers on namely at every turn.
These a plurality of operations are pre-conditioned to be comprised one write operation is pre-conditioned and a read operation is pre-conditioned.These a plurality of shutoff operations are pre-conditioned comprise one close write operation pre-conditioned and one to close read operation pre-conditioned.Processor 21 need to send a functional check code to arbitration circuit 23 when needs carry out respective operations (such as write operation or read operation) to storer 22.If it is pre-conditioned that the functional check code satisfies corresponding operation, then 23 pairs of processors of arbitration circuit 21 are opened corresponding operating rights.Wherein, so-called " open corresponding operating right " refers to allow 21 pairs of storeies of processor 22 to carry out corresponding operation.Similarly, processor 21 need to send a shutoff operation check code to arbitration circuit 23 when needs are closed respective operations (as close write operation or close read operation) to storer 22.If it is pre-conditioned that the shutoff operation check code satisfies corresponding shutoff operation, then 23 pairs of processors 21 of arbitration circuit cut out corresponding operating right, if opening dissatisfied then that keep authority.Wherein, so-called " closing corresponding operating right " namely do not allow 21 pairs of storeies of processor 22 to carry out corresponding operation.
Please in the lump with reference to Fig. 2 and Fig. 3, Fig. 3 is the flow chart of steps that data-storage system shown in Figure 2 is carried out write operation.The below carries out write operation as example take data-storage system 2, and each included step of data access method that data-storage system 2 adopts is described:
Step 1, processor 21 send write operation requests to arbitration circuit 23;
The enable pin 215 of writing of processor 21 becomes effectively, be write operation so that arbitration circuit 23 determines that processors 21 requests carry out, and then it is pre-conditioned to call corresponding write operation.
Step 2, processor send the write operation check code to arbitration circuit 23;
Processor 21 sends write operation check code by address bus 25 and data bus 24 to arbitration circuit 23 by address pin 212.Be specially the specific storage unit by the RAM of address bus 25 selected arbitration circuits 23, write this write operation check code by data bus 24 to this specific storage unit again.
Whether step 3, decision operation check code meet that operation is pre-conditioned, if eligible, then the write operation authority of open memory 22 and notification processor 21 can carry out write operation, continue to carry out follow-up step; If ineligible, then notification processor 21 cannot carry out write operation, keep storer 22 the write operation authority close and no longer carry out follow-up step;
These arbitration circuit 23 internal preset have a write operation code presupposition, and whether this write operation is pre-conditioned equals this write operation code presupposition for this write operation check code.That is, if this write operation check code equals this write operation code presupposition, then this arbitration circuit 23 by input and output pin 230 output low levels of correspondence so that the enable pin 223 of writing of this storer 22 is in effective status.Simultaneously, this arbitration circuit 23 sends one by address bus 25 and allows operation signal to feed back to processor 21 can to carry out write operation with notification processor 21.If this write operation check code is not equal to this write operation code presupposition, then this arbitration circuit 23 sends one by address bus 25 and does not allow operation signal to feed back to processor 21 cannot to carry out write operation with notification processor 21, and continue to keep storer 22 write enable pin 223 for high level to be in disarmed state.Like this, even if processor 21 still continues to attempt this storer 22 is carried out write operation, also can place disarmed state and make the write operation can not be successful because of the write enable pin 223 of this arbitration circuit 23 with storer 22.For example, this write operation check code for example is binary number 1010, and this write operation code presupposition is 1000, because 1010 be not equal to 1000, therefore can not open the write operation authority.
Step 4,21 pairs of storeies of processor 22 carry out write operation;
Above-mentioned steps 4 comprises again following concrete step 4.1~4.3:
The access unit address that step 4.1, processor 21 send erase command and need to wipe;
For the storer 22 that present embodiment is given an example, a plurality of storage unit that storer 22 inside have special-purpose fixed address are used for the deposit operation instruction, and a plurality of storage unit of these fixed address are called as control register.Therefore in the present embodiment, so-called " processor 21 sends erase command " is the control code that writes erase operation to the control register of storer 22.For example, wipe second sector of 21 pairs of storeies 22 of processor, and second sector start address is assumed to 0x10000, and the erase operation process is so:
A. write 0xAA by data bus 24 to the 0x10555 address
B. write 0x55 by data bus 24 to the 0x102AA address
C. write 0x80 by data bus 24 to the 0x10555 address
D. write 0xAA by data bus 24 to the 0x10555 address
E. write 0x55 by data bus 24 to the 0x102AA address
F. write 0x30 by data bus 24 to the 0x10000 address
Certainly, above-mentioned only is that a kind of erase operation of storer is done illustrates, and for dissimilar storer, mode of operation and control code are all different, but this is common-sense technology known in those skilled in the art.
And the access unit address that need to wipe sends by address bus 25.
Step 4.2, processor 21 send the data that write order, the access unit address that need to write and need to write;
The control register that this process remains 21 pairs of storeies 22 of processor writes control code, and method is identical with erase process (step 4.1), and only address and order are different, do not give unnecessary details here.
Step 4.3, data writing;
Step 4.4, inspection data correctness;
In the middle of present embodiment, be the data of write operation institute write store 22 to be read back compare with the data that processor 21 sends to the inspection of data correctness.If write correctly, then continue to carry out next step, if write error, then continuing to judge whether is write error for the first time: if write error for the first time then comes back to and execution in step 4.1; If not the write error first time, then send error message to processor 21, and carry out next step.
Step 5, processor 21 send to arbitration circuit 23 and close the write operation check code, judge whether close the write operation check code meets that to close write operation pre-conditioned, if eligible, then close the write operation authority of storer 22; If ineligible, then keep standing state and do not change;
In order to prevent interrupt operation wrong in operating process and then data to be destroyed, so also can being set when shutoff operation, a step 5 comes shutoff operation is carried out a checking.The operating process of step 5 and step 2~3 are similar.Herein, shutoff operation is pre-conditioned can be preset to the same condition with operation is pre-conditioned, also can be preset to different condition.
Data-storage system 2 of the present invention is owing to the control pin 210 of processor 21 is not directly connected on the controlled pin 220 of storer 22, but by these arbitration circuit 23 controls, therefore can utilize the operation of 23 pairs of processors of arbitration circuit, 21 requests to verify, so that the security of data is higher on the storer 22.
It is described that the present invention is not limited to above-mentioned embodiment, also has all shape changeable embodiments, for example:
One, such as Fig. 4, can utilize control pin 510 transmit operation check codes (being the functional check code),
So then need not address bus 55 and data bus 54 are connected to arbitration circuit 53.
Two, the processor 21 of data-storage system 2 of the present invention and storer 22 all are not limited to one.For example: this data-storage system also comprises another processor, this another processor sends another functional check code to this arbitration circuit when needs operate described storer, this arbitration circuit satisfies this at this another functional check code and operates and make this storer to this another processor open operation authority when pre-conditioned.Like this, can be by different processors or storer be arranged different functional check codes or operate the pre-conditioned step control of carrying out.
Three, such as Fig. 5, the part of this control pin 610 and controlled pin 620 can be connected on the arbitration circuit 63,63 pairs of part operations of arbitration circuit are verified.As, only will write enable pin 615 and write enable pin 623 and be connected to arbitration circuit 63, so that only write operation is verified.
Four, operation is pre-conditioned and shutoff operation is pre-conditioned can also have various ways, for example operates pre-conditionedly can also be: when functional check code during greater than a code presupposition, and the open operation authority.
Five, data-storage system 2 of the present invention can a plurality of operations are pre-conditioned to be controlled storer 22 different data segments (such as the sector) by arranging.
Six, the arbitration circuit 23 of data-storage system 2 of the present invention can also be used for realizing address decoding, system clock control, the functions such as electrifying timing sequence control.
Seven, in addition, data-storage system of the present invention can be used in the middle of the plurality of devices, such as the mobile phone of consumer product area, multimedia player, notebook computer etc. can also be the digital oscilloscope of measuring field tests, digital multimeter, signal generator etc.
The above; be the specific embodiment of the present invention only, but protection scope of the present invention is not limited to this, anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; can expect easily changing or replacing, all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention all should be as the criterion with the protection domain of claim.