Summary of the invention
Fundamental purpose of the present invention is to provide a kind of upgrade method and system of wireless communication module, is intended to realize and conveniently wireless communication module is upgraded, and avoids wireless communication module dismounting to cause damage.
To achieve these objectives, the present invention proposes a kind of upgrade method of wireless communication module, comprises step:
Virtual port is set on application processor;
Set up the communication thread between described virtual port and the physical port of wireless communication module;
By described communication thread, carry out the data interaction between described virtual port and described physical port.
Preferably, described communication thread comprises the first thread, the second thread and the 3rd thread, and the described data interaction of carrying out between described virtual port and described physical port according to communication thread comprises:
By the duty of physical port described in described First Line range monitoring and virtual port;
By described the second thread, carry out described physical port to the data transmission of described virtual port;
By described the 3rd thread, carry out described virtual port to the data transmission of described physical port.
Preferably, the described duty by physical port described in First Line range monitoring and virtual port comprises:
By DTR signal and the DSR signal of physical port described in described First Line range monitoring and virtual port;
The DTR signal of described physical port and described virtual port and DSR signal are transmitted mutually.
Preferably, by described the second thread, carrying out described physical port comprises to the data transmission of described virtual port:
Read described physical port data waiting for transmission, judge that described data are AT instruction or communication data;
If AT instruction, is directly transferred to described virtual port by described the second thread by described AT instruction;
If communication data, carries out circular treatment by described the second thread, until described communication data is all transferred to described virtual port.
Preferably, after the described step that virtual port is set on application processor, also comprise:
The messaging parameter setting of the virtual port of application processor and the physical port of wireless communication module described in initialization.
The present invention proposes a kind of upgrade-system of wireless communication module simultaneously, comprises application processor, wireless communication module, setting unit and upgrading unit, and described wireless communication module has physical port, wherein:
Setting unit, for virtual port being set on described application processor, sets up the communication thread between described virtual port and described physical port;
Upgrading unit, for carrying out the data interaction between described virtual port and described physical port by described communication thread.
Preferably, described communication thread comprises the first thread, the second thread and the 3rd thread, and described upgrading unit is used for:
By the duty of physical port described in described First Line range monitoring and virtual port;
By described the second thread, carry out described physical port to the data transmission of described virtual port;
By described the 3rd thread, carry out described virtual port to the data transmission of described physical port.
Preferably, described upgrading unit is used for:
By DTR signal and the DSR signal of physical port described in described First Line range monitoring and virtual port;
The DTR signal of described physical port and described virtual port and DSR signal are transmitted mutually.
Preferably, described upgrading unit is used for:
Read described physical port data waiting for transmission, judge that described data are AT instruction or communication data;
If AT instruction, is directly transferred to described virtual port by described the second thread by described AT instruction;
If communication data, carries out circular treatment by described the second thread, until described communication data is all transferred to described virtual port.
Preferably, described setting unit is also for the messaging parameter setting of virtual port and physical port described in initialization.
The upgrade method of a kind of wireless communication module provided by the present invention, by a virtual port is set on application processor, between virtual port and the physical port of wireless communication module, set up communication thread, realize the data interaction between virtual port and physical port, completed the upgrading of wireless communication module.Thereby wireless communication module can directly be upgraded by physical port, to avoid communication module to carry out dismounting, escalation process is convenient and swift, has avoided disassembly process to damage the secondary of wireless communication module.
Embodiment
Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Referring to Fig. 1, Fig. 2, upgrade method one embodiment of wireless communication module of the present invention is proposed, the upgrade method of described wireless communication module comprises the following steps:
Step S101, virtual port is set on application processor
The terminal device such as panel computer, mobile phone comprises application processor (AP, Aplication Processo), mainboard and hardware plate, and wireless communication module is welded on hardware plate, is provided with the physical port of wireless communication module on hardware plate.A virtual port is set on application processor, in the operating system of terminal device, writes a virtual port and drive.The messaging parameter setting of initialization virtual port, be api interface (the Aplication Programming Interface of call operation system, application programming interface) open the file handle that virtual port is corresponding, other parameters except virtual port filename are set; The messaging parameter setting of the physical port of intiating radio communication module, the api interface of call operation system is opened the file handle that physical port is corresponding, and other parameters except physical port filename are set.The state machine of startup to virtual port, for managing the state transition process of this virtual port.
Step S102, set up the communication thread between virtual port and physical port
Utilize software to realize the mapping of the virtual port of application processor and the physical port of wireless communication module, between virtual port and physical port, set up three communication thread, comprise the first thread, the second thread and the 3rd thread.The first thread is responsible for the duty of monitors physical port and virtual port; The second thread is responsible for physical port to the data transmission of virtual port; The 3rd thread is responsible for virtual port to the data transmission of physical port.
Step S103, by communication thread, carry out the data interaction between virtual port and physical port
By the data interaction between virtual port and physical port, wireless communication module receives outside upgrading data packet and upgrades.As shown in Figure 2, this step S103 is specially:
Step S201, by the duty of First Line range monitoring physical port and virtual port
The DTR(Data Terminal Ready of the physical port of First Line range monitoring wireless communication module and the virtual port of application processor, data terminal ready) signal and DSR (Data Set Ready, data ready) signal, transmits the DTR signal of physical port and virtual port and DSR signal mutually.For example: the DTR signal of the physical port that is wireless communication module by the DTR signal transmission of the virtual port of application processor, the DSR signal of the physical port that is wireless communication module by the DSR signal transmission of the virtual port of application processor, the DTR signal of the physical port of the virtual port that is application processor by the DTR signal transmission of wireless communication module, the DSR signal of the physical port of the virtual port that is application processor by the DSR signal transmission of wireless communication module.
Step S202, physical port detected and there are data waiting for transmission
Step S203, judgement physical port data waiting for transmission are AT instruction or communication data
Read the physical port data waiting for transmission of wireless communication module, judge that described data are AT instruction or communication data.
If step S204 AT instruction, is directly transferred to virtual port by the second thread by AT instruction
Thereby realize the transmission of AT instruction from the physical port of wireless communication module to the virtual port of application processor.
If step S205 communication data, carries out circular treatment by the second thread, until communication data is all transferred to virtual port
Call circular treatment transport communication data, can prevent data from overflow, guarantee the integrality of data.Thereby complete the transmission of communication data from the physical port of wireless communication module to the virtual port of application processor.
Step S206, virtual port detected and there are data waiting for transmission
Step S207, by the 3rd thread, described data are directly transferred to physical port
Now no matter data are AT instruction or communication data, are all directly transferred to physical port, by wireless communication module, are directly processed.Thereby completed the transmission of data from the virtual port of application processor to the physical port of wireless communication module.
The upgrade method of wireless communication module of the present invention, by a virtual port is set on application processor, between virtual port and the physical port of wireless communication module, set up communication thread, realize the data interaction between virtual port and physical port, completed the upgrading of wireless communication module.Thereby wireless communication module can directly be upgraded by physical port, to avoid communication module to carry out dismounting, escalation process is convenient and swift, has avoided disassembly process to damage the secondary of wireless communication module.
Referring to Fig. 3, upgrade-system one embodiment of wireless communication module of the present invention is proposed, described upgrade-system can be for terminal devices such as mobile phone, panel computers, comprise application processor 110, wireless communication module 130, setting unit 120 and upgrading unit 140, described wireless communication module 130 is welded on the hardware plate of terminal device, hardware plate is provided with the physical port of wireless communication module 130, wherein:
Setting unit 120, for virtual port being set on application processor 110, sets up the communication thread between described virtual port and the physical port of wireless communication module 130.Concrete:
Setting unit 120 arranges a virtual port on application processor 110, creates a virtual port and drive in the operating system of terminal device.Setting unit 120 is also carried out initialization to the messaging parameter setting of the physical port of the virtual port of application processor 110 and wireless communication module 130, that is: the api interface that calls terminal device operating system is opened the file handle that virtual port is corresponding, and other parameters except virtual port filename are set; The api interface of call operation system is opened the file handle that physical port is corresponding, and other parameters except physical port filename are set.Setting unit 120 also starts the state machine to virtual port, for managing the state transition process of this virtual port.
Setting unit 120 utilizes software to realize the mapping of the virtual port of application processor 110 and the physical port of wireless communication module 130, between virtual port and physical port, sets up three communication thread, comprises the first thread, the second thread and the 3rd thread.The first thread is responsible for monitoring the duty of the physical port of wireless communication module 130 and the virtual port of application processor 110; The second thread is responsible for the physical port of wireless communication module 130 to the data transmission of the virtual port of application processor 110; The 3rd thread is responsible for the virtual port of application processor 110 to the data transmission of the physical port of wireless communication module 130.
Upgrading unit 140, for carrying out the data interaction between the virtual port of application processor 110 and the physical port of wireless communication module 130 by communication thread.Upgrading unit 140 calls the duty of the physical port of First Line range monitoring wireless communication module 130 and the virtual port of application processor 110, call the second thread and carry out the physical port of wireless communication module 130 to the data transmission of the virtual port of application processor 110, call the 3rd thread and carry out the virtual port of application processor 110 to the data transmission of the physical port of wireless communication module 130.Concrete:
Upgrading unit 140 calls DTR signal and the DSR signal of the physical port of First Line range monitoring wireless communication module 130 and the virtual port of application processor 110, and the DTR signal of the virtual port of the physical port of wireless communication module 130 and application processor 110 and DSR signal are transmitted mutually.For example, by the DTR signal transmission of the virtual port of application processor 110, it is the DTR signal of the physical port of wireless communication module 130, by the DSR signal transmission of the virtual port of application processor 110, it is the DSR signal of the physical port of wireless communication module 130, by the DTR signal transmission of the physical port of wireless communication module 130, being the DTR signal of the virtual port of application processor 110, is the DSR signal of the virtual port of application processor 110 by the DSR signal transmission of the physical port of wireless communication module 130.
The physical port that upgrading unit 140 detects wireless communication module 130 has data waiting for transmission, reads described data and judges that it is AT instruction or communication data.If AT instruction, calls the second thread AT instruction is directly transferred to virtual port, realize the transmission of AT instruction from the physical port of wireless communication module 130 to the virtual port of application processor 110; If communication data, for preventing data from overflow, guarantee the integrality of data, 140 of unit of upgrading call the second thread and carry out circular treatment, until communication data is all transferred to virtual port, thereby complete the transmission of communication data from the physical port of wireless communication module 130 to the virtual port of application processor 110.
Upgrading unit 140 detects virtual port and has data waiting for transmission, calls the 3rd thread described data are directly transferred to physical port.Now no matter data are AT instruction or communication data, are all directly transferred to physical port, by wireless communication module 130, are directly processed.Thereby completed the transmission of data from the virtual port of application processor 110 to the physical port of wireless communication module 130.
The upgrade-system of wireless communication module of the present invention, one virtual port is set on application processor 110 by setting unit 120, and set up communication thread between virtual port and the physical port of wireless communication module 130, by upgrading unit 140, by communication thread, realize the data interaction between virtual port and physical port, complete the upgrading of wireless communication module 130.Thereby wireless communication module 130 can directly be upgraded by physical port, to avoid communication module 130 to carry out dismounting, escalation process is convenient and swift, has avoided disassembly process to damage the secondary of wireless communication module 130.
Should be understood that; these are only the preferred embodiments of the present invention; can not therefore limit the scope of the claims of the present invention; every equivalent structure or conversion of equivalent flow process that utilizes instructions of the present invention and accompanying drawing content to do; or be directly or indirectly used in other relevant technical fields, be all in like manner included in scope of patent protection of the present invention.