CN103713908A - Method for designing digital quantity input functional unit driving program of CPCI (compact peripheral component interface) bus under VxWorks operating system - Google Patents

Method for designing digital quantity input functional unit driving program of CPCI (compact peripheral component interface) bus under VxWorks operating system Download PDF

Info

Publication number
CN103713908A
CN103713908A CN201410024766.3A CN201410024766A CN103713908A CN 103713908 A CN103713908 A CN 103713908A CN 201410024766 A CN201410024766 A CN 201410024766A CN 103713908 A CN103713908 A CN 103713908A
Authority
CN
China
Prior art keywords
function
input
plate
digital
digital quantity
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
Application number
CN201410024766.3A
Other languages
Chinese (zh)
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.)
Harbin Institute of Technology
Original Assignee
Harbin Institute of Technology
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 Harbin Institute of Technology filed Critical Harbin Institute of Technology
Priority to CN201410024766.3A priority Critical patent/CN103713908A/en
Publication of CN103713908A publication Critical patent/CN103713908A/en
Pending legal-status Critical Current

Links

Images

Abstract

The invention relates to a method for designing a digital quantity input functional unit driving program of a CPCI (compact peripheral component interface) bus under a VxWorks operating system, and the method is used for solving the problem of the traditional digital quantity input module driving program development based on the CPCI bus under the VxWorks operating system that the data structure of the device needs to be abstracted by the development personnel and the complicated process for establishing the device and installing the device driving program brings inconvenient to the development personnel. A digital quantity input functional module is operated in a CPCI case, an application program is operated on a control computer, and the digital quantity input functional module is controlled by virtue of the CPCI bus. The method for designing the driving program of the digital quantity input functional module mainly comprises the following steps: initializing the device, and realizing and encapsulating a function interface. By adopting the method, the control of the digital quantity input functional module is realized, the form of the driving interface is directly defined for the application program, and the functional interface function is directly encapsulated.

Description

