Bluetooth serial driver implemented in Windows CE

Source: Internet
Author: User

Windows CE bluetooth Serial driver is implemented in


[ Date:2006-10-19]

Source: Internet Author: anon

[ font: big medium small ]

Windows CEAs a kind of typicalEmbeddedOperating system, by porting Bluetooth applications toWidows CE, for examplepsos+、Nucleusand otherEmbeddedSystem, which is of typical significance. BecauseOBEXThe file transfer application is based on theRFCOMMImplementation of the Bluetooth simulation on the serial port, this paper introducesOBEXImplementation of Bluetooth virtual serial port driver for file transfer.
  
   1 Windows CE device driver Overview
  
   Windows CEsupports a wide range of basedCEThe device driver for the platform. Currently, it provides four device models, two of which are dedicated toWindows CEModel, and the other two external models come from other operating systems. Based onWindows CEThe two models are native device drivers and flow interface drivers. Two external models are used for the Universal Serial bus (USB) and network drive Interface standards (NDIS) driver.
  
Because the Bluetooth protocol is a wireless technology in the simulation of the serial port, BluetoothOBMany applications of ex are based on the Bluetooth emulation serial port. and the flow interface driver through a set of flow interface functions so that the application can be through the file system of special files and interface with the device, so the function of Bluetooth simulation serial port is more suitable for the flow interface driver structure.
    V:f eqn= "sum @0 1 0" >
  
   2 Implementation of Bluetooth serial port driver under Windows CE
  
Although the implementation of Bluetooth device driver is designed with flow interface driver, because the basic structure and principle of two kinds of drivers are similar, the realization principle of Bluetooth device driver can be understood more clearly after starting from the structure of native device driver.
  
   2. 1 native device driver structure
  
Windows CEThere are two types of sample device drivers included: single-chip drivers (monolithic Device Driver) and layered drivers (layered Devicedriver)。 The monolithic driver is based on a single piece of code, which transmits the functionality of the hardware device directly to the operating system through the device driver interface. A layered driver consists of two layers, compared to a monolithic driver: The upper layer is a model device driver (MDD), and the underlying driver (PDD) is dependent on the platform. This article uses a layered driver to connect the Bluetooth hardware and file transfer applications above. Figure 1 illustrates how both of the drivers are in the Windows CEIntegrated in the operating system.
  
The device driver Interface (DDI) is a set of functions that are implemented in MDD, where the Gwes module invokes the device driver, and the device driver Server Provider Interface (DDSI) is a set of functions implemented in PDD and invoked by MDD. Since Microsoft provides all the source code associated with the MDD module, there is no need to make any changes to this section by simply linking its PDD module with the MDD module chain into a common repository.
  
Having understood the structure of the native device driver, it is easy to see from Figure 1 to the right that the streaming interface driver simply uses the flow interface as their DDI. In this case, you do not need to connect these drivers with the Gwes module. They exist as normal DLLs and are invoked as needed.
  
   2.2 Bluetooth simulation serial driver Implementation
  
Bluetooth simulation serial port is a Bluetooth RFCOMM protocol to achieve wireless serial communication without cable, and the same as the local device driver, the realization of the flow interface of the serial driver only need to implement the Bluetooth PDD module.
  
The PDD module consists of four parts: the first part is all the DDSI interfaces that must be implemented by itself; The second part is the Bluetooth protocol stack including FRCOMM, SDP, L2cap and HCI entities; The third part is the HCI transport layer is connected to the Bluetooth hardware via UART or USB interface. The last part is a graphical interface and a control port module for Bluetooth applications, which is used to initialize the entire stack, Bluetooth hardware initialization, search for nearby Bluetooth devices, and discover services on the specified device. As shown in Figure 2.
  
In the system structure of the Bluetooth emulation serial driver shown in Figure 2, the device management program is the user layer program, based on the Windows CEOn the platform and kept running. Device Manager is not part of the kernel, but it is a separate section that interacts with the kernel, registry, and note interface driver DLLs. It mainly performs the following tasks:
  
   hwobj bluetoothobj={/*Description of Bluetooth simulation serial port characteristics*/
  
(pdevice_list)&serdl,
  
   thread_in_pdd,/*Interrupt handling All byPDDLayer Processing*/
  
   0,
  
   NULL,
  
(Phw_vtbl)&bluetoothvtbl/*Contains all the standard serial ports that need to be implementedDdsiList of functions*/
  
   };
  
   hwobj bluetoothctrlobj={/*Describes Bluetooth control port features*/
  
(pdevice_list)&serdl,
  
   THREAD_IN_PDD,
  
   0,
  
   NULL,
  
   (PHW_VTBL) &ctrlvtb1
  
   };
  
   phwobj rgphwobjects[]={/*Contains twoPDDAn array of instances*/
  
   &bluetoothobj,
  
   &bluetoothctrlobj
  
   };
  
   device_list serdl={/*All serial devices in the storage device driver*/
  
   "CESerial.dll",/*The name of the serial driver*/
  
   sizeof (rgphwobjects)/sizeof (phwobj),/*Number of serial devices*/
  
   reghwobjects
  
   };
  
   pdevice_list Getserialobject (VOID)
  
   {
  
   Return (&SERDL);
  
   }
  
  
After registering two serial devices in serial driver, it is necessary to realize these twoPDDThe flow interface function corresponding to the instance. Microsoft for the serial port to be implementedPDDmodule provides aHwobj(Haredware ObjectType of serial object table, which lists all interface function pointers that implement serial port drivers. See the following description:
  
   typedef struct _hw_vtbl{
  
   pvoid (*hwinit) (ULONG identifier,pvoid pmddcon-text,phwobj phwobj);
  
   . ..,
  
   . ..,
  
   BOOL(*hwioct1)(pvoid Phead,dword Dwcode,
  
   pbyte Pbufin,dword dwlenin,pbyte Pbufout,dword
  
   dwlenout,pdwordpdwactualout);
  
   } hw_vtbl,*phw_vtbl;
  
The user modifies the serial port byPDDThe Serial object table changes the set of functions or function names. The following structureBluetoothvtblThe definition of Bluetooth simulation serial portDdsiThe name of the function.
  
   Const hw_vtbl bluetoothvtbl={
  
   Bluetoothinitserial,
  
   . ..,
  
   . ..,
  
   Bluetoothioctl
  
   };
  
Same with structural variablesCtrlvtblthat defines the control port.DdsiList of function names. Since this serial device is used for internal implementation special functions, the following lists only the main function names that need to be cared for.
  
   Const hw_vtbl ctrlvtbl={
  
   Ctrlinitserial,
  
   Ctrldeinit,
  
   Ctrlopen,
  
   Ctrlclose,
  
   . ..,
  
   . ..,
  
   Ctrlioctl
  
   };
  
Bluetooth as an engine to drive the new economy, will beEmbeddedSystem-oriented"AfterPCMachine"The advent of the Times has great impetus, and it will also face from the elephantIrDA、802.11、HomeRFThe challenges of wireless communication technology. and willOBEXSuccessful introduction of Bluetooth, so that inEmbeddedIt is possible to transfer files, synchronization and printing applications on Bluetooth communication devices under the system, so it plays an important role in Bluetooth.



</

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.