Summary of the invention
The problem that the present invention solves is to provide a kind of general bluetooth module, bluetooth equipment and information processing method thereof, with simplified design, shortening development time, saving exploitation and design cost.
For addressing the above problem, the invention provides a kind of bluetooth module, comprising:
Radio-frequency (RF) transceiver is used for receiving and sending Bluetooth signal;
Memory is used for storing bluetooth module application program, Bluetooth protocol application program, HCI driver and allocator;
The base band microcontroller, be used for being connected with described radio-frequency (RF) transceiver, finishing the following bottom hardware of HCI of bluetooth protocol repertory uses, also be used for connecting and driving described memory, need to be converted to corresponding HCI order with the mutual control command of other bluetooth equipment, will need to be converted to corresponding control event with the mutual HCI order of ancillary equipment, will execute the response that control command or HCI order produce and be converted to corresponding control command response, and finish software protocol application more than the HCI of bluetooth protocol repertory;
Communication interface is used for the control command that ancillary equipment sends is sent to described base band microcontroller and sends control command response, control event that described base band microcontroller sends to ancillary equipment.
Optionally, described radio-frequency (RF) transceiver and base band microcontroller are integrated in bluetooth chipset.
Optionally, described bluetooth module also comprises the digital signal processor that is connected with described base band microcontroller, for the treatment of audio digital signals.Described radio-frequency (RF) transceiver, base band microcontroller and digital signal processor are integrated in bluetooth chipset.
Optionally, described bluetooth module also comprises the pulse code modulation interface, is used for transmitting the audio digital signals of described digital signal processor processes.
Optionally, described bluetooth module comprises that also external memory storage drives expansion interface, is used for connecting described base band microcontroller and memory, drives memory for the base band microcontroller.
Optionally, described communication interface is the UART Universal Asynchronous Receiver Transmitter interface.
Optionally, described communication interface is internal integrate circuit bus interface, and described bluetooth module also comprises the interface conversion circuit of asynchronism transceiver and internal integrate circuit bus.
Optionally, described communication interface is USB (universal serial bus) or serial port.
Optionally, described bluetooth module also comprises: radio-frequency filter is used for being undertaken by the Bluetooth signal that antenna is received bandpass filtering and disturbs inhibition, and sends to described radio-frequency (RF) transceiver; Also be used for the analog signal that radio-frequency (RF) transceiver produces is carried out being gone out by antenna transmission after the filtering.
For addressing the above problem, the present invention also provides a kind of information processing method of bluetooth module, comprising:
Reception is from the control command of communication interface, need to carry out mutual control command with other bluetooth equipment and be converted to corresponding HCI order, carrying out does not need to carry out mutual control command with other bluetooth equipment, if produce the control command response that the response that responds, then will produce is converted to correspondence after executing control command;
Reception is from the HCI order of radio-frequency (RF) transceiver, need to carry out mutual HCI order with ancillary equipment and be converted to corresponding control event, carrying out does not need to carry out mutual HCI order with ancillary equipment, is converted to corresponding control command response if execute the rear response that produces response, then will produce of HCI order.
Optionally, describedly will need to carry out mutual control command with other bluetooth equipment and be converted to corresponding HCI order and refer to carry out the bluetooth module application program, judge whether the control command that receives needs to carry out mutual order with other bluetooth equipment, if then control command is converted to corresponding HCI order.
Optionally, described execution does not need to carry out mutual control command with other bluetooth equipment and refers to carry out the bluetooth module application program, judge whether the control command that receives needs to carry out mutual order with other bluetooth equipment, if not, then judge the type of control command: if control command is relevant with the bottom hardware of bluetooth protocol repertory, then call the HCI driver, finish the function of bluetooth bottom hardware by the HCI firmware of base band microcontroller; If control command is relevant with intermediate protocol layer, the higher layer applications of bluetooth protocol repertory, then call the Bluetooth protocol application program, finish the function of bluetooth intermediate protocol layer, higher layer applications; If control command is relevant with the hardware of bluetooth module, then carry out the bluetooth module application program, the hardware of bluetooth module is operated.
Optionally, the described response that will produce is converted to corresponding control command response and refers to carry out the bluetooth module application program, and bluetooth module application program or Bluetooth protocol application program are carried out the control command response that the response that produces after the control command is converted to correspondence.
Optionally, describedly will need to carry out mutual HCI order with ancillary equipment and be converted to corresponding control event and refer to carry out allocator, according to the analysis result of HCI driver to the HCI order, judge whether the HCI order needs to carry out mutual order with ancillary equipment, if, then carry out the bluetooth module application program, the HCI order is converted to corresponding control event.
Optionally, described execution does not need to carry out mutual HCI order with ancillary equipment and refers to carry out allocator, according to the analysis result of HCI driver to the HCI order, judge whether the HCI order needs to carry out mutual order with ancillary equipment, if not, then according to the analysis result of HCI driver to the HCI order, judge the type of HCI order: if the HCI order is relevant with the bottom hardware of bluetooth protocol repertory, then carry out the bluetooth module application program, by bluetooth module application call HCI driver, and finished the function of bluetooth bottom hardware by the base band microcontroller; If the HCI order is relevant with intermediate protocol layer, the higher layer applications of bluetooth protocol repertory, then carry out the Bluetooth protocol application program, finish the function of bluetooth intermediate protocol layer, higher layer applications.
Optionally, change the generation event if the information processing method of described bluetooth module also comprises the hardware state because of bluetooth module, then the event that produces is converted to corresponding control event.Described event with generation is converted to corresponding control event and refers to carry out the bluetooth module application program, and the event that produces is converted to corresponding control event.
For addressing the above problem, the present invention also provides a kind of bluetooth equipment, comprises main frame, is used for sending control command and receives control command response, control event; Bluetooth module, be used for receiving the control command that described main frame sends, need to carry out mutual control command with other bluetooth equipment and be converted to corresponding HCI order, carrying out does not need to carry out mutual control command with other bluetooth equipment, be converted to the control command response with executing the response that produces after the control command, receive the HCI order that other bluetooth equipment sends, need to carry out mutual HCI order with main frame and be converted to corresponding control event, carrying out does not need to carry out mutual HCI order with main frame, be converted to the control command response with executing the response that produces after the HCI order, control command is responded, the control event sends to main frame.
For addressing the above problem, the present invention also provides a kind of information processing method of bluetooth equipment, and described bluetooth equipment comprises main frame and bluetooth module, and described information processing method comprises:
Described main frame sends control command to bluetooth module, described bluetooth module will need to carry out mutual control command with other bluetooth equipment and be converted to corresponding HCI order, described bluetooth module is carried out not to be needed to carry out mutual control command with other bluetooth equipment, if there is the response that response occurs, described bluetooth module will produce to be converted to the control command response and to send described control command response to main frame after executing control command;
Described bluetooth module receives the HCI order, described bluetooth module will need to be converted to corresponding control event and to send described control event to main frame with the mutual HCI of main frame order, described bluetooth module is carried out does not need the HCI order mutual with main frame, if after executing the HCI order, have response to occur, the response that described bluetooth module will produce is converted to the control command response, and sends described control command response to main frame.
Compared with prior art, the bluetooth module of technique scheme to the periphery equipment (main frame) provides the interface of the response of control command, control command and control event, in bluetooth module, realize control command and HCI order conversion, carry out the response and the conversion of control command response and the conversion of HCI order and control event that produce after control command, the HCI order; Gather simultaneously bluetooth protocol repertory, realized the application of the bottom hardware that HCI is following and the application of the software protocol more than the HCI.Therefore, when using above-mentioned bluetooth module exploitation bluetooth equipment, the main frame of bluetooth equipment just can be controlled bluetooth module by control command and control command response and realize various Bluetooth functions.Because the application (bluetooth protocol repertory) relevant with bluetooth all is integrated in the bluetooth module, bluetooth module can be common to the exploitation of various bluetooth equipments, development technique personnel do not need to be grasped the ins and outs of HCI, bluetooth protocol repertory and application framework, just can develop at short notice the bluetooth equipment with Bluetooth function and only need grasp the response of simple control command and control command; And when the new function of exploitation bluetooth equipment, the control command that only need to increase in the application program of main frame corresponding Bluetooth function gets final product, and has so also just reduced the difficulty of exploitation and design.
In addition, because the main frame of bluetooth equipment only need send simple control command and receive simple control command response, do not need to realize bluetooth software agreement and application framework, thus not high for the controller requirement of main frame yet, and the microcontroller that normal operation is 8 just can be realized.Therefore, technique scheme has simplified design, shortens the development time, saves exploitation and design cost, the raising research and development of products is to the advantages such as speed in market.
Embodiment
The bluetooth module of the embodiment of the invention to the periphery equipment (main frame) provides the interface of the response of control command, control command and control event, and the conversion, execution control command, the HCI that realize control command and HCI order in bluetooth module order the conversion of the rear response that produces and control command response and HCI orders and the conversion of the event of control, bluetooth module has been gathered bluetooth protocol repertory (comprising bottom hardware, HCI, intermediate protocol layer and higher layer applications) simultaneously, has realized the application of the bottom hardware that HCI is following and the application of the software protocol more than the HCI.Be described in detail below in conjunction with accompanying drawing and the preferred embodiment embodiment to bluetooth module of the present invention, bluetooth equipment and information processing method thereof.
Please refer to Fig. 2, it has shown the hardware configuration of the bluetooth module of the present embodiment.Described bluetooth module 2 comprises: bluetooth chipset 21, clock generator 22, radio-frequency filter (RF filter) 23, memory 24, UART interface 25, power supervisor 26, pulse code modulation (PCM) interface 27, audio output interface 28, audio input interface 29.
Described bluetooth chipset 21 comprises that radio-frequency (RF) transceiver 210, base band microcontroller 211, digital signal processor (DSP) 212, digital to analog converter (DAC) 213, analog to digital converter (ADC) 214, UART interface 215, pcm interface 216, external memory storage drive expansion interface 217.
Radio-frequency (RF) transceiver 210, base band microcontroller 211 are finished the HCI firmware of bluetooth protocol repertory and the function and application of the bottom hardware agreement below the HCI, the HCI firmware is realized bluetooth hardware HCI order by the access to base band, link manager, hardware status register, control register and event registers.Radio-frequency (RF) transceiver 210 receives the signal of other bluetooth equipment transmission and carries out the processing such as demodulation, analog-to-digital conversion, digital signal after base band microcontroller 211 received RF transceivers 210 are processed is also finished the operations such as corresponding bluetooth baseband processing, equipment room establishment of connection and condition managing, if have data feedback or bluetooth module 2 to send data to other bluetooth equipment, base band microcontroller 211 sends the data to radio-frequency (RF) transceiver 210, is undertaken converting analog signal to after the processing such as digital-to-analogue conversion, modulation by 210 pairs of data of radio-frequency (RF) transceiver and sends.
If what receive is audio signal, then base band microcontroller 211 sends to digital signal processor 212 processing such as decode with audio digital signals, audio digital signals after digital signal processor 212 is processed is through digital to analog converter 213 output audio analog signals, and digital to analog converter 213 can external loudspeaker or earphone.In addition, audio digital signals after digital signal processor 212 is processed also can be by pcm interface 21 6 or internal integrated circuit audio-frequency bus (I2S) output, and pcm interface 216 also can the audio reception digital signal and sent to digital signal processor 212 and process simultaneously.
Analog to digital converter 214 can be connected with microphone, the audio analog signals input of external microphone is through analog to digital converter 214 output audio digital signals, the processing such as encode of the audio digital signals of 212 pairs of analog to digital converters of base band microcontroller 211 control figure signal processors 214 output, audio digital signals after by base band microcontroller 211 digital signal processor 212 being processed again sends to radio-frequency (RF) transceiver 210, and 210 pairs of audio digital signals of radio-frequency (RF) transceiver carry out converting analog signal to after the processing such as digital-to-analogue conversion, modulation and send.
UART interface 215 provides the communication interface of bluetooth chipset 21 with ancillary equipment, described ancillary equipment is the main frame of the bluetooth equipment of the described bluetooth module 2 of application, and it sends control commands and receive the control command response by the base band microcontroller 211 of communication interface to bluetooth chipset 21.Except UART interface 215, bluetooth chipset 21 can also provide the communication interface of interfaces (not shown) conducts such as SPI, USB, programming input and output (PIO) with ancillary equipment.
Described clock generator 22 is used for providing work clock to bluetooth chipset 21.In the present embodiment, clock generator 22 is crystal oscillator (Crystal), can produce stable clock signal.
Described radio-frequency filter 23, be used for being undertaken by the bluetooth high-frequency signal (2.4GHz) that antenna 20 is received bandpass filtering and disturb the radio-frequency (RF) transceiver 210 that suppresses and send into bluetooth chipset 21, the analog signal that while radio-frequency (RF) transceiver 210 produces is launched by antenna 20 after radio-frequency filter 23 filtering.
Described memory 24 is used for storing bluetooth module application program, Bluetooth protocol application program, HCI driver and allocator (Dispatcher).Memory 24 is flash memory (Flash Memory), the base band microcontroller 211 of bluetooth chipset 21 drives expansion interface 217 connections and drives memory 24 by external memory storage, the response that control command is converted to HCI order, carries out control command, produces after the HCI order is converted to the control command response, the HCI order is converted to the control event, and the application that realizes the software protocol that the HCI of bluetooth protocol repertory is above.
Please in conjunction with reference to figure 2 and Fig. 4, bluetooth module 2 among Fig. 2 is identical with bluetooth module 4 among Fig. 4, memory 24 is identical with memory 44, stores bluetooth module application program 440, Bluetooth protocol application program 441, HCI driver 442 and allocator 443 in the memory 44.
Bluetooth module application program 440 is used for judging whether the control command that main frame sends needs the order mutual with other bluetooth equipment, if then control command is converted to corresponding HCI order; If not, then judge the type of control command: if control command is relevant with the bottom hardware of bluetooth protocol repertory, then call HCI driver 442; If control command is relevant with intermediate protocol layer, the higher layer applications of bluetooth protocol repertory, then call Bluetooth protocol application program 441; If control command is relevant with the hardware of bluetooth module, then carry out control command, the hardware of bluetooth module is operated (such as control PIO, pcm interface etc.).
Bluetooth module application program 440 also is used for executing the response that produces after control command, the HCI order and is converted to the control command response; Need to carry out mutual HCI order with main frame and be converted to corresponding control event what allocator 443 distributed; According to the relevant HCI order of the bottom hardware with bluetooth protocol repertory that allocator 443 distributes, call HCI driver 442.
Bluetooth module application program 440 also is used for changing and generation event (for example PIO is drawn high) at the hardware state of bluetooth module, and the event that produces is converted to corresponding control event.
Bluetooth protocol application program 441 is used for receiving calling of bluetooth module application program 440, carries out control command, finishes the intermediate protocol layer of bluetooth protocol repertory, the Bluetooth function of higher layer applications.If produce response after executing control command, the response that then will produce returns to bluetooth module application program 440.
Bluetooth protocol application program 441 also is used for carrying out the HCI order that allocator 443 distributes, and finishes the intermediate protocol layer of bluetooth protocol repertory, the Bluetooth function of higher layer applications.If produce response after executing the HCI order, the response that then will produce sends to bluetooth module application program 440.
HCI driver 442 is used for receiving calling of bluetooth module application program 440, carries out control command, HCI order, finishes the function of bluetooth bottom hardware by the HCI firmware 418 of base band microcontroller 411.If produce response after the control command of executing, the HCI order, the response that then will produce returns to bluetooth module application program 440.
HCI driver 442, the HCI order that also is used for other bluetooth equipment is sent is resolved, and analysis result is sent to allocator 443.
Allocator 443 is used for the analysis result according to 442 pairs of HCI orders of HCI driver, judges whether the HCI order needs to carry out mutual order with main frame, if then the HCI call allocation is changed to bluetooth module application program 440; If not, then judge the type of HCI order:, then the HCI call allocation is carried out to bluetooth module application program 440 if the HCI order is relevant with the bottom hardware of bluetooth protocol repertory; If the HCI order is relevant with intermediate protocol layer, the higher layer applications of bluetooth protocol repertory, then the HCI call allocation is carried out to Bluetooth protocol application program 441.
Control command, control command response and control event are corresponding to the various application of bluetooth, in the present embodiment, control command, control command response and control event comprise AT Command Set and the self-defining expansion AT command collection of phone control protocol, therefore, just can control bluetooth module 2 by control command, control command response and control event and realize various Bluetooth functions.
Described UART interface 25, be connected with the UART interface 215 of bluetooth chipset 21, be used for to the periphery that equipment provides communication interface, bluetooth module 2 receives the control command that ancillary equipment send by UART interface 25,215, and perhaps equipment sends control command response, control event to the periphery.Corresponding to SPI interface, USB interface, the PIO interface that bluetooth chipset 21 provides, bluetooth module 2 also can provide the corresponding SPI interface that connects, USB interface, PIO interface (not shown) as with the communication interface of ancillary equipment.In addition, bluetooth module 2 can also provide internal integrate circuit bus (I2C) interface, only needs to increase a U2C (UART to I2C) interface conversion circuit and get final product in bluetooth module 2.
Described power supervisor 26 is used for the power supply of input is carried out voltage transitions, provides required power supply to bluetooth chipset 21, clock generator 22, radio-frequency filter (RF filter) 23, memory 24, UART interface 25.
Described pcm interface 27 is connected with the pcm interface 216 of bluetooth chipset 21, is used for the audio digital signals after output digit signals processor 212 is processed and receives the audio digital signals of inputting.
Described audio output interface 28 is used for the audio analog signals that the digital to analog converter 213 of bluetooth chipset 21 is exported is delivered to external loud speaker or earphone.
Described audio input interface 29 is for the analog to digital converter 214 of the audio analog signals input of external microphone being delivered to bluetooth chipset 21.
Radio-frequency (RF) transceiver 210 shown in Figure 2, base band microcontroller 211 also can not be integrated in the bluetooth chipset 21, and directly be integrated in the bluetooth module 2, base band microcontroller 211 can directly connect UART interface 25, communicate by UART interface 25 and ancillary equipment, base band microcontroller 211 also can directly not connect and drive memory 24 by external memory storage driving expansion interface 217.Digital signal processor 212 also can not be integrated in the bluetooth chipset 21, and directly is integrated in according to actual needs in the bluetooth module 2, perhaps is external in bluetooth module 2.In addition, digital to analog converter 213, analog to digital converter 214 also can be integrated in the bluetooth module 2 according to actual needs, perhaps are external in bluetooth module 2; Clock generator 22, radio-frequency filter 23, power supervisor 26 also can be external in bluetooth module 2 as required.
The information processing method of above-mentioned bluetooth module please refer to Fig. 3 A and 3B.
Please in conjunction with reference to figure 3A and Fig. 4, Fig. 3 A is that bluetooth module receives the message processing flow from the control command of communication interface, and the hardware of bluetooth module 4 shown in Figure 4 is corresponding with the hardware of bluetooth module shown in Figure 22.
Step S11 receives the control command from communication interface.Ancillary equipment (main frame 3) sends control command by host communication interface (UART interface) 31, bluetooth module communication interface 45 to the base band microcontroller 411 of bluetooth module 4.
Step S12 judges whether described control command needs to carry out mutual order with other bluetooth equipment, if, then carry out step S13, if not, then carry out step S14.Base band microcontroller 411 drives memory 44, carries out bluetooth module application program 440, judges whether the control command that receives needs to carry out mutual order with other bluetooth equipment.
Step S13 is converted to the HCI order with control command.If described control command is to carry out mutual order with other bluetooth equipment, carry out bluetooth module application program 440, control command is converted to corresponding HCI order, finish this message processing flow.HCI order through being converted to sends to other bluetooth equipment through HCI firmware 418 and the radio-frequency (RF) transceiver 410 of HCI driver 442, base band microcontroller 411.
Step S14 carries out control command.If described control command is not to carry out mutual order with other bluetooth equipment, carry out bluetooth module application program 440, judge the type of control command: if control command is relevant with the bottom hardware of bluetooth protocol repertory, then call HCI driver 442, finish the function of bluetooth bottom hardware by the HCI firmware 418 of base band microcontroller 411; If control command is relevant with intermediate protocol layer, the higher layer applications of bluetooth protocol repertory, then call Bluetooth protocol application program 441, finish the function of bluetooth intermediate protocol layer, higher layer applications; If control command is relevant with the hardware of bluetooth module, then carry out bluetooth module application program 440, the hardware of bluetooth module is operated (such as control PIO, pcm interface etc.).After executing control command, if there is response to occur, then carry out step S15; If response does not occur, then finish this message processing flow.
Step S15 is converted to the control command response with executing the response that produces after the control command.Carry out bluetooth module application program 440, bluetooth module application program 440 or Bluetooth protocol application program 441 are carried out the control command response that the response that produces after the control command is converted to correspondence.Control command response through being converted to is sent to the main frame microcontroller 30 of main frame 3 by bluetooth module communication interface 45, host communication interface 31 by base band microcontroller 411.
Please in conjunction with reference to figure 3B and Fig. 4, Fig. 3 B is that bluetooth module receives the message processing flow from the HCI order of radio-frequency (RF) transceiver 410, and the hardware of bluetooth module 4 shown in Figure 4 is corresponding with the hardware of bluetooth module shown in Figure 22.
Step S21 receives the HCI order from radio-frequency (RF) transceiver 410.The radio-frequency (RF) transceiver 410 of bluetooth module 4 receives the HCI order that other bluetooth equipment sends, and send to the HCI firmware 418 of base band microcontroller 411, base band microcontroller 411 drives memory 44, carries out HCI driver 442, and the HCI order that receives is resolved.
Step S22 judges whether described HCI order needs to carry out mutual order with main frame, if, then carry out step S23, if not, then carry out step S24.Carry out allocator 443, according to the analysis result of 442 pairs of HCI orders of HCI driver, judge whether the HCI order needs to carry out mutual order with main frame.
Step S23 is converted to the control event with the HCI order.If described HCI order is to carry out mutual order with main frame, then carry out bluetooth module application program 440, the HCI order is converted to corresponding control event, finish this message processing flow.Control event through being converted to is sent to the control event by bluetooth module communication interface 45, host communication interface 31 the main frame microcontroller 30 of main frame 3 by base band microcontroller 411.
Step S24 carries out the HCI order.If described HCI order is not to carry out mutual order with main frame, carry out allocator 443, analysis result according to 442 pairs of HCI orders of HCI driver, judge the type of HCI order: if the HCI order is relevant with the bottom hardware of bluetooth protocol repertory, then carry out bluetooth module application program 440, call HCI driver 442 by bluetooth module application program 440, and finished the function of bluetooth bottom hardware by base band microcontroller 411; If the HCI order is relevant with intermediate protocol layer, the higher layer applications of bluetooth protocol repertory, then carry out Bluetooth protocol application program 441, finish the function of bluetooth intermediate protocol layer, higher layer applications.After executing the HCI order, if there is response to occur, then carry out step S25; If response does not occur, then finish this message processing flow.
Step S25 is converted to the control command response with executing the response that produces after the HCI order.Carry out bluetooth module application program 440, the response that produces after bluetooth module application program 440 or the 441 execution HCI orders of Bluetooth protocol application program is converted to corresponding control command responds.Control command response through being converted to is sent to the main frame microcontroller 30 of main frame 3 by bluetooth module communication interface 45, host communication interface 31 by base band microcontroller 411.
In addition, change the event (for example PIO is drawn high) that produces because of the hardware state of bluetooth module, then also can carry out bluetooth module application program 440, the event that produces is converted to corresponding control event, and by bluetooth module communication interface 45, host communication interface 31 the control event is sent to the main frame microcontroller 30 of main frame 3 by base band microcontroller 411.
Use above-mentioned bluetooth module and can develop easily the bluetooth equipment with Bluetooth function, Fig. 4 is the system configuration schematic diagram of described bluetooth equipment, comprises main frame 3 and bluetooth module 4.
Main frame 3 is used for sending control command and receives control command response, control event.Host hardware comprises main frame microcontroller 30 and host communication interface 31.Store host application program 300 in the main frame microcontroller 30, main frame microcontroller 30 calls host application program 300, sends control command and receives control command response, control event to bluetooth module 4 by host communication interface 31.
Bluetooth module 4 is used for the control command that Receiving Host 3 sends, if the control command that main frame 3 sends is to carry out mutual order with other bluetooth equipment, then control command is converted to corresponding HCI order; If the control command that main frame 3 sends is not to carry out mutual order with other bluetooth equipment, then carry out control command.If have response to occur after executing control command, then will execute the response that produces after the control command and be converted to the control command response, and send to main frame 3.
Bluetooth module 4 also is used for receiving the HCI order that other bluetooth equipment sends, if the HCI that other bluetooth equipment sends order is to carry out mutual order with main frame 3, then the HCI order is converted to corresponding control event, and sends to main frame 3; If the HCI that other bluetooth equipment sends order is not to carry out mutual order with main frame 3, then carry out the HCI order, if have response to occur after executing the HCI order, then will execute the response that produces after the HCI order and be converted to the control command response, and send to main frame 3.
In addition, change the event that produces because of the hardware state of bluetooth module 4, also can the event that produce be converted to the control event of correspondence by bluetooth module 4, and send to main frame 3.
The hardware of bluetooth module 4 comprises radio-frequency (RF) transceiver 410, base band microcontroller 411, memory 44 and bluetooth module communication interface 45.Radio-frequency (RF) transceiver 410 is used for receiving and sending Bluetooth signal; Radio-frequency (RF) transceiver 410 and base band microcontroller 411 are finished the application of the bottom hardware agreement below HCI firmware 418 and the HCI; Store bluetooth module application program 440, Bluetooth protocol application program 441, HCI driver 442 and allocator 443 in the memory 44, base band microcontroller 411 connects and driving memory 44, control storage 44 is converted to corresponding HCI order with the control command that receives, the response that produces is converted to corresponding control command response, the HCI order is converted to corresponding control event, and realizes the application of the software protocol that HCI is above; Bluetooth module communication interface 45 is connected with host communication interface 31, is used for sending the control command that main frame 3 sends to described base band microcontroller 411 and control command response, control event that described base band microcontroller 411 is sent send main frame to.The bluetooth protocol repertory relevant with bluetooth all is integrated in the bluetooth module 4, and therefore, bluetooth module 4 can be realized various Bluetooth functions, comprises the application of the bottom hardware that HCI is following and the application of the software protocol more than the HCI.Bluetooth module communication interface 45 has identical standard with the host communication interface 31 of main frame 3, is used for transfer control order, control command response and control event, and in the present embodiment, host communication interface 31 and bluetooth module communication interface 45 all are the UART interfaces.
The bluetooth module 4 of the present embodiment also is integrated with clock generator, radio-frequency filter, power supervisor, pcm interface, audio output interface, audio input interface, digital signal processor, digital to analog converter, analog to digital converter, external memory storage and drives expansion interface, and bluetooth module among the particular hardware structure of the bluetooth module 4 among Fig. 4 and Fig. 22 is corresponding and be described in detail in the above.
Illustrate that below in conjunction with Fig. 4 and Fig. 5 A the main frame 3 of above-mentioned bluetooth equipment sends the message processing flow of control command to bluetooth module 4.
Step S31, main frame 3 sends control command to bluetooth module 4.The console controller 30 of main frame 3 sends control command by host communication interface 31, bluetooth module communication interface 45 to bluetooth module 4.
Step S32, bluetooth module 4 judges whether described control command needs to carry out mutual order with other bluetooth equipment, if, then carry out step S33, if not, then carry out step S34.The base band microcontroller 411 of bluetooth module 4 receives control command and drives memory 44, carries out bluetooth module application program 440, judges whether the control command that receives needs to carry out mutual order with other bluetooth equipment.
Step S33, bluetooth module 4 is converted to the HCI order with control command.If described control command is to carry out mutual order with other bluetooth equipment, carry out bluetooth module application program 440, control command is converted to corresponding HCI order, finish this message processing flow.HCI order through being converted to sends to other bluetooth equipment through HCI firmware 418 and the radio-frequency (RF) transceiver 410 of HCI driver 442, base band microcontroller 411.
Step S34, bluetooth module 4 is carried out control command.If described control command is not to carry out mutual order with other bluetooth equipment, carry out bluetooth module application program 440, judge the type of control command: if control command is relevant with the bottom hardware of bluetooth protocol repertory, then call HCI driver 442, finish the function of bluetooth bottom hardware by the HCI firmware 418 of base band microcontroller 411; If control command is relevant with intermediate protocol layer, the higher layer applications of bluetooth protocol repertory, then call Bluetooth protocol application program 441, finish the function of bluetooth intermediate protocol layer, higher layer applications; If control command is relevant with the hardware of bluetooth module, then carry out bluetooth module application program 440, the hardware of bluetooth module is operated (such as control PIO, pcm interface etc.).After executing control command, if there is response to occur, then carry out step S35; If response does not occur, then finish this message processing flow.
Step S35, bluetooth module 4 will execute the response that produces after the control command and be converted to the control command response.Carry out bluetooth module application program 440, bluetooth module application program 440 or Bluetooth protocol application program 441 are carried out the control command response that the response that produces after the control command is converted to correspondence.
Step S36, bluetooth module 4 sends the control command response to main frame 3.Control command response through being converted to is sent to the main frame microcontroller 30 of main frame 3 by bluetooth module communication interface 45, host communication interface 31 by the base band microcontroller 411 of bluetooth module 4.
Illustrate that below in conjunction with Fig. 4 and Fig. 5 B the bluetooth module 4 of above-mentioned bluetooth equipment sends the message processing flow of control command response, control event to main frame 3.
Step S41, bluetooth module 4 receives the HCI order.The radio-frequency (RF) transceiver 410 of bluetooth module 4 receives the HCI order that other bluetooth equipment sends, and send to the HCI firmware 418 of base band microcontroller 411, base band microcontroller 411 drives memory 44, carries out HCI driver 442, and the HCI order that receives is resolved.
Step S42, bluetooth module 4 judge whether described HCI order needs to carry out mutual order with main frame 3, if, then carry out step S43, if not, then carry out step S45.Carry out allocator 443, according to the analysis result of 442 pairs of HCI orders of HCI driver, judge whether the HCI order needs to carry out mutual order with main frame 3.
Step S43, bluetooth module 4 is converted to the control event with the HCI order.If described HCI order is to carry out mutual order with main frame, then carry out bluetooth module application program 440, the HCI order is converted to corresponding control event.
Step S44, bluetooth module 4 sends the control event to main frame 3.The base band microcontroller 411 of bluetooth module 4 sends to the control event by bluetooth module communication interface 45, host communication interface 31 the main frame microcontroller 30 of main frame 3, finishes this message processing flow.
Step S45, bluetooth module 4 is carried out the HCI order.If described HCI order is not to carry out mutual order with main frame 3, carry out allocator 443, analysis result according to 442 pairs of HCI orders of HCI driver, judge the type of HCI order: if the HCI order is relevant with the bottom hardware of bluetooth protocol repertory, then carry out bluetooth module application program 440, call HCI driver 442 by bluetooth module application program 440, and finished the function of bluetooth bottom hardware by base band microcontroller 411; If the HCI order is relevant with intermediate protocol layer, the higher layer applications of bluetooth protocol repertory, then carry out Bluetooth protocol application program 441, finish the function of bluetooth intermediate protocol layer, higher layer applications.After executing the HCI order, if there is response to occur, then carry out step S46; If response does not occur, then finish this message processing flow.
Step S46, bluetooth module 4 will execute the response that produces after the HCI order and be converted to the control command response.Carry out bluetooth module application program 440, the response that produces after bluetooth module application program 440 or the 441 execution HCI orders of Bluetooth protocol application program is converted to corresponding control command responds.
Step S47, bluetooth module 4 sends the control command response to main frame 3.Control command response through being converted to is sent to the main frame microcontroller 30 of main frame 3 by bluetooth module communication interface 45, host communication interface 31 by the base band microcontroller 411 of bluetooth module 4.
In addition, change the event (for example PIO is drawn high) that produces because of the hardware state of bluetooth module 4, then also can carry out bluetooth module application program 440, the event that produces is converted to corresponding control event, and by bluetooth module communication interface 45, host communication interface 31 the control event is sent to the main frame microcontroller 30 of main frame 3 by the base band microcontroller 411 of bluetooth module 4.
In sum, the bluetooth module of technique scheme to the periphery equipment (main frame) interface of the response of control command, control command and control event is provided and in bluetooth module, realizes control command and the conversion of HCI order, carry out the response and the conversion of control command response and the conversion of HCI order and control event that produce after control command, the HCI order; Bluetooth module has been gathered bluetooth protocol repertory (comprising bottom hardware, HCI, intermediate protocol layer and higher layer applications) simultaneously, has realized the application of the bottom hardware that HCI is following and the application of the software protocol more than the HCI.Therefore, when using above-mentioned bluetooth module exploitation bluetooth equipment, the main frame of bluetooth equipment just can be controlled bluetooth module by control command, control command response and control event and realize various Bluetooth functions.Because the application (bluetooth protocol repertory) relevant with bluetooth all is integrated in the bluetooth module, bluetooth module can be common to the exploitation of various bluetooth equipments, development technique personnel do not need to be grasped the ins and outs of HCI, bluetooth protocol repertory and application framework, just can develop at short notice the bluetooth equipment with Bluetooth function and only need grasp simple control command, control command response and control event; And when the new function of exploitation bluetooth equipment, the control command that only need to increase in the application program of main frame corresponding Bluetooth function gets final product, and has so also just reduced the difficulty of exploitation and design.
In addition, because the main frame of bluetooth equipment only need send simple control command and receive simple control command response, control event, do not need to realize bluetooth software agreement and application program thereof, thus not high for the controller requirement of main frame yet, and the microcontroller that normal operation is 8 just can be realized.Therefore, technique scheme has simplified design, shortens the development time, saves exploitation and design cost, the raising research and development of products is to the advantages such as speed in market.
Although the present invention with preferred embodiment openly as above; but it is not to limit the present invention; any those skilled in the art without departing from the spirit and scope of the present invention; can make possible change and modification, so protection scope of the present invention should be as the criterion with the scope that claim of the present invention was defined.