CN104516853A - System and method for improving GPIO (general purpose input and output) efficiency under linux - Google Patents

System and method for improving GPIO (general purpose input and output) efficiency under linux Download PDF

Info

Publication number
CN104516853A
CN104516853A CN201410800151.5A CN201410800151A CN104516853A CN 104516853 A CN104516853 A CN 104516853A CN 201410800151 A CN201410800151 A CN 201410800151A CN 104516853 A CN104516853 A CN 104516853A
Authority
CN
China
Prior art keywords
gpio
module
controls
output
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.)
Granted
Application number
CN201410800151.5A
Other languages
Chinese (zh)
Other versions
CN104516853B (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.)
Xiamen Yaxon Networks Co Ltd
Original Assignee
Xiamen Yaxon Networks Co Ltd
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 Xiamen Yaxon Networks Co Ltd filed Critical Xiamen Yaxon Networks Co Ltd
Priority to CN201410800151.5A priority Critical patent/CN104516853B/en
Publication of CN104516853A publication Critical patent/CN104516853A/en
Application granted granted Critical
Publication of CN104516853B publication Critical patent/CN104516853B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/382Information 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 invention relates to the technical field of computers, in particular to a system and a method for improving GPIO (general purpose input and output) efficiency. By means of the system, GPIO use of embedded LINUX vehicle-mounted devices, especially a vehicle data recorder is classified, input detection, independent output control and periodical output control are extracted in a classification mode and designed to be driving modules, a general device model is built in the core space, and a dynamic base calling adaptation interface is built in the user space. The system I/O calling is greatly reduced, the system efficiency is improved, and consistency of codes in the core space is improved under the condition that the hardware platform is kept unchanged. By means of the method, the input detection, the independent output control and the periodical output control are extracted in the classification mode, the general device model is built in the core space, and the dynamic base calling adaptation interface is built in the user space. The system efficiency is greatly improved.

Description

