Method and apparatus for adapting a device

By obtaining the identifier and interrupt information of the PXI bus device to generate an adaptation file, and calling the script file for automatic adaptation, the problem of high error rate caused by manually writing configuration files for PXI bus devices on the domestic platform is solved, and rapid adaptation and management are achieved.

CN116302121BActive Publication Date: 2026-01-16BEIJING AEROSPACE MEASUREMENT & CONTROL TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211569802.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-07
Publication Date
2026-01-16
Estimated Expiration
2042-12-07

AI Technical Summary

Technical Problem

Under the domestic platform, the driver identification of PXI bus devices requires manual configuration files, which leads to a high error rate and is not easy to adapt to different types of board devices.

Method used

By obtaining the target device's identification and interrupt information, an adaptation file is generated, and the adaptation script file is called to automatically execute the adaptation process, including the adaptation process in automatic and non-automatic modes, and the device is managed using the resource manager.

Benefits of technology

It enables rapid device adaptation in the driver and device management in the management software, reducing labor costs and improving adaptation efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116302121B_ABST
    Figure CN116302121B_ABST
Patent Text Reader

Abstract

Embodiments of the present application relate to a device adaptation method and device, the method comprising: after obtaining identification information and interrupt information of a target device, generating an adaptation file of the target device, the adaptation file carrying adaptation instructions of the target device; based on the adaptation instructions, calling an adaptation script file of the target device; and performing adaptation processing on the target device according to the adaptation file and the adaptation script file. Thus, the technical effects of fast adaptation of a device in a driver and device management in management software can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The embodiment of the present application relates to the technical field of modular test equipment, in particular to a device adaptation method and device. BACKGROUND

[0002] PXI bus devices are mostly virtual instrument board card devices, and corresponding device drivers and application programs need to be developed for different types of virtual instrument board cards. Under the localization platform, the PXI bus-based device develops the corresponding kernel driver and user space application program according to the specific situation of the device. The kernel space processes the initialization, space allocation, register operation, interrupt processing and other work directly related to the hardware. The identification of different board cards in the initialization of the driver needs to write a configuration file first, and the service program parses the configuration file and uses the parameters to pass to the driver. And the person who develops the application program also needs to pay attention to the kernel driver, and for the use of different PXI virtual instrument devices, the kernel driver needs to be modified and compiled and the application program needs to be modified accordingly.

[0003] At present, under the localization platform, PXI driver identification for different types of board cards needs to be manually written PXI device configuration file, and the configuration file parsing in the resource management service program needs to specify a fixed file format, so that the user needs to understand the specific format of the configuration file when using other board cards and writing configuration files, and manual configuration file writing is prone to errors. SUMMARY

[0004] In view of this, in order to solve the technical problems of automatic adaptation and automatic management of the above-mentioned device, the embodiment of the present application provides a device adaptation method and device.

[0005] In the first aspect, the embodiment of the present application provides a device adaptation method, comprising:

[0006] After obtaining the identification information and interrupt information of the target device, generating an adaptation file of the target device, the adaptation file carrying adaptation instructions of the target device;

[0007] Based on the adaptation instructions, calling an adaptation script file of the target device;

[0008] According to the adaptation file and the adaptation script file, performing adaptation on the target device.

[0009] In one possible implementation, after obtaining the identification information and interrupt information of the target device, generating an adaptation file of the target device, the adaptation file carrying adaptation instructions of the target device, comprising:

[0010] obtaining identification information of the target device, the identification information carrying a function module identification, a 0 function module name, and / or a device sub-identification of the target device;

[0011] obtaining interrupt detection information and / or interrupt clearing information of the target device, the interrupt detection information carrying detection BAR space number information, detection offset address information, and detection comparison mask information, and the interrupt clearing information carrying clearing BAR space number information, clearing offset address information, and clearing comparison mask information;

[0012] obtaining interrupt information of the target device based on the interrupt detection information and / or the interrupt clearing information;

[0013] 5generating an adaptation file of the target device based on the identification information of the target device and the interrupt information;

[0014]

[0015] determining whether the adaptation file is in an automatic adaptation mode;

[0016] generating an adaptation instruction of the target device in a case where the adaptation file is in the automatic adaptation mode.

[0017] In one possible implementation, the method further includes:

[0018] generating a modification instruction of the adaptation file in a case where the adaptation file is in a non-automatic adaptation mode;

[0019] 5re-executing the step of generating the adaptation instruction based on the modification instruction.

[0020] In one possible implementation, the adaptation processing of the target device based on the adaptation file and the adaptation script file includes:

[0021] extracting device information of the adaptation file in a pre-set format according to the adaptation script file to generate a device file, the device information carrying the identification information and / or the interrupt information of the target device;

[0022] performing parsing processing on the device file to obtain a parsed file;

