WO2023082622A1 - Method for designing communication module having master and slave devices compatible, and apparatus - Google Patents

Method for designing communication module having master and slave devices compatible, and apparatus Download PDF

Info

Publication number
WO2023082622A1
WO2023082622A1 PCT/CN2022/097637 CN2022097637W WO2023082622A1 WO 2023082622 A1 WO2023082622 A1 WO 2023082622A1 CN 2022097637 W CN2022097637 W CN 2022097637W WO 2023082622 A1 WO2023082622 A1 WO 2023082622A1
Authority
WO
WIPO (PCT)
Prior art keywords
mode
value
communication module
pcie
flag bit
Prior art date
Application number
PCT/CN2022/097637
Other languages
French (fr)
Chinese (zh)
Inventor
李升根
Original Assignee
深圳市广和通无线股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市广和通无线股份有限公司 filed Critical 深圳市广和通无线股份有限公司
Publication of WO2023082622A1 publication Critical patent/WO2023082622A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B1/00Details of transmission systems, not covered by a single one of groups H04B3/00 - H04B13/00; Details of transmission systems not characterised by the medium used for transmission
    • H04B1/38Transceivers, i.e. devices in which transmitter and receiver form a structural unit and in which at least one part is used for functions of transmitting and receiving
    • H04B1/40Circuits
    • H04B1/401Circuits for selecting or indicating operating mode