Cpci bus digital quantity input function unit drives Programming Methodology under vxworks operating system
Technical field
The present invention relates to cpci bus digital quantity input function unit drives Programming Methodology under vxworks operating system, belong to digital quantity input functional module Driver Development field.
Background technology
Under vxworks operating system, cpci bus digital quantity input functional module, as test module important in Auto-Test System, has been widely used in every field.Digital quantity input module Driver Development based on cpci bus under traditional vxworks operating system, as required, realize corresponding power function interface, and be packaged into I/O interface (the I/O interface of seven standards of standard, open () for example, close (), read () etc.), be registered in system drive list, be articulated under I/O subsystem.In whole process, driving developer need to take out the data structure of equipment, the establishment of finishing equipment and the installation of device driver, and this process more complicated, gives and drives developer to bring a lot of inconvenience.
For the problems referred to above, the present invention proposes Driver Design and the encapsulation of cpci bus digital quantity input module under vxworks operating system, according to the common operation to digital quantity input functional module, propose a kind of new digital quantity input and drive interface encapsulation form, when digital quantity input functional module effectively being controlled to realize, can greatly reduce the development difficulty that drives developer.
Summary of the invention
The object of the invention is to invent the driver design method of cpci bus digital quantity input functional module under a kind of vxworks operating system, to solve the digital quantity input module Driver Development based on cpci bus under traditional vxworks operating system, there is the data structure that drives developer need to take out equipment, the complex process of the establishment of finishing equipment and the installation of device driver, gives and drives developer to bring the problem of a lot of inconvenience.
The present invention solves the problems of the technologies described above the technical scheme of taking to be:
A cpci bus digital quantity input function unit drives Programming Methodology under vxworks operating system, the specific implementation process of described method is:
Step 1, initialization apparatus:
Initialization apparatus process is hardware distributing system resource, obtains facility information, device memory mapping and the Break Link of the digital quantity input functional module based on cpci bus;
The realization of step 2, power function and encapsulation:
Power function interface is used for realizing the concrete operations to digital quantity input functional module, for the operation of digital quantity input functional module, mainly contains and opens, closes and read functions;
The major control process of digital quantity input functional module is: first application program carries out the operation of opening designation number amount load module board, load the driver of digital quantity input module, then call number amount is inputted acquisition interface, application program is imported plate number and the channel number of digital quantity input module into, enable corresponding digital quantity input channel, gather digital quantity input; 32 railway digital amount inputs are controlled by 2 16 bit registers;
Digital quantity input module, after system powers on, completes the memory-mapped of board, and according to the register interface handbook of hardware and each operation that drives interface function to complete, each drives interface function to carry out specific implementation, and detailed process is:
Step 2 (1), open digital quantity input function unit (digital input card): (in Table 1)
Load digital quantity input driver, open the digital input of given plate number, so that digital input is carried out to subsequent operation; The output channel of digital input is carried out to zero clearing;
Function prototype is STATUS IOOpen (int num),
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Rreturn value is opened and is successfully returned to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of IOOpen function is as follows:
First the digital input card number that application passes will be opened, in function body, judge whether plate is number correct, if correct, the digital input card memory-mapped base value obtaining after initialization function is carried out is assigned to a global variable, again to each passage zero clearing of designation number amount input card, last function returns to OK, if not being user, plate parameter do not allow, Returning plate fault code.
Step 2 (2), close digital quantity input function unit (digital input):
Close the digital input of given plate number, unloading I/O driver, discharges the hardware resource of I/O plate after completing, can not other operations except opening to I/O plate again;
Function prototype is STATUS IOClose (int num);
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Rreturn value is closed and is successfully returned to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure following (as Fig. 4) of IOClose function:
First the designation number amount tablet card number that application passes will be closed, in function body, whether the plate parameter that judgement is transmitted is correct, if correct, will preserve the global variable zero clearing of memory base address, function returns to OK, if plate card number mistake, Returning plate fault code.
Step 2 (3), the operation of digital quantity input function unit (digital input) read bit: (in Table 3)
The plate number of designation number amount tablet, reads the state of specifying a road input channel, and result is passed to char type parameter pointer * pdata;
Function prototype is STATUS IOReadBit (int num, int chan, char*pdata)
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Int chan is channel number, assignment 0~M-1, the input channel quantity that M is digital input;
Char*pdata deposits reading result, and value is 0 or 1;
Rreturn value reads successfully returns to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of IOReadBit function is as follows: (shown in Fig. 5):
The implementation procedure of DARevertData function is as follows:
First application passes will be carried out digital input card number and the channel number parameter of data input, in function body, whether the plate that first judgement is transmitted number is the plate number that user allows input, if so, more further judge whether the channel number transmitting is the channel number that user allows input, if, the state value of input channel is specified in retaking of a year or grade, and preserve, function returns to OK, represents that user can read the state value of specifying input channel from corresponding passage.If the process of above-mentioned judgement occurs negating to exit function and return to corresponding fault code.
Byte manipulation is read in step 2 (4), digital quantity input function unit (digital input): (in Table 4)
The plate number of designation number amount tablet, the data that the offset of take is a byte of side-play amount address read, i.e. the state of 8 input channels, and result is passed to char type parameter pointer * pdata;
Function prototype is STATUS IOReadByte (int num, int offset, char*pdata);
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Offset is side-play amount, assignment 0~P-1, and the input channel quantity that P is digital input is divided by 8;
Pdata is for storing the result reading, value 00~FFH;
Rreturn value reads successfully returns to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code; Side-play amount that can also identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of function IOReadByte is as follows:
First application passes will be carried out digital input card number and the offset parameter of data input, in function body, whether the plate that first judgement is transmitted number is the plate number that user allows input, if so, more further judge whether the channel number transmitting is the side-play amount that user allows input, if, the state value of 8 tunnel input channels is specified in retaking of a year or grade, and preserve, function returns to OK, represents that user can read the state value of specifying input channel from corresponding passage.If the process of above-mentioned judgement occurs negating to exit function and return to corresponding fault code.
Full tunnel operation is read in step 2 (5) digital quantity input function unit (digital input): (in Table 5)
The plate number of designation number amount tablet, reads the state of all input channels of plate, and result is placed in the data b uffer that specifies first address;
STATUS?IOReadAll(int?num,char*pbuf)
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Buffer is first address, and buffer size is fixed according to hardware physical channel number according to hardware;
Rreturn value reads successfully returns to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of function IOReadAll is as follows:
First application passes will be carried out digital input card number and the offset parameter of data input, and in function body, whether the plate that first judgement is transmitted number is the plate number that user allows input, if, the state value of all input channels of retaking of a year or grade, and preserve, function returns to OK.If the process of above-mentioned judgement occurs negating to exit function and return to corresponding fault code.
Step 2 (6), digital quantity input function unit (digital input) Real-Time Monitoring: (in Table 6)
Digital input to the plate of appointment number carries out Real-Time Monitoring in place;
Function prototype is STATUS IORTWatch (int num);
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the quantity of the digital input of computing machine;
OK is normally returned in rreturn value monitoring, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of IORTWatch function is as follows:
First application passes designation number amount input function cell board number, in function body, whether the plate number that judgement is transmitted is the plate number that user allows, if, next step calls PciFindDevice () function, whether the rreturn value that judges PciFindDevice () function is OK, and if so, function interface returns to OK.If above-mentioned judgement occurs, if the process of above-mentioned judgement occurs negating to exit function and return to corresponding fault code.
The specific implementation process of described step 1 is:
Step 1 (1) is obtained the facility information of the digital quantity input functional module based on cpci bus
After PCI device power, BIOS PCI allocation equipment, the BIOS of target machine lists the interrupt number information of the PCI equipment that finds and Vendor ID, Device ID, device type, distribution when starting;
Initialization function first utilizes function pciFindDevice () to find corresponding equipment according to equipment Vendor ID and Device ID, according to Vendor ID, Device ID and identical device serial number (may have identical PCI equipment in a system), scan bus, find out BUS No, Device No and the Func No at equipment place; Then according to Bus number, device number and function number, call register base address and the interrupt number that pciConfigInLong () and pciConfigInByte () function are determined equipment; Again base address and I/O mask bit phase with obtain internal register base address on real plate;
The mapping of step 1 (2) device memory
User uses the MMU(memory management unit of the standard that VxWorks provides) distribute the memory headroom of PCI equipment; After clear and definite base address and memory headroom size, call function sysMmuMapAdd () function is configured to MMU by memory headroom; Complete after the device memory mapping of digital quantity input functional module, by the access to device memory, realize the control to equipment;
Step 1 (3) Break Link
In vxworks operating system, use intConnect () link interruption service routine (ISR), adopt pciIntConncet () to articulate interruption, pciIntConncet () is defined in pciIntLib.c, during use, comprise header file pciIntLib.h, interrupt vector ventor is by the INUM_TO_IVEC acquisition that converts;
After using pciIntConnect () function that interruption and specific c program are coupled together under VxWorks system, described function is associated the C function of appointment with the interrupt vector of appointment, the address of function will be stored in described interrupt vector, when an interrupt occurs, system will be called described specific c program function, i.e. interrupt service routine.
The invention has the beneficial effects as follows:
The present invention is according to the feature of digital quantity input functional module, exploitation drives the control realizing digital quantity input functional module, a kind of driving interface encapsulation form of new digital quantity input functional module is provided simultaneously, application program-oriented method directly defines the form that drives interface, directly encapsulation function interface function.In driving the process of exploitation, the design, the equipment that do not relate to the device data structure of conventional digital amount input functional module create and drive installation, have reduced to a great extent the development difficulty that drives developer like this.This advantage of tool shows the following aspects;
1) the digital quantity input functional module driver that, this method provides can be realized the effective control to functional module;
2) the direct user oriented application program of digital quantity input functional module driver that, this method provides provides general driving function interface;
3) the digital quantity input functional module Driver Design that, this method provides and encapsulation reduce the difficulty that drives exploitation greatly;
4), this method the digital quantity input functional module Driver Design and the encapsulation that provide have independence and versatility, can be applicable to other design.
Accompanying drawing explanation
Fig. 1 is the integrated stand composition of digital input amount functional module, Fig. 2 is initialization function process flow diagram, Fig. 3 opens digital input process flow diagram, Fig. 4 closes digital input flow process, Fig. 5 is digital input read bit running program process flow diagram, Fig. 6 is that digital input is read byte program process flow diagram, and Fig. 7 is that full tunnel program flow diagram is read in digital quantity input, and Fig. 8 is digital input Real-Time Monitoring figure.
Embodiment
Referring to Fig. 1 to Fig. 8, present embodiment is that cpci bus digital quantity input function unit drives Programming Methodology under vxworks operating system of the present invention is described in detail:
The overall architecture of the digital quantity input functional module described in present embodiment is as shown in Figure 1:
Digital quantity input functional module operates in CPCI cabinet, controls computing machine and is realized the read-write of digital quantity input functional module is controlled by cpci bus.Between cpci bus and digital quantity input function circuit, need to realize cpci bus interface controller, cpci bus controller adopts the PCI9054 interface chip of PLX company to realize, and cpci bus is transformed into local bus.Complete compatible with PCI 2.2 standards of PCI9054 interface chip, and burst rate is high, and price is low, and versatility is good, can effectively reduce development difficulty.PCI9054 local bus end is used FPGA to realize bus interface decoding, and meanwhile, FPGA indoor design control register, realizes the control to digital quantity input function circuit.Digital quantity input functional module You32 road optocoupler forms.FPGA is inputted in outside 32 railway digital amount inputs after light-coupled isolation, and FPGA can detect the state of input channel.
Digital quantity input functional module Driver Design process is:
In digital quantity input functional module operation CPCI cabinet, application program operates in to be controlled on computing machine, by cpci bus, realizes the control to digital quantity input functional module, therefore needs the driver of exploitation based on cpci bus digital quantity input functional module.The Driver Design of digital quantity input functional module mainly comprises initialization apparatus, the realization of power function interface and encapsulation.
Step 1, initialization apparatus
Initialization apparatus, as the important step of CPCI Development of device driver, is to be mainly hardware distributing system resource, is mainly facility information, device memory mapping and the Break Link that obtains the digital quantity input functional module based on cpci bus here.
(1) obtain the facility information of the digital quantity input functional module based on cpci bus
After PCI device power, BIOS can PCI allocation equipment.The BIOS of target machine has the information such as interrupt number that the PCI equipment that finds and Vendor ID, Device ID, device type, distribution are listed in an interface when starting.
Initialization function first utilizes function pciFindDevice () to find corresponding equipment according to equipment Vendor ID and Device ID, according to Vendor ID, Device ID and identical device serial number (may have identical PCI equipment in a system), scan bus, find out the BUS No.(Bus number at equipment place), Device No.(device number) and Func No.(function number).Then according to Bus number, device number and function number, call register base address and the interrupt number that pciConfigInLong () and pciConfigInByte () function are determined equipment.Again base address and I/O mask bit phase with obtain internal register base address on real plate.Initialization function flow process is illustrated in fig. 2 shown below.
(2) device memory mapping
VxWorks provides the MMU(memory management unit of standard), user can distribute with MMU the memory headroom of PCI equipment.After clear and definite base address and memory headroom size, call function sysMmuMapAdd () function can be configured to MMU by memory headroom.Completed after the device memory mapping of digital quantity input functional module, can pass through the access to device memory, realized the control to equipment.
(3) Break Link
In vxworks operating system, use intConnect () link interruption service routine (ISR), but for CPCI equipment, the general pciIntConncet () that adopts articulates interruption, the main difference of it and intConnect () is that the interrupt vector that intConnect () is used monopolizes, and pciIntConncet () can make a plurality of external interrupt share an interrupt vector.PciIntConncet () is defined in pciIntLib.c, during use, should comprise header file pciIntLib.h.Should notice that ventor is interrupt vector, need to be by the INUM_TO_IVEC acquisition that converts.
After using pciIntConnect () function that interruption and specific c program are coupled together under VxWorks system, this function is associated the C function of appointment with the interrupt vector of appointment, and the address of function will be stored in this interrupt vector.When an interrupt occurs, system will be called this specific c program function, i.e. interrupt service routine.
The realization of step 2, power function interface and encapsulation
Power function interface is used for realizing the concrete operations to digital quantity input functional module, and for the operation of digital quantity input functional module, common mainly containing such as opens, closes and read at the function.
The major control process of digital quantity input functional module is: first application program carries out the operation of opening designation number amount load module board, load the driver of digital quantity input module, next step call number amount input acquisition interface, application program is imported plate number and the channel number of digital quantity input module into, enable corresponding digital quantity input channel, gather digital quantity input.32 railway digital amount inputs are controlled by 2 16 bit registers.
Digital quantity input module, after system powers on, completes the memory-mapped of board, the driving hardware register interface handbook providing according to hardware design personnel and each operation that drives interface function to complete, and each drives interface function to carry out specific implementation.
(1), open digital input card, in Table 1
Table 1 is opened digital input card
Figure BDA0000453819220000071
Figure BDA0000453819220000081
Program flow diagram is illustrated in fig. 3 shown below;
(2), close digital input, in Table 2;
Table 2 is closed digital input
Figure BDA0000453819220000082
Program realization flow is illustrated in fig. 4 shown below;
(3), digital input read bit operation, in Table 3;
The operation of table 3 digital input read bit
Figure BDA0000453819220000083
Program realization flow is illustrated in fig. 5 shown below;
(4), digital input reads byte manipulation, in Table 4;
Table 4 digital input is read byte manipulation
Figure BDA0000453819220000091
Program realization flow is illustrated in fig. 6 shown below;
(5), digital input reads full tunnel operation, in Table 5;
Table 5 digital input is read full tunnel operation
Figure BDA0000453819220000092
Program realization flow is illustrated in fig. 7 shown below;
(6), digital input Real-Time Monitoring, in Table 6;
Table 6I/O plate Real-Time Monitoring
Figure BDA0000453819220000101
Program circuit is illustrated in fig. 8 shown below.

