Presentation is loading. Please wait.

Presentation is loading. Please wait.

EMB321 How To Write A Windows CE SDIO Client

Similar presentations


Presentation on theme: "EMB321 How To Write A Windows CE SDIO Client"— Presentation transcript:

1 EMB321 How To Write A Windows CE SDIO Client
4/19/2017 6:39 PM EMB321 How To Write A Windows CE SDIO Client Jay Loney - Program Manager Steve Schrock – Software Engineer Windows CE Microsoft Corporation © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

2 4/19/2017 6:39 PM © 2004 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

3 OEM Hardware and Standard Drivers Standard PC Hardware and Drivers
4/19/2017 6:39 PM Hardware/Drivers OEM/IHV Supplied BSP (ARM, SH4, MIPS) OEM Hardware and Standard Drivers Standard PC Hardware and Drivers Windows XP DDK Device Building Tools Platform Builder Windows Embedded Studio Data Lightweight Relational EDB SQL Server 2005 Express Edition SQL Server 2005 Mobile Edition SQL Server 2005 Native Managed Server Side Win32 Programming Model MFC 8.0, ATL 8.0 .NET Compact Framework .NET Framework ASP.NET Mobile Controls ASP.NET Multimedia Windows Media DirectX Location Services MapPoint Development Tools Visual Studio 2005 Internet Security and Acceleration Server Communications & Messaging Exchange Server Live Communications Server Speech Server Device Update Agent Management Tools Image Update Software Update Services Systems Management Server Microsoft Operations Manager © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

4 Overview CE SDIO Stack Features What does the CE stack look like?
4/19/2017 6:39 PM Overview CE SDIO Stack Features What does the CE stack look like? How to write a client Bluetooth code walkthrough © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

5 SDIO Support In CE 5.0 Dynamic insert/remove
4/19/2017 6:39 PM SDIO Support In CE 5.0 Dynamic insert/remove DMA (optional in standard host spec, platform dependent) SDIO interrupts Dynamic clock control Error recovery Wake-up Power will be handled using CE Power Manager Clients may be power-managed and tell the controller to put its slot into a different power state Multi-function and Combo devices Also support MMC v3.0 basic functionality In the next Windows Mobile release we’re adding: Support MMC v4.0 basic functionality Performance enhancements for single block cards © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

6 4/19/2017 6:39 PM The Secure In SD SDA SD Memory specification provides a mechanism to lock content to a specific machine We are not providing a block driver supporting it in 5.0 release explicitly. SDBus does allow you to build your own though Digital Rights Management (DRM) for all of CE is being supplied by a filesystem filter driver at a level above the SD Memory block driver © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

7 CE 5.0 SDIO Architecture Client Drivers Host Software Stack Hardware
4/19/2017 6:39 PM CE 5.0 SDIO Architecture FatFS Location Services Client Drivers SDIO GPS Client Driver SD Memory (block driver) SDBus Driver Host Software Stack SD Host Driver SD Host Controller Hardware SD Memory Card SDIO GPS Card © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

8 SD Bus Driver Enumerates cards to determine if MMC, SD Memory or SDIO
4/19/2017 6:39 PM SD Bus Driver Enumerates cards to determine if MMC, SD Memory or SDIO Determines voltage to use for card Loads clients based on registry values Queues bus requests Queues asynchronous notifications from host controller Bus request completion, SDIO interrupts, device insertion/removal Performs error handling with retry © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

9 Standard Host Controller
4/19/2017 6:39 PM Standard Host Controller SDA Host Working Group (MSFT executive member) Defined Standard Host Register Specification to standardize hardware interface from bus to controller Currently ratified to v1.0 by SDA executive committee MSFT strongly advocating this standard to all IHVs, ODMs, OEMs and Silicons Also support for PXa270, OMAP730, SMDK2410 © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

10 Compatibility With SDIO Now!
4/19/2017 6:39 PM Compatibility With SDIO Now! BSquare has an install base PPCs on the market today Target was to maintain client driver compatibility to ensure smooth transition of marketplace Have verified we’re compatible using SDIO Now! Client Drivers compiled into x86 running on CEPC w/ Standard Host Controllers © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

11 Windows CE Provided Clients
4/19/2017 6:39 PM Windows CE Provided Clients SD Memory (MMC support verified) SDIO Bluetooth Type A class SDIO GPS class SDIO WiFi (vendor specific) © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

