[abstract]: The VxWorks operating system provides the filing system to visit and to manage the Flash memory, this way cannot satisfy real-time reads in with the system controllable request. This article proposed that one kind controls Flash through the control system clock interrupt the Memory read-write operation and based on the administrative district simple controllable document management plan, realizes the mobile communication system, in does not affect the service module movement under the premise, satisfies to timeliness and the controllability request.
[key word]: Dodges saves; System clock; Interrupt; Filing system;
1. Introduction
cdma2000 the 1x mobile communication system’s base depot main processor uses WindRiver Corporation VxWorks embedded real-time operating system, selects the FLASH memory (to hereafter refer to as FLASH) to take the external storage unit preservation system parameters and the service data.
FLASH and the ordinary magnetic dielectric memory biggest difference lies in writes the operating mode to be different, it writes the operation to be opposite in the ordinary floppy disk is the quite slow process, consumes the massive CPU resources. FLASH writes the operating mode based on the order character to cause to read in the mistake, although the probability is very small, but in fact is the existence. But the commercial VxWorks operating system provides dosFs filing system and special-purpose TrueFFS filing system to this situation processing insufficiency, and user not corresponding sound code, system, once appears writes the operation mistake, the uncontrolled system, reduced system’s controllability. Therefore, it is necessary to improve or the control to the FLASH accessing operation, and designs the special-purpose FLASH document management plan which a set corresponds, satisfies the system controllability request.
2. Deposit design
FLASH writes the operation to complete based on the order character way, divides into cleans (erase) and programs the (program) two stages. Because the FLASH programming instruction can only cause “1″ to change “0″, the cleaning instruction can only cause “0″ to change “1″, moreover, the cleaning operation cannot carries on the byte or the random data area, but must be a complete sector, therefore to FLASH some position write data time, must clean the target location first in sector all data, then can carry on the programming operation. In fact, only need read in the standard to the specific register the command sequences, the concrete cleaning and the programming process may the algorithm execution which inserts by the interior.
2.1 design concepts
Usually, after FLASH writes operational order issuing, completes the order character by the driver the establishment. This time, data by temporary memory in FLASH latch, but the system still needed to maintain the data bus terminates until the write operation or completes only then releases. A sector’s cleaning is several milliseconds time, a byte’s read-in is several microsecond time, may see that the data bus took the process to consume the massive CPU time. This part of resources saved regarding the embedded real time system are necessary. The operating system definitely may after the establishment writes the operational order character releases the data bus, withdraws from the FLASH operation, uses for the cleaning/programming process’s CPU time to carry out other instructions, after and so on current order character execution finished, through some event’s triggering, causes CPU to skip the establishment next order character. This is improves the FLASH operating process the design concept.
2.2 realize the process
The trigger event choice and the skipping cycle length’s control is the question solution key, namely after an order character operation completes, selects any way triggering next order character operation. May consider the way mainly has the scanning way and the interrupt mode.
Through scanning way, when the application procedure completes a time complete processing period, scans some sign condition, judges the FLASH write operation whether to carry on completes. If completes, then establishes the order character to carry on the operation once more. Because the program processing cycle is decided by the application layer handling of traffic time, this way will cause the triggering cycle not to be fixed.
Uses the interrupt mode, may control the triggering cycle through the establishment interrupt frequency. But must choose the appropriate interrupt source, enables its precision to meet the requirements, and to system not extra influence. Because the base-station system uses exterior GPS clock, system’s veneer clock idle, its precision regarding the FLASH operation is enough, therefore may consider that chooses the CPU clock interrupt. The question lies in VxWorks to this to interrupt whether to have the use. In fact, VxWorks completes the system register through this clock interrupt, thus realizes the system timer in its foundation, watch-dog timer, function modules and so on duty time sharing dispatch. Therefore, takes over control the clock interrupt, must while revise the clock rate, guaranteed the operating system needs the system register frequency is invariable.