Claims (2)

1. a cpci bus digital quantity input function unit drives Programming Methodology under vxworks operating system, is characterized in that, the specific implementation process of described method is:
Step 1, initialization apparatus:
Initialization apparatus process is hardware distributing system resource, obtains facility information, device memory mapping and the Break Link of the digital quantity input functional module based on cpci bus;
The realization of step 2, power function and encapsulation:
Power function interface is used for realizing the concrete operations to digital quantity input functional module, for the operation of digital quantity input functional module, mainly contains and opens, closes and read functions;
The major control process of digital quantity input functional module is: first application program carries out the operation of opening designation number amount load module board, load the driver of digital quantity input module, then call number amount is inputted acquisition interface, application program is imported plate number and the channel number of digital quantity input module into, enable corresponding digital quantity input channel, gather digital quantity input; 32 railway digital amount inputs are controlled by 2 16 bit registers;
Digital quantity input module, after system powers on, completes the memory-mapped of board, and according to the register interface handbook of hardware and each operation that drives interface function to complete, each drives interface function to carry out specific implementation, and detailed process is:
Step 2 (1), open digital quantity input function unit:
Load digital quantity input driver, open the digital input of given plate number, so that digital input is carried out to subsequent operation; The output channel of digital input is carried out to zero clearing;
Function prototype is STATUS IOOpen (int num),
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Rreturn value is opened and is successfully returned to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of IOOpen function is as follows:
First the digital input card number that application passes will be opened, in function body, judge whether plate is number correct, if correct, the digital input card memory-mapped base value obtaining after initialization function is carried out is assigned to a global variable, again to each passage zero clearing of designation number amount input card, last function returns to OK, if not being user, plate parameter do not allow, Returning plate fault code;
Step 2 (2), close digital quantity input function unit:
Close the digital input of given plate number, unloading I/O driver, discharges the hardware resource of I/O plate after completing, can not other operations except opening to I/O plate again;
Function prototype is STATUS IOClose (int num);
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Rreturn value is closed and is successfully returned to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of IOClose function is as follows:
First the designation number amount tablet card number that application passes will be closed, in function body, whether the plate parameter that judgement is transmitted is correct, if correct, will preserve the global variable zero clearing of memory base address, function returns to OK, if plate card number mistake, Returning plate fault code;
Step 2 (3), the operation of digital quantity input function unit read bit:
The plate number of designation number amount tablet, reads the state of specifying a road input channel, and result is passed to char type parameter pointer * pdata;
Function prototype is STATUS IOReadBit (int num, int chan, char*pdata)
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Int chan is channel number, assignment 0~M-1, the input channel quantity that M is digital input;
Char*pdata deposits reading result, and value is 0 or 1;
Rreturn value reads successfully returns to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of IOReadBit function is as follows:
The implementation procedure of DARevertData function is as follows:
First application passes will be carried out digital input card number and the channel number parameter of data input, in function body, whether the plate that first judgement is transmitted number is the plate number that user allows input, if so, more further judge whether the channel number transmitting is the channel number that user allows input, if, the state value of input channel is specified in retaking of a year or grade, and preserve, function returns to OK, represents that user can read the state value of specifying input channel from corresponding passage; If the process of above-mentioned judgement occurs negating to exit function and return to corresponding fault code;
Byte manipulation is read in step 2 (4), digital quantity input function unit:
The plate number of designation number amount tablet, the data that the offset of take is a byte of side-play amount address read, i.e. the state of 8 input channels, and result is passed to char type parameter pointer * pdata;
Function prototype is STATUS IOReadByte (int num, int offset, char*pdata);
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Offset is side-play amount, assignment 0~P-1, and the input channel quantity that P is digital input is divided by 8;
Pdata is for storing the result reading, value 00~FFH;
Rreturn value reads successfully returns to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code; Side-play amount that can also identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of function IOReadByte is as follows:
First application passes will be carried out digital input card number and the offset parameter of data input, in function body, whether the plate that first judgement is transmitted number is the plate number that user allows input, if so, more further judge whether the channel number transmitting is the side-play amount that user allows input, if, the state value of 8 tunnel input channels is specified in retaking of a year or grade, and preserve, function returns to OK, represents that user can read the state value of specifying input channel from corresponding passage; If the process of above-mentioned judgement occurs negating to exit function and return to corresponding fault code;
Full tunnel operation is read in step 2 (5) digital quantity input function unit:
The plate number of designation number amount tablet, reads the state of all input channels of plate, and result is placed in the data b uffer that specifies first address;
STATUS?IOReadAll(int?num,char*pbuf)
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the digital input quantity of computing machine;
Buffer is first address, and buffer size is fixed according to hardware physical channel number according to hardware;
Rreturn value reads successfully returns to OK, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of function IOReadAll is as follows:
First application passes will be carried out digital input card number and the offset parameter of data input, and in function body, whether the plate that first judgement is transmitted number is the plate number that user allows input, if, the state value of all input channels of retaking of a year or grade, and preserve, function returns to OK; If the process of above-mentioned judgement occurs negating to exit function and return to corresponding fault code;
Step 2 (6), digital quantity input function unit Real-Time Monitoring:
Digital input to the plate of appointment number carries out Real-Time Monitoring in place;
Function prototype is STATUS IORTWatch (int num);
Suction parameter num is plate number, and scope is 1~N, and N is for controlling the quantity of the digital input of computing machine;
OK is normally returned in rreturn value monitoring, unsuccessfully returns to non-zero negative value diagnostic trouble code;
Number input of the plate of described function energy identification error, and return to corresponding diagnostic trouble code;
The implementation procedure of IORTWatch function is as follows:
First application passes designation number amount input function cell board number, in function body, whether the plate number that judgement is transmitted is the plate number that user allows, if, next step calls PciFindDevice () function, whether the rreturn value that judges PciFindDevice () function is OK, and if so, function interface returns to OK; If above-mentioned judgement occurs, if the process of above-mentioned judgement occurs negating to exit function and return to corresponding fault code.
2. cpci bus digital quantity input function unit drives Programming Methodology under a kind of vxworks operating system according to claim 1, is characterized in that, the specific implementation process of described step 1 is:
Step 1 (1) is obtained the facility information of the digital quantity input functional module based on cpci bus:
After PCI device power, BIOS PCI allocation equipment, the BIOS of target machine lists the interrupt number information of the PCI equipment that finds and Vendor ID, Device ID, device type, distribution when starting;
Initialization function first utilizes function pciFindDevice () to find corresponding equipment according to equipment Vendor ID and Device ID, according to Vendor ID, Device ID and identical device serial number, scan bus, find out BUS No, Device No and the Func No at equipment place; Then according to Bus number, device number and function number, call register base address and the interrupt number that pciConfigInLong () and pciConfigInByte () function are determined equipment; Again base address and I/O mask bit phase with obtain internal register base address on real plate;
The mapping of step 1 (2) device memory
The MMU of the standard that user provides with VxWorks distributes the memory headroom of PCI equipment; After clear and definite base address and memory headroom size, call function sysMmuMapAdd () function is configured to MMU by memory headroom; Complete after the device memory mapping of digital quantity input functional module, by the access to device memory, realize the control to equipment;
Step 1 (3) Break Link
In vxworks operating system, use intConnect () link interruption service routine, adopt pciIntConncet () to articulate interruption, pciIntConncet () is defined in pciIntLib.c, during use, comprise header file pciIntLib.h, interrupt vector ventor is by the INUM_TO_IVEC acquisition that converts;
After using pciIntConnect () function that interruption and specific c program are coupled together under VxWorks system, described function is associated the C function of appointment with the interrupt vector of appointment, the address of function will be stored in described interrupt vector, when an interrupt occurs, system will be called described specific c program function, i.e. interrupt service routine.
CN201410024766.3A 2014-01-07 2014-01-07 Method for designing digital quantity input functional unit driving program of CPCI (compact peripheral component interface) bus under VxWorks operating system Pending CN103713908A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410024766.3A CN103713908A (en) 2014-01-07 2014-01-07 Method for designing digital quantity input functional unit driving program of CPCI (compact peripheral component interface) bus under VxWorks operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410024766.3A CN103713908A (en) 2014-01-07 2014-01-07 Method for designing digital quantity input functional unit driving program of CPCI (compact peripheral component interface) bus under VxWorks operating system