[0023] recognizing the parsed file to enable the target device to complete the adaptation processing.

[0024] In one possible implementation, the extracting of the device information of the adaptation file in the pre-set format according to the adaptation script file to generate the device file includes: ​

[0025] extracting the identification information in the adaptation file according to the pre-set format identifier, and storing the identification information to the first line of the device file;

[0026] extracting the interrupt detection information in the adaptation file according to the pre-set first fixed identifier, and storing the extracted interrupt detection information to the second line of the device file;

[0027] extracting the interrupt clearing information in the adaptation file according to the pre-set second fixed identifier, and storing the extracted interrupt clearing information to the device file after the interrupt detection information, to obtain the device file of the target device.

[0028] In one possible implementation, after the device file of the target device is obtained, the method further comprises:

[0029] judging whether the target device is adapted to end;

[0030] when the target device is adapted to end, re-executing the adaptation processing step of the target device after removing the adaptation file.

[0031] In one possible implementation, the parsing processing of the device file to obtain a parsed file comprises:

[0032] reading the device information corresponding to the device file;

[0033] parsing the function module identifier, the function module name and / or the device sub-identifier of the target device in the ID identification line of the device information, and storing the parsed information as the identification information of the target device to an array of a first set type;

[0034] parsing the interrupt information in the INTR identification line of the device information, and storing the interrupt information to a structure of a second set type;

[0035] storing the obtained array and the structure in a file as a parsed file.

[0036] In one possible implementation, the method further comprises:

[0037] after the target device is adapted to end, calling a resource manager;

[0038] scanning the read-write test result of the register in the target device by using the resource manager;

[0039] displaying the read-write test result.

[0040] In one possible implementation, the method further comprises:

[0041] The resource manager is used to call a preset IO library to obtain a device type;

[0042] According to the device type, read-write test results of registers in the device are scanned and displayed.

[0043] In a second aspect, an embodiment of the present application provides a device adaptation apparatus, comprising:

[0044] A generation module is configured to generate an adaptation file of a target device after obtaining identification information and interrupt information of the target device, wherein the adaptation file carries adaptation instructions of the target device;

[0045] A calling module is configured to call an adaptation script file of the target device based on the adaptation instructions;

[0046] An adaptation module is configured to perform adaptation processing on the target device according to the adaptation file and the adaptation script file.

[0047] The device adaptation scheme provided by the embodiment of the present application comprises the following steps: generating an adaptation file of a target device after obtaining identification information and interrupt information of the target device, wherein the adaptation file carries adaptation instructions of the target device; calling an adaptation script file of the target device based on the adaptation instructions; and performing adaptation processing on the target device according to the adaptation file and the adaptation script file. After obtaining the identification information and the interrupt information of the target device, the adaptation file is generated, and the adaptation instructions are carried. The adaptation script file associated with the adaptation file is called to perform extraction and analysis, and an analysis file is generated. Then, the analysis file is read and analyzed. When the analysis is completed and successful, the adaptation process of the target device is completed. According to the scheme, the technical effects of quickly adapting the device in the driver and managing the device in the management software can be achieved. BRIEF DESCRIPTION OF DRAWINGS

[0048] The accompanying drawings, which are incorporated into and form a part of the specification, illustrate one embodiment consistent with the present application and, together with the description, serve to explain the principles of the application.

[0049] Figure 1 A flowchart of a device adaptation method provided by an embodiment of the present application is shown in the figure;

[0050] Figure 2 A flowchart of another device adaptation method provided by an embodiment of the present application is shown in the figure;

[0051] Figure 3 A flowchart of still another device adaptation method provided by an embodiment of the present application is shown in the figure;

[0052] Figure 4A structural schematic diagram of an adaptation device of an equipment is provided for the embodiment of the present application. DETAILED DESCRIPTION

[0053] To make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings of the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application but not all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of the present application.

[0054] The terms “include” and “have” in the embodiments of the present application are used to represent an open-ended inclusion, and refer to that in addition to the listed elements / components / etc., there can be other elements / components / etc.; the terms “first” and “second” etc. are only used as labels, and are not a limitation on the number of objects. In addition, different elements and regions in the drawings are only schematically shown, and thus the present application is not limited to the sizes or distances shown in the drawings.

[0055] To make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in connection with the drawings of the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application but not all the embodiments. Based on the embodiments of the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts fall within the scope of the present application.

[0056] Adaptation is to map a hardware idea into a logic editor. Many programming logic devices have many manufacturer models. Due to the differences in these structures, when designing in a hardware description language, a macro circuit is obtained, which is not for a certain FPGA, so adaptation is to map it to a certain FPGA.

[0057] Figure 1 A flowchart of an adaptation method of an equipment is provided for the embodiment of the present application. The execution subject of the present application is an adaptation equipment. Referring to the provided diagram, the adaptation method of the equipment specifically includes: Figure 1 The adaptation method of the equipment specifically includes:

