1. Field of the Invention
The present invention relates to an optical transceiver implemented with a micro-processor.
2. Related Prior Art
One type of an optical transceiver implements a controller that provides an electrically erasable and programmable read only memory (hereafter denoted as EEPROM) for users to write field data therein. A multi-source agreement regarding the SFP+ type optical transceiver has rules that the EEPROM with user rewritable area of 120 bytes is implemented. A Japanese Patent Application published as JP-H08-171545A has disclosed that the user rewritable EEPROM memory is realized by a flash memory integrated within a micro-controller unit (hereafter denoted as MCU) to reduce the number of components installed within the system.
The rewriting of such a flash memory is generally carried out by a block as one unit, while, the number of rewriting of the flash memory is often restricted by an inherent characteristic of the flash memory or by the specification of the system such as the SFP+ transceiver that installs a flash memory. Another Japanese Patent Application has disclosed to reduce the number of the writing or the erasing of the block in the flash memory by writing difference data in different blocks.
In the procedure that the difference data is written in the flash memory, a series of procedures to rearrange the rewritable area, to erase the flash memory and to write the rearranged data is necessary. Occasionally, it takes much time to complete these procedures and exceeds the standard time defined in the specification of the system such as the SFP+ optical transceiver. The SFP+ standard sets the execution time to rearrange the flash memory to be 40 mS, while, some microprocessors require a time to erase the flash memory implemented therein to be 36 mS and another time to write 120 bytes data to be 71 μs×120=8.52 mS, a total of 44.52 mS, which exceeds the time assigned to rearrange the flash memory in the SFP+ standard.
The preset application provides, in a system with a micro-controller implemented with a flash memory, a new algorithm to rearrange the data stored in the flash memory to shorten the process time thereof.
One aspect of the present invention relates to a method to use a flash memory that sequentially stores data and provides at least two blocks each exclusively taking an active mode and an inactive mode. The method of the invention has a feature that, when the active block is detected to be filled, the inactive block is erased before the data next to be stored is received, and after receiving the data next to be stored and storing then into the inactive block, the inactive block is changed to be active, while, the active block is changed to be inactive.
Each block may have an allocation for an area for base data, an area for active flag, an area for inactive flag, and a plurality of areas for difference data. When the areas for difference data in the active block is detected to be filled, the whole inactive block is erased before the data next to be stored is received. When the inactive block is firstly set by the user data, a replica data is created on the RAM by procedures of: (1) fetching the base data stored in the area for base data and all difference data stored in the areas for difference data from the currently active block into the RAM; (2) creating a new based data to be stored in the flash memory based on thus fetched base data, the plurality of difference data, and the data to be next stored; and (3) then, thus created replica data is transferred into the inactive block of the flash memory. Synchronizing with the transfer of the replica data, an inactive flag is set in the area for inactive flag in the currently active block to change the mode of the currently active block to be inactive.
The method according to the present invention may be preferably implemented in an optical transceiver following the standard of the SFP+ pluggable transceiver, in which the time to rewrite the flash memory is strictly restricted. Because the method according to the present invention, the erase of an inactive block of the flash memory is carried out synchronized with the detection of the no user data area in the active block before the reception of the next data to be stored, and when the data next to be stored is received, only the creating of the new base data is performed. That is, the present invention divides two processes of erasing block and writing data into the erased block, which are conventionally done at one time, into independently carried out processes.
The foregoing and other purposes, aspects and advantages will be better understood from the following detailed description of a preferred embodiment of the invention with reference to the drawings, in which:
Next, preferred embodiments of the present invention will be described as referring to accompanying drawings. In the description of the figures, the same numeral or the symbol will refer to the same element without over lapping explanations.
The TOSA 12 includes a semiconductor light-emitting device, typically a laser diode (LD), a light-receiving device such as photodiode (PD) to monitor a magnitude of the light emitted from the LD. The TOSA 12 emits signal light responding to a driving current provided from the transceiver IC 16. The driving current is modulated in the transceiver IC 16 by the Tx data, while, the magnitude thereof is controlled by a signal output from the PD installed within the TOSA 12. The ROSA 14 includes another PD to generate a photocurrent responding to the light provided from an external fiber coupled with the ROSA 14.
The transceiver IC 16 modulates the driving current, whose magnitude depends on the signal output from the PD in the TOSA 12 and signals provided from the controller 18 as mentioned above, based on the Tx data provided from the host device on which the transceiver 10 is installed. Further, the transceiver IC 16 outputs the Rx data, which reflects the optical signal received by the ROSA 14, to the host device. The transceiver IC 16 is coupled with the controller through the internal bus 20.
The controller 18 includes a central processing unit
(CPU) 22, a type of volatile memory 24, which is often called as random access memory (RAM), and a type of non-volatile memory, 110002-US Ishibashi typically a flash memory with a rewritable function 26. The non-volatile memory 26 may be a type of electrically erasable and programmable read only memory, which is often called as EEPROM. The CPU 22 operates according to a program stored in the EEPROM 26. The RAM 24 is for temporarily storing data therein. Reading and writing the data from/to the EEPROM 26 will be described later.
Each block, 32a and 32b, includes an area for the block active flag, 34a and 34b, an area for the block inactive flag, 36a and 36b, an area for the base data, 38a and 38b, and a plurality of areas for difference data, 40a1 to 40aM and 40b1 to 40bM, where M is an integer greater than unity. These two blocks 32a and 32b are exclusively active, that is, when the front block 32a is active in reading/writing the data therefrom/thereto, the active flag is set in the area for the active flag 34a, while, the inactive flag is set in the area for the inactive flag in the back block 32b.
On the other hand, when the back block 32b is used for reading/writing the data therefrom/thereto, the area for the active flag in the back block 32b sets the active flag and the area for the inactive flag area in the front block 32a sets the inactive flag. Generally, when a flash memory is rewritten, that is, a new data is set in a memory cell, it is necessary to erase all cells including the target cell to be rewritten first; subsequently only the state “1” may be written into the target cell. Accordingly, it is unable to reset the active flag or the inactive flag reflecting the active mode of the blocks. Therefore, the inactive flag has the priority in the present embodiment of the non-volatile memory 26.
The areas for the base data, 38a and 38b, hold the base data; while, respective areas for the difference data, 40a2 to 40aM and 40b1 to 40bM, store data that denotes a difference from those stored in respective areas for the base data, 38a and 38b. In an example, the data stored in the area for the base date, 38a or 38b, are the magnitude of the driving current for the LD and the maximum condition thereof, the preset optical power emitted from the LD and monitored by the PD in the TOSA 12, where the optical power depends on the magnitude of the driving current, or the threshold of the input optical power received by the ROSA 14, and so on.
Next, the reading/writing the data by the CPU 22 will be described. When the CPU 22 receives a request to read the data through an operating program or an interruption, the CPU reads the data stored in the area for the base data, 38a or 38b, and a series of the difference data stored in the areas for the difference data, 40a1 to 40aM or 40b1 to 40bM, in the block whose active flag is set, and sets thus read data in the RAM 24. Next, the CPU 22 revises the base data by the series of the difference data and rewrites thus revised data in the RAM 24.
Next, a procedure to write data will be described.
As shown in
When the index k is equal to M, that is, only one area 40M for the difference data is left in the front block 32a, the CPU 22 writes the difference data just received from the host device into the top area 40M at step S10. Then, the CPU 22 erases the whole back block 32b at step S12 and increases the index k by one, which means that the index k becomes M+1. Further, when the index k is equal to M+1 at step S2, which means that no areas for the difference data are left in the front block 32a, the CPU 22 rearranges the back block 32b at step S22. Specifically, the CPU 22 prepares in the RAM 24 the new base data by reading the current base data held in the area 38a in the front block 32a, all difference data stored in the areas 401 to 40M into the RAM 24, and creating the new base data by counting the series of difference data and currently received difference data with the original base data at step S20.
Then, the CPU 22 sets the inactive flag in the inactive flag area 36a of the front block 32a, step S22; while, set the active flag in the area 34b for the active flag at step S24. Because the inactive flag has the priority, the front block 32a becomes inactive even the active flag is set in the area for the active flag 34a. Then, the CPU 22 writes the new base data in the area 38b for the base data in the back block 32b, and sets the index k=1, step S28.
Thus, the procedures from step S20 to S28 omit the operation to erase the back block 32b, where the erasing of the back block 32b is carried out in advance at step S18 when the last area 40M for the difference data in the front block 32a is filled, which may shorten the time to write data in the non-volatile memory. For instance, assuming that step S10 that writes data in the top area 40M for the difference data carries out by a rate of 71 μs/byte for data with length of 11 bytes and step S12 to erase the whole back block 32b spends 36 mS, then, steps S10 to S12 spend 36.8 mS in total.
Further, assuming that each of the active flag and the inactive flag has a length of one byte, the area for the base data allocates 120 bytes, and the write time for the non-volatile memory is 71 μs/byte; steps S23 to S26 spend (120+1+1)×71 μS=8.7 mS. That is, steps S10 to S12 and steps S23 to S28 are each carried out within 40 mS, which satisfies the standard set for the SFP+ pluggable optical transceiver.
While there has been illustrated and described what are presently considered to be example embodiments of the present invention, it will be understood by those skilled in the art that various other modifications may be made, and equivalents may be substituted, without departing from the true scope of the invention. Many modifications may be made to adapt a particular situation to the teachings of the present invention without departing from the central inventive concept described herein.
For instance, Although the flow chart shown in
Number | Date | Country | Kind |
---|---|---|---|
2009-029773 | Feb 2009 | JP | national |