Publications (1)

Publication Number Publication Date
CN103713908A true CN103713908A (en) 2014-04-09

Family

ID=50406915

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410024766.3A Pending CN103713908A (en) 2014-01-07 2014-01-07 Method for designing digital quantity input functional unit driving program of CPCI (compact peripheral component interface) bus under VxWorks operating system

Country Status (1)

Country Link
CN (1) CN103713908A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109117374A (en) * 2018-08-20 2019-01-01 浪潮电子信息产业股份有限公司 A kind of method and system of automatic acquisition failure
CN111124842A (en) * 2019-12-10 2020-05-08 山东超越数控电子股份有限公司 Method for displaying equipment information on domestic firmware interface
CN112231003A (en) * 2020-10-15 2021-01-15 天津津航计算技术研究所 CAN equipment management method under VxWorks system

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109117374A (en) * 2018-08-20 2019-01-01 浪潮电子信息产业股份有限公司 A kind of method and system of automatic acquisition failure
CN109117374B (en) * 2018-08-20 2021-10-22 浪潮电子信息产业股份有限公司 Method and system for automatically acquiring fault
CN111124842A (en) * 2019-12-10 2020-05-08 山东超越数控电子股份有限公司 Method for displaying equipment information on domestic firmware interface
CN112231003A (en) * 2020-10-15 2021-01-15 天津津航计算技术研究所 CAN equipment management method under VxWorks system