[0058] S101, after obtaining the identification information and the interrupt information of the target equipment, generating an adaptation file of the target equipment, the adaptation file carrying an adaptation instruction of the target equipment.

[0059] The execution subject of the application is an adaptation device, and a processing module with an adaptation function is arranged on the adaptation device. The target device is identified by collecting important information of the target device, an adaptation file for the target device is generated, the corresponding important information of the target device is obtained by calling a script file of a control middle layer, and a corresponding analysis file is generated according to the obtained important information; the important information of the target device stored in the analysis file is parsed by reading the content in the analysis file, and then the parsing process is completed, the adaptation process is completed after the parsing process, and the use of the target device is realized through a resource manager.

[0060] The target device mentioned here can be understood as a device to be configured or to be installed with a driver. The identification information mentioned here can be understood as important information representing the target device. The interrupt information mentioned here can be understood as important configuration information in the adaptation device. The interrupt information is used to control the processing operation of the target device. The adaptation file mentioned here can be understood as a file corresponding to the trigger during device adaptation. The adaptation instruction mentioned here can be understood as a processing instruction for driving or configuring the target device.

[0061] Further, after the target device is placed in the designated position, the identification information and the interrupt information contained in the target device are obtained through manual input or system data acquisition, and the adaptation process of the target device is triggered after the identification information and the interrupt information are obtained, and the adaptation file of the target device is generated, which prepares for the next adaptation of important information.

[0062] S102, based on the adaptation instruction, a script file of the target device is called.

[0063] The adaptation script file mentioned here can be understood as a running code storing the instruction information of the adaptation of the target device.

[0064] Further, the target device uses the adaptation instruction to call the script file associated with the adaptation process of the target device, and starts the adaptation process based on the adaptation script file.

[0065] S103, according to the adaptation file and the adaptation script file, the adaptation process of the target device is performed.

[0066] The adaptation process mentioned here can be understood as a process of running the driver installation of the target device.

[0067] Further, the adaptation script file and the adaptation instruction are found according to the adaptation file, the adaptation process is started according to the adaptation script file, the adaptation is performed according to the adaptation instruction, and the adaptation of the target device is completed after the adaptation is successfully completed, so that the target device starts a normal operation mode, the automatic adaptation process of the target device is completed, the labor cost is reduced, the device adaptation efficiency is improved, and the technical effects of quickly adapting the device in the driver and managing the device in the management software can be achieved.

[0068] The device adaptation scheme provided by the embodiment of the present application comprises the following steps: after obtaining the identification information and interrupt information of a target device, an adaptation file of the target device is generated, the adaptation file carrying adaptation instructions of the target device; based on the adaptation instructions, an adaptation script file of the target device is called; and the adaptation processing is performed on the target device according to the adaptation file and the adaptation script file. After obtaining the identification information and interrupt information of the target device, the adaptation file is generated, which carries the adaptation instructions. By calling the adaptation script file associated with the adaptation file, the extraction and analysis are performed to generate an analysis file, and then the reading and analysis processing are performed on the analysis file, and the adaptation process of the target device is completed after the analysis is completed and the analysis is successful. By the present scheme, the technical effects of fast adaptation of the device in the driver and device management in the management software can be achieved.

[0069] Figure 2 The flowchart of another device adaptation method provided by the embodiment of the present application is shown in the figure. The execution subject of the present application is an adaptation device. Figure 2 The device adaptation method provided by the embodiment of the present application is introduced on the basis of the above device adaptation method. According to the figure provided by the embodiment of the present application, the device adaptation method specifically comprises the following steps: Figure 2 The device adaptation method provided by the embodiment of the present application is introduced on the basis of the above device adaptation method. According to the figure provided by the embodiment of the present application, the device adaptation method specifically comprises the following steps:

[0070] S201, obtaining the identification information of a target device, the identification information carrying a function module identification, a function module name and / or a device sub-identification of the target device.

[0071] The execution subject of the present application is an adaptation device, which can be, but is not limited to, a PXI bus device. The processing module with the adaptation function is arranged on the adaptation device. The target device is identified by collecting important information of the target device, an adaptation file for the target device is generated, the corresponding software control underlying script file is called to obtain the important information of the target device, and the corresponding analysis file is generated for the obtained important information. The important information of the target device stored in the analysis file is parsed by reading the content in the analysis file, and then the analysis processing is completed. After the analysis processing, the adaptation processing is completed, and the use of the target device is realized through the resource manager.