The system and method for GPIO I/O efficiency under raising linux
Technical field
The present invention relates to field of computer technology, be specifically related to a kind of system and method improving GPIO I/O efficiency under linux.
Background technology
Along with the development of embedded technology, flush type LINUX to be widely used in mobile unit particularly driving recording, we know that the digital signal that drive recorder needs to gather and control is a lot, general have more than 20 input to detect (ignition signal, brake signal, steering indicating light signal etc.), export more than 10 and control (oil circuit control circui, various peripheral hardware power on, resetting controls).
Linux operating system has carried out layering to system, be divided into user's space and kernel spacing, drive the driver of hardware, run on kernel spacing, and application program runs on user's space, if application program will carry out alternately, needing the I/O interface of logical calling system with driver, carry out comprising a series of process such as system model switching, cost is higher.
And in the mobile units such as drive recorder, all hundred milliseconds of even 10 Milliseconds to the collection of various transducing signal, if according to common scheme for each GPIO(universal input/output) carry out independent management and control, the I/O that middle needs so per second are dozens or even hundreds of time calls, inefficiency.
Summary of the invention
Solve the problems of the technologies described above, the invention provides a kind of system improving GPIO I/O efficiency under linux, to flush type LINUX mobile unit particularly drive recorder GPIO use classify, input detection, independent output control and cycle are exported control tactics extract, be designed to driver module respectively, set up common apparatus model at kernel spacing, set up dynamic base at user's space and call adaptable interface.Greatly reduce calling of system I/O, improve the efficiency of system, under ensure that the condition that hardware platform is constant, the consistance of kernel spacing code.
Present invention also offers a kind of method improving GPIO I/O efficiency under linux, input is detected, independent output controls and cycle output control tactics extracts, set up common apparatus model at kernel spacing, set up dynamic base at user's space and call adaptable interface.
In order to achieve the above object, the technical solution adopted in the present invention is, a kind of system improving GPIO I/O efficiency under linux, comprises and is arranged on kernel spacing part:
Pin multiplexing controls driver module, for controlling to drive to the pin multiplexing of hardware controls, in order to realize the multiplexing control of chip-scale pin,
Chip-scale GPIO control module, for gathering effective GPIO pin number, realizes controlling the input and output of GPIO interface,
Input detection module, carries out acquisition and processing for timing (such as 100MS is once) to input signal, and the stable level signal after process is supplied to application layer,
Cycle output control module, controls for the periodic output realizing GPIO interface,
Direct output control module, the single for realizing GPIO interface exports and controls,
File interface module, for the various GPIO control operations initiated with the mode unified management delivery applications of device node, and according to funcall input detection module, cycle output control module, direct output control module realizes concrete input and output and controls,
Also comprise and be arranged on user's space part:
The direct control module of GPIO, for each GPIO interface function of classifying, input detection is provided, the cycle exports control, directly export the registration of control, realize the corresponding relation of GPIO pin number and business function, the default value of GPIO during initialization is provided, regularly (100MS) reads the state of each input signal that input detection module is kept in
GPIO interface encapsulation module, controls for the output realizing concrete GPIO.
Further, input detection module gathers the state of each input signal by 32 bit variables, and keeps in, and waits for the reading of application layer.
Further, cycle output control module according to application arrange low and high level duration, upset number of times periodically control.
Improve a method for GPIO I/O efficiency under linux, comprise the following steps:
Linux system is carried out layering, is divided into user's space and kernel spacing, arrange at kernel spacing:
Pin multiplexing controls driver module, for controlling to drive to the pin multiplexing of hardware controls, in order to realize the multiplexing control of chip-scale pin,
Chip-scale GPIO control module, for gathering effective GPIO pin number, realizes controlling the input and output of GPIO interface,
Input detection module, carries out acquisition and processing for timing (such as 100MS is once) to input signal, and the stable level signal after process is supplied to application layer,
Cycle output control module, controls for the periodic output realizing GPIO interface,
Direct output control module, the single for realizing GPIO interface exports and controls,
File interface module, for the various GPIO control operations initiated with the mode unified management delivery applications of device node, and according to funcall input detection module, cycle output control module, direct output control module realizes concrete input and output and controls,
Arrange at user's space:
The direct control module of GPIO, for each GPIO interface function of classifying, input detection is provided, the cycle exports control, directly export the registration of control, realize the corresponding relation of GPIO pin number and business function, the default value of GPIO during initialization is provided, regularly (100MS) reads the state of each input signal that input detection module is kept in
GPIO interface encapsulation module, control for the output realizing concrete GPIO, it upwards provides interface by the form of function name, encapsulates the name information of lower floor, provides the interface that last time easily identifies and understands, the power on and off interface of such as hard disk.
Further, input detection module gathers the state of each input signal by 32 bit variables, and keeps in, and waits for the reading of application layer.
Further, cycle output control module according to application arrange low and high level duration, upset number of times periodically control.
The present invention is by adopting technique scheme, and compared with prior art, tool has the following advantages:
System of the present invention to flush type LINUX mobile unit particularly drive recorder GPIO use classify, input detection, independent output control and cycle are exported control tactics extract, be designed to driver module respectively, set up common apparatus model at kernel spacing, set up dynamic base at user's space and call adaptable interface.Greatly reduce calling of system I/O, improve the efficiency of system, under ensure that the condition that hardware platform is constant, the consistance of kernel spacing code.
Method of the present invention carries out classification and abstract to GPIO space, extracts constant part, is designed to general system model, unify management and control to input and output, the number of times that the system I/O of reducing calls, drastically increase the efficiency of system; Out design registry entry abstract for the thing become, improve the maintainability of GPIO.
Accompanying drawing explanation
Fig. 1 is the structural representation of embodiments of the invention.
Embodiment
Now the present invention is further described with embodiment by reference to the accompanying drawings.
As a specific embodiment, as shown in Figure 1, a kind of system improving GPIO I/O efficiency under linux of the present invention, comprises and is arranged on kernel spacing part:
Pin multiplexing controls driver module, for controlling to drive to the pin multiplexing of hardware controls, in order to realize the multiplexing control of chip-scale pin,
Chip-scale GPIO control module, for gathering effective GPIO pin number, realizing controlling the input and output of GPIO interface, having hardware dependency,
Input detection module, for timing, such as 100MS once carries out acquisition and processing to input signal, and the stable level signal after process is supplied to application layer, input detection module gathers the state of each input signal by 32 bit variables, and keeps in, and waits for the reading of application layer.
Cycle output control module, controls for the periodic output realizing GPIO interface, and duration, the upset number of times of the low and high level that cycle output control module is arranged according to application periodically control.Such as flickering pilot lamp controls, duration, the upset number of times of the low and high level that this module is arranged according to application periodically control, application only disposablely need set these parameters, and concrete enforcement is completed by this module, until application needs to change flashing mode;
Direct output control module, the single for realizing GPIO interface exports and controls,
File interface module, for the various GPIO control operations initiated with the mode unified management delivery applications of device node, and according to funcall input detection module, cycle output control module, direct output control module realizes concrete input and output and controls,
The input driven detects (sensor), the cycle exports control, directly export control, is designed to platform-neutral, can regards as " container ", before not being employed to carry out map pins, does not have there is concrete contact with hardware.There is the complete reusability of different platform.
Also comprise and be arranged on user's space part:
The direct control module of GPIO, for each GPIO interface function of classifying, input detection is provided, the cycle exports control, directly export the registration of control, realize the corresponding relation of GPIO pin number and business function, the default value of GPIO during initialization is provided, regularly (100MS) reads the state of each input signal that input detection module is kept in
GPIO interface encapsulation module, controls for the output realizing concrete GPIO.
Improve a method for GPIO I/O efficiency under linux, comprise the following steps:
Linux system is carried out layering, is divided into user's space and kernel spacing, arrange at kernel spacing:
Pin multiplexing controls driver module, for controlling to drive to the pin multiplexing of hardware controls, in order to realize the multiplexing control of chip-scale pin,
Chip-scale GPIO control module, for gathering effective GPIO pin number, realizes controlling the input and output of GPIO interface,
Input detection module, for timing (such as 100MS once), acquisition and processing is carried out to input signal, and the stable level signal after process is supplied to application layer, input detection module gathers the state of each input signal by 32 bit variables, and keep in, wait for the reading of application layer.
Cycle output control module, controls for the periodic output realizing GPIO interface, and duration, the upset number of times of the low and high level that cycle output control module is arranged according to application periodically control.
Direct output control module, the single for realizing GPIO interface exports and controls,
File interface module, for the various GPIO control operations initiated with the mode unified management delivery applications of device node, and according to funcall input detection module, cycle output control module, direct output control module realizes concrete input and output and controls,
Arrange at user's space:
The direct control module of GPIO, for each GPIO interface function of classifying, input detection is provided, the cycle exports control, directly export the registration of control, realize the corresponding relation of GPIO pin number and business function, the default value of GPIO during initialization is provided, regularly (100MS) reads the state of each input signal that input detection module is kept in
GPIO interface encapsulation module, control for the output realizing concrete GPIO, it upwards provides interface by the form of function name, encapsulates the name information of lower floor, provides the interface that upper strata easily identifies and understands, the power on and off interface of such as hard disk.
void YX_PLT_HDPowerOn(void);
void YX_PLT_HDPowerOff(void);
User's space part, is embodied as dynamic base, implements based on thread.
In order to further illustrate the advantage of the present embodiment, the lifting to efficiency: below in conjunction with the approach application instantiation explanation of conventional method and the present embodiment.
Conventional method:
Suppose that application layer has 4 processes, there are 20 to input and detect GPIO signal, 3 cycles export control signal, minimum control cycle is 100 milliseconds, if carry out drived control separately, then for 20 input detection signals, the I/O call number of individual process needs p.s. is 20 * 6=120 times, 4 processes just need 480 times, and in like manner for 3 periodic output signal, the I/O call number of p.s. is 3 * 6=18 times.So p.s. is 120+18=138 time to the call number of these I/O.
This method:
Filtering is gathered due to input signal is concentrated in driver module, disposablely just overall 20 signals to be read out, so only need I/O6 time p.s., and for periodic output, only need once control, when not changing the output cycle, and this situation neither be very frequent, calling of I/O almost can be ignored, and so each process only needs the p.s. I/O of 6 times namely can complete.4 processes altogether 24 I/O are called.
Although specifically show in conjunction with preferred embodiment and describe the present invention; but those skilled in the art should be understood that; not departing from the spirit and scope of the present invention that appended claims limits; can make a variety of changes the present invention in the form and details, be protection scope of the present invention.

Claims (6)

1. improve a system for GPIO I/O efficiency under linux, it is characterized in that: comprise and be arranged on kernel spacing part:
Pin multiplexing controls driver module, for controlling to drive to the pin multiplexing of hardware controls, in order to realize the multiplexing control of chip-scale pin,
Chip-scale GPIO control module, for gathering effective GPIO pin number, realizes controlling the input and output of GPIO interface,
Input detection module, carries out acquisition and processing for timing to input signal, and the stable level signal after process is supplied to application layer,
Cycle output control module, controls for the periodic output realizing GPIO interface,
Direct output control module, the single for realizing GPIO interface exports and controls,
File interface module, for the various GPIO control operations initiated with the mode unified management delivery applications of device node, and according to funcall input detection module, cycle output control module, direct output control module realizes concrete input and output and controls,
Also comprise and be arranged on user's space part:
The direct control module of GPIO, for each GPIO interface function of classifying, input detection is provided, the cycle exports control, directly export the registration of control, realize the corresponding relation of GPIO pin number and business function, the default value of GPIO during initialization is provided, the state of each input signal that input detection module is kept in is read in timing
GPIO interface encapsulation module, controls for the output realizing concrete GPIO.
2. a kind of system improving GPIO I/O efficiency under linux according to claim 1, is characterized in that: input detection module gathers the state of each input signal by 32 bit variables, and keeps in, and waits for the reading of application layer.
3. a kind of system improving GPIO I/O efficiency under linux according to claim 1, is characterized in that: duration, the upset number of times of the low and high level that cycle output control module is arranged according to application periodically control.
4. improve a method for GPIO I/O efficiency under linux, it is characterized in that, comprise the following steps:
Linux system is carried out layering, is divided into user's space and kernel spacing, arrange at kernel spacing:
Pin multiplexing controls driver module, for controlling to drive to the pin multiplexing of hardware controls, in order to realize the multiplexing control of chip-scale pin,
Chip-scale GPIO control module, for gathering effective GPIO pin number, realizes controlling the input and output of GPIO interface,
Input detection module, carries out acquisition and processing for timing to input signal, and the stable level signal after process is supplied to application layer,
Cycle output control module, controls for the periodic output realizing GPIO interface,
Direct output control module, the single for realizing GPIO interface exports and controls,
File interface module, for the various GPIO control operations initiated with the mode unified management delivery applications of device node, and according to funcall input detection module, cycle output control module, direct output control module realizes concrete input and output and controls,
Arrange at user's space:
The direct control module of GPIO, for each GPIO interface function of classifying, input detection is provided, the cycle exports control, directly export the registration of control, realize the corresponding relation of GPIO pin number and business function, the default value of GPIO during initialization is provided, the state of each input signal that input detection module is kept in is read in timing
GPIO interface encapsulation module, controls for the output realizing concrete GPIO.
5. a kind of method improving GPIO I/O efficiency under linux according to claim 4, it is characterized in that, comprise the following steps: input detection module gathers the state of each input signal by 32 bit variables, and keeps in, and waits for the reading of application layer.
6. a kind of method improving GPIO I/O efficiency under linux according to claim 4, is characterized in that, duration, the upset number of times of the low and high level that cycle output control module is arranged according to application periodically control.
CN201410800151.5A 2014-12-22 2014-12-22 The system and method for improving GPIO I/O efficiency under linux Active CN104516853B (en)

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 true CN104516853A (en) 2015-04-15
CN104516853B 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)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110275858A (en) * 2019-05-17 2019-09-24 南京南瑞继保电气有限公司 A kind of information processing method, terminal and computer readable storage medium
CN111338462A (en) * 2018-12-19 2020-06-26 技嘉科技股份有限公司 Configuration method and system of universal input/output port

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030149946A1 (en) * 2002-02-01 2003-08-07 Devins Robert J. Method of switching external models in an automated system-on-chip integrated circuit design verification system
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

