diff --git a/.appveyor.yml b/.appveyor.yml index 3e5f481b2..56578798d 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -39,7 +39,7 @@ clone_depth: 10 install: - cmd: Bcdedit.exe -set TESTSIGNING ON # Configure logging - - cmd: reg import .appveyor\ThreadEtw.reg + - cmd: reg import tools\windows\ThreadEtw.reg - ps: Restart-Computer -Force - ps: Start-Sleep -s 10 before_build: @@ -58,7 +58,7 @@ test_script: # Run the unit tests - cmd: .appveyor\run_unit_tests.cmd # Run the tests for the driver (only runs on x64) - - cmd: .appveyor\test_driver.cmd + #- cmd: .appveyor\test_driver.cmd artifacts: - path: release name: release diff --git a/.appveyor/make_release.cmd b/.appveyor/make_release.cmd index e7bdddc8d..3ec5449c4 100644 --- a/.appveyor/make_release.cmd +++ b/.appveyor/make_release.cmd @@ -28,12 +28,26 @@ REM pushd %APPVEYOR_BUILD_FOLDER% -REM Make the release directory +REM Make the release directories mkdir release +mkdir release\include +mkdir release\include\commissioning +mkdir release\include\missing +mkdir release\include\platform mkdir release\libs mkdir release\symbols mkdir release\symbols\TraceFormat +REM Copy the relavant include headers + +copy include\openthread.h release\include +copy include\openthread-types.h release\include +copy include\commissioning\commissioner.h release\include\commissioning +copy include\commissioning\joiner.h release\include\commissioning +copy include\platform\toolchain.h release\include\platform +copy src\missing\stdbool\stdbool.h release\include\missing +copy src\missing\stdint\stdint.h release\include\missing + REM Copy the relavant binaries copy build\bin\%Platform2%\%Configuration%\sys\otlwf\* release @@ -53,6 +67,12 @@ copy build\bin\%Platform2%\%Configuration%\exe\otCli.pdb release\symbols copy build\bin\%Platform2%\%Configuration%\exe\otTestRunner.exe release copy build\bin\%Platform2%\%Configuration%\exe\otTestRunner.pdb release\symbols +REM Copy the tools + +copy tools\windows\* release +copy tools\windows\%Platform%\otInstall.exe release +copy "C:\Program Files (x86)\Windows Kits\10\Tools\%Platform%\devcon.exe" release + REM Generate the trace format files to decode the WPP logs "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\x64\TracePdb.exe" -f release\symbols\*.pdb -p release\symbols\TraceFormat diff --git a/doc/images/windows_design.png b/doc/images/windows_design.png index bfd3e4eed..c5fa3438e 100644 Binary files a/doc/images/windows_design.png and b/doc/images/windows_design.png differ diff --git a/examples/drivers/windows/README.md b/examples/drivers/windows/README.md index e475f71a3..9d1e9c911 100644 --- a/examples/drivers/windows/README.md +++ b/examples/drivers/windows/README.md @@ -31,85 +31,24 @@ It plugs into the networking stack, binding to a protocol driver (TCPIP) at the at the bottom. It's job is to take IPv6 packets from TCPIP and pass the necessary data down to the Miniport in order to send the packets out over the network. -`otLwf.sys` supports operating in two modes: Full Stack and Tunnel. Full Stack mode is where OpenThread is -running on the host (in Windows) and a simple radio device is connected externally. Tunnel mode is where +`otLwf.sys` supports operating in two modes: Full Stack and Tunnel. Full Stack mode is where OpenThread is +running on the host (in Windows) and a simple radio device is connected externally. Tunnel mode is where OpenThread is running on the external device and Windows is merely a pass through for commands and packets. -In Full Stack mode, `otLwf.sys` hosts the OpenThread core library and manages serializing all Windows -networking inputs to the OpenThread APIs. It maintains one dedicated worker thread for running all -OpenThread related logic, including IOCTL commands, data packets, and basic OpenThread processing logic. -`otLwf.sys` uses [OID][oid]s to send control path commands (channel, panid, etc.) and [NBL][nbl]s to send and -receive the 802.15.4 data packets to/from the miniport. The miniport then passes this information, in the -proper format, off to the radio device. +In both cases, `otLwf.sys` uses the Spinel command interface for interacting with the connected device. When operating +in Full Stack mode, `otLwf.sys` uses only the low level PHY/MAC commands. In Tunnel mode, it uses the higher layer +Spinel commands and lets the device manage the actual Thread stack. -In Tunnel mode, `otLwf.sys` mainly just manages the serialization of Windows networking inputs to -Spinel commands (and back). The Spinel commands are passed down (in [NBL][nbl]s) to the miniport which will then pass -the commands (correctly encoded) to whatever device is externally connected. +### ottmp.sys ### -### 802.15.4 PHY Miniport ### +This is the component responsible passing the Spinel commands from `otLwf.sys` down to the device. It is responsible +for abstracting the actual mechanism (USB, Serial, SPI) used for communicating with the device. It handles the device +arrival/removal and the encoding/decoding of data when communicating with it. The current implementation only handles +Serial devices. -This is the component responsible for taking the [OID][oid]s and [NBL][nbl]s from `otLwf.sys` and sending the -information down to the matching 802.15.4 PHY Device, in the proper format. In other words, it's job is mainly -handling the arrival/removal of the physical device and serialization of the info in the proper format for -the device it's paired with. +### Device ### -### Thread Miniport ### - -This is the component for taking the [NBL][nbl]s, containing Spinel commands, from `otLwf.sys` and sending them -down to the matching OpenThread (NCP) Device. Again, like the PHY miniport, it's job is handling device arrival/removal -and command serialization. - -### 802.15.4 PHY Device ### - -This is a 'simple' device, exposing a mostly PHY layer interface (with a few MAC layer constructs). - -### OpenThread (NCP) Device ### - -This is a 'full solution' device, that exposes the entire OpenThread interface via NCP. - -## Build ## - -Open the Visual Studio Solution `openthread.sln` under `etc\visual-studio` and then pick the -configuration and platform you wish to build for. For instance, `Release` and `x64`. Build -the whole solution (F6). This will output the files here: - -``` -build\bin\\ -``` - -## Install ## - -### Filter Driver ### - -1. Copy the following files to a temporary location on the target machine: - -``` -build\bin\\\sys\otLwf.cer -build\bin\\\sys\otLwf\otLwf.cat -build\bin\\\sys\otLwf\otLwf.inf -build\bin\\\sys\otLwf\otLwf.sys -``` - -2. Open an admin command prompt in the location of the temporary files. - -3. Install the certificate to the root and TrustedPublisher store by running: - -``` -certutil -addstore root otLwf.cer -certutil -addstore TrustedPublisher otLwf.cer -``` - -4. Install the driver by running: - -``` -netcfg.exe -v -l otlwf.inf -c s -i otLwf -``` - -### Miniport Driver ### - -`TODO` - -## Controlling OpenThread from an Application ## - -`TODO` +Windows supports OpenThread devices that implement the Spinel protocol. It supports devices that support either the raw +link-layer PHY/MAC commands and devices that support the Thread commands (and devices that support both). By default, +Windows will operate in Full Stack mode, only sending raw link-layer commands. diff --git a/.appveyor/ThreadEtw.reg b/tools/windows/ThreadEtw.reg similarity index 71% rename from .appveyor/ThreadEtw.reg rename to tools/windows/ThreadEtw.reg index 84cc36d4a..fd3804c6e 100644 Binary files a/.appveyor/ThreadEtw.reg and b/tools/windows/ThreadEtw.reg differ diff --git a/tools/windows/arm/otinstall.exe b/tools/windows/arm/otinstall.exe new file mode 100644 index 000000000..67b498a8f Binary files /dev/null and b/tools/windows/arm/otinstall.exe differ diff --git a/tools/windows/install_cc2538.cmd b/tools/windows/install_cc2538.cmd new file mode 100644 index 000000000..3a39f6ad4 --- /dev/null +++ b/tools/windows/install_cc2538.cmd @@ -0,0 +1,30 @@ +REM +REM Copyright (c) 2016, The OpenThread Authors. +REM All rights reserved. +REM +REM Redistribution and use in source and binary forms, with or without +REM modification, are permitted provided that the following conditions are met: +REM 1. Redistributions of source code must retain the above copyright +REM notice, this list of conditions and the following disclaimer. +REM 2. Redistributions in binary form must reproduce the above copyright +REM notice, this list of conditions and the following disclaimer in the +REM documentation and/or other materials provided with the distribution. +REM 3. Neither the name of the copyright holder nor the +REM names of its contributors may be used to endorse or promote products +REM derived from this software without specific prior written permission. +REM +REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +REM ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +REM LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +REM CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +REM SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +REM INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +REM CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +REM ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +REM POSSIBILITY OF SUCH DAMAGE. +REM + +devcon update ftdibus.inf "USB\VID_0403&PID_A6D1*" +devcon update ftdiport.inf FTDIBUS\VID_0403+PID_A6D1 \ No newline at end of file diff --git a/tools/windows/install_otlwf.cmd b/tools/windows/install_otlwf.cmd new file mode 100644 index 000000000..4207c9451 --- /dev/null +++ b/tools/windows/install_otlwf.cmd @@ -0,0 +1,42 @@ +REM +REM Copyright (c) 2016, The OpenThread Authors. +REM All rights reserved. +REM +REM Redistribution and use in source and binary forms, with or without +REM modification, are permitted provided that the following conditions are met: +REM 1. Redistributions of source code must retain the above copyright +REM notice, this list of conditions and the following disclaimer. +REM 2. Redistributions in binary form must reproduce the above copyright +REM notice, this list of conditions and the following disclaimer in the +REM documentation and/or other materials provided with the distribution. +REM 3. Neither the name of the copyright holder nor the +REM names of its contributors may be used to endorse or promote products +REM derived from this software without specific prior written permission. +REM +REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +REM ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +REM LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +REM CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +REM SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +REM INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +REM CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +REM ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +REM POSSIBILITY OF SUCH DAMAGE. +REM + +REM Install the API +copy otapi.dll %SystemRoot%\System32 + +REM Install the certifications to the cert stores +certutil -addstore root otLwf.cer +certutil -addstore TrustedPublisher otLwf.cer + +REM Start ETW logging (requires reboot) +reg.exe import ThreadEtw.reg + +REM Install the driver +copy otlwf.sys %SystemRoot%\System32\drivers +sc.exe create otlwf binPath= \SystemRoot\system32\drivers\otlwf.sys type= kernel start= system group= NDIS displayname= "OpenThread NDIS LightWeight Filter" +otInstall.exe -i \ No newline at end of file diff --git a/tools/windows/install_ottmp.cmd b/tools/windows/install_ottmp.cmd new file mode 100644 index 000000000..5324d66d7 --- /dev/null +++ b/tools/windows/install_ottmp.cmd @@ -0,0 +1,33 @@ +REM +REM Copyright (c) 2016, The OpenThread Authors. +REM All rights reserved. +REM +REM Redistribution and use in source and binary forms, with or without +REM modification, are permitted provided that the following conditions are met: +REM 1. Redistributions of source code must retain the above copyright +REM notice, this list of conditions and the following disclaimer. +REM 2. Redistributions in binary form must reproduce the above copyright +REM notice, this list of conditions and the following disclaimer in the +REM documentation and/or other materials provided with the distribution. +REM 3. Neither the name of the copyright holder nor the +REM names of its contributors may be used to endorse or promote products +REM derived from this software without specific prior written permission. +REM +REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +REM AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +REM IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +REM ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +REM LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +REM CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +REM SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +REM INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +REM CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +REM ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +REM POSSIBILITY OF SUCH DAMAGE. +REM + +REM Install the certifications to the cert stores +certutil -addstore root ottmp.cer +certutil -addstore TrustedPublisher ottmp.cer + +devcon install ottmp.inf root\ottmp \ No newline at end of file diff --git a/tools/windows/x64/otinstall.exe b/tools/windows/x64/otinstall.exe new file mode 100644 index 000000000..7dccb4db4 Binary files /dev/null and b/tools/windows/x64/otinstall.exe differ diff --git a/tools/windows/x86/otinstall.exe b/tools/windows/x86/otinstall.exe new file mode 100644 index 000000000..fc2fd9525 Binary files /dev/null and b/tools/windows/x86/otinstall.exe differ