CN104516853B - The system and method for improving GPIO I/O efficiency under linux - Google Patents
The system and method for improving GPIO I/O efficiency under linux Download PDFInfo
- Publication number
- CN104516853B CN104516853B CN201410800151.5A CN201410800151A CN104516853B CN 104516853 B CN104516853 B CN 104516853B CN 201410800151 A CN201410800151 A CN 201410800151A CN 104516853 B CN104516853 B CN 104516853B
- Authority
- CN
- China
- Prior art keywords
- gpio
- controls
- module
- output control
- control module
- 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.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/382—Information transfer, e.g. on bus using universal interface adapter
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
The present invention relates to field of computer technology, and in particular to a kind of system and method for improving GPIO I/O efficiency under linux.This system, the GPIO use of flush type LINUX mobile unit especially automobile data recorder is classified, input detection, independent output control and period output control tactics are extracted, it is respectively designed to drive module, common apparatus model is established in kernel spacing, dynamic base is established in user's space and calls adaptable interface.The calling for greatly reducing system I/O improves the efficiency of system, under conditions of ensure that hardware platform is constant, the consistency of kernel spacing code.Input detection, independent output control and period output control tactics are extracted, establish common apparatus model in kernel spacing, establish dynamic base in user's space and call adaptable interface by this method.Present invention greatly enhances the efficiency of system.
Description
Technical field
The present invention relates to field of computer technology, and in particular to a kind of to improve GPIO I/O efficiency under linux and be
System and method.
Background technique
With the development of embedded technology, flush type LINUX has been widely used in mobile unit especially driving note
Record generally has more than 20 input detection (igniting it is understood that there are many digital signal that automobile data recorder needs to acquire and control
Signal, brake signal turn to modulating signal etc.), (oil circuit circuit control, various peripheral hardwares power on, reset control for more than 10 output control
System etc.).
Linux operating system is layered system, is divided into user's space and kernel spacing, drives the driving journey of hardware
Sequence runs on kernel spacing, and application program runs on user's space, if application program will be interacted with driver,
The I/O interface for needing logical calling system carries out including that a series of processing, the costs such as system model switching are relatively high.
And in the mobile units such as automobile data recorder, the acquisition to various transducing signals is all hundred milliseconds of even 10 Milliseconds
, if being directed to each GPIO(universal input/output according to common scheme) independent control is carried out, middle needs per second are several
Ten secondary I/O even up to a hundred are called, inefficiency.
Summary of the invention
Above-mentioned technical problem is solved, it is right the present invention provides a kind of system of GPIO I/O efficiency under raising linux
The GPIO use of flush type LINUX mobile unit especially automobile data recorder is classified, input detection, independent output control
System and period output control tactics extract, and are respectively designed to drive module, establish common apparatus model in kernel spacing,
Dynamic base, which is established, in user's space calls adaptable interface.The calling for greatly reducing system I/O improves the efficiency of system,
Under conditions of ensure that hardware platform is constant, the consistency of kernel spacing code.
The present invention also provides a kind of methods of GPIO I/O efficiency under raising linux, and input is detected, is independent defeated
Control and period output control tactics extract out, establish common apparatus model in kernel spacing, establish in user's space
Dynamic base calls adaptable interface.
In order to achieve the above object, the technical scheme adopted by the invention is that, GPIO input and output under a kind of raising linux
The system of efficiency, including kernel spacing part is arranged in:
Pin multiplexing controls drive module, driving is controlled for the pin multiplexing to hardware controls, to realize chip-scale
The multiplexing of pin controls,
Chip-scale GPIO control module realizes the input and output to GPIO interface for summarizing effective GPIO pin number
Control,
Detection module is inputted, input signal is acquired and is handled for timing (for example 100MS is primary), and will processing
Stable level signal afterwards is supplied to application layer,
Period output control module controls for realizing the periodic output of GPIO interface,
Direct output control module exports control for realizing the single of GPIO interface,
File interface module, the various GPIO control behaviour initiated for being managed collectively distribution application in a manner of device node
Make, and detection module, period output control module are inputted according to funcall, direct output control module realizes specific input
Output control,
Further include that user's space part is set:
GPIO directly controls module, for each GPIO interface function of classifying, provides input detection, period output controls, is straight
Connect output control registration, realize GPIO pin number and business function corresponding relationship, the default value of GPIO when initialization is provided,
Periodically (100MS) reads the state of the temporary each input signal of input detection module,
GPIO interface package module controls for realizing the output of specific GPIO.
Further, input detection module summarizes the state of each input signal by 32 bit variables, and carries out temporary
It deposits, waits the reading of application layer.
Further, period output control module according to application setting low and high level duration, overturning number into
Row periodically control.
A method of improving GPIO I/O efficiency under linux, comprising the following steps:
Linux system is layered, user's space and kernel spacing are divided into, is arranged in kernel spacing:
Pin multiplexing controls drive module, driving is controlled for the pin multiplexing to hardware controls, to realize chip-scale
The multiplexing of pin controls,
Chip-scale GPIO control module realizes the input and output to GPIO interface for summarizing effective GPIO pin number
Control,
Detection module is inputted, input signal is acquired and is handled for timing (for example 100MS is primary), and will processing
Stable level signal afterwards is supplied to application layer,
Period output control module controls for realizing the periodic output of GPIO interface,
Direct output control module exports control for realizing the single of GPIO interface,
File interface module, the various GPIO control behaviour initiated for being managed collectively distribution application in a manner of device node
Make, and detection module, period output control module are inputted according to funcall, direct output control module realizes specific input
Output control,
It is arranged in user's space:
GPIO directly controls module, for each GPIO interface function of classifying, provides input detection, period output controls, is straight
Connect output control registration, realize GPIO pin number and business function corresponding relationship, the default value of GPIO when initialization is provided,
Periodically (100MS) reads the state of the temporary each input signal of input detection module,
GPIO interface package module controls for realizing the output of specific GPIO, upward by way of function name
Interface is provided, the name information of lower layer is encapsulated, the interface that last time easily identifies and understand, such as the power on and off of hard disk are provided
Interface.
Further, input detection module summarizes the state of each input signal by 32 bit variables, and carries out temporary
It deposits, waits the reading of application layer.
Further, period output control module according to application setting low and high level duration, overturning number into
Row periodically control.
The present invention is by using above-mentioned technical proposal, compared with prior art, has the advantages that
System of the invention has carried out point the GPIO use of flush type LINUX mobile unit especially automobile data recorder
Class extracts input detection, independent output control and period output control tactics, is respectively designed to drive module,
Kernel spacing establishes common apparatus model, establishes dynamic base in user's space and calls adaptable interface.Greatly reduce system I/O
Calling, improve the efficiency of system, under conditions of ensure that hardware platform is constant, the consistency of kernel spacing code.
Method of the invention is classified and is abstracted to the space GPIO, extracts constant part, is designed to general-purpose system
Model is controlled uniformly input and output, reduces the number of system I/O calling, greatly improves the efficiency of system;?
The thing of change abstracts design registry entry, improves the maintainability of GPIO.
Detailed description of the invention
Fig. 1 is the structural schematic diagram of the embodiment of the present invention.
Specific embodiment
Now in conjunction with the drawings and specific embodiments, the present invention is further described.
As a specific embodiment, as shown in Figure 1, GPIO input and output are imitated under a kind of raising linux of the invention
The system of rate, including kernel spacing part is arranged in:
Pin multiplexing controls drive module, driving is controlled for the pin multiplexing to hardware controls, to realize chip-scale
The multiplexing of pin controls,
Chip-scale GPIO control module realizes the input and output to GPIO interface for summarizing effective GPIO pin number
Control has hardware dependency,
Detection module is inputted, once input signal is acquired and is handled for timing, such as 100MS, and will processing
Stable level signal afterwards is supplied to application layer, and input detection module summarizes each input signal by 32 bit variables
State, and kept in, wait the reading of application layer.
Period output control module controls, period output control module for realizing the periodic output of GPIO interface
It is periodically controlled according to the duration of the low and high level of application setting, overturning number.Such as flickering instruction
Lamp control, this module is periodically controlled according to the duration of the low and high level of application setting, overturning number, using only
These parameters need to be disposably set, it is specific to implement to be completed by this module, until application needs to change flashing mode;
Direct output control module exports control for realizing the single of GPIO interface,
File interface module, the various GPIO control behaviour initiated for being managed collectively distribution application in a manner of device node
Make, and detection module, period output control module are inputted according to funcall, direct output control module realizes specific input
Output control,
Input detection (sensor), the period output control, directly output control of driving, are designed to platform-neutral, can
To regard " container " as, before not carrying out map pins by application, no and hardware has specific connection.It is flat with difference
The complete reusability of platform.
Further include that user's space part is set:
GPIO directly controls module, for each GPIO interface function of classifying, provides input detection, period output controls, is straight
Connect output control registration, realize GPIO pin number and business function corresponding relationship, the default value of GPIO when initialization is provided,
Periodically (100MS) reads the state of the temporary each input signal of input detection module,
GPIO interface package module controls for realizing the output of specific GPIO.
A method of improving GPIO I/O efficiency under linux, comprising the following steps:
Linux system is layered, user's space and kernel spacing are divided into, is arranged in kernel spacing:
Pin multiplexing controls drive module, driving is controlled for the pin multiplexing to hardware controls, to realize chip-scale
The multiplexing of pin controls,
Chip-scale GPIO control module realizes the input and output to GPIO interface for summarizing effective GPIO pin number
Control,
Detection module is inputted, input signal is acquired and is handled for timing (for example 100MS is primary), and will processing
Stable level signal afterwards is supplied to application layer, and input detection module summarizes each input signal by 32 bit variables
State, and kept in, wait the reading of application layer.
Period output control module controls, period output control module for realizing the periodic output of GPIO interface
It is periodically controlled according to the duration of the low and high level of application setting, overturning number.
Direct output control module exports control for realizing the single of GPIO interface,
File interface module, the various GPIO control behaviour initiated for being managed collectively distribution application in a manner of device node
Make, and detection module, period output control module are inputted according to funcall, direct output control module realizes specific input
Output control,
It is arranged in user's space:
GPIO directly controls module, for each GPIO interface function of classifying, provides input detection, period output controls, is straight
Connect output control registration, realize GPIO pin number and business function corresponding relationship, the default value of GPIO when initialization is provided,
Periodically (100MS) reads the state of the temporary each input signal of input detection module,
GPIO interface package module controls for realizing the output of specific GPIO, upward by way of function name
Interface is provided, the name information of lower layer is encapsulated, the interface that upper layer easily identifies and understands, such as the power on and off of hard disk is provided
Interface.
void YX_PLT_HDPowerOn(void);
void YX_PLT_HDPowerOff(void);
User's space part, is embodied as dynamic base, is implemented based on thread.
The advantages of in order to further illustrate the present embodiment, the promotion to efficiency: below with reference to conventional method and the present embodiment
Approach application specific example explanation.
Conventional method:
Assuming that application layer there are 4 processes, there are 20 input detection GPIO signals, 3 period output control signals, minimum control
Period processed is 100 milliseconds, if individually carrying out drive control, detects signal for 20 inputs, needs individual process each second
The I/O call number wanted is 20 * 6=120 times, and 4 processes just need 480 times, similarly for 3 periodic output signals, often
Second I/O call number be 3 * 6=18 times.So each second is 120+18=138 time to the call number of these I/O.
This method:
It filters since input signal is concentrated on acquiring in drive module, disposably just whole 20 signals is read out,
So each second only needs I/O6 times, and for periodically exporting, a secondary control is only needed, the case where not changing the output period
Under, and such case is also not very frequently, the calling of I/O can almost be ignored, then each process only needs each second 6 times
I/O can be completed.24 I/O are called 4 processes in total.
Although specifically showing and describing the present invention in conjunction with preferred embodiment, those skilled in the art should be bright
It is white, it is not departing from the spirit and scope of the present invention defined by the appended claims, it in the form and details can be right
The present invention makes a variety of changes, and is protection scope of the present invention.
Claims (6)
1. a kind of system for improving GPIO I/O efficiency under linux, it is characterised in that: including being arranged in kernel spacing part
:
Pin multiplexing controls drive module, multiplexing control driving is carried out for the pin to hardware controls, to realize chip-scale
The multiplexing of pin controls,
Chip-scale GPIO control module, for summarizing effective GPIO pin number, realization controls the input and output of GPIO interface,
Detection module is inputted, input signal is acquired and is handled for timing, and by treated stable level signal
Application layer is supplied to,
Period output control module controls for realizing the periodic output of GPIO interface,
Direct output control module exports control for realizing the single of GPIO interface,
File interface module, the various GPIO control operation initiated for being managed collectively distribution application in a manner of device node,
And detection module, period output control module are inputted according to funcall, direct output control module realization specifically inputs defeated
It controls out,
Further include that user's space part is set:
GPIO directly controls module, for each GPIO interface function of classifying, provides input detection, period output controls, is directly defeated
The corresponding relationship of GPIO pin number and business function, the default value of GPIO when providing initialization, timing are realized in the registration controlled out
The state of the temporary each input signal of input detection module is read,
GPIO interface package module controls for realizing the output of specific GPIO.
2. a kind of system for improving GPIO I/O efficiency under linux according to claim 1, it is characterised in that: defeated
Enter detection module by 32 bit variables to summarize the state of each input signal, and kept in, waits the reading of application layer.
3. a kind of system for improving GPIO I/O efficiency under linux according to claim 1, it is characterised in that: week
Phase output control module is periodically controlled according to the duration of the low and high level of application setting, overturning number.
4. a kind of method for improving GPIO I/O efficiency under linux, which comprises the following steps:
Linux system is layered, user's space and kernel spacing are divided into, is arranged in kernel spacing:
Pin multiplexing controls drive module, multiplexing control driving is carried out for the pin to hardware controls, to realize chip-scale
The multiplexing of pin controls,
Chip-scale GPIO control module, for summarizing effective GPIO pin number, realization controls the input and output of GPIO interface,
Detection module is inputted, input signal is acquired and is handled for timing, and by treated stable level signal
Application layer is supplied to,
Period output control module controls for realizing the periodic output of GPIO interface,
Direct output control module exports control for realizing the single of GPIO interface,
File interface module, the various GPIO control operation initiated for being managed collectively distribution application in a manner of device node,
And detection module, period output control module are inputted according to funcall, direct output control module realization specifically inputs defeated
It controls out,
It is arranged in user's space:
GPIO directly controls module, for each GPIO interface function of classifying, provides input detection, period output controls, is directly defeated
The corresponding relationship of GPIO pin number and business function, the default value of GPIO when providing initialization, timing are realized in the registration controlled out
The state of the temporary each input signal of input detection module is read,
GPIO interface package module controls for realizing the output of specific GPIO.
5. a kind of method for improving GPIO I/O efficiency under linux according to claim 4, which is characterized in that packet
Include following steps: input detection module summarizes the state of each input signal by 32 bit variables, and is kept in, and waits
The reading of application layer.
6. a kind of method for improving GPIO I/O efficiency under linux according to claim 4, which is characterized in that week
Phase output control module is periodically controlled according to the duration of the low and high level of application setting, overturning number.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410800151.5A CN104516853B (en) | 2014-12-22 | 2014-12-22 | The system and method for improving GPIO I/O efficiency under linux |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410800151.5A CN104516853B (en) | 2014-12-22 | 2014-12-22 | The system and method for improving GPIO I/O efficiency under linux |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104516853A CN104516853A (en) | 2015-04-15 |
CN104516853B true CN104516853B (en) | 2019-05-31 |
Family
ID=52792181
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410800151.5A Active CN104516853B (en) | 2014-12-22 | 2014-12-22 | The system and method for improving GPIO I/O efficiency under linux |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104516853B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111338462A (en) * | 2018-12-19 | 2020-06-26 | 技嘉科技股份有限公司 | Configuration method and system of universal input/output port |
CN110275858B (en) * | 2019-05-17 | 2022-03-29 | 南京南瑞继保电气有限公司 | Information processing method, terminal and computer readable storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6803785B1 (en) * | 2000-06-12 | 2004-10-12 | Altera Corporation | I/O circuitry shared between processor and programmable logic portions of an integrated circuit |
CN2807650Y (en) * | 2005-07-13 | 2006-08-16 | 新日电子器材(香港)有限公司 | TV set core with multiple micro processor and universal input/output port |
CN101377764A (en) * | 2008-09-12 | 2009-03-04 | 北京中星微电子有限公司 | Allocating system of GPIO and data communicating method thereof |
CN103678226A (en) * | 2012-09-24 | 2014-03-26 | 炬力集成电路设计有限公司 | General purpose input/output (GPIO) port reuse circuit and method of chip |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7353156B2 (en) * | 2002-02-01 | 2008-04-01 | International Business Machines Corporation | Method of switching external models in an automated system-on-chip integrated circuit design verification system |
-
2014
- 2014-12-22 CN CN201410800151.5A patent/CN104516853B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6803785B1 (en) * | 2000-06-12 | 2004-10-12 | Altera Corporation | I/O circuitry shared between processor and programmable logic portions of an integrated circuit |
CN2807650Y (en) * | 2005-07-13 | 2006-08-16 | 新日电子器材(香港)有限公司 | TV set core with multiple micro processor and universal input/output port |
CN101377764A (en) * | 2008-09-12 | 2009-03-04 | 北京中星微电子有限公司 | Allocating system of GPIO and data communicating method thereof |
CN103678226A (en) * | 2012-09-24 | 2014-03-26 | 炬力集成电路设计有限公司 | General purpose input/output (GPIO) port reuse circuit and method of chip |
Also Published As
Publication number | Publication date |
---|---|
CN104516853A (en) | 2015-04-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102662708B (en) | A kind of (SuSE) Linux OS and video driver device thereof | |
CN104050005A (en) | Recording method and system | |
CN104516853B (en) | The system and method for improving GPIO I/O efficiency under linux | |
WO2006015935A3 (en) | System and method for automatically discovering and grouping resources used by a business process | |
CN105511906B (en) | A kind of video signal platform automatic deployment method, apparatus and system | |
CN102123084B (en) | Resource scheduling method and system in cloud computing operating system | |
CN103838610B (en) | A kind of method for product software automatic identification motherboard configuration information | |
CN104008060A (en) | Method for detecting compatibility of plug-in and host, and detection server | |
CN109819246A (en) | Detection device and detection method, the device of LED display terminal | |
CN106790836A (en) | The display screen method to set up of mobile terminal and mobile terminal | |
CN103178962B (en) | General-purpose fingerprint authentication method and device | |
CN102819527A (en) | Method and system for matching rules in mobile communication system | |
CN105701429B (en) | A kind of self-defined adaptation method and system of RFID radio-frequency cards | |
CN104866747A (en) | Information processing method and electronic device | |
CN109683470A (en) | A kind of software and hardware self-adaptive matching method, device and driving device | |
CN107808529B (en) | Traffic light control method and system based on local intersection video monitoring | |
CN105843773A (en) | Automatic identification method of function extension module of embedded system | |
CN107301284B (en) | Digital-analog hybrid system and power management circuit | |
CN109872674B (en) | Display system and drive configuration method | |
CN111638871A (en) | Equipment information processing method, device, equipment and medium | |
CN103914304A (en) | Method for converting different structure type parameters on basis of SAP (service access point) platforms | |
CN104066255B (en) | A kind of LED drive circuit and transmission method thereof | |
CN106879113A (en) | The method and apparatus of terminal and its Based Intelligent Control indicator lamp | |
CN103941730A (en) | Android system based remote control shooting dolly | |
CN108920217B (en) | Reconstruction method for reducing non-reentrant function |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |