CN109101445A - A kind of system bus conversion method - Google Patents
A kind of system bus conversion method Download PDFInfo
- Publication number
- CN109101445A CN109101445A CN201710475483.4A CN201710475483A CN109101445A CN 109101445 A CN109101445 A CN 109101445A CN 201710475483 A CN201710475483 A CN 201710475483A CN 109101445 A CN109101445 A CN 109101445A
- Authority
- CN
- China
- Prior art keywords
- usb
- spi
- upper layer
- bus conversion
- layer application
- 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.)
- Pending
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
- G06F13/385—Information transfer, e.g. on bus using universal interface adapter for adaptation of a particular data processing system to different peripheral devices
-
- 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/10—Program control for peripheral devices
- G06F13/102—Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver
-
- 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/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Bus Control (AREA)
- Computer And Data Communications (AREA)
- Information Transfer Systems (AREA)
Abstract
The present invention provides a kind of system bus conversion method, including: Step 1: providing the upper layer application for being applicable in SPI;Step 2: system adaptation module is added in upper layer application, for judging current system type before SPI transmission;Step 3: the corresponding bottom library access scheme of calling system type realizes SPI transmission according to the judging result of step 2;Step 4: transferring data to USB processing module by bottom library access scheme, and data processing is carried out by the corresponding processor of system type.System bus conversion method of the invention, can be realized cross-platform using upper level applications, and support to be that not homologous ray and hardware platform provide bottom library and access.
Description
Technical field
The present invention relates to computer science and technology field more particularly to a kind of system bus conversion methods.
Background technique
With the continuous development of Embedded Industry, various embedded technologys apply more and more extensive, the external interface of CPU
Become more and more various complexity.But since embedded product is more smart small, hardware and software is cropped to properly by actual demand
State, so the interface carried on some embedded main boards, than relatively limited, when generating new demand, original mainboard is just full
Foot not new demand.
In aviation field, 429 communication protocols are widely used in always in each airline carriers of passengers.What 429 communication modules used
It is SPI (Serial Peripheral Interface, Serial Peripheral Interface (SPI)) interface, and the platforms such as X86 do not support SPI directly
Interface, therefore 429 communication modules can not be applicable in the industrial control mainboards such as X86, so, in order to realize that 429 is logical on these mainboards
Letter, it is necessary to be converted using chip.For example mainboard end is USB (Universal Serial Bus, universal serial bus) interface,
SPI interface is converted to, then overlaps 429 modules and is communicated.
In the prior art, turn the demand of SPI interface for USB, MICROCHIP manufacturer is proposed a MCP2210 core
Piece, the major function of the chip are to realize the conversion of USB interface to SPI interface.But the USB that MICROCHIP is provided turns SPI
Scheme is only supported to develop at Windows, does not support other operating systems, more can not achieve cross-platform application, cannot
Solve the demand under Embedded other platforms such as linux system.
Therefore, it needs to invent a kind of system bus conversion method, can develop and make in the environment of in addition to Windows
With the USB for solving the environment in addition to Windows turns the requirement of SPI interface.
Summary of the invention
System bus conversion method provided by the invention, can in view of the deficiencies of the prior art, solve MCP2210 chip without
The problem of USB interface is transformed into SPI interface under the system in addition to Windows by method.
The present invention provides a kind of system bus conversion method, including:
Step 1: providing the upper layer application for being applicable in SPI;
Step 2: system adaptation module is added in the upper layer application, for judging current system before SPI transmission
Type;
Step 3: calling the corresponding bottom library access scheme of the system type according to the judging result of the step 2
Realize the SPI transmission;
Step 4: transferring data to USB processing module by bottom library access scheme, and by the system type
Corresponding processor carries out data processing.
Optionally, the upper layer application in above-mentioned steps one is developed by C++ or QT.
Optionally, the upper layer application in above-mentioned steps one can be used across multiple platforms.
Optionally, the system adaptation module in above-mentioned steps two is for judging Windows system or linux system.
Optionally, the SPI transmission in above-mentioned steps two includes being transmitted by the API of SPI protocol.
Optionally, in above-mentioned steps three, when the step 2 judging result be Windows system, then use
The bottom library access scheme that MICROCHIP is provided;When the judging result of the step 2 is linux system, then using Linux system
It unites dedicated bottom library access scheme.
Optionally, the dedicated bottom library access scheme of above-mentioned linux system includes: starting access interface API, is used for upper layer
Using progress data access;Start standard character device drives, for handling the standard character of external equipment input;Start USB
Device drives, for handling USB device related data;Start USB kernel, for handling usb protocol related data packets.
Optionally, above-mentioned standard char device driver and USB device driving are programmed using C language.
Optionally, the USB processing module in above-mentioned steps four includes external input device, USB device and/or USB kernel.
Optionally, the processor in above-mentioned steps four includes CPU.
System bus conversion method provided by the invention can develop the cross-platform upper level applications used by QT,
It is allowed to be applicable to different system and hardware platform it is not necessary to modify source code;In addition, the present invention also passes through addition linux system
Layer support be embodied as not homologous ray and hardware platform the access of bottom library be provided, it is only necessary to can be flat in difference by API Calls
It is correctly run on platform.
Detailed description of the invention
Fig. 1 is the whole architecture diagram that USB is converted to SPI by MCP2210 chip in the prior art;
Fig. 2 is the whole architecture diagram of the system bus conversion in one embodiment of the invention;
Fig. 3 is the flow chart that the upper layer application of one embodiment of the invention judges current system environment;
Fig. 4 is the configuration diagram in the bottom library for linux system of one embodiment of the invention;
Fig. 5 is the flow chart of the system bus conversion method of one embodiment of the invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is only
It is only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, ordinary skill
Personnel's every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
Fig. 1 shows the whole architecture diagram that USB is converted to SPI by MCP2210 chip in the prior art.As schemed
Show, top is APP application program, is API (the Application Programming of SPI protocol below application program
Interface, application programming interface), for shielding the characteristic of bottom hardware;Third layer is HID (Human
Interface Device, human-computer interaction device) protocol layer, HID can include but is not limited to such as keyboard, mouse, hand lever,
The HID protocol layer is for facilitating User Exploitation;4th layer is driving layer, including but not limited to USB device driving and host control
Device driving, the relevant data of processing USB device;Layer 5 is core layer, for handling the relevant data packet of usb protocol;Most bottom
Layer is hardware layer.
Particularly, in Windows operating system, the DLL of application program and system (Dynamic Link Library,
Dynamic link library) file is developed using VB and is not increased income, but application program is increased income.
To solve the only support that the USB of MICROCHIP is converted to the whole software architecture scheme of SPI
The shortcomings that Windows system, the present invention use C language programming tool, add the bottom layer driving layer under Linux, make
The whole software architecture scheme that USB is converted to SPI supports the extensive linux system of embedded middle use.
Fig. 2 shows the whole architecture diagrams of the system bus conversion in one embodiment of the present of invention.The present invention exists
Adaptation layer is added on the basis of the MCP2210 of the prior art, different platforms is adapted to, keeps application program compatibility different
System and hardware platform.As shown, top is APP application program, it is the API of SPI protocol below application program
(Application Programming Interface, application programming interface), for shielding the characteristic of bottom hardware;
Third layer is adaptation layer, for being adapted to different platforms, makes application program compatible different system and hardware platform;The
Four layers are HID (Human Interface Device, human-computer interaction device) protocol layer, and HID can include but is not limited to for example
Keyboard, mouse, hand lever etc., the HID protocol layer is for facilitating User Exploitation;Layer 5 is driving layer, and including but not limited to USB is set
Standby driving and Host controller driver, the relevant data of processing USB device;Layer 6 is core layer, for handling usb protocol phase
The data packet of pass;The bottom is hardware layer.
Specifically, being developed at the middle and upper levels using C++ or QT in the solution of the present invention, since QT is cross-platform exploitation work
Tool, so upper level applications can easily realize cross-platform, such as ARM platform.Particularly, the bottom of corresponding upper layer application drives
It is dynamic only to be realized on each platform, and unified api interface is provided to application program.Particularly, bottom layer driving using C language into
Row programming.
Further, the MICROCHIP scheme of upper layer application compared with prior art, joined judgment step.Particularly, exist
Before the library function for calling SPI transmission, judges that current system is Linux environment or Windows environment, then call and correspond to respectively
Operating system transmission library function.
Fig. 3 shows the flow chart that the upper layer application of one embodiment of the present of invention judges current system environment.
As shown, application judges whether equipment has connected first;When judging that equipment has connected, transmission of the input for judgement
Data, judge current system whether linux system;When judging current system for linux system, the library function of Linux is called
It is accessed for bottom library, when judging current system not is linux system, the library function of Windows is called to visit for bottom library
It asks;Subsequently determine whether data return to success, if data return to the data for successfully printing return, if data return not
Success, then terminate whole flow process.
One side, for Windows environment, still call the bottom to application that MICROCHIP is provided in the prior art
The scheme that library accesses.Another aspect, for linux system, then bsp driver is separately developed, being achieved can
The access of upper layer application is realized at Windows, and can be compatible with linux system.
Fig. 4 shows the configuration diagram in the bottom library for linux system of one embodiment of the present of invention.As schemed
Show, the whole software of system bus conversion of the invention is mainly made of four parts in the bottom library of Linux environment: being assisted in HID
View level provides access interface API to upper layer application based on API library;Pass through the data of char device driver processing character equipment
Information;USB interface related data information corresponding with character device data information is handled by USB device driving;And pass through
System kernel layer handles usb protocol related data packets.To realize the stream compression in bottom library under linux system.
Fig. 5 shows the flow chart of system bus conversion method provided by one embodiment of the present invention.As shown, S51
To provide the upper layer application for being applicable in SPI;S52 is that system adaptation module is added in upper layer application, for the judgement before SPI is transmitted
Current system type;S53 be according to the judging result of system type, the corresponding bottom library access scheme of calling system type with
Realize the SPI transmission;S54 is by bottom library access scheme to transfer data to USB processing module, and by the system class
The corresponding processor of type carries out data processing.
System bus conversion method provided by the invention can develop the cross-platform upper level applications used by QT,
It is allowed to be applicable to different system and hardware platform it is not necessary to modify source code;In addition, the present invention also passes through addition linux system
Layer support be embodied as not homologous ray and hardware platform the access of bottom library be provided, it is only necessary to can be flat in difference by API Calls
It is correctly run on platform.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any
In the technical scope disclosed by the present invention, any changes or substitutions that can be easily thought of by those familiar with the art, all answers
It is included within the scope of the present invention.Therefore, protection scope of the present invention should be subject to the protection scope in claims.
Claims (10)
1. a kind of system bus conversion method characterized by comprising
Step 1: providing the upper layer application for being applicable in SPI;
Step 2: system adaptation module is added in the upper layer application, for judging current system class before SPI transmission
Type;
Step 3: calling the corresponding bottom library access scheme of the system type to realize according to the judging result of the step 2
The SPI transmission;
Step 4: transferring data to USB processing module by bottom library access scheme, and corresponded to by the system type
Processor carry out data processing.
2. system according to claim 1 general line system method, which is characterized in that the upper layer application in the step 1 is logical
It crosses C++ or QT is developed.
3. system according to claim 1 general line system method, which is characterized in that the upper layer application energy in the step 1
It is enough to be used across multiple platforms.
4. system according to claim 1 general line system method, which is characterized in that the system adaptation mould in the step 2
Block is for judging Windows system or linux system.
5. system bus conversion method according to claim 4, which is characterized in that the SPI in the step 2 transmits packet
It includes and is transmitted by the API of SPI protocol.
6. USB according to claim 4 turns SPI method, which is characterized in that in the step 3, when the step 2
Judging result is Windows system, then the bottom library access scheme provided using MICROCHIP;When the judgement of the step 2
As a result it is linux system, then uses the dedicated bottom library access scheme of linux system.
7. system bus conversion method according to claim 6, which is characterized in that the dedicated bottom of linux system
Library access scheme includes:
Start access interface API, carries out data access for upper layer application;
Start standard character device drives, for handling the standard character of external equipment input;
Start USB device driving, for handling USB device related data;
Start USB kernel, for handling usb protocol related data packets.
8. system bus conversion method according to claim 7, which is characterized in that the standard character device drives and institute
USB device driving is stated to be programmed using C language.
9. system according to claim 1 general line system method, which is characterized in that the USB in the step 4 handles mould
Block includes external input device, USB device and/or USB kernel.
10. system according to claim 1 general line system method, which is characterized in that the processor packet in the step 4
Include CPU.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710475483.4A CN109101445A (en) | 2017-06-21 | 2017-06-21 | A kind of system bus conversion method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710475483.4A CN109101445A (en) | 2017-06-21 | 2017-06-21 | A kind of system bus conversion method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN109101445A true CN109101445A (en) | 2018-12-28 |
Family
ID=64796262
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710475483.4A Pending CN109101445A (en) | 2017-06-21 | 2017-06-21 | A kind of system bus conversion method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109101445A (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102355409A (en) * | 2011-08-16 | 2012-02-15 | 中国科学院计算技术研究所 | Data one-way transmission system |
CN103970706A (en) * | 2014-05-14 | 2014-08-06 | 赵美惠 | External expansion system of mobile device based on FT311D interface chip |
-
2017
- 2017-06-21 CN CN201710475483.4A patent/CN109101445A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102355409A (en) * | 2011-08-16 | 2012-02-15 | 中国科学院计算技术研究所 | Data one-way transmission system |
CN103970706A (en) * | 2014-05-14 | 2014-08-06 | 赵美惠 | External expansion system of mobile device based on FT311D interface chip |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102567074B (en) | USB (universal serial bus) device redirecting method facing virtual machines | |
CN1107894C (en) | Mobile client computer interface for user input device | |
US20060005186A1 (en) | Systems and methods for stack-jumping between a virtual machine and a host environment | |
CN1722092A (en) | VEX - virtual extension framework | |
CN86100690A (en) | Processor I/O and interruption filtrator | |
US20130211812A1 (en) | Conveying data from a hardware device to a circuit simulation | |
CN101520738A (en) | Virtual machine system based on the management technology of equipment access storage and equipment access control method thereof | |
CN204759403U (en) | System based on data pass realization equipment internal module thoroughly and upgrade | |
CN103874984A (en) | Virtualizable and forward-compatible hardware-software interface | |
RU2007143547A (en) | TECHNOLOGIES FOR PROVIDING CORRECTNESS AND TRANSFER OF INFORMATION | |
CN103873489A (en) | Device sharing system with PCIe interface and device sharing method with PCIe interface | |
CN103064796A (en) | Virtual machine memory sharing method and computer system | |
CN105701037B (en) | Weston and DRM accesses the system and method for display controller simultaneously in vehicle entertainment system | |
Wang et al. | Modeling and integration of peripheral devices in embedded systems | |
CN104360860B (en) | A kind of domestic autonomous embedded computer system and its video driver method | |
CN205103599U (en) | Cross -border trade BPO uses cloud terminating set | |
US20100064058A1 (en) | Communication method and an interface device | |
CN101369258B (en) | Input/output control system | |
CN103227825A (en) | Desktop all-in-one machine framework | |
CN109101445A (en) | A kind of system bus conversion method | |
CN101840391A (en) | Electronic payment system dual-processor sub-system communication method and calling method thereof | |
CN101382875B (en) | Kvm switch identifying peripheral for computer and method thereof | |
JP4809166B2 (en) | Computer system constituting remote I / O and I / O data transfer method | |
CN100361104C (en) | User-defined interrupt signal response processing method and system under interrupt share mechanism | |
CN114461186A (en) | Method for automatically compiling and running C/C + + code for Huaji Shengteng accelerator card |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181228 |