VxWorks provides when the sysClkConnect() function permission clock interrupt occurs, according to assigns the parameter to hang meets the user definition the interrupt handling routine, after the interrupt processing completes, by the user program returns. VxWorks provides the usrClock() function is the system default clock interrupt processing function, uses for to transfer counter function tickAnnounce(), realizes the system counter function. The clock interrupt frequency establishes by SYS_CLK_RATE, the default value is 60. Therefore, we when replace clock interrupt processing function, needs to contain operating system’s register function tickAnnounce(), and before the frequency division method guaranteed that tickAnnounce() the transfer and the clock rate revise the transfer frequency are consistent, thus causes the operating system counter not to be able to feel that the clock rate revision and the interrupt processing function the difference which replaces.
Certainly, the system clock frequency’s establishment cannot be too high, usually the clock rate establishment is 60HZ (or 100HZ), when the frequency surpasses 600HZ, will cause the essence dispatcher time ratio to be high, but the actual duty available CPU time will drop, the processor will spend the majority time to process the clock to cause the systems operation efficiency to drop or not available.
Figure 1 gave concretely has realized the flow chart. sysClkChange() is from the definition system clock frequency control steering function, this function basis intake conditions establishment system clock interrupt frequency, the choice hangs meets the interrupt processing function flsClock() or usrClock(). Through transfers the usrClock() function from definition interrupt processing function’s flsClock() to complete the system counter function. sysClkRateGet() and the sysClkRateSet() function is the clock rate establishment function which VxWorks provides.
flsClock() also needs to be responsible for the actual write operation. First inspects in the previous interrupt processing FLASH to operate whether already to complete. If has not completed, then returns, and records the returns number of times, if the returns number of times has surpassed certain limit, namely thought that this piece of FLASH breaks down, sends out the FLASH fault warning to the application layer; If already completed, then starts to carry on this operation, namely determined the first operation the type (cleaning or programming) and the related parameter (including goal sector serial number, destination address, data pool address and so on), the FLASH operation connection which then the transfer driver provides, completes operations and so on order character establishment.
3. Management design
In the I/O system basic structure, the application procedure may through the meet standards I/O connection filing system transfer device driver operating equipment, may also connect the operating equipment with the driver (VxWorks itself not to support this procedure) directly. Usually, uses the filing system to operate access facilities’ way, reduced the I/O operation connection function number which the driver must support, obtains the widespread application in the VxWorks development.
VxWorks provides with MS-DOS the compatible dosFs filing system transfers for the I/O connection, but the dosFs filing system easy to receive some type floppy disk breakdown essentially the influence, causes in the renewal process the construction of data nonuniformity, moreover, the dosFs filing system is one did not consider that the fault-tolerant performance the filing system, had not considered the FLASH operation the particularity, the FLASH order character way causes regarding the first floor driver to read in is unable to process wrongly. Might choose the module as VxWorks, M-System Corporation is the TrueFFS module which VxWorks had custom-made has provided face the FLASH special file system.
The TrueFFS filing system will use the block-to-flash transition system to dodge saves abstracts as the ordinary block equipment. Causes the FLASH index based on the dynamic maintenance’s mapping chart to become a series of continual blocks. Carries on when the data reads, if the goal block has written has the data, TrueFFS looks for the idle area to read in addition, after treating the data security reads, the TrueFFS renewal mapping chart, the new FLASH address which reads in this direction. The TrueFFS filing system mechanism is perfect, but the base-station system is quite unitary to the FLASH function request, the memory data file type and the memory way are relatively unitary, the TrueFFS filing system cannot display its formidable function, instead reduced system’s performance.
3.1 design concepts
Refers to the dosFs filing system and the TrueFFS filing system’s management, the selection important function redesign, realizes an application layer controllable FLASH management plan. Divides FLASH for the administrative district and the data area two parts carries on the organization to manage. And administrative district file documents management information, data area depositing data file. In order to prevent in the revision administrative district process power failure, establishes the double backup in the memory block both sides the administrative district.
We the FLASH smallest Administrative unit definition are a FLASH sector (block). Before carrying on the FLASH operation, arrives at the first goal sector content backup the memory, revises after the memory finished solidifies FLASH again. The administrative district and the data area take the space is the sector integral multiple, while will like this only then not renew certain data, will create to had the data revision. Regarding the quite small document, is smaller than possibly a sector space, causes the FLASH space the waste, but has avoided, because shares the identical sector to create between the different file operation the mutual influence, reduces the data the possibility which destroys, the simplification management games.
3.2 realize the process
According to the document management plan, the FLASH block number which the hypothesis user may revise is 512, around two administrative districts take 64, data area available 448. The FLASH administrative district needs to contain content as shown in Table 1.
Any time, is at the active state the administrative district to have one. In refresh data time, first renews is at the active state the administrative district, then the write data document, after waiting for reads in stably, renews another administrative district, then sets at another administrative district for the current active state, the original administrative district sets for the non-active state. This may guarantee when the data file reads in the defeat, through two administrative district management information uniformity identification data validity.


FLASH block tabulation’s each byte corresponds a sector to take the situation, 1 expressed that this sector has assigned, 0 expressed that this sector has not assigned, 0xff expressed that this sector necrosis, cannot use.
The document information record position disposes the good processor number according to the system to use permanent order depositing. Before renewing any data file, must renew this document the information record, determined that this file operation condition, the edition information and deposits the position. Concrete organizational structure as shown in Table 2.
When the system needs from the FLASH read data, first compares two FLASH administrative district management information to be whether consistent. If consistent, thinks the data to be effective, direct read; If is inconsistent, then explained that has the FLASH abnormal operation, maintains control bench (OMC) to the system operation to report an emergency, and informs the application program request to read in the recent data file to the OMC downloading.
When needs to delete on FLASH the data file, only need this file operation condition set “invalid” the administrative district, and the sector which takes it sets “has assigned” the condition, then renews the FLASH administrative district information then.
Here has not given the fragment collection and trash data processing mechanism, in fact, deletes the function which the operation realizes namely to have the recycling trash data in the sector function, and controls by the application layer, has realized the system controllability. Fragment which exists regarding FLASH, what because we adopt is carries on the data management take the sector as the unit, data file’s storage space is the integer block, moreover the block tabulation may not be continual, therefore does not have the fragment the question, thus on ingenious has avoided the fragment collection complexity.
4. Summary
This article introduced the FLASH operating procedure as well as with it necessary document management plan, has saved the considerable time for the systems operation, might between the very good solution service movement and the data backup the contradiction which took to the system resources, was relatively frequent regarding the FLASH operation and the data backup timeliness request high system, was suitable.
5. Reference
[1] WindRiver Inc. VxWorks Programmer’s Guide 5.4 Edition 1[EB/OL].1999
[2] WindRiver Inc. Tornado User’s Guide 2.2 [EB/OL].2002
[3] Chen .VxWorks procedure developments and so on intellectual instruction warm Yan armed forces practice the [M]. Beijing: People’s posts and telecommunications publication, 2003-9-1.177-200.