Topology generation method, electronic device, storage medium and product
Through the method of automatically identifying the I2C bus device, the topological connection relationship of the I2C device is generated by comparing the preset switch address and device address, which solves the problems of manual inspection of complexity and error identification, and realizes accurate and efficient identification of the I2C device.
Patent Information
- Application Number
- CN202411147074.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-20
AI Technical Summary
In the prior art, manually inputting instructions to check the I2C topology leads to increased system complexity and increased difficulty, prone to identification errors, affecting the identification accuracy of I2C devices.
By obtaining the device addresses of each bus device, identifying the bus switch device using a preset switch address, controlling its connection channels to close and open, determining the target bus device by comparing the scan results, generating topological connection relationships, and realizing automated I2C device topological recognition.
Achieve comprehensive and accurate identification of all devices on the I2C bus, reduce the workload of manual inspection and configuration, improve the efficiency of equipment identification, avoid errors and omissions caused by manual operations, and ensure the consistency and reliability of identification results. .
Smart Images

Figure CN118656334B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a topology generation method, electronic equipment, storage medium and product. Background Art
[0002] I2C (Inter-Integrated Circuit) is a protocol for short-distance, serial communication. Due to its simplicity and reliability, I2C is widely used in communication between motherboards, embedded systems or mobile phones and peripheral device components, for example, communication between microcontrollers and sensor arrays, displays, IoT devices, EEPROMs and other devices.
[0003] At present, the baseboard management controller (BMC) is usually used as the master end of the I2C bus, responsible for managing many downstream I2C devices. As the functional requirements of the baseboard management controller continue to increase, the number of I2C slave devices it connects and manages is also increasing. In order to expand the number of I2C devices and realize address multiplexing, an I2C Switch device is usually used to enable more devices to be connected to the same I2C bus.
[0004] However, currently, the I2C topology is mainly checked by manually inputting relevant instructions through the serial port connection to the BMC. This configuration increases the complexity of the system, resulting in a sharp increase in the difficulty of topology checking, which is prone to recognition errors, further affecting the recognition accuracy of the I2C device. Summary of the invention
[0005] In view of this, the present invention aims to propose a topology generation method, electronic device, storage medium and product to solve the problem of manually inputting instructions to check the I2C topology, which affects the accuracy of I2C device recognition, and realize automatic and accurate I2C device topology recognition.
[0006] According to a first aspect of the present invention, a topology generation method is provided, the method comprising:
[0007] Obtaining the device address of each bus device, and identifying the bus switch device using a preset switch address and the device address; wherein the bus devices are deployed in several levels, and the bus switch device is used to connect to the bus devices of the next level through a preset number of connection channels;
[0008] Controlling all connection channels of the bus switch device to be closed, identifying a first bus device at a level where the bus switch device is located, and determining a device address corresponding to the first bus device as a reference result;
[0009] Controlling the connection channels of the bus switch device to be opened in sequence, identifying the second bus device of each connection channel of the bus switch device, and determining the device address corresponding to the second bus device as the scanning result;
[0010] Comparing the scanning results of each connection channel with the benchmark results respectively, and determining the target bus device mounted on each connection channel of the bus switch device;
[0011] A topological connection relationship of the bus devices is generated according to the target bus devices mounted on each connection channel of the bus switch device.
[0012] Optionally, the acquiring of the device address of each bus device and identifying the bus switch device using a preset switch address and the device address include:
[0013] Scanning bus devices, obtaining device addresses of various bus devices, and storing the device addresses as a device address list;
[0014] Obtaining a preset switch address corresponding to a predetermined bus switch device;
[0015] The preset switch address is used to traverse the device address list to identify the bus switch device.
[0016] Optionally, the controlling the connection channels of the bus switch device to be completely closed, identifying a first bus device at a level where the bus switch device is located, and determining a device address corresponding to the first bus device as a reference result includes:
[0017] In response to the first control signal, controlling all connection channels of the bus switch device to be closed;
[0018] Determining that a connection channel of the bus switch device is closed, scanning bus devices at a level where the bus switch device is located, and identifying a first bus device at the level where the bus switch device is located;
[0019] A device address corresponding to the first bus device is obtained, and the device address of the first bus device is determined as a reference result.
[0020] Optionally, in response to the first control signal, controlling all connection channels of the bus switch device to be closed includes:
[0021] Preset the corresponding relationship between the control signal bit and the connection channel;
[0022] If all the connection channels of the bus switch device are requested to be closed, all the control signal bits are set to closed flag bits to generate a first control signal;
[0023] In response to detecting the first control signal, all connection channels of the bus switch device are controlled to be closed.
[0024] Optionally, the controlling the connection channels of the bus switch device to be opened in sequence, identifying the second bus device of each connection channel of the bus switch device, and determining the device address corresponding to the second bus device as the scanning result includes:
[0025] In response to the second control signal, controlling the connection channels of the bus switch device to be opened in sequence according to a preset opening sequence;
[0026] Monitoring the open state of the connection channel of the bus switch device to determine the only currently open connection channel;
[0027] Scan the bus devices under the only currently opened connection channel to identify the second bus device under the only currently opened connection channel;
[0028] The device address corresponding to the second bus device is obtained, the device addresses corresponding to the second bus device are summarized, and the scanning results of each connection channel are determined.
[0029] Optionally, in response to the second control signal, controlling the connection channels of the bus switch device to be opened in sequence according to a preset opening sequence includes:
[0030] If the connection channels of the bus switch device are requested to be opened in sequence, the control signal positions of the target connection channels are respectively set to the opening flag positions according to the preset opening sequence, and a second control signal is generated;
[0031] In response to detecting the second control signal, the target connection channel of the bus switch device is controlled to be turned on.
[0032] Optionally, comparing the scanning results of each connection channel with the benchmark results respectively to determine the target bus device mounted on each connection channel of the bus switch device includes:
[0033] Compare the scan results of each connection channel with the benchmark results to obtain the current bus devices mounted on each connection channel;
[0034] Checking the current bus devices mounted under each connection channel to determine whether there is a cascade bus switch device in the current bus devices;
[0035] If so, the target bus devices mounted on each connection channel of the bus switch device are determined according to the cascade bus switch device.
[0036] Optionally, the checking of the bus devices mounted on each connection channel to determine whether there is a cascade bus switch device in the bus devices includes:
[0037] Determine the number of levels of bus devices mounted under each connection channel;
[0038] The bus devices at the same level under each connection channel are checked using the preset switch address corresponding to the bus switch device to determine whether there is a cascade bus switch device in the bus devices.
[0039] Optionally, if yes, determining the target bus device mounted on each connection channel of the bus switch device according to the cascade bus switch device includes:
[0040] If it is determined that there is a cascade bus switch device in the current bus device, repeatedly performing switch control on the connection channels of the cascade bus switch device to determine the bus devices mounted on each connection channel of the cascade bus switch device;
[0041] Acquire a connection relationship between the cascade bus switch device and the bus switch device;
[0042] By using the connection relationship, the bus devices mounted on each connection channel of the cascade bus switch device and the current bus device are summarized to determine the target bus device mounted on each connection channel of the bus switch device.
[0043] Optionally, after checking the bus devices mounted on each connection channel to determine whether there is a cascade bus switch device in the bus devices, the method further includes:
[0044] If not, the current bus device is determined as the target bus device mounted on each connection channel of the bus switch device.
[0045] Optionally, generating the topological connection relationship of the bus devices according to the target bus devices mounted on each connection channel of the bus switch device includes:
[0046] Determine the hierarchical position of the target bus device mounted on each connection channel of the bus switch device;
[0047] The target bus device and the bus switch devices in each level are used to generate a topological connection relationship of the bus devices.
[0048] Optionally, the adopting the target bus device and the bus switch devices in each level to generate a topological connection relationship of the bus devices includes:
[0049] Get the corresponding connection node of each target bus device;
[0050] According to the hierarchical position of the target bus device of each connection channel of the bus switch device, connecting the connection nodes of adjacent hierarchies under the bus switch device to generate a topological connection relationship of the bus devices;
[0051] The topological connection relationship of the bus devices is used to generate a topological map of the bus devices.
[0052] According to a second aspect of the present invention, a topology generation device is provided, the device comprising:
[0053] an identification device module, used to obtain the device address of each bus device, and identify the bus switch device by using a preset switch address and the device address; wherein the bus devices are deployed in several levels, and the bus switch device is used to connect to the bus devices of the next level through a preset number of connection channels;
[0054] A first control module, used for controlling the connection channels of the bus switch device to be completely closed, identifying a first bus device at a level where the bus switch device is located, and determining a device address corresponding to the first bus device as a reference result;
[0055] A second control module, used for controlling the connection channels of the bus switch device to be opened in sequence, identifying the second bus device of each connection channel of the bus switch device, and determining the device address corresponding to the second bus device as the scanning result;
[0056] A device determination module, used for comparing the scanning results of each connection channel with the benchmark results respectively, and determining the target bus device mounted on each connection channel of the bus switch device;
[0057] A topology generation module is used to generate a topological connection relationship of the bus devices according to the target bus devices mounted on each connection channel of the bus switch device.
[0058] According to another aspect of the present invention, there is also provided an electronic device, comprising:
[0059] processor;
[0060] a memory for storing instructions executable by the processor;
[0061] The processor is configured to execute the instructions to implement the topology generation method as described above.
[0062] According to another aspect of the present invention, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the topology generation method described above are implemented.
[0063] According to yet another aspect of the present invention, a computer program product is provided, comprising a computer program / instruction, wherein when the computer program / instruction is executed by a processor, the steps of the topology generation method described above are implemented.
[0064] The topology generation method provided by the embodiment of the present invention obtains the device address of each bus device, adopts the preset switch address and the device address, identifies the bus switch device, controls all the connection channels of the bus switch device to be closed, identifies the first bus device at the level where the bus switch device is located, determines the device address corresponding to the first bus device as the benchmark result, controls the connection channels of the bus switch device to be opened in sequence, identifies the second bus device of each connection channel of the bus switch device, determines the device address corresponding to the second bus device as the scanning result, compares the scanning results of each connection channel with the benchmark results, determines the target bus device mounted on each connection channel of the bus switch device, and generates the topological connection relationship of the bus devices according to the target bus devices mounted on each connection channel of the bus switch device. The embodiment of the present invention utilizes accurate scanning and comparison of device addresses to identify devices in cascade of I2C bus switch devices, and performs hierarchical topology recognition to clarify the specific connection relationship and hierarchy of each device, thereby constructing a hierarchical I2C system topology structure, and achieving comprehensive and accurate recognition of all devices on the I2C bus. By automatically scanning and identifying bus devices, the workload of manual inspection and configuration is reduced, the efficiency of device recognition is improved, and errors and omissions caused by manual operations are avoided, thereby ensuring the consistency and reliability of the recognition results.
[0065] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0067] Figure 1 is a flowchart of a topology generation method provided by an embodiment of the present invention;
[0068] Figure 2 yes Figure 1 A flowchart of step 101 in the topology generation method provided in an embodiment of the present invention;
[0069] Figure 3 yes Figure 1 Flow chart of step 102 in the topology generation method provided in the embodiment of the present invention;
[0070] Figure 4 yes Figure 1 Flow chart of step 103 in the topology generation method provided in the embodiment of the present invention;
[0071] Figure 5 yes Figure 1 Flow chart of step 104 in the topology generation method provided in the embodiment of the present invention;
[0072] Figure 6 is a schematic diagram of the connection of bus devices in the topology generation method provided by an embodiment of the present invention;
[0073] Figure 7 is a topology diagram of bus devices in the topology generation method provided by an embodiment of the present invention;
[0074] Figure 8 is a schematic diagram of the structure of a topology generating device provided by an embodiment of the present invention;
[0075] Fig. 9 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0076] To make the purpose, technical scheme and advantages of the embodiments of the present invention clearer, the embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings. However, it will be appreciated by those skilled in the art that in the embodiments of the present invention, many technical details are proposed in order to enable the reader to better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical scheme claimed in the present application can be implemented. The division of the following embodiments is for the convenience of description, and should not constitute any limitation on the specific implementation of the present invention. The various embodiments can be combined and referenced with each other without contradiction.
[0077] Reference Figure 1 , shows a flowchart of the steps of a topology generation method provided by an embodiment of the present invention, the method may include:
[0078] Step 101, obtaining the device address of each bus device, using a preset switch address and the device address to identify the bus switch device.
[0079] Wherein, the bus devices are deployed in several levels, and the bus switch device is used to connect with the bus devices of the next level through a preset number of connection channels;
[0080] In an embodiment of the present invention, in order to solve the problem that the current I2C topology is checked by manually inputting instructions, which leads to a sharp increase in the difficulty of topology checking and is prone to recognition errors, thereby affecting the recognition accuracy of I2C devices, this embodiment uses accurate scanning and comparison of device addresses to automatically identify devices cascaded by I2C bus switch devices, and performs hierarchical topology recognition to clarify the specific connection relationship and hierarchy of each device, thereby constructing a hierarchical I2C system topology structure, and realizing comprehensive and accurate recognition of all devices on the I2C bus.
[0081] It should be noted that, refer to Figure 6 , shows a connection diagram of bus devices in the topology generation method provided by an embodiment of the present invention. Specifically, there are many I2C devices, i.e., bus devices, mounted under the baseboard management controller. The bus devices are deployed according to several levels. Since each bus device has a corresponding device address, this embodiment connects the test device to the BMC through the serial port and inputs a scan instruction to scan the I2C devices existing in each level to obtain the device address of each bus device. Usually, the address of the I2C device consists of a fixed part and a programmable part. In the 8-bit address, the upper 4 bits (bit4-bit7) are the fixed part. This part of the address is usually used to distinguish the device type. It is preset when the chip leaves the factory and is usually not changeable; bit1-bit3 is the programmable part, which is used to distinguish devices of the same type and is set through hardware configuration (such as address selection pins) to ensure that each device has a unique address on the bus; bit0 is usually called a read / write bit, which is used to indicate the direction of data transmission. The I2C device address range is usually 0x03 to 0x77. The I2C switch, i.e., the bus switch device, which is common in servers and storage products, has the upper 4 bits bit4-bit7 in its I2C address definition. is the fixed part, bit1-bit3 are the programmable part. By configuring these bits, different I2C addresses can be generated. The optional address range of the I2C switch device is 0xe0 to 0xef. Based on this address range, the I2C switch device can be identified under the I2C bus. I will not go into details here.
[0082] Specifically, all bus devices are first scanned to obtain the device address of each bus device, and the device address is stored as a device address list. The preset switch address corresponding to the predetermined bus switch device, that is, the optional address range 0xe0 to 0xef, is obtained. The preset switch address is used to traverse the device address list to identify the bus switch device, wherein the bus switch device is used to connect to the bus device of the next level through a preset number of connection channels. It should be noted that in order to expand the number of devices and realize address multiplexing, an I2C Switch device is usually used. The I2C Switch device selects different connection channels to enable more devices to be connected to the same I2C bus, thereby solving the address conflict problem. However, the use of I2CSwitch also increases the complexity of the bus, especially when multiple I2C Switches are cascaded, it is necessary to switch the connection channels step by step to access a specific device. This configuration increases the complexity of the system, especially when performing troubleshooting and topology checking. It is more difficult. Therefore, in this embodiment, the preset switch address is first used to identify the bus switch device to facilitate the identification of the topological relationship of the device.
[0083] Step 102: Control all connection channels of the bus switch device to be closed, identify the first bus device at the level where the bus switch device is located, and determine the device address corresponding to the first bus device as a reference result.
[0084] In an embodiment of the present invention, after a bus switch device in a scanning level is identified, since the bus switch device is connected to the bus device of the next level through a preset number of connection channels, the bus device of the next level may also include a bus switch device. Therefore, this embodiment first controls all the connection channels of the bus switch device to be closed, and identifies the first bus device of the level where the bus switch device is located, wherein the first bus device is a first-level bus device mounted under the baseboard management controller. Since the bus switch device is identified and all the connection channels of the bus switch device are controlled to be closed, the scanning device can only scan the device address of the bus device of the level where the bus switch device is located, and determines the device address corresponding to the first bus device as the benchmark result. The benchmark result is used to judge the bus device of the next level, which will not be repeated here.
[0085] Specifically, a control operation is performed on the connection channels of the I2C switch device, and after closing all its connection channels, the I2C bus is scanned again to obtain the addresses of all I2C devices at the current level. The opening and closing of the connection channels are realized through control signals. In this embodiment, the I2C switch device has a channel switching control register, which receives control signals sent by the host to control the opening or closing of different connection channels. Specifically, in response to the control signal for closing all channels, the connection channels of the bus switch device are controlled to be all closed, and it is determined that the connection channels of the bus switch device are closed, and the bus devices at the level where the bus switch device is located are scanned to identify the first bus device at the level where the bus switch device is located, and the device address corresponding to the first bus device is obtained, and the device address of the first bus device is determined as the reference result.
[0086] Step 103, controlling the connection channels of the bus switch device to be opened in sequence, identifying the second bus device of each connection channel of the bus switch device, and determining the device address corresponding to the second bus device as the scanning result.
[0087] In an embodiment of the present invention, after determining the benchmark result, the connection channels of the bus switch device are opened one by one, the I2C devices under each connection channel of the bus switch device are scanned and identified, and the device addresses corresponding to the I2C devices under each connection channel are determined as the scan results. Specifically, in response to the control signal for sequentially opening the connection channels, the connection channels of the bus switch device are controlled to be opened sequentially in a preset opening order, the opening state of the connection channels of the bus switch device is monitored, the currently only opened connection channel is determined, the bus devices under the currently only opened connection channel are scanned, the bus devices under the currently only opened connection channel are identified, the device addresses corresponding to the bus devices under the connection channels are obtained, the device addresses corresponding to the bus devices under the connection channels are summarized, and the scan results of each connection channel are determined. It should be noted that the preset opening order can be set according to the sequence of the connection channel numbers, or can be set according to the actual scanning requirements, which is not specifically limited here.
[0088] Step 104 : Compare the scan results of each connection channel with the reference results respectively, and determine the target bus device mounted on each connection channel of the bus switch device.
[0089] In the embodiment of the present invention, since the scanning result of the connection channel includes the device address of the bus device at the level where the bus switch device is located and the device address of the bus device under the connection channel, the device address cannot distinguish the level. Therefore, by comparing the scanning result of each connection channel with the benchmark result, the device address of the bus device under the connection channel can be determined, thereby determining the target bus device mounted on each connection channel of the bus switch device, and the target bus device is the bus device mounted under the channel of the bus switch device.
[0090] Specifically, it is necessary to determine whether there is a cascaded I2C switch device to ensure that the bottom layer is identified and to achieve comprehensive identification of the bus device. Therefore, the scanning results of each connection channel are compared with the benchmark results to obtain the current bus device mounted on each connection channel. The current bus device mounted on each connection channel is checked to determine whether there is a cascaded bus switch device in the current bus device. If so, the target bus device mounted on each connection channel of the bus switch device is determined based on the cascaded bus switch device. If not, the current bus device is determined as the target bus device mounted on each connection channel of the bus switch device.
[0091] Step 105 , generating a topological connection relationship of the bus devices according to the target bus devices mounted on each connection channel of the bus switch device.
[0092] In the embodiment of the present invention, the hierarchical position of the target bus device mounted on each connection channel of the bus switch device is determined, and the topological connection relationship of the bus device is generated by using the target bus device and the bus switch devices in each layer. Specifically, the corresponding connection node of each target bus device is obtained, and the connection nodes of the adjacent layers under the bus switch device are connected according to the hierarchical position of the target bus device of each connection channel of the bus switch device to generate the topological connection relationship of the bus device. The topological connection relationship of the bus device is used to generate the topological map of the bus device. After the iterative check of all I2C switch devices is completed, the complete I2C topological connection relationship under the system can be obtained. Figure 7 , shows a topology diagram of the bus device in the topology generation method provided by an embodiment of the present invention, specifically a topology diagram automatically generated by using the networkx network topology library, taking each bus device as a node and its connection relationship as an edge, and its connection relationship can be automatically drawn into a topology connection diagram, which is convenient for more intuitive observation of the I2C topology connection relationship.
[0093] The topology generation method provided by the embodiment of the present invention obtains the device address of each bus device, adopts the preset switch address and the device address, identifies the bus switch device, controls all the connection channels of the bus switch device to be closed, identifies the first bus device at the level where the bus switch device is located, determines the device address corresponding to the first bus device as the benchmark result, controls the connection channels of the bus switch device to be opened in sequence, identifies the second bus device of each connection channel of the bus switch device, determines the device address corresponding to the second bus device as the scanning result, compares the scanning results of each connection channel with the benchmark results, determines the target bus device mounted on each connection channel of the bus switch device, and generates the topological connection relationship of the bus devices according to the target bus devices mounted on each connection channel of the bus switch device. The embodiment of the present invention utilizes accurate scanning and comparison of device addresses to identify devices in cascade of I2C bus switch devices, and performs hierarchical topology recognition to clarify the specific connection relationship and hierarchy of each device, thereby constructing a hierarchical I2C system topology structure, and achieving comprehensive and accurate recognition of all devices on the I2C bus. By automatically scanning and identifying bus devices, the workload of manual inspection and configuration is reduced, the efficiency of device recognition is improved, and errors and omissions caused by manual operations are avoided, thereby ensuring the consistency and reliability of the recognition results.
[0094] Further, see Figure 2 , showing Figure 1 A flowchart of step 101 in a topology generation method is provided. The method is basically the same as the topology generation method provided in the first embodiment of the present invention. Step 101 may include:
[0095] Step 201 , scan bus devices, obtain device addresses of various bus devices, and store the device addresses as a device address list.
[0096] Step 202: Obtain a preset switch address corresponding to a predetermined bus switch device.
[0097] Step 203: Use the preset switch address to traverse the device address list and identify the bus switch device.
[0098] It should be noted that in the embodiment of the present invention, the bus devices are scanned to obtain the device address of each bus device, and the device address is stored as a device address list. Specifically, all devices connected to the bus are scanned by a network scanning tool. During the scanning process, the unique address of each device is identified and recorded, and all the acquired device addresses are stored in a list for subsequent processing and access. In the design or configuration stage of the baseboard management controller and the bus devices, it has been determined which devices are bus switch devices. These bus switch devices have a specific address range. Each address in the device address list is checked one by one. By comparing the addresses in the list with the preset switch addresses, it is possible to identify which devices are bus switch devices.
[0099] The embodiment of the present invention accurately identifies the switch devices on the bus by scanning and comparing the device addresses, and systematically scans and identifies the key bus switch devices by accurately scanning and comparing the device addresses, so as to facilitate the construction of a hierarchical I2C system topology.
[0100] Further, see Figure 3 , showing Figure 1 A flowchart of step 102 in a topology generation method is provided. The method is substantially the same as the topology generation method provided in the first embodiment of the present invention. Step 102 may include:
[0101] Step 301: In response to a first control signal, all connection channels of the bus switch device are controlled to be closed.
[0102] Step 302: determine that the connection channel of the bus switch device is closed, scan the bus devices at the level where the bus switch device is located, and identify the first bus device at the level where the bus switch device is located.
[0103] Step 303: Acquire a device address corresponding to the first bus device, and determine the device address of the first bus device as a reference result.
[0104] It should be noted that, in the embodiment of the present invention, in response to the first control signal, all the connection channels of the bus switch device are controlled to be closed. The first control signal is an instruction signal generated by the host according to the request of the bus switch device to close all the connection channels. When the controller receives the first control signal, all the connection channels of the bus switch device will be closed, and the bus switch device will no longer communicate with any bus device of the next level. The connection channel control operation is performed on the I2C switch device. After closing all its connection channels, the I2C bus is scanned again to obtain all I2C device addresses at the current level. In this embodiment, the I2C switch device has a channel switching control register, which receives the control signal sent by the host, thereby controlling the opening or closing of different connection channels.
[0105] Specifically, confirm that the connection channel of the bus switch device has been closed, scan the bus devices at the level where the bus switch device is located, scan other bus devices at the same level as the bus switch device, and identify the first bus device at the level where the bus switch device is located, wherein the first bus device is a first-level bus device mounted under the baseboard management controller. Since the bus switch device is identified and all the connection channels of the control bus switch device are closed, the scanning device can only scan the device address of the bus device at the level where the bus switch device is located, and determine the device address corresponding to the first bus device as the benchmark result, and the benchmark result is used to judge the bus device at the next level.
[0106] For example, the optional address range of the I2C switch device is 0xe0~0xef. Based on this address range, the I2C switch device can be identified under the I2C bus. From the scan results, it is determined whether each device is an I2C switch device according to the device address. Assuming that the channel of the current switchA device is CH7, the results of executing the I2C scan are 0xa0, 0xa2, 0xe0, 0xb0, and 0x90. It can be obtained that the address 0xe0 is the I2C switch device. Turn off all channels of the I2C switch device, perform an I2C scan, obtain all I2C device addresses at the current level, and turn off all channels of the bus switch device 1. At this time, the device addresses that can be obtained are 0xa0, 0xa2, 0xe0, and 0xb0. This group of device addresses is used as the benchmark result to subsequently determine the bus devices mounted under each connection channel of the I2C switch.
[0107] Specifically, in response to the first control signal, controlling the connection channels of the bus switch device to be all closed may include the following steps:
[0108] First, the corresponding relationship between the control signal bit and the connection channel is preset;
[0109] Secondly, if the connection channels of the bus switch device request to be closed, all the control signal bits are set to closed flag bits to generate a first control signal;
[0110] Secondly, in response to detecting the first control signal, all the connection channels of the bus switch device are controlled to be closed.
[0111] It should be noted that in the above steps, in order to control the opening and closing of the connection channel, the corresponding relationship between the control signal bit and the connection channel is pre-set, wherein the control signal bit is a signal bit used to control the connection channel of the bus switch device, and the connection channel is a channel used by the bus switch device to communicate with other devices. In the design or configuration stage, it is clear which connection channel each control signal bit corresponds to. According to the scanning requirements, if the connection channel of the bus switch device requests to be closed, all the control signal bits are set to the closing flag bit, and the first control signal is generated, so that in response to the detection of the first control signal, all the connection channels of the bus switch device are controlled to be closed.
[0112] In this embodiment, when a request to close a connection channel is received, the I2C switch device has a channel switching control register by setting a control signal bit and generating a corresponding control signal, which receives a first control signal sent by the host to close all connection channels of the bus switch device, thereby ensuring that these connection channels can be correctly controlled and managed.
[0113] For example, as shown in the following table, an I2C switch device with 8 connection channels is used as an example for explanation. The I2C switch device has a channel switching control register, which receives the control signal sent by the host to control the opening or closing of different channels. The following table shows the correspondence between the control signal and the channel switch of the 8-channel I2C switch device. A bit 0 / 1 corresponds to the closing / opening of a channel respectively. Specifically, all channels under the I2C switch device are closed, all bits of the control signal are set to 0, and sent to the I2C switch channel switching control register. At this time, the scan results 0xa0, 0xa2, 0xe0, 0xb0 can be obtained. This result is used as a benchmark for subsequent judgment of the devices mounted under each connection channel of the I2C switch.
[0114] Table 1: Correspondence between control signal bits and connection channels
[0115]
[0116] Further, see Figure 4 , showing Figure 1 A flowchart of step 103 in a topology generation method is provided. The method is substantially the same as the topology generation method provided in the first embodiment of the present invention. Step 103 may include:
[0117] Step 401: In response to a second control signal, the connection channels of the bus switch devices are controlled to be turned on in sequence according to a preset turn-on sequence.
[0118] Step 402, monitoring the open state of the connection channel of the bus switch device, and determining the only currently open connection channel.
[0119] Step 403, scanning the bus devices under the only currently opened connection channel, and identifying the second bus device under the only currently opened connection channel;
[0120] Step 404: Acquire the device address corresponding to the second bus device, summarize the device addresses corresponding to the second bus device, and determine the scanning result of each connection channel.
[0121] It should be noted that, in an embodiment of the present invention, in response to the second control signal, the connection channels of the bus switch device are controlled to be turned on in sequence according to a preset opening order. The second control signal is a predefined signal used to control the connection channels of the bus switch device to be turned on in sequence according to a preset opening order. When the first control signal is received, the connection channels of the bus switch device are turned on one by one according to the preset order, and the opening state of each connection channel is monitored in real time. During the opening process, the only connection channel that is currently in the open state is identified and determined, and the bus devices under the only connection channel that is currently opened are scanned to identify the second bus device under the only connection channel that is currently opened, wherein the second bus device includes the bus device at the level where the bus switch device is located and the bus device under the only connection channel that is currently opened. The device address of the second bus device is obtained from the scanning result, and all the obtained device addresses are summarized to form a complete scanning result of the connection channel. The scanning result is used to determine the device status under each connection channel to facilitate subsequent management and configuration.
[0122] Specifically, in response to the second control signal, controlling the connection channels of the bus switch devices to be opened in sequence according to a preset opening sequence may specifically include the following steps:
[0123] If the connection channels of the bus switch device request to be opened in sequence, the control signal positions of the target connection channels are respectively set to the opening flag positions according to the preset opening sequence, and a second control signal is generated;
[0124] In response to detecting the second control signal, the target connection channel of the bus switch device is controlled to be turned on.
[0125] It should be noted that in the above steps, if the connection channels of the bus switch device request to be turned on in sequence, then according to the pre-set correspondence between the control signal bit and the connection channel, the control signal that sets the control signal position of the target connection channel to the turn-on identification bit is determined, that is, the control signal position of the target connection channel is set to the turn-on identification bit according to the preset turn-on sequence, and a second control signal is generated, so that in response to detecting the second control signal, the target connection channel of the bus switch device is controlled to be turned on.
[0126] Further, see Figure 5 , showing Figure 1 A flowchart of step 104 in a topology generation method is provided. The method is substantially the same as the topology generation method provided in the first embodiment of the present invention. Step 104 may include:
[0127] Step 501 : Compare the scanning results of each connection channel with the benchmark results to obtain the current bus devices mounted on each connection channel.
[0128] Step 502: Check the current bus devices mounted on each connection channel to determine whether there is a cascade bus switch device in the current bus devices.
[0129] Step 503: If yes, determine the target bus device mounted on each connection channel of the bus switch device according to the cascaded bus switch device.
[0130] It should be noted that the embodiment of the present invention can obtain the current bus device mounted under each connection channel by comparing the scanning results of each connection channel with the benchmark results. To ensure that the lowest-level device is scanned and the bus device is comprehensively and accurately identified, the current bus device mounted under each connection channel is checked to determine whether there is a cascaded bus switch device in the current bus device. If so, the target bus device mounted on each connection channel of the bus switch device is determined based on the cascaded bus switch device, wherein the target bus device includes all bus devices mounted under the bus switch device channel.
[0131] For example, the scan result is compared with the benchmark result to obtain the I2C device under the current I2C switch channel. For example, by comparing the scan result (0xa0, 0xa2, 0xe0, 0xb0, 0x84) with the benchmark result (0xa0, 0xa2, 0xe0, 0xb0), it can be known that device 0x84 is the bus device mounted under the connection channel CH0 of bus switch device 1. By switching the channels of bus switch device 1 one by one, the bus devices mounted under each connection channel can be obtained in turn. Specifically, connection channel 0 corresponds to device 4, with an address of 0x84; connection channel 1 corresponds to device 5, with an address of 0x90, and so on. The scanned results are identified to determine whether there are cascaded I2C switch devices. When switch device 1 switches to channel CH2, switch device 2 corresponding to 0xe2 can be identified. At this time, the connection channel of switch device 1 is kept unchanged, and the scan is repeated on switch device 2 to obtain the I2C devices mounted under all its channels. The steps are repeated to check the current bus devices mounted under each connection channel to determine whether there are cascaded bus switch devices in the current bus device until there are no next-level I2C switch devices.
[0132] Specifically, checking the bus devices mounted under each connection channel to determine whether there is a cascade bus switch device in the bus device may include:
[0133] First, determine the number of levels of bus devices mounted under each connection channel;
[0134] Secondly, the bus devices at the same level under each connection channel are checked using the preset switch address corresponding to the bus switch device to determine whether there is a cascaded bus switch device in the bus device.
[0135] It should be noted that in the above steps, when scanning the device, the number of levels of the bus devices mounted under each connection channel is determined, and the preset switch address corresponding to the bus switch device is used to check the bus devices of the same level under each connection channel to determine whether there are cascaded bus switch devices in the bus devices. The cascaded bus switch devices are bus switch devices that are connected to the bus switch devices of the upper level and the bus switch devices or bus devices of the lower level. The bus switch devices are continued to be identified in the mounted devices of the bus switch devices until there are no I2C switch devices of the next cascade, indicating that the bus devices of the last level have been scanned and identified.
[0136] Specifically, if so, determining the target bus device mounted on each connection channel of the bus switch device according to the cascaded bus switch device may specifically include:
[0137] If it is determined that there is a cascade bus switch device in the current bus device, repeatedly perform switch control on the connection channels of the cascade bus switch device to determine the bus devices mounted on each connection channel of the cascade bus switch device;
[0138] Obtaining a connection relationship between a cascade bus switch device and a bus switch device;
[0139] The connection relationship is adopted to summarize the bus devices mounted on each connection channel of the cascade bus switch device and the current bus device, and determine the target bus device mounted on each connection channel of the bus switch device.
[0140] In the embodiment of the present invention, in the above steps, if it is determined that there is a cascade bus switch device in the current bus device, the steps of closing all the connection channels and then opening them one by one are repeated, that is, the connection channels of the cascade bus switch device are repeatedly switched on and off to determine the bus devices mounted on each connection channel of the cascade bus switch device, which will not be described one by one here. The connection relationship between the cascade bus switch device and the bus switch device is obtained, and the bus devices mounted on each connection channel of the cascade bus switch device are summarized with the current bus device through the connection relationship to determine the target bus device mounted on each connection channel of the bus switch device.
[0141] Specifically, after checking the bus devices mounted under each connection channel to determine whether there is a cascade bus switch device in the bus device, it also includes: if not, determining the current bus device as the target bus device mounted on each connection channel of the bus switch device. It should be noted that if there is no cascade bus switch device among the bus devices mounted under each connection channel of the current bus switch device, it indicates that there is no bus device mounted under the current level, and there is no need to scan and identify again, and the current bus device is determined as the target bus device mounted on each connection channel of the bus switch device.
[0142] In some embodiments, step 105 generates a topological connection relationship between bus devices based on the target bus devices mounted on each connection channel of the bus switch device, which may specifically include: determining the hierarchical position of the target bus devices mounted on each connection channel of the bus switch device; using the target bus devices and the bus switch devices in each hierarchy to generate a topological connection relationship between the bus devices.
[0143] Specifically, the target bus device and the bus switch devices in each layer are used to generate a topological connection relationship of the bus devices, which may specifically include the following steps:
[0144] First, obtain the corresponding connection node of each target bus device;
[0145] Secondly, according to the hierarchical position of the target bus device of each connection channel of the bus switch device, the connection nodes of adjacent hierarchies under the bus switch device are connected to generate a topological connection relationship of the bus devices;
[0146] Secondly, the topological connection relationship of the bus devices is used to generate a topological map of the bus devices.
[0147] In the embodiment of the present invention, the hierarchical position of the target bus device mounted on each connection channel of the bus switch device is determined. The target bus device is the bus device mounted on the connection channel under the bus switch device. It is necessary to determine the hierarchical position of each target bus device in the bus topology, and use the target bus device and the bus switch devices in each level to generate the topological connection relationship of the bus device. Combined with the information of the target bus device and the bus switch device, a topological map corresponding to the connection relationship of the bus device is constructed. Specifically, the corresponding connection node of each target bus device is obtained, and the connection node of each target bus device is identified and recorded. According to the hierarchical position of the target bus device, the connection nodes of adjacent levels are connected. Through these connections, the topological connection relationship of the bus device is constructed, thereby generating a visual topological map for easy management and maintenance.
[0148] The embodiment of the present invention determines the hierarchical position of the target bus device, combines the information of the bus switch device, generates the topological connection relationship of the bus device, and finally generates a visual topological map, thereby constructing a hierarchical I2C system topology structure, and realizing comprehensive and accurate identification of all devices on the I2C bus.
[0149] Reference Figure 8 , shows a schematic diagram of the structure of a topology generation device provided by an embodiment of the present invention, the device comprising:
[0150] The device identification module 601 is used to obtain the device address of each bus device, and use the preset switch address and the device address to identify the bus switch device; wherein the bus devices are deployed according to several levels, and the bus switch device is used to connect to the bus devices of the next level through a preset number of connection channels;
[0151] A first control module 602 is used to control all connection channels of the bus switch device to be closed, identify a first bus device at the level where the bus switch device is located, and determine a device address corresponding to the first bus device as a reference result;
[0152] The second control module 603 is used to control the connection channels of the bus switch device to be opened in sequence, identify the second bus device of each connection channel of the bus switch device, and determine the device address corresponding to the second bus device as the scanning result;
[0153] A device determination module 604 is used to compare the scanning results of each connection channel with the reference result to determine the target bus device mounted on each connection channel of the bus switch device;
[0154] The topology generation module 605 is used to generate a topological connection relationship of the bus devices according to the target bus devices mounted on each connection channel of the bus switch device.
[0155] Furthermore, the identification device module 601 includes:
[0156] A first scanning submodule, used for scanning bus devices, obtaining device addresses of various bus devices, and storing the device addresses as a device address list;
[0157] A first acquisition submodule, used to acquire a preset switch address corresponding to a predetermined bus switch device;
[0158] The identification submodule is used to traverse the device address list using the preset switch address to identify the bus switch device.
[0159] Furthermore, the first control module 602 includes:
[0160] A first control submodule, configured to control all connection channels of the bus switch device to be closed in response to a first control signal;
[0161] A second scanning submodule is used to determine that the connection channel of the bus switch device is closed, scan the bus devices at the level where the bus switch device is located, and identify the first bus device at the level where the bus switch device is located;
[0162] The second acquisition submodule is used to acquire the device address corresponding to the first bus device, and determine the device address of the first bus device as a reference result.
[0163] Furthermore, the first control submodule includes:
[0164] A preset unit, used to preset the corresponding relationship between the control signal bit and the connection channel;
[0165] A first generating unit, configured to set all the control signal bits to close flag bits to generate a first control signal if all the connection channels of the bus switch device are requested to be closed;
[0166] The first control unit is used to control all the connection channels of the bus switch device to be closed in response to detecting the first control signal.
[0167] Furthermore, the second control module 603 includes:
[0168] A second control submodule, configured to control the connection channels of the bus switch device to be opened in sequence according to a preset opening sequence in response to a second control signal;
[0169] A monitoring submodule, used to monitor the open state of the connection channel of the bus switch device and determine the only currently open connection channel;
[0170] A third scanning submodule is used to scan the bus device under the only currently opened connection channel to identify the second bus device under the only currently opened connection channel;
[0171] The third acquisition submodule is used to acquire the device address corresponding to the second bus device, summarize the device addresses corresponding to the second bus device, and determine the scanning results of each connection channel.
[0172] Furthermore, the second control submodule includes:
[0173] A second generating unit is configured to set the control signal position of the target connection channel to an opening flag position respectively according to a preset opening sequence if the connection channels of the bus switch device are requested to be opened in sequence, and generate a second control signal;
[0174] The second control unit is used to control the target connection channel of the bus switch device to open in response to detecting the second control signal.
[0175] Furthermore, the determining device module 604 includes:
[0176] A comparison submodule, used to compare the scanning results of each connection channel with the benchmark results respectively, to obtain the current bus device mounted under each connection channel;
[0177] A checking submodule, used for checking the current bus devices mounted under each connection channel to determine whether there is a cascade bus switch device in the current bus devices;
[0178] The first determining submodule is used to determine the target bus device mounted on each connection channel of the bus switch device according to the cascade bus switch device.
[0179] Furthermore, the inspection submodule includes:
[0180] A first determining unit, used to determine the number of levels of bus devices mounted under each connection channel;
[0181] The checking unit is used to check the bus devices at the same level under each connection channel by using the preset switch address corresponding to the bus switch device to determine whether there is a cascade bus switch device in the bus devices.
[0182] Furthermore, the determining submodule includes:
[0183] A control unit, configured to, if it is determined that a cascade bus switch device exists in the current bus device, repeatedly perform switch control on the connection channels of the cascade bus switch device, and determine the bus devices mounted on each connection channel of the cascade bus switch device;
[0184] A first acquisition unit, configured to acquire a connection relationship between the cascade bus switch device and the bus switch device;
[0185] The second determining unit is used to adopt the connection relationship to summarize the bus devices mounted on each connection channel of the cascade bus switch device and the current bus device, and determine the target bus device mounted on each connection channel of the bus switch device.
[0186] Furthermore, the determining device module 604 further includes:
[0187] The second determining submodule is used for, if not, determining the current bus device as the target bus device mounted on each connection channel of the bus switch device.
[0188] Furthermore, the generating topology module 605 includes:
[0189] A third determination submodule is used to determine the hierarchical position of the target bus device mounted on each connection channel of the bus switch device;
[0190] A generating submodule is used to generate a topological connection relationship of the bus devices by using the target bus device and the bus switch devices in each level.
[0191] Furthermore, the generation submodule includes:
[0192] A second acquisition unit, used to acquire a connection node corresponding to each target bus device;
[0193] A connection unit, configured to connect connection nodes of adjacent levels under the bus switch device according to the hierarchical position of the target bus device of each connection channel of the bus switch device, so as to generate a topological connection relationship of the bus devices;
[0194] The third generating unit is used to generate a topological map of the bus device by adopting the topological connection relationship of the bus device.
[0195] The topology generation device provided by the embodiment of the present invention obtains the device address of each bus device, adopts the preset switch address and the device address, identifies the bus switch device, controls all the connection channels of the bus switch device to be closed, identifies the first bus device at the level where the bus switch device is located, determines the device address corresponding to the first bus device as the benchmark result, controls the connection channels of the bus switch device to be opened in sequence, identifies the second bus device of each connection channel of the bus switch device, determines the device address corresponding to the second bus device as the scanning result, compares the scanning results of each connection channel with the benchmark results respectively, determines the target bus device mounted on each connection channel of the bus switch device, and generates the topological connection relationship of the bus devices according to the target bus devices mounted on each connection channel of the bus switch device. The embodiment of the present invention utilizes accurate scanning and comparison of device addresses to identify devices in cascade of I2C bus switch devices, and performs hierarchical topology recognition to clarify the specific connection relationship and hierarchy of each device, thereby constructing a hierarchical I2C system topology structure, and achieving comprehensive and accurate recognition of all devices on the I2C bus. By automatically scanning and identifying bus devices, the workload of manual inspection and configuration is reduced, the efficiency of device recognition is improved, and errors and omissions caused by manual operations are avoided, thereby ensuring the consistency and reliability of the recognition results.
[0196] Reference Fig. 9 , an embodiment of the present invention further provides an electronic device, such as Fig. 9As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.
[0197] Memory 703, used for storing computer programs;
[0198] The processor 701 is used to execute the program stored in the memory 703 to implement the following steps:
[0199] Obtaining the device address of each bus device, and using a preset switch address and the device address to identify a bus switch device; wherein the bus switch device is used to connect to a bus device at a next level through a preset number of connection channels;
[0200] Controlling all connection channels of the bus switch device to be closed, identifying a first bus device at a level where the bus switch device is located, and determining a device address corresponding to the first bus device as a reference result;
[0201] Controlling the connection channels of the bus switch device to be opened in sequence, identifying the second bus device of each connection channel of the bus switch device, and determining the device address corresponding to the second bus device as the scanning result;
[0202] Comparing the scanning results of each connection channel with the benchmark results respectively, and determining the target bus device mounted on each connection channel of the bus switch device;
[0203] A topological connection relationship of the bus devices is generated according to the target bus devices mounted on each connection channel of the bus switch device.
[0204] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0205] The communication interface is used for communication between the above terminal and other devices.
[0206] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0207] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0208] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores instructions. When the instructions are executed on a computer, the computer executes the topology generation method described in any one of the above embodiments.
[0209] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the topology generation method described in any one of the above embodiments.
[0210] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.
[0211] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0212] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0213] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims
1. A topology generation method, characterized in that: The method comprises: Obtaining the device address of each bus device, and identifying the bus switch device using a preset switch address and the device address; wherein the bus devices are deployed in several levels, and the bus switch device is used to connect to the bus devices of the next level through a preset number of connection channels; Controlling all connection channels of the bus switch device to be closed, identifying a first bus device at a level where the bus switch device is located, and determining a device address corresponding to the first bus device as a reference result; Controlling the connection channels of the bus switch device to be opened in sequence, identifying the second bus device of each connection channel of the bus switch device, and determining the device address corresponding to the second bus device as the scanning result; Comparing the scanning results of each connection channel with the benchmark results respectively, and determining the target bus device mounted on each connection channel of the bus switch device; A topological connection relationship of the bus devices is generated according to the target bus devices mounted on each connection channel of the bus switch device.
2. The method according to claim 1, characterized in that The step of obtaining the device address of each bus device and identifying the bus switch device by using a preset switch address and the device address includes: Scanning bus devices, obtaining device addresses of various bus devices, and storing the device addresses as a device address list; Obtaining a preset switch address corresponding to a predetermined bus switch device; The preset switch address is used to traverse the device address list to identify the bus switch device.
3. The method according to claim 1, characterized in that The controlling the connection channels of the bus switch device to be all closed, identifying the first bus device at the level where the bus switch device is located, and determining the device address corresponding to the first bus device as the reference result, includes: In response to the first control signal, controlling all connection channels of the bus switch device to be closed; Determining that a connection channel of the bus switch device is closed, scanning bus devices at a level where the bus switch device is located, and identifying a first bus device at the level where the bus switch device is located; A device address corresponding to the first bus device is obtained, and the device address of the first bus device is determined as a reference result.
4. The method according to claim 3, characterized in that The step of controlling all the connection channels of the bus switch device to be closed in response to the first control signal comprises: Preset the corresponding relationship between the control signal bit and the connection channel; If all the connection channels of the bus switch device are requested to be closed, all the control signal bits are set to closed flag bits to generate a first control signal; In response to detecting the first control signal, all connection channels of the bus switch device are controlled to be closed.
5. The method according to claim 1, characterized in that The controlling the connection channels of the bus switch device to be opened in sequence, identifying the second bus device of each connection channel of the bus switch device, and determining the device address corresponding to the second bus device as the scanning result, comprises: In response to the second control signal, controlling the connection channels of the bus switch device to be opened in sequence according to a preset opening sequence; Monitoring the open state of the connection channel of the bus switch device to determine the only currently open connection channel; Scan the bus devices under the only currently opened connection channel to identify the second bus device under the only currently opened connection channel; The device address corresponding to the second bus device is obtained, the device addresses corresponding to the second bus device are summarized, and the scanning results of each connection channel are determined.
6. The method according to claim 5, characterized in that In response to the second control signal, controlling the connection channels of the bus switch device to be opened in sequence according to a preset opening sequence comprises: If the connection channels of the bus switch device are requested to be opened in sequence, the control signal positions of the target connection channels are respectively set to the opening flag positions according to the preset opening sequence, and a second control signal is generated; In response to detecting the second control signal, the target connection channel of the bus switch device is controlled to be turned on.
7. The method according to claim 1, characterized in that The step of comparing the scanning results of each connection channel with the reference result to determine the target bus device mounted on each connection channel of the bus switch device includes: Compare the scan results of each connection channel with the benchmark results to obtain the current bus devices mounted on each connection channel; Checking the current bus devices mounted under each connection channel to determine whether there is a cascade bus switch device in the current bus devices; If so, the target bus devices mounted on each connection channel of the bus switch device are determined according to the cascade bus switch device.
8. The method according to claim 7, characterized in that The checking of the bus devices mounted under each connection channel to determine whether there is a cascade bus switch device in the bus devices includes: Determine the number of levels of bus devices mounted under each connection channel; The bus devices at the same level under each connection channel are checked using the preset switch address corresponding to the bus switch device to determine whether there is a cascade bus switch device in the bus devices.
9. The method according to claim 7, characterized in that: If so, determining the target bus device mounted on each connection channel of the bus switch device according to the cascade bus switch device includes: If it is determined that there is a cascade bus switch device in the current bus device, repeatedly performing switch control on the connection channels of the cascade bus switch device to determine the bus devices mounted on each connection channel of the cascade bus switch device; Acquire a connection relationship between the cascade bus switch device and the bus switch device; By using the connection relationship, the bus devices mounted on each connection channel of the cascade bus switch device and the current bus device are summarized to determine the target bus device mounted on each connection channel of the bus switch device.
10. The method according to claim 7, characterized in that After checking the bus devices mounted on each connection channel to determine whether there is a cascade bus switch device in the bus devices, the method further includes: If not, the current bus device is determined as the target bus device mounted on each connection channel of the bus switch device.
11. The method according to claim 1, characterized in that: The generating the topological connection relationship of the bus devices according to the target bus devices mounted on each connection channel of the bus switch device includes: Determine the hierarchical position of the target bus device mounted on each connection channel of the bus switch device; The target bus device and the bus switch devices in each level are used to generate a topological connection relationship of the bus devices.
12. The method according to claim 11, characterized in that The step of using the target bus device and the bus switch devices in each level to generate a topological connection relationship of the bus devices includes: Get the corresponding connection node of each target bus device; According to the hierarchical position of the target bus device of each connection channel of the bus switch device, connecting the connection nodes of adjacent hierarchies under the bus switch device to generate a topological connection relationship of the bus devices; The topological connection relationship of the bus devices is used to generate a topological map of the bus devices.
13. An electronic device, characterized in that: include: processor; a memory for storing processor-executable instructions; The processor is configured to execute the instructions to implement the topology generation method according to any one of claims 1 to 12.
14. A readable storage medium, characterized in that: The readable storage medium stores a computer program, and when the computer program is executed by a processor, the topology generation method according to any one of claims 1 to 12 is implemented.
15. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the topology generation method according to any one of claims 1 to 12 is implemented.