12 How To Write A Client Driver
4/19/2017 6:39 PM How To Write A Client Driver Client Driver model Registry loads driver Checklist of functions © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

13 Client Driver Model Streams interface for API
4/19/2017 6:39 PM Client Driver Model Streams interface for API Init, Deinit are the only ones strictly required Suggested use of Open, Close, Read, Write, IOControl, PowerUp/Down as appropriate © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

14 Registry Entries Custom Driver: [HKEY_LOCAL_MACHINE\Drivers
4/19/2017 6:39 PM Registry Entries Custom Driver: [HKEY_LOCAL_MACHINE\Drivers \SDCARD\ClientDrivers\Custom \MANF-02DB-CARDID-0002-FUNC-1] "Dll"=“mydriver.dll" "Prefix"=“XXX“ Class Driver: \SDCARD\ClientDrivers\Class\SDIO_Class\3] "Dll"=“bthsdio.dll" "Prefix"=“BSD“ SD Memory and MMC have special class keys as well © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

15 MANF, CARDID And FUNC For custom SDIO cards
4/19/2017 6:39 PM MANF, CARDID And FUNC For custom SDIO cards MANF is the four digit hexadecimal value of the Manufacturer ID CARDID is the four digit hexadecimal value of the Card ID FUNC is the decimal value of the card function number for which the driver is being loaded © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

16 4/19/2017 6:39 PM Checklist Get SDA specs and card manufacturer specs. Use Bluetooth driver as an example XXX_Init() Get the unique identification handle for the client © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

17 4/19/2017 6:39 PM SDGetDeviceHandle Takes in device initialization context passed back from XXX_Init and registry path Return Value: SD_DEVICE_HANDLE This device handle is passed to every other SD Bus API © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

18 4/19/2017 6:39 PM Checklist Create a function to receive asynchronous slot state change notifications Register the client driver with the SD Bus driver [SDIO] Enable the SDIO function [SDIO] Determine which function on the card the driver is associated with © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

19 Slot Events Recommended SlotEventCallBack()
4/19/2017 6:39 PM Slot Events Recommended SlotEventCallBack() Provides Asynchronous info about changes in slot state Example: SDCardEjected © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

20 4/19/2017 6:39 PM SDRegisterClient Fill in structure with the local device context, slot event callback, and a friendly name Friendly name used for debug output After successful registration, all other SD Bus APIs may be called © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

21 SDSetCardFeature Configures the card SD_IO_FUNCTION_ENABLE
4/19/2017 6:39 PM SDSetCardFeature Configures the card SD_IO_FUNCTION_ENABLE SD_IO_FUNCTION_DISABLE SD_IO_FUNCTION_SET_BLOCK_SIZE SD_SET_CARD_INTERFACE Sets both the bus width and the bus clock frequency © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

22 SDCardInfoQuery Provides information about card and host controller
4/19/2017 6:39 PM SDCardInfoQuery Provides information about card and host controller Function number Host controller maximum block size Current bus clock and width Address of function’s SDIO CIS region Parsed card register structures CSD CID DSR RCA SCR © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

23 Code Sample – Initialization
4/19/2017 6:39 PM Code Sample – Initialization public\common\oak\drivers\sdcard sdclientdrivers\bluetooth\bthsdio.cpp CSdioDevice::Attach() © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

24 4/19/2017 6:39 PM © 2004 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

25 Checklist Retrieve the host controller’s max block size
4/19/2017 6:39 PM Checklist Retrieve the host controller’s max block size Use SDCardInfoQuery [SDIO] Retrieve the function’s max block size from the card tuples Use the smaller maximum block size [SDIO] Set the block size on the card Use SDSetCardFeature © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

26 SDGetTuple Simplifies reading tuples from the CIS
4/19/2017 6:39 PM SDGetTuple Simplifies reading tuples from the CIS Information residing in tuples: Maximum block size Power draw Manufacturer code © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

27 Code Sample Maximum Block Size
4/19/2017 6:39 PM Code Sample Maximum Block Size CSdioDevice::GetMaxBlockLen() © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

28 Checklist [SDIO] Determine if the card supports multi-block transfers
4/19/2017 6:39 PM Checklist [SDIO] Determine if the card supports multi-block transfers Read from CCCR [SDIO] Create and register a function to receive interrupt notifications Transfer data via Bus Requests… © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

29 4/19/2017 6:39 PM SDIO Interrupts Card notifies driver of Asynchronous events via SDIO interrupts SDIOConnectInterrupt() to register for a callback Client must clear the interrupt before exiting callback Return SD_API_STATUS_SUCCESS © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

30 Code Sample – Interrupts
4/19/2017 6:39 PM Code Sample – Interrupts CSdioDevice::SDIOIsrCallBack() CSdioDevice::SDIOIsrCallback_Int() © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

31 Touching Card Registers
4/19/2017 6:39 PM Touching Card Registers SDReadWriteRegistersDirect() – for multiple single-byte transfers Single-byte transfers are slow so try to avoid them Used for doing things like: Determining if the card is multi-block capable (CCCR) Clearing and enabling card specific interrupt settings Setting card specific modes Read if data is available © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

32 Read/Write – Bus Requests
4/19/2017 6:39 PM Read/Write – Bus Requests Client driver interacts with the card via the Bus driver using Bus Requests. These requests pass the SD CMD to the card Sync – must wait for response before issuing subsequent commands SDSynchronousBusRequest() Async – subsequent commands are queued by Bus driver. You must free the bus request after completion SDBusRequest() Second parameter of both is the SD Command SDCancelBusRequest() © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

33 4/19/2017 6:39 PM Sync Versus Async Async helps the most when sending many small blocks (Not multi-block) Async will always be at least as fast or faster then Sync If you submit a bunch of async requests, they’ll be queued by the bus driver, good because bus driver optimizes bus activity Sync is easier to program, less logic in client © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

34 Issuing An SDIO Command
4/19/2017 6:39 PM Issuing An SDIO Command CMDs are listed in the SDA specifications You should build the arguments via Macros Two macros that build the complex command statements for you: BUILD_IO_RW_DIRECT_ARG() BUILD_IO_RW_EXTENDED_ARG() Call SDSynchronousBusRequest() or SDBusRequest() with the command argument © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

35 Code Sample – Transfers
4/19/2017 6:39 PM Code Sample – Transfers CSdioDevice::SDSend() Synchronous CSdioDevice::SDRecv() Asynchronous © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

36 4/19/2017 6:39 PM Call To Action Write a CE driver for your SDIO Hardware and sell more chips Become a member of the Driver Developer program ce/drivers/driverdev/default.aspx Advertise your driver on our web site of supported drivers ce/drivers/supdrivers/default.aspx Contact Microsoft.com © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

37 While at MEDC 2005… Fill out an evaluation for this session
4/19/2017 6:39 PM While at MEDC 2005… Fill out an evaluation for this session Randomly selected instant WIN prizes! Visit the Microsoft Product Pavilion in the Exhibit Hall Shorelines B Use real technology in a lab Instructor led Reef E/F & Breakers L Self-paced Reef B/C © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

38 After The Conference… Build Develop Install
4/19/2017 6:39 PM After The Conference… Build Install Build Join Full-featured trial versions of Windows CE and/or Windows XP Embedded Cool stuff & tell us about it: msdn.microsoft.com/embedded/community Windows Embedded Partner Program: Develop Install Enter Join Windows Mobile 5.0 Eval Kit including Visual Studio 2005 Beta 2 Mobile2Market Contest and win up to $25000: mobile2marketcontest.com Microsoft Solutions Partner Program: partner.microsoft.com © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

39 Tools & Resources Build Develop Websites Newsgroups Blogs Tools
4/19/2017 6:39 PM Tools & Resources Build Develop Websites msdn.microsoft.com/ embedded msdn.microsoft.com/ mobility Newsgroups microsoft.public windowsxp.embedded windowsce.platbuilder windowsce.embedded.vc microsoft.public pocketpc.developer smartphone.developer dotnet.framework.compactframework Blogs blogs.msdn.com/ mikehall blogs.msdn.com/ windowsmobile vsdteam netcfteam Tools Windows CE 5.0 Eval Kit Windows XP Embedded Eval Kit Windows Mobile 5.0 Eval Kit © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

40 4/19/2017 6:39 PM © 2004 Microsoft Corporation. All rights reserved.
This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.

41 © 2005 Microsoft Corporation. All rights reserved.
4/19/2017 6:39 PM © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. © 2004 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.


Download ppt "EMB321 How To Write A Windows CE SDIO Client"

Similar presentations


Ads by Google