[0072] The target device mentioned here can be understood as a device to be configured or installed with a driver, which can be, but is not limited to, a PXI board card device. The identification information mentioned here can be understood as important information representing the target device, which is used to distinguish the characteristic information of different target devices. The function module identification mentioned here can be understood as the manufacturer ID and module ID corresponding to the target device, which is used to distinguish the identification information of the function module. The function module name mentioned here can be understood as the main technical function of the target device, and the main technical function is taken as the name for easy distinction. The device sub-identification mentioned here can be understood as a device sub-ID, that is, important identification information carried by the subsystem of the target device.

[0073] Further, after determining the access target device, the identification information representing the important information of the target device manually input or collected by the device is obtained through the interface of the target device, and the obtained identification information is stored, preparing for the next step of adaptation.

[0074] S202, obtain the interrupt detection information and / or interrupt clearing information of the target device, the interrupt detection information carrying detection BAR space number information, detection offset address information and detection comparison mask information, and the interrupt clearing information carrying clearing BAR space number information, clearing offset address information and clearing comparison mask information.

[0075] The interrupt detection information mentioned here can be understood as important information for detecting the interrupt function of the device adaptation process. The interrupt detection information mentioned here generally includes the BAR space number, offset address and comparison mask required when detecting the interrupt. The interrupt clearing information mentioned here can be understood as important information for clearing the interrupt flag in the adaptation process of the device. The BAR space number, offset address and value required for writing to clear the interrupt flag. The interrupt clearing information can be stored in the target device to be adapted. The target device can only contain interrupt detection information and not interrupt clearing information.

[0076] Further, after obtaining the flag information of the device, the interrupt detection information and interrupt clearing information corresponding to the device are obtained for the next step of triggering the adaptation process of the device.

[0077] S203, obtain the interrupt information of the target device based on the interrupt detection information and / or interrupt clearing information.

[0078] The interrupt information mentioned here can be understood as the interrupt detection information and interrupt clearing information contained in the installation and adaptation process of the PXI board card device.

[0079] Further, in the adaptation process of the target device, after obtaining the interrupt detection information and / or interrupt clearing information of the PXI board card device, the interrupt information of the PXI board card device is obtained.

[0080] S204, generate the adaptation file of the target device based on the identification information and interrupt information of the target device.

[0081] The adaptation file mentioned here can be understood as the installation information file generated by the device driver when installing the installation wizard software. The installation information file mainly extracts the related device information in the installation information INF file of all PXI board card devices, and stores the extracted device information in the intrinfo.txt file according to the format agreed with the kernel driver.

[0082] Further, in the adaptation process of the PXI board card device, first, after obtaining the important information of the PXI board card device, the installation wizard of the PXI bus device for the driving function of the PXI board card device is started, the installation information file of the PXI board card device driving is generated based on the identification information and the interrupt information obtained to the PXI board card device, which is generally set as an INF file, and finally it is selected whether to install the driving according to the generated installation information file.

[0083] In a possible example scenario, the installation wizard tool of the PXI bus device in the process of driving the PXI board card device can modify and regenerate the generated driving installation information file on the basis of importing the generated driving installation information file on the one hand. On the other hand, the information file of the PXI board card device can be re-input through the interface, and the information file is perfected step by step according to the interface prompt, and finally the installation information file is generated.

[0084] S205, judge whether the adaptation file is in the automatic adaptation mode.

[0085] The automatic adaptation mode mentioned here can be understood as the selectable running mode carried in the adaptation file of the target device. The automatic adaptation process can automatically trigger the kernel driving of the target device without human intervention.

[0086] Further, in the PXI bus device, after the driving installation information file of the PXI board card device is generated, it is judged whether the kernel driving function of the PXI board card device set in the installation information file has been selected on the current PXI bus device, which provides a prerequisite for the next automatic adaptation or re-adaptation.

[0087] S206, generate the adaptation instruction of the target device in the case that the adaptation file is in the automatic adaptation mode.

[0088] The adaptation instruction mentioned here can be understood as the control instruction for executing the automatic adaptation of the target device.

[0089] S207, call the adaptation script file of the target device based on the adaptation instruction.

[0090] The adaptation script file mentioned here can be understood as a script file storing the adaptation information of the target device, which can be but is not limited to a.sh type file.

[0091] Further, the INF file format is the standard installation information file format, which is generated for compatibility with the installation of the PXI bus device driving under Windows. In the installation script file, the device information needs to be accurately extracted from the INF file. The user stores all the INF files of the PXI board card device in the specified folder, and runs the script by using the root account in the command line.

[0092] S208, generating modification instruction of the adaptation file in case that the adaptation file is in non-automatic adaptation mode.

[0093] The modification instruction can be understood as the control instruction of re-installing the adaptation file. The non-automatic adaptation mode can be understood as the mode of closing automatic adaptation or the mode of not supporting automatic adaptation, or the mode after the adaptation processing is completed.

[0094] S209, re-executing the step of generating the adaptation instruction based on the modification instruction.

[0095] Further, the lsmod command and the drive name are used to query whether the PXI board device drive has been installed in the device identification information in the installation information file through the PXI bus device, and if it has been installed, it is determined that the drive file corresponding to the PXI board device is in the non-automatic adaptation mode, and then the drive is removed and re-installed, and the installation information file corresponding to the drive is generated.

[0096] S210, extracting the device information of the adaptation file in the preset format according to the adaptation script file, generating the device file, and the device information carrying the identification information and / or interrupt information of the target device.

[0097] The set format can be understood as the specified type of storing the content of the adaptation script file. For example, IntrDetect category, ExcludeFromSelect category or IntrRemove category.

[0098] Further, when the adaptation script file is called, the specified device information in the adaptation script file is read, including the identification information of the specific format or the interrupt information of the specific format in the target device, and the read device information is stored in the file of the specified format as the device file for the target device drive processing.

[0099] In a possible example scenario, the related device information in the installation information INF file of all PXI board devices is extracted according to the installation information file, and the extracted device information is stored in the intrinfo.txt file in the format agreed with the kernel drive.

[0100] S211, performing parsing processing on the device file to obtain a parsed file.

[0101] The parsing processing can be understood as the process of reading or recognizing the file information. The parsed file can be understood as the file representing the adaptation of the target device after the parsing processing.

[0102] Further, according to the obtained device file intrinfo.txt for the PXI bus device, the intrinfo.txt file is opened, and the file content is read and parsed line by line, and the parsed information is stored in a.ko type file as a parsed file, to prepare for recognizing the content information of the parsed file in the next step.

[0103] In S212, the parsed file is recognized, so that the target device completes the adaptation process.

[0104] The recognition can be understood as the recognition of the target device when starting the adaptation process of the device driver or configuration.

[0105] Further, after the PXI bus device obtains the parsed file for the current PXI bus device, the information representing the current PXI bus device is parsed according to the specified path address, and when the parsed content of the parsed file is consistent with the PXI bus device to be adapted, it is determined that the driver or configuration process of the PXI bus device is completed, the adaptation process of the PXI bus device is completed, and the use and management of the PXI bus device can be started.

[0106] The embodiment of the application provides a device adaptation method, which generates an adaptation file by obtaining identification information and interrupt information of a target device, generates a device file in an automatic adaptation mode when the adaptation file is a kernel driver setting, parses the device file according to a limited kernel format to obtain a parsed file of to-be-recognized information, and completes the adaptation process of the target device through recognition of the parsed file, to start the operation and management mode of the target device, and achieve the technical effects of fast adaptation of the device in the driver and device management in the management software.

[0107] Figure 3 A flowchart of another device adaptation method is provided in the embodiment of the application. The execution subject of the application is an adaptation device. Figure 3 The second device adaptation method is introduced on the basis of the first device adaptation method. Figure 3 According to the provided diagram, the device adaptation method further includes the following steps.

[0108] In S301, after obtaining identification information and interrupt information of a target device, an adaptation file of the target device is generated, and the adaptation file carries an adaptation instruction of the target device.

[0109] The execution subject of the present application is an adaptation device, which can be but is not limited to a PXI bus device. A processing module with adaptation function is arranged on the adaptation device. The target device is identified by collecting important information of the target device, an adaptation file for the target device is generated, the corresponding important information of the target device is obtained by calling a script file for controlling the underlying software, and a corresponding analysis file is generated for the obtained important information; the important information of the target device stored in the analysis file is parsed by reading the content in the analysis file, and then the parsing process is completed, the adaptation process is completed after the parsing process, and the use of the target device is realized through a resource manager.

[0110] The target device mentioned here can be understood as a device to be configured or to be installed with a driver, which can be but is not limited to a PXI board card device. The identification information mentioned here can be understood as important information representing the target device, such as ID number, device name, etc. The interrupt information mentioned here can be understood as important configuration information in the adaptation device. It is used to control the processing operation of the target device. The adaptation file mentioned here can be understood as a file triggered corresponding to the device adaptation. The adaptation instruction mentioned here can be understood as a processing instruction for driving or configuring the target device.

[0111] Further, after the target device is placed in the designated position, the identification information and the interrupt information contained in the target device are obtained by manual input or system data collection, such as the vendor ID, module ID, vendor name and module name of the target device. If the target device has a sub-ID, the sub-system ID of the target device also needs to be input. When the target device has an interrupt function, the related information of the interrupt is input, including the BAR space number required for interrupt detection, the offset address and the comparison mask; the BAR space number required for interrupt flag clearing, the offset address and the value required for writing to clear the interrupt flag. After obtaining the identification information and the interrupt information, the adaptation process of the target device is triggered, and the INF file of the target device is generated, which prepares for the next adaptation important information.

