Disclosure of Invention
The invention aims to provide an interface switching device and terminal equipment, which effectively solve the technical problem that interface type switching in the terminal equipment in the prior art is complicated.
The technical scheme provided by the invention is as follows:
an interface switching device, said interface switching device is connected with a general interface in the terminal equipment, said interface switching device includes:
the memory comprises a plurality of partitions, and a driver of one interface type is correspondingly stored in each partition;
and the processor is in communication connection with the memory and loads the driving programs in different partitions according to the received interface type switching request to realize the switching of the general interface types.
In the technical scheme, the processor realizes the switching of the types of the universal interfaces by loading the driving programs in different partitions of the memory, and the switching of the types of the universal interfaces is realized by adopting different partitions in a software and hardware combined mode, so that the method is simple and convenient, saves resources, and can realize the functions of various universal interfaces without arranging too many universal interfaces in the terminal equipment.
Further preferably, in the processor, the switching of the different partitions is realized by changing the starting address of the partition, and then the drivers in the different partitions are loaded to realize the switching of the types of the universal interfaces.
In the technical scheme, the starting address of each partition is different, so that the switching of different partitions is realized by changing the starting address of the partition.
Further preferably, the interface switching device further comprises a trigger key connected with the processor;
and the processor switches the partition for loading the driving program according to the trigger signal in the trigger key to realize the switching of the type of the universal interface.
In the technical scheme, the power grade is switched by triggering the hardware switch of the key, the method is simple and convenient, the configuration page does not need to be logged in for switching, even if the personnel who do not know the technology can easily switch according to the requirement, and the resources are fully utilized.
Further preferably, the switching of the types of the universal interfaces by switching the partition where the driver is loaded according to the trigger signal in the trigger button by the processor includes:
judging whether a trigger signal sent by a user through a trigger key is received; if so,
performing partition switching once according to the front and back sequence of partitions;
restarting the interface switching device and loading the driving program in the partition to realize the switching of the type of the general interface.
In the technical scheme, when a user sends a trigger signal for interface switching through the trigger key, the processor performs partition switching according to the sequence of partitions in the memory, so that switching of the types of the universal interfaces is realized, and the method is simple and convenient.
Further preferably, the switching of the types of the universal interfaces by switching the partition where the driver is loaded according to the trigger signal in the trigger button by the processor includes:
reading the background noise intensity of the terminal equipment;
comparing the acquired intensity with a preset noise intensity threshold value, and judging a threshold value interval to which the intensity belongs;
judging whether a trigger signal sent by a user through a trigger key is received; if so,
switching to a corresponding partition according to the judged threshold interval, wherein each partition is associated with one threshold interval;
restarting the interface switching device and loading the driving program in the partition, and switching the general interface to the corresponding interface type.
In the technical scheme, when a user sends a trigger signal for switching the interface type through a trigger key, the processor immediately reads the intensity information of the current wireless signal, and switches to the corresponding partition according to the intensity information, so as to switch to the corresponding interface type.
Further preferably, the interface switching device further comprises a display device connected with the processor;
and the processor reads the intensity of the background noise of the terminal equipment and displays the intensity in the display device.
In the technical scheme, the interface switching device further comprises a display device for displaying the intensity of background noise of the terminal equipment, so that a user can conveniently check the intensity as a theoretical basis for judging whether to switch the interface type.
Further preferably, the switching of the types of the universal interfaces by switching the partition where the driver is loaded according to the trigger signal in the trigger button by the processor includes:
reading the background noise intensity of the terminal equipment, and displaying in the display device;
judging whether a trigger signal sent by a user through a trigger key is received; if so,
performing partition switching once according to the front and back sequence of partitions;
restarting the interface switching device and loading the driving program in the partition to realize the switching of the type of the general interface.
In the technical scheme, after the user checks the background noise intensity displayed in the display device, the trigger key sends out the trigger signal of the interface type, and the processor performs partition switching according to the sequence of partitions in the memory, so that switching of the general interface type is realized, and the method is simple and convenient.
Further preferably, the switching of the types of the universal interfaces by switching the partition where the driver is loaded according to the trigger signal in the trigger button by the processor includes:
reading the background noise intensity of the terminal equipment;
comparing the acquired intensity with a preset noise intensity threshold value, and judging a threshold value interval to which the intensity belongs;
displaying the comparison result in the display device;
judging whether a trigger signal sent by a user through a trigger key is received; if so,
switching to a corresponding partition according to the judged threshold interval, wherein each partition is associated with one threshold interval;
restarting the interface switching device and loading the driving program in the partition to realize the switching of the type of the general interface.
In the technical scheme, after a user checks the strength of a display signal in the display device, a trigger signal of an interface type is sent out through the trigger key, the processor immediately reads the strength information of background noise of the terminal equipment, and switches to a corresponding partition according to the strength information so as to switch to the corresponding interface type.
The invention also provides terminal equipment comprising the interface switching device.
In the technical scheme, in the terminal equipment, a mode of combining software and hardware is adopted, the interface types are switched at any time by triggering the keys, the switching is simple and convenient, the configuration page does not need to be logged in for switching, even if personnel who do not know the technology can easily switch according to the requirements, and resources are fully utilized.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will be made with reference to the accompanying drawings. It is obvious that the drawings in the following description are only some examples of the invention, and that for a person skilled in the art, other drawings and embodiments can be derived from them without inventive effort.
For the sake of simplicity, the drawings only schematically show the parts relevant to the present invention, and they do not represent the actual structure as a product.
As shown in fig. 1, which is a schematic diagram of an embodiment of an interface switching apparatus provided by the present invention, specifically, the interface switching apparatus 100 is connected to a general interface in a terminal device, and as can be seen from the figure, the interface switching apparatus 100 includes: a memory 110 including a plurality of partitions (e.g., a partition one, a partition two, and a partition two in the figure), each of which stores a driver of one interface type; and the processor 120 is in communication connection with the memory 110, and loads the drivers in different partitions according to the received interface type switching request to realize the switching of the general interface type.
In this embodiment, the processor 120 implements switching of the types of the common interfaces by loading drivers in different partitions of the memory 110, and implements switching of the drivers in different partitions by combining software and hardware. Before the interface switching device 100 is used for switching the interface types, the memory 110 is partitioned according to requirements, and the starting address and the ending address of each partition are recorded according to the storage capacity of each partition; thereafter, the drivers for each power class are written into each partition. In the process of switching the interface types, the starting address of the partition is changed according to the received interface type switching request to realize the switching of different partitions, then the driving programs in different partitions are loaded to realize the switching of the general interface types, and further the switching of different interface types in the same interface is realized, so that the functions of different interface types can be realized without arranging too many interfaces in the terminal equipment. The interface type switching request may be sent by a user through a configuration page, may also be sent through a device management APP (Application), and may even be sent for periodic automatic switching configured by the user, specifically, the user configures, according to an actual Application requirement, an interface type that needs to be switched in a manner of sending the interface type switching request, and after receiving the interface type switching request, the processor determines the configured interface type, and then loads a driver in a corresponding partition.
In one example, a Nand Flash nonvolatile memory is used in the interface switching apparatus 100, and before the interface type switching is performed, the interface type switching is divided into two partitions, each partition has a storage capacity of 128Mbyte, specifically, the partition one is configured as an interface type 1, the start address is 000000000000, the end address is 04000000, and a driver of the interface type 1 is written in the partition; partition two is configured as interface type 2, with start address 04000001 and end address 08000000, and has interface type 2 drivers written into it.
The Nand Flash is connected to a Central Processing Unit (CPU) through a General Purpose Input/Output (GPIO) interface, and the CPU provides a stable clock frequency through a crystal oscillator. In the working process, after the CPU interface is switched to the interface type, judging that the CPU interface needs to be switched to the interface type 2, switching the initial address of the partition to 04000001 by the CPU, loading a driving program in the partition II, and realizing the switching from the interface type 1 to the interface type 2. In other examples, the memory 110 may also employ Spi Flash and the like, which is not specifically limited herein. In addition, the interface type here is determined according to actual requirements, and may be a USB2.0 interface, a USB3.0 interface, a video interface, and the like.
As shown in fig. 2, in the present embodiment, the interface switching apparatus 100 includes a trigger button 130 connected to the processor 120 in addition to the memory 110 and the processor 120; the processor 120 switches the partition for loading the driver according to the trigger signal in the trigger button 130, so as to realize the switching of the type of the universal interface.
In this embodiment, the user sends an interrupt control signal to the processor 120 through the trigger button 130, and the processor 120 switches the interface types according to the interrupt control signal, so that the power can be switched without logging in a configuration page, which is simple and convenient.
Based on this, in one embodiment, after the processor 120 determines that the trigger signal sent by the user through the trigger button 130 is received, it further determines the partition where the driver of the interface type is located, and performs partition switching according to the partition condition of the memory 110 and the current driver loading partition, so as to implement switching of the wireless signal power level. Specifically, the switching is performed according to the sequence of the partitions, and the switching is performed each time a trigger signal sent by the trigger button 130 is received.
In one example, a Nand Flash nonvolatile memory is used in the interface switching apparatus 100, and before interface switching is performed, the Nand Flash nonvolatile memory is divided into four partitions, the storage capacity of each partition is 64Mbyte, specifically, a partition one is configured as an interface type 1, the start address is 000000000000, the end address is 02000000, and a driver of the interface type 1 is written in the partition; partition two is configured as interface type 2, the start address is 02000001, the end address is 04000000, and the driver of interface type 2 is written in the partition; partition three is configured as interface type 3, the start address is 04000001, the end address is 06000000, and the driver of interface type 3 is written in the partition; partition four is configured as interface type 4, with start address 06000001 and end address 08000000, and has interface type 4 drivers written in it. In addition, the Nand Flash is connected with the CPU through a GPIO interface, and the CPU provides stable clock frequency through a crystal oscillator.
In the working process, when the CPU receives an interrupt control signal sent by the user through the trigger button 130, it determines that the currently loaded driver in the partition two is currently loaded, so as to switch the start address to the start address of the partition three according to the sequence of the partitions, and load the driver in the partition three after the restart, and perform interface type switching. Thereafter, if the CPU receives the interrupt control signal sent by the user through the trigger button 130 again, the partition on which the driver is loaded is switched to partition four, and the switching is not performed again until the interrupt control signal is no longer received.
In another embodiment, after the processor 120 determines that the trigger signal sent by the user through the trigger key 130 is received, the current background noise intensity of the terminal device is read through the GPIO port, and the obtained intensity is compared with a preset noise intensity threshold to determine a threshold interval to which the current background noise intensity belongs; then, whether a trigger signal sent by the user through the trigger button 130 is received is judged; if so, switching to the corresponding partition according to the judged threshold interval, wherein each partition is associated with one threshold interval; finally, the interface switching apparatus 100 is restarted and the driver in the partition is loaded, so as to switch the general interface to the corresponding interface type.
In the present embodiment, before interface switching is performed using the interface switching apparatus 100, the memory 110 is partitioned as required, and a driver of a corresponding interface type is written in each partition. Then, a corresponding number of noise intensity thresholds and the correlation between the threshold intervals and the partitions are preset and stored in the processor 120. Therefore, the processor 120 receives the trigger signal of the trigger button 130, reads the current background noise intensity of the terminal device, compares the current background noise intensity with the noise intensity threshold, determines the threshold interval to which the terminal device belongs, further changes the start address into the start address of the corresponding partition according to the association relationship, and loads the driver in the corresponding partition after the device is restarted, thereby realizing the switching of the types of the universal interfaces.
In an example, the memory 110 includes a first partition and a second partition, where drivers of different interface types are stored in the two partitions, specifically, the first partition stores a driver of USB3.0/2.0/1.0, and the second partition stores a driver of USB 2.0/1.0; in addition, a noise intensity threshold is preset, and if the read current background noise intensity is smaller than the noise intensity threshold, the background noise is small at the moment, otherwise, the signal is strong. Thereafter, if it is determined that the trigger signal sent by the trigger button 130 is received and the current signal strength is smaller than the noise strength threshold, the start address is switched to the start address of the partition one, and a corresponding driver is loaded, so that the universal interface is switched to the USB 3.0. If the trigger signal sent by the trigger key 130 is judged to be received and the current signal intensity is judged to be greater than the noise intensity threshold value, the initial address is switched to the initial address of the partition two, and a corresponding driving program is loaded, so that the universal interface is switched to the USB 2.0.
In another example, the memory 110 includes a first partition and a second partition, where drivers of different interface types are stored in the two partitions, specifically, the first partition stores a driver of USB3.0/2.0/1.0, and the second partition stores a driver of USB 2.0/1.0; in addition, two noise intensity thresholds, namely a noise intensity threshold 1 and a noise intensity threshold 2, are preset, and the noise intensity threshold 1 is smaller than the noise intensity threshold 2. If the trigger signal sent by the trigger key 130 is judged to be received and the current signal intensity is judged to be smaller than the noise intensity threshold value 1, the initial address is switched to the initial address of the partition one, and a corresponding driving program is loaded, so that the universal interface is switched to the USB 3.0. If the trigger signal sent by the trigger key 130 is judged to be received and the current signal intensity is judged to be greater than the noise intensity threshold value, the initial address is switched to the initial address of the partition two, and a corresponding driving program is loaded, so that the universal interface is switched to the USB 2.0. If the trigger signal sent by the trigger key 130 is judged to be received and the current background noise intensity is judged to be between the two noise intensity thresholds, no switching is performed and the current interface type is maintained.
In another example, the memory 110 includes a partition one, a partition two, and a partition three, where drivers of different interface types are stored in the three partitions, specifically, a driver of the partition one internal storage interface 1, a driver of the partition two internal storage interface 2, and a driver of the partition three internal storage interface 3; in addition, two noise intensity thresholds, namely a noise intensity threshold 1 and a noise intensity threshold 2, are preset, and the noise intensity threshold 1 is smaller than the noise intensity threshold 2. Thereafter, if it is determined that the trigger signal sent by the trigger button 130 is received and it is determined that the current background noise intensity is smaller than the noise intensity threshold 1, the start address is switched to the start address of the partition two, a corresponding driver is loaded, and the interface is switched to the interface 2. If the trigger signal sent by the trigger key 130 is judged to be received and the current background noise intensity is judged to be greater than the noise intensity threshold 2, the initial address is switched to the initial address of the partition three, a corresponding driving program is loaded, and the interface is switched to the interface 3. If the trigger signal sent by the trigger key 130 is judged to be received and the current background noise intensity is judged to be between the two noise intensity thresholds, the initial address is switched to the initial address of the partition one, a corresponding driving program is loaded, and the interface is switched to the interface 1.
As shown in fig. 3, in the present embodiment, the interface switching apparatus 100 includes a display device 140 in addition to the memory 110, the processor 120, and the trigger button 130; the processor 120 reads the intensity of the background noise of the terminal device and displays the intensity in the display device 140. In addition, in the present embodiment, the processor 120 periodically reads the intensity of the background noise of the terminal device and displays the intensity on the display device 140, so as to provide a theoretical basis for switching power for the user. In other embodiments, the processor 120 reads the intensity of the background noise of the terminal device, compares the intensity with a preset signal intensity threshold, determines a noise level (an association relationship between a preset noise threshold interval and the noise level) to which the current background noise intensity belongs, and displays the noise level on the display device 140 for the user to view.
Based on this, in one embodiment, processor 120 periodically reads the background noise level of the terminal device and displays it on display device 140. The user checks the signal intensity displayed on the display device 140, determines that the interface switching is possible, and sends a trigger signal to the processor 120 through the trigger button 130. When the processor 120 determines that the trigger signal sent by the user through the trigger button 130 is received, it further determines the partition where the driver of the interface type is located, and performs partition switching according to the partition condition of the memory 110 and the current driver loading partition, so as to implement switching of the wireless signal power level. Specifically, the switching is performed according to the sequence of the partitions, and the switching is performed each time a trigger signal sent by the trigger button 130 is received. In one example, the memory 110 includes a partition one, a partition two, and a partition three, and the processor 120 switches the start address to the start address of the partition two according to the order of the partitions when receiving the trigger signal sent by the trigger button 130 and determining that the driver in the partition one is currently loaded, and so on. The partition order here may be set in advance by the user, and the processor 120 may circulate the process of receiving the trigger signal transmitted from the trigger button 130 and switching the partition order according to the set partition order.
In another embodiment, the processor 120 periodically reads the intensity of the background noise of the terminal device; and compares the acquired intensity with a preset noise intensity threshold, determines the threshold interval to which the intensity belongs, further obtains the noise level, and displays the noise level on the display device 140. The user checks the information displayed on the display device 140, determines whether the interface switching is possible, and if so, sends a trigger signal to the processor 120 through the trigger button 130. After judging that the trigger signal sent by the user through the trigger key 130 is received, the processor 120 switches to the corresponding partition according to the judged threshold interval, wherein each partition is associated with one threshold interval; finally, the interface switching apparatus 100 is restarted and the driving whiskers in the partition are loaded to switch the interface.
In the present embodiment, before interface switching is performed using the interface switching apparatus 100, the memory 110 is partitioned as needed, and a driver for a corresponding interface is written in each partition. Then, a corresponding number of signal strength thresholds and the association relationship between the threshold interval and the partition are preset and stored in the processor 120. Therefore, the processor 120 receives the trigger signal of the trigger button 130, reads the current background noise intensity, compares the current background noise intensity with the signal intensity threshold, determines the threshold interval to which the current background noise intensity belongs, changes the start address into the start address of the corresponding partition according to the association relationship, and loads the driver in the corresponding partition after the device is restarted, thereby realizing interface switching.
The invention also provides terminal equipment comprising the interface switching device. The terminal device may be a wireless router, a computer, or the like. In the working process, when a user needs to switch the interface, a trigger signal is sent to the processor through the trigger key. Therefore, the processor switches the interfaces according to the trigger signal, and the method is simple and convenient and fully utilizes resources.
In one example, the wireless router includes a Nand Flash nonvolatile memory (storing an image file of the wireless router), and before interface switching is performed, the wireless router is divided into two partitions, the storage capacity of each partition is 128Mbyte, specifically, a driver of USB3.0/2.0/1.0 is stored in one partition, the start address is 00000000, and the end address is 04000000; the partition two stores drivers of USB2.0/1.0, with the start address being 04000001 and the end address being 08000000. In addition, a signal intensity threshold value 1 and a signal intensity threshold value 2 are preset and are respectively-75 dBm and-65 dBm, and the wireless router also comprises a switch SW, wherein the switch SW comprises a closed state and an open state.
In the working process, the CPU reads the background noise intensity of the wireless router in real time through the internal register and displays the value in a display screen in the wireless router.
If the current background noise intensity is judged to be between-75 dBm and-65 dBm, the current background noise of the wireless router is in a controllable range, and if the current universal interface is USB3.0, the current USB3.0 has small influence on the WiFi performance of the wireless router, and the wireless router can be continuously used. Of course, the user can also switch the interface according to the own requirements, such as finding the phenomenon of video jamming and the like.
If the current background noise intensity is judged to be less than-75 dBm, the current background environment interference is very little, no influence is generated on the wireless router when the USB3.0 is used, and if the USB2.0 is used as the universal interface at the moment, the user is reminded through the display screen that the USB3.0 can be switched to, so that the data transmission efficiency is improved. And then, judging whether the switch SW is closed, if so, skipping the start address from 04000001 to 00000000 by the wireless router, starting from the first partition after restarting, starting to read a driver in the first partition after completing hardware self-checking, loading the driver of the USB3.0/2.0/1.0 by default, completing starting, ensuring that the use of the USB3.0 interface is normally used and simultaneously the use of a user on a WiFi network is not influenced.
If the current background noise intensity is judged to be larger than-65 dBm, the current background environment is seriously interfered, if a USB3.0 interface is used, the performance of the WiFi network is influenced, such as low internet speed, video blockage, even disconnection and the like, and if the USB3.0 used by the universal interface at the moment is transmitting data, a user is reminded to switch to the USB2.0 through a display screen, so that the performance of the 2.4G WiFi network is ensured. And then, judging whether the switch SW is turned on, if so, skipping the start address from 00000000 to 04000001 by the wireless router, starting from the second partition after restarting, starting to read a driver in the second partition after completing hardware self-checking, loading the driver of the USB2.0/1.0 by default, completing starting, and ensuring that the use of the USB2.0 interface by a user is not influenced while the normal use of the WiFi network is ensured.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.