Similar Documents

Publication Publication Date Title
CN103412841B (en) The driver of cpci bus RS422 communication module and driving method under vxworks operating system
CN103309830A (en) Driver of CPCI bus CAN communicating module under VxWorks operating system and driving method
CN101626351A (en) Multiprotocol data acquisition gateway
CN103049363B (en) Verification method of NAND (neither agree not disagree) Flash controller
CN105446847A (en) Automatic testing system and method for ARINC659 buses
CN107562437A (en) A kind of system and method for the FPGA online upgradings based on the soft cores of MicroBlaze
CN105159731A (en) Field programmable gate array (FPGA) configuration file remote upgrading device
CN202362865U (en) Fault detection device for IC (integrated circuit) card pre-payment electric energy meter
CN103713908A (en) Method for designing digital quantity input functional unit driving program of CPCI (compact peripheral component interface) bus under VxWorks operating system
CN108664264A (en) A kind of device and method remotely updating FPGA by JTAG modes based on CPU
CN101206614A (en) Simulator for simulating register with specific function
CN113407393A (en) Chip verification method, terminal device, verification platform and storage medium
CN103677855A (en) Design method for driver of CPCI (Compact Peripheral Component Interconnect) bus DAC (digital-to-analog conversion) function unit under VxWorks operating system
CN103678187A (en) Micro-control unit and control method thereof
CN103412833A (en) CPCI (Compact Peripheral Component Interconnect) bus scanning ADC (Analog-to-Digital Converter) function module driver under VxWorks operating system and control method thereof
CN117278890B (en) Optical module access method, device and system, electronic equipment and readable storage medium
CN110209605A (en) The register reading/writing method and calculating equipment of PCIE Cardbus NIC Cardbus
CN109597765A (en) A kind of processor instruction adjustment method, device and the electronic equipment of FPGA
CN109358891A (en) A kind of the dsp software upgrade method and system of embedded controller
CN202205195U (en) Equipment for reading and writing physical memory of computer through IEEE 1394 interface
CN204680004U (en) Spaceborne embedded software reliability test verification system
CN103677856A (en) Method for designing CPCI bus switching-value output function unit driving program under the VxWorks operating system
CN108228314B (en) Virtual prototype error detection method based on equipment protocol
CN103412839B (en) Cpci bus Big Dipper time service positioning function device and driving method thereof and drive unit under vxworks operating system
CN105788639B (en) Radar data recorder power-off continuous cryopreservation device based on eMMC and renew method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20140409

WD01 Invention patent application deemed withdrawn after publication