├── .gitattributes ├── .gitignore ├── LICENSE ├── README.md ├── bspfiles ├── OEMInputSamples │ ├── RetailOEMInput.xml │ └── TestOEMInput.xml └── Packages │ ├── RPi.BootFirmware │ ├── LICENCE.broadcom │ ├── RPi.BootFirmware.wm.xml │ ├── bootcode.bin │ ├── config.txt │ ├── fixup.dat │ ├── fixup_cd.dat │ ├── fixup_x.dat │ ├── kernel.img │ ├── start.elf │ ├── start_cd.elf │ └── start_x.elf │ ├── RPi.Customization │ └── RPi.Customization.wm.xml │ ├── RPi.Drivers │ ├── RpiLanPropertyChange.wm.xml │ ├── SV.PlatExtensions.wm.xml │ ├── SerPL011.wm.xml │ ├── bcm2836pwm.wm.xml │ ├── bcm2836sdhc.wm.xml │ ├── bcmauxspi.wm.xml │ ├── bcmgpio.wm.xml │ ├── bcmi2c.wm.xml │ ├── bcmspi.wm.xml │ ├── piminiuart.wm.xml │ ├── rpiq.wm.xml │ ├── rpisdhc.wm.xml │ ├── rpiwav.wm.xml │ └── vchiq.wm.xml │ ├── RPiFM.xml │ └── RPiFMFileList.xml ├── build ├── bcm2836 │ └── buildbcm2836.sln └── bsp.props ├── drivers ├── RpiLanPropertyChange │ └── bcm2836 │ │ ├── RpiLanPropertyChange.cpp │ │ ├── RpiLanPropertyChange.pkg.xml │ │ ├── RpiLanPropertyChange.vcxproj │ │ ├── dllmain.cpp │ │ ├── service.cpp │ │ ├── service.def │ │ ├── service.h │ │ ├── stdafx.cpp │ │ ├── stdafx.h │ │ └── targetver.h ├── audio │ └── bcm2836 │ │ ├── EndpointsCommon │ │ ├── EndpointsCommon.vcxproj │ │ ├── hptoptable.h │ │ ├── mintopo.cpp │ │ ├── mintopo.h │ │ ├── minwavert.cpp │ │ ├── minwavert.h │ │ ├── minwavertstream.cpp │ │ ├── minwavertstream.h │ │ ├── simple.h │ │ ├── sources.props │ │ ├── speakerhptopo.cpp │ │ ├── speakerhptopo.h │ │ ├── speakerhptoptable.h │ │ └── speakerhpwavtable.h │ │ ├── License.txt │ │ ├── README.md │ │ ├── adapter.cpp │ │ ├── basetopo.cpp │ │ ├── basetopo.h │ │ ├── common.cpp │ │ ├── common.h │ │ ├── kshelper.cpp │ │ ├── kshelper.h │ │ ├── rpiwav.h │ │ ├── rpiwav.inf │ │ ├── rpiwav.rc │ │ ├── rpiwav │ │ ├── minipairs.h │ │ ├── rpiwav.pkg.xml │ │ ├── rpiwav.vcxproj │ │ └── sources.props │ │ └── sources.inc.props ├── gpio │ └── bcm2836 │ │ ├── BcmGpio.cpp │ │ ├── BcmGpio.hpp │ │ ├── BcmUtility.hpp │ │ ├── License.txt │ │ ├── README.md │ │ ├── bcmgpio.inf │ │ ├── bcmgpio.pkg.xml │ │ ├── bcmgpio.rc │ │ ├── bcmgpio.vcxproj │ │ ├── precomp.hpp │ │ └── sources.props ├── i2c │ └── bcm2836 │ │ ├── License.txt │ │ ├── README.md │ │ ├── bcmi2c.h │ │ ├── bcmi2c.inf │ │ ├── bcmi2c.pkg.xml │ │ ├── bcmi2c.vcxproj │ │ ├── device.cpp │ │ ├── device.h │ │ ├── driver.cpp │ │ ├── driver.h │ │ ├── i2ctrace.h │ │ ├── precomp.h │ │ ├── resource.rc │ │ └── sources.props ├── mailbox │ └── bcm2836 │ │ ├── License.txt │ │ ├── README.md │ │ ├── RPIQ.inf │ │ ├── device.c │ │ ├── device.h │ │ ├── driver.c │ │ ├── driver.h │ │ ├── init.c │ │ ├── init.h │ │ ├── interrupt.c │ │ ├── interrupt.h │ │ ├── ioctl.c │ │ ├── ioctl.h │ │ ├── mailbox.c │ │ ├── mailbox.h │ │ ├── precomp.h │ │ ├── register.h │ │ ├── rpiq.h │ │ ├── rpiq.pkg.xml │ │ ├── rpiq.rc │ │ ├── rpiq.vcxproj │ │ ├── sources.props │ │ └── trace.h ├── misc │ ├── userland │ │ └── interface │ │ │ ├── vchi │ │ │ ├── common │ │ │ │ └── endian.h │ │ │ ├── connections │ │ │ │ └── connection.h │ │ │ ├── message_drivers │ │ │ │ └── message.h │ │ │ ├── vchi.h │ │ │ ├── vchi_cfg.h │ │ │ ├── vchi_cfg_internal.h │ │ │ ├── vchi_common.h │ │ │ └── vchi_mh.h │ │ │ ├── vchiq_arm │ │ │ ├── License.txt │ │ │ ├── README.md │ │ │ ├── sources.props │ │ │ ├── vchiq.h │ │ │ ├── vchiq_arm_kern.vcxproj │ │ │ ├── vchiq_cfg.h │ │ │ ├── vchiq_if.h │ │ │ ├── vchiq_ioctl.h │ │ │ ├── vchiq_lib.c │ │ │ └── vchiq_util.h │ │ │ └── vcos │ │ │ ├── generic │ │ │ ├── License.txt │ │ │ ├── README.md │ │ │ ├── sources.props │ │ │ ├── vcos_abort.c │ │ │ ├── vcos_common.h │ │ │ ├── vcos_deprecated.h │ │ │ ├── vcos_generic_blockpool.c │ │ │ ├── vcos_generic_blockpool.h │ │ │ ├── vcos_generic_event_flags.h │ │ │ ├── vcos_generic_named_sem.c │ │ │ ├── vcos_generic_named_sem.h │ │ │ ├── vcos_generic_quickslow_mutex.h │ │ │ ├── vcos_generic_reentrant_mtx.h │ │ │ ├── vcos_generic_tls.h │ │ │ ├── vcos_init.c │ │ │ ├── vcos_logcat.c │ │ │ ├── vcos_mem_from_malloc.c │ │ │ ├── vcos_mem_from_malloc.h │ │ │ ├── vcos_msgqueue.c │ │ │ └── vcos_win32_kern_generic.vcxproj │ │ │ ├── vcos.h │ │ │ ├── vcos_assert.h │ │ │ ├── vcos_atomic_flags.h │ │ │ ├── vcos_attr.h │ │ │ ├── vcos_blockpool.h │ │ │ ├── vcos_cmd.h │ │ │ ├── vcos_ctype.h │ │ │ ├── vcos_event.h │ │ │ ├── vcos_event_flags.h │ │ │ ├── vcos_init.h │ │ │ ├── vcos_inttypes.h │ │ │ ├── vcos_logging.h │ │ │ ├── vcos_logging_control.h │ │ │ ├── vcos_mem.h │ │ │ ├── vcos_mempool.h │ │ │ ├── vcos_msgqueue.h │ │ │ ├── vcos_mutex.h │ │ │ ├── vcos_named_semaphore.h │ │ │ ├── vcos_once.h │ │ │ ├── vcos_queue.h │ │ │ ├── vcos_quickslow_mutex.h │ │ │ ├── vcos_reentrant_mutex.h │ │ │ ├── vcos_semaphore.h │ │ │ ├── vcos_stdbool.h │ │ │ ├── vcos_stdint.h │ │ │ ├── vcos_string.h │ │ │ ├── vcos_thread.h │ │ │ ├── vcos_thread_attr.h │ │ │ ├── vcos_timer.h │ │ │ ├── vcos_tls.h │ │ │ ├── vcos_types.h │ │ │ └── win32 │ │ │ ├── License.txt │ │ │ ├── README.md │ │ │ ├── sources.props │ │ │ ├── vcos_platform.h │ │ │ ├── vcos_platform_types.h │ │ │ ├── vcos_pthreads.c │ │ │ └── vcos_win32_kern.vcxproj │ └── vchiq │ │ ├── License.txt │ │ ├── README.md │ │ ├── device.c │ │ ├── device.h │ │ ├── driver.c │ │ ├── driver.h │ │ ├── file.c │ │ ├── file.h │ │ ├── init.c │ │ ├── init.h │ │ ├── interrupt.c │ │ ├── interrupt.h │ │ ├── ioctl.c │ │ ├── ioctl.h │ │ ├── memory.c │ │ ├── memory.h │ │ ├── precomp.h │ │ ├── slots.c │ │ ├── slots.h │ │ ├── slotscommon.h │ │ ├── sources.props │ │ ├── trace.c │ │ ├── trace.h │ │ ├── transfer.c │ │ ├── transfer.h │ │ ├── vchiq.h │ │ ├── vchiq.inf │ │ ├── vchiq.pkg.xml │ │ ├── vchiq.vcxproj │ │ ├── vchiq_2835.h │ │ ├── vchiq_cfg.h │ │ ├── vchiq_common.h │ │ ├── vchiq_core.h │ │ ├── vchiq_if.h │ │ ├── vchiq_ioctl.h │ │ └── vchiq_pagelist.h ├── pwm │ └── bcm2836 │ │ ├── License.txt │ │ ├── README.md │ │ ├── bcm2836pwm.h │ │ ├── bcm2836pwm.inf │ │ ├── bcm2836pwm.pkg.xml │ │ ├── bcm2836pwm.vcxproj │ │ ├── clockmgr.h │ │ ├── device.cpp │ │ ├── device.h │ │ ├── dma.cpp │ │ ├── dma.h │ │ ├── dmaInterrupt.cpp │ │ ├── dmaInterrupt.h │ │ ├── driver.cpp │ │ ├── driver.h │ │ ├── pwm.cpp │ │ ├── pwm.h │ │ ├── resource.rc │ │ ├── sources.props │ │ └── trace.h ├── sd │ └── bcm2836 │ │ ├── bcm2836sdhc │ │ ├── README.md │ │ ├── bcm2836sdhc.c │ │ ├── bcm2836sdhc.h │ │ ├── bcm2836sdhc.inf │ │ ├── bcm2836sdhc.pkg.xml │ │ ├── bcm2836sdhc.rc │ │ ├── bcm2836sdhc.vcxproj │ │ ├── sources.props │ │ └── trace.h │ │ └── rpisdhc │ │ ├── README.md │ │ ├── precomp.hpp │ │ ├── rpisdhc.cpp │ │ ├── rpisdhc.hpp │ │ ├── rpisdhc.inf │ │ ├── rpisdhc.pkg.xml │ │ ├── rpisdhc.rc │ │ ├── rpisdhc.vcxproj │ │ ├── sdhclogging.cpp │ │ ├── sdhclogging.h │ │ └── sources.props ├── spi │ ├── bcm2836 │ │ ├── License.txt │ │ ├── README.md │ │ ├── bcmspi.h │ │ ├── bcmspi.inf │ │ ├── bcmspi.pkg.xml │ │ ├── bcmspi.vcxproj │ │ ├── controller.cpp │ │ ├── controller.h │ │ ├── device.cpp │ │ ├── device.h │ │ ├── driver.cpp │ │ ├── driver.h │ │ ├── internal.h │ │ ├── resource.rc │ │ ├── sources.props │ │ └── spitrace.h │ └── bcmauxspi │ │ ├── License.txt │ │ ├── README.md │ │ ├── bcmauxspi-hw.h │ │ ├── bcmauxspi.cpp │ │ ├── bcmauxspi.h │ │ ├── bcmauxspi.inf │ │ ├── bcmauxspi.pkg.xml │ │ ├── bcmauxspi.vcxproj │ │ ├── precomp.h │ │ ├── resource.rc │ │ ├── sources.props │ │ └── trace.h └── uart │ └── bcm2836 │ ├── miniUart │ ├── License.txt │ ├── README.md │ ├── Trace.h │ ├── error.c │ ├── flush.c │ ├── immediat.c │ ├── initunlo.c │ ├── ioctl.c │ ├── isr.c │ ├── modmflow.c │ ├── openclos.c │ ├── pi_miniuart.inf │ ├── pi_miniuart.rc │ ├── pi_miniuart.sln │ ├── pi_miniuart.vcxproj │ ├── piminiuart.pkg.xml │ ├── pnp.c │ ├── power.c │ ├── precomp.h │ ├── purge.c │ ├── qsfile.c │ ├── read.c │ ├── registry.c │ ├── resource.h │ ├── serial.h │ ├── serial.rc │ ├── serialp.h │ ├── utils.c │ ├── waitmask.c │ ├── wmi.c │ └── write.c │ └── serPL011 │ ├── License.txt │ ├── PL011.rc │ ├── PL011common.cpp │ ├── PL011common.h │ ├── PL011device.cpp │ ├── PL011device.h │ ├── PL011driver.cpp │ ├── PL011driver.h │ ├── PL011hw.cpp │ ├── PL011hw.h │ ├── PL011interrupt.cpp │ ├── PL011interrupt.h │ ├── PL011ioctl.cpp │ ├── PL011ioctl.h │ ├── PL011logging.h │ ├── PL011rx.h │ ├── PL011tx.cpp │ ├── PL011tx.h │ ├── PL011uart.cpp │ ├── PL011uart.h │ ├── README.md │ ├── SerPL011.inf │ ├── SerPL011.pkg.xml │ ├── SerPL011.vcxproj │ ├── pl011rx.cpp │ ├── precomp.h │ └── sources.props └── tools ├── binexport.cmd └── binexport.ps1 /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /bspfiles/OEMInputSamples/RetailOEMInput.xml: -------------------------------------------------------------------------------- 1 |  2 | 6 | Contoso Windows 10 IoT Core Retail FFU with RPi BSP 7 | RPi-R 8 | 9 | RASPBERRY PI 10 | RPi-R 11 | 12 | Production 13 | fre 14 | 15 | 16 | en-us 17 | 18 | 19 | en-us 20 | 21 | 22 | en-us 23 | 24 | 25 | en-us 26 | en-us 27 | 28 | 1024x768 29 | 30 | 31 | 32 | %BLD_DIR%\MergedFMs\RPiFM.xml 33 | 34 | %BLD_DIR%\MergedFMs\OEMCommonFM.xml 35 | %BLD_DIR%\MergedFMs\OEMFM.xml 36 | 37 | 38 | 39 | IOT_EFIESP 40 | IOT_EFIESP_BCD_MBR 41 | IOT_DMAP_DRIVER 42 | IOT_GENERIC_POP 43 | 44 | IOT_UAP_OOBE 45 | IOT_APP_TOOLKIT 46 | 47 | IOT_BERTHA 48 | IOT_ALLJOYN_APP 49 | 50 | 51 | 52 | 53 | RPI2_DRIVERS 54 | RPI3_DRIVERS 55 | 56 | OEM_CustomCmd 57 | OEM_ProvAuto 58 | 59 | 60 | 61 | 62 | Windows 10 IoT Core 63 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/LICENCE.broadcom: -------------------------------------------------------------------------------- 1 | Copyright (c) 2006, Broadcom Corporation. 2 | All rights reserved. 3 | 4 | Redistribution. Redistribution and use in binary form, without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * This software may only be used for the purposes of developing for, 9 | running or using a Raspberry Pi device. 10 | * Redistributions must reproduce the above copyright notice and the 11 | following disclaimer in the documentation and/or other materials 12 | provided with the distribution. 13 | * Neither the name of Broadcom Corporation nor the names of its suppliers 14 | may be used to endorse or promote products derived from this software 15 | without specific prior written permission. 16 | 17 | DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 18 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, 19 | BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 20 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 21 | COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 22 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 23 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS 24 | OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 26 | TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 27 | USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 28 | DAMAGE. 29 | 30 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/RPi.BootFirmware.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/bootcode.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/bspfiles/Packages/RPi.BootFirmware/bootcode.bin -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/config.txt: -------------------------------------------------------------------------------- 1 | # For more options and information see 2 | # http://www.raspberrypi.org/documentation/configuration/config-txt.md 3 | # Some settings may impact device functionality. See link above for details 4 | # GPU Firmware SHA256 checksum: 7CE2EF13CDD77F1782FFFF98533572503DF4B46765966CC7E18F6C6455B9623A 5 | # kernel.img SHA256 checksum: 6C82C8720BE4EFB2951BDC01FA187B0B659227033EB7D7DB5ACA6324FD644D7F 6 | # kernel.img git commit ID: f6706f4bd3b10c8294589f45082c8bdc4c50be59 7 | 8 | # 9 | # Boot 10 | # 11 | init_uart_clock=16000000 # Set UART clock to 16Mhz 12 | kernel_old=1 # Load kernel.img at physical memory address 0x0 13 | safe_mode_gpio=8 # A temp firmware limitation workaround 14 | max_usb_current=1 # Enable maximum usb current 15 | 16 | # 17 | # Memory 18 | # 19 | gpu_mem=32 # Set VC to 32MB, ARM DRAM to (1008-32)MB 20 | hdmi_force_hotplug=1 # Enable HDMI display even if it is not connected (640x480) 21 | 22 | # 23 | # Overclocking 24 | # 25 | core_freq=250 # Frequency of GPU processor core in MHz 26 | 27 | # 28 | # Video 29 | # 30 | framebuffer_ignore_alpha=1 # Ignore the alpha channel for Windows. 31 | framebuffer_swap=1 # Set the frame buffer to be Windows BGR compatible. 32 | disable_overscan=1 # Disable overscan 33 | hdmi_group=2 # Use VESA Display Mode Timing over CEA 34 | hdmi_cvt 800 480 60 6 0 0 0 # Add custom 800x480 resolution (group 2 mode 87) -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/fixup.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/bspfiles/Packages/RPi.BootFirmware/fixup.dat -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/fixup_cd.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/bspfiles/Packages/RPi.BootFirmware/fixup_cd.dat -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/fixup_x.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/bspfiles/Packages/RPi.BootFirmware/fixup_x.dat -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/kernel.img: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/bspfiles/Packages/RPi.BootFirmware/kernel.img -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/start.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/bspfiles/Packages/RPi.BootFirmware/start.elf -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/start_cd.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/bspfiles/Packages/RPi.BootFirmware/start_cd.elf -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.BootFirmware/start_x.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/bspfiles/Packages/RPi.BootFirmware/start_x.elf -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Customization/RPi.Customization.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 14 | 18 | 22 | 23 | 25 | 29 | 30 | 32 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/RpiLanPropertyChange.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 15 | 16 | 25 | 27 | 28 | 31 | 34 | 37 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/SV.PlatExtensions.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/SerPL011.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/bcm2836pwm.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/bcm2836sdhc.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/bcmauxspi.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/bcmgpio.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/bcmi2c.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/bcmspi.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/piminiuart.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/rpiq.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/rpisdhc.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/rpiwav.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPi.Drivers/vchiq.wm.xml: -------------------------------------------------------------------------------- 1 |  2 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /bspfiles/Packages/RPiFMFileList.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | true 4 | 5 | 6 | 7 | 8 | 9 | 1024x768 10 | 11 | 12 | 13 | en-US 14 | 15 | 16 | 17 | en-US 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /build/bsp.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 1.0 7 | $(SolutionDir)$(Platform)\$(Configuration)\$(TargetName)\Out\ 8 | $(SolutionDir)$(Platform)\$(Configuration)\ 9 | 10 | 11 | 12 | true 13 | true 14 | 4595;%(DisableSpecificWarnings) 15 | 16 | 17 | "OEMNAME=Contoso;BSPARCH=$(Platform);_RELEASEDIR=$(SolutionDir)$(Platform)\$(Configuration)\;TARGETNAME=$(TargetName);TARGETEXT=$(TargetExt);$(PkgGen_DefaultDriverDest)" 18 | /onecore %(AdditionalOptions) 19 | 20 | 21 | 22 | Off 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /drivers/RpiLanPropertyChange/bcm2836/RpiLanPropertyChange.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 40 | 41 | 42 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /drivers/RpiLanPropertyChange/bcm2836/dllmain.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // RpiLanPropertyChange.cpp 7 | // 8 | // Abstract: 9 | // 10 | // This file defines the exported functions for the DLL application. 11 | // 12 | 13 | #include "stdafx.h" 14 | 15 | HINSTANCE g_hInstance = nullptr; 16 | 17 | extern "C" 18 | { 19 | // Externally callable functions 20 | BOOL APIENTRY DllMain( HMODULE hModule, 21 | DWORD ul_reason_for_call, 22 | LPVOID lpReserved 23 | ) 24 | { 25 | switch (ul_reason_for_call) 26 | { 27 | case DLL_PROCESS_ATTACH: 28 | { 29 | // Save the dll module handle 30 | g_hInstance = hModule; 31 | 32 | // Disable thread-attach calls 33 | DisableThreadLibraryCalls(hModule); 34 | } 35 | break; 36 | 37 | case DLL_THREAD_ATTACH: 38 | case DLL_THREAD_DETACH: 39 | break; 40 | 41 | case DLL_PROCESS_DETACH: 42 | { 43 | g_hInstance = NULL; 44 | } 45 | break; 46 | } 47 | return TRUE; 48 | } 49 | 50 | } // extern "C" 51 | 52 | -------------------------------------------------------------------------------- /drivers/RpiLanPropertyChange/bcm2836/service.def: -------------------------------------------------------------------------------- 1 | LIBRARY 2 | EXPORTS 3 | ServiceMain -------------------------------------------------------------------------------- /drivers/RpiLanPropertyChange/bcm2836/service.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // service.h 7 | // 8 | // Abstract: 9 | // 10 | // This file is header file defines the service interfaces. 11 | // 12 | 13 | #pragma once 14 | 15 | namespace RpiLanPropertyChange 16 | { 17 | 18 | class Service final 19 | { 20 | public: 21 | Service(); 22 | 23 | void ServiceMain(DWORD argc, _In_ PTSTR argv[]); 24 | 25 | void Start(); 26 | void Stop(); 27 | DWORD ServiceHandler(DWORD opcode, DWORD eventType, _In_ void* pEventData); 28 | 29 | private: 30 | HRESULT UpdateServiceStatus(DWORD currentState, DWORD win32ExitCode, DWORD waitHint = 10000); 31 | SERVICE_STATUS m_serviceStatus; 32 | SERVICE_STATUS_HANDLE m_hServiceStatus; 33 | 34 | class LanDevice * m_LanDevice; 35 | }; 36 | 37 | class LanDevice final 38 | { 39 | public: 40 | LanDevice(); 41 | ~LanDevice(); 42 | 43 | HRESULT CheckAndUpdateProperty(bool & bUpdateDone); 44 | 45 | private: 46 | enum LanPropertyChangeStatus 47 | { 48 | LanPropertyNoChange = 0, 49 | LanPropertyNeedUpdate, 50 | LanPropertyUpdated 51 | }; 52 | 53 | DEVINST m_Devinst; 54 | CONFIGRET FindDeviceInstance(); 55 | CONFIGRET ApllyLanPropertyChange(); 56 | LanPropertyChangeStatus LanPropertyChange(); 57 | CONFIGRET LanPropertyChangeDone(); 58 | }; 59 | } 60 | 61 | extern "C" 62 | { 63 | // public callable by svchost 64 | void STDAPICALLTYPE ServiceMain(DWORD argc, _In_ PTSTR argv[]); 65 | } // extern "C" 66 | 67 | -------------------------------------------------------------------------------- /drivers/RpiLanPropertyChange/bcm2836/stdafx.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | #include "stdafx.h" 5 | -------------------------------------------------------------------------------- /drivers/RpiLanPropertyChange/bcm2836/stdafx.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // stdafx.h : include file for standard system include files, 5 | // or project specific include files that are used frequently, but 6 | // are changed infrequently 7 | // 8 | 9 | #pragma once 10 | 11 | #include "targetver.h" 12 | 13 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 14 | // Windows Header Files 15 | #include 16 | #include 17 | 18 | // reference additional headers your program requires here 19 | -------------------------------------------------------------------------------- /drivers/RpiLanPropertyChange/bcm2836/targetver.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | #pragma once 5 | 6 | // Including SDKDDKVer.h defines the highest available Windows platform. 7 | 8 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and 9 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. 10 | 11 | #include 12 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/EndpointsCommon/hptoptable.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Abstract: 6 | Common declaration of topology table for the headphone. 7 | 8 | --*/ 9 | 10 | #pragma once 11 | 12 | //============================================================================= 13 | static 14 | KSJACK_DESCRIPTION HpJackDesc = 15 | { 16 | KSAUDIO_SPEAKER_STEREO, 17 | JACKDESC_RGB(179, 201, 140), 18 | eConnTypeOtherAnalog, 19 | eGeoLocTop, 20 | eGenLocPrimaryBox, 21 | ePortConnJack, 22 | TRUE 23 | }; 24 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/EndpointsCommon/mintopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Abstract: 7 | Declaration of topology miniport. 8 | 9 | --*/ 10 | 11 | #pragma once 12 | 13 | #include "basetopo.h" 14 | 15 | //============================================================================= 16 | // Classes 17 | //============================================================================= 18 | 19 | /////////////////////////////////////////////////////////////////////////////// 20 | // CMiniportTopology 21 | // 22 | 23 | class CMiniportTopology : 24 | public CMiniportTopologyRPIWAV, 25 | public IMiniportTopology, 26 | public CUnknown 27 | { 28 | private: 29 | eDeviceType m_DeviceType; 30 | union { 31 | PVOID m_DeviceContext; 32 | }; 33 | 34 | public: 35 | DECLARE_STD_UNKNOWN(); 36 | CMiniportTopology 37 | ( 38 | _In_opt_ PUNKNOWN UnknownOuter, 39 | _In_ PCFILTER_DESCRIPTOR *FilterDesc, 40 | _In_ USHORT DeviceMaxChannels, 41 | _In_ eDeviceType DeviceType, 42 | _In_opt_ PVOID DeviceContext 43 | ) 44 | : CUnknown(UnknownOuter), 45 | CMiniportTopologyRPIWAV(FilterDesc, DeviceMaxChannels), 46 | m_DeviceType(DeviceType), 47 | m_DeviceContext(DeviceContext) 48 | { 49 | } 50 | 51 | ~CMiniportTopology(); 52 | 53 | IMP_IMiniportTopology; 54 | 55 | NTSTATUS PropertyHandlerJackDescription 56 | ( 57 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 58 | _In_ ULONG NumJackDescriptions, 59 | _In_reads_(NumJackDescriptions) PKSJACK_DESCRIPTION *JackDescriptions 60 | ); 61 | 62 | NTSTATUS PropertyHandlerJackDescription2 63 | ( 64 | _In_ PPCPROPERTY_REQUEST PropertyRequest, 65 | _In_ ULONG NumJackDescriptions, 66 | _In_reads_(NumJackDescriptions) PKSJACK_DESCRIPTION * JackDescriptions, 67 | _In_ DWORD JackCapabilities 68 | ); 69 | 70 | }; 71 | 72 | typedef CMiniportTopology *PCMiniportTopology; 73 | 74 | 75 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/EndpointsCommon/simple.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Abstract: 6 | Node and Pin numbers and other common definitions for rpisimple configuration. 7 | 8 | --*/ 9 | 10 | #pragma once 11 | 12 | // Name Guid 13 | // {F6730547-F795-4FEC-ACF4-17344717375F} 14 | #define STATIC_NAME_RPIWAV_SIMPLE\ 15 | 0xf6730547, 0xf795, 0x4fec, 0xac, 0xf4, 0x17, 0x34, 0x47, 0x17, 0x37, 0x5f 16 | DEFINE_GUIDSTRUCT("F6730547-F795-4FEC-ACF4-17344717375F", NAME_RPIWAV_SIMPLE); 17 | #define NAME_RPIWAV_SIMPLE DEFINE_GUIDNAMED(NAME_RPIWAV_SIMPLE) 18 | 19 | //---------------------------------------------------- 20 | // New defines for the render endpoints. 21 | //---------------------------------------------------- 22 | 23 | // Default pin instances. 24 | #define MAX_INPUT_SYSTEM_STREAMS 1 25 | 26 | // Wave Topology nodes 27 | enum 28 | { 29 | KSNODE_WAVE_AUDIO_ENGINE = 0 30 | }; 31 | 32 | // Wave pins 33 | enum 34 | { 35 | KSPIN_WAVE_RENDER_SINK_SYSTEM = 0, 36 | KSPIN_WAVE_RENDER_SOURCE 37 | }; 38 | 39 | // Topology pins. 40 | enum 41 | { 42 | KSPIN_TOPO_WAVEOUT_SOURCE = 0, 43 | KSPIN_TOPO_LINEOUT_DEST, 44 | }; 45 | 46 | // Wave Topology nodes. 47 | enum 48 | { 49 | KSNODE_WAVE_ADC = 0 50 | }; 51 | 52 | // data format attribute range definitions. 53 | static 54 | KSATTRIBUTE PinDataRangeSignalProcessingModeAttribute = 55 | { 56 | sizeof(KSATTRIBUTE), 57 | 0, 58 | STATICGUIDOF(KSATTRIBUTEID_AUDIOSIGNALPROCESSING_MODE), 59 | }; 60 | 61 | static 62 | PKSATTRIBUTE PinDataRangeAttributes[] = 63 | { 64 | &PinDataRangeSignalProcessingModeAttribute, 65 | }; 66 | 67 | static 68 | KSATTRIBUTE_LIST PinDataRangeAttributeList = 69 | { 70 | ARRAYSIZE(PinDataRangeAttributes), 71 | PinDataRangeAttributes, 72 | }; 73 | 74 | 75 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/EndpointsCommon/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | EndpointsCommon 5 | LIBRARY 6 | 1 7 | $(DDK_INC_PATH); ..\..\..\PWM\drivers\RPi2; .. 8 | retail 9 | $(C_DEFINES) -DDEBUG_LEVEL=DEBUGLVL_TERSE 10 | Universal 11 | $(_NT_TARGET_VERSION_WIN10) 12 | 1 13 | $(SOURCES) mintopo.cpp minwavert.cpp minwavertstream.cpp speakerhptopo.cpp 14 | 15 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/EndpointsCommon/speakerhptopo.h: -------------------------------------------------------------------------------- 1 | 2 | /*++ 3 | 4 | Copyright (c) Microsoft Corporation All Rights Reserved 5 | 6 | Abstract: 7 | Declaration of topology miniport for the speaker (external: headphone). 8 | 9 | --*/ 10 | 11 | #pragma once 12 | 13 | NTSTATUS 14 | PropertyHandler_SpeakerHpTopoFilter 15 | ( 16 | _In_ PPCPROPERTY_REQUEST PropertyRequest 17 | ); 18 | 19 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi 2 (BCM2836) WaveRT Audio Driver 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/audio/bcm2836/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 (BCM2836) Audio Driver (rpiwav.sys) 2 | rpiwav.sys is the audio driver for RaspberryPi designed as a WaveRT miniport that fits into the Windows10 Audio stack illustrated here: https://msdn.microsoft.com/en-us/library/windows/hardware/mt631182(v=vs.85).aspx. 3 | RaspberryPi does not have an I2S DAC/Codec which requires a DAC extension board. Out-of-the-box audio output is possible only through the 2-channel 3.5mm audio jack which is wired to PWM peripheral left and right channels. This audio driver uses Pulse-Width Modulation to produce stereo audio through the PWM peripheral. As a consequence, hardware PWM is used exclusively by the audio driver and is not available to for any other use. 4 | 5 | ## A 2 Layered Design 6 | The audio driver (rpiwav.sys) uses the PWM driver (bcm2836pwm.sys) exclusively. rpiwav.sys sends PCM audio packets to bmc2836pwm.sys to modulate and output over the right and left channels resulting in a stereo audio output. 7 | 8 | ## References 9 | 1. Audio Miniport Drivers: https://msdn.microsoft.com/en-us/library/windows/hardware/ff536206(v=vs.85).aspx 10 | 2. WaveRT Port Driver: https://msdn.microsoft.com/en-us/library/windows/hardware/ff538845(v=vs.85).aspx 11 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/basetopo.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Abstract: 6 | Declaration of topology miniport. 7 | 8 | --*/ 9 | 10 | #pragma once 11 | 12 | //============================================================================= 13 | // Classes 14 | //============================================================================= 15 | 16 | /////////////////////////////////////////////////////////////////////////////// 17 | // CMiniportTopologyRPIWAV 18 | // 19 | 20 | class CMiniportTopologyRPIWAV 21 | { 22 | protected: 23 | PADAPTERCOMMON m_AdapterCommon; // Adapter common object. 24 | PPCFILTER_DESCRIPTOR m_FilterDescriptor; // Filter descriptor. 25 | PPORTEVENTS m_PortEvents; // Event interface. 26 | USHORT m_DeviceMaxChannels; // Max device channels. 27 | 28 | public: 29 | CMiniportTopologyRPIWAV( 30 | _In_ PCFILTER_DESCRIPTOR *FilterDesc, 31 | _In_ USHORT DeviceMaxChannels 32 | ); 33 | 34 | ~CMiniportTopologyRPIWAV(); 35 | 36 | NTSTATUS GetDescription 37 | ( 38 | _Out_ PPCFILTER_DESCRIPTOR * Description 39 | ); 40 | 41 | NTSTATUS DataRangeIntersection 42 | ( 43 | _In_ ULONG PinId, 44 | _In_ PKSDATARANGE ClientDataRange, 45 | _In_ PKSDATARANGE MyDataRange, 46 | _In_ ULONG OutputBufferLength, 47 | _Out_writes_bytes_to_opt_(OutputBufferLength, *ResultantFormatLength) 48 | PVOID ResultantFormat OPTIONAL, 49 | _Out_ PULONG ResultantFormatLength 50 | ); 51 | 52 | NTSTATUS Init 53 | ( 54 | _In_ PUNKNOWN UnknownAdapter, 55 | _In_ PPORTTOPOLOGY Port 56 | ); 57 | 58 | // PropertyHandlers. 59 | NTSTATUS PropertyHandlerGeneric 60 | ( 61 | _In_ PPCPROPERTY_REQUEST PropertyRequest 62 | ); 63 | 64 | NTSTATUS PropertyHandlerMuxSource 65 | ( 66 | _In_ PPCPROPERTY_REQUEST PropertyRequest 67 | ); 68 | 69 | NTSTATUS PropertyHandlerDevSpecific 70 | ( 71 | _In_ PPCPROPERTY_REQUEST PropertyRequest 72 | ); 73 | 74 | VOID AddEventToEventList 75 | ( 76 | _In_ PKSEVENT_ENTRY EventEntry 77 | ); 78 | 79 | VOID GenerateEventList 80 | ( 81 | _In_opt_ GUID *Set, 82 | _In_ ULONG EventId, 83 | _In_ BOOL PinEvent, 84 | _In_ ULONG PinId, 85 | _In_ BOOL NodeEvent, 86 | _In_ ULONG NodeId 87 | ); 88 | }; 89 | 90 | 91 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/rpiwav.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/audio/bcm2836/rpiwav.inf -------------------------------------------------------------------------------- /drivers/audio/bcm2836/rpiwav.rc: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Abstract: 6 | Resource data 7 | 8 | --*/ 9 | 10 | #define VER_FILETYPE VFT_DRV 11 | #define VER_FILESUBTYPE VFT2_DRV_SOUND 12 | #define VER_FILEDESCRIPTION_STR "Microsoft RPi2 Audio Device Driver" 13 | #define VER_INTERNALNAME_STR "rpiwav.sys" 14 | #define VER_ORIGINALFILENAME_STR "rpiwav.sys" 15 | 16 | #define VER_LEGALCOPYRIGHT_YEARS "2016" 17 | #define VER_LEGALCOPYRIGHT_STR "Copyright (C) Microsoft Corp." VER_LEGALCOPYRIGHT_YEARS 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/rpiwav/rpiwav.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/rpiwav/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | ..\sources.inc.props 5 | $([System.IO.Path]::Combine($(MSBuildProjectDirectory),'..\sources.inc.props')) 6 | $([System.IO.Path]::Combine($(MSBuildThisFileDirectory),'..\sources.inc.props')) 7 | 8 | 9 | 10 | 11 | rpiwav 12 | retail 13 | $(C_DEFINES) -D_USE_WAVERT_ 14 | $(_NT_TARGET_VERSION_WIN10) 15 | 1 16 | 13 17 | $(INCLUDES); ..\EndpointsCommon; ..\..\..\PWM\drivers\RPi2; ..\EndpointsCommon; 18 | $(SOURCES) 19 | 0 20 | 1 21 | 1 22 | ..\rpiwav.inf 23 | 1 24 | 25 | -------------------------------------------------------------------------------- /drivers/audio/bcm2836/sources.inc.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | DRIVER 5 | $(DDK_LIB_PATH)\portcls.lib $(DDK_LIB_PATH)\stdunk.lib $(SDK_LIB_PATH)\libcntpr.lib 6 | $(DDK_INC_PATH); .. 7 | -W4 -WX 8 | $(C_DEFINES) -DUNICODE -D_UNICODE 9 | $(C_DEFINES) -DDEBUG_LEVEL=DEBUGLVL_TERSE 10 | ..\adapter.cpp ..\basetopo.cpp ..\common.cpp ..\kshelper.cpp ..\rpiwav.rc 11 | 12 | -------------------------------------------------------------------------------- /drivers/gpio/bcm2836/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi 2 (BCM2836) GPIO Client Driver 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/gpio/bcm2836/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 (BCM2836) GPIO Client Driver 2 | 3 | This is the GPIO driver for Raspberry Pi. It implements GPIO input/output, 4 | interrupts, and pin muxing. It is a GpioClx client driver. A subset of pins 5 | is exposed to usermode through the rhproxy driver. For more information on 6 | the GpioClx framework, see 7 | [General-Purpose I/O (GPIO) Driver Reference](https://msdn.microsoft.com/en-us/library/windows/hardware/hh439515(v=vs.85).aspx). -------------------------------------------------------------------------------- /drivers/gpio/bcm2836/bcmgpio.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/gpio/bcm2836/bcmgpio.inf -------------------------------------------------------------------------------- /drivers/gpio/bcm2836/bcmgpio.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /drivers/gpio/bcm2836/bcmgpio.rc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) Microsoft Corporation 3 | // 4 | 5 | #include 6 | 7 | #include 8 | 9 | #define VER_FILETYPE VFT_DRV 10 | #define VER_FILESUBTYPE VFT2_UNKNOWN 11 | #define VER_FILEDESCRIPTION_STR "BCM2836 GPIO Controller Driver" 12 | #define VER_INTERNALNAME_STR "bcmgpio.sys" 13 | #define VER_ORIGINALFILENAME_STR "bcmgpio.sys" 14 | 15 | // Ensure that VS_VERSION_INFO in not defined 16 | #ifdef VS_VERSION_INFO 17 | #undef VS_VERSION_INFO 18 | #endif 19 | 20 | #include "common.ver" 21 | 22 | -------------------------------------------------------------------------------- /drivers/gpio/bcm2836/precomp.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | -------------------------------------------------------------------------------- /drivers/gpio/bcm2836/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | bcmgpio 5 | DRIVER 6 | retail 7 | 1 8 | /W4 /WX 9 | 1 10 | $(TARGETLIBS) $(DDK_LIB_PATH)\msgpioclxstub.lib 11 | BcmGpio.cpp bcmgpio.rc 12 | BcmGpio.inf 13 | 14 | -------------------------------------------------------------------------------- /drivers/i2c/bcm2836/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi 2 (BCM2836) I2C Controller driver for SPB Framework 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/i2c/bcm2836/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 (BCM2836) I2C Controller driver for SPB Framework 2 | 3 | This is the I2C driver for Raspberry Pi. It is implemented as an 4 | [SpbCx Controller Driver](https://msdn.microsoft.com/en-us/library/windows/hardware/hh406203(v=vs.85).aspx). 5 | I2C1 is exposed to usermode through the rhproxy driver. I2C0 and I2C2 are 6 | reserved by the GPU firmware. 7 | Some limitations are: 8 | 9 | - Due to hardware limitations, does not support arbitrary sequences. Only 10 | Write-Read sequences are supported. 11 | - Due to hardware limitations, does not support `IOCTL_SPB_LOCK_CONTROLLER` 12 | and `IOCTL_SPB_UNLOCK_CONTROLLER`. 13 | - Due to the hardware bug described [here](https://github.com/raspberrypi/linux/issues/254), 14 | Raspberry Pi cannot communicate reliably with slave devices that do clock 15 | stretching, including Atmel ATMEGA microcontrollers. It is recommended to use 16 | UART to communicate with ATMEGA microcontrollers. 17 | 18 | 19 | ## Registry Settings 20 | 21 | The driver supports the following registry settings which can be used to change 22 | the default behavior of the driver. 23 | 24 | ### Under key `HKLM\System\CurrentControlSet\enum\ACPI\BCM2841\1\Device Parameters` 25 | 26 | | Registry Value Name | Type | Description | 27 | |---------------------|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 28 | | ClockStretchTimeout | REG_DWORD | The value used to program the TOUT (Clock Stretch Timeout) register. This is the maximum amount of time, in SCL clock cycles, that a slave address can stretch the clock before the master fails the transfer with a clock stretch timeout error. A value of 0 turns off clock stretch timeout detection, allowing slave devices to stretch the clock indefinitely. Value must be in the range [0, 0xffff]. | 29 | 30 | -------------------------------------------------------------------------------- /drivers/i2c/bcm2836/bcmi2c.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/i2c/bcm2836/bcmi2c.inf -------------------------------------------------------------------------------- /drivers/i2c/bcm2836/bcmi2c.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/i2c/bcm2836/driver.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Module Name: 6 | 7 | driver.h 8 | 9 | Abstract: 10 | 11 | This module contains the function definitions for 12 | the WDF driver. 13 | 14 | Environment: 15 | 16 | kernel-mode only 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | #ifndef _DRIVER_H_ 23 | #define _DRIVER_H_ 24 | 25 | // 26 | // Macros to be used for proper PAGED/NON-PAGED code placement 27 | // 28 | 29 | #define BCM_I2C_NONPAGED_SEGMENT_BEGIN \ 30 | __pragma(code_seg(push)) \ 31 | //__pragma(code_seg(.text)) 32 | 33 | #define BCM_I2C_NONPAGED_SEGMENT_END \ 34 | __pragma(code_seg(pop)) 35 | 36 | #define BCM_I2C_PAGED_SEGMENT_BEGIN \ 37 | __pragma(code_seg(push)) \ 38 | __pragma(code_seg("PAGE")) 39 | 40 | #define BCM_I2C_PAGED_SEGMENT_END \ 41 | __pragma(code_seg(pop)) 42 | 43 | #define BCM_I2C_INIT_SEGMENT_BEGIN \ 44 | __pragma(code_seg(push)) \ 45 | __pragma(code_seg("INIT")) 46 | 47 | #define BCM_I2C_INIT_SEGMENT_END \ 48 | __pragma(code_seg(pop)) 49 | 50 | #define BCM_I2C_ASSERT_MAX_IRQL(Irql) NT_ASSERT(KeGetCurrentIrql() <= (Irql)) 51 | 52 | enum : ULONG { 53 | BCM_I2C_POOL_TAG = 'IMCB' 54 | }; 55 | 56 | namespace _DETAILS { 57 | 58 | // Disables template argument deduction from Forward helper 59 | template 60 | struct IDENTITY { 61 | // Map T to type unchanged 62 | typedef T TYPE; 63 | }; 64 | 65 | template 66 | inline T&& Forward (typename IDENTITY::TYPE& arg) throw() 67 | { 68 | // Forward arg, given explicitly specified Type parameter 69 | return (T&&)arg; 70 | } 71 | 72 | } // namespace _DETAILS 73 | 74 | template 75 | struct _FINALLY : public Fn { 76 | __forceinline _FINALLY (Fn&& Func) : Fn(_DETAILS::Forward(Func)) {} 77 | __forceinline _FINALLY (const _FINALLY&); // generate link error if copy constructor is called 78 | __forceinline ~_FINALLY () { this->operator()(); } 79 | }; 80 | 81 | template 82 | __forceinline _FINALLY Finally (Fn&& Func) 83 | { 84 | return {_DETAILS::Forward(Func)}; 85 | } 86 | 87 | EVT_WDF_DRIVER_DEVICE_ADD OnDeviceAdd; 88 | 89 | EVT_WDF_DRIVER_UNLOAD OnDriverUnload; 90 | extern "C" DRIVER_INITIALIZE DriverEntry; 91 | 92 | #endif // _DRIVER_H_ 93 | -------------------------------------------------------------------------------- /drivers/i2c/bcm2836/i2ctrace.h: -------------------------------------------------------------------------------- 1 | #ifndef _I2CTRACE_H_ 2 | #define _I2CTRACE_H_ 1 3 | 4 | // 5 | // Copyright (C) Microsoft. All rights reserved. 6 | // 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif // __cplusplus 11 | 12 | // 13 | // Defining control guids, including this is required to happen before 14 | // including the tmh file (if the WppRecorder API is used) 15 | // 16 | #include 17 | 18 | // 19 | // Tracing GUID - 2C6CF78D-93D0-4A18-A3A5-49C67BCBF820 20 | // 21 | #define WPP_CONTROL_GUIDS \ 22 | WPP_DEFINE_CONTROL_GUID(BCMI2C, (2C6CF78D,93D0,4A18,A3A5,49C67BCBF820), \ 23 | WPP_DEFINE_BIT(BSC_TRACING_DEFAULT) \ 24 | WPP_DEFINE_BIT(BSC_TRACING_VERBOSE) \ 25 | WPP_DEFINE_BIT(BSC_TRACING_DEBUG) \ 26 | WPP_DEFINE_BIT(BSC_TRACING_BUGCHECK) \ 27 | ) 28 | 29 | // begin_wpp config 30 | // 31 | // FUNC BSC_LOG_ERROR{LEVEL=TRACE_LEVEL_ERROR, FLAGS=BSC_TRACING_DEFAULT}(MSG, ...); 32 | // USEPREFIX (BSC_LOG_ERROR, "%!STDPREFIX! [%s @ %u] ERROR :", __FILE__, __LINE__); 33 | // 34 | // FUNC BSC_LOG_LOW_MEMORY{LEVEL=TRACE_LEVEL_ERROR, FLAGS=BSC_TRACING_DEFAULT}(MSG, ...); 35 | // USEPREFIX (BSC_LOG_LOW_MEMORY, "%!STDPREFIX! [%s @ %u] LOW MEMORY :", __FILE__, __LINE__); 36 | // 37 | // FUNC BSC_LOG_WARNING{LEVEL=TRACE_LEVEL_WARNING, FLAGS=BSC_TRACING_DEFAULT}(MSG, ...); 38 | // USEPREFIX (BSC_LOG_WARNING, "%!STDPREFIX! [%s @ %u] WARNING :", __FILE__, __LINE__); 39 | // 40 | // FUNC BSC_LOG_INFORMATION{LEVEL=TRACE_LEVEL_INFORMATION, FLAGS=BSC_TRACING_DEFAULT}(MSG, ...); 41 | // USEPREFIX (BSC_LOG_INFORMATION, "%!STDPREFIX! [%s @ %u] INFO :", __FILE__, __LINE__); 42 | // 43 | // FUNC BSC_LOG_TRACE{LEVEL=TRACE_LEVEL_VERBOSE, FLAGS=BSC_TRACING_VERBOSE}(MSG, ...); 44 | // USEPREFIX (BSC_LOG_TRACE, "%!STDPREFIX! [%s @ %u] TRACE :", __FILE__, __LINE__); 45 | // 46 | // end_wpp 47 | 48 | #ifdef __cplusplus 49 | } // extern "C" 50 | #endif // __cplusplus 51 | 52 | #endif // _I2CTRACE_H_ 53 | 54 | -------------------------------------------------------------------------------- /drivers/i2c/bcm2836/precomp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | -------------------------------------------------------------------------------- /drivers/i2c/bcm2836/resource.rc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) Microsoft Corporation 3 | // 4 | 5 | #include 6 | 7 | #include 8 | 9 | #define VER_FILETYPE VFT_DRV 10 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 11 | #define VER_FILEDESCRIPTION_STR "BCM I2C Controller Driver" 12 | #define VER_INTERNALNAME_STR "bcmi2c.sys" 13 | #define VER_ORIGINALFILENAME_STR "bcmi2c.sys" 14 | 15 | // Ensure that VS_VERSION_INFO in not defined 16 | #ifdef VS_VERSION_INFO 17 | #undef VS_VERSION_INFO 18 | #endif 19 | 20 | #include "common.ver" 21 | -------------------------------------------------------------------------------- /drivers/i2c/bcm2836/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | bcmi2c 5 | DRIVER 6 | retail 7 | 1 8 | 1 9 | /W4 /WX 10 | $(INCLUDES); $(SPB_INC_PATH)\$(SPB_VERSION_MAJOR).$(SPB_VERSION_MINOR); 11 | $(TARGETLIBS) $(SPB_LIB_PATH)\$(SPB_VERSION_MAJOR).$(SPB_VERSION_MINOR)\SpbCxStubs.lib $(DDK_LIB_PATH)\wpprecorder.lib 12 | $(TARGETNAME).inf 13 | 14 | -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi 2 (BCM2836) RPIQ Driver 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 (BCM2836) VC4 Mailbox Driver 2 | 3 | The RPIQ driver provides mailbox inteface to the VC GPU firmware. The mailbox 4 | interface is defined by Raspberry Pi and documentation can be found here 5 | https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface. The 6 | rpiq.h header provides some basic property definition. 7 | 8 | Currently the VCHIQ driver would use the mailbox interface by sending an IOCTL 9 | to RPIQ to intiialize the VCHIQ shared memory interface with the firmware. The 10 | RPIQ driver also is responsible to setup the mac address for Pi platform during 11 | boot. -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/RPIQ.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/mailbox/bcm2836/RPIQ.inf -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/device.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // device.h 7 | // 8 | // Abstract: 9 | // 10 | // This file contains the device definitions. 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | #define RPIQ_VERSION_MAJOR 0 18 | #define RPIQ_VERSION_MINOR 1 19 | 20 | #define RPIQ_NONPAGED_SEGMENT_BEGIN \ 21 | __pragma(code_seg(push)) 22 | 23 | #define RPIQ_NONPAGED_SEGMENT_END \ 24 | __pragma(code_seg(pop)) 25 | 26 | #define RPIQ_PAGED_SEGMENT_BEGIN \ 27 | __pragma(code_seg(push)) \ 28 | __pragma(code_seg("PAGE")) 29 | 30 | #define RPIQ_PAGED_SEGMENT_END \ 31 | __pragma(code_seg(pop)) 32 | 33 | #define RPIQ_INIT_SEGMENT_BEGIN \ 34 | __pragma(code_seg(push)) \ 35 | __pragma(code_seg("INIT")) 36 | 37 | #define RPIQ_INIT_SEGMENT_END \ 38 | __pragma(code_seg(pop)) 39 | 40 | #define RPIQ_MEMORY_RESOURCE_TOTAL 1 41 | #define RPIQ_INT_RESOURCE_TOTAL 1 42 | 43 | extern const int RpiqTag; 44 | 45 | typedef struct _DEVICE_CONTEXT { 46 | // Version 47 | ULONG VersionMajor; 48 | ULONG VersionMinor; 49 | 50 | // Mailbox Register 51 | MAILBOX* Mailbox; 52 | ULONG MailboxMmioLength; 53 | 54 | // Lock 55 | WDFWAITLOCK WriteLock; 56 | 57 | // Mailbox channel wdf queue object 58 | WDFQUEUE ChannelQueue[MAILBOX_CHANNEL_MAX]; 59 | 60 | // Interrupt 61 | WDFINTERRUPT MailboxIntObj; 62 | 63 | // Device interface notification handle 64 | VOID* NdisNotificationHandle; 65 | 66 | } DEVICE_CONTEXT, *PDEVICE_CONTEXT; 67 | 68 | WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(DEVICE_CONTEXT, RpiqGetContext) 69 | 70 | EVT_WDF_DEVICE_PREPARE_HARDWARE RpiqPrepareHardware; 71 | 72 | EVT_WDF_DEVICE_RELEASE_HARDWARE RpiqReleaseHardware; 73 | 74 | DRIVER_NOTIFICATION_CALLBACK_ROUTINE RpiqNdisInterfaceCallback; 75 | 76 | EVT_WDF_IO_TARGET_REMOVE_COMPLETE RpiqNdisTargetRemoveComplete; 77 | 78 | _IRQL_requires_max_(PASSIVE_LEVEL) 79 | NTSTATUS 80 | RpiqCreateDevice ( 81 | _In_ WDFDRIVER Driver, 82 | _Inout_ PWDFDEVICE_INIT DeviceInit 83 | ); 84 | 85 | EVT_WDF_IO_QUEUE_IO_STOP RpiqIoStop; 86 | 87 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/driver.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // driver.h 7 | // 8 | // Abstract: 9 | // 10 | // 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | DRIVER_INITIALIZE DriverEntry; 18 | EVT_WDF_DRIVER_UNLOAD RpiqOnDriverUnload; 19 | EVT_WDF_DRIVER_DEVICE_ADD RpiqOnDeviceAdd; 20 | 21 | EXTERN_C_END 22 | -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/init.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // init.h 7 | // 8 | // Abstract: 9 | // 10 | // This header contain early initialization related definition 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | EVT_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED RpiqInitOperation; 18 | 19 | _IRQL_requires_max_(PASSIVE_LEVEL) 20 | NTSTATUS RpiSetDeviceMacAddress( 21 | _In_ DEVICE_CONTEXT* DeviceContextPtr 22 | ); 23 | 24 | EXTERN_C_END 25 | -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/interrupt.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // interrupt.h 7 | // 8 | // Abstract: 9 | // 10 | // This file contains the interrupt related definitions. 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | _IRQL_requires_max_(PASSIVE_LEVEL) 18 | NTSTATUS RpiqEnableInterrupts ( 19 | _In_ DEVICE_CONTEXT* DeviceContextPtr 20 | ); 21 | 22 | _IRQL_requires_max_(PASSIVE_LEVEL) 23 | NTSTATUS RpiqDisableInterrupts ( 24 | _In_ DEVICE_CONTEXT* DeviceContextPtr 25 | ); 26 | 27 | EVT_WDF_INTERRUPT_ISR RpiqMailboxIsr; 28 | EVT_WDF_INTERRUPT_DPC RpiqMailboxDpc; 29 | 30 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/ioctl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // ioctl.h 7 | // 8 | // Abstract: 9 | // 10 | // This file contains the ioctl header. 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | #define IOCTL_MAILBOX_VCHIQ_INPUT_BUFFER_SIZE 8 18 | 19 | EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL RpiqProcessChannel; 20 | 21 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/mailbox.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // Mailbox.h 7 | // 8 | // Abstract: 9 | // 10 | // Mailbox Interface. 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | #define MAX_POLL 50 18 | 19 | typedef struct _RPIQ_REQUEST_CONTEXT { 20 | VOID* PropertyMemory; 21 | ULONG PropertyMemorySize; 22 | } RPIQ_REQUEST_CONTEXT, *PRPIQ_REQUEST_CONTEXT; 23 | 24 | WDF_DECLARE_CONTEXT_TYPE_WITH_NAME( 25 | RPIQ_REQUEST_CONTEXT, 26 | RpiqGetRequestContext); 27 | 28 | _IRQL_requires_max_(PASSIVE_LEVEL) 29 | NTSTATUS RpiqMailboxInit ( 30 | _In_ WDFDEVICE Device 31 | ); 32 | 33 | _IRQL_requires_max_(PASSIVE_LEVEL) 34 | NTSTATUS RpiqMailboxWrite ( 35 | _In_ DEVICE_CONTEXT* DeviceContextPtr, 36 | _In_ ULONG Channel, 37 | _In_ ULONG Value, 38 | _In_opt_ WDFREQUEST Request 39 | ); 40 | 41 | _IRQL_requires_max_(PASSIVE_LEVEL) 42 | NTSTATUS RpiqMailboxProperty ( 43 | _In_ DEVICE_CONTEXT* DeviceContextPtr, 44 | _In_reads_bytes_(DataSize) const VOID* DataInPtr, 45 | _In_ ULONG DataSize, 46 | _In_ ULONG Channel, 47 | _In_ WDFREQUEST Request 48 | ); 49 | 50 | EVT_WDF_OBJECT_CONTEXT_CLEANUP RpiqRequestContextCleanup; 51 | 52 | EXTERN_C_END 53 | -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/precomp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // precomp.h 7 | // 8 | // Abstract: 9 | // 10 | // 11 | // 12 | 13 | #pragma once 14 | 15 | #define INITGUID 16 | 17 | // Window related header files 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | // RPIQ public header 26 | #include "rpiq.h" 27 | -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/register.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // register.h 7 | // 8 | // Abstract: 9 | // 10 | // This header contain mailbox related register definition 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | #define OFFSET_DIRECT_SDRAM 0xC0000000 // Direct Access to SDRAM 18 | #define HEX_512_MB 0x20000000 19 | #define HEX_1_G 0x40000000 20 | 21 | // Status Bits 22 | #define MAILBOX_STATUS_FULL 0x80000000 23 | #define MAILBOX_STATUS_EMPTY 0x40000000 24 | #define MAILBOX_FILL_LEVEL_MASK 0x0000000F 25 | 26 | // Config Bits 27 | #define MAILBOX_DATA_AVAIL_ENABLE_IRQ 0x00000001 28 | #define MAILBOX_SPACE_AVAIL_ENABLE_IRQ 0x00000002 29 | #define MAILBOX_OPP_EMPTY_ENABLE_IRQ 0x00000004 30 | #define MAILBOX_RESET 0x00000008 31 | #define MAILBOX_DATA_AVAIL_PENDING 0x00000010 32 | #define MAILBOX_SPACE_AVAIL_PENDING 0x00000020 33 | #define MAILBOX_OPP_EMPTY_PENDING 0x00000040 34 | #define MAILBOX_MASK_IRQ 0x00000007 35 | 36 | // Mask 37 | #define MAILBOX_CHANNEL_MASK 0x0000000F 38 | 39 | // Power bit 40 | #define POWER_SD 0x0001 41 | #define POWER_UART 0x0002 42 | #define POWER_MINIUART 0x0004 43 | #define POWER_USB 0x0008 44 | #define POWER_12C0 0x0010 45 | #define POWER_12C1 0x0020 46 | #define POWER_12C2 0x0040 47 | #define POWER_SPI 0x0080 48 | #define POWER_CCP2TX 0x0100 49 | #define POWER_DSI 0x0200 50 | 51 | enum MAILBOX_CHANNEL { 52 | MAILBOX_CHANNEL_POWER_MGMT = 0, 53 | MAILBOX_CHANNEL_FB = 1, 54 | MAILBOX_CHANNEL_VIRTUAL_UART = 2, 55 | MAILBOX_CHANNEL_VCHIQ = 3, 56 | MAILBOX_CHANNEL_LED = 4, 57 | MAILBOX_CHANNEL_BUTTON = 5, 58 | MAILBOX_CHANNEL_TOUCH_SCREEN = 6, 59 | MAILBOX_CHANNEL_PROPERTY_ARM_VC = 8, 60 | MAILBOX_CHANNEL_PROPERTY_VC_ARM = 9, 61 | MAILBOX_CHANNEL_MAX = 10 62 | }; 63 | 64 | typedef struct _MAILBOX { 65 | volatile ULONG Read; 66 | volatile ULONG Rsvd0[3]; 67 | volatile ULONG Poll; 68 | volatile ULONG Send; 69 | volatile ULONG Status; 70 | volatile ULONG Config; 71 | volatile ULONG Write; 72 | } MAILBOX; 73 | 74 | EXTERN_C_END 75 | -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/rpiq.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/rpiq.rc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | #include 5 | #include 6 | 7 | #define VER_FILETYPE VFT_DRV 8 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 9 | #define VER_FILEDESCRIPTION_STR "BCM2836 RPIQ Driver" 10 | #define VER_INTERNALNAME_STR "rpiq.sys" 11 | 12 | // Ensure that VS_VERSION_INFO in not defined 13 | #ifdef VS_VERSION_INFO 14 | #undef VS_VERSION_INFO 15 | #endif 16 | 17 | #include "common.ver" 18 | -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | rpiq 5 | DRIVER 6 | retail 7 | 1 8 | /W4 /WX 9 | 1 10 | rpiq.inf 11 | $(TARGETLIBS) $(DDK_LIB_PATH)\wpprecorder.lib 12 | device.c driver.c init.c interrupt.c ioctl.c mailbox.c rpiq.rc 13 | 14 | -------------------------------------------------------------------------------- /drivers/mailbox/bcm2836/trace.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // trace.h 7 | // 8 | // Abstract: 9 | // 10 | // Header file for the debug tracing related function defintions and macros. 11 | // 12 | 13 | #include 14 | // 15 | // Define the tracing flags. 16 | // 17 | // Tracing GUID - 32EC38BE-1C63-47CD-ABEE-7D4E0ACDACAF 18 | // 19 | 20 | #define WPP_CONTROL_GUIDS \ 21 | WPP_DEFINE_CONTROL_GUID( \ 22 | RPiqTraceGuid, (32EC38BE,1C63,47CD,ABEE,7D4E0ACDACAF), \ 23 | WPP_DEFINE_BIT(TRACE_INFO) \ 24 | WPP_DEFINE_BIT(TRACE_WARNING) \ 25 | WPP_DEFINE_BIT(TRACE_ERROR) \ 26 | ) 27 | 28 | #define WPP_FLAG_LEVEL_LOGGER(flag, level) \ 29 | WPP_LEVEL_LOGGER(flag) 30 | 31 | #define WPP_FLAG_LEVEL_ENABLED(flag, level) \ 32 | (WPP_LEVEL_ENABLED(flag) && \ 33 | WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) 34 | 35 | #define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \ 36 | WPP_LEVEL_LOGGER(flags) 37 | 38 | #define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \ 39 | (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl) 40 | 41 | // 42 | // This comment block is scanned by the trace preprocessor to define our 43 | // Trace function. 44 | // 45 | // begin_wpp config 46 | // 47 | // FUNC RPIQ_LOG_INFORMATION{LEVEL=TRACE_LEVEL_INFORMATION, FLAGS=TRACE_INFO}(MSG, ...); 48 | // USEPREFIX (RPIQ_LOG_INFORMATION, "%!STDPREFIX! [%s @ %u] INFO:", __FILE__, __LINE__); 49 | // 50 | // FUNC RPIQ_LOG_WARNING{LEVEL=TRACE_LEVEL_WARNING, FLAGS=TRACE_WARNING}(MSG, ...); 51 | // USEPREFIX (RPIQ_LOG_WARNING, "%!STDPREFIX! [%s @ %u] INFO:", __FILE__, __LINE__); 52 | // 53 | // FUNC RPIQ_LOG_ERROR{LEVEL=TRACE_LEVEL_CRITICAL, FLAGS=TRACE_ERROR}(MSG, ...); 54 | // USEPREFIX (RPIQ_LOG_ERROR, "%!STDPREFIX! [%s @ %u] CRITICAL ERROR:", __FILE__, __LINE__); 55 | // 56 | // end_wpp 57 | // 58 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchi/common/endian.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012, Broadcom Europe Ltd 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef _VCHI_ENDIAN_H_ 29 | #define _VCHI_ENDIAN_H_ 30 | 31 | #include "interface/vcos/vcos.h" 32 | 33 | int16_t vchi_readbuf_int16 ( const void *ptr ); 34 | uint16_t vchi_readbuf_uint16( const void *ptr ); 35 | uint32_t vchi_readbuf_uint32( const void *ptr ); 36 | vcos_fourcc_t vchi_readbuf_fourcc( const void *ptr ); 37 | 38 | void vchi_writebuf_uint16( void *ptr, uint16_t value ); 39 | void vchi_writebuf_uint32( void *ptr, uint32_t value ); 40 | void vchi_writebuf_fourcc( void *ptr, vcos_fourcc_t value ); 41 | 42 | #endif /* _VCHI_ENDIAN_H_ */ 43 | 44 | /********************************** End of file ******************************************/ 45 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchi/vchi.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vchi/vchi.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchi/vchi_common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vchi/vchi_common.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchi/vchi_mh.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012, Broadcom Europe Ltd 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef VCHI_MH_H_ 29 | #define VCHI_MH_H_ 30 | 31 | #include 32 | 33 | typedef int32_t VCHI_MEM_HANDLE_T; 34 | #define VCHI_MEM_HANDLE_INVALID 0 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchiq_arm/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi vchiq_arm Windows kernel Mode Export Driver 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchiq_arm/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi vchiq_arm Windows kernel Mode Export Driver 2 | 3 | This kernel mode export driver is the equivalent of the vchiq_arm module that 4 | is available in userland to interact with VCHIQ. Kernel module will be able to 5 | interface with VCHIQ driver witht the standard vchiq_* interface just like any 6 | userland component. -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchiq_arm/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | vchiq_arm_kern 5 | EXPORT_DRIVER 6 | dll 7 | retail 8 | 9 | 1 10 | 1 11 | 1 12 | 0 13 | $(C_DEFINES) -DUNICODE -D_UNICODE -DWIN32 -DWIN32_KERN -DWIN32DLL_EXPORTS -DUSE_VCHIQ_ARM 14 | $(INCLUDES); $(IFSKIT_INC_PATH); ..\; ..\..\; ..\vcos\win32; 15 | vchiq_lib.c 16 | $(TARGETLIBS) $(SDK_LIB_PATH)\onecore.lib $(DDK_LIB_PATH)\ntoskrnl.lib 17 | 18 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchiq_arm/vchiq.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012, Broadcom Europe Ltd 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef VCHIQ_VCHIQ_H 29 | #define VCHIQ_VCHIQ_H 30 | 31 | #include "vchiq_if.h" 32 | #include "vchiq_util.h" 33 | #include "interface/vcos/vcos.h" 34 | 35 | #endif 36 | 37 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchiq_arm/vchiq_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2014, Broadcom Europe Ltd 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef VCHIQ_CFG_H 29 | #define VCHIQ_CFG_H 30 | 31 | #define VCHIQ_MAGIC VCHIQ_MAKE_FOURCC('V', 'C', 'H', 'I') 32 | /* The version of VCHIQ - change with any non-trivial change */ 33 | #define VCHIQ_VERSION 8 34 | /* The minimum compatible version - update to match VCHIQ_VERSION with any 35 | ** incompatible change */ 36 | #define VCHIQ_VERSION_MIN 3 37 | 38 | /* The version that introduced the VCHIQ_IOC_LIB_VERSION ioctl */ 39 | #define VCHIQ_VERSION_LIB_VERSION 7 40 | 41 | /* The version that introduced the VCHIQ_IOC_CLOSE_DELIVERED ioctl */ 42 | #define VCHIQ_VERSION_CLOSE_DELIVERED 7 43 | 44 | /* The version that made it safe to use SYNCHRONOUS mode */ 45 | #define VCHIQ_VERSION_SYNCHRONOUS_MODE 8 46 | 47 | #define VCHIQ_MAX_STATES 2 48 | #define VCHIQ_MAX_SERVICES 4096 49 | #define VCHIQ_MAX_SLOTS 128 50 | #define VCHIQ_MAX_SLOTS_PER_SIDE 64 51 | 52 | #define VCHIQ_NUM_CURRENT_BULKS 32 53 | #define VCHIQ_NUM_SERVICE_BULKS 4 54 | 55 | #ifndef VCHIQ_ENABLE_DEBUG 56 | #define VCHIQ_ENABLE_DEBUG 1 57 | #endif 58 | 59 | #ifndef VCHIQ_ENABLE_STATS 60 | #define VCHIQ_ENABLE_STATS 1 61 | #endif 62 | 63 | #endif /* VCHIQ_CFG_H */ 64 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchiq_arm/vchiq_if.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vchiq_arm/vchiq_if.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchiq_arm/vchiq_ioctl.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vchiq_arm/vchiq_ioctl.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchiq_arm/vchiq_lib.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vchiq_arm/vchiq_lib.c -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vchiq_arm/vchiq_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012, Broadcom Europe Ltd 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | #ifndef VCHIQ_UTIL_H 29 | #define VCHIQ_UTIL_H 30 | 31 | #include "vchiq_if.h" 32 | #include "interface/vcos/vcos.h" 33 | 34 | typedef struct { 35 | int size; 36 | int read; 37 | int write; 38 | 39 | VCOS_EVENT_T pop; 40 | VCOS_EVENT_T push; 41 | 42 | VCHIQ_HEADER_T **storage; 43 | } VCHIU_QUEUE_T; 44 | 45 | extern int vchiu_queue_init(VCHIU_QUEUE_T *queue, int size); 46 | extern void vchiu_queue_delete(VCHIU_QUEUE_T *queue); 47 | 48 | extern int vchiu_queue_is_empty(VCHIU_QUEUE_T *queue); 49 | extern int vchiu_queue_is_full(VCHIU_QUEUE_T *queue); 50 | 51 | extern void vchiu_queue_push(VCHIU_QUEUE_T *queue, VCHIQ_HEADER_T *header); 52 | 53 | extern VCHIQ_HEADER_T *vchiu_queue_peek(VCHIU_QUEUE_T *queue); 54 | extern VCHIQ_HEADER_T *vchiu_queue_pop(VCHIU_QUEUE_T *queue); 55 | 56 | #endif 57 | 58 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/generic/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi VCOS generic Windows kernel mode library 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/generic/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi VCOS generic Windows kernel mode library 2 | 3 | This library is the Windows kernel mode version of VCOS generic library that is 4 | also available in userland. Only minimal component is ported over. -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/generic/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | vcos_win32_kern_generic 5 | LIBRARY 6 | 1 7 | 1 8 | 1 9 | 1 10 | $(C_DEFINES) -DUNICODE -D_UNICODE -DWIN32_KERN -DWIN32DLL_EXPORTS -DVCOS_PROVIDER 11 | $(INCLUDES); ..\; ..\..\..\; ..\win32\; 12 | vcos_abort.c vcos_generic_blockpool.c vcos_generic_named_sem.c vcos_init.c vcos_logcat.c vcos_mem_from_malloc.c vcos_msgqueue.c 13 | 14 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/generic/vcos_abort.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/generic/vcos_abort.c -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/generic/vcos_deprecated.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012, Broadcom Europe Ltd 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | /* 29 | The symbol vcos_deprecated_code may be defined at most once, by the inclusion of "vcos_deprecated.h" in vcos_init.c. 30 | Any other inclusions of this header will cause the linker to warn about multiple definitions of vcos_deprecated_code, for example: 31 | [ldvc] (Warning) "vcos_deprecated_code" is multiply defined in libs/vcos_threadx/vcos_init.c.o and libs/xxxxx/xxxxx.c.o 32 | If you see a build message like this then the configuration you are building is using deprecated code. 33 | Contact the person named in the accompanying comment for advice - do not remove the inclusion. 34 | */ 35 | 36 | int vcos_deprecated_code; 37 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/generic/vcos_generic_blockpool.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/generic/vcos_generic_blockpool.c -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/generic/vcos_logcat.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/generic/vcos_logcat.c -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/generic/vcos_mem_from_malloc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/generic/vcos_mem_from_malloc.c -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_attr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/vcos_attr.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_ctype.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012, Broadcom Europe Ltd 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | /*============================================================================= 29 | VideoCore OS Abstraction Layer - public header file 30 | =============================================================================*/ 31 | 32 | #ifndef VCOS_CTYPE_H 33 | #define VCOS_CTYPE_H 34 | 35 | /** 36 | * \file 37 | * 38 | * ctype functions. 39 | * 40 | */ 41 | 42 | #ifdef __KERNEL__ 43 | #include 44 | #else 45 | #include 46 | #endif 47 | 48 | #endif 49 | 50 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_inttypes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/vcos_inttypes.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_logging.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/vcos_logging.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_logging_control.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012, Broadcom Europe Ltd 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | 28 | 29 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_named_semaphore.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/vcos_named_semaphore.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_once.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/vcos_once.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_stdbool.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2012, Broadcom Europe Ltd 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | * Neither the name of the copyright holder nor the 13 | names of its contributors may be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY 20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | */ 27 | #ifndef VCOS_STDBOOL_H 28 | #define VCOS_STDBOOL_H 29 | 30 | #ifndef __cplusplus 31 | 32 | #if defined(__STDC__) && (__STDC_VERSION__ >= 199901L) 33 | #include 34 | #else 35 | /* sizeof(bool) == 1. hopefully this matches up with c++ (so structures and 36 | * such containing bool are binary compatible), but the c++ standard doesn't 37 | * require sizeof(bool) == 1, so there's no guarantee */ 38 | typedef unsigned char bool; 39 | enum { 40 | false, 41 | true 42 | }; 43 | #endif 44 | 45 | #endif /* __cplusplus */ 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_stdint.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/vcos_stdint.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_string.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/vcos_string.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_timer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/vcos_timer.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/vcos_types.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/vcos_types.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/win32/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi VCOS Win32 Kernel Mode Export Driver 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/win32/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi VCOS Win32 Kernel Mode Export Driver 2 | 3 | This kernel mode export driver is the equivalent of the vcos module that is 4 | available in userland. Just like the vcos module in userland vcos_win32_kern 5 | acts as the OS abstraction layer proving Windows kernel mode interfaces.Not 6 | all of vcos_* interface is implemented for kernel mode. -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/win32/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | vcos_win32_kern 5 | EXPORT_DRIVER 6 | dll 7 | retail 8 | 9 | 1 10 | 1 11 | $(C_DEFINES) -DUNICODE -D_UNICODE -DWIN32_KERN -DWIN32DLL_EXPORTS -DVCOS_PROVIDER 12 | $(INCLUDES); ..\..\..\; 13 | vcos_pthreads.c 14 | $(OBJ_PATH)\..\generic\$(O)\vcos_abort.obj $(OBJ_PATH)\..\generic\$(O)\vcos_generic_blockpool.obj $(OBJ_PATH)\..\generic\$(O)\vcos_generic_named_sem.obj $(OBJ_PATH)\..\generic\$(O)\vcos_init.obj $(OBJ_PATH)\..\generic\$(O)\vcos_logcat.obj $(OBJ_PATH)\..\generic\$(O)\vcos_mem_from_malloc.obj $(OBJ_PATH)\..\generic\$(O)\vcos_msgqueue.obj 15 | $(TARGETLIBS) $(SDK_LIB_PATH)\onecore.lib $(DDK_LIB_PATH)\ntoskrnl.lib 16 | 17 | -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/win32/vcos_platform.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/win32/vcos_platform.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/win32/vcos_platform_types.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/win32/vcos_platform_types.h -------------------------------------------------------------------------------- /drivers/misc/userland/interface/vcos/win32/vcos_pthreads.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/userland/interface/vcos/win32/vcos_pthreads.c -------------------------------------------------------------------------------- /drivers/misc/vchiq/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi VCHIQ Driver 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/misc/vchiq/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi VCHIQ Driver 2 | 3 | This is the Video Core Host Interface Queue driver that is responsible to 4 | marshall communication with the GPU firmware. THe VCHIQ driver is main function 5 | is to provide the interface with firmware with various client such as MMAL. 6 | 7 | VCHIQ communicates with the GPU firmware through a shared memory that is 8 | initialized through mailbox interface (rpiq). The shared memory are divided 9 | into slots. The first slot (slot 0) acts like a header containing the structer 10 | definition for the rest of the slot. The remaining slots are allocated for The 11 | master (firmware) and slave (VCHIQ). Firmware would use the master slots to 12 | send message to slave while VCHIQ driver would use the slave slot to send 13 | message to the firmware. Firmware and VCHIQ notifies the avaibility of new 14 | message through doorbell interrups. A portion of the shared memory at the end 15 | of the shared memory is called fragment block. The fragment block is meant to 16 | patch DMA transfer for buffer that is not align with cache size. This is not 17 | used as VCHIQ takes advantage of DMA api for DMA buffer. -------------------------------------------------------------------------------- /drivers/misc/vchiq/driver.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // driver.h 7 | // 8 | // Abstract: 9 | // 10 | // VCHIQ main driver entry headers 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | DRIVER_INITIALIZE DriverEntry; 18 | EVT_WDF_DRIVER_UNLOAD VchiqOnDriverUnload; 19 | EVT_WDF_DRIVER_DEVICE_ADD VchiqOnDeviceAdd; 20 | 21 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/misc/vchiq/file.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // file.h 7 | // 8 | // Abstract: 9 | // 10 | // This file contains file handle related definitions. 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | enum { 18 | // Message queues 19 | FILE_QUEUE_CREATE_SERVICE = 0, 20 | FILE_QUEUE_CLOSE_SERVICE, 21 | FILE_QUEUE_PENDING_MSG, 22 | FILE_QUEUE_PENDING_VCHI_MSG, 23 | FILE_QUEUE_TX_DATA, 24 | FILE_QUEUE_RX_DATA, 25 | FILE_QUEUE_MAX, 26 | }; 27 | 28 | typedef enum _MSG_BULK_TYPE { 29 | // Message queues 30 | MSG_BULK_TX = 0, 31 | MSG_BULK_RX, 32 | MSG_BULK_MAX, 33 | }MSG_BULK_TYPE; 34 | 35 | typedef enum _SERVICE_STATE { 36 | // Service State 37 | SERVICE_STATE_MIN = 0, 38 | SERVICE_STATE_OPEN = 1, 39 | SERVICE_STATE_CLOSE = 2, 40 | }_ERVICE_STATE; 41 | 42 | typedef struct _VCHIQ_FILE_CONTEXT { 43 | ULONG ArmPortNumber; 44 | ULONG VCHIQPortNumber; 45 | 46 | // Lookaside memory per file handle to take advantage 47 | // of WDF memory cleanup by parenting to file object 48 | WDFLOOKASIDE PendingMsgLookAsideMemory; 49 | WDFLOOKASIDE PendingBulkMsgLookAsideMemory; 50 | 51 | LIST_ENTRY PendingDataMsgList; 52 | FAST_MUTEX PendingDataMsgMutex; 53 | 54 | LIST_ENTRY PendingBulkMsgList[MSG_BULK_MAX]; 55 | FAST_MUTEX PendingBulkMsgMutex[MSG_BULK_MAX]; 56 | 57 | WDFQUEUE FileQueue[FILE_QUEUE_MAX]; 58 | 59 | KEVENT FileEventStop; 60 | 61 | // Pointer to service data in user space. Userland expects the driver 62 | // returns this back when completing a transaction 63 | VOID *ServiceUserData; 64 | 65 | ULONG IsVchi; 66 | LIST_ENTRY PendingVchiMsgList; 67 | FAST_MUTEX PendingVchiMsgMutex; 68 | 69 | // Minimal state management for now. Consider to expand more service 70 | // state tracking i current implementation is insufficient. 71 | volatile LONG State; 72 | 73 | // DMA 74 | DMA_ADAPTER* DmaAdapterPtr; 75 | 76 | } VCHIQ_FILE_CONTEXT, *PVCHIQ_FILE_CONTEXT; 77 | 78 | WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(VCHIQ_FILE_CONTEXT, VchiqGetFileContext); 79 | 80 | _IRQL_requires_max_(PASSIVE_LEVEL) 81 | NTSTATUS VchiqAllocateFileObjContext ( 82 | _In_ DEVICE_CONTEXT* DeviceContextPtr, 83 | _In_ WDFFILEOBJECT WdfFileObject, 84 | _Outptr_ VCHIQ_FILE_CONTEXT** VchiqFileContextPPtr 85 | ); 86 | 87 | EVT_WDF_FILE_CLOSE VchiqFileClose; 88 | 89 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/misc/vchiq/init.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // init.h 7 | // 8 | // Abstract: 9 | // 10 | // This header contain early initialization related definition 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | EVT_WDF_DEVICE_D0_ENTRY_POST_INTERRUPTS_ENABLED VchiqInitOperation; 18 | DRIVER_NOTIFICATION_CALLBACK_ROUTINE VchiqInterfaceCallback; 19 | 20 | EXTERN_C_END 21 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/interrupt.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // interrupt.h 7 | // 8 | // Abstract: 9 | // 10 | // This file contains the interrupt related definitions. 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | _IRQL_requires_max_(PASSIVE_LEVEL) 18 | NTSTATUS VchiqEnableInterrupts ( 19 | _In_ DEVICE_CONTEXT* DeviceContextPtr 20 | ); 21 | 22 | _IRQL_requires_max_(PASSIVE_LEVEL) 23 | NTSTATUS VchiqDisableInterrupts ( 24 | _In_ DEVICE_CONTEXT* DeviceContextPtr 25 | ); 26 | 27 | EVT_WDF_INTERRUPT_ISR VchiqIsr; 28 | EVT_WDF_INTERRUPT_DPC VchiqDpc; 29 | 30 | EXTERN_C_END 31 | 32 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/ioctl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // ioctl.h 7 | // 8 | // Abstract: 9 | // 10 | // This file contains the ioctl header for vchiq driver. 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | EVT_WDF_IO_QUEUE_IO_DEVICE_CONTROL VchiqIoDeviceControl; 18 | 19 | _IRQL_requires_max_(PASSIVE_LEVEL) 20 | NTSTATUS VchiqUpdateQueueDispatchMessage ( 21 | _In_ DEVICE_CONTEXT* DeviceContextPtr, 22 | _In_ VCHIQ_FILE_CONTEXT* VchiqFileContextPtr, 23 | _In_opt_ WDFREQUEST Request, 24 | _In_opt_ WDFQUEUE MsgQueue, 25 | _In_ ULONG MessageId, 26 | _In_reads_bytes_(BufferSize) VOID* BufferPtr, 27 | _In_ ULONG BufferSize 28 | ); 29 | 30 | EVT_WDF_IO_IN_CALLER_CONTEXT VchiqInCallerContext; 31 | 32 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/misc/vchiq/memory.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // memory.h 7 | // 8 | // Abstract: 9 | // 10 | // This file contains memory related definitions. 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | #define MEMORY_SIZE_1_G 0x40000000 18 | 19 | _IRQL_requires_max_(PASSIVE_LEVEL) 20 | NTSTATUS VchiqAllocPhyContiguous ( 21 | _In_ DEVICE_CONTEXT* DeviceContextPtr, 22 | _In_ ULONG BufferSize, 23 | _Outptr_ VOID** BufferPPtr 24 | ); 25 | 26 | _IRQL_requires_max_(PASSIVE_LEVEL) 27 | NTSTATUS VchiqAllocateCommonBuffer ( 28 | _In_ VCHIQ_FILE_CONTEXT* VchiqFileContextPtr, 29 | _In_ ULONG BufferSize, 30 | _Outptr_ VOID** BufferPPtr, 31 | _Out_ PHYSICAL_ADDRESS* PhyAddressPtr 32 | ); 33 | 34 | _IRQL_requires_max_(DISPATCH_LEVEL) 35 | NTSTATUS VchiqFreeCommonBuffer ( 36 | _In_ VCHIQ_FILE_CONTEXT* VchiqFileContextPtr, 37 | _In_ ULONG BufferSize, 38 | _In_ PHYSICAL_ADDRESS PhyAddress, 39 | _In_ VOID* BufferPtr 40 | ); 41 | 42 | _IRQL_requires_max_(DISPATCH_LEVEL) 43 | NTSTATUS VchiqFreePhyContiguous ( 44 | _In_ DEVICE_CONTEXT* DeviceContextPtr, 45 | _In_ VOID** BufferPPtr 46 | ); 47 | 48 | EXTERN_C_END 49 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/precomp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // precomp.h 7 | // 8 | // Abstract: 9 | // 10 | // 11 | // 12 | 13 | #pragma once 14 | 15 | #define INITGUID 16 | 17 | // Window related header files 18 | #include 19 | #include 20 | #include 21 | 22 | // RPIQ driver public header 23 | #include "rpiq.h" 24 | 25 | // VCHIQ driver public header 26 | #include "vchiq.h" 27 | 28 | // VCHIQ ported over public header 29 | #include "vchiq_common.h" 30 | #include "vchiq_2835.h" 31 | #include "vchiq_if.h" 32 | #include "vchiq_cfg.h" 33 | #include "vchiq_core.h" 34 | #include "vchiq_pagelist.h" 35 | #include "vchiq_ioctl.h" 36 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/slotscommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // slotmgmt.h 7 | // 8 | // Abstract: 9 | // 10 | // This file contains the definitions for commont slot management 11 | // definition. 12 | // 13 | 14 | #pragma once 15 | 16 | EXTERN_C_START 17 | 18 | typedef struct _SLOT_INFO { 19 | volatile LONG RefCount; 20 | BOOLEAN SlotInUse; 21 | }SLOT_INFO, *PSLOT_INFO; 22 | 23 | typedef struct _VCHIQ_PENDING_MSG { 24 | VCHIQ_HEADER* Msg; 25 | ULONG SlotNumber; 26 | WDFMEMORY WdfMemory; 27 | LIST_ENTRY ListEntry; 28 | }VCHIQ_PENDING_MSG, *PVCHIQ_PENDING_MSG; 29 | 30 | typedef struct _VCHIQ_PENDING_BULK_MSG { 31 | VOID* BulkUserData; 32 | WDFMEMORY WdfMemory; 33 | LIST_ENTRY ListEntry; 34 | VCHIQ_BULK_MODE_T Mode; 35 | }VCHIQ_PENDING_BULK_MSG, *PVCHIQ_PENDING_BULK_MSG; 36 | 37 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/misc/vchiq/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | vchiq 5 | DRIVER 6 | retail 7 | 1 8 | /W4 /WX 9 | 1 10 | vchiq.inf 11 | $(INCLUDES); ..\..\mailbox\bcm2836 12 | $(TARGETLIBS) $(DDK_LIB_PATH)\wpprecorder.lib 13 | device.c driver.c file.c init.c interrupt.c ioctl.c memory.c slots.c trace.c transfer.c 14 | 15 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/trace.c: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // trace.c 7 | // 8 | // Abstract: 9 | // 10 | // Vchiq trace related implementation 11 | // 12 | 13 | #include "precomp.h" 14 | 15 | ULONG VchiqCriticalDebugBreak ( 16 | ) 17 | { 18 | for (;;) { 19 | char response[2] = { 0 }; 20 | DbgPrompt( 21 | "Break to debug (b) or ignore (i)? ", 22 | response, 23 | sizeof(response)); 24 | 25 | if ((response[0] == 'B') || (response[0] == 'b')) { 26 | DbgBreakPoint(); 27 | break; 28 | } else if ((response[0] == 'I') || (response[0] == 'i')) { 29 | break; 30 | } 31 | } 32 | 33 | return 1; 34 | } -------------------------------------------------------------------------------- /drivers/misc/vchiq/trace.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // trace.h 7 | // 8 | // Abstract: 9 | // 10 | // Header file for the debug tracing related function defintions and macros. 11 | // 12 | 13 | #include 14 | // 15 | // Define the tracing flags. 16 | // 17 | // Tracing GUID - 32EC38BE-1C63-47CD-ABEE-7D4E0ACDACAF 18 | // 19 | 20 | #define WPP_CONTROL_GUIDS \ 21 | WPP_DEFINE_CONTROL_GUID( \ 22 | VchiqTraceGuid, (05B041F1,D0E4,4AA6,A9F6,ECBEBC832D4C), \ 23 | WPP_DEFINE_BIT(TRACE_INFO) \ 24 | WPP_DEFINE_BIT(TRACE_WARNING) \ 25 | WPP_DEFINE_BIT(TRACE_ERROR) \ 26 | ) 27 | 28 | #define WPP_FLAG_LEVEL_LOGGER(flag, level) \ 29 | WPP_LEVEL_LOGGER(flag) 30 | 31 | #define WPP_FLAG_LEVEL_ENABLED(flag, level) \ 32 | (WPP_LEVEL_ENABLED(flag) && \ 33 | WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) 34 | 35 | #define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \ 36 | WPP_LEVEL_LOGGER(flags) 37 | 38 | #define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \ 39 | (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl) 40 | 41 | // 42 | // This comment block is scanned by the trace preprocessor to define our 43 | // Trace function. 44 | // 45 | // begin_wpp config 46 | // 47 | // FUNC VCHIQ_LOG_INFORMATION{LEVEL=TRACE_LEVEL_INFORMATION, FLAGS=TRACE_INFO}(MSG, ...); 48 | // USEPREFIX (VCHIQ_LOG_INFORMATION, "%!STDPREFIX! [%s @ %u] INFO:", __FILE__, __LINE__); 49 | // 50 | // FUNC VCHIQ_LOG_WARNING{LEVEL=TRACE_LEVEL_WARNING, FLAGS=TRACE_WARNING}(MSG, ...); 51 | // USEPREFIX (VCHIQ_LOG_WARNING, "%!STDPREFIX! [%s @ %u] WARNING:", __FILE__, __LINE__); 52 | // 53 | // FUNC VCHIQ_LOG_ERROR{LEVEL=TRACE_LEVEL_CRITICAL, FLAGS=TRACE_ERROR}(MSG, ...); 54 | // USEPREFIX (VCHIQ_LOG_ERROR, "%!STDPREFIX! [%s @ %u] CRITICAL ERROR:", __FILE__, __LINE__); 55 | // 56 | // end_wpp 57 | // 58 | 59 | extern ULONG VchiqCriticalDebugBreak(); 60 | 61 | #define WPP_LEVEL_FLAGS_POST(LEVEL,FLAGS) \ 62 | ,(((WPP_BIT_ ## FLAGS) == WPP_BIT_TRACE_ERROR) ? \ 63 | VchiqCriticalDebugBreak() : 1) 64 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/transfer.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // transfer.h 7 | // 8 | // Abstract: 9 | // 10 | // This file contains vchiq bulk transfer related definitions. 11 | // 12 | 13 | #pragma once 14 | 15 | EXTERN_C_START 16 | 17 | typedef struct _VCHIQ_TX_REQUEST_CONTEXT { 18 | MDL* BufferMdlPtr; 19 | VOID* PageListPtr; 20 | ULONG PageListSize; 21 | PHYSICAL_ADDRESS PageListPhyAddr; 22 | SCATTER_GATHER_LIST* ScatterGatherListPtr; 23 | DEVICE_CONTEXT* DeviceContextPtr; 24 | VCHIQ_FILE_CONTEXT* VchiqFileContextPtr; 25 | } VCHIQ_TX_REQUEST_CONTEXT, *PVCHIQ_TX_REQUEST_CONTEXT; 26 | 27 | WDF_DECLARE_CONTEXT_TYPE_WITH_NAME( 28 | VCHIQ_TX_REQUEST_CONTEXT, 29 | VchiqGetTxRequestContext); 30 | 31 | _IRQL_requires_max_(PASSIVE_LEVEL) 32 | NTSTATUS VchiqAllocateTransferRequestObjContext ( 33 | _In_ DEVICE_CONTEXT* DeviceContextPtr, 34 | _In_ VCHIQ_FILE_CONTEXT* VchiqFileContextPtr, 35 | _In_ WDFREQUEST Request, 36 | _In_ MDL* BufferMdlPtr, 37 | _In_ VOID* PageListPtr, 38 | _In_ ULONG PageListSize, 39 | _In_ PHYSICAL_ADDRESS PageListPhyAddr, 40 | _In_ SCATTER_GATHER_LIST* ScatterGatherListPtr, 41 | _Outptr_ VCHIQ_TX_REQUEST_CONTEXT** VchiqTxRequestContextPPtr 42 | ); 43 | 44 | EVT_WDF_OBJECT_CONTEXT_CLEANUP VchiqTransferRequestContextCleanup; 45 | 46 | EXTERN_C_END 47 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/vchiq.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/misc/vchiq/vchiq.inf -------------------------------------------------------------------------------- /drivers/misc/vchiq/vchiq.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/vchiq_2835.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // vchiq_2835.h 7 | // 8 | // Abstract: 9 | // 10 | // This header contains sepcific definition from Raspberry Pi 11 | // public userland repo. This is based on the vchiq_2835.h header. 12 | // Only minimal definitions are ported over. 13 | // 14 | 15 | #pragma once 16 | 17 | #define VCHIQ_PLATFORM_FRAGMENTS_OFFSET_IDX 0 18 | #define VCHIQ_PLATFORM_FRAGMENTS_COUNT_IDX 1 19 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/vchiq_cfg.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // vchiq_cfg.h 7 | // 8 | // Abstract: 9 | // 10 | // This header contains sepcific definition from Raspberry Pi 11 | // public userland repo. This is based on the vchiq_cfg.h header 12 | // 13 | 14 | #pragma once 15 | 16 | EXTERN_C_START 17 | 18 | #define VCHIQ_MAGIC VCHIQ_MAKE_FOURCC('V', 'C', 'H', 'I') 19 | /* The version of VCHIQ - change with any non-trivial change */ 20 | #define VCHIQ_VERSION 8 21 | /* The minimum compatible version - update to match VCHIQ_VERSION with any 22 | ** incompatible change */ 23 | #define VCHIQ_VERSION_MIN 3 24 | 25 | /* The version that introduced the VCHIQ_IOC_LIB_VERSION ioctl */ 26 | #define VCHIQ_VERSION_LIB_VERSION 7 27 | 28 | /* The version that introduced the VCHIQ_IOC_CLOSE_DELIVERED ioctl */ 29 | #define VCHIQ_VERSION_CLOSE_DELIVERED 7 30 | 31 | /* The version that made it safe to use SYNCHRONOUS mode */ 32 | #define VCHIQ_VERSION_SYNCHRONOUS_MODE 8 33 | 34 | #define VCHIQ_MAX_STATES 1 35 | #define VCHIQ_MAX_SERVICES 4096 36 | #define VCHIQ_MAX_SLOTS 128 37 | #define VCHIQ_MAX_SLOTS_PER_SIDE 64 38 | 39 | #define VCHIQ_NUM_CURRENT_BULKS 32 40 | #define VCHIQ_NUM_SERVICE_BULKS 4 41 | 42 | #ifndef VCHIQ_ENABLE_DEBUG 43 | #define VCHIQ_ENABLE_DEBUG 1 44 | #endif 45 | 46 | #ifndef VCHIQ_ENABLE_STATS 47 | #define VCHIQ_ENABLE_STATS 1 48 | #endif 49 | 50 | EXTERN_C_END 51 | -------------------------------------------------------------------------------- /drivers/misc/vchiq/vchiq_common.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // vchiq_common.h 7 | // 8 | // Abstract: 9 | // 10 | // This header contains sepcific definition from Raspberry Pi 11 | // vchiq_common.h header in the public userland repo. 12 | // It also includes definition that is not included in a spcific 13 | // header file. 14 | // 15 | 16 | #pragma once 17 | 18 | EXTERN_C_START 19 | 20 | //callback reasons when an event occurs on a service 21 | typedef enum _VCHI_CALLBACK_REASON { 22 | VCHI_CALLBACK_REASON_MIN, 23 | 24 | //This indicates that there is data available 25 | //handle is the msg id that was transmitted with the data 26 | // When a message is received and there was no FULL message available previously, send callback 27 | // Tasks get kicked by the callback, reset their event and try and read from the fifo until it fails 28 | VCHI_CALLBACK_MSG_AVAILABLE, 29 | VCHI_CALLBACK_MSG_SENT, 30 | VCHI_CALLBACK_MSG_SPACE_AVAILABLE, // XXX not yet implemented 31 | 32 | // This indicates that a transfer from the other side has completed 33 | VCHI_CALLBACK_BULK_RECEIVED, 34 | //This indicates that data queued up to be sent has now gone 35 | //handle is the msg id that was used when sending the data 36 | VCHI_CALLBACK_BULK_SENT, 37 | VCHI_CALLBACK_BULK_RX_SPACE_AVAILABLE, // XXX not yet implemented 38 | VCHI_CALLBACK_BULK_TX_SPACE_AVAILABLE, // XXX not yet implemented 39 | 40 | VCHI_CALLBACK_SERVICE_CLOSED, 41 | 42 | // this side has sent XOFF to peer due to lack of data consumption by service 43 | // (suggests the service may need to take some recovery action if it has 44 | // been deliberately holding off consuming data) 45 | VCHI_CALLBACK_SENT_XOFF, 46 | VCHI_CALLBACK_SENT_XON, 47 | 48 | // indicates that a bulk transfer has finished reading the source buffer 49 | VCHI_CALLBACK_BULK_DATA_READ, 50 | 51 | // power notification events (currently host side only) 52 | VCHI_CALLBACK_PEER_OFF, 53 | VCHI_CALLBACK_PEER_SUSPENDED, 54 | VCHI_CALLBACK_PEER_ON, 55 | VCHI_CALLBACK_PEER_RESUMED, 56 | VCHI_CALLBACK_FORCED_POWER_OFF, 57 | 58 | #ifdef USE_VCHIQ_ARM 59 | // some extra notifications provided by vchiq_arm 60 | VCHI_CALLBACK_SERVICE_OPENED, 61 | VCHI_CALLBACK_BULK_RECEIVE_ABORTED, 62 | VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, 63 | #endif 64 | 65 | VCHI_CALLBACK_REASON_MAX 66 | } VCHI_CALLBACK_REASON; 67 | 68 | // Mailbox 69 | #define MAILBOX_CHANNEL_VCHIQ 3 70 | 71 | // Definition from vchiq_2835_arm.c 72 | 73 | #define VCHIQ_TOTAL_SLOTS (VCHIQ_SLOT_ZERO_SLOTS + 2 * 32) 74 | 75 | #define VCHIQ_MAX_FRAGMENTS (VCHIQ_NUM_CURRENT_BULKS * 2) 76 | 77 | #define BELL0 0x00 78 | #define BELL2 0x08 79 | 80 | // End vchiq_2835_arm.c 81 | 82 | // Definition from vchiq_core.c 83 | 84 | typedef struct _VCHIQ_OPEN_PAYLOAD { 85 | ULONG FourCC; 86 | ULONG ClientId; 87 | SHORT Version; 88 | SHORT VersionMin; 89 | }VCHIQ_OPEN_PAYLOAD, *PVCHIQ_OPEN_PAYLOAD; 90 | 91 | // End vchiq_core.c 92 | 93 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/misc/vchiq/vchiq_ioctl.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // vchiq_ioctl.h 7 | // 8 | // Abstract: 9 | // 10 | // This header contains sepcific definition from Raspberry Pi 11 | // public userland repo. This is based on the vchiq_ioctl.h header 12 | // 13 | 14 | #pragma once 15 | 16 | EXTERN_C_START 17 | 18 | #include 19 | 20 | #define VCHIQ_IOC_MAGIC 0xc4 21 | #define VCHIQ_INVALID_HANDLE (~0) 22 | 23 | typedef struct _VCHIQ_CREATE_SERVICE { 24 | VCHIQ_SERVICE_PARAMS Params; 25 | int IsOpen; 26 | int IsVchi; 27 | unsigned int handle; /* OUT */ 28 | } VCHIQ_CREATE_SERVICE, *PVCHIQ_CREATE_SERVICE; 29 | 30 | typedef struct _VCHIQ_QUEUE_MESSAGE { 31 | unsigned int Handle; 32 | unsigned int Count; 33 | VCHIQ_ELEMENT* Elements; 34 | WDFMEMORY WdfMemoryElementBuffer; 35 | } VCHIQ_QUEUE_MESSAGE, *PVCHIQ_QUEUE_MESSAGE; 36 | 37 | typedef struct _VCHIQ_QUEUE_BULK_TRANSFER { 38 | unsigned int Handle; 39 | VOID* Data; 40 | unsigned int Size; 41 | VOID* UserData; 42 | VCHIQ_BULK_MODE_T Mode; 43 | WDFMEMORY WdfMemoryBuffer; 44 | } VCHIQ_QUEUE_BULK_TRANSFER, *PVCHIQ_QUEUE_BULK_TRANSFER; 45 | 46 | typedef struct VCHIQ_COMPLETION_DATA { 47 | VCHIQ_REASON_T Reason; 48 | VCHIQ_HEADER* Header; 49 | VOID* ServiceUserData; 50 | VOID* BulkUserData; 51 | WDFMEMORY WdfMemoryBuffer; 52 | } VCHIQ_COMPLETION_DATA, *PVCHIQ_COMPLETION_DATA; 53 | 54 | typedef struct _VCHIQ_AWAIT_COMPLETION { 55 | unsigned int Count; 56 | VCHIQ_COMPLETION_DATA* Buf; 57 | unsigned int MsgBufSize; 58 | unsigned int MsgBufCount; /* IN/OUT */ 59 | VOID** MsgBufs; 60 | WDFMEMORY WdfMemoryCompletion; 61 | } VCHIQ_AWAIT_COMPLETION, *PVCHIQ_AWAIT_COMPLETION; 62 | 63 | typedef struct _VCHIQ_DEQUEUE_MESSAGE { 64 | unsigned int Handle; 65 | int Blocking; 66 | unsigned int BufSize; 67 | VOID* Buf; 68 | WDFMEMORY WdfMemoryBuffer; 69 | } VCHIQ_DEQUEUE_MESSAGE, *PVCHIQ_DEQUEUE_MESSAGE; 70 | 71 | 72 | typedef struct _VCHIQ_GET_CONFIG { 73 | unsigned int ConfigSize; 74 | VCHIQ_CONFIG* PConfig; 75 | WDFMEMORY WdfMemoryConfiguration; 76 | } VCHIQ_GET_CONFIG, *PVCHIQ_GET_CONFIG; 77 | 78 | typedef struct _VCHIQ_SET_SERVICE_OPTION { 79 | unsigned int Handle; 80 | VCHIQ_SERVICE_OPTION_T Option; 81 | int Value; 82 | } VCHIQ_SET_SERVICE_OPTION, *PVCHIQ_SET_SERVICE_OPTION; 83 | 84 | typedef struct _VCHIQ_DUMP_MEM { 85 | VOID* VirtAddr; 86 | size_t NumBytes; 87 | } VCHIQ_DUMP_MEM, *PVCHIQ_DUMP_MEM; 88 | 89 | #include 90 | 91 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/misc/vchiq/vchiq_pagelist.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // vchiq_pagelist.h 7 | // 8 | // Abstract: 9 | // 10 | // This header contains sepcific definition from Raspberry Pi 11 | // public userland repo. This is based on the vchiq_pagelist.h header. 12 | // Only minimal definitions are ported over. 13 | // 14 | 15 | #pragma once 16 | 17 | EXTERN_C_START 18 | 19 | #ifndef PAGE_SIZE 20 | #define PAGE_SIZE 4096 21 | #endif 22 | #define CACHE_LINE_SIZE 32 23 | #define PAGELIST_WRITE 0 24 | #define PAGELIST_READ 1 25 | #define PAGELIST_READ_WITH_FRAGMENTS 2 26 | 27 | #include 28 | 29 | typedef struct _VCHIQ_PAGELIST { 30 | ULONG Length; 31 | USHORT Type; 32 | USHORT Offset; 33 | ULONG Addrs[1]; /* N.B. 12 LSBs hold the number of following 34 | pages at consecutive addresses. */ 35 | } VCHIQ_PAGELIST, *PVCHIQ_PAGELIST; 36 | 37 | typedef struct _FRAGMENTS { 38 | char Headbuf[CACHE_LINE_SIZE]; 39 | char Tailbuf[CACHE_LINE_SIZE]; 40 | } FRAGMENTS, *PFRAGMENTS; 41 | 42 | #include 43 | 44 | EXTERN_C_END -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi 2 (BCM2836) PWM Driver 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 (BCM2836) PWM Driver (bcm2836pwm.sys) 2 | This is the Pulse-Width Modulation (PWM) peripheral driver for RaspberryPi. The driver uses 2 more peripherals to achieve its job: DMA Controller and ClockManager peripherals. 3 | 4 | ## Audio Driver Ownership 5 | RaspberryPi is capable of outputting hardware generated PWM signals, but currently the PWM hardware is used exclusively by the Audio driver rpiwav.sys for audio output and is not available for use by any other kernel-mode/user-mode driver/service/application i.e. If rpiwav.sys is enabled, then it assumes sole ownership of bcm2836pwm.sys and no other party is expected to manipulate the PWM peripheral state, PWM clocks or owned DMA channels. 6 | 7 | Note: The PWM driver has been specially tweaked for the audio driver and any modification to it can result in poor audio performance/quality. 8 | 9 | ## Using PWM Driver from Kernel/User-Mode 10 | Audio driver has to be disabled for PWM driver to be available for use by kernel/user-mode drivers/services/applications. Communication with the PWM driver is achievable through a set of IOCTLs documented in bcm2836pwm.h. Please refer to rpiwav.sys source code for examples on how to open a connection with the PWM driver and communicate with it over IOCTLs. -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/bcm2836pwm.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/pwm/bcm2836/bcm2836pwm.inf -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/bcm2836pwm.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/dmaInterrupt.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Abstract: 6 | 7 | This file contains definitions for DMA interrupt handling. 8 | 9 | --*/ 10 | 11 | #pragma once; 12 | 13 | #define PREVIOUS_PACKET_INDEX(currentPacket, numPackets) (currentPacket ? currentPacket - 1 : numPackets - 1) 14 | #define FIRST_CB_ADDRESS_OF_PACKET(packet, cbBaseAddressPaLow) (cbBaseAddressPaLow + (2 * packet * sizeof(DMA_CB))) 15 | #define SOURCE_AD_INIT_VALUE_OF_PACKET(packet, cbBaseAddress) (cbBaseAddress[2 * packet].SOURCE_AD) 16 | 17 | EVT_WDF_INTERRUPT_ISR DmaIsr; 18 | EVT_WDF_INTERRUPT_DPC DmaDpc; 19 | 20 | VOID 21 | ClearDmaErrorAndRequestRestart 22 | ( 23 | _In_ PDEVICE_CONTEXT DeviceContext 24 | ); 25 | 26 | ULONG 27 | GetNumberOfProcessedPackets 28 | ( 29 | _In_ ULONG CompletedPacket, 30 | _In_ ULONG LastKnownCompletedPacket, 31 | _In_ ULONG NumPackets 32 | ); 33 | 34 | VOID 35 | HandleUnderflow( 36 | _In_ PDEVICE_CONTEXT DeviceContext 37 | ); 38 | -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/driver.cpp: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation All Rights Reserved 4 | 5 | Abstract: 6 | 7 | This file contains the driver entry points and callbacks. 8 | 9 | --*/ 10 | 11 | #include "driver.h" 12 | #include "driver.tmh" 13 | 14 | 15 | #pragma code_seg("INIT") 16 | _Use_decl_annotations_ 17 | NTSTATUS 18 | DriverEntry( 19 | PDRIVER_OBJECT DriverObject, 20 | PUNICODE_STRING RegistryPath 21 | ) 22 | /*++ 23 | 24 | Routine Description: 25 | 26 | Create the driver object 27 | 28 | Arguments: 29 | 30 | DriverObject - Pointer to the driver object 31 | RegistryPath - Driver specific registry path 32 | 33 | Return Value: 34 | 35 | NTSTATUS 36 | 37 | --*/ 38 | { 39 | NTSTATUS status; 40 | WDF_DRIVER_CONFIG config; 41 | WDF_OBJECT_ATTRIBUTES attributes; 42 | 43 | // 44 | // Initialize WPP Tracing 45 | // 46 | WPP_INIT_TRACING( DriverObject, RegistryPath ); 47 | 48 | // 49 | // Register a cleanup callback so that we can call WPP_CLEANUP when 50 | // the framework driver object is deleted during driver unload. 51 | // 52 | 53 | WDF_OBJECT_ATTRIBUTES_INIT(&attributes); 54 | 55 | WDF_DRIVER_CONFIG_INIT(&config, OnDeviceAdd); 56 | config.EvtDriverUnload = OnDriverUnload; 57 | 58 | status = WdfDriverCreate( 59 | DriverObject, 60 | RegistryPath, 61 | &attributes, 62 | &config, 63 | WDF_NO_HANDLE); 64 | 65 | if (!NT_SUCCESS(status)) 66 | { 67 | TraceEvents(TRACE_LEVEL_ERROR, TRACE_INIT, "BCM2836PWM WdfDriverCreate failed %!STATUS!", status); 68 | WPP_CLEANUP(DriverObject); 69 | } 70 | 71 | return status; 72 | } 73 | 74 | #pragma code_seg("PAGE") 75 | _Use_decl_annotations_ 76 | VOID 77 | OnDriverUnload ( 78 | WDFDRIVER Driver 79 | ) 80 | /*++ 81 | 82 | Routine Description: 83 | 84 | Called when driver is unloaded. Clean up WPP. 85 | 86 | Arguments: 87 | 88 | Driver - Handle to a framework driver object created in DriverEntry 89 | 90 | Return Value: 91 | 92 | None 93 | 94 | --*/ 95 | { 96 | PAGED_CODE(); 97 | 98 | PDRIVER_OBJECT driverObject; 99 | 100 | TraceEvents(TRACE_LEVEL_INFORMATION, TRACE_INIT, "Driver unloaded"); 101 | 102 | driverObject = WdfDriverWdmGetDriverObject(Driver); 103 | WPP_CLEANUP(driverObject); 104 | } 105 | 106 | -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/driver.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Abstract: 6 | 7 | Header file which includes all other header files. 8 | 9 | --*/ 10 | 11 | 12 | #define INITGUID 13 | 14 | // Windows related header files 15 | #include 16 | #include 17 | #include 18 | 19 | // Implementation header files 20 | #include "bcm2836pwm.h" 21 | #include "gpio.h" 22 | #include "clockmgr.h" 23 | #include "pwm.h" 24 | #include "dma.h" 25 | #include "dmaInterrupt.h" 26 | #include "device.h" 27 | #include "trace.h" 28 | 29 | #define BCM_PWM_POOLTAG 'PMCB' 30 | 31 | extern "C" DRIVER_INITIALIZE DriverEntry; 32 | extern "C" EVT_WDF_DRIVER_UNLOAD OnDriverUnload; 33 | -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/resource.rc: -------------------------------------------------------------------------------- 1 | #define VER_FILETYPE VFT_DRV 2 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 3 | #define VER_FILEDESCRIPTION_STR "Broadcom PWM Controller Driver" 4 | #define VER_INTERNALNAME_STR "bcm2836pwm.sys" 5 | #define VER_ORIGINALFILENAME_STR "bcm2836pwm.sys" -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | bcm2836pwm 5 | DRIVER 6 | retail 7 | 0 8 | This is not a user facing component 9 | 1 10 | $(TARGETNAME).inf 11 | $(TARGETLIBS) $(DDK_LIB_PATH)\wpprecorder.lib 12 | /W4 /WX 13 | driver.cpp device.cpp pwm.cpp dma.cpp dmaInterrupt.cpp resource.rc 14 | 15 | -------------------------------------------------------------------------------- /drivers/pwm/bcm2836/trace.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Abstract: 6 | 7 | This file contains definitions for tracing. 8 | 9 | --*/ 10 | 11 | 12 | // 13 | // Define the tracing flags. 14 | // 15 | // Tracing GUID - dcc0f520-7600-42d0-b1e4-f968c4597781 16 | // 17 | 18 | #define WPP_CONTROL_GUIDS \ 19 | WPP_DEFINE_CONTROL_GUID( \ 20 | BCM_PWM_TraceGuid, (dcc0f520,7600,42d0,b1e4,f968c4597781), \ 21 | WPP_DEFINE_BIT(TRACE_INIT) \ 22 | WPP_DEFINE_BIT(TRACE_DEVICE) \ 23 | WPP_DEFINE_BIT(TRACE_IOCTL) \ 24 | WPP_DEFINE_BIT(TRACE_IO) \ 25 | WPP_DEFINE_BIT(TRACE_IRQ) \ 26 | WPP_DEFINE_BIT(TRACE_FUNC) \ 27 | ) 28 | 29 | #define WPP_FLAG_LEVEL_LOGGER(flag, level) \ 30 | WPP_LEVEL_LOGGER(flag) 31 | 32 | #define WPP_FLAG_LEVEL_ENABLED(flag, level) \ 33 | (WPP_LEVEL_ENABLED(flag) && \ 34 | WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) 35 | 36 | #define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \ 37 | WPP_LEVEL_LOGGER(flags) 38 | 39 | #define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \ 40 | (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl) 41 | 42 | #define WPP__ENABLED() \ 43 | WPP_LEVEL_ENABLED(TRACE_FUNC) 44 | 45 | #define WPP__LOGGER() \ 46 | WPP_LEVEL_LOGGER(TRACE_FUNC) 47 | 48 | // 49 | // This comment block is scanned by the trace preprocessor to define our 50 | // Trace function. 51 | // 52 | // begin_wpp config 53 | // FUNC Trace{FLAG=BCM_PWM__ALL}(LEVEL, MSG, ...); 54 | // FUNC TraceEvents(LEVEL, FLAGS, MSG, ...); 55 | // FUNC FuncEntry(); 56 | // FUNC FuncExit(); 57 | // USESUFFIX(FuncEntry, "[%!FUNC!] --> entry"); 58 | // USESUFFIX(FuncExit, "[%!FUNC!] <-- exit"); 59 | // end_wpp 60 | // 61 | 62 | 63 | -------------------------------------------------------------------------------- /drivers/sd/bcm2836/bcm2836sdhc/README.md: -------------------------------------------------------------------------------- 1 | # RaspberryPi Arasan SD/SDIO Host Controller Driver 2 | This is the Arasan SD host controller device driver, available on Pi2 and Pi3. 3 | It is implemented as a kernel mode SDPORT miniport driver, and supports SD/SDIO protocols. 4 | On Pi2 it is used for hosting Pi2 main mass storage device (SD card). 5 | On Pi3 it is used to host the onboard SDIO WiFi adapter. 6 | -------------------------------------------------------------------------------- /drivers/sd/bcm2836/bcm2836sdhc/bcm2836sdhc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/sd/bcm2836/bcm2836sdhc/bcm2836sdhc.h -------------------------------------------------------------------------------- /drivers/sd/bcm2836/bcm2836sdhc/bcm2836sdhc.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/sd/bcm2836/bcm2836sdhc/bcm2836sdhc.inf -------------------------------------------------------------------------------- /drivers/sd/bcm2836/bcm2836sdhc/bcm2836sdhc.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/sd/bcm2836/bcm2836sdhc/bcm2836sdhc.rc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | #include 5 | 6 | #include 7 | 8 | #define VER_FILETYPE VFT_DRV 9 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 10 | #define VER_FILEDESCRIPTION_STR "Broadcom 2836 Arasan SD Host Controller Driver" 11 | #define VER_INTERNALNAME_STR "bcm2836sdhc.sys" 12 | #define VER_ORIGINALFILENAME_STR "bcm2836sdhc.sys" 13 | 14 | // Ensure that VS_VERSION_INFO is not defined 15 | #ifdef VS_VERSION_INFO 16 | #undef VS_VERSION_INFO 17 | #endif 18 | 19 | #include "common.ver" 20 | 21 | -------------------------------------------------------------------------------- /drivers/sd/bcm2836/bcm2836sdhc/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | bcm2836sdhc 5 | DRIVER 6 | retail 7 | /W4 /WX 8 | $(MINWIN_PRIV_SDK_INC_PATH); $(MINWIN_PRIV_SDK_INC_PATH)\ddk; 9 | $(DDK_LIB_PATH)\sdport.lib $(DDK_LIB_PATH)\wpprecorder.lib 10 | bcm2836sdhc.rc bcm2836sdhc.c 11 | bcm2836sdhc.inf 12 | $(SOURCES) -km -scan:trace.h -func:TraceMessage(LEVEL,FLAGS,(MSG,...)) -gen:{km-WdfDefault.tpl}*.tmh 13 | 1 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /drivers/sd/bcm2836/rpisdhc/precomp.hpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | 5 | #include 6 | 7 | extern "C" { 8 | #include 9 | } // extern "C" 10 | -------------------------------------------------------------------------------- /drivers/sd/bcm2836/rpisdhc/rpisdhc.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/sd/bcm2836/rpisdhc/rpisdhc.inf -------------------------------------------------------------------------------- /drivers/sd/bcm2836/rpisdhc/rpisdhc.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/sd/bcm2836/rpisdhc/rpisdhc.rc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | #include 5 | 6 | #include 7 | 8 | #define VER_FILETYPE VFT_DRV 9 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 10 | #define VER_FILEDESCRIPTION_STR "RaspberryPi SD2.0 Host Controller Driver" 11 | #define VER_INTERNALNAME_STR "rpisdhc.sys" 12 | #define VER_ORIGINALFILENAME_STR "rpisdhc.sys" 13 | 14 | // Ensure that VS_VERSION_INFO is not defined 15 | #ifdef VS_VERSION_INFO 16 | #undef VS_VERSION_INFO 17 | #endif 18 | 19 | #include "common.ver" 20 | -------------------------------------------------------------------------------- /drivers/sd/bcm2836/rpisdhc/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | rpisdhc 5 | DRIVER 6 | retail 7 | rpisdhc.inf 8 | 1 9 | /W4 /WX 10 | $(MINWIN_PRIV_SDK_INC_PATH); $(MINWIN_PRIV_SDK_INC_PATH)\ddk; 11 | $(DDK_LIB_PATH)\sdport.lib $(DDK_LIB_PATH)\wpprecorder.lib 12 | rpisdhc.cpp SdhcLogging.cpp rpisdhc.rc 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /drivers/spi/bcm2836/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi 2 (BCM2836) SPI Controller driver for SPB Framework 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/spi/bcm2836/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 (BCM2836) SPI Controller driver for SPB Framework 2 | 3 | This is an SPI driver for the SPI peripheral. In addition to the two AUXSPI 4 | controllers on the AUX block, there is a single SPI peripheral (SPI0). This driver 5 | is implemented as an [SpbCx Controller Driver](https://msdn.microsoft.com/en-us/library/windows/hardware/hh406203(v=vs.85).aspx). 6 | SPI0 is exposed to usermode by the rhproxy driver. 7 | -------------------------------------------------------------------------------- /drivers/spi/bcm2836/bcmspi.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/spi/bcm2836/bcmspi.inf -------------------------------------------------------------------------------- /drivers/spi/bcm2836/bcmspi.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/spi/bcm2836/controller.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Module Name: 6 | 7 | controller.h 8 | 9 | Abstract: 10 | 11 | This module contains the controller-specific function 12 | definitions. 13 | 14 | Environment: 15 | 16 | kernel-mode only 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | #ifndef _CONTROLLER_H_ 23 | #define _CONTROLLER_H_ 24 | 25 | // 26 | // Controller specific function prototypes. 27 | // 28 | 29 | VOID ControllerInitialize( 30 | _Inout_ PPBC_DEVICE pDevice 31 | ); 32 | 33 | VOID ControllerUninitialize( 34 | _Inout_ PPBC_DEVICE pDevice 35 | ); 36 | 37 | NTSTATUS 38 | ControllerTransferData( 39 | _Inout_ PPBC_DEVICE pDevice, 40 | _Inout_ PPBC_REQUEST pRequest 41 | ); 42 | 43 | NTSTATUS 44 | ControllerDoOneTransferPollMode( 45 | _Inout_ PPBC_DEVICE pDevice, 46 | _Inout_ PPBC_REQUEST pRequest 47 | ); 48 | 49 | bool 50 | ControllerCompleteTransfer( 51 | _Inout_ PPBC_DEVICE pDevice, 52 | _Inout_ PPBC_REQUEST pRequest, 53 | _In_ NTSTATUS TransferStatus 54 | ); 55 | 56 | VOID 57 | ControllerUnlockTransfer( 58 | _Inout_ PPBC_DEVICE pDevice 59 | ); 60 | 61 | VOID 62 | ControllerConfigForTargetAndActivate( 63 | _In_ PPBC_DEVICE pDevice 64 | ); 65 | 66 | VOID 67 | ControllerCompleteRequest( 68 | _In_ PPBC_DEVICE pDevice, 69 | _In_ PPBC_REQUEST pRequest 70 | ); 71 | 72 | NTSTATUS 73 | ControllerDelayTransfer( 74 | _In_ PPBC_DEVICE pDevice, 75 | _In_ PPBC_REQUEST pRequest 76 | ); 77 | 78 | VOID 79 | ControllerConfigClock( 80 | _In_ PPBC_DEVICE pDevice, 81 | ULONG clockHz 82 | ); 83 | 84 | VOID 85 | ControllerActivateTransfer( 86 | _In_ PPBC_DEVICE pDevice 87 | ); 88 | 89 | VOID 90 | ControllerDeactivateTransfer( 91 | _In_ PPBC_DEVICE pDevice 92 | ); 93 | 94 | ULONGLONG 95 | ControllerEstimateRequestCompletionTimeUs( 96 | _In_ PPBC_TARGET pTarget, 97 | _In_ PPBC_REQUEST pRequest, 98 | bool CountTransferDelays 99 | ); 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /drivers/spi/bcm2836/driver.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Module Name: 6 | 7 | driver.h 8 | 9 | Abstract: 10 | 11 | This module contains the function definitions for 12 | the WDF driver. 13 | 14 | Environment: 15 | 16 | kernel-mode only 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | #ifndef _DRIVER_H_ 23 | #define _DRIVER_H_ 24 | 25 | extern "C" 26 | _Function_class_(DRIVER_INITIALIZE) _IRQL_requires_same_ 27 | NTSTATUS 28 | DriverEntry( 29 | _In_ PDRIVER_OBJECT pDriverObject, 30 | _In_ PUNICODE_STRING pRegistryPath 31 | ); 32 | 33 | EVT_WDF_DRIVER_DEVICE_ADD OnDeviceAdd; 34 | EVT_WDF_DEVICE_CONTEXT_CLEANUP OnDeviceCleanup; 35 | EVT_WDF_OBJECT_CONTEXT_CLEANUP OnDriverCleanup; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /drivers/spi/bcm2836/resource.rc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright(c) Microsoft Corporation 3 | // 4 | 5 | #include 6 | 7 | #include 8 | 9 | #define VER_FILETYPE VFT_DRV 10 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 11 | #define VER_FILEDESCRIPTION_STR "Broadcom SPI Controller Driver" 12 | #define VER_INTERNALNAME_STR "bcmspi.sys" 13 | #define VER_ORIGINALFILENAME_STR "bcmspi.sys" 14 | 15 | // Ensure that VS_VERSION_INFO in not defined 16 | #ifdef VS_VERSION_INFO 17 | #undef VS_VERSION_INFO 18 | #endif 19 | 20 | #include "common.ver" 21 | -------------------------------------------------------------------------------- /drivers/spi/bcm2836/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | bcmspi 5 | DRIVER 6 | $(TARGETNAME) 7 | 1 8 | /W4 /WX 9 | $(INCLUDES); $(SPB_INC_PATH)\$(SPB_VERSION_MAJOR).$(SPB_VERSION_MINOR); 10 | $(TARGETLIBS) $(SPB_LIB_PATH)\$(SPB_VERSION_MAJOR).$(SPB_VERSION_MINOR)\SpbCxStubs.lib $(DDK_LIB_PATH)\ntstrsafe.lib 11 | driver.cpp device.cpp controller.cpp resource.rc 12 | $(SOURCES) -km -scan:spitrace.h -func:Trace(LEVEL,FLAGS,MSG,...) 13 | retail 14 | $(INF_NAME).inf 15 | 1 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /drivers/spi/bcm2836/spitrace.h: -------------------------------------------------------------------------------- 1 | /*++ 2 | 3 | Copyright (c) Microsoft Corporation. All rights reserved. 4 | 5 | Module Name: 6 | 7 | spitrace.h 8 | 9 | Abstract: 10 | 11 | This module contains the trace definitions for 12 | the BCM2836 SPI0 controller driver. 13 | 14 | Environment: 15 | 16 | kernel-mode only 17 | 18 | Revision History: 19 | 20 | --*/ 21 | 22 | #ifndef _SPITRACE_H_ 23 | #define _SPITRACE_H_ 24 | 25 | extern "C" 26 | { 27 | // 28 | // Tracing Definitions: 29 | // 30 | // Control GUID: 31 | // {383D2181-9EED-4FC9-83EC-68F806D4498D} 32 | 33 | #define WPP_CONTROL_GUIDS \ 34 | WPP_DEFINE_CONTROL_GUID( \ 35 | PbcTraceGuid, \ 36 | (383D2181, 9EED, 4fc9, 83EC, 68F806D4498D), \ 37 | WPP_DEFINE_BIT(TRACE_FLAG_WDFLOADING) \ 38 | WPP_DEFINE_BIT(TRACE_FLAG_SPBDDI) \ 39 | WPP_DEFINE_BIT(TRACE_FLAG_PBCLOADING) \ 40 | WPP_DEFINE_BIT(TRACE_FLAG_TRANSFER) \ 41 | WPP_DEFINE_BIT(TRACE_FLAG_OTHER) \ 42 | ) 43 | } 44 | 45 | #define WPP_LEVEL_FLAGS_LOGGER(level,flags) WPP_LEVEL_LOGGER(flags) 46 | #define WPP_LEVEL_FLAGS_ENABLED(level, flags) (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= level) 47 | 48 | // begin_wpp config 49 | // FUNC FuncEntry{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS); 50 | // FUNC FuncExit{LEVEL=TRACE_LEVEL_VERBOSE}(FLAGS); 51 | // USEPREFIX(FuncEntry, "%!STDPREFIX! [%!FUNC!] --> entry"); 52 | // USEPREFIX(FuncExit, "%!STDPREFIX! [%!FUNC!] <--"); 53 | // end_wpp 54 | 55 | #endif // _SPITRACE_H_ 56 | -------------------------------------------------------------------------------- /drivers/spi/bcmauxspi/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi (BCM2836) AUXSPI Controller driver for SPB Framework 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/spi/bcmauxspi/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 (BCM2836) AUXSPI Controller driver for SPB Framework 2 | 3 | This is an SPI driver for the AUXSPI peripheral. There are two AUXSPI 4 | peripherals located on the auxiliary block. Although the hardware FIFO is only 5 | 4 items deep, each entry is 32 bits wide, so we can pack up to 4 bytes 6 | per entry yeilding an effective depth of 16 bytes. The hardware also supports 7 | a variable shift length mode which we can use to handle non multiple of 4 8 | transfer lengths. This driver has undergone data integrity testing over all 9 | 4 SPI modes and a variety of transfer lengths and clock speeds. 10 | -------------------------------------------------------------------------------- /drivers/spi/bcmauxspi/bcmauxspi.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/spi/bcmauxspi/bcmauxspi.inf -------------------------------------------------------------------------------- /drivers/spi/bcmauxspi/bcmauxspi.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/spi/bcmauxspi/precomp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | -------------------------------------------------------------------------------- /drivers/spi/bcmauxspi/resource.rc: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #define VER_FILETYPE VFT_DRV 6 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 7 | #define VER_FILEDESCRIPTION_STR "Broadcom AUX SPI Controller Driver" 8 | #define VER_INTERNALNAME_STR "bcmauxspi.sys" 9 | #define VER_ORIGINALFILENAME_STR "bcmauxspi.sys" 10 | 11 | // Ensure that VS_VERSION_INFO is not defined 12 | #ifdef VS_VERSION_INFO 13 | #undef VS_VERSION_INFO 14 | #endif 15 | 16 | #include "common.ver" 17 | -------------------------------------------------------------------------------- /drivers/spi/bcmauxspi/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | bcmauxspi 5 | DRIVER 6 | $(TARGETNAME) 7 | 1 8 | /W4 /WX 9 | $(INCLUDES);..\..\mailbox\bcm2836;$(SPB_INC_PATH)\$(SPB_VERSION_MAJOR).$(SPB_VERSION_MINOR); 10 | $(TARGETLIBS) $(SPB_LIB_PATH)\$(SPB_VERSION_MAJOR).$(SPB_VERSION_MINOR)\SpbCxStubs.lib $(DDK_LIB_PATH)\wpprecorder.lib 11 | bcmauxspi.cpp resource.rc 12 | $(SOURCES) -km -p:bcmauxspi -DENABLE_WPP_RECORDER=1 -DWPP_EMIT_FUNC_NAME -scan:trace.h 13 | retail 14 | bcmauxspi.inf 15 | 1 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /drivers/spi/bcmauxspi/trace.h: -------------------------------------------------------------------------------- 1 | #ifndef _BCM_AUXSPI_TRACE_H_ 2 | #define _BCM_AUXSPI_TRACE_H_ 1 3 | 4 | // 5 | // Copyright (C) Microsoft. All rights reserved. 6 | // 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif // __cplusplus 11 | 12 | // 13 | // Defining control guids, including this is required to happen before 14 | // including the tmh file (if the WppRecorder API is used) 15 | // 16 | #include 17 | 18 | // 19 | // Tracing GUID - F40BAF8A-C1D6-457F-8AB1-04E29BA7DB0B 20 | // 21 | #define WPP_CONTROL_GUIDS \ 22 | WPP_DEFINE_CONTROL_GUID(BCMAUXSPI, (F40BAF8A,C1D6,457F,8AB1,04E29BA7DB0B), \ 23 | WPP_DEFINE_BIT(AUXSPI_TRACING_DEFAULT) \ 24 | ) 25 | 26 | // begin_wpp config 27 | // 28 | // FUNC AUXSPI_LOG_ERROR{LEVEL=TRACE_LEVEL_ERROR, FLAGS=AUXSPI_TRACING_DEFAULT}(MSG, ...); 29 | // USEPREFIX (AUXSPI_LOG_ERROR, "%!STDPREFIX! [%s @ %u] ERROR :", __FILE__, __LINE__); 30 | // 31 | // FUNC AUXSPI_LOG_LOW_MEMORY{LEVEL=TRACE_LEVEL_ERROR, FLAGS=AUXSPI_TRACING_DEFAULT}(MSG, ...); 32 | // USEPREFIX (AUXSPI_LOG_LOW_MEMORY, "%!STDPREFIX! [%s @ %u] LOW MEMORY :", __FILE__, __LINE__); 33 | // 34 | // FUNC AUXSPI_LOG_WARNING{LEVEL=TRACE_LEVEL_WARNING, FLAGS=AUXSPI_TRACING_DEFAULT}(MSG, ...); 35 | // USEPREFIX (AUXSPI_LOG_WARNING, "%!STDPREFIX! [%s @ %u] WARNING :", __FILE__, __LINE__); 36 | // 37 | // FUNC AUXSPI_LOG_INFORMATION{LEVEL=TRACE_LEVEL_INFORMATION, FLAGS=AUXSPI_TRACING_DEFAULT}(MSG, ...); 38 | // USEPREFIX (AUXSPI_LOG_INFORMATION, "%!STDPREFIX! [%s @ %u] INFO :", __FILE__, __LINE__); 39 | // 40 | // FUNC AUXSPI_LOG_TRACE{LEVEL=TRACE_LEVEL_VERBOSE, FLAGS=AUXSPI_TRACING_DEFAULT}(MSG, ...); 41 | // USEPREFIX (AUXSPI_LOG_TRACE, "%!STDPREFIX! [%s @ %u] TRACE :", __FILE__, __LINE__); 42 | // 43 | // end_wpp 44 | 45 | #ifdef __cplusplus 46 | } // extern "C" 47 | #endif // __cplusplus 48 | 49 | #endif // _BCM_AUXSPI_TRACE_H_ 50 | 51 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi 2 (BCM2836) miniUART Driver 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 (BCM2836) Auxiliary UART (miniUART) Driver 2 | 3 | This is a Windows 10 device driver for the Broadcom proprietary version of the 16550 UART, available on the Pi 2 and 3. 4 | 5 | Due to lack of certain features present in the standard 16550 UART, the Broadcom version is 6 | called miniUart. 7 | 8 | This is a kernel mode driver implemented as a monolithic standalone serial 16550-like controller driver. 9 | The code code is derived from the Microsoft WDF serial device driver sample fox x86/X64. 10 | 11 | * miniUart does not support hardware flow control. 12 | * miniUart supports software flow control (XON/XOFF). 13 | * miniUart does not use DMA. 14 | * Default baud rate is 9600 baud. 15 | * Minimum baud rate is 1200 baud. 16 | * Maximum baud rate is 912600 baud. 17 | 18 | On Pi 3 miniUART RX/TX signals are routed to the GPIO header on pins 8/10 (GPIO15/14), 19 | and is available to user-mode applications (UWP or console mode) and to other device drivers. 20 | 21 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/Trace.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // trace.h 7 | // 8 | // Abstract: 9 | // 10 | // Header file for WPP tracing related function defintions and macros. 11 | // 12 | 13 | // 14 | // Define the tracing flags. 15 | // 16 | // mini Uart Tracing GUID - 22bf0db9-1111-4c9d-b478-9988857bd94b 17 | // 18 | 19 | #define WPP_CONTROL_GUIDS \ 20 | WPP_DEFINE_CONTROL_GUID( \ 21 | piminiuartTraceGuid, (22bf0db9,1111,4c9d,b478,9988857bd94b), \ 22 | WPP_DEFINE_BIT(DBG_INIT) /* bit 0 = 0x00000001 */ \ 23 | WPP_DEFINE_BIT(DBG_PNP) /* bit 1 = 0x00000002 */ \ 24 | WPP_DEFINE_BIT(DBG_POWER) /* bit 2 = 0x00000004 */ \ 25 | WPP_DEFINE_BIT(DBG_WMI) /* bit 3 = 0x00000008 */ \ 26 | WPP_DEFINE_BIT(DBG_CREATE_CLOSE) /* bit 4 = 0x00000010 */ \ 27 | WPP_DEFINE_BIT(DBG_IOCTLS) /* bit 5 = 0x00000020 */ \ 28 | WPP_DEFINE_BIT(DBG_WRITE) /* bit 6 = 0x00000040 */ \ 29 | WPP_DEFINE_BIT(DBG_READ) /* bit 7 = 0x00000080 */ \ 30 | WPP_DEFINE_BIT(DBG_DPC) /* bit 8 = 0x00000100 */ \ 31 | WPP_DEFINE_BIT(DBG_INTERRUPT) /* bit 9 = 0x00000200 */ \ 32 | WPP_DEFINE_BIT(DBG_LOCKS) /* bit 10 = 0x00000400 */ \ 33 | WPP_DEFINE_BIT(DBG_QUEUEING) /* bit 11 = 0x00000800 */ \ 34 | WPP_DEFINE_BIT(DBG_HW_ACCESS) /* bit 12 = 0x00001000 */ \ 35 | ) 36 | 37 | #define WPP_FLAG_LEVEL_LOGGER(flag, level) \ 38 | WPP_LEVEL_LOGGER(flag) 39 | 40 | #define WPP_FLAG_LEVEL_ENABLED(flag, level) \ 41 | (WPP_LEVEL_ENABLED(flag) && \ 42 | WPP_CONTROL(WPP_BIT_ ## flag).Level >= level) 43 | 44 | #define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \ 45 | WPP_LEVEL_LOGGER(flags) 46 | 47 | #define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \ 48 | (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl) 49 | 50 | // 51 | // This comment block is scanned by the trace preprocessor to define our 52 | // Trace function. 53 | // 54 | // begin_wpp config 55 | // FUNC Trace{FLAG=MYDRIVER_ALL_INFO}(LEVEL, MSG, ...); 56 | // FUNC TraceEvents(LEVEL, FLAGS, MSG, ...); 57 | // end_wpp 58 | // 59 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/error.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Module Name: 4 | // 5 | // error.c 6 | // Abstract: 7 | // 8 | // This module contains the code that is very specific to error 9 | // operations in the serial driver 10 | 11 | #include "precomp.h" 12 | #include "error.tmh" 13 | 14 | /*++ 15 | 16 | Routine Description: 17 | 18 | This routine is invoked at dpc level to in response to 19 | a comm error. All comm errors complete all read and writes 20 | 21 | Arguments: 22 | 23 | Return Value: 24 | 25 | None. 26 | 27 | --*/ 28 | _Use_decl_annotations_ 29 | VOID 30 | SerialCommError( 31 | WDFDPC Dpc 32 | ) 33 | { 34 | PSERIAL_DEVICE_EXTENSION extension = NULL; 35 | 36 | extension = SerialGetDeviceExtension(WdfDpcGetParentObject(Dpc)); 37 | 38 | TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT, 39 | "++SerialCommError(%p)\r\n", 40 | extension); 41 | 42 | SerialFlushRequests(extension->WriteQueue, 43 | &extension->CurrentWriteRequest); 44 | 45 | SerialFlushRequests(extension->ReadQueue, 46 | &extension->CurrentReadRequest); 47 | 48 | TraceEvents(TRACE_LEVEL_INFORMATION, DBG_INIT, 49 | "--SerialCommError\r\n"); 50 | } 51 | 52 | 53 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/flush.c: -------------------------------------------------------------------------------- 1 | // Copyright (c) Microsoft Corporation. All rights reserved. 2 | // 3 | // Module Name: 4 | // 5 | // 6 | // flush.c 7 | // 8 | // Abstract: 9 | // 10 | // This module contains the code that is very specific to flush 11 | // operations in the serial driver 12 | 13 | 14 | #include "precomp.h" 15 | #include "flush.tmh" 16 | 17 | #ifdef ALLOC_PRAGMA 18 | #pragma alloc_text(PAGE, SerialFlush) 19 | #endif 20 | 21 | /*++ 22 | 23 | Routine Description: 24 | 25 | This is the dispatch routine for flush. Flushing works by placing 26 | this request in the write queue. When this request reaches the 27 | front of the write queue we simply complete it since this implies 28 | that all previous writes have completed. 29 | 30 | Arguments: 31 | 32 | DeviceObject - Pointer to the device object for this device 33 | 34 | Irp - Pointer to the IRP for the current request 35 | 36 | Return Value: 37 | 38 | Could return status success, cancelled, or pending. 39 | 40 | --*/ 41 | _Use_decl_annotations_ 42 | NTSTATUS 43 | SerialFlush( 44 | WDFDEVICE Device, 45 | PIRP Irp 46 | ) 47 | { 48 | PSERIAL_DEVICE_EXTENSION extension; 49 | 50 | extension = SerialGetDeviceExtension(Device); 51 | 52 | TraceEvents(TRACE_LEVEL_INFORMATION, DBG_WRITE, 53 | "++SerialFlush(%p, %p)\r\n", 54 | Device, 55 | Irp); 56 | 57 | PAGED_CODE(); 58 | 59 | WdfIoQueueStopSynchronously(extension->WriteQueue); 60 | 61 | // Flush is done - restart the queue 62 | 63 | WdfIoQueueStart(extension->WriteQueue); 64 | 65 | Irp->IoStatus.Information = 0L; 66 | Irp->IoStatus.Status = STATUS_SUCCESS; 67 | IoCompleteRequest(Irp, IO_NO_INCREMENT); 68 | 69 | TraceEvents(TRACE_LEVEL_INFORMATION, DBG_WRITE, "--SerialFlush\r\n"); 70 | 71 | return STATUS_SUCCESS; 72 | } 73 | 74 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/isr.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/uart/bcm2836/miniUart/isr.c -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/pi_miniuart.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/uart/bcm2836/miniUart/pi_miniuart.inf -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/pi_miniuart.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/uart/bcm2836/miniUart/pi_miniuart.rc -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/pi_miniuart.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pi_miniuart", "pi_miniuart.vcxproj", "{BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|ARM = Debug|ARM 11 | Debug|ARM64 = Debug|ARM64 12 | Debug|x64 = Debug|x64 13 | Debug|x86 = Debug|x86 14 | Release|ARM = Release|ARM 15 | Release|ARM64 = Release|ARM64 16 | Release|x64 = Release|x64 17 | Release|x86 = Release|x86 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|ARM.ActiveCfg = Debug|ARM 21 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|ARM.Build.0 = Debug|ARM 22 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|ARM.Deploy.0 = Debug|ARM 23 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|ARM64.ActiveCfg = Debug|ARM64 24 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|ARM64.Build.0 = Debug|ARM64 25 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|ARM64.Deploy.0 = Debug|ARM64 26 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|x64.ActiveCfg = Debug|x64 27 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|x64.Build.0 = Debug|x64 28 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|x64.Deploy.0 = Debug|x64 29 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|x86.ActiveCfg = Debug|Win32 30 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|x86.Build.0 = Debug|Win32 31 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Debug|x86.Deploy.0 = Debug|Win32 32 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|ARM.ActiveCfg = Release|ARM 33 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|ARM.Build.0 = Release|ARM 34 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|ARM.Deploy.0 = Release|ARM 35 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|ARM64.ActiveCfg = Release|ARM64 36 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|ARM64.Build.0 = Release|ARM64 37 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|ARM64.Deploy.0 = Release|ARM64 38 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|x64.ActiveCfg = Release|x64 39 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|x64.Build.0 = Release|x64 40 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|x64.Deploy.0 = Release|x64 41 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|x86.ActiveCfg = Release|Win32 42 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|x86.Build.0 = Release|Win32 43 | {BD0C7A4E-D4AF-4FAB-941D-D15B3E3B8A67}.Release|x86.Deploy.0 = Release|Win32 44 | EndGlobalSection 45 | GlobalSection(SolutionProperties) = preSolution 46 | HideSolutionNode = FALSE 47 | EndGlobalSection 48 | EndGlobal 49 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/piminiuart.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/pnp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/uart/bcm2836/miniUart/pnp.c -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/precomp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // precomp.h 7 | // 8 | // Abstract: 9 | // 10 | // Common header files are included here 11 | // 12 | 13 | #include 14 | #include 15 | #define WIN9X_COMPAT_SPINLOCK 16 | #include "ntddk.h" 17 | #include 18 | #define NTSTRSAFE_LIB 19 | #include 20 | #include 21 | #include 22 | #include "ntddser.h" 23 | #include 24 | #include 25 | #include 26 | #include "serial.h" 27 | #include "serialp.h" 28 | #include "trace.h" 29 | 30 | #define RESHUB_USE_HELPER_ROUTINES 31 | #include 32 | #include 33 | 34 | // 35 | // RPi3 mini Uart hardware as well as this driver supports higher baud rates, compared to 36 | // typical 16550 UART. Macros for standard baud rates 110 - 115200 baud rates are 37 | // defined in ntddser.h header. 38 | // Macros for higher speed serial port masks are set below 39 | // 40 | 41 | #define SERIAL_BAUD_230400 ((ULONG)0x00080000) 42 | #define SERIAL_BAUD_460800 ((ULONG)0x00100000) 43 | #define SERIAL_BAUD_921600 ((ULONG)0x00200000) 44 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by pi_miniuart.rc 4 | 5 | // Next default values for new objects 6 | // 7 | #ifdef APSTUDIO_INVOKED 8 | #ifndef APSTUDIO_READONLY_SYMBOLS 9 | #define _APS_NEXT_RESOURCE_VALUE 101 10 | #define _APS_NEXT_COMMAND_VALUE 40001 11 | #define _APS_NEXT_CONTROL_VALUE 1001 12 | #define _APS_NEXT_SYMED_VALUE 101 13 | #endif 14 | #endif 15 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/serial.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/uart/bcm2836/miniUart/serial.h -------------------------------------------------------------------------------- /drivers/uart/bcm2836/miniUart/serial.rc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | #include 5 | #include 6 | 7 | #define VER_FILETYPE VFT_DRV 8 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 9 | #define VER_FILEDESCRIPTION_STR "BCM283x Mini UART Driver" 10 | #define VER_INTERNALNAME_STR "pi_miniUart.sys" 11 | #define VER_ORIGINALFILENAME_STR "pi_miniUart.sys" 12 | 13 | #include "common.ver" 14 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/License.txt: -------------------------------------------------------------------------------- 1 | 2 | Raspberry Pi 2 (BCM2836) ARM PL011 UART Driver 3 | 4 | Copyright(c) Microsoft Corporation 5 | 6 | All rights reserved. 7 | 8 | MIT License 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a 11 | copy of this software and associated documentation files(the ""Software""), 12 | to deal in the Software without restriction, including without limitation 13 | the rights to use, copy, modify, merge, publish, distribute, sublicense, 14 | and / or sell copies of the Software, and to permit persons to whom the 15 | Software is furnished to do so, subject to the following conditions : 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 26 | IN THE SOFTWARE. -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/PL011.rc: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (C) Microsoft. All rights reserved. 3 | // 4 | #include 5 | #include 6 | 7 | #define VER_FILETYPE VFT_DRV 8 | #define VER_FILESUBTYPE VFT2_DRV_SYSTEM 9 | #define VER_FILEDESCRIPTION_STR "ARM PL011 UART Driver" 10 | #define VER_INTERNALNAME_STR "SerPL011.sys" 11 | #define VER_ORIGINALFILENAME_STR "SerPL011.sys" 12 | 13 | // Ensure that VS_VERSION_INFO in not defined 14 | #ifdef VS_VERSION_INFO 15 | #undef VS_VERSION_INFO 16 | #endif 17 | 18 | #include "common.ver" 19 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/PL011driver.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // PL011driver.h 7 | // 8 | // Abstract: 9 | // 10 | // This module contains the ARM PL011 UART controller driver entry functions. 11 | // This controller driver uses the Serial WDF class extension (SerCx2). 12 | // 13 | // Environment: 14 | // 15 | // kernel-mode only 16 | // 17 | 18 | #ifndef _PL011_DRIVER_H_ 19 | #define _PL011_DRIVER_H_ 20 | 21 | WDF_EXTERN_C_START 22 | 23 | 24 | // 25 | // Driver configuration parameters registry value names 26 | // 27 | #define MAX_BAUD_RATE__REG_VAL_NAME L"MaxBaudRateBPS" 28 | #define UART_CLOCK___REG_VAL_NAME L"UartClockHz" 29 | #define UART_FLOW_CTRL__REG_VAL_NAME L"UartFlowControl" 30 | #define UART_CTRL_LINES__REG_VAL_NAME L"UartControlLines" 31 | 32 | 33 | // 34 | // PL011_DRIVER_EXTENSION. 35 | // Contains all The PL011 driver configuration parameters. 36 | // It is associated with the WDFDRIVER object. 37 | // 38 | typedef struct _PL011_DRIVER_EXTENSION 39 | { 40 | // 41 | // Driver configuration parameters 42 | // We read these parameters from registry, 43 | // since three is no standard way to get it 44 | // from UEFI. 45 | // 46 | // The configuration parameters reside at: 47 | // HKLM\System\CurrentControlSet\Services\SerPL011\Parameters 48 | // 49 | 50 | // 51 | // Max baud rate 52 | // 53 | ULONG MaxBaudRateBPS; 54 | 55 | // 56 | // UART clock. 57 | // 58 | ULONG UartClockHz; 59 | 60 | // 61 | // Flow control supported by the 62 | // board 63 | // 64 | ULONG UartFlowControl; 65 | 66 | // 67 | // Control line exposed by the 68 | // board 69 | // 70 | ULONG UartControlLines; 71 | 72 | } PL011_DRIVER_EXTENSION; 73 | 74 | WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(PL011_DRIVER_EXTENSION, PL011DriverGetExtension); 75 | 76 | 77 | // 78 | // PL011driver WDF Driver event handlers 79 | // 80 | DRIVER_INITIALIZE DriverEntry; 81 | EVT_WDF_DRIVER_UNLOAD PL011EvtDriverUnload; 82 | 83 | 84 | // 85 | // PL011driver private methods 86 | // 87 | #ifdef _PL011_DRIVER_CPP_ 88 | 89 | _IRQL_requires_max_(PASSIVE_LEVEL) 90 | NTSTATUS 91 | PL011pDriverReadConfig(); 92 | 93 | #endif //_PL011_DRIVER_CPP_ 94 | 95 | 96 | WDF_EXTERN_C_END 97 | 98 | #endif // !_PL011_DRIVER_H_ 99 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/PL011interrupt.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // PL011interrupt.h 7 | // 8 | // Abstract: 9 | // 10 | // This module contains common enum, types, and methods definitions 11 | // for handling ARM PL011 UART interrupts. 12 | // This controller driver uses the Serial WDF class extension (SerCx2). 13 | // 14 | // Environment: 15 | // 16 | // kernel-mode only 17 | // 18 | 19 | #ifndef _PL011_INTERRUPT_H_ 20 | #define _PL011_INTERRUPT_H_ 21 | 22 | WDF_EXTERN_C_START 23 | 24 | 25 | // 26 | // PL011interrupt WDF interrupt event handlers 27 | // 28 | EVT_WDF_INTERRUPT_ISR PL011EvtInterruptIsr; 29 | EVT_WDF_INTERRUPT_DPC PL011EvtInterruptDpc; 30 | 31 | 32 | // 33 | // PL011interrupt private methods 34 | // 35 | #ifdef _PL011_INTERRUPT_CPP_ 36 | 37 | BOOLEAN 38 | PL011pInterruptIsr( 39 | _In_ PL011_DEVICE_EXTENSION* DevExtPtr 40 | ); 41 | 42 | #endif //_PL011_INTERRUPT_CPP_ 43 | 44 | 45 | WDF_EXTERN_C_END 46 | 47 | #endif // !_PL011_INTERRUPT_H_ 48 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/PL011logging.h: -------------------------------------------------------------------------------- 1 | // 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // 5 | // Module Name: 6 | // 7 | // PL011logging.h 8 | // 9 | // Abstract: 10 | // 11 | // This module contains the tracing definitions for the 12 | // ARM PL011 (UART) device driver. 13 | // This controller driver uses the Serial WDF class extension (SerCx2). 14 | // 15 | // Environment: 16 | // 17 | // kernel-mode only 18 | // 19 | 20 | #ifndef _PL011_LOGGING_H_ 21 | #define _PL011_LOGGING_H_ 22 | 23 | WDF_EXTERN_C_START 24 | 25 | 26 | // 27 | // Defining control guids, including this is required to happen before 28 | // including the tmh file (if the WppRecorder API is used) 29 | // 30 | #include 31 | 32 | // 33 | // Debug support 34 | // 35 | extern BOOLEAN PL011IsDebuggerPresent(); 36 | extern BOOLEAN PL011BreakPoint(); 37 | 38 | 39 | // 40 | // Tracing GUID - 2EA62EE7-3DC8-401D-99DA-3F9379A231AD 41 | // 42 | #define WPP_CONTROL_GUIDS \ 43 | WPP_DEFINE_CONTROL_GUID(SERPL011, (2EA62EE7,3DC8,401D,99DA,3F9379A231AD), \ 44 | WPP_DEFINE_BIT(PL011_TRACING_DEFAULT) \ 45 | WPP_DEFINE_BIT(PL011_TRACING_VERBOSE) \ 46 | WPP_DEFINE_BIT(PL011_TRACING_DEBUG) \ 47 | ) 48 | 49 | // begin_wpp config 50 | // 51 | // FUNC PL011_LOG_ASSERTION{LEVEL=TRACE_LEVEL_ERROR, FLAGS=PL011_TRACING_DEBUG}(MSG, ...); 52 | // USEPREFIX (PL011_LOG_ASSERTION, "%!STDPREFIX! [%s @ %u] ASSERTION :", __FILE__, __LINE__); 53 | // 54 | // FUNC PL011_LOG_ERROR{LEVEL=TRACE_LEVEL_ERROR, FLAGS=PL011_TRACING_DEFAULT}(MSG, ...); 55 | // USEPREFIX (PL011_LOG_ERROR, "%!STDPREFIX! [%s @ %u] ERROR :", __FILE__, __LINE__); 56 | // 57 | // FUNC PL011_LOG_WARNING{LEVEL=TRACE_LEVEL_WARNING, FLAGS=PL011_TRACING_DEFAULT}(MSG, ...); 58 | // USEPREFIX (PL011_LOG_WARNING, "%!STDPREFIX! [%s @ %u] WARNING :", __FILE__, __LINE__); 59 | // 60 | // FUNC PL011_LOG_INFORMATION{LEVEL=TRACE_LEVEL_INFORMATION, FLAGS=PL011_TRACING_DEFAULT}(MSG, ...); 61 | // USEPREFIX (PL011_LOG_INFORMATION, "%!STDPREFIX! [%s @ %u] INFO :", __FILE__, __LINE__); 62 | // 63 | // FUNC PL011_LOG_TRACE{LEVEL=TRACE_LEVEL_VERBOSE, FLAGS=PL011_TRACING_VERBOSE}(MSG, ...); 64 | // USEPREFIX (PL011_LOG_TRACE, "%!STDPREFIX! [%s @ %u] TRACE :", __FILE__, __LINE__); 65 | // 66 | // FUNC PL011_ASSERT{LEVEL=TRACE_LEVEL_ERROR, FLAGS=PL011_TRACING_DEBUG}(PL011_ASSERT_EXP); 67 | // USEPREFIX (PL011_ASSERT, "%!STDPREFIX! [%s @ %u] ASSERTION :%s", __FILE__, __LINE__, #PL011_ASSERT_EXP); 68 | // 69 | // end_wpp 70 | 71 | 72 | // 73 | // PL011_ASSERT customization 74 | // 75 | #define WPP_RECORDER_LEVEL_FLAGS_PL011_ASSERT_EXP_FILTER(LEVEL, FLAGS, PL011_ASSERT_EXP) \ 76 | (!(PL011_ASSERT_EXP)) 77 | 78 | #define WPP_RECORDER_LEVEL_FLAGS_PL011_ASSERT_EXP_ARGS(LEVEL, FLAGS, PL011_ASSERT_EXP) \ 79 | WPP_CONTROL(WPP_BIT_ ## FLAGS).AutoLogContext, LEVEL, WPP_BIT_ ## FLAGS 80 | 81 | #define WPP_LEVEL_FLAGS_PL011_ASSERT_EXP_POST(LEVEL, FLAGS, PL011P_ASSERT_EXP) \ 82 | ,((!(PL011P_ASSERT_EXP)) ? PL011BreakPoint() : 1) 83 | 84 | 85 | WDF_EXTERN_C_END 86 | 87 | #endif // !_PL011_LOGGING_H_ -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/README.md: -------------------------------------------------------------------------------- 1 | # Raspberry Pi 2 (BCM2836) ARM PL011 UART Driver 2 | This is the Arm standard PL011 UART driver available on Pi2 and Pi3. 3 | The driver is a kernel mode driver implemented as a SerCx2 Serial Controller Driver. 4 | The device does not have HW flow control and does not use DMA. 5 | 6 | On Pi2 the PL011 UART RX/TX signals are routed to the Pi2 header on pins 8/10 (GPIO15/14), and is available to user-mode application and other device drivers. 7 | On Pi3 it is being used by the BT stack to communicate with the BT modem, and thus not available to user-mode application and other device drivers. 8 | On Pi3 the miniUART is used for this purpose. 9 | 10 | The PL011 UART registry settings reside under key HKLM\System\CurrentControlSet\services\SerPl011\Parameters: 11 | - UartClockHz: UART clock [Hz]. Default value is 16 Mhz. The UART clock needs to be 16 times the maximum baud rate, means a default of 1 MBPS. 12 | - MaxBaudRateBPS: Maximum baud rate [Bytes Per Second], default is 921600 BPS. 13 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/SerPL011.inf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ms-iot/rpi-iotcore/31e89330c37564d96e246a64210cfeaf8c45007c/drivers/uart/bcm2836/serPL011/SerPL011.inf -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/SerPL011.pkg.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/precomp.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) Microsoft Corporation. All rights reserved. 3 | // 4 | // Module Name: 5 | // 6 | // PL011driver.cpp 7 | // 8 | // Abstract: 9 | // 10 | // This is the standard header for all of the source modules within the 11 | // ARM PL011 UART device driver. 12 | // 13 | // Environment: 14 | // 15 | // kernel-mode only 16 | // 17 | 18 | // Various compilation options 19 | #pragma warning(disable:4127) 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | // Class Extension includes 31 | #define RESHUB_USE_HELPER_ROUTINES 32 | #include 33 | #include 34 | 35 | // For initial debugging with a serial debugger 36 | #if DBG 37 | #define IS_DONT_CHANGE_HW 0 38 | #else // DBG 39 | #define IS_DONT_CHANGE_HW 0 40 | #endif // !DBG 41 | -------------------------------------------------------------------------------- /drivers/uart/bcm2836/serPL011/sources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | SerPL011 5 | DRIVER 6 | retail 7 | /W4 /WX 8 | 1 9 | 1 10 | SerPL011.inf 11 | $(INCLUDES); $(DDK_INC_PATH)\sercx\2.0; $(MINWIN_PRIV_SDK_INC_PATH); 12 | $(TARGETLIBS) $(DDK_LIB_PATH)\sercx\2.0\SerCxStubs.lib $(DDK_LIB_PATH)\wpprecorder.lib 13 | PL011driver.cpp PL011device.cpp PL011ioctl.cpp PL011interrupt.cpp PL011uart.cpp PL011rx.cpp PL011tx.cpp PL011hw.cpp PL011common.cpp PL011.rc 14 | 15 | -------------------------------------------------------------------------------- /tools/binexport.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | REM Export Script for exporting required binary files only 3 | goto START 4 | 5 | :Usage 6 | echo Usage: binexport [Release]/[Debug] [TargetDir] 7 | echo Release................... Picks the release binaries 8 | echo Debug..................... Picks the debug binaries 9 | echo One of the above should be specified 10 | echo [TargetDir]............... Directory to export the files. 11 | echo [/?]...................... Displays this usage string. 12 | echo Example: 13 | echo binexport Release C:\bsp_v1.0_release 14 | echo binexport Debug C:\bsp_v1.0_debug 15 | 16 | 17 | exit /b 1 18 | 19 | :START 20 | 21 | REM Input validation 22 | if [%1] == [/?] goto Usage 23 | if [%1] == [-?] goto Usage 24 | if [%1] == [] goto Usage 25 | if [%2] == [] ( 26 | goto Usage 27 | ) else ( 28 | set TDIR=%2\RPi 29 | ) 30 | 31 | pushd 32 | setlocal ENABLEDELAYEDEXPANSION 33 | 34 | REM 35 | REM Set source root 36 | REM 37 | set REPO_BUILD_TOOL=%~dp0 38 | cd /d "%REPO_BUILD_TOOL%.." 39 | set REPO_SOURCE_ROOT=%cd%\ 40 | 41 | set OUTPUT_DIR=%REPO_SOURCE_ROOT%\build\bcm2836\ARM 42 | set BINTYPE=%1 43 | 44 | 45 | if not exist %TDIR% ( mkdir %TDIR% ) 46 | if not exist %OUTPUT_DIR%\%BINTYPE% ( 47 | echo %BINTYPE% directory not found. Do %BINTYPE% build 48 | goto usage 49 | ) 50 | REM Copy the bspfiles 51 | xcopy /E /I %REPO_SOURCE_ROOT%\bspfiles\*.* %TDIR% >nul 52 | set DRVDIR=%TDIR%\Packages\RPi.Drivers 53 | 54 | REM Export the built binaries 55 | copy %OUTPUT_DIR%\%BINTYPE%\*.inf %DRVDIR% > nul 56 | copy %OUTPUT_DIR%\%BINTYPE%\*.sys %DRVDIR% > nul 57 | copy %OUTPUT_DIR%\%BINTYPE%\*.dll %DRVDIR% > nul 58 | 59 | popd 60 | exit /b 61 | 62 | 63 | -------------------------------------------------------------------------------- /tools/binexport.ps1: -------------------------------------------------------------------------------- 1 | <# 2 | .SYNOPSIS 3 | Exports the driver binaries in a zip file format with all the bsp files in the right format. 4 | 5 | .DESCRIPTION 6 | Exports the driver binaries in a zip file format with all the bsp files in the right format the output zip file can be imported directly in the IoTCoreShell using the Import-IoTBSP command. 7 | 8 | .PARAMETER OutputDir 9 | Mandatory parameter, specifying the output directory for the zip file. 10 | 11 | .PARAMETER IsDebug 12 | Optional Switch parameter to package debug binaries. Default is Release binaries. 13 | 14 | .EXAMPLE 15 | binexport.ps1 "C:\Release" 16 | 17 | #> 18 | param( 19 | [Parameter(Position = 0, Mandatory = $true)][ValidateNotNullOrEmpty()][String]$OutputDir, 20 | [Parameter(Position = 1, Mandatory = $false)][Switch]$IsDebug 21 | ) 22 | 23 | $RootDir = "$PSScriptRoot\..\" 24 | #$RootDir = Resolve-Path -Path $RootDir 25 | $buildconfig = "Release" 26 | #Override if IsDebug switch defined. 27 | if($IsDebug){ 28 | $buildconfig = "Debug" 29 | } 30 | $bindir = $RootDir + "build\bcm2836\ARM\$buildconfig\" 31 | $OutputFile = "RPi_BSP_$buildconfig.zip" 32 | 33 | if (!(Test-Path $bindir -PathType Container)){ 34 | Write-Host "Error: $bindir not found." -ForegroundColor Red 35 | return 36 | } 37 | $bindir = Resolve-Path -Path $bindir 38 | 39 | if (!(Test-Path "$OutputDir\RPi")) { 40 | New-Item "$OutputDir\RPi" -ItemType Directory | Out-Null 41 | } 42 | 43 | #Copy items 44 | Copy-Item -Path "$RootDir\bspfiles\*" -Destination "$OutputDir\RPi\" -Recurse -Force | Out-Null 45 | Copy-Item -Path "$bindir\*" -Destination "$OutputDir\RPi\Packages\RPi.Drivers\" -Include "*.sys","*.dll","*.inf" -Force | Out-Null 46 | 47 | Write-Host "Output File: $OutputFile" 48 | if (Test-Path "$OutputDir\$OutputFile" -PathType Leaf){ 49 | Remove-Item "$OutputDir\$OutputFile" -Force | Out-Null 50 | } 51 | Compress-Archive -Path "$OutputDir\RPi\" -CompressionLevel "Fastest" -DestinationPath "$OutputDir\$OutputFile" 52 | Remove-Item "$OutputDir\RPi\" -Recurse -Force | Out-Null 53 | 54 | Write-Host "Done" 55 | --------------------------------------------------------------------------------