[0112] S302, based on the adaptation instruction, calling the adaptation script file of the target device.

[0113] Further, the INF files of all PXI board card devices are stored in a designated folder, and the adaptation script file is called by using the root instruction in the command line.

[0114] S303, according to the pre-set format identifier, extracting the identification information in the adaptation file and storing it to the first line of the device file.

[0115] The format identifier mentioned here can be understood as an identifier specifying a type, such as the ExcludeFromSelect identifier. The identification information mentioned here can be understood as the ID information used to identify the target device. The device file mentioned here can be understood as the intrinfo.txt file, an adaptation script file designed to maintain consistency with the format conventions of kernel driver files.

[0116] Furthermore, the system repeatedly opens the installation information files corresponding to the PXI board devices by looping through the specified INF file paths. It then searches for the vendor ID and module ID in the adapter file using the fixed format identifier ExcludeFromSelect in the INF file, stores them in the first line of the device file (intrinfo.txt file), and adds an ID identifier line to that line.

[0117] S304. Extract interrupt detection information from the adapter file according to the pre-set first fixed identifier, and store the extracted interrupt information in the second line of the device file.

[0118] The first fixed identifier mentioned here can be understood as a default type identifier, used to extract information, such as the IntrDetect identifier.

[0119] Furthermore, interrupt detection information is searched in the adapter file using the first fixed identifier IntrDetect. The extracted interrupt detection information is stored in the second line of the device file (intrinfo.txt file), and an INTR identifier line is added at the beginning of that line.

[0120] S305. Extract interrupt clearing information from the adapter file according to the pre-set second fixed identifier, and store the extracted interrupt clearing information into the interrupt detection information of the device file to obtain the device file of the target device.

[0121] The second fixed identifier mentioned here can be understood as another type of identifier, used to find information, such as the IntrRemove identifier.

[0122] Furthermore, the second fixed identifier IntrRemove is used to search for interrupt clearing operation related information in the adapter file, and the extracted interrupt clearing information is stored after the second line of interrupt detection information in the intrinfo.txt file.

[0123] S306. Read the device information corresponding to the device file.

[0124] Furthermore, the obtained device file is read. If the reading is successful, the device information is obtained. If the reading fails, the failure information is displayed through the command line of the script file.

[0125] S307, the function module identifier, the function module name and / or the device sub-identifier of the ID identification line in the device information are parsed as the identification information of the target device and stored into the array of the first setting type.

[0126] The array of the first setting type can be understood as an array for storing the identification information of the target device. For example, the defined array tmp_pci_tbl of the pci_device_id type.

[0127] Further, the obtained device file is parsed. In a possible example scenario, the device file is obtained as follows:

[0128] ID 0xfead, 0x1111

[0129] INTR InterruptDetect0 = BAR1 0x00000010 0x00000001 0x00000001;

[0130] InterruptQuiesce = BAR1 0x00000010 0x00000000

[0131] First, the device file is opened, and the content of the device file is read. Then, the module manufacturer code ID and the module ID of the ID identification line in the device file are extracted and parsed. The two IDs of the ID identification line are set in the array tmp_pci_tbl of the pci_device_id type, and used for identifying the device information.

[0132] S308, the interrupt information of the INTR identification line in the device information is parsed, and the interrupt information is stored into the structure body of the second setting type.

[0133] The structure body of the second type can be understood as a storage data type for distinguishing the identification information type.

[0134] Further, after storing the ID identification line in the device file, the interrupt processing information of the INTR identification line is extracted and parsed, mainly including interrupt flag register query instruction and interrupt flag register clearing instruction. The interrupt flag register query instruction information contains the current operation type, operation BAR space number, query offset address, interrupt flag mask and read-back value. The interrupt flag register clearing instruction information contains the current operation type, operation BAR space number, and write value at the time of clearing. Repeat steps S307 and S308 to continue parsing and extracting the device information of other PXI board card devices. Finally, place the extracted identification information corresponding to all ID identification lines in the tmp_pci_tbl array, and place the interrupt information in the global structure of the AMC_dev type. Complete the information processing of the PXI card board device adaptation, and prepare for the next step of identification.

[0135] S309, the file where the obtained array and structure are located is taken as a parsing file.

[0136] S310, the parsing file is identified to complete the adaptation processing of the target device.

[0137] Further, the parsed array and structure are stored in a specified file, and the obtained file is taken as a parsing file. When the PXI bus device inputs the identification information of the PXI board card device, the adaptation operation of the PXI board card device is started, and after the driver installation information file calls the adaptation script file, the parsing file storing the identification information of the PXI board card device is identified. When the identification information of the PXI board card device corresponding to the parsing file is identified, the identification ends, and the adaptation processing process is completed, and the adaptation processing of the PXI board card device ends.

[0138] S311, whether the current target device is adapted to end is judged.

