CN100419725C - Method for dynamic regulating serial transmission buffer area size - Google Patents

Method for dynamic regulating serial transmission buffer area size Download PDF

Info

Publication number
CN100419725C
CN100419725C CNB2004100520888A CN200410052088A CN100419725C CN 100419725 C CN100419725 C CN 100419725C CN B2004100520888 A CNB2004100520888 A CN B2004100520888A CN 200410052088 A CN200410052088 A CN 200410052088A CN 100419725 C CN100419725 C CN 100419725C
Authority
CN
China
Prior art keywords
data transmission
data
buffer
length
buffer length
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB2004100520888A
Other languages
Chinese (zh)
Other versions
CN1773476A (en
Inventor
叶承溱
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mitac Computer Shunde Ltd
Shunda Computer Factory Co Ltd
Mitac International Corp
Original Assignee
Mitac Computer Shunde Ltd
Mitac International Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mitac Computer Shunde Ltd, Mitac International Corp filed Critical Mitac Computer Shunde Ltd
Priority to CNB2004100520888A priority Critical patent/CN100419725C/en
Publication of CN1773476A publication Critical patent/CN1773476A/en
Application granted granted Critical
Publication of CN100419725C publication Critical patent/CN100419725C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Systems (AREA)
  • Communication Control (AREA)

Abstract

The present invention relates to a method for dynamically regulating serial transmission buffer area length, which dynamically regulates buffer area (FIFO buffer) length according to data transmission quantity when a serial port driver (serial driver) executes a data transmission process. The method comprises the following steps: firstly, transmission starting time, data transmission quantity and transmission terminating time are obtained; secondly, the data transmission quantity is obtained by calculation; thirdly, whether the data transmission quantity meets a standard interval is judged; fourthly, the buffer area length is increased when the data transmission quantity falls in the standard interval and a relative value falls close to the upper limit of the standard interval, and the buffer area length is shortened when the data transmission quantity falls in the standard interval and the relative value falls close to the lower limit of the standard interval; finally, data transmission is begun to process according to an interruption request generated by a buffer area data state. Thus, data overflow caused by insufficient buffer area length and overlong interrupt request interval can be avoided when the data transmission quantity is large, and inconspicuous whole effect caused by overlong buffer area length and overlong interrupt request interval can be reduced when the data transmission quantity is small.

Description

Dynamically adjust the method for the buffer length of serial transmission
[technical field]
The present invention is a kind of relevant for data processing method, refer in particular to a kind of being applied in the serial port driver (serial driver), can carry out buffer zone (FIFO buffer) length according to volume of transmitted data and dynamically adjust the interrupt request method at interval of controlling.
[background technology]
In the structure that existing serial data transmission is handled (as shown in fig. 1), serial port driver (serial driver) 30 often is used as the main communication bridge of being responsible for data transmission between microprocessor 10 and the peripheral unit 50.When having task, to carry out peripheral unit 50, when need carry out data transmission and processing, just can be by answerable serial port driver 30 is responsible for sending interruption (interrupt) request to microprocessor 10, and after microprocessor 10 receives interrupt request from serial port driver 30, just can distribute certain resource at once and allow corresponding peripheral unit 50 to begin to carry out the data transmission and processing of being asked.
Particularly in the process of data transmission and processing, serial port driver 30 is mainly used to be responsible for the I/O transmission of data between microprocessor 10 and the peripheral unit 50.And input block 31 and output buffer 32 that the I/O transmission can see through in the serial port driver 30 respectively usually carry out; so-called buffer zone (FIFO buffer) promptly is to can be used to the temporary transient internal memory of waiting for the transmission process data that keeps, and is mainly used to the usefulness as the buffering of data transmission and processing between microprocessor 10 and the peripheral unit 50.
Purposes about buffer zone has been the prior art category, seldom gives unnecessary details at this.But because in the use of past for buffer zone, all be to take the pattern of regular length (fixed length) carrying out (input block 31 and output buffer 32 in as Fig. 1), just the length scale of buffer zone and open ended data volume are fixing, therefore often when the data volume that needs transmission process is sizable, the buffer zone of this regular length just through regular meeting because data processing rate inconsistent, data in the buffer zone exceed the open ended maximum magnitude of buffer zone and error situations that overflow takes place and cause being temporarily stored in; Otherwise, when the data volume that needs transmission process is very little, the buffer zone of this regular length also through regular meeting because the temporal data quantity not sufficient in the buffer zone, and can't produce in addition transmission process of interrupt request, have influence on whole operational effect.
Therefore, in the actual data transfer processing procedure, buffer zone in the serial port driver 30 is necessary to carry out according to volume of transmitted data at any time the dynamic adjustment of buffer length really, so that can sending interrupt request to microprocessor 10 on optimal opportunity, serial port driver 30 carries out data transmission and processing, so can make the data transmission and processing between microprocessor 10 and the peripheral unit 50 can maintain optimized state, make whole effect also can reach optimized situation simultaneously.How designing a kind of method that can dynamically adjust buffer length in the serial port driver 30 according to the actual data transfer amount, is emphasis of the present invention place.
[summary of the invention]
Handle existing problem points according to existing serial data transmission, the object of the present invention is to provide a kind of method of buffer length of dynamic adjustment serial transmission.
For achieving the above object, the pattern that the method for the buffer length of dynamic adjustment serial transmission provided by the present invention can dynamically be adjusted according to volume of transmitted data, also promptly have the buffer mode of distance to go (dynamic length), this method includes the following step: at first obtain original transmission time, data transmission total amount, reach the termination transmission time; See through computing and try to achieve volume of transmitted data, wherein, asking for of this volume of transmitted data can see through following expression formula and calculate: volume of transmitted data=data transmission total amount/(stop transmission time-original transmission time); Its unit is: byte/ticktock (byte/tick); Judge whether the conformance with standard interval? wherein, can self-defining default value between this standard regions for the user, include the scope of the data transmission upper limit and lower limit.In this volume of transmitted data falls between standard regions, and relative value falls near going up in limited time the growth buffer length between this standard regions; In this volume of transmitted data falls between standard regions, and relative value falls near prescribing a time limit the shortening buffer length between this standard regions down; At last, produce interrupt request, begin to transmit data processing according to the buffer data state.
Compared to prior art, when the present invention can avoid volume of transmitted data big, the length that increases buffer zone took place with the situation that reduces the data overflow; Also can reduce simultaneously volume of transmitted data hour, the length that shortens buffer zone is to promote whole operational effect.
[description of drawings]
Fig. 1 is the structured flowchart that existing serial data transmission is handled.
Fig. 2 is the structured flowchart of method of the buffer length of the dynamic adjustment serial transmission carried of the present invention.
Fig. 3 is the operation workflow figure of method of the buffer length of the dynamic adjustment serial transmission carried of the present invention.
[embodiment]
The present invention proposes a kind of method of buffer length of dynamic adjustment serial transmission.Can know discovery in the structure of the present invention by the existing structure of Fig. 1 and Fig. 2, major technique of the present invention is characterised in that and the buffer zone (FIFO buffer) in the existing serial port driver 30 (serial driver) (comprising: input block 31 and output buffer 32) can be changed to the pattern that can dynamically adjust according to the actual data transfer amount from the pattern of in the past regular length (fixed length), also promptly has the buffer mode of distance to go (dynamiclength).
The inventive method is mainly used on the computing machine executable platform, particularly be used for promoting the effect (as shown in Figure 2) of the data transmission and processing between the microprocessor 10 and peripheral unit 50 in the computing machine executable platform, all can use the inventive method as long as therefore have the computing machine executable platform of microprocessor 10, for example: the intelligent mobile phone (Smartphone) in the hand-held mobile communications device (handheld device).
The operation workflow of the inventive method will cooperate the part of Fig. 3 to be illustrated (please arrange in pairs or groups with reference to the part of figure 2).When 50 pairs of serial port driver 30 of peripheral unit are sent the request of data transmission and processing, this moment, serial port driver 30 meetings be sent interruption (interrupt) before to microprocessor 10, execution the inventive method is carried out the dynamic adjustment about buffer length, just sends the operation of interrupting and beginning data transmission and processing to microprocessor 10 after finishing.As for being described in detail as follows of the inventive method:
At first, when serial port driver 30 receives the data transmission and processing request of being sent from peripheral unit 50, the original transmission time (step 100) when just beginning to start the inventive method and obtaining startup; After the startup, serial port driver 30 is just installed the total amount of data (step 110) that required transmission process data are read in 50 requests to the periphery; And estimate and obtain peripheral unit 50 simultaneously all transmission process data are sent to termination transmission time (step 120) on the serial port driver 30; Calculate volume of transmitted data (step 130) according to default expression formula then, expression formula can be represented by following formula:
M=D/(T2-T1);
Wherein, M is a volume of transmitted data, and its unit is: byte/ticktock (byte/tick); D is the data transmission total amount, and its unit is: byte (byte); T1 and T2 are respectively the original transmission time and stop the transmission time, and its unit is: drip (tick), be the inside sequential unit that is produced in the general computing machine executable platform.
Calculate after the volume of transmitted data, just do you judge further that this volume of transmitted data meets between default standard regions? between (step 140) this standard regions, for providing the user to adjust the default value of definition voluntarily according to computing machine executable platform state, the scope interval that includes the data transmission upper limit and lower limit, data-driven transmission quantity fall within this interval numerical value and decide and increase length or shorten length buffer zone.
In the volume of transmitted data that calculates falls between standard regions (being the conformance with standard interval), do you then judge this volume of transmitted data interval upper limit that is near the mark? (step 150) is near the mark the interval upward in limited time when the volume of transmitted data relative value falls within, just carry out the program (step 151) that buffer zone is increased, the buffer length that is increased is the length of 1/2 buffer zone to the maximum in theory, this growth limitation only is the preferred embodiment in the inventive method, and in fact this restriction also can provide the user to be defined voluntarily.
In the volume of transmitted data that calculates falls between standard regions (being the conformance with standard interval), and the volume of transmitted data relative value does not fall within interval the going up in limited time that be near the mark, do you then judge this volume of transmitted data interval lower limit that is near the mark? (step 152) is near the mark the interval down in limited time when the volume of transmitted data relative value falls within, just carry out the program (step 153) that buffer zone is shortened, the buffer length minimum that is shortened in theory is the length of 1 byte, this shortening restriction similarly only is the preferred embodiment in the inventive method, and in fact this restriction also can provide the user to be defined voluntarily.In the volume of transmitted data that calculates falls between standard regions (being the conformance with standard interval), and the volume of transmitted data relative value does not fall within and is near the mark the interval down in limited time, this moment, serial port driver 30 just can produce interrupt request in real time according to the buffer data state, and was sent to interrupt request in the microprocessor 10 and begins to transmit data processing (step 160).
Finish above-mentioned steps 100 to step 151, step 153, promptly finished the flow process of whole dynamic adjustment buffer zone, this moment, serial port driver 30 just can produce interrupt request in real time according to the buffer data state, and was sent to interrupt request in the microprocessor 10 and begins to transmit data processing (step 160).Because this moment, buffer length passed through optimized dynamic adjustment,, any deal with data to be transmitted from peripheral unit 50 handles so can both transferring in the microprocessor 10 in mode the most smooth, full blast in buffer zone.
Be the self-defining part of user between standard regions, can look the overall operation state at any time and do real-time adjustment, and then make the dynamic adjustment of buffer length and the data transmission and processing between microprocessor 10 and the peripheral unit 50 can be more smooth.For instance, if UART Universal Asynchronous Receiver Transmitter (Universal Asynchronous Receiver-Transmitter to be used in intelligent mobile phone, UART) serial transmission operation is limited to 160 byte per seconds between preferable standard regions, is limited to 5 byte per seconds under between standard regions.
The above only is the present invention's preferred embodiment wherein, be not to be used for limiting practical range of the present invention, can apply mechanically the inventive method as long as in fact be applied on the computing machine executable platform and through any data transmission and processing program that serial port driver is carried out.

Claims (7)

1. method of dynamically adjusting the buffer length of serial transmission, act on the computing machine executable platform, when peripheral unit sees through serial port driver request execution data transmission and processing, can dynamically adjust to promote the data transmission and processing effect the buffer zone in the serial port driver, it is characterized in that: this method comprises the following step:
Obtain an initial transmission time T1, read a data transmission total amount D and a termination transmission time T2;
Carry out computing and try to achieve a volume of transmitted data M, wherein, this volume of transmitted data M asks for, and can see through following expression formula and calculate:
M=D/ (T2-T1); Its unit is: byte/ticktock;
In judging whether this volume of transmitted data falls between a standard regions, wherein, can self-defining default value between this standard regions for the user, include the scope of the data transmission upper limit and lower limit;
In this volume of transmitted data falls between standard regions, and relative value falls near going up in limited time the growth buffer length between this standard regions;
In this volume of transmitted data falls between standard regions, and relative value falls near prescribing a time limit the shortening buffer length between this standard regions down; And
Produce interrupt request according to the buffer data state, begin to transmit data processing.
2. the method for the buffer length of dynamic adjustment serial transmission according to claim 1 is characterized in that: this computing machine executable platform is meant the hand-held mobile communications device of tool microprocessor.
3. the method for the buffer length of dynamic adjustment serial transmission according to claim 2 is characterized in that: this computing machine executable platform is meant intelligent mobile phone.
4. the method for the buffer length of dynamic adjustment serial transmission according to claim 1, it is characterized in that: this original transmission time T 1 and this termination transmission time T2, all be to be as the criterion with the inside sequential unit that is produced in this computing machine executable platform, this unit is for dripping.
5. the method for the buffer length of dynamic adjustment serial transmission according to claim 1 is characterized in that: this data transmission total amount D is to be unit with the byte.
6. the method for the buffer length of dynamic adjustment serial transmission according to claim 1 is characterized in that: increase in the step of buffer length, the buffer length that is increased is the length of 1/2 buffer zone to the maximum.
7. the method for the buffer length of dynamic adjustment serial transmission according to claim 1 is characterized in that: shorten in the step of buffer length, the buffer length minimum that is shortened is the length of 1 byte.
CNB2004100520888A 2004-11-08 2004-11-08 Method for dynamic regulating serial transmission buffer area size Expired - Fee Related CN100419725C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2004100520888A CN100419725C (en) 2004-11-08 2004-11-08 Method for dynamic regulating serial transmission buffer area size

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2004100520888A CN100419725C (en) 2004-11-08 2004-11-08 Method for dynamic regulating serial transmission buffer area size

Publications (2)

Publication Number Publication Date
CN1773476A CN1773476A (en) 2006-05-17
CN100419725C true CN100419725C (en) 2008-09-17

Family

ID=36760459

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2004100520888A Expired - Fee Related CN100419725C (en) 2004-11-08 2004-11-08 Method for dynamic regulating serial transmission buffer area size

Country Status (1)

Country Link
CN (1) CN100419725C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106374352A (en) * 2016-08-29 2017-02-01 四川行之智汇知识产权运营有限公司 Protection layer-based metal-enclosed power distribution cabinet with top inlet/outlet

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0962483A (en) * 1995-08-24 1997-03-07 Hitachi Ltd Optimization system for doubled i/o buffer length
CN1256445A (en) * 1998-12-04 2000-06-14 国际商业机器公司 Method for executing input/output operation in information processing unit and information processing system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0962483A (en) * 1995-08-24 1997-03-07 Hitachi Ltd Optimization system for doubled i/o buffer length
CN1256445A (en) * 1998-12-04 2000-06-14 国际商业机器公司 Method for executing input/output operation in information processing unit and information processing system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106374352A (en) * 2016-08-29 2017-02-01 四川行之智汇知识产权运营有限公司 Protection layer-based metal-enclosed power distribution cabinet with top inlet/outlet

Also Published As

Publication number Publication date
CN1773476A (en) 2006-05-17

Similar Documents

Publication Publication Date Title
US8675615B2 (en) Temperature-driven airlink selection in a multi-mode wireless device
KR100753780B1 (en) Speech input device with attention span
JP2004537872A (en) Method and apparatus for scheduling packet data transmission in a wireless communication system
US20190235475A1 (en) Method and apparatus for controlling motor vibration
US20040164765A1 (en) Logic circuit module having power consumption control interface and a recording medium storing the module
US20080141265A1 (en) Power Management Method for Platform and that Platform
CN104349401A (en) Equipment and method for regulating data strategy in terminal
CN100419725C (en) Method for dynamic regulating serial transmission buffer area size
CN107534618A (en) Transmitting device, transmission method and program
CN108037889A (en) Location regulation method, terminal and the computer-readable recording medium of virtual key
CN108307337A (en) Flux monitoring method, system and the storage device of vehicle mounted guidance terminal
CN113296808A (en) Application program downloading control method and server
CN102957399A (en) Automatic parameter optimization method for parameter equalizer
KR100877735B1 (en) Portable communication terminal, communication method of the portable communication terminal, program and recording medium having the program recorded thereon
CN106325515B (en) A kind of service-oriented man-machine interactive system and implementation method
CN106534735A (en) Intelligent TV volume adjustment method
CN103384316B (en) Radiotelevisor and volume curve adjustment method thereof
JP2003102066A (en) Packet communication regulation system and method for mobile terminal
JP2004007404A (en) Method for adjusting usage of digital signal processing in mobile terminal and its apparatus
CN101630288A (en) Method and device for processing and controlling buffer cache and storage device thereof
KR100484304B1 (en) Method for determining bus master priority in direct memory access controller
KR100428738B1 (en) Method for controlling data rate use mode and data rate control length
JP2002351761A (en) Network communication system, network communication connection selecting device, information processor, network communication connection selecting method, recording medium, and program
JP3528817B2 (en) Method of operating CDMA telephone and cellular telephone device
JP2003036435A (en) Device and method for processing image

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20080917

Termination date: 20151108

EXPY Termination of patent right or utility model