Definitions

  • the embodiments of the present application relate to the technical field of communication, and in particular, to a method and device for designing a communication module compatible with master-slave devices.
  • a wireless network card is a wireless terminal device that can access the Internet through a wireless network connection under the wireless coverage of a wireless local area network. That is, electronic devices do not need to be connected to network cables to achieve Internet access.
  • Wireless network cards can be divided into external network cards and built-in network cards.
  • the built-in network card may be a wireless network card integrated in electronic devices such as notebooks, smart phones, and tablet computers.
  • External network cards can be divided into universal serial bus (USB) wireless network cards and peripheral component interconnect (PCI) wireless network cards, etc.
  • USB universal serial bus
  • PCI peripheral component interconnect
  • the external network card when an external network card provides a network, a host computer is always required, and the external network card can be used as a PCIe slave device.
  • the wireless external network card of the PCIe-M.2 keyB communication module type needs to have a built-in network card inside the tablet as the upper computer, and the external network card can only provide the network when it is connected to the built-in network card, otherwise it cannot provide network.
  • the embodiment of the present application discloses a master-slave compatible communication module design method and device, which are used to expand the application range of the communication module.
  • the first aspect discloses a communication module design method compatible with master-slave equipment, including: the method is applied to electronic equipment, the electronic equipment is provided with a communication module, and the communication module is used to provide a network for the electronic equipment, including : based on the first value of the flag bit, the operating mode of the communication module is determined as the first mode, the operating mode includes a high-speed serial computer expansion bus PCIe master mode and a PCIe slave mode, and the flag bit is the A flag bit of the memory of the communication module; when the first mode is different from the second mode, change the value of the flag bit from the first value to a second value; change the value of the flag bit based on the second value The working mode of the communication module is determined as the second mode.
  • the values of different flag bits in the electronic device definition memory represent different working modes.
  • the PCIe-M.2 keyB communication module can not only work on the PCIe slave Device mode, can also switch to PCIe master device mode. In this way, the working mode can be freely switched according to user needs, so as to expand the scope of use of the PCIe-M.2 keyB communication module and improve the flexibility of use.
  • the method further includes: receiving the second mode input by a user.
  • the electronic device can determine which mode needs to be switched from the current working mode according to the working mode input by the user, so as to improve user operability and switching flexibility.
  • the second mode is a mode stored in the electronic device.
  • the second mode may also be a working mode already stored in the electronic device.
  • the electronic device obtains the second mode, it can further determine whether the second mode is the same as the first mode, and then determine whether switching is required. Operating mode.
  • the electronic device can switch working modes more autonomously, and the operation that the user participates in is simpler, thereby improving user experience.
  • the method further includes: storing the second value; restarting the electronic device.
  • the electronic device after the electronic device changes the flag bit from the first value to the second value, the electronic device can be restarted (restart or power off and then on).
  • the value determines the mode of operation so that switching can be done. Rebooting at this point is a necessary step in the handover process so that the integrity of the method can be guaranteed.
  • changing the value of the flag bit from the first value to a second value includes: When the first mode is different from the second mode, an AT command is generated; according to the AT command, the value of the flag bit is changed from the first value to a second value.
  • changing the value of the flag bit from the first value to the second value includes: receiving user input A switching instruction, where the switching instruction is an instruction for the user to instruct to switch the current working mode when the first mode is different from the second mode; in response to the switching instruction, the value of the flag is changed from the second One value is changed to the second value.
  • the user can make a judgment on whether to switch according to the current first mode and the second mode.
  • the user determines that the current working mode needs to be switched, the user needs to input a switching command (for example, click the control to confirm switching, or enter switch command).
  • a switching command for example, click the control to confirm switching, or enter switch command.
  • the electronic device receives a switching instruction, it can perform switching in response to the instruction. In the above process, the judgment of whether to switch is in the hands of the user, which can improve user experience.
  • the first mode is the PCIe slave mode
  • the second mode is the PCIe master mode
  • the flag bit is the register value of the memory of the communication module or the custom pin voltage average value.
  • the second aspect discloses an electronic device, comprising: one or more processors and one or more memories, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, the electronic device is configured There is a communication module, the communication module is used to provide a network for the electronic device, when the one or more processors execute the computer instructions, so that the electronic device performs: based on the first value of the flag bit will
  • the operating mode of the communication module is determined as the first mode, the operating mode includes a PCIe master mode and a PCIe slave mode, and the flag bit is a flag bit of the memory of the communication module; in the first mode and If the second mode is different, changing the value of the flag bit from the first value to a second value; determining the working mode of the communication module as the second mode based on the second value.
  • the electronic device defines different values of the flags to indicate different working modes, and by changing the value of the flags to switch the working mode, the PCIe-M.2 keyB communication module can not only work in the PCIe slave mode , you can also switch to PCIe master mode. In this way, the working mode can be freely switched according to user needs, so as to expand the scope of use of the PCIe-M.2 keyB communication module and improve the flexibility of use.
  • the electronic device further executes: receiving the second mode input by a user.
  • the electronic device can determine which mode needs to be switched from the current working mode according to the working mode input by the user, so as to improve user operability and switching flexibility.
  • the second mode is a mode stored in the electronic device.
  • the second mode may also be a working mode already stored in the electronic device.
  • the electronic device obtains the second mode, it can further determine whether the second mode is the same as the first mode, and then determine whether switching is required. Operating mode.
  • the electronic device can switch working modes more autonomously, and the operation that the user participates in is simpler, thereby improving user experience.
  • the electronic device further executes: storing the second value; restarting the electronic device.
  • the electronic device after the electronic device changes the flag bit from the first value to the second value, the electronic device can be restarted (restart or power off and then on).
  • the value determines the mode of operation so that switching can be done. Rebooting at this point is a necessary step in the handover process so that the integrity of the method can be guaranteed.
  • the electronic device changes the value of the flag bit from the first value to the second value, and specifically executes:
  • an AT command is generated; according to the AT command, the value of the flag bit is changed from the first value to a second value.
  • the electronic device when the first mode is different from the second mode, changes the value of the flag bit from the first value to a second value, and specifically executes:
  • the switching instruction is an instruction for the user to switch the current working mode when the first mode is different from the second mode; in response to the switching instruction, set the value of the flag to Change from the first value to the second value.
  • the user can make a judgment on whether to switch according to the current first mode and the second mode.
  • the user determines that the current working mode needs to be switched, the user needs to input a switching command (for example, click the control to confirm switching, or enter switch command).
  • a switching command for example, click the control to confirm switching, or enter switch command.
  • the electronic device receives a switching instruction, it can perform switching in response to the instruction. In the above process, the judgment of whether to switch is in the hands of the user, which can improve user experience.
  • the first mode is the PCIe slave mode
  • the second mode is the PCIe master mode
  • the flag bit is the register value of the memory of the communication module or the custom pin voltage average value.
  • the third aspect discloses a computer-readable storage medium, where computer programs or computer instructions are stored in the computer-readable storage medium, and when the computer programs or computer instructions are executed, the above-mentioned first aspect or the first aspect is realized
  • a fourth aspect discloses a computer program product, the computer program product includes computer program code, and when the computer program code is executed, the above-mentioned method is executed.
  • Fig. 1 is a schematic structural diagram of a PCIe device disclosed in an embodiment of the present application
  • FIG. 2 is a schematic structural diagram of an electronic device and a communication module disclosed in an embodiment of the present application
  • Fig. 3 is a schematic structural diagram of another PCIe device disclosed in the embodiment of the present application.
  • Fig. 4 is a schematic flowchart of a method for designing a communication module compatible with master-slave devices disclosed in the embodiment of the present application;
  • Fig. 5 is a schematic flowchart of another master-slave device-compatible communication module design method disclosed in the embodiment of the present application.
  • FIG. 6 is a schematic structural diagram of another PCIe device disclosed in the embodiment of the present application.
  • the embodiment of the present application discloses a master-slave compatible communication module design method and device, which are used to expand the application range of the communication module. The details will be described below.
  • the PCIe-M.2 keyB communication module is a module whose interface type provides network services for PCIe-M.2 keyB users. For example, network card module, etc.
  • PCIe peripheral component interconnect express
  • M.2 is an interface/slot type, and M.2 interfaces and slots can be divided into two types: keyB (socket2) and keyM (socket3).
  • keyB can support PCI-Ex2
  • SATA interface can support PCI-Ex4
  • the speed of keyM interface is much higher than keyB.
  • PCIe master device and PCIe slave device
  • the PCIe-M.2 keyB communication module is a PCIe device, and the PCIe device can be divided into a PCIe master device and a PCIe slave device.
  • a PCIe master device is a PCIe device that provides a clock
  • a PCIe slave device is a PCIe device that receives a clock.
  • FIG. 1 is a schematic structural diagram of a PCIe device disclosed in an embodiment of the present application.
  • a PCIe master device and a PCIe slave device can be connected to each other through a PCIe interface, so as to transmit data to each other. All PCIe slave devices need to be connected to the PCIe master device, and the PCIe master device can be called the host computer of its PCIe slave device.
  • PCIe master device and the PCIe slave device can be called different modes correspondingly, the mode of the PCIe slave device (PCIe slave device mode) is called the end point (EP) mode (EP mode), and the mode of the PCIe master device (PCIe master device mode) is called root complex (root complex, RC) mode (RC mode).
  • PCIe slave device mode the mode of the PCIe slave device
  • EP mode end point
  • PCIe master device mode PCIe master device
  • root complex root complex
  • RC mode root complex
  • the PCIe-M.2 keyB communication module can be referred to as the communication module for short.
  • Fig. 2 is a schematic structural diagram of an electronic device and a communication module disclosed in an embodiment of the present application.
  • the electronic device can be connected to the communication module, for example, the communication module can be inserted into the electronic device, and the electronic device can read and write to the communication module.
  • the communication module may include a main control chip, a memory and a PCIe interface.
  • the main control chip can be coupled with the memory and the PCIe interface.
  • the electronic device can control the communication module through the main control chip.
  • FIG. 2 is a schematic structural diagram of a PCIe interface module disclosed in the embodiment of the present application.
  • the PCIe interface module may be a specific type of PCIe interface in FIG. 2 .
  • FM150-M.2-5G module One side of the M150-M.2-5G module can be a PCIe physical interface, through which another PCIe device can be connected.
  • the other side of the FM150-M.2-5G module is the interface connected to the main control chip (To CPU), which can include three PCIe control signal pins (reset PERST signal, wake-up PWAKE signal, clock request CLKREQ signal) .
  • the interface is coupled with a two-way level shift module.
  • the bidirectional level conversion module is coupled with the left PCIe physical interface through the M.2 interface.
  • the two ends of the PCIe interface module of the communication module can be respectively coupled to the main control chip of the communication module and another PCIe device (which can be a PCIe master device or a PCIe slave device).
  • FIG. 3 is a schematic structural diagram of another PCIe device disclosed in the embodiment of the present application. As shown in Figure 3, the electronic device can be used as the PCIe master device in the PCIe device, the communication module can be used as the PCIe slave device, and the electronic device and PCIe-M. 2 keyB communication modules can be connected through the PCIe interface.
  • the PCIe-M.2 keyB communication module can be used in different scenarios.
  • the PCIe-M.2 keyB communication module can be used as a network card device.
  • the PCIe-M.2 keyB communication module can be plugged into the PC, and this module can be controlled by the PC to realize the wireless Internet access of the PC.
  • the upper computer is an electronic device PC.
  • the PCIe-M.2 keyB communication module can be used in customer premise equipment (CPE), which can demodulate 4G or 5G wireless signals in the public network and become a baseband The signal is sent to the main control chip through the PCIe interface. The main control chip then sends the demodulated baseband signal to the WiFi module, thereby forming a WiFi hotspot, and then allowing the terminal device to access the Internet through WiFi.
  • CPE customer premise equipment
  • the electronic device represented by the host computer is the built-in main control chip of the CPE.
  • this communication module is used as a PCIe slave device.
  • the PCIe slave device needs a corresponding host computer.
  • the PCIe- The M.2 keyB communication module cannot be used.
  • some users need the PCIe-M.2 keyB communication module as a PCIe slave device to provide a network for electronic devices, and some users need the PCIe-M.2 keyB communication module to be mounted as a PCIe master device other slave devices. Therefore, the PCIe-M.2 keyB communication module is only used as a PCIe slave device, and the use of the PCIe-M.2 keyB communication module is relatively limited.
  • the electronic device can change the flag bit and the corresponding working mode of the PCIe-M.2 keyB communication module according to user needs. For example, when the flag bit is 0, the electronic device can determine the current EP mode (PCIe slave mode) of the PCIe-M.2 keyB communication module; when the flag bit is 1, the electronic device can determine the PCIe-M.2 keyB The communication module currently uses RC mode (PCIe master mode). In the case of needing to change the mode, the electronic device can modify the flag bit of the PCIe-M.2 keyB communication module to switch the working mode (the working mode includes EP mode (that is, PCIe slave mode), and RC mode (that is, PCIe master mode) )). In this way, the electronic device can freely switch the mode of the communication device to expand the scope of use of the PCIe-M.2 keyB communication module.
  • the working mode includes EP mode (that is, PCIe slave mode), and RC mode (that is, PCIe master mode)
  • FIG. 4 it is a schematic flowchart of a method for designing a master-slave device-compatible communication module disclosed in the embodiment of the present application. Among them, the method can be applied to electronic equipment. The electronic device is connected to the communication module, and the connection method can refer to the relevant description in FIG. 2 .
  • a method for designing a communication module compatible with master-slave devices may include the following steps:
  • the communication module determines that the working mode of the communication module is the first mode based on the value of the flag bit.
  • the working modes of the communication module may include a PCIe master mode (RC mode) and a PCIe slave mode (EP mode).
  • RC mode PCIe master mode
  • EP mode PCIe slave mode
  • the communication module is also turned on. The working mode of the communication module will be determined when the electronic device is turned on.
  • the electronic device can obtain the value of the flag bit of the working mode in the memory through the main control chip of the communication module, and at this time, the value of the flag bit obtained is the first value.
  • the electronic device can determine the working mode of the communication module based on the first value.
  • the value (first value) of the above-mentioned flag bit is used to represent the operating mode used by the communication module, and the first value can be a value indicating that the PCIe operating mode of the communication module is the PCIe master mode, or it can be a value representing the communication module
  • the PCIe working mode is the value of the PCIe slave mode, and the first value of the flag bit can only represent one of the two working modes.
  • the electronic device can determine that the current communication module working mode is PCIe slave mode, and can pass this work in one mode. For example, when the electronic device reads the first value of the flag bit of the memory through the main control chip to "0" (the value of the flag bit is "1" to indicate the PCIe master mode, and the value of the flag bit is "0" Indicates PCIe slave mode), the communication module can enter PCIe slave mode to work.
  • the electronic device can determine that the current communication module working mode is the PCIe master mode , and can work through this mode. For example, when the first value of the flag bit of the memory read by the communication module through the main control chip is "1" (the value of the flag bit is "1" indicating the PCIe master mode, and the value of the flag bit is "0" Indicates PCIe slave mode), the communication module can enter the PCIe master mode to work.
  • the flag bit can be a register value of a memory of the communication module or a level value of a user-defined pin.
  • the flag bit may be a register value of the memory of the communication module, that is, a certain bit or several bits in the memory, and different flag bit values may represent different working modes.
  • the electronic device can set a flag in the memory, "1" indicates the PCIe master mode, and "0" indicates the PCIe slave mode.
  • the flag bit may be a high or low value of a user-defined pin level of the communication module. For example, when the level is high (1), it indicates the PCIe master mode, and when the level is low (0), it indicates the PCIe slave mode.
  • the working mode of the communication module has also been determined.
  • the computer program of the working mode included in the communication module should exist in both the PCIe master mode and the PCIe slave mode (compatible with the PCIe master-slave mode). That is, the main control chip of the communication module supports both RC mode and EP mode.
  • the electronic device determines whether the first mode is the same as the second mode. If yes, end the current flow of FIG. 4; otherwise, execute step S403.
  • the second mode is a target working mode required by the communication mode, and the second mode may be a PCIe master mode or a PCIe slave mode.
  • the electronic device determines that the current working mode of the communication module is the first mode, and then can determine whether the current working mode is the second mode. In the case that the first mode is the same as the second mode, at this time, the communication module is already using the target working mode, and there is no need to switch. Therefore, the electronic device can end the current process of FIG. 4 . In the case that the first mode is different from the second mode, at this time, the working mode used by the communication module is not the target working mode, so the current working mode needs to be switched to the second mode, so S403 needs to be further executed.
  • the electronic device may determine whether the two modes are the same based on the first mode and the second mode.
  • the second mode may be fixed or variable.
  • the second mode may be a working mode stored in the electronic device, or may be a working mode determined according to user needs. For example, when the user needs to adjust the second mode, the user may input the second mode information into the electronic device, and when the electronic device receives the second mode information input by the user, the second mode may be determined.
  • the user may determine whether the first mode is the same as the second mode according to the current working mode determined by the electronic device.
  • the user may input a switching instruction.
  • the switch instruction is an instruction to switch the working mode of the current communication module.
  • the electronic device receives the switching instruction, it executes step S403 in response to the switching instruction.
  • end the current process When the same situation exists, end the current process.
  • the electronic device may determine that the first mode is different from the second mode, and step S403 is performed.
  • the electronic device may determine that the first mode is the same as the second mode, and end the current process.
  • the electronic device may determine that the first mode is different from the second mode, and step S403 needs to be performed.
  • the electronic device may determine that the first mode is the same as the second mode, and end the current process.
  • the target mode can be determined by the working mode set by the user or by the electronic device.
  • the target mode can be changed.
  • the target mode is PCIe slave mode, but the user needs to use PCIe master mode, and the target mode can be set as PCIe master mode.
  • the electronic device changes the value of the flag bit from the first value to a second value, and determines the working mode of the communication module as the second mode based on the second value.
  • the electronic device can change the value of the flag bit of the memory in the current communication module from the first value to the second value, and the second value is the value of the flag bit indicating that the working mode is the second mode. For example, when the first value of the flag bit is 0, the electronic device can change the first value to the second value 1 ("1" means PCIe master mode, and "0" means PCIe slave mode); In case the first value of the bit is 1, the electronic device may change the first value to a second value of 0.
  • the electronic device can generate an attention AT (Attention) command, and the AT command at this time is used to change the value of the flag bit of the communication module. Afterwards, the electronic device can send an AT command to the communication module. After the communication module receives the AT command, it can further execute the AT command through the main control chip, that is, the main control chip changes the flag bit of the current memory based on the AT command. Wherein, the first value is different from the second value.
  • the electronic device can be restarted (for example, shut down first and then restart or directly restart), and the communication module will re-read the memory in the process of restarting the electronic device.
  • the flag bit is the second value, so as to determine its own working mode as the second mode.
  • the first value indicates that the working mode is the first mode
  • the second value indicates that the working mode is the second mode. Therefore, in the process of determining its working mode, the communication module can complete the switching of the working mode.
  • the communication module can switch the working mode, that is, the PCIe slave mode and the PCIe master mode can be switched.
  • the communication module can be mounted on other PCIe master devices as a PCIe slave device; it can also be used as a PCIe
  • the master device is used to connect to other PCIe slave devices.
  • the working mode of the communication module can better adapt to the needs of users to provide network services. so.
  • the scope of use of the communication module can be expanded.
  • PCIe when the communication module cannot be used as a PCIe master device, PCIe must have a host computer and be connected to it. At this time, the system is more complicated and the cost is higher. It is the upper computer itself, which can simplify the system and reduce the cost.
  • an electronic device may be any terminal device having communication capabilities, processing functions, and storage capabilities, such as a computer, a CPE, and the like. That is, the electronic device may be all possible devices that provide a network through the communication module, which is not limited here.
  • FIG. 5 is a schematic flowchart of another method for designing a communication module compatible with master-slave devices disclosed in the embodiment of the present application.
  • the design method of the communication module compatible with the master-slave device is as follows:
  • the memory and the main control chip in the communication module can be preset in advance.
  • the pre-set master chip is compatible with PCIe master mode and PCIe slave mode.
  • a flag bit is preset in the memory of the communication module, and the two numbers of the flag bit can correspond to the PCIe master mode and the PCIe slave mode respectively.
  • the default flag bit in the communication module is "0", which means the PCIe slave mode; and the flag bit is "1", which means the PCIe master mode.
  • the following describes the specific process of switching the working mode of the communication module of the electronic device.
  • the electronic device determines a flag bit, and if the flag bit is "0", determines that the working mode is a PCIe slave mode.
  • the communication module When the electronic equipment is turned on, the communication module will also be turned on. During the above-mentioned startup process, the communication module reads that the default flag bit is (first value) "0", and the current working mode of the communication module according to the flag bit "0" is PCIe slave mode, that is, the PCIe in the main control chip of the communication module is set to slave mode.
  • the electronic device changes the flag bit of the communication module, and changes the flag bit to the flag bit (second value) "1" of the PCIe master device mode.
  • the electronic device can change the flag bit of the communication module to "1", that is, modify it to the flag bit corresponding to the PCIe master mode.
  • the communication module re-reads the flag bit, and if the flag bit is "1", determines that the working mode is the PCIe master mode.
  • step S502 the electronic device can be restarted or restarted after shutdown.
  • the communication module re-reads the flag as "1" and sets the working mode as PCIe master mode.
  • FIG. 6 is a schematic structural diagram of another PCIe device disclosed in the embodiment of the present application.
  • the FM150-M.2-5G communication module can be used as a PCIe master device and directly mounted externally through the PCIe interface PCIe slave device (RTL8111H).
  • the FM150-M.2-5G communication module does not need a host computer, and can directly demodulate 4G and 5G signals into baseband signals, and send baseband signals to RTL8111H (PCIe slave device) through the PCIe interface.
  • RTL8111H receives the baseband signal, it converts the baseband signal into a wired network card signal, and then can provide a network source for a PC or a WiFi router.
  • all or part of them may be implemented by software, hardware, firmware or any combination thereof.
  • software When implemented using software, it may 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 the computer, the processes or functions according to the embodiments of the present application will be generated in whole or in part.
  • the computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server or data center Transmission to another website site, computer, server, or data center by wired (eg, coaxial cable, optical fiber, DSL) or wireless (eg, infrared, wireless, microwave, etc.) means.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media.
  • the available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, solid state hard disk), etc.
  • the processes can be completed by computer programs to instruct related hardware.
  • the programs can be stored in computer-readable storage media.
  • When the programs are executed may include the processes of the foregoing method embodiments.
  • the aforementioned storage medium includes: ROM or random access memory RAM, magnetic disk or optical disk, and other various media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computer Hardware Design (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Transfer Systems (AREA)

Abstract

A method for designing a communication module having master and slave devices compatible. The method is applied to an electronic device, wherein the electronic device is provided with a communication module, and the communication module is used for providing a network for the electronic device. The method comprises: on the basis of a first value of a flag bit, determining the working mode of a communication mode to be a first mode, wherein the working mode comprises a peripheral component interconnect express (PCIe) master device mode and a PCIe slave device mode, and the flag bit is a flag bit of a memory of the communication module; when the first mode is different from a second mode, changing the value of the flag bit from the first value to a second value; and on the basis of the second value, determining the working mode of the communication module to be the second mode.

Description

一种主从设备兼容的通信模块设计方法及装置A communication module design method and device compatible with master-slave devices
本申请要求于2021年11月09日提交中国专利局、申请号为2021113218669、发明名称为“一种主从设备兼容的通信模块设计方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 2021113218669 and the title of the invention "a communication module design method and device compatible with master-slave equipment" submitted to the China Patent Office on November 09, 2021, the entire content of which is passed References are incorporated in this application.
技术领域technical field
本申请实施例涉及通信技术领域,尤其涉及一种主从设备兼容的通信模块设计方法及装置。The embodiments of the present application relate to the technical field of communication, and in particular, to a method and device for designing a communication module compatible with master-slave devices.
背景技术Background technique
无线网卡是一种无线终端设备,是无线局域网的无线覆盖下能够通过无线网络连接进行上网的无线终端设备。即电子设备不需要连接网线就够实现上网的设备。无线网卡可以分为外置网卡和内置网卡。内置网卡可以是笔记本、智能手机、平板电脑等电子设备内部集成有的无线网卡。外置网卡可以分为通用串行总线(universal serial bus,USB)无线网卡和外设部件互连标准(peripheral component interconnect,PCI)无线网卡等,外置网卡可以插入笔记本等电子设备提供网络服务。A wireless network card is a wireless terminal device that can access the Internet through a wireless network connection under the wireless coverage of a wireless local area network. That is, electronic devices do not need to be connected to network cables to achieve Internet access. Wireless network cards can be divided into external network cards and built-in network cards. The built-in network card may be a wireless network card integrated in electronic devices such as notebooks, smart phones, and tablet computers. External network cards can be divided into universal serial bus (USB) wireless network cards and peripheral component interconnect (PCI) wireless network cards, etc. External network cards can be inserted into notebooks and other electronic devices to provide network services.
然而,外置网卡在提供网络时,总需要有上位机,外置网卡可以作为PCIe从设备。例如,PCIe-M.2 keyB通信模块类型的无线外置网卡,需要在平板电脑内部设有内置网卡作为上位机,且外置网卡与内置网卡连接的情况下,才能提供网络,否则不能够提供网络。However, when an external network card provides a network, a host computer is always required, and the external network card can be used as a PCIe slave device. For example, the wireless external network card of the PCIe-M.2 keyB communication module type needs to have a built-in network card inside the tablet as the upper computer, and the external network card can only provide the network when it is connected to the built-in network card, otherwise it cannot provide network.
发明内容Contents of the invention
本申请实施例公开了一种主从设备兼容的通信模块设计方法及装置,用于扩大通信模块的使用范围。The embodiment of the present application discloses a master-slave compatible communication module design method and device, which are used to expand the application range of the communication module.
第一方面公开一种主从设备兼容的通信模块设计方法,包括:所述方法应用于电子设备,所述电子设备设置有通信模块,所述通信模块用于为所述电子设备提供网络,包括:基于标志位的第一值将所述通信模块的工作模式确定为第一模式,所述工作模式包括高速串行计算机扩展总线PCIe主设备模式和PCIe从设备模式,所述标志位为所述通信模块的存储器的标志位;在所述第一模式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值;基于所述第二值将所述通信模块的工作模式确定为所述第二模式。The first aspect discloses a communication module design method compatible with master-slave equipment, including: the method is applied to electronic equipment, the electronic equipment is provided with a communication module, and the communication module is used to provide a network for the electronic equipment, including : based on the first value of the flag bit, the operating mode of the communication module is determined as the first mode, the operating mode includes a high-speed serial computer expansion bus PCIe master mode and a PCIe slave mode, and the flag bit is the A flag bit of the memory of the communication module; when the first mode is different from the second mode, change the value of the flag bit from the first value to a second value; change the value of the flag bit based on the second value The working mode of the communication module is determined as the second mode.
本申请实施例中,电子设备定义存储器中不同的标志位的值表示不同的工作模式,通过更改标志位的值切换工作模式,从而可以让PCIe-M.2 keyB通信模块不仅仅工作在PCIe从设备模式,还可以切换为PCIe主设备模式。从而可以根据用户需要实现工作模式的自由切换,以便能够扩大PCIe-M.2 keyB通信模块的使用范围,以及提高使用的灵活性。In the embodiment of the present application, the values of different flag bits in the electronic device definition memory represent different working modes. By changing the value of the flag bit to switch the working mode, the PCIe-M.2 keyB communication module can not only work on the PCIe slave Device mode, can also switch to PCIe master device mode. In this way, the working mode can be freely switched according to user needs, so as to expand the scope of use of the PCIe-M.2 keyB communication module and improve the flexibility of use.
作为一种可能的实施方式,所述方法还包括:接收用户输入的所述第二模式。As a possible implementation manner, the method further includes: receiving the second mode input by a user.
本申请实施例中,电子设备可以根据用户输入的工作模式确定需要将当前的工作模式切换为哪一模式,提高用户的可操作性,以及提高切换的灵活性。In the embodiment of the present application, the electronic device can determine which mode needs to be switched from the current working mode according to the working mode input by the user, so as to improve user operability and switching flexibility.
作为一种可能的实施方式,所述第二模式为所述电子设备存储的模式。As a possible implementation manner, the second mode is a mode stored in the electronic device.
本申请实施例中,第二模式也可以是电子设备已经存储有的工作模式,当电子设备获取到第二模式时,可以进一步判断第二模式与第一模式是否相同,进而可以确定是否需要切换工作模式。由此,电子设备能够切换工作模式的自主性更高,用户参与的操作的更加简单,从而可以提高用户体验。In the embodiment of the present application, the second mode may also be a working mode already stored in the electronic device. When the electronic device obtains the second mode, it can further determine whether the second mode is the same as the first mode, and then determine whether switching is required. Operating mode. As a result, the electronic device can switch working modes more autonomously, and the operation that the user participates in is simpler, thereby improving user experience.
作为一种可能的实施方式,所述将所述标志位的值由所述第一值更改为第二值之后,所述方法还包括:存储所述第二值;重启所述电子设备。As a possible implementation manner, after changing the value of the flag bit from the first value to a second value, the method further includes: storing the second value; restarting the electronic device.
本申请实施例中,在电子设备将标志位从第一值更改为第二值之后,可以重启电子设备(重启或者关机后再开机),电子设备在开机的过程中,可以重启根据标志位的值确定工作模式,从而可以完成切换。此时重启是切换过程中的必要步骤,从而可以保证方法的完整性。In the embodiment of the present application, after the electronic device changes the flag bit from the first value to the second value, the electronic device can be restarted (restart or power off and then on). The value determines the mode of operation so that switching can be done. Rebooting at this point is a necessary step in the handover process so that the integrity of the method can be guaranteed.
作为一种可能的实施方式,所述在所述第一模式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值,包括:在所述第一模式与第二模式不同的情况下,生成AT指令;根据所述AT指令,将所述标志位的值由所述第一值更改为第二值。As a possible implementation manner, in the case that the first mode is different from the second mode, changing the value of the flag bit from the first value to a second value includes: When the first mode is different from the second mode, an AT command is generated; according to the AT command, the value of the flag bit is changed from the first value to a second value.
作为一种可能的实施方式,所述在所述第一模式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值,包括:接收用户输入的切换指令,所述切换指令是在所述第一模式与第二模式不同的情况下,用户指示切换当前工作模式的指令;响应于所述切换指令,将所述标志位的值由所述第一值更改为第二值。As a possible implementation manner, in the case that the first mode is different from the second mode, changing the value of the flag bit from the first value to the second value includes: receiving user input A switching instruction, where the switching instruction is an instruction for the user to instruct to switch the current working mode when the first mode is different from the second mode; in response to the switching instruction, the value of the flag is changed from the second One value is changed to the second value.
本申请实施例中,用户可以根据当前的第一模式和第二模式作出是否切换的判断,当用户确定需要切换当前的工作模式时,需要输入切换指令(例如,点击确定切换的控件,或者输入切换的命令)。当电子设备接收到切换指令的情况下,可以响应于这一指令,进行切换。在上述过程中,切换与否的判断掌握在用户的手中,能够提高用户体验。In this embodiment of the application, the user can make a judgment on whether to switch according to the current first mode and the second mode. When the user determines that the current working mode needs to be switched, the user needs to input a switching command (for example, click the control to confirm switching, or enter switch command). When the electronic device receives a switching instruction, it can perform switching in response to the instruction. In the above process, the judgment of whether to switch is in the hands of the user, which can improve user experience.
作为一种可能的实施方式,所述第一模式为PCIe从设备模式,所述第二模式为PCIe主设备模式,所述标志位为所述通信模块的存储器的寄存器值或者自定义管脚电平值。As a possible implementation manner, the first mode is the PCIe slave mode, the second mode is the PCIe master mode, and the flag bit is the register value of the memory of the communication module or the custom pin voltage average value.
第二方面公开一种电子设备,包括:一个或多个处理器和一个或多个存储器,所述一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,所述电子设备设置有通信模块,所述通信模块用于为所述电子设备提供网络,当所述一个或多个处理器执行所述计算机指令时,以使得所述电子设备执行:基于标志位的第一值将所述通信模块的工作模式确定为第一模式,所述工作模式包括PCIe主设备模式和PCIe从设备模式,所述标志位为所述通信模块的存储器的标志位;在所述第一模式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值;基于所述第二值将所述通信模块的工作模式确定为所述第二模式。The second aspect discloses an electronic device, comprising: one or more processors and one or more memories, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, the electronic device is configured There is a communication module, the communication module is used to provide a network for the electronic device, when the one or more processors execute the computer instructions, so that the electronic device performs: based on the first value of the flag bit will The operating mode of the communication module is determined as the first mode, the operating mode includes a PCIe master mode and a PCIe slave mode, and the flag bit is a flag bit of the memory of the communication module; in the first mode and If the second mode is different, changing the value of the flag bit from the first value to a second value; determining the working mode of the communication module as the second mode based on the second value.
本申请实施例中,电子设备定义不同的标志位的值表示不同的工作模式,通过更改标志位的值切换工作模式,从而可以让PCIe-M.2 keyB通信模块不仅仅工作在PCIe从设备模式,还可以切换为PCIe主设备模式。从而可以根据用户需要实现工作模式的自由切换,以便能够扩大PCIe-M.2 keyB通信模块的使用范围,以及提高使用的灵活性。In the embodiment of the present application, the electronic device defines different values of the flags to indicate different working modes, and by changing the value of the flags to switch the working mode, the PCIe-M.2 keyB communication module can not only work in the PCIe slave mode , you can also switch to PCIe master mode. In this way, the working mode can be freely switched according to user needs, so as to expand the scope of use of the PCIe-M.2 keyB communication module and improve the flexibility of use.
作为一种可能的实施方式,所述电子设备还执行:接收用户输入的所述第二模式。As a possible implementation manner, the electronic device further executes: receiving the second mode input by a user.
本申请实施例中,电子设备可以根据用户输入的工作模式确定需要将当前的工作模式切换为哪一模式,提高用户的可操作性,以及提高切换的灵活性。In the embodiment of the present application, the electronic device can determine which mode needs to be switched from the current working mode according to the working mode input by the user, so as to improve user operability and switching flexibility.
作为一种可能的实施方式,所述第二模式为所述电子设备存储的模式。As a possible implementation manner, the second mode is a mode stored in the electronic device.
本申请实施例中,第二模式也可以是电子设备已经存储有的工作模式,当电子设备获取到第二模式时,可以进一步判断第二模式与第一模式是否相同,进而可以确定是否需要切换工作模式。由此,电子设备能够切换工作模式的自主性更高,用户参与的操作的更加简单,从而可以提高用户体验。In the embodiment of the present application, the second mode may also be a working mode already stored in the electronic device. When the electronic device obtains the second mode, it can further determine whether the second mode is the same as the first mode, and then determine whether switching is required. Operating mode. As a result, the electronic device can switch working modes more autonomously, and the operation that the user participates in is simpler, thereby improving user experience.
作为一种可能的实施方式,所述将所述标志位的值由所述第一值更改为第 二值之后,所述电子设备还执行:存储所述第二值;重启所述电子设备。As a possible implementation manner, after the value of the flag bit is changed from the first value to a second value, the electronic device further executes: storing the second value; restarting the electronic device.
本申请实施例中,在电子设备将标志位从第一值更改为第二值之后,可以重启电子设备(重启或者关机后再开机),电子设备在开机的过程中,可以重启根据标志位的值确定工作模式,从而可以完成切换。此时重启是切换过程中的必要步骤,从而可以保证方法的完整性。In the embodiment of the present application, after the electronic device changes the flag bit from the first value to the second value, the electronic device can be restarted (restart or power off and then on). The value determines the mode of operation so that switching can be done. Rebooting at this point is a necessary step in the handover process so that the integrity of the method can be guaranteed.
作为一种可能的实施方式,所述电子设备在所述第一模式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值,具体执行:在所述第一模式与第二模式不同的情况下,生成AT指令;根据所述AT指令,将所述标志位的值由所述第一值更改为第二值。As a possible implementation manner, when the first mode is different from the second mode, the electronic device changes the value of the flag bit from the first value to the second value, and specifically executes: When the first mode is different from the second mode, an AT command is generated; according to the AT command, the value of the flag bit is changed from the first value to a second value.
作为一种可能的实施方式,所述电子设备在所述第一模式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值,具体执行:As a possible implementation manner, when the first mode is different from the second mode, the electronic device changes the value of the flag bit from the first value to a second value, and specifically executes:
接收用户输入的切换指令,所述切换指令是在所述第一模式与第二模式不同的情况下,用户指示切换当前工作模式的指令;响应于所述切换指令,将所述标志位的值由所述第一值更改为第二值。receiving a switching instruction input by the user, the switching instruction is an instruction for the user to switch the current working mode when the first mode is different from the second mode; in response to the switching instruction, set the value of the flag to Change from the first value to the second value.
本申请实施例中,用户可以根据当前的第一模式和第二模式作出是否切换的判断,当用户确定需要切换当前的工作模式时,需要输入切换指令(例如,点击确定切换的控件,或者输入切换的命令)。当电子设备接收到切换指令的情况下,可以响应于这一指令,进行切换。在上述过程中,切换与否的判断掌握在用户的手中,能够提高用户体验。In this embodiment of the application, the user can make a judgment on whether to switch according to the current first mode and the second mode. When the user determines that the current working mode needs to be switched, the user needs to input a switching command (for example, click the control to confirm switching, or enter switch command). When the electronic device receives a switching instruction, it can perform switching in response to the instruction. In the above process, the judgment of whether to switch is in the hands of the user, which can improve user experience.
作为一种可能的实施方式,所述第一模式为PCIe从设备模式,所述第二模式为PCIe主设备模式,所述标志位为所述通信模块的存储器的寄存器值或者自定义管脚电平值。As a possible implementation manner, the first mode is the PCIe slave mode, the second mode is the PCIe master mode, and the flag bit is the register value of the memory of the communication module or the custom pin voltage average value.
第三方面公开一种计算机可读存储介质,所述计算机可读存储介质中存储 有计算机程序或计算机指令,当所述计算机程序或计算机指令被运行时,实现如上述第一方面或第一方面的任一实施方式公开的主从设备兼容的通信模块设计方法。The third aspect discloses a computer-readable storage medium, where computer programs or computer instructions are stored in the computer-readable storage medium, and when the computer programs or computer instructions are executed, the above-mentioned first aspect or the first aspect is realized The method for designing a communication module compatible with master-slave devices disclosed in any of the implementation modes.
第四方面公开一种计算机程序产品,该计算机程序产品包括计算机程序代码,当该计算机程序代码被运行时,使得上述的方法被执行。A fourth aspect discloses a computer program product, the computer program product includes computer program code, and when the computer program code is executed, the above-mentioned method is executed.
附图说明Description of drawings
图1是本申请实施例公开的一种PCIe设备的结构示意图;Fig. 1 is a schematic structural diagram of a PCIe device disclosed in an embodiment of the present application;
图2是本申请实施例公开的一种电子设备与通信模块的结构示意图;FIG. 2 is a schematic structural diagram of an electronic device and a communication module disclosed in an embodiment of the present application;
图3是本申请实施例公开的另一种PCIe设备的结构示意图;Fig. 3 is a schematic structural diagram of another PCIe device disclosed in the embodiment of the present application;
图4是本申请实施例公开的一种主从设备兼容的通信模块设计的方法流程示意图;Fig. 4 is a schematic flowchart of a method for designing a communication module compatible with master-slave devices disclosed in the embodiment of the present application;
图5是本申请实施例公开的另一种主从设备兼容的通信模块设计的方法流程示意图;Fig. 5 is a schematic flowchart of another master-slave device-compatible communication module design method disclosed in the embodiment of the present application;
图6是本申请实施例公开的又一种PCIe设备的结构示意图。FIG. 6 is a schematic structural diagram of another PCIe device disclosed in the embodiment of the present application.
具体实施方式Detailed ways
本申请实施例公开了一种主从设备兼容的通信模块设计方法及装置,用于扩大通信模块的使用范围。以下进行详细说明。The embodiment of the present application discloses a master-slave compatible communication module design method and device, which are used to expand the application range of the communication module. The details will be described below.
为了便于理解本申请实施例公开的一种主从设备兼容的通信模块设计方法及装置,下面先对本申请实施例涉及的相关技术进行介绍:In order to facilitate the understanding of a master-slave device-compatible communication module design method and device disclosed in the embodiments of the present application, the related technologies involved in the embodiments of the present application are firstly introduced below:
1.PCIe-M.2 keyB通信模块1. PCIe-M.2 keyB communication module
PCIe-M.2 keyB通信模块是接口类型为PCIe-M.2 keyB用户提供网络服务的模块。例如,网卡模块等。The PCIe-M.2 keyB communication module is a module whose interface type provides network services for PCIe-M.2 keyB users. For example, network card module, etc.
高速串行计算机扩展总线标准(peripheral component interconnect express,PCIe)是一种端对端的互连协议,PCIe总线的两端可以连接两个设备(例如,连接设备A和设备B),这两个设备可以通过PCIe总线进行数据传输。The high-speed serial computer expansion bus standard (peripheral component interconnect express, PCIe) is an end-to-end interconnection protocol. Two ends of the PCIe bus can be connected to two devices (for example, connecting device A and device B). Data transmission can be performed via the PCIe bus.
M.2是一种接口/插槽类型,M.2接口和插槽又可以分为keyB(socket2)keyM(socket3)两种类型。其中,keyB可以支持PCI-Ex2、SATA接口,keyM可以支持PCI-Ex4,keyM接口的速度远高于keyB。M.2 is an interface/slot type, and M.2 interfaces and slots can be divided into two types: keyB (socket2) and keyM (socket3). Among them, keyB can support PCI-Ex2, SATA interface, keyM can support PCI-Ex4, and the speed of keyM interface is much higher than keyB.
2.PCIe主设备和PCIe从设备2. PCIe master device and PCIe slave device
PCIe-M.2 keyB通信模块是一种PCIe设备,PCIe设备可以分为PCIe主设备和PCIe从设备。PCIe主设备是提供时钟的PCIe设备,对应地,PCIe从设备是接收时钟的PCIe设备。The PCIe-M.2 keyB communication module is a PCIe device, and the PCIe device can be divided into a PCIe master device and a PCIe slave device. A PCIe master device is a PCIe device that provides a clock, and correspondingly, a PCIe slave device is a PCIe device that receives a clock.
图1是本申请实施例公开的一种PCIe设备的结构示意图。如图1所示,PCIe主设备与PCIe从设备可以通过PCIe接口相互连接,从而可以相互传输数据。PCIe从设备均需要连接到PCIe主设备,PCIe主设备可以称为其PCIe从设备的上位机。FIG. 1 is a schematic structural diagram of a PCIe device disclosed in an embodiment of the present application. As shown in FIG. 1 , a PCIe master device and a PCIe slave device can be connected to each other through a PCIe interface, so as to transmit data to each other. All PCIe slave devices need to be connected to the PCIe master device, and the PCIe master device can be called the host computer of its PCIe slave device.
PCIe主设备和PCIe从设备可以对应称为不同模式,PCIe从设备的模式(PCIe从设备模式)称为终点(end point,EP)模式(EP模式),而PCIe主设备的模式(PCIe主设备模式)称为根复合体(root complex,RC)模式(RC模式)。The PCIe master device and the PCIe slave device can be called different modes correspondingly, the mode of the PCIe slave device (PCIe slave device mode) is called the end point (EP) mode (EP mode), and the mode of the PCIe master device (PCIe master device mode) is called root complex (root complex, RC) mode (RC mode).
以下说明本申请实施例所涉及的一种PCIe设备的结构。The structure of a PCIe device involved in the embodiment of the present application is described below.
为了方便表述,PCIe-M.2 keyB通信模块可以简称为通信模块。For the convenience of expression, the PCIe-M.2 keyB communication module can be referred to as the communication module for short.
图2是本申请实施例公开的一种电子设备与通信模块的结构示意图。如图2所示,电子设备可以与通信模块相连接,例如,通信模块可以插入电子设备,电子设备可以对通信模块进行读写。通信模块可以包括主控芯片、存储器和 PCIe接口。主控芯片可以与存储器以及PCIe接口相耦合。当通信模块的主控芯片可以读取存储器中的计算机程序,并根据读取到的程序执行相关命令。电子设备可以通过主控芯片控制通信模块。Fig. 2 is a schematic structural diagram of an electronic device and a communication module disclosed in an embodiment of the present application. As shown in FIG. 2 , the electronic device can be connected to the communication module, for example, the communication module can be inserted into the electronic device, and the electronic device can read and write to the communication module. The communication module may include a main control chip, a memory and a PCIe interface. The main control chip can be coupled with the memory and the PCIe interface. When the main control chip of the communication module can read the computer program in the memory, and execute related commands according to the read program. The electronic device can control the communication module through the main control chip.
示例性地,图2是本申请实施例公开的一种PCIe接口模块的结构示意图。PCIe接口模块可以为图2中的PCIe接口一种具体类型。例如,FM150-M.2-5G模块。M150-M.2-5G模块的一边可以是PCIe物理接口,通过这一物理接口可以与另一个PCIe设备相连接。FM150-M.2-5G模块的另一边是与主控芯片(To CPU)相连接的接口,该接口可以包括PCIe三根控制信号的引脚(复位PERST信号、唤醒PWAKE信号、时钟请求CLKREQ信号)。该接口与双向电平转换(two-way level shift)模块相耦合。双向电平转换模块与左边PCIe物理接口通过M.2接口相耦合。由此,通信模块的PCIe接口模块的两端可以分别耦合通信模块的主控芯片和另一个PCIe设备(可以是PCIe主设备,也可以是PCIe从设备)。Exemplarily, FIG. 2 is a schematic structural diagram of a PCIe interface module disclosed in the embodiment of the present application. The PCIe interface module may be a specific type of PCIe interface in FIG. 2 . For example, FM150-M.2-5G module. One side of the M150-M.2-5G module can be a PCIe physical interface, through which another PCIe device can be connected. The other side of the FM150-M.2-5G module is the interface connected to the main control chip (To CPU), which can include three PCIe control signal pins (reset PERST signal, wake-up PWAKE signal, clock request CLKREQ signal) . The interface is coupled with a two-way level shift module. The bidirectional level conversion module is coupled with the left PCIe physical interface through the M.2 interface. Thus, the two ends of the PCIe interface module of the communication module can be respectively coupled to the main control chip of the communication module and another PCIe device (which can be a PCIe master device or a PCIe slave device).
当通信模块接入电子设备在使用的过程中,通信模块通常会作为PCIe从设备(EP模式)。图3是本申请实施例公开的另一种PCIe设备的结构示意图,如图3所示,电子设备可以作为PCIe设备中的PCIe主设备,通信模块作为PCIe从设备,电子设备与PCIe-M.2 keyB通信模块之间可以通过PCIe接口进行连接。When the communication module is connected to the electronic device and is in use, the communication module usually acts as a PCIe slave device (EP mode). Figure 3 is a schematic structural diagram of another PCIe device disclosed in the embodiment of the present application. As shown in Figure 3, the electronic device can be used as the PCIe master device in the PCIe device, the communication module can be used as the PCIe slave device, and the electronic device and PCIe-M. 2 keyB communication modules can be connected through the PCIe interface.
PCIe-M.2 keyB通信模块的可以使用在不同的场景。The PCIe-M.2 keyB communication module can be used in different scenarios.
在一种可能的场景中,在个人计算机(personal computer,PC)中,PCIe-M.2 keyB通信模块可以作为网卡设备。PCIe-M.2 keyB通信模块可以插在PC上,这一模块可以受到PC的控制,用于实现PC的无线上网。此时,上位机为电子设备PC。In a possible scenario, in a personal computer (personal computer, PC), the PCIe-M.2 keyB communication module can be used as a network card device. The PCIe-M.2 keyB communication module can be plugged into the PC, and this module can be controlled by the PC to realize the wireless Internet access of the PC. At this time, the upper computer is an electronic device PC.
在另一种可能的场景中,PCIe-M.2 keyB通信模块可以用于客户前置设备(customer premise equipment,CPE)中,它可以将公网中4G或5G无线信号进行解调,成为基带信号,通过PCIe接口,发送给主控芯片。主控芯片再将解调的基带信号发送到WiFi模块,从而可以形成WiFi热点,进而可以供终端设备通过WiFi上网。此时,上位机为的电子设备为CPE内置的主控芯片。In another possible scenario, the PCIe-M.2 keyB communication module can be used in customer premise equipment (CPE), which can demodulate 4G or 5G wireless signals in the public network and become a baseband The signal is sent to the main control chip through the PCIe interface. The main control chip then sends the demodulated baseband signal to the WiFi module, thereby forming a WiFi hotspot, and then allowing the terminal device to access the Internet through WiFi. At this time, the electronic device represented by the host computer is the built-in main control chip of the CPE.
在上述的PCIe-M.2 keyB通信模块的使用过程中,这一通信模块均作为PCIe从设备,然而PCIe从设备需要对应的上位机,在不存在上位机的情况下,电子设备的PCIe-M.2 keyB通信模块无法使用。此外,由于用户的需求各不相同,即有些用户需要PCIe-M.2 keyB通信模块作为PCIe从设备为电子设备提供网络,另有些用户需要PCIe-M.2 keyB通信模块作为PCIe主设备挂载其他从设备。因此,单一地将PCIe-M.2 keyB通信模块作为PCIe从设备,PCIe-M.2 keyB通信模块的使用时局限定较大。During the use of the above-mentioned PCIe-M.2 keyB communication module, this communication module is used as a PCIe slave device. However, the PCIe slave device needs a corresponding host computer. In the absence of a host computer, the PCIe- The M.2 keyB communication module cannot be used. In addition, due to the different needs of users, that is, some users need the PCIe-M.2 keyB communication module as a PCIe slave device to provide a network for electronic devices, and some users need the PCIe-M.2 keyB communication module to be mounted as a PCIe master device other slave devices. Therefore, the PCIe-M.2 keyB communication module is only used as a PCIe slave device, and the use of the PCIe-M.2 keyB communication module is relatively limited.
针对上述问题,在本申请实施例中,电子设备可以根据用户需求更改PCIe-M.2 keyB通信模块的标志位及对应的工作模式。例如,当标志位为0时,电子设备可以确定PCIe-M.2 keyB通信模块当前的使用EP模式(PCIe从设备模式);当标志位为1时,电子设备可以确定PCIe-M.2 keyB通信模块当前的使用RC模式(PCIe主设备模式)。在需要更换模式的情况下,电子设备可以修改PCIe-M.2 keyB通信模块的标志位来切换工作模式(工作模式包括EP模式(即PCIe从设备模式),和RC模式(即PCIe主设备模式))。这样,电子设备可以自由切换通信设备的模式,以扩大PCIe-M.2 keyB通信模块使用的范围。In view of the above problems, in the embodiment of this application, the electronic device can change the flag bit and the corresponding working mode of the PCIe-M.2 keyB communication module according to user needs. For example, when the flag bit is 0, the electronic device can determine the current EP mode (PCIe slave mode) of the PCIe-M.2 keyB communication module; when the flag bit is 1, the electronic device can determine the PCIe-M.2 keyB The communication module currently uses RC mode (PCIe master mode). In the case of needing to change the mode, the electronic device can modify the flag bit of the PCIe-M.2 keyB communication module to switch the working mode (the working mode includes EP mode (that is, PCIe slave mode), and RC mode (that is, PCIe master mode) )). In this way, the electronic device can freely switch the mode of the communication device to expand the scope of use of the PCIe-M.2 keyB communication module.
请参阅图4,如图4所示是本申请实施例公开的一种主从设备兼容的通信模块设计的方法流程示意图。其中,该方法可以应用于电子设备。电子设备与 通信模块相连接,连接方式可以参考图2的相关描述。一种主从设备兼容的通信模块设计的方法可以包括以下步骤:Please refer to FIG. 4 . As shown in FIG. 4 , it is a schematic flowchart of a method for designing a master-slave device-compatible communication module disclosed in the embodiment of the present application. Among them, the method can be applied to electronic equipment. The electronic device is connected to the communication module, and the connection method can refer to the relevant description in FIG. 2 . A method for designing a communication module compatible with master-slave devices may include the following steps:
S401、通信模块基于标志位的值确定通信模块的工作模式为第一模式。S401. The communication module determines that the working mode of the communication module is the first mode based on the value of the flag bit.
通信模块的工作模式可以包括PCIe主设备模式(RC模式)和PCIe从设备模式(EP模式)。在电子设备开机的情况下,通信模块也会开启。电子设备开启的过程中会确定通信模块的工作模式。The working modes of the communication module may include a PCIe master mode (RC mode) and a PCIe slave mode (EP mode). When the electronic device is turned on, the communication module is also turned on. The working mode of the communication module will be determined when the electronic device is turned on.
电子设备可以通过通信模块的主控芯片获取存储器中工作模式的标志位的值,此时,获取的标志位的值为第一值。在电子设备获取标志位的第一值的情况下,电子设备可以基于第一值确定通信模块的工作模式。其中,上述的标志位的值(第一值)用于表示通信模块所使用的工作模式,第一值可以为表示通信模块的PCIe工作模式为PCIe主设备模式的值,也可以为表示通信模块的PCIe工作模式为PCIe从设备模式的值,标志位的第一值仅仅可以表示两种工作模式其中的一种。The electronic device can obtain the value of the flag bit of the working mode in the memory through the main control chip of the communication module, and at this time, the value of the flag bit obtained is the first value. When the electronic device acquires the first value of the flag bit, the electronic device can determine the working mode of the communication module based on the first value. Wherein, the value (first value) of the above-mentioned flag bit is used to represent the operating mode used by the communication module, and the first value can be a value indicating that the PCIe operating mode of the communication module is the PCIe master mode, or it can be a value representing the communication module The PCIe working mode is the value of the PCIe slave mode, and the first value of the flag bit can only represent one of the two working modes.
以下说明基于标志位的第一值确定工作模式的两种情况:The following describes two situations in which the working mode is determined based on the first value of the flag bit:
一种可能的情况下,当电子设备获取的标志位的第一值为表示工作模式为PCIe从设备模式的情况下,电子设备可以确定当前通信模块工作模式为PCIe从设备模式,并可以通过这一模式进行工作。例如,在电子设备通过主控芯片读取到存储器的标志位的第一值为“0”的情况下(标志位的值为“1”表示PCIe主设备模式,标志位的值为“0”表示PCIe从设备模式),通信模块可以进入PCIe从设备模式进行工作。In a possible situation, when the first value of the flag bit obtained by the electronic device indicates that the working mode is PCIe slave mode, the electronic device can determine that the current communication module working mode is PCIe slave mode, and can pass this work in one mode. For example, when the electronic device reads the first value of the flag bit of the memory through the main control chip to "0" (the value of the flag bit is "1" to indicate the PCIe master mode, and the value of the flag bit is "0" Indicates PCIe slave mode), the communication module can enter PCIe slave mode to work.
另一种可能的情况下,当电子设备获取的标志位或者电平值的第一值为表示工作模式为PCIe主设备模式的情况下,电子设备可以确定当前通信模块工作模式为PCIe主设备模式,并可以通过这一模式进行工作。例如,在通信模块通过主控芯片读取到存储器的标志位的第一值为“1”的情况下(标志位的值 为“1”表示PCIe主设备模式,标志位的值为“0”表示PCIe从设备模式),通信模块可以进入PCIe主设备模式进行工作。In another possible situation, when the first value of the flag bit or level value acquired by the electronic device indicates that the working mode is the PCIe master mode, the electronic device can determine that the current communication module working mode is the PCIe master mode , and can work through this mode. For example, when the first value of the flag bit of the memory read by the communication module through the main control chip is "1" (the value of the flag bit is "1" indicating the PCIe master mode, and the value of the flag bit is "0" Indicates PCIe slave mode), the communication module can enter the PCIe master mode to work.
上述的两种情况中,标志位可以为通信模块的存储器的寄存器值或者自定义管脚电平值。一种可能的实施方式中,标志位可以为通信模块的存储器的寄存器值,即可以为存储器中的某一位或者某几位,不同的标志位的值可以表示不同的工作模式。例如,电子设备可以在存储器内设置一位标志位,“1”表示PCIe主设备模式,“0”表示PCIe从设备模式。此处仅仅是举例说明标志位可能的标志数,具体标志位表示方法不构成限定。另一种可能的实施方式中,标志位可以为通信模块某个自定义管脚电平高低值。例如,在电平为的高(1)的情况下,表示PCIe主设备模式,电平为的低(0)的情况下,表示PCIe从设备模式。In the above two cases, the flag bit can be a register value of a memory of the communication module or a level value of a user-defined pin. In a possible implementation manner, the flag bit may be a register value of the memory of the communication module, that is, a certain bit or several bits in the memory, and different flag bit values may represent different working modes. For example, the electronic device can set a flag in the memory, "1" indicates the PCIe master mode, and "0" indicates the PCIe slave mode. Here is just an example to illustrate the number of possible flags of the flag bit, and the specific flag bit expression method does not constitute a limitation. In another possible implementation manner, the flag bit may be a high or low value of a user-defined pin level of the communication module. For example, when the level is high (1), it indicates the PCIe master mode, and when the level is low (0), it indicates the PCIe slave mode.
需要说明的是,在电子设备开机完成的情况下,通信模块工作模式也已经确定。在通信模块中包括的工作模式的计算机程序应当是PCIe主设备模式和PCIe从设备模式均存在的(兼容PCIe主从设备模式)。即通信模块的主控芯片既支持RC模式,也支持EP模式。It should be noted that, when the electronic device is powered on, the working mode of the communication module has also been determined. The computer program of the working mode included in the communication module should exist in both the PCIe master mode and the PCIe slave mode (compatible with the PCIe master-slave mode). That is, the main control chip of the communication module supports both RC mode and EP mode.
S402、电子设备判断第一模式与第二模式是否相同。如果是,结束当前的图4的流程;否则,执行步骤S403。S402. The electronic device determines whether the first mode is the same as the second mode. If yes, end the current flow of FIG. 4; otherwise, execute step S403.
第二模式是通信模式需要使用的目标工作模式,第二模式可以是PCIe主设备模式或者PCIe从设备模式。The second mode is a target working mode required by the communication mode, and the second mode may be a PCIe master mode or a PCIe slave mode.
电子设备确定当前通信模块的工作模式为第一模式,之后可以判断当前的工作模式是否为第二模式。在第一模式与第二模式相同的情况下,此时,通信模块已经使用的是目标工作模式,不需要进行切换,因此,电子设备可以结束当前的图4的流程。在第一模式与第二模式不同的情况下,此时,通信模块所使用的工作模式并非目标工作模式,从而需要切换当前的工作模式为第二模式, 所以需要进一步执行S403。The electronic device determines that the current working mode of the communication module is the first mode, and then can determine whether the current working mode is the second mode. In the case that the first mode is the same as the second mode, at this time, the communication module is already using the target working mode, and there is no need to switch. Therefore, the electronic device can end the current process of FIG. 4 . In the case that the first mode is different from the second mode, at this time, the working mode used by the communication module is not the target working mode, so the current working mode needs to be switched to the second mode, so S403 needs to be further executed.
以下说明两种判断第一模式与第二模式是否相同的实施方式:The following describes two implementations for judging whether the first mode is the same as the second mode:
在一种可能的实施方式中,电子设备可以基于第一模式和第二模式判断二者是否相同。其中第二模式可以是固定的,也可以是变化的。第二模式可以是电子设备存储的工作模式,还可以是根据用户需要确定的工作模式。例如,当用户需要调整第二模式时,用户可以向电子设备输入第二模式信息,当电子设备接收到用户输入的第二模式信息时,可以确定第二模式。In a possible implementation manner, the electronic device may determine whether the two modes are the same based on the first mode and the second mode. The second mode may be fixed or variable. The second mode may be a working mode stored in the electronic device, or may be a working mode determined according to user needs. For example, when the user needs to adjust the second mode, the user may input the second mode information into the electronic device, and when the electronic device receives the second mode information input by the user, the second mode may be determined.
在另一种可能的实施方式中,用户可以根据电子设备确定的当前的工作模式,判断第一模式与第二模式是否相同。在不相同的情况下,用户可以输入切换指令。切换指令是指示切换当前通信模块的工作模式的指令。电子设备接收到切换指令时,响应于所述切换指令,执行步骤S403。当相同的情况下,结束当前流程。In another possible implementation manner, the user may determine whether the first mode is the same as the second mode according to the current working mode determined by the electronic device. In a different case, the user may input a switching instruction. The switch instruction is an instruction to switch the working mode of the current communication module. When the electronic device receives the switching instruction, it executes step S403 in response to the switching instruction. When the same situation exists, end the current process.
以下说明判断第一模式与第二模式是否相同的几种情况:The following describes several situations for judging whether the first mode and the second mode are the same:
一种可能的情况下,在第一模式为PCIe从设备模式的情况下(已知目标模式为PCIe主设备模式),电子设备可以确定第一模式与第二模式不同,需执行步骤S403。In a possible situation, when the first mode is the PCIe slave mode (the known target mode is the PCIe master mode), the electronic device may determine that the first mode is different from the second mode, and step S403 is performed.
另一种可能的情况下,在第一模式为PCIe从设备模式的情况下(已知目标模式为PCIe从设备模式),电子设备可以确定第一模式与第二模式相同,结束当前流程。In another possible situation, when the first mode is the PCIe slave mode (the known target mode is the PCIe slave mode), the electronic device may determine that the first mode is the same as the second mode, and end the current process.
又一种可能的情况下,在第一模式为PCIe主设备模式的情况下(已知目标模式为PCIe从设备模式),电子设备可以确定第一模式与第二模式不同,需执行步骤S403。In yet another possible situation, when the first mode is the PCIe master mode (the known target mode is the PCIe slave mode), the electronic device may determine that the first mode is different from the second mode, and step S403 needs to be performed.
又一种可能的情况下,在第一模式为PCIe主设备模式的情况下(已知目标模式为PCIe主设备模式),电子设备可以确定第一模式与第二模式相同,结 束当前流程。In another possible situation, when the first mode is the PCIe master mode (the known target mode is the PCIe master mode), the electronic device may determine that the first mode is the same as the second mode, and end the current process.
需要说明的是,目标模式可以通过用户设定的工作模式,也可以是电子设备确定的。目标模式是可以变化的,例如,目标模式为PCIe从设备模式,而用户需要使用PCIe主设备模式,可以设置目标模式为PCIe主设备模式。It should be noted that the target mode can be determined by the working mode set by the user or by the electronic device. The target mode can be changed. For example, the target mode is PCIe slave mode, but the user needs to use PCIe master mode, and the target mode can be set as PCIe master mode.
S403、电子设备将标志位的值由第一值更改为第二值,基于第二值将通信模块的工作模式确定为第二模式。S403. The electronic device changes the value of the flag bit from the first value to a second value, and determines the working mode of the communication module as the second mode based on the second value.
电子设备可以更改当前通信模块中存储器标志位的值由第一值更改第二值,第二值是表示工作模式为第二模式的标志位的值。例如,在标志位的第一值为0的情况下,电子设备可以将第一值改为第二值1(“1”表示PCIe主设备模式,“0”表示PCIe从设备模式);在标志位的第一值为1的情况下,电子设备可以将第一值改为第二值0。The electronic device can change the value of the flag bit of the memory in the current communication module from the first value to the second value, and the second value is the value of the flag bit indicating that the working mode is the second mode. For example, when the first value of the flag bit is 0, the electronic device can change the first value to the second value 1 ("1" means PCIe master mode, and "0" means PCIe slave mode); In case the first value of the bit is 1, the electronic device may change the first value to a second value of 0.
电子设备可以生成注意AT(Attention)指令,此时的AT指令用于更改通信模块的标志位的值。之后,电子设备可以向通信模块发送AT指令。通信模块接收到AT指令之后,可以进一步通过主控芯片执行AT指令,即主控芯片基于AT指令更改当前的存储器的标志位。其中,第一值与第二值不相同。The electronic device can generate an attention AT (Attention) command, and the AT command at this time is used to change the value of the flag bit of the communication module. Afterwards, the electronic device can send an AT command to the communication module. After the communication module receives the AT command, it can further execute the AT command through the main control chip, that is, the main control chip changes the flag bit of the current memory based on the AT command. Wherein, the first value is different from the second value.
在通信模块的存储器中的标志位的值更改为第二值之后,电子设备可以重新开机(例如先关机后开机或者直接重启),在电子设备重新开机的过程中,通信模块会重新读取存储器的标志位为第二值,从而确定自身的工作模式为第二模式。具体的确定过程可以参考步骤S401的相关描述。其中,第一值表示工作模式为第一模式,第二值表示工作模式为第二模式。因此,在确定其工作模式的过程中,通信模块便能完成工作模式的切换。After the value of the flag bit in the memory of the communication module is changed to the second value, the electronic device can be restarted (for example, shut down first and then restart or directly restart), and the communication module will re-read the memory in the process of restarting the electronic device. The flag bit is the second value, so as to determine its own working mode as the second mode. For a specific determination process, reference may be made to the relevant description of step S401. Wherein, the first value indicates that the working mode is the first mode, and the second value indicates that the working mode is the second mode. Therefore, in the process of determining its working mode, the communication module can complete the switching of the working mode.
经过上述的方法实施例,通信模块可以切换工作模式,即可以切换PCIe从设备模式和PCIe主设备模式,此时,通信模块可以作为PCIe从设备挂载到其他PCIe主设备上;也可以作为PCIe主设备,用来挂在其他PCIe从设备。 当能够实现自由切换时,通信模块的工作模式可以更好的适应用户的需求,以提供网络服务。这样。可以扩大通信模块使用的范围。Through the above-mentioned method embodiment, the communication module can switch the working mode, that is, the PCIe slave mode and the PCIe master mode can be switched. At this time, the communication module can be mounted on other PCIe master devices as a PCIe slave device; it can also be used as a PCIe The master device is used to connect to other PCIe slave devices. When free switching can be realized, the working mode of the communication module can better adapt to the needs of users to provide network services. so. The scope of use of the communication module can be expanded.
此外,在通信模块不能作为PCIe主设备的情况下,PCIe必须要有上位机,并与之连接,此时系统较复杂,成本较高,而在通信模块作为PCIe主设备的情况下,通信模块自身便是上位机,能够简化系统,降低成本。In addition, when the communication module cannot be used as a PCIe master device, PCIe must have a host computer and be connected to it. At this time, the system is more complicated and the cost is higher. It is the upper computer itself, which can simplify the system and reduce the cost.
在本申请实施例中,电子设备可以是拥有通信能力、处理功能和存储能力的任何终端设备,例如,电脑、CPE等等。即电子设备可以是通过通信模块提供网络的所有可能的设备,此处不加限定。In this embodiment of the present application, an electronic device may be any terminal device having communication capabilities, processing functions, and storage capabilities, such as a computer, a CPE, and the like. That is, the electronic device may be all possible devices that provide a network through the communication module, which is not limited here.
示例性地,根据上述的方法实施例,具体介绍一种主从设备兼容的通信模块设计的方法。请参阅图5,图5是本申请实施例公开的另一种主从设备兼容的通信模块设计的方法流程示意图。如图5所示,该主从设备兼容的通信模块设计的方法如下:Exemplarily, according to the above method embodiment, a method for designing a communication module compatible with master and slave devices is specifically introduced. Please refer to FIG. 5 . FIG. 5 is a schematic flowchart of another method for designing a communication module compatible with master-slave devices disclosed in the embodiment of the present application. As shown in Figure 5, the design method of the communication module compatible with the master-slave device is as follows:
通信模块中的存储器和主控芯片可以提前预设置。经过预设置的主控芯片可以兼容PCIe主设备模式和PCIe从设备模式。并且通信模块存储器内预设置一标志位,标志位的两种数字可以分别对应PCIe主设备模式和PCIe从设备模式。通信模块中默认的标志位为“0”,即表示PCIe从设备模式;而标志位为“1”,即表示PCIe主设备模式。The memory and the main control chip in the communication module can be preset in advance. The pre-set master chip is compatible with PCIe master mode and PCIe slave mode. And a flag bit is preset in the memory of the communication module, and the two numbers of the flag bit can correspond to the PCIe master mode and the PCIe slave mode respectively. The default flag bit in the communication module is "0", which means the PCIe slave mode; and the flag bit is "1", which means the PCIe master mode.
以下说明电子设备的切换通信模块的工作模式的具体过程。The following describes the specific process of switching the working mode of the communication module of the electronic device.
S501、电子设备确定标志位,在标志位是“0”的情况下,确定工作模式为PCIe从设备模式。S501. The electronic device determines a flag bit, and if the flag bit is "0", determines that the working mode is a PCIe slave mode.
在电子设备开机时,通信模块也会开机,在上述的开机过程中,通信模块读取到默认标志位为(第一值)“0”,通信模块根据标志位“0”当前的工作模式为PCIe从设备模式,即通信模块主控芯片内PCIe设置为从设备模式。When the electronic equipment is turned on, the communication module will also be turned on. During the above-mentioned startup process, the communication module reads that the default flag bit is (first value) "0", and the current working mode of the communication module according to the flag bit "0" is PCIe slave mode, that is, the PCIe in the main control chip of the communication module is set to slave mode.
S502、电子设备更改通信模块的标志位,将标志位该改为PCIe主设备模 式的标志位(第二值)“1”。S502. The electronic device changes the flag bit of the communication module, and changes the flag bit to the flag bit (second value) "1" of the PCIe master device mode.
在开机完成后,在用户确定所需要的工作模式为PCIe主设备模式(目标模式),且当前的工作模式为PCIe从设备模式的情况下,电子设备可以通过AT指令更改通信模块的标志位为“1”,即修改为PCIe主设备模式对应的标志位。After the boot is completed, when the user determines that the required working mode is PCIe master mode (target mode), and the current working mode is PCIe slave mode, the electronic device can change the flag bit of the communication module to "1", that is, modify it to the flag bit corresponding to the PCIe master mode.
S503、通信模块重新读取标志位,在标志位是“1”的情况下,确定工作模式为PCIe主设备模式。S503. The communication module re-reads the flag bit, and if the flag bit is "1", determines that the working mode is the PCIe master mode.
在完成步骤S502之后,电子设备可以重启或者关机之后重新开机,在开机过程中,通信模块重新读取标志位为“1”,并设定工作模式为PCIe主设备模式。After step S502 is completed, the electronic device can be restarted or restarted after shutdown. During the startup process, the communication module re-reads the flag as "1" and sets the working mode as PCIe master mode.
当完成上述的切换过程之后,通信模块可以挂载其他的PCIe从设备。示例性地,图6是本申请实施例公开的又一种PCIe设备的结构示意图,如图6所示,FM150-M.2-5G通信模块可以作为PCIe主设备,通过PCIe接口外部直接挂载PCIe从设备(RTL8111H)。此时FM150-M.2-5G通信模块不需要上位机,可以直接将4G和5G信号解调成基带信号,通过PCIe接口向RTL8111H(PCIe从设备)发送基带信号。RTL8111H接收到基带信号之后,将基带信号转换成有线网卡信号,之后可以给PC或者WiFi路由器等提供网络来源。After the above switching process is completed, the communication module can mount other PCIe slave devices. Exemplarily, FIG. 6 is a schematic structural diagram of another PCIe device disclosed in the embodiment of the present application. As shown in FIG. 6, the FM150-M.2-5G communication module can be used as a PCIe master device and directly mounted externally through the PCIe interface PCIe slave device (RTL8111H). At this time, the FM150-M.2-5G communication module does not need a host computer, and can directly demodulate 4G and 5G signals into baseband signals, and send baseband signals to RTL8111H (PCIe slave device) through the PCIe interface. After the RTL8111H receives the baseband signal, it converts the baseband signal into a wired network card signal, and then can provide a network source for a PC or a WiFi router.
以上所述的具体实施方式,对本申请的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本申请的具体实施方式而已,并不用于限定本申请的保护范围,凡在本申请的技术方案的基础之上,所做的任何修改、等同替换、改进等,均应包括在本申请的保护范围之内。The specific implementation described above has further described the purpose, technical solutions and beneficial effects of the application in detail. It should be understood that the above description is only a specific implementation of the application, and is not intended to limit the scope of the application. Scope of protection: All modifications, equivalent replacements, improvements, etc. made on the basis of the technical solutions of this application shall be included within the scope of protection of this application.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实 现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如DVD)、或者半导体介质(例如固态硬盘)等。In the above embodiments, all or part of them may be implemented by software, hardware, firmware or any combination thereof. When implemented using software, it may 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 the computer, the processes or functions according to the embodiments of the present application will be generated in whole or in part. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website, computer, server or data center Transmission to another website site, computer, server, or data center by wired (eg, coaxial cable, optical fiber, DSL) or wireless (eg, infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center integrated with one or more available media. The available media may be magnetic media (eg, floppy disk, hard disk, magnetic tape), optical media (eg, DVD), or semiconductor media (eg, solid state hard disk), etc.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments are realized. The processes can be completed by computer programs to instruct related hardware. The programs can be stored in computer-readable storage media. When the programs are executed , may include the processes of the foregoing method embodiments. The aforementioned storage medium includes: ROM or random access memory RAM, magnetic disk or optical disk, and other various media that can store program codes.

Claims (10)

  1. 一种主从设备兼容的通信模块设计方法,其特征在于,所述方法应用于电子设备,所述电子设备设置有通信模块,所述通信模块用于为所述电子设备提供网络,包括:A communication module design method compatible with master-slave equipment, characterized in that the method is applied to electronic equipment, the electronic equipment is provided with a communication module, and the communication module is used to provide a network for the electronic equipment, including:
    基于标志位的第一值将所述通信模块的工作模式确定为第一模式,所述工作模式包括高速串行计算机扩展总线PCIe主设备模式和PCIe从设备模式,所述标志位为所述通信模块的存储器的标志位;Based on the first value of the flag bit, the working mode of the communication module is determined as the first mode, and the working mode includes a high-speed serial computer expansion bus PCIe master mode and a PCIe slave mode, and the flag bit is the communication module. The flag bit of the module's memory;
    在所述第一模式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值;In the case where the first mode is different from the second mode, changing the value of the flag bit from the first value to a second value;
    基于所述第二值将所述通信模块的工作模式确定为所述第二模式。The working mode of the communication module is determined as the second mode based on the second value.
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, further comprising:
    接收用户输入的所述第二模式。The second pattern input by a user is received.
  3. 根据权利要求1所述的方法,其特征在于,所述第二模式为所述电子设备存储的模式。The method according to claim 1, wherein the second mode is a mode stored in the electronic device.
  4. 根据权利要求1所述的方法,其特征在于,所述将所述标志位的值由所述第一值更改为第二值之后,所述方法还包括:The method according to claim 1, wherein after the value of the flag bit is changed from the first value to the second value, the method further comprises:
    存储所述第二值;storing said second value;
    重启所述电子设备。The electronic device is restarted.
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述在所述第一模式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值,包括:The method according to any one of claims 1-4, wherein when the first mode is different from the second mode, changing the value of the flag bit from the first value to second value, including:
    在所述第一模式与第二模式不同的情况下,生成AT指令;In the case where the first mode is different from the second mode, an AT command is generated;
    根据所述AT指令,将所述标志位的值由所述第一值更改为第二值。According to the AT instruction, the value of the flag bit is changed from the first value to a second value.
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述在所述第一模 式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值,包括:The method according to any one of claims 1-5, wherein when the first mode is different from the second mode, changing the value of the flag bit from the first value to second value, including:
    接收用户输入的切换指令,所述切换指令是在所述第一模式与第二模式不同的情况下,用户指示切换当前工作模式的指令;receiving a switching instruction input by the user, where the switching instruction is an instruction from the user to switch the current working mode when the first mode is different from the second mode;
    响应于所述切换指令,将所述标志位的值由所述第一值更改为第二值。In response to the switching instruction, change the value of the flag bit from the first value to a second value.
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述第一模式为PCIe从设备模式,所述第二模式为PCIe主设备模式,所述标志位为所述通信模块的存储器的寄存器值或者自定义管脚电平值。The method according to any one of claims 1-6, wherein the first mode is a PCIe slave mode, the second mode is a PCIe master mode, and the flag bit is the communication module's The register value of the memory or the level value of the user-defined pin.
  8. 一种电子设备,其特征在于,包括:一个或多个处理器和一个或多个存储器,所述一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,所述电子设备设置有通信模块,所述通信模块用于为所述电子设备提供网络,当所述一个或多个处理器执行所述计算机指令时,以使得所述电子设备执行:An electronic device, characterized in that it includes: one or more processors and one or more memories, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, the electronic device is set There is a communication module for providing a network for the electronic device, when the one or more processors execute the computer instructions, such that the electronic device performs:
    基于标志位的第一值将所述通信模块的工作模式确定为第一模式,所述工作模式包括PCIe主设备模式和PCIe从设备模式,所述标志位为所述通信模块的存储器的标志位;The operating mode of the communication module is determined as the first mode based on the first value of the flag bit, the operating mode includes a PCIe master mode and a PCIe slave mode, and the flag bit is a flag bit of a memory of the communication module ;
    在所述第一模式与第二模式不同的情况下,将所述标志位的值由所述第一值更改为第二值;In the case where the first mode is different from the second mode, changing the value of the flag bit from the first value to a second value;
    基于所述第二值将所述通信模块的工作模式确定为所述第二模式。The working mode of the communication module is determined as the second mode based on the second value.
  9. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储有计算机程序或计算机指令,当所述计算机程序或计算机指令被运行时,实现如权利要求1-7任一项所述的方法。A computer-readable storage medium, characterized in that a computer program or computer instruction is stored in the computer-readable storage medium, and when the computer program or computer instruction is executed, any one of claims 1-7 is realized the method described.
  10. 一种计算机程序产品,其特征在于,当所述计算机程序产品在计算机上运行时,使得所述计算机执行如权利要求1-7中任一项所述的方法。A computer program product, characterized in that, when the computer program product is run on a computer, the computer is made to execute the method according to any one of claims 1-7.
PCT/CN2022/097637 2021-11-09 2022-06-08 Method for designing communication module having master and slave devices compatible, and apparatus WO2023082622A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111321866.9A CN114328329A (en) 2021-11-09 2021-11-09 Communication module design method and device compatible with master and slave devices
CN202111321866.9 2021-11-09

Publications (1)

Publication Number Publication Date
WO2023082622A1 true WO2023082622A1 (en) 2023-05-19

Family

ID=81044550

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/097637 WO2023082622A1 (en) 2021-11-09 2022-06-08 Method for designing communication module having master and slave devices compatible, and apparatus

Country Status (2)

Country Link
CN (1) CN114328329A (en)
WO (1) WO2023082622A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114328329A (en) * 2021-11-09 2022-04-12 深圳市广和通无线股份有限公司 Communication module design method and device compatible with master and slave devices
CN114826907B (en) * 2022-04-22 2023-08-11 西安广和通无线通信有限公司 PCIe RC and EP mode switching method, device, equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102082667A (en) * 2010-11-17 2011-06-01 北京曙光天演信息技术有限公司 Method for switching master mode and slave mode of encryption card and encryption card
US20160179735A1 (en) * 2014-12-18 2016-06-23 Emc Corporation Managing a peripheral component interface express device hotplug
CN110941576A (en) * 2018-09-21 2020-03-31 苏州库瀚信息科技有限公司 System, method and device for memory controller with multi-mode PCIE function
CN210899167U (en) * 2019-12-16 2020-06-30 闻泰通讯股份有限公司 Communication chip module and electronic product
CN114328329A (en) * 2021-11-09 2022-04-12 深圳市广和通无线股份有限公司 Communication module design method and device compatible with master and slave devices

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7793010B2 (en) * 2005-11-22 2010-09-07 Lsi Corporation Bus system with multiple modes of operation
CN206100018U (en) * 2016-09-06 2017-04-12 深圳市乙辰科技股份有限公司 Multimedia smart "Residential gateway" , management system and TV box of high integration
US11256644B2 (en) * 2018-09-05 2022-02-22 Fungible, Inc. Dynamically changing configuration of data processing unit when connected to storage device or computing device
CN112292672A (en) * 2019-11-05 2021-01-29 深圳市大疆创新科技有限公司 Switching control method, electronic equipment and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102082667A (en) * 2010-11-17 2011-06-01 北京曙光天演信息技术有限公司 Method for switching master mode and slave mode of encryption card and encryption card
US20160179735A1 (en) * 2014-12-18 2016-06-23 Emc Corporation Managing a peripheral component interface express device hotplug
CN110941576A (en) * 2018-09-21 2020-03-31 苏州库瀚信息科技有限公司 System, method and device for memory controller with multi-mode PCIE function
CN210899167U (en) * 2019-12-16 2020-06-30 闻泰通讯股份有限公司 Communication chip module and electronic product
CN114328329A (en) * 2021-11-09 2022-04-12 深圳市广和通无线股份有限公司 Communication module design method and device compatible with master and slave devices

Also Published As

Publication number Publication date
CN114328329A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
WO2023082622A1 (en) Method for designing communication module having master and slave devices compatible, and apparatus
US10747267B2 (en) Configuring docks
KR101565357B1 (en) Systems, methods, and apparatuses for handling timeouts
JP5917408B2 (en) Configurable connector for system level communication
KR20180052539A (en) Methods and apparatus for providing individualized power control for peripheral sub-systems
TWI515577B (en) Method and interface for communications between units in a device
US20060160569A1 (en) Cellular phone and portable storage device using the same
US20030110319A1 (en) Universal serial bus device having logical circuit for conversive and immediate host reset operation
WO2024103829A1 (en) Port configuration method, component, and hard disk expansion apparatus
US11797468B2 (en) Peripheral component interconnect express device and computing system including the same
CN116431546B (en) Parameter configuration method, electronic device, storage medium, and program product
WO2024109026A1 (en) Server interrupt operation execution method and apparatus, device, and storage medium
CN115733549B (en) PCIE network card, switching method of interface modes of PCIE network card, electronic equipment and storage medium
US10645166B2 (en) Network interface card
US10521385B2 (en) Inter-device digital audio
WO2023155363A1 (en) Server dynamic hot backup method, apparatus and device, and storage medium
US9043500B2 (en) System and method for generating a virtual PCI-type configuration space for a device
CN109165099B (en) Electronic equipment, memory copying method and device
US20230315672A1 (en) Interface device and computing system including the same
US20230315591A1 (en) PCIe DEVICE AND COMPUTING SYSTEM INCLUDING THE SAME
JP2004302778A (en) Interface device
WO2020103041A1 (en) Bluetooth connection control method and router
KR100288116B1 (en) File and directory transfer system between host computer and guest computer
CN115190012A (en) Method, controller and storage device for information configuration of interconnection protocol
CN117997658A (en) Communication method and device and electronic equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22891431

Country of ref document: EP

Kind code of ref document: A1