[0139] S312, when the target device adaptation ends, the target device adaptation processing steps are re-executed after executing the removal of the adaptation file operation.

[0140] The adaptation end mentioned here can be understood as follows: after inputting the identification information of the specified PXI board card device on the PXI bus device, the corresponding parsing file is identified, and before executing the parsing or driver configuration, it is judged whether the PXI board card device has adaptation operation traces, that is, whether there are historical operation traces of the driver installation of the PXI board card device. When it is detected that the PXI board card device has been installed on the PXI bus device, the historical installation adaptation traces are removed before reinstalling the driver. If it is not installed, it is directly automatically adapted and installed.

[0141] In the localization software processing platform, PXI resource manager software, driver installation wizard software, put in the driver installation script and modify the script file through the command line executable permissions, put the.KO file of the driver into the system specified directory. By opening the driver installation wizard software, input the identification information and interrupt information of the PXI board equipment, finally select the save and install mode, register the PXI board equipment to the system, and create the PXI board equipment file name and device node under the device directory / dev directory.

[0142] S313, after the target device adaptation is completed, the resource manager is called.

[0143] S314, the read-write test result of the register in the target device is scanned by using the resource manager.

[0144] S315, the read-write test result is displayed.

[0145] The resource manager mentioned here can be understood as a functional tool for using and managing the configured PXI board equipment. The resource manager software mainly manages all PXI board equipment, LXI network equipment and ASRL serial port equipment in the localization platform, and the most important one is to manage the PXI test board equipment.

[0146] Further, after the PXI bus device completes the PXI board equipment driver conversion, the working data of the current PXI board equipment is detected through the resource manager on the PXI bus device, the register test result detected by the current PXI board equipment is obtained by scanning the read-write test result of the register in the PXI board equipment, for example, the PXI equipment can be automatically searched by the resource manager software, and the read-write test operation of the register of the PXI board equipment can be directly performed.

[0147] S316, the IO library preset by the resource manager is called to obtain the device type.

[0148] S317, according to the device type, the read-write test result of the register in the device is scanned and displayed.

[0149] Further, all the adapted PXI board equipment is obtained by calling the IO library for automatic scanning, and the scanned equipment is added to the resource tree in the specified position of the interface through bus type classification. When each device is scanned, the related information of the PXI board equipment is also obtained, mainly including module ID, bus number, device number, resource name, allocated specific memory space and various information read through the PXI header. The important information in these information is directly displayed through the main interface, and the properties of each PXI board equipment are displayed through the table arrangement.

[0150] In the operation of PXI device, no additional programming is needed, only by opening the register read-write test panel in the resource manager, the currently selected PXI board device will be opened when the panel is opened, the device is opened by calling the corresponding IO library interface PXIOpen, and the PXI board device handle is transmitted into the register read-write test panel, and the following four read-write modes are mainly provided in the panel:

[0151] Single register read.

[0152] Single register write.

[0153] Single register block read.

[0154] Single register block write.

[0155] Each operation mode needs to set the BAR space number required for reading and writing, the reading and writing offset address, and the bit number of the reading and writing register value is 8, 16, 32, by transmitting these parameters into the IO library interface write function PXIWrite8 / 16 / 32 and the read function PXIRead8 / 16 / 32, the state of the current reading and writing is given after reading and writing is completed, and the processing of the programming control of the device based on the existing IO library function call is completed.

[0156] The device adaptation method provided by the embodiment of the application comprises the following steps: obtaining identification information and interrupt information of a target device, starting adaptation processing of the target device, obtaining a device file by associating target device adaptation information in a generated adaptation file, reading and analyzing the content in the device file to obtain an analysis file, and obtaining an adapted target device after the analysis file is successfully analyzed, and starting management processing of the target device, so that the device can be quickly adapted in the driver and managed in the management software.

[0157] Figure 4 The device adaptation apparatus provided by the embodiment of the application has the structure as shown in the figure. Figure 4 The device adaptation apparatus comprises the following parts:

[0158] A generation module 41 is configured to generate an adaptation file of a target device after obtaining identification information and interrupt information of the target device, and the adaptation file carries an adaptation instruction of the target device.

[0159] A calling module 42 is configured to call an adaptation script file of the target device based on the adaptation instruction.

[0160] An adaptation module 43 is configured to perform adaptation processing on the target device according to the adaptation file and the adaptation script file.

[0161] The adaptation device of the equipment provided in the embodiment can be the adaptation device of the equipment as shown in Figure 4 The adaptation device of the equipment provided in the embodiment can be the adaptation device of the equipment as shown in Figures 1-3 The adaptation device of the equipment provided in the embodiment can be the adaptation device of the equipment as shown in Figures 1-3 The adaptation device of the equipment provided in the embodiment can be the adaptation device of the equipment as shown in Figures 1-3 The adaptation device of the equipment provided in the embodiment can be the adaptation device of the equipment as shown in