Patent Citations (5)

* Cited by examiner, † Cited by third party
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
US20030149946A1 (en) * 2002-02-01 2003-08-07 Devins Robert J. Method of switching external models in an automated system-on-chip integrated circuit design verification system
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

Cited By (2)

* Cited by examiner, † Cited by third party
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
CN110275858A (en) * 2019-05-17 2019-09-24 南京南瑞继保电气有限公司 A kind of information processing method, terminal and computer readable storage medium

Also Published As

Publication number Publication date
CN104516853B (en) 2019-05-31

Similar Documents

Publication Publication Date Title
CN105785958B (en) Multi-functional data collector, acquisition system and method based on wisdom factory
CN104598308B (en) A kind of mode switch control method and device
CN104635690A (en) Whole vehicle control unit (VCU) integrated with gateway function of pure electric vehicle
CN103620536A (en) Touch event reporting method, device and mobile terminal
CN103838610B (en) A kind of method for product software automatic identification motherboard configuration information
CN104516853A (en) System and method for improving GPIO (general purpose input and output) efficiency under linux
CN104360775A (en) Driving method of touch control display device and touch control display device
CN111107061A (en) Intelligent network card and communication method thereof
CN101957802B (en) USB device with driving program
CN103178962B (en) General-purpose fingerprint authentication method and device
CN104750226A (en) USB (universal serial bus) OTG (on-the-go) pattern recognition system and USB OTG pattern recognition method
CN107943350A (en) A kind of touch-control display panel and its touch-control driving method
CN102929817A (en) Heterogeneous model information automatic configuring method based on GPIO (general purpose input/output)
CN203386338U (en) Cross screen network control system
CN204440127U (en) The entire car controller of the pure electric automobile of integrated gateway function
CN104680626A (en) Internet of things based intelligent parking lot entrance and exit monitoring system
CN104090833B (en) Server and signal resolver thereof
CN201203774Y (en) Industry intelligent terminal based on RFID data acquisition function
CN102594871B (en) A kind of data encapsulation method, system, adapter and Internet of things middleware
CN202978797U (en) Motor driving device
CN105242603A (en) Power collection terminal with USB OTG interface and debugging upgrade method thereof
CN105677474A (en) Interruption polymerization device and method based on FPGA
CN104615387A (en) Vehicle-mounted equipment based on XPE system and design method of vehicle-mounted equipment
CN101508274B (en) Heavy duty car CAN control system flexible collocation method based on bussing technique
CN114679821A (en) Light control system

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