Control method of multiple AWG board cards
Technical Field
The invention relates to the field of waveform generator control, in particular to a control method of a multi-AWG board card.
Background
The AWG (arbitrary Waveform Generator) is used as a signal generating device, can generate complex time-varying multipath signals, can measure performance indexes of equipment such as complex radars, electronic reconnaissance, friend or foe identification and the like in the military field, and provides various digital modulation signals; the method is widely applied in the field of scientific research, and particularly in some advanced scientific and technological research fields, the method needs to support the cooperative work of a plurality of AWG boards.
At present, new equipment handles are returned every time equipment is opened, so that the multiple paths of board cards cannot be correctly controlled, the control of the board cards is invalid, the waveform transmission fails, only the operation of a single AWG board card can be carried out, and the research, development and working efficiency are greatly reduced. Therefore, it is urgently needed to realize a control method for multiple AWG boards.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention provides a method for realizing simultaneous control by simultaneously inserting a plurality of AWG boards into a computer.
The technical scheme adopted by the invention for overcoming the technical problems is as follows:
a control method of a multi-AWG board card comprises the following steps:
a) inserting N AWG boards into PCIe slots of a mainboard on a computer, wherein N is a positive integer greater than or equal to 2;
b) installing a PCIe Xilinx DMA driver in a Windows system, and acquiring the number of AWG boards inserted into a current chassis by the Windows system;
c) the Windows system detects whether an AWG board card exists in a designated PCIe slot, if the matched AWG board card is not detected in the corresponding PCIe slot, error information is printed, and if the matched AWG board card is detected in the corresponding PCIe slot, the PCIe device is opened, and a device handle of the device is returned;
d) utilizing the uthash C code to dynamically create a hash table entry map _ item by using a malloc function, setting a key of the map _ item as the serial number ID of the AWG board card, and setting the value of the map _ item as the equipment handle of the AWG board card;
e) inserting the newly created hash table entry map _ item into the hash table map _ table to complete the insertion of new equipment;
f) when a user needs to operate the AWG board card in the appointed PCIe slot, the bottom layer code of the Windows system receives a slot number parameter of the PCIe slot transmitted from the upper layer, converts the slot number into a key value corresponding to the AWG board card, and searches a HASH table entry map _ item corresponding to the key value in a HASH table map _ table by using a HASH _ FIND _ INT interface;
g) the Windows system calls a ReadFile () interface, sets the interface parameter dev _ user as the value of a hash table entry map _ item, and sets the interface parameter address as the state or the vacant register address of an XDMA IP inner core to be read;
h) the Windows system calls a WriteFile () interface, sets the interface parameter dev _ user as the value of a hash table entry map _ item, sets the interface parameter address as the state or the vacant register address of an XDMA IP inner core to be read, and sets the interface parameter data as the written data;
i) when the slot number on the appointed case is switched, the HASH _ FIND _ INT interface returns different HASH table entry map _ item through the AWG card number ID.
Further, in the step b), the Windows system obtains the number of AWG boards inserted into the current chassis through the get _ devices () interface, identifies all PCIe devices by using the GUID identifier, fills the serial number of each device into the array at a time, and calls the get _ devices () interface to return the number of AWG boards inserted into the chassis successfully.
Further, the Windows system in step c) detects whether the AWG card exists in the designated PCIe slot by calling a check _ device _ exist () interface.
Further, the Windows system in step c) opens the PCIe device by calling the CreateFile () interface.
Further, the Windows system in step e) inserts the newly created HASH table entry map _ item into the map _ table using the HASH _ ADD _ INT () interface.
The invention has the beneficial effects that: the HASH _ FIND _ INT interface returns different HASH table entry map _ item through the AWG board card serial number ID, when the trigger mode setting operation is carried out on the board card again, the equipment handle is successfully updated to the AWG board card which is expected to be controlled at the moment, the control of multiple board cards can be successfully realized, through embedding the Hash data structure, the PCIe equipment handle is inserted and the operation is checked in a Hash key-value pair mode, and the problem that a plurality of AWG board cards cannot be normally controlled when being inserted into the computer case at the same time is solved.
Drawings
FIG. 1 is a flow chart of the method of the present invention.
Detailed Description
The invention is further described below with reference to fig. 1.
A control method of a multi-AWG board card comprises the following steps:
a) inserting N AWG boards into PCIe slots of a mainboard on a computer, wherein N is a positive integer greater than or equal to 2;
b) installing a PCIe Xilinx DMA driver in a Windows system, and acquiring the number of AWG boards inserted into a current chassis by the Windows system;
c) the Windows system detects whether an AWG board card exists in a designated PCIe slot, if the matched AWG board card is not detected in the corresponding PCIe slot, error information is printed, and if the matched AWG board card is detected in the corresponding PCIe slot, the PCIe device is opened, and a device handle of the device is returned;
d) utilizing the uthash C code to dynamically create a hash table entry map _ item by using a malloc function, setting a key of the map _ item as the serial number ID of the AWG board card, and setting the value of the map _ item as the equipment handle of the AWG board card;
e) inserting the newly created hash table entry map _ item into the hash table map _ table to complete the insertion of new equipment;
f) when a user needs to operate the AWG board card in the appointed PCIe slot, the bottom layer code of the Windows system receives a slot number parameter of the PCIe slot transmitted from the upper layer, converts the slot number into a key value corresponding to the AWG board card, and searches a HASH table entry map _ item corresponding to the key value in a HASH table map _ table by using a HASH _ FIND _ INT interface;
g) the Windows system calls a ReadFile () interface, sets the interface parameter dev _ user as the value of a hash table entry map _ item, and sets the interface parameter address as the state or the vacant register address of an XDMA IP inner core to be read;
h) the Windows system calls a WriteFile () interface, sets the interface parameter dev _ user as the value of a hash table entry map _ item, sets the interface parameter address as the state or the vacant register address of an XDMA IP inner core to be read, and sets the interface parameter data as the written data;
i) when the slot number on the appointed case is switched, the HASH _ FIND _ INT interface returns different HASH table entry map _ item through the AWG card number ID.
The HASH _ FIND _ INT interface returns different HASH table entry map _ item through the AWG board card serial number ID, when the trigger mode setting operation is carried out on the board card again, the equipment handle is successfully updated to the AWG board card which is expected to be controlled at the moment, the control of multiple board cards can be successfully realized, through embedding the Hash data structure, the PCIe equipment handle is inserted and the operation is checked in a Hash key-value pair mode, and the problem that a plurality of AWG board cards cannot be normally controlled when being inserted into the computer case at the same time is solved.
Further, in the step b), the Windows system obtains the number of AWG boards inserted into the current chassis through the get _ devices () interface, identifies all PCIe devices by using the GUID identifier, fills the serial number of each device into the array at a time, and calls the get _ devices () interface to return the number of AWG boards inserted into the chassis successfully.
Further, the Windows system in step c) detects whether the AWG card exists in the designated PCIe slot by calling a check _ device _ exist () interface.
Further, the Windows system in step c) opens the PCIe device by calling the CreateFile () interface.
Further, the Windows system in step e) inserts the newly created HASH table entry map _ item into the map _ table using the HASH _ ADD _ INT () interface.
Finally, it should be noted that: although the present invention has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that changes may be made in the embodiments and/or equivalents thereof without departing from the spirit and scope of the invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.