[0162] The above detailed description of the specific embodiments, the purposes, technical solutions and beneficial effects of the present application are further described in detail, and it should be understood that the above description is only a specific embodiment of the present application and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method of adapting a device, characterized by, The method comprises the following steps: After obtaining the identification information and interrupt information of the target device, an adaptation file of the target device is generated, and the adaptation file carries adaptation instructions of the target device, wherein the target device is a device to be configured or to be installed with a driver; Based on the adaptation instructions, an adaptation script file of the target device is called; According to the adaptation file and the adaptation script file, adaptation processing is performed on the target device, including: according to the adaptation script file, device information of the adaptation file in a pre-set format is extracted, a device file is generated, and the device information carries the identification information and / or interrupt information of the target device; the device file is parsed to obtain a parsed file; the parsed file is identified to enable the target device to complete the adaptation processing; wherein the adaptation processing is a process of running the driver installation of the target device.

2. The method of claim 1, wherein, After obtaining the identification information and interrupt information of the target device, an adaptation file of the target device is generated, and the adaptation file carries adaptation instructions of the target device, wherein the target device is a device to be configured or to be installed with a driver; Obtain the identification information of the target device, and the identification information carries the function module identifier, the function module name and / or the device sub-identifier of the target device; Obtain the interrupt detection information and / or interrupt clearing information of the target device, and the interrupt detection information carries the detection BAR space number information, the detection offset address information and the detection comparison mask information, and the interrupt clearing information carries the clearing BAR space number information, the clearing offset address information and the clearing comparison mask information; Based on the interrupt detection information and / or the interrupt clearing information, obtain the interrupt information of the target device; Based on the identification information and the interrupt information of the target device, generate the adaptation file of the target device; Determine whether the adaptation file is in an automatic adaptation mode; Generate the adaptation instructions of the target device when the adaptation file is in the automatic adaptation mode.

3. The method of claim 2, wherein, The method further comprises: When the adaptation file is in a non-automatic adaptation mode, generate a modification instruction of the adaptation file; Based on the modification instruction, re-execute the step of generating the adaptation instructions.

4. The method of claim 1, wherein, According to the adaptation script file, the device information of the adaptation file in a pre-set format is extracted, and a device file is generated, and the device information carries the identification information and / or interrupt information of the target device, comprising: According to a pre-set format identifier, the identification information in the adaptation file is extracted and stored in the first row of the device file; According to a pre-set first fixed identifier, the interrupt detection information in the adaptation file is extracted, and the extracted interrupt information is stored in the second row of the device file; According to a pre-set second fixed identifier, the interrupt clearing information in the adaptation file is extracted, and the extracted interrupt clearing information is stored in the device file after the interrupt detection information, to obtain the device file of the target device.

5. The method of claim 4, wherein, After the device file of the target device is obtained, the method further comprises: Determine whether the current target device is adapted to end; When the target device adaptation ends, the adaptation processing step of the target device is re-executed after a remove adaptation file operation is performed.

6. The method of claim 4, wherein, The device file is parsed to obtain a parsed file, including: reading device information corresponding to the device file; parsing a function module identifier, a function module name and / or a device sub-identifier of the target device in an ID identifier line of the device information as identification information of the target device and storing the identification information in an array of a first setting type; parsing interrupt information in an INTR identifier line of the device information and storing the interrupt information in a structure of a second setting type; the array and the structure are obtained as a parsed file.

7. The method of claim 6, wherein, The method further includes: after the target device adaptation ends, calling a resource manager; scanning read-write test results of registers in the target device using the resource manager; displaying the read-write test results.

8. The method of claim 7, wherein, The method further includes: calling a pre-set IO library using the resource manager to obtain a device type; according to the device type, scanning read-write test results of registers in the device and displaying the read-write test results.

9. An adapting device for a device, characterized in that including: a generation module for generating an adaptation file of the target device after obtaining identification information and interrupt information of the target device, the adaptation file carrying adaptation instructions of the target device, wherein the target device is a device to be configured or to have a driver installed; a calling module for calling an adaptation script file of the target device based on the adaptation instructions; an adaptation module for performing adaptation processing on the target device according to the adaptation file and the adaptation script file, specifically for extracting device information of the adaptation file in a pre-set format according to the adaptation script file to generate a device file, the device information carrying identification information and / or interrupt information of the target device; parsing the device file to obtain a parsed file; and identifying the parsed file to enable the target device to complete the adaptation processing; wherein the adaptation processing is a process of running a driver installation for the target device.

Citation Information

Patent Citations

  • Hardware equipment state adaptive method and device

    CN103677812A

  • Driver-adaptive loading system

    CN107315607A