Full Code of hrvach/deskhop for AI

main be55d7f7aeeb cached
563 files
12.4 MB
3.3M tokens
3104 symbols
1 requests
Copy disabled (too large) Download .txt
Showing preview only (13,137K chars total). Download the full file to get everything.
Repository: hrvach/deskhop
Branch: main
Commit: be55d7f7aeeb
Files: 563
Total size: 12.4 MB

Directory structure:
gitextract_phg38h2d/

├── .github/
│   └── workflows/
│       └── build.yml
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── Pico-PIO-USB/
│   ├── CMakeLists.txt
│   └── src/
│       ├── pio_usb.c
│       ├── pio_usb.h
│       ├── pio_usb_configuration.h
│       ├── pio_usb_device.c
│       ├── pio_usb_host.c
│       ├── pio_usb_ll.h
│       ├── usb_crc.c
│       ├── usb_crc.h
│       ├── usb_definitions.h
│       ├── usb_rx.pio
│       ├── usb_rx.pio.h
│       ├── usb_tx.pio
│       └── usb_tx.pio.h
├── README.md
├── case/
│   ├── bottom.stl
│   ├── deskhop_case.f3d
│   ├── deskhop_case.step
│   └── top.stl
├── disk/
│   ├── create.sh
│   ├── disk.S
│   └── disk.img
├── misc/
│   ├── .clang-format
│   ├── .editorconfig
│   ├── .markdownlint.yaml
│   ├── Dockerfile
│   ├── crc32.py
│   ├── docker.yml
│   └── memory_map.ld
├── pcb/
│   ├── v1.0/
│   │   ├── DeskHop.kicad_pcb
│   │   ├── DeskHop.kicad_prl
│   │   ├── DeskHop.kicad_pro
│   │   ├── DeskHop.kicad_sch
│   │   └── Gerber/
│   │       ├── DeskHop-B_Cu.gbr
│   │       ├── DeskHop-B_Mask.gbr
│   │       ├── DeskHop-B_Paste.gbr
│   │       ├── DeskHop-B_Silkscreen.gbr
│   │       ├── DeskHop-Edge_Cuts.gbr
│   │       ├── DeskHop-F_Cu.gbr
│   │       ├── DeskHop-F_Mask.gbr
│   │       ├── DeskHop-F_Paste.gbr
│   │       ├── DeskHop-F_Silkscreen.gbr
│   │       ├── DeskHop-NPTH.drl
│   │       ├── DeskHop-PTH.drl
│   │       └── DeskHop-job.gbrjob
│   └── v1.1/
│       ├── DeskHop_Rev1.kicad_pcb
│       ├── DeskHop_Rev1.kicad_pro
│       ├── DeskHop_Rev1.kicad_sch
│       └── Gerber/
│           ├── DeskHop_Rev1-B_Cu.gbr
│           ├── DeskHop_Rev1-B_Mask.gbr
│           ├── DeskHop_Rev1-B_Silkscreen.gbr
│           ├── DeskHop_Rev1-Edge_Cuts.gbr
│           ├── DeskHop_Rev1-F_Cu.gbr
│           ├── DeskHop_Rev1-F_Mask.gbr
│           ├── DeskHop_Rev1-F_Paste.gbr
│           ├── DeskHop_Rev1-F_Silkscreen.gbr
│           ├── DeskHop_Rev1-NPTH.drl
│           ├── DeskHop_Rev1-PTH.drl
│           └── DeskHop_Rev1-job.gbrjob
├── pico-sdk/
│   ├── CMakeLists.txt
│   ├── cmake/
│   │   ├── Platform/
│   │   │   └── PICO.cmake
│   │   ├── pico_pre_load_platform.cmake
│   │   ├── pico_pre_load_toolchain.cmake
│   │   ├── pico_utils.cmake
│   │   └── preload/
│   │       ├── platforms/
│   │       │   ├── host.cmake
│   │       │   ├── pico/
│   │       │   │   └── pico.cmake
│   │       │   └── rp2040.cmake
│   │       └── toolchains/
│   │           ├── find_compiler.cmake
│   │           ├── pico_arm_clang.cmake
│   │           ├── pico_arm_clang_arm.cmake
│   │           ├── pico_arm_gcc.cmake
│   │           └── set_flags.cmake
│   ├── lib/
│   │   └── tinyusb/
│   │       ├── LICENSE
│   │       ├── hw/
│   │       │   └── bsp/
│   │       │       ├── ansi_escape.h
│   │       │       ├── board.c
│   │       │       ├── board_api.h
│   │       │       ├── board_mcu.h
│   │       │       ├── family_support.cmake
│   │       │       └── rp2040/
│   │       │           ├── board.h
│   │       │           ├── boards/
│   │       │           │   ├── pico_sdk/
│   │       │           │   │   └── board.cmake
│   │       │           │   └── raspberry_pi_pico/
│   │       │           │       └── board.cmake
│   │       │           ├── family.c
│   │       │           ├── family.cmake
│   │       │           ├── family.mk
│   │       │           ├── pico_sdk_import.cmake
│   │       │           └── rp2040-openocd.cfg
│   │       └── src/
│   │           ├── CMakeLists.txt
│   │           ├── class/
│   │           │   ├── cdc/
│   │           │   │   ├── cdc.h
│   │           │   │   ├── cdc_device.c
│   │           │   │   ├── cdc_device.h
│   │           │   │   └── serial/
│   │           │   │       ├── cp210x.h
│   │           │   │       └── ftdi_sio.h
│   │           │   ├── hid/
│   │           │   │   ├── hid.h
│   │           │   │   ├── hid_device.c
│   │           │   │   ├── hid_device.h
│   │           │   │   ├── hid_host.c
│   │           │   │   └── hid_host.h
│   │           │   └── msc/
│   │           │       ├── msc.h
│   │           │       ├── msc_device.c
│   │           │       └── msc_device.h
│   │           ├── common/
│   │           │   ├── tusb_common.h
│   │           │   ├── tusb_compiler.h
│   │           │   ├── tusb_debug.h
│   │           │   ├── tusb_fifo.c
│   │           │   ├── tusb_fifo.h
│   │           │   ├── tusb_mcu.h
│   │           │   ├── tusb_private.h
│   │           │   ├── tusb_types.h
│   │           │   └── tusb_verify.h
│   │           ├── device/
│   │           │   ├── dcd.h
│   │           │   ├── usbd.c
│   │           │   ├── usbd.h
│   │           │   ├── usbd_control.c
│   │           │   └── usbd_pvt.h
│   │           ├── host/
│   │           │   ├── hcd.h
│   │           │   ├── hub.c
│   │           │   ├── hub.h
│   │           │   ├── usbh.c
│   │           │   ├── usbh.h
│   │           │   └── usbh_pvt.h
│   │           ├── osal/
│   │           │   ├── osal.h
│   │           │   ├── osal_none.h
│   │           │   └── osal_pico.h
│   │           ├── portable/
│   │           │   └── raspberrypi/
│   │           │       ├── pio_usb/
│   │           │       │   ├── dcd_pio_usb.c
│   │           │       │   └── hcd_pio_usb.c
│   │           │       └── rp2040/
│   │           │           ├── dcd_rp2040.c
│   │           │           ├── hcd_rp2040.c
│   │           │           ├── rp2040_usb.c
│   │           │           └── rp2040_usb.h
│   │           ├── tinyusb.mk
│   │           ├── tusb.c
│   │           ├── tusb.h
│   │           ├── tusb_option.h
│   │           └── typec/
│   │               ├── pd_types.h
│   │               ├── tcd.h
│   │               ├── usbc.c
│   │               └── usbc.h
│   ├── pico_sdk_import.cmake
│   ├── pico_sdk_init.cmake
│   ├── pico_sdk_version.cmake
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   ├── board_setup.cmake
│   │   ├── boards/
│   │   │   ├── generic_board.cmake
│   │   │   ├── include/
│   │   │   │   └── boards/
│   │   │   │       ├── none.h
│   │   │   │       ├── pico.h
│   │   │   │       └── pico_w.h
│   │   │   └── pico_w.cmake
│   │   ├── common/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── README.md
│   │   │   ├── boot_picoboot/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── boot/
│   │   │   │           └── picoboot.h
│   │   │   ├── boot_uf2/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── boot/
│   │   │   │           └── uf2.h
│   │   │   ├── pico_base/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── generate_config_header.cmake
│   │   │   │   └── include/
│   │   │   │       ├── pico/
│   │   │   │       │   ├── assert.h
│   │   │   │       │   ├── config.h
│   │   │   │       │   ├── error.h
│   │   │   │       │   ├── types.h
│   │   │   │       │   └── version.h.in
│   │   │   │       └── pico.h
│   │   │   ├── pico_binary_info/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           ├── binary_info/
│   │   │   │           │   ├── code.h
│   │   │   │           │   ├── defs.h
│   │   │   │           │   └── structure.h
│   │   │   │           └── binary_info.h
│   │   │   ├── pico_bit_ops/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── bit_ops.h
│   │   │   ├── pico_divider/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── divider.h
│   │   │   ├── pico_stdlib/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── stdlib.h
│   │   │   ├── pico_sync/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── critical_section.c
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       ├── critical_section.h
│   │   │   │   │       ├── lock_core.h
│   │   │   │   │       ├── mutex.h
│   │   │   │   │       ├── sem.h
│   │   │   │   │       └── sync.h
│   │   │   │   ├── lock_core.c
│   │   │   │   ├── mutex.c
│   │   │   │   └── sem.c
│   │   │   ├── pico_time/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       ├── time.h
│   │   │   │   │       └── timeout_helper.h
│   │   │   │   ├── time.c
│   │   │   │   └── timeout_helper.c
│   │   │   ├── pico_usb_reset_interface/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── usb_reset_interface.h
│   │   │   └── pico_util/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── datetime.c
│   │   │       ├── doc.h
│   │   │       ├── include/
│   │   │       │   └── pico/
│   │   │       │       └── util/
│   │   │       │           ├── datetime.h
│   │   │       │           ├── pheap.h
│   │   │       │           └── queue.h
│   │   │       ├── pheap.c
│   │   │       └── queue.c
│   │   ├── rp2040/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── README.md
│   │   │   ├── hardware_regs/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           ├── platform_defs.h
│   │   │   │           └── regs/
│   │   │   │               ├── adc.h
│   │   │   │               ├── addressmap.h
│   │   │   │               ├── busctrl.h
│   │   │   │               ├── clocks.h
│   │   │   │               ├── dma.h
│   │   │   │               ├── dreq.h
│   │   │   │               ├── i2c.h
│   │   │   │               ├── intctrl.h
│   │   │   │               ├── io_bank0.h
│   │   │   │               ├── io_qspi.h
│   │   │   │               ├── m0plus.h
│   │   │   │               ├── pads_bank0.h
│   │   │   │               ├── pads_qspi.h
│   │   │   │               ├── pio.h
│   │   │   │               ├── pll.h
│   │   │   │               ├── psm.h
│   │   │   │               ├── pwm.h
│   │   │   │               ├── resets.h
│   │   │   │               ├── rosc.h
│   │   │   │               ├── rtc.h
│   │   │   │               ├── sio.h
│   │   │   │               ├── spi.h
│   │   │   │               ├── ssi.h
│   │   │   │               ├── syscfg.h
│   │   │   │               ├── sysinfo.h
│   │   │   │               ├── tbman.h
│   │   │   │               ├── timer.h
│   │   │   │               ├── uart.h
│   │   │   │               ├── usb.h
│   │   │   │               ├── usb_device_dpram.h
│   │   │   │               ├── vreg_and_chip_reset.h
│   │   │   │               ├── watchdog.h
│   │   │   │               ├── xip.h
│   │   │   │               └── xosc.h
│   │   │   └── hardware_structs/
│   │   │       ├── CMakeLists.txt
│   │   │       └── include/
│   │   │           └── hardware/
│   │   │               └── structs/
│   │   │                   ├── adc.h
│   │   │                   ├── bus_ctrl.h
│   │   │                   ├── clocks.h
│   │   │                   ├── dma.h
│   │   │                   ├── i2c.h
│   │   │                   ├── interp.h
│   │   │                   ├── iobank0.h
│   │   │                   ├── ioqspi.h
│   │   │                   ├── mpu.h
│   │   │                   ├── nvic.h
│   │   │                   ├── pads_qspi.h
│   │   │                   ├── padsbank0.h
│   │   │                   ├── pio.h
│   │   │                   ├── pll.h
│   │   │                   ├── psm.h
│   │   │                   ├── pwm.h
│   │   │                   ├── resets.h
│   │   │                   ├── rosc.h
│   │   │                   ├── rtc.h
│   │   │                   ├── scb.h
│   │   │                   ├── sio.h
│   │   │                   ├── spi.h
│   │   │                   ├── ssi.h
│   │   │                   ├── syscfg.h
│   │   │                   ├── systick.h
│   │   │                   ├── timer.h
│   │   │                   ├── uart.h
│   │   │                   ├── usb.h
│   │   │                   ├── vreg_and_chip_reset.h
│   │   │                   ├── watchdog.h
│   │   │                   ├── xip_ctrl.h
│   │   │                   └── xosc.h
│   │   ├── rp2040.cmake
│   │   ├── rp2_common/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── README.md
│   │   │   ├── boot_stage2/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── asminclude/
│   │   │   │   │   └── boot2_helpers/
│   │   │   │   │       ├── exit_from_boot2.S
│   │   │   │   │       ├── read_flash_sreg.S
│   │   │   │   │       └── wait_ssi_ready.S
│   │   │   │   ├── boot2_at25sf128a.S
│   │   │   │   ├── boot2_generic_03h.S
│   │   │   │   ├── boot2_is25lp080.S
│   │   │   │   ├── boot2_usb_blinky.S
│   │   │   │   ├── boot2_w25q080.S
│   │   │   │   ├── boot2_w25x10cl.S
│   │   │   │   ├── boot_stage2.ld
│   │   │   │   ├── compile_time_choice.S
│   │   │   │   ├── doc.h
│   │   │   │   ├── include/
│   │   │   │   │   └── boot_stage2/
│   │   │   │   │       └── config.h
│   │   │   │   └── pad_checksum
│   │   │   ├── cmsis/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── cmsis/
│   │   │   │   │       └── rename_exceptions.h
│   │   │   │   └── stub/
│   │   │   │       └── CMSIS/
│   │   │   │           ├── Core/
│   │   │   │           │   └── Include/
│   │   │   │           │       ├── cmsis_armcc.h
│   │   │   │           │       ├── cmsis_armclang.h
│   │   │   │           │       ├── cmsis_armclang_ltm.h
│   │   │   │           │       ├── cmsis_compiler.h
│   │   │   │           │       ├── cmsis_gcc.h
│   │   │   │           │       ├── cmsis_iccarm.h
│   │   │   │           │       ├── cmsis_version.h
│   │   │   │           │       ├── core_cm0plus.h
│   │   │   │           │       └── mpu_armv7.h
│   │   │   │           ├── Device/
│   │   │   │           │   └── RaspberryPi/
│   │   │   │           │       └── RP2040/
│   │   │   │           │           ├── Include/
│   │   │   │           │           │   ├── RP2040.h
│   │   │   │           │           │   └── system_RP2040.h
│   │   │   │           │           └── Source/
│   │   │   │           │               └── system_RP2040.c
│   │   │   │           └── LICENSE.txt
│   │   │   ├── hardware_adc/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── adc.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── adc.h
│   │   │   ├── hardware_base/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── address_mapped.h
│   │   │   ├── hardware_claim/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── claim.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── claim.h
│   │   │   ├── hardware_clocks/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── clocks.c
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── clocks.h
│   │   │   │   └── scripts/
│   │   │   │       └── vcocalc.py
│   │   │   ├── hardware_divider/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── divider.S
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           ├── divider.h
│   │   │   │           └── divider_helper.S
│   │   │   ├── hardware_dma/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── dma.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── dma.h
│   │   │   ├── hardware_exception/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── exception.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── exception.h
│   │   │   ├── hardware_flash/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── flash.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── flash.h
│   │   │   ├── hardware_gpio/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── gpio.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── gpio.h
│   │   │   ├── hardware_i2c/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── i2c.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── i2c.h
│   │   │   ├── hardware_interp/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── interp.h
│   │   │   │   └── interp.c
│   │   │   ├── hardware_irq/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── irq.h
│   │   │   │   ├── irq.c
│   │   │   │   └── irq_handler_chain.S
│   │   │   ├── hardware_pio/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       ├── pio.h
│   │   │   │   │       └── pio_instructions.h
│   │   │   │   └── pio.c
│   │   │   ├── hardware_pll/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── pll.h
│   │   │   │   └── pll.c
│   │   │   ├── hardware_pwm/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── pwm.h
│   │   │   ├── hardware_resets/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── resets.h
│   │   │   ├── hardware_rtc/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── rtc.h
│   │   │   │   └── rtc.c
│   │   │   ├── hardware_spi/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── spi.h
│   │   │   │   └── spi.c
│   │   │   ├── hardware_sync/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── sync.h
│   │   │   │   └── sync.c
│   │   │   ├── hardware_timer/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── timer.h
│   │   │   │   └── timer.c
│   │   │   ├── hardware_uart/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── uart.h
│   │   │   │   └── uart.c
│   │   │   ├── hardware_vreg/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── vreg.h
│   │   │   │   └── vreg.c
│   │   │   ├── hardware_watchdog/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── watchdog.h
│   │   │   │   └── watchdog.c
│   │   │   ├── hardware_xosc/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── xosc.h
│   │   │   │   └── xosc.c
│   │   │   ├── pico_async_context/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── async_context_base.c
│   │   │   │   ├── async_context_freertos.c
│   │   │   │   ├── async_context_poll.c
│   │   │   │   ├── async_context_threadsafe_background.c
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           ├── async_context.h
│   │   │   │           ├── async_context_base.h
│   │   │   │           ├── async_context_freertos.h
│   │   │   │           ├── async_context_poll.h
│   │   │   │           └── async_context_threadsafe_background.h
│   │   │   ├── pico_bit_ops/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── bit_ops_aeabi.S
│   │   │   ├── pico_bootrom/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── bootrom.c
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           ├── bootrom/
│   │   │   │           │   └── sf_table.h
│   │   │   │           └── bootrom.h
│   │   │   ├── pico_bootsel_via_double_reset/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── pico_bootsel_via_double_reset.c
│   │   │   ├── pico_cxx_options/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── doc.h
│   │   │   ├── pico_divider/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── divider.S
│   │   │   ├── pico_double/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── double_aeabi.S
│   │   │   │   ├── double_init_rom.c
│   │   │   │   ├── double_math.c
│   │   │   │   ├── double_none.S
│   │   │   │   ├── double_v1_rom_shim.S
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── double.h
│   │   │   ├── pico_fix/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── rp2040_usb_device_enumeration/
│   │   │   │       ├── CMakeLists.txt
│   │   │   │       ├── include/
│   │   │   │       │   └── pico/
│   │   │   │       │       └── fix/
│   │   │   │       │           └── rp2040_usb_device_enumeration.h
│   │   │   │       └── rp2040_usb_device_enumeration.c
│   │   │   ├── pico_flash/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── flash.c
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── flash.h
│   │   │   ├── pico_float/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── float_aeabi.S
│   │   │   │   ├── float_init_rom.c
│   │   │   │   ├── float_math.c
│   │   │   │   ├── float_none.S
│   │   │   │   ├── float_v1_rom_shim.S
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── float.h
│   │   │   ├── pico_i2c_slave/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── i2c_slave.c
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── i2c_slave.h
│   │   │   ├── pico_int64_ops/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── int64_ops.h
│   │   │   │   └── pico_int64_ops_aeabi.S
│   │   │   ├── pico_malloc/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── malloc.h
│   │   │   │   └── pico_malloc.c
│   │   │   ├── pico_mem_ops/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── mem_ops.h
│   │   │   │   ├── mem_ops.c
│   │   │   │   └── mem_ops_aeabi.S
│   │   │   ├── pico_multicore/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── multicore.h
│   │   │   │   └── multicore.c
│   │   │   ├── pico_platform/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       ├── asm_helper.S
│   │   │   │   │       └── platform.h
│   │   │   │   └── platform.c
│   │   │   ├── pico_printf/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── printf.h
│   │   │   │   ├── printf.c
│   │   │   │   └── printf_none.S
│   │   │   ├── pico_rand/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── rand.h
│   │   │   │   └── rand.c
│   │   │   ├── pico_runtime/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── runtime.h
│   │   │   │   └── runtime.c
│   │   │   ├── pico_standard_link/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── binary_info.c
│   │   │   │   ├── crt0.S
│   │   │   │   ├── doc.h
│   │   │   │   ├── memmap_blocked_ram.ld
│   │   │   │   ├── memmap_copy_to_ram.ld
│   │   │   │   ├── memmap_default.ld
│   │   │   │   ├── memmap_no_flash.ld
│   │   │   │   └── new_delete.cpp
│   │   │   ├── pico_stdio/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── LICENSE
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       ├── stdio/
│   │   │   │   │       │   └── driver.h
│   │   │   │   │       └── stdio.h
│   │   │   │   └── stdio.c
│   │   │   ├── pico_stdio_semihosting/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── stdio_semihosting.h
│   │   │   │   └── stdio_semihosting.c
│   │   │   ├── pico_stdio_uart/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── stdio_uart.h
│   │   │   │   └── stdio_uart.c
│   │   │   ├── pico_stdio_usb/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   ├── pico/
│   │   │   │   │   │   ├── stdio_usb/
│   │   │   │   │   │   │   └── reset_interface.h
│   │   │   │   │   │   └── stdio_usb.h
│   │   │   │   │   └── tusb_config.h
│   │   │   │   ├── reset_interface.c
│   │   │   │   ├── stdio_usb.c
│   │   │   │   └── stdio_usb_descriptors.c
│   │   │   ├── pico_stdlib/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── stdlib.c
│   │   │   ├── pico_unique_id/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── unique_id.h
│   │   │   │   └── unique_id.c
│   │   │   └── tinyusb/
│   │   │       ├── CMakeLists.txt
│   │   │       └── doc.h
│   │   └── rp2_common.cmake
│   └── tools/
│       ├── CMakeLists.txt
│       ├── FindELF2UF2.cmake
│       ├── FindPioasm.cmake
│       ├── elf2uf2/
│       │   ├── CMakeLists.txt
│       │   ├── elf.h
│       │   └── main.cpp
│       └── pioasm/
│           ├── CMakeLists.txt
│           ├── ada_output.cpp
│           ├── c_sdk_output.cpp
│           ├── gen/
│           │   ├── lexer.cpp
│           │   ├── location.h
│           │   ├── parser.cpp
│           │   └── parser.hpp
│           ├── hex_output.cpp
│           ├── lexer.ll
│           ├── main.cpp
│           ├── output_format.h
│           ├── parser.yy
│           ├── pio_assembler.cpp
│           ├── pio_assembler.h
│           ├── pio_disassembler.cpp
│           ├── pio_disassembler.h
│           ├── pio_types.h
│           └── python_output.cpp
├── src/
│   ├── constants.c
│   ├── defaults.c
│   ├── handlers.c
│   ├── hid_parser.c
│   ├── hid_report.c
│   ├── include/
│   │   ├── config.h
│   │   ├── constants.h
│   │   ├── dma.h
│   │   ├── firmware.h
│   │   ├── flash.h
│   │   ├── handlers.h
│   │   ├── hid_parser.h
│   │   ├── hid_report.h
│   │   ├── keyboard.h
│   │   ├── main.h
│   │   ├── misc.h
│   │   ├── mouse.h
│   │   ├── packet.h
│   │   ├── pinout.h
│   │   ├── protocol.h
│   │   ├── screen.h
│   │   ├── serial.h
│   │   ├── setup.h
│   │   ├── structs.h
│   │   ├── tasks.h
│   │   ├── tusb_config.h
│   │   ├── usb_descriptors.h
│   │   ├── user_config.h
│   │   └── watchdog.h
│   ├── keyboard.c
│   ├── led.c
│   ├── main.c
│   ├── mouse.c
│   ├── protocol.c
│   ├── ramdisk.c
│   ├── setup.c
│   ├── tasks.c
│   ├── uart.c
│   ├── usb.c
│   ├── usb_descriptors.c
│   └── utils.c
└── webconfig/
    ├── .gitignore
    ├── Makefile
    ├── config-unpacked.htm
    ├── config.htm
    ├── form.py
    ├── render.py
    ├── requirements.txt
    └── templates/
        ├── form.html
        ├── main.html
        ├── packer.j2
        ├── script.js
        └── style.css

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/workflows/build.yml
================================================
name: Build

on:
  push:
    branches:
      - main
  pull_request:
    branches: 
      - main
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:

    - name: Install build deps
      shell: bash
      run: |
        sudo apt-get install -y \
          gcc-arm-none-eabi \
          libnewlib-arm-none-eabi \
          dosfstools

    - name: Checkout
      uses: actions/checkout@v4

    - name: Render webconfig
      shell: bash
      working-directory: webconfig
      run: make
    
    - name: Build disk image
      shell: bash
      working-directory: disk
      run: ./create.sh

    - name: Build firmware
      shell: bash
      run: |
        cmake -S . -B build
        cmake --build build

    - name: Publish artifacts
      uses: actions/upload-artifact@v4
      with:
        name: deskhop-gha-${{ github.run_number }}
        path: build/deskhop.uf2


================================================
FILE: .gitignore
================================================
build

.idea/


================================================
FILE: CMakeLists.txt
================================================
cmake_minimum_required(VERSION 3.6)

## Version Configuration.
## Define e.g. 0.72 as major 0 and minor 72
set(VERSION_MAJOR 0)
set(VERSION_MINOR 77)

## Release Type Selection
option(DH_DEBUG "Build a debug version" OFF)
option(DH_DEBUG_CDC_FLASH "Enable CDC command to trigger bootloader mode" OFF)

## Hardware Configuration
set(DP_PIN_DEFAULT 14 CACHE STRING "Default USB D+ Pin Number")
set(PIO_USE_TINYUSB 1 CACHE STRING "Make TinyUSB Manage the PIO USB Port")
set(PICO_BOARD "pico")

## Pico SDK Configuration
set(PICO_SDK_FETCH_FROM_GIT off)
set(PICO_SDK_PATH ${CMAKE_CURRENT_LIST_DIR}/pico-sdk)
set(SRC_DIR ${CMAKE_CURRENT_LIST_DIR}/src)
include(${PICO_SDK_PATH}/pico_sdk_import.cmake)

## Project Setup
project(deskhop_project C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(PICO_COPY_TO_RAM 1)

## Compiler Flags
set(CMAKE_C_FLAGS "-Ofast -Wall -mcpu=cortex-m0plus -mtune=cortex-m0plus -fstack-usage")

## Initialize Pico SDK
pico_sdk_init()

## PIO USB Library Setup
set(PICO_PIO_USB_DIR ${CMAKE_CURRENT_LIST_DIR}/Pico-PIO-USB)

add_library(Pico-PIO-USB STATIC
  ${PICO_PIO_USB_DIR}/src/pio_usb.c
  ${PICO_PIO_USB_DIR}/src/pio_usb_host.c
  ${PICO_PIO_USB_DIR}/src/usb_crc.c
)
pico_generate_pio_header(Pico-PIO-USB ${PICO_PIO_USB_DIR}/src/usb_tx.pio)
pico_generate_pio_header(Pico-PIO-USB ${PICO_PIO_USB_DIR}/src/usb_rx.pio)

target_link_libraries(Pico-PIO-USB PRIVATE
  pico_stdlib
  pico_multicore
  hardware_pio
  hardware_dma
)
target_include_directories(Pico-PIO-USB PRIVATE ${PICO_PIO_USB_DIR})

## Source Files
set(COMMON_SOURCES
  ${SRC_DIR}/usb_descriptors.c
  ${SRC_DIR}/defaults.c
  ${SRC_DIR}/constants.c
  ${SRC_DIR}/protocol.c
  ${SRC_DIR}/hid_parser.c
  ${SRC_DIR}/hid_report.c
  ${SRC_DIR}/utils.c
  ${SRC_DIR}/handlers.c
  ${SRC_DIR}/setup.c
  ${SRC_DIR}/keyboard.c
  ${SRC_DIR}/mouse.c
  ${SRC_DIR}/tasks.c
  ${SRC_DIR}/led.c
  ${SRC_DIR}/uart.c
  ${SRC_DIR}/usb.c
  ${SRC_DIR}/main.c
  ${SRC_DIR}/ramdisk.c
  ${PICO_TINYUSB_PATH}/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
  ${PICO_TINYUSB_PATH}/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
)

## Include Directories
set(COMMON_INCLUDES
  ${SRC_DIR}/include
  ${PICO_PIO_USB_DIR}/src
)

## Library Dependencies
set(COMMON_LINK_LIBRARIES
  pico_stdlib
  hardware_flash
  hardware_uart
  hardware_gpio
  hardware_pio
  hardware_dma

  tinyusb_device 
  tinyusb_host
  pico_multicore
  pico_unique_id
  Pico-PIO-USB
)
set(binary deskhop)

## Disk Image Configuration
# This assembles disk.S, then updates the elf section in post-build
# With the disk FAT image binary in /disk/disk.img 

set(DISK_ASM "${CMAKE_CURRENT_LIST_DIR}/disk/disk.S")
set(DISK_BIN "${CMAKE_CURRENT_LIST_DIR}/disk/disk.img")
set_property(SOURCE ${DISK_ASM} APPEND PROPERTY COMPILE_OPTIONS "-x" "assembler-with-cpp")

add_executable(${binary} ${DISK_ASM})

target_sources(${binary} PUBLIC ${COMMON_SOURCES})
target_compile_definitions(${binary} 
    PRIVATE
    VERSION_MAJOR=${VERSION_MAJOR}
    VERSION_MINOR=${VERSION_MINOR}
    PIO_USB_USE_TINYUSB=${PIO_USE_TINYUSB}
    PIO_USB_DP_PIN_DEFAULT=${DP_PIN_DEFAULT}
    __disk_file_path__="${DISK_BIN}"
)

## Support building a debug version
if (DH_DEBUG)
  add_definitions(-DDH_DEBUG)  
endif()

if (DH_DEBUG_CDC_FLASH)
  add_definitions(-DDH_DEBUG_CDC_FLASH)
endif()
  
target_include_directories(${binary} PUBLIC ${COMMON_INCLUDES})
target_link_libraries(${binary} PUBLIC ${COMMON_LINK_LIBRARIES})

## Configure Pico Library
pico_enable_stdio_usb(${binary} 0)
pico_enable_stdio_uart(${binary} 0)
pico_set_linker_script(${binary} ${CMAKE_SOURCE_DIR}/misc/memory_map.ld)

## Build other file formats as well
pico_add_extra_outputs(${binary})

# For internal firmware use, to simplify comparison: 0.72 -> 172
math(EXPR FIRMWARE_VERSION "${VERSION_MAJOR} * 1000 + ${VERSION_MINOR} + 100")

## Post-Build Commands
add_custom_command(
    TARGET ${binary} POST_BUILD
    COMMAND python3 ${CMAKE_SOURCE_DIR}/misc/crc32.py ${binary}.bin ${binary}.crc ${FIRMWARE_VERSION}
    COMMAND ${CMAKE_OBJCOPY} --update-section .section_metadata=${binary}.crc ${binary}.elf
    COMMAND ${CMAKE_OBJCOPY} -O binary ${binary}.elf ${binary}.bin
    COMMAND ${CMAKE_BINARY_DIR}/elf2uf2/elf2uf2 ${binary}.elf ${binary}.uf2
    COMMENT "Update CRC32 section to match the actual binary"  
)

## Linker Options
target_link_options(${binary} PRIVATE
  -Xlinker
  --print-memory-usage
)



================================================
FILE: LICENSE
================================================
                    GNU GENERAL PUBLIC LICENSE
                       Version 3, 29 June 2007

 Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
 Everyone is permitted to copy and distribute verbatim copies
 of this license document, but changing it is not allowed.

                            Preamble

  The GNU General Public License is a free, copyleft license for
software and other kinds of works.

  The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.  We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors.  You can apply it to
your programs, too.

  When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

  To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.

  For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

  Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

  For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

  Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so.  This is fundamentally incompatible with the aim of
protecting users' freedom to change the software.  The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable.  Therefore, we
have designed this version of the GPL to prohibit the practice for those
products.  If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.

  Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

  The precise terms and conditions for copying, distribution and
modification follow.

                       TERMS AND CONDITIONS

  0. Definitions.

  "This License" refers to version 3 of the GNU General Public License.

  "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.

  "The Program" refers to any copyrightable work licensed under this
License.  Each licensee is addressed as "you".  "Licensees" and
"recipients" may be individuals or organizations.

  To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy.  The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.

  A "covered work" means either the unmodified Program or a work based
on the Program.

  To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy.  Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.

  To "convey" a work means any kind of propagation that enables other
parties to make or receive copies.  Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.

  An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License.  If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.

  1. Source Code.

  The "source code" for a work means the preferred form of the work
for making modifications to it.  "Object code" means any non-source
form of a work.

  A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.

  The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form.  A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.

  The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities.  However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work.  For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.

  The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.

  The Corresponding Source for a work in source code form is that
same work.

  2. Basic Permissions.

  All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met.  This License explicitly affirms your unlimited
permission to run the unmodified Program.  The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work.  This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.

  You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force.  You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright.  Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.

  Conveying under any other circumstances is permitted solely under
the conditions stated below.  Sublicensing is not allowed; section 10
makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

  No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.

  When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.

  4. Conveying Verbatim Copies.

  You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.

  You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

  You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:

    a) The work must carry prominent notices stating that you modified
    it, and giving a relevant date.

    b) The work must carry prominent notices stating that it is
    released under this License and any conditions added under section
    7.  This requirement modifies the requirement in section 4 to
    "keep intact all notices".

    c) You must license the entire work, as a whole, under this
    License to anyone who comes into possession of a copy.  This
    License will therefore apply, along with any applicable section 7
    additional terms, to the whole of the work, and all its parts,
    regardless of how they are packaged.  This License gives no
    permission to license the work in any other way, but it does not
    invalidate such permission if you have separately received it.

    d) If the work has interactive user interfaces, each must display
    Appropriate Legal Notices; however, if the Program has interactive
    interfaces that do not display Appropriate Legal Notices, your
    work need not make them do so.

  A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit.  Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.

  6. Conveying Non-Source Forms.

  You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:

    a) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by the
    Corresponding Source fixed on a durable physical medium
    customarily used for software interchange.

    b) Convey the object code in, or embodied in, a physical product
    (including a physical distribution medium), accompanied by a
    written offer, valid for at least three years and valid for as
    long as you offer spare parts or customer support for that product
    model, to give anyone who possesses the object code either (1) a
    copy of the Corresponding Source for all the software in the
    product that is covered by this License, on a durable physical
    medium customarily used for software interchange, for a price no
    more than your reasonable cost of physically performing this
    conveying of source, or (2) access to copy the
    Corresponding Source from a network server at no charge.

    c) Convey individual copies of the object code with a copy of the
    written offer to provide the Corresponding Source.  This
    alternative is allowed only occasionally and noncommercially, and
    only if you received the object code with such an offer, in accord
    with subsection 6b.

    d) Convey the object code by offering access from a designated
    place (gratis or for a charge), and offer equivalent access to the
    Corresponding Source in the same way through the same place at no
    further charge.  You need not require recipients to copy the
    Corresponding Source along with the object code.  If the place to
    copy the object code is a network server, the Corresponding Source
    may be on a different server (operated by you or a third party)
    that supports equivalent copying facilities, provided you maintain
    clear directions next to the object code saying where to find the
    Corresponding Source.  Regardless of what server hosts the
    Corresponding Source, you remain obligated to ensure that it is
    available for as long as needed to satisfy these requirements.

    e) Convey the object code using peer-to-peer transmission, provided
    you inform other peers where the object code and Corresponding
    Source of the work are being offered to the general public at no
    charge under subsection 6d.

  A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.

  A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling.  In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage.  For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product.  A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.

  "Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source.  The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.

  If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information.  But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).

  The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed.  Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.

  Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.

  7. Additional Terms.

  "Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law.  If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.

  When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it.  (Additional permissions may be written to require their own
removal in certain cases when you modify the work.)  You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.

  Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:

    a) Disclaiming warranty or limiting liability differently from the
    terms of sections 15 and 16 of this License; or

    b) Requiring preservation of specified reasonable legal notices or
    author attributions in that material or in the Appropriate Legal
    Notices displayed by works containing it; or

    c) Prohibiting misrepresentation of the origin of that material, or
    requiring that modified versions of such material be marked in
    reasonable ways as different from the original version; or

    d) Limiting the use for publicity purposes of names of licensors or
    authors of the material; or

    e) Declining to grant rights under trademark law for use of some
    trade names, trademarks, or service marks; or

    f) Requiring indemnification of licensors and authors of that
    material by anyone who conveys the material (or modified versions of
    it) with contractual assumptions of liability to the recipient, for
    any liability that these contractual assumptions directly impose on
    those licensors and authors.

  All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10.  If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term.  If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.

  If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.

  Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.

  8. Termination.

  You may not propagate or modify a covered work except as expressly
provided under this License.  Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).

  However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.

  Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.

  Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License.  If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.

  9. Acceptance Not Required for Having Copies.

  You are not required to accept this License in order to receive or
run a copy of the Program.  Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance.  However,
nothing other than this License grants you permission to propagate or
modify any covered work.  These actions infringe copyright if you do
not accept this License.  Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.

  10. Automatic Licensing of Downstream Recipients.

  Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License.  You are not responsible
for enforcing compliance by third parties with this License.

  An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations.  If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.

  You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License.  For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.

  11. Patents.

  A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based.  The
work thus licensed is called the contributor's "contributor version".

  A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version.  For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.

  Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.

  In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement).  To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.

  If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients.  "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.

  If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.

  A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License.  You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.

  Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.

  12. No Surrender of Others' Freedom.

  If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License.  If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all.  For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.

  13. Use with the GNU Affero General Public License.

  Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work.  The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.

  14. Revised Versions of this License.

  The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time.  Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.

  Each version is given a distinguishing version number.  If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation.  If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.

  If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.

  Later license versions may give you additional or different
permissions.  However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.

  15. Disclaimer of Warranty.

  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  16. Limitation of Liability.

  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.

  17. Interpretation of Sections 15 and 16.

  If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.

                     END OF TERMS AND CONDITIONS

            How to Apply These Terms to Your New Programs

  If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.

  To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) <year>  <name of author>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.

Also add information on how to contact you by electronic and paper mail.

  If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

    <program>  Copyright (C) <year>  <name of author>
    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
    This is free software, and you are welcome to redistribute it
    under certain conditions; type `show c' for details.

The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License.  Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".

  You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.

  The GNU General Public License does not permit incorporating your program
into proprietary programs.  If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library.  If this is what you want to do, use the GNU Lesser General
Public License instead of this License.  But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.


================================================
FILE: Pico-PIO-USB/CMakeLists.txt
================================================
set(lib_name pico_pio_usb)
add_library(${lib_name} INTERFACE)

set(dir ${CMAKE_CURRENT_LIST_DIR}/src)

pico_generate_pio_header(${lib_name} ${dir}/usb_tx.pio)
pico_generate_pio_header(${lib_name} ${dir}/usb_rx.pio)

target_sources(${lib_name} INTERFACE
    ${dir}/pio_usb.c
    ${dir}/pio_usb_device.c
    ${dir}/pio_usb_host.c
    ${dir}/usb_crc.c
)

target_link_libraries(${lib_name} INTERFACE
    pico_stdlib
    pico_multicore
    hardware_pio
    hardware_dma
)

target_include_directories(${lib_name} INTERFACE ${dir})

# enable all warnings
target_compile_options(${lib_name} INTERFACE -Wall -Wextra)


================================================
FILE: Pico-PIO-USB/src/pio_usb.c
================================================
/**
 * Copyright (c) 2021 sekigon-gonnoc
 */

#pragma GCC push_options
#pragma GCC optimize("-O3")

#include <stdio.h>
#include <stdint.h>
#include <string.h> // memcpy

#include "hardware/clocks.h"
#include "hardware/dma.h"
#include "hardware/pio.h"
#include "hardware/sync.h"
#include "pico/bootrom.h"
#include "pico/stdlib.h"

#include "pio_usb.h"
#include "usb_definitions.h"
#include "pio_usb_ll.h"
#include "usb_crc.h"
#include "usb_tx.pio.h"
#include "usb_rx.pio.h"

#define UNUSED_PARAMETER(x) (void)x

usb_device_t pio_usb_device[PIO_USB_DEVICE_CNT];
pio_port_t pio_port[1];
root_port_t pio_usb_root_port[PIO_USB_ROOT_PORT_CNT];
endpoint_t pio_usb_ep_pool[PIO_USB_EP_POOL_CNT];

//--------------------------------------------------------------------+
// Bus functions
//--------------------------------------------------------------------+

static void __no_inline_not_in_flash_func(send_pre)(const pio_port_t *pp) {
  uint8_t data[] = {USB_SYNC, USB_PID_PRE};

  // send PRE token in full-speed
  pio_sm_set_enabled(pp->pio_usb_tx, pp->sm_tx, false);
  for (uint i = 0; i < USB_TX_EOP_DISABLER_LEN; ++i) {
    uint16_t instr = pp->fs_tx_pre_program->instructions[i + USB_TX_EOP_OFFSET];
    pp->pio_usb_tx->instr_mem[pp->offset_tx + i + USB_TX_EOP_OFFSET] = instr;
  }

  SM_SET_CLKDIV(pp->pio_usb_tx, pp->sm_tx, pp->clk_div_fs_tx);

  dma_channel_transfer_from_buffer_now(pp->tx_ch, data, 2);

  pio_sm_set_enabled(pp->pio_usb_tx, pp->sm_tx, true);
  pp->pio_usb_tx->irq |= IRQ_TX_ALL_MASK;       // clear complete flag
  pp->pio_usb_tx->irq_force |= IRQ_TX_EOP_MASK; // disable eop

  while ((pp->pio_usb_tx->irq & IRQ_TX_COMP_MASK) == 0) {
    continue;
  }

  // change bus speed to low-speed
  pio_sm_set_enabled(pp->pio_usb_tx, pp->sm_tx, false);
  for (uint i = 0; i < USB_TX_EOP_DISABLER_LEN; ++i) {
    uint16_t instr = pp->fs_tx_program->instructions[i + USB_TX_EOP_OFFSET];
    pp->pio_usb_tx->instr_mem[pp->offset_tx + i + USB_TX_EOP_OFFSET] = instr;
  }
  SM_SET_CLKDIV(pp->pio_usb_tx, pp->sm_tx, pp->clk_div_ls_tx);

  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_rx, false);
  SM_SET_CLKDIV_MAXSPEED(pp->pio_usb_rx, pp->sm_rx);

  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_eop, false);
  SM_SET_CLKDIV(pp->pio_usb_rx, pp->sm_eop, pp->clk_div_ls_rx);
  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_eop, true);
}

void __not_in_flash_func(pio_usb_bus_usb_transfer)(const pio_port_t *pp,
                                              uint8_t *data, uint16_t len) {
  if (pp->need_pre) {
    send_pre(pp);
  }

  dma_channel_transfer_from_buffer_now(pp->tx_ch, data, len);

  pio_sm_set_enabled(pp->pio_usb_tx, pp->sm_tx, true);
  pp->pio_usb_tx->irq |= IRQ_TX_ALL_MASK; // clear complete flag

  while ((pp->pio_usb_tx->irq & IRQ_TX_ALL_MASK) == 0) {
    continue;
  }
}

void __no_inline_not_in_flash_func(pio_usb_bus_send_handshake)(
    const pio_port_t *pp, uint8_t pid) {
  uint8_t data[] = {USB_SYNC, pid};
  pio_usb_bus_usb_transfer(pp, data, sizeof(data));
}

void __no_inline_not_in_flash_func(pio_usb_bus_send_token)(const pio_port_t *pp,
                                                           uint8_t token,
                                                           uint8_t addr,
                                                           uint8_t ep_num) {

  uint8_t packet[4] = {USB_SYNC, token, 0, 0};
  uint16_t dat = ((uint16_t)(ep_num & 0xf) << 7) | (addr & 0x7f);
  uint8_t crc = calc_usb_crc5(dat);
  packet[2] = dat & 0xff;
  packet[3] = (crc << 3) | ((dat >> 8) & 0x1f);

  pio_usb_bus_usb_transfer(pp, packet, sizeof(packet));
}

void __no_inline_not_in_flash_func(pio_usb_bus_prepare_receive)(const pio_port_t *pp) {
  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_rx, false);
  pio_sm_clear_fifos(pp->pio_usb_rx, pp->sm_rx);
  pio_sm_restart(pp->pio_usb_rx, pp->sm_rx);
  pio_sm_exec(pp->pio_usb_rx, pp->sm_rx, pp->rx_reset_instr);
  pio_sm_exec(pp->pio_usb_rx, pp->sm_rx, pp->rx_reset_instr2);
}

void __no_inline_not_in_flash_func(pio_usb_bus_start_receive)(const pio_port_t *pp) {
  pp->pio_usb_rx->ctrl |= (1 << pp->sm_rx);
  pp->pio_usb_rx->irq = IRQ_RX_ALL_MASK;
}

uint8_t __no_inline_not_in_flash_func(pio_usb_bus_wait_handshake)(pio_port_t* pp) {
  int16_t t = 240;
  int16_t idx = 0;

  while (t--) {
    if (pio_sm_get_rx_fifo_level(pp->pio_usb_rx, pp->sm_rx)) {
      uint8_t data = pio_sm_get(pp->pio_usb_rx, pp->sm_rx) >> 24;
      pp->usb_rx_buffer[idx++] = data;
      if (idx == 2) {
        break;
      }
    }
  }

  if (t > 0) {
    while ((pp->pio_usb_rx->irq & IRQ_RX_COMP_MASK) == 0) {
      continue;
    }
  }

  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_rx, false);

  return pp->usb_rx_buffer[1];
}

int __no_inline_not_in_flash_func(pio_usb_bus_receive_packet_and_handshake)(
    pio_port_t *pp, uint8_t handshake) {
  uint16_t crc = 0xffff;
  uint16_t crc_prev = 0xffff;
  uint16_t crc_prev2 = 0xffff;
  uint16_t crc_receive = 0xffff;
  uint16_t crc_receive_inverse;
  bool crc_match = false;
  int16_t t = 240;
  uint16_t idx = 0;

  while (t--) {
    if (pio_sm_get_rx_fifo_level(pp->pio_usb_rx, pp->sm_rx)) {
      uint8_t data = pio_sm_get(pp->pio_usb_rx, pp->sm_rx) >> 24;
      pp->usb_rx_buffer[idx++] = data;
      if (idx == 2) {
        break;
      }
    }
  }

  // timing critical start
  if (t > 0) {
    if (handshake == USB_PID_ACK) {
      while ((pp->pio_usb_rx->irq & IRQ_RX_COMP_MASK) == 0) {
        if (pio_sm_get_rx_fifo_level(pp->pio_usb_rx, pp->sm_rx)) {
          uint8_t data = pio_sm_get(pp->pio_usb_rx, pp->sm_rx) >> 24;
          crc_prev2 = crc_prev;
          crc_prev = crc;
          crc = update_usb_crc16(crc, data);
          pp->usb_rx_buffer[idx++] = data;
          crc_receive = (crc_receive >> 8) | (data << 8);
          crc_receive_inverse = crc_receive ^ 0xffff;
          crc_match = (crc_receive_inverse == crc_prev2);
        }
      }

      if (idx >= 4 && crc_match) {
        pio_usb_bus_send_handshake(pp, USB_PID_ACK);
        // timing critical end
        return idx - 4;
      }
    } else {
      // just discard received data since we NAK/STALL anyway
      while ((pp->pio_usb_rx->irq & IRQ_RX_COMP_MASK) == 0) {
        continue;
      }
      pio_sm_clear_fifos(pp->pio_usb_rx, pp->sm_rx);

      pio_usb_bus_send_handshake(pp, handshake);
    }
  }

  return -1;
}

static __always_inline void add_pio_host_rx_program(PIO pio,
                                             const pio_program_t *program,
                                             const pio_program_t *debug_program,
                                             uint *offset, int debug_pin) {
  if (debug_pin < 0) {
    *offset = pio_add_program(pio, program);
  } else {
    *offset = pio_add_program(pio, debug_program);
  }
}

static void __no_inline_not_in_flash_func(initialize_host_programs)(
    pio_port_t *pp, const pio_usb_configuration_t *c, root_port_t *port) {
  pp->offset_tx = pio_add_program(pp->pio_usb_tx, pp->fs_tx_program);
  usb_tx_fs_program_init(pp->pio_usb_tx, pp->sm_tx, pp->offset_tx,
                         port->pin_dp, port->pin_dm);

  add_pio_host_rx_program(pp->pio_usb_rx, &usb_nrzi_decoder_program,
                          &usb_nrzi_decoder_debug_program, &pp->offset_rx,
                          c->debug_pin_rx);
  usb_rx_fs_program_init(pp->pio_usb_rx, pp->sm_rx, pp->offset_rx, port->pin_dp,
                         port->pin_dm, c->debug_pin_rx);
  pp->rx_reset_instr = pio_encode_jmp(pp->offset_rx);
  pp->rx_reset_instr2 = pio_encode_set(pio_x, 0);

  add_pio_host_rx_program(pp->pio_usb_rx, &usb_edge_detector_program,
                          &usb_edge_detector_debug_program, &pp->offset_eop,
                          c->debug_pin_eop);
  eop_detect_fs_program_init(pp->pio_usb_rx, c->sm_eop, pp->offset_eop,
                             port->pin_dp, port->pin_dm, true,
                             c->debug_pin_eop);

  usb_tx_configure_pins(pp->pio_usb_tx, pp->sm_tx, port->pin_dp, port->pin_dm);

  pio_sm_set_jmp_pin(pp->pio_usb_rx, pp->sm_rx, port->pin_dp);
  pio_sm_set_jmp_pin(pp->pio_usb_rx, pp->sm_eop, port->pin_dm);
  pio_sm_set_in_pins(pp->pio_usb_rx, pp->sm_eop, port->pin_dp);
}

static void configure_tx_channel(uint8_t ch, PIO pio, uint sm) {
  dma_channel_config conf = dma_channel_get_default_config(ch);

  channel_config_set_read_increment(&conf, true);
  channel_config_set_write_increment(&conf, false);
  channel_config_set_transfer_data_size(&conf, DMA_SIZE_8);
  channel_config_set_dreq(&conf, pio_get_dreq(pio, sm, true));

  dma_channel_set_config(ch, &conf, false);
  dma_channel_set_write_addr(ch, &pio->txf[sm], false);
}

static void apply_config(pio_port_t *pp, const pio_usb_configuration_t *c,
                         root_port_t *port) {
  pp->pio_usb_tx = c->pio_tx_num == 0 ? pio0 : pio1;
  pp->sm_tx = c->sm_tx;
  pp->tx_ch = c->tx_ch;
  pp->pio_usb_rx = c->pio_rx_num == 0 ? pio0 : pio1;
  pp->sm_rx = c->sm_rx;
  pp->sm_eop = c->sm_eop;
  port->pin_dp = c->pin_dp;

  if (c->pinout == PIO_USB_PINOUT_DPDM) {
    port->pin_dm = c->pin_dp + 1;
    pp->fs_tx_program = &usb_tx_dpdm_program;
    pp->fs_tx_pre_program = &usb_tx_pre_dpdm_program;
    pp->ls_tx_program = &usb_tx_dmdp_program;
  } else {
    port->pin_dm = c->pin_dp - 1;
    pp->fs_tx_program = &usb_tx_dmdp_program;
    pp->fs_tx_pre_program = &usb_tx_pre_dmdp_program;
    pp->ls_tx_program = &usb_tx_dpdm_program;
  }

  pp->debug_pin_rx = c->debug_pin_rx;
  pp->debug_pin_eop = c->debug_pin_eop;

  pio_sm_claim(pp->pio_usb_tx, pp->sm_tx);
  pio_sm_claim(pp->pio_usb_rx, pp->sm_rx);
  pio_sm_claim(pp->pio_usb_rx, pp->sm_eop);
}

static void port_pin_drive_setting(const root_port_t *port) {
  gpio_set_slew_rate(port->pin_dp, GPIO_SLEW_RATE_FAST);
  gpio_set_slew_rate(port->pin_dm, GPIO_SLEW_RATE_FAST);
  gpio_set_drive_strength(port->pin_dp, GPIO_DRIVE_STRENGTH_12MA);
  gpio_set_drive_strength(port->pin_dm, GPIO_DRIVE_STRENGTH_12MA);
}

void pio_usb_bus_init(pio_port_t *pp, const pio_usb_configuration_t *c,
                      root_port_t *root) {
  memset(root, 0, sizeof(root_port_t));

  pp->pio_usb_tx = c->pio_tx_num == 0 ? pio0 : pio1;
  dma_claim_mask(1<<c->tx_ch);
  configure_tx_channel(c->tx_ch, pp->pio_usb_tx, c->sm_tx);

  apply_config(pp, c, root);
  initialize_host_programs(pp, c, root);
  port_pin_drive_setting(root);
  root->initialized = true;
  root->dev_addr = 0;
}

//--------------------------------------------------------------------+
// Application API
//--------------------------------------------------------------------+

endpoint_t *pio_usb_get_endpoint(usb_device_t *device, uint8_t idx) {
  uint8_t ep_id = device->endpoint_id[idx];
  if (ep_id == 0) {
    return NULL;
  } else if (ep_id >= 1) {
    return &pio_usb_ep_pool[ep_id - 1];
  }
  return NULL;
}

int __no_inline_not_in_flash_func(pio_usb_get_in_data)(endpoint_t *ep,
                                                       uint8_t *buffer,
                                                       uint8_t len) {
  if (ep->has_transfer || ep->is_tx) {
    return -1;
  }

  if (ep->new_data_flag) {
    len = len < ep->actual_len ? len : ep->actual_len;
    memcpy(buffer, (void *)ep->buffer, len);

    ep->new_data_flag = false;

    return pio_usb_ll_transfer_start(ep, ep->buffer, ep->size) ? len : -1;
  }

  return -1;
}

int __no_inline_not_in_flash_func(pio_usb_set_out_data)(endpoint_t *ep,
                                                        const uint8_t *buffer,
                                                        uint8_t len) {
  if (ep->has_transfer || !ep->is_tx) {
    return -1;
  }

  return pio_usb_ll_transfer_start(ep, (uint8_t *)buffer, len) ? 0 : -1;
}

//--------------------------------------------------------------------+
// Low Level Function
//--------------------------------------------------------------------+

void __no_inline_not_in_flash_func(pio_usb_ll_configure_endpoint)(
    endpoint_t *ep, uint8_t const *desc_endpoint) {
  const endpoint_descriptor_t *d = (const endpoint_descriptor_t *)desc_endpoint;
  ep->size = d->max_size[0] | (d->max_size[1] << 8);
  ep->ep_num = d->epaddr;
  ep->attr = d->attr;
  ep->interval = d->interval;
  ep->interval_counter = 0;
  ep->data_id = 0;
}

static inline __force_inline void prepare_tx_data(endpoint_t *ep) {
  uint16_t const xact_len = pio_usb_ll_get_transaction_len(ep);
  ep->buffer[0] = USB_SYNC;
  ep->buffer[1] = (ep->data_id == 1)
                      ? USB_PID_DATA1
                      : USB_PID_DATA0; // USB_PID_SETUP also DATA0
  memcpy(ep->buffer + 2, ep->app_buf, xact_len);

  uint16_t const crc16 = calc_usb_crc16(ep->app_buf, xact_len);
  ep->buffer[2 + xact_len] = crc16 & 0xff;
  ep->buffer[2 + xact_len + 1] = crc16 >> 8;
}

bool __no_inline_not_in_flash_func(pio_usb_ll_transfer_start)(endpoint_t *ep,
                                                              uint8_t *buffer,
                                                              uint16_t buflen) {
  if (ep->has_transfer) {
    return false;
  }

  ep->app_buf = buffer;
  ep->total_len = buflen;
  ep->actual_len = 0;

  if (ep->is_tx) {
    prepare_tx_data(ep);
  } else {
    ep->new_data_flag = false;
  }

  ep->transfer_started = false;
  ep->transfer_aborted = false;
  ep->has_transfer = true;

  return true;
}

bool __no_inline_not_in_flash_func(pio_usb_ll_transfer_continue)(
    endpoint_t *ep, uint16_t xferred_bytes) {
  ep->app_buf += xferred_bytes;
  ep->actual_len += xferred_bytes;
  ep->data_id ^= 1;

  if ((xferred_bytes < ep->size) || (ep->actual_len >= ep->total_len)) {
    // complete if all bytes transferred or short packet
    pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_COMPLETE_BITS);
    return false;
  } else {
    if (ep->is_tx) {
      prepare_tx_data(ep);
    }

    return true;
  }
}

void __no_inline_not_in_flash_func(pio_usb_ll_transfer_complete)(
    endpoint_t *ep, uint32_t flag) {
  root_port_t *rport = PIO_USB_ROOT_PORT(ep->root_idx);
  uint32_t const ep_mask = (1u << (ep - pio_usb_ep_pool));

  rport->ints |= flag;

  if (flag == PIO_USB_INTS_ENDPOINT_COMPLETE_BITS) {
    rport->ep_complete |= ep_mask;
    if (!ep->is_tx) {
      ep->new_data_flag = true;
    }
  } else if (flag == PIO_USB_INTS_ENDPOINT_ERROR_BITS) {
    rport->ep_error |= ep_mask;
  } else if (flag == PIO_USB_INTS_ENDPOINT_STALLED_BITS) {
    rport->ep_stalled |= ep_mask;
  } else {
    // something wrong
  }

  ep->has_transfer = false;
}

int pio_usb_host_add_port(uint8_t pin_dp, PIO_USB_PINOUT pinout) {
  for (int idx = 0; idx < PIO_USB_ROOT_PORT_CNT; idx++) {
    root_port_t *root = PIO_USB_ROOT_PORT(idx);
    if (!root->initialized) {
      root->pin_dp = pin_dp;

      if (pinout == PIO_USB_PINOUT_DPDM) {
        root->pin_dm = pin_dp + 1;
      } else {
        root->pin_dm = pin_dp - 1;
      }

      gpio_pull_down(pin_dp);
      gpio_pull_down(root->pin_dm);
      pio_gpio_init(pio_port[0].pio_usb_tx, pin_dp);
      pio_gpio_init(pio_port[0].pio_usb_tx, root->pin_dm);
      gpio_set_inover(pin_dp, GPIO_OVERRIDE_INVERT);
      gpio_set_inover(root->pin_dm, GPIO_OVERRIDE_INVERT);
      pio_sm_set_pindirs_with_mask(pio_port[0].pio_usb_tx, pio_port[0].sm_tx, 0,
                                   (1 << pin_dp) | (1 << root->pin_dm));
      port_pin_drive_setting(root);
      root->initialized = true;

      return 0;
    }
  }

  return -1;
}

#pragma GCC pop_options


================================================
FILE: Pico-PIO-USB/src/pio_usb.h
================================================

#pragma once

#include "pio_usb_configuration.h"
#include "usb_definitions.h"

#ifdef __cplusplus
 extern "C" {
#endif

// Host functions
usb_device_t *pio_usb_host_init(const pio_usb_configuration_t *c);
int pio_usb_host_add_port(uint8_t pin_dp, PIO_USB_PINOUT pinout);
void pio_usb_host_task(void);
void pio_usb_host_stop(void);
void pio_usb_host_restart(void);
uint32_t pio_usb_host_get_frame_number(void);

// Call this every 1ms when skip_alarm_pool is true.
void pio_usb_host_frame(void);

// Device functions
usb_device_t *pio_usb_device_init(const pio_usb_configuration_t *c,
                                  const usb_descriptor_buffers_t *buffers);
void pio_usb_device_task(void);

// Common functions
endpoint_t *pio_usb_get_endpoint(usb_device_t *device, uint8_t idx);
int pio_usb_get_in_data(endpoint_t *ep, uint8_t *buffer, uint8_t len);
int pio_usb_set_out_data(endpoint_t *ep, const uint8_t *buffer, uint8_t len);

// Misc functions
int pio_usb_kbd_set_leds(usb_device_t *device, uint8_t port, uint8_t value); 

extern int dh_debug_printf(const char *format, ...);

#ifdef __cplusplus
 }
#endif


================================================
FILE: Pico-PIO-USB/src/pio_usb_configuration.h
================================================

#pragma once

typedef enum {
  PIO_USB_PINOUT_DPDM = 0,  // DM = DP+1
  PIO_USB_PINOUT_DMDP,      // DM = DP-1
} PIO_USB_PINOUT;

typedef struct {
    uint8_t pin_dp;
    uint8_t pio_tx_num;
    uint8_t sm_tx;
    uint8_t tx_ch;
    uint8_t pio_rx_num;
    uint8_t sm_rx;
    uint8_t sm_eop;
    void* alarm_pool;
    int8_t debug_pin_rx;
    int8_t debug_pin_eop;
    bool skip_alarm_pool;
    PIO_USB_PINOUT pinout;
} pio_usb_configuration_t;

#ifndef PIO_USB_DP_PIN_DEFAULT
#define PIO_USB_DP_PIN_DEFAULT 0
#endif

#define PIO_USB_TX_DEFAULT 0
#define PIO_SM_USB_TX_DEFAULT 0
#define PIO_USB_DMA_TX_DEFAULT 0

#define PIO_USB_RX_DEFAULT 1
#define PIO_SM_USB_RX_DEFAULT 0
#define PIO_SM_USB_EOP_DEFAULT 1

#define PIO_USB_DEBUG_PIN_NONE (-1)

#define PIO_USB_DEFAULT_CONFIG                                             \
  {                                                                        \
    PIO_USB_DP_PIN_DEFAULT, PIO_USB_TX_DEFAULT, PIO_SM_USB_TX_DEFAULT,     \
        PIO_USB_DMA_TX_DEFAULT, PIO_USB_RX_DEFAULT, PIO_SM_USB_RX_DEFAULT, \
        PIO_SM_USB_EOP_DEFAULT, NULL, PIO_USB_DEBUG_PIN_NONE,              \
        PIO_USB_DEBUG_PIN_NONE, false, PIO_USB_PINOUT_DPDM                 \
  }

#define PIO_USB_EP_POOL_CNT 32
#define PIO_USB_DEV_EP_CNT 16
#define PIO_USB_DEVICE_CNT 1
#define PIO_USB_HUB_PORT_CNT 8
#define PIO_USB_ROOT_PORT_CNT 2

#define PIO_USB_EP_SIZE 64


================================================
FILE: Pico-PIO-USB/src/pio_usb_device.c
================================================
/**
 * Copyright (c) 2021 sekigon-gonnoc
 *                    Ha Thach (thach@tinyusb.org)
 */

#pragma GCC push_options
#pragma GCC optimize("-O3")

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>

#include "pio_usb.h"
#include "pio_usb_ll.h"
#include "usb_crc.h"

#include "usb_rx.pio.h"
#include "usb_tx.pio.h"

#include "hardware/dma.h"
#include "hardware/irq.h"

static uint8_t new_devaddr = 0;
static uint8_t ep0_crc5_lut[16];
static __unused usb_descriptor_buffers_t descriptor_buffers;

static void __no_inline_not_in_flash_func(update_ep0_crc5_lut)(uint8_t addr) {
  uint16_t dat;
  uint8_t crc;

  for (int epnum = 0; epnum < 16; epnum++) {
    dat = (addr) | (epnum << 7);
    crc = calc_usb_crc5(dat);
    ep0_crc5_lut[epnum] = (crc << 3) | ((epnum >> 1) & 0x07);
  }
}

static __always_inline void restart_usb_reveiver(pio_port_t *pp) {
  pio_sm_exec(pp->pio_usb_rx, pp->sm_rx, pp->rx_reset_instr);
  pio_sm_exec(pp->pio_usb_rx, pp->sm_rx, pp->rx_reset_instr2);
  pio_sm_restart(pp->pio_usb_rx, pp->sm_rx);
  pp->pio_usb_rx->irq = IRQ_RX_ALL_MASK;
}

static __always_inline int8_t device_receive_token(uint8_t *buffer,
                                                   uint8_t dev_addr) {
  pio_port_t *pp = PIO_USB_PIO_PORT(0);
  uint8_t idx = 0;
  uint8_t addr;
  uint8_t ep;
  bool match = false;

  static uint8_t eplut[2][8] = {{0, 2, 4, 6, 8, 10, 12, 14},
                                {1, 3, 5, 7, 9, 11, 13, 15}};
  uint8_t *current_lut;

  if ((pp->pio_usb_rx->irq & IRQ_RX_COMP_MASK) == 0) {
    while ((pp->pio_usb_rx->irq & IRQ_RX_COMP_MASK) == 0) {
      if (pio_sm_get_rx_fifo_level(pp->pio_usb_rx, pp->sm_rx)) {
        buffer[idx++] = pio_sm_get(pp->pio_usb_rx, pp->sm_rx) >> 24;
        if ((idx == 3) && (buffer[1] != USB_PID_SOF)) {
          addr = buffer[2] & 0x7f;
          current_lut = &eplut[buffer[2] >> 7][0];
          match = dev_addr == addr ? true : false;
        }
      }
    }
  } else {
    // host is probably timeout. Ignore this packets.
    pio_sm_clear_fifos(pp->pio_usb_rx, pp->sm_rx);
  }

  restart_usb_reveiver(pp);

  if (match) {
    ep = current_lut[buffer[3] & 0x07];
    if (ep0_crc5_lut[ep] == buffer[3]) {
      return ep;
    } else {
      return -1;
    }
  }

  return -1;
}

static void __no_inline_not_in_flash_func(usb_device_packet_handler)(void) {
  static uint8_t token_buf[64];
  pio_port_t *pp = PIO_USB_PIO_PORT(0);
  root_port_t *rport = PIO_USB_ROOT_PORT(0);

  //
  // time critical start
  //
  int8_t ep_num = device_receive_token(token_buf, rport->dev_addr);

  if (token_buf[1] == USB_PID_IN) {
    if (ep_num < 0) {
      return;
    }
    static uint8_t hand_shake_token[2] = {USB_SYNC, USB_PID_STALL};

    endpoint_t *ep = PIO_USB_ENDPOINT((ep_num << 1) | 0x01);
    uint16_t const xact_len = pio_usb_ll_get_transaction_len(ep);

    pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_rx, false);
    volatile bool has_transfer = ep->has_transfer;

    if (has_transfer) {
      dma_channel_transfer_from_buffer_now(pp->tx_ch, ep->buffer, xact_len + 4);
    } else if (ep->stalled) {
      hand_shake_token[1] = USB_PID_STALL;
      dma_channel_transfer_from_buffer_now(pp->tx_ch, hand_shake_token, 2);
    } else {
      hand_shake_token[1] = USB_PID_NAK;
      dma_channel_transfer_from_buffer_now(pp->tx_ch, hand_shake_token, 2);
    }

    pp->pio_usb_tx->irq = IRQ_TX_ALL_MASK; // clear complete flag
    while ((pp->pio_usb_tx->irq & IRQ_TX_ALL_MASK) == 0) {
      continue;
    }

    if (has_transfer) {
      pp->pio_usb_rx->irq = IRQ_RX_ALL_MASK;
      irq_clear(pp->device_rx_irq_num);
      pio_usb_bus_start_receive(pp);

      // wait for ack
      pio_usb_bus_wait_handshake(pp);

      pio_usb_bus_start_receive(pp);
      irq_clear(pp->device_rx_irq_num);

      //
      // time critical end
      //

      if (ep->ep_num == 0x80 && new_devaddr > 0) {
        rport->dev_addr = new_devaddr;
        new_devaddr = 0;
        update_ep0_crc5_lut(rport->dev_addr);
      }

      pio_usb_ll_transfer_continue(ep, xact_len);
    } else {
      pp->pio_usb_rx->irq = IRQ_RX_ALL_MASK;
      irq_clear(pp->device_rx_irq_num);
      pio_usb_bus_start_receive(pp);

      //
      // time critical end
      //
    }
  } else if (token_buf[1] == USB_PID_OUT) {
    if (ep_num < 0) {
      return;
    }
    endpoint_t *ep = PIO_USB_ENDPOINT(ep_num << 1);

    uint8_t hanshake = ep->stalled
                           ? USB_PID_STALL
                           : (ep->has_transfer ? USB_PID_ACK : USB_PID_NAK);
    int res = pio_usb_bus_receive_packet_and_handshake(pp, hanshake);
    pio_sm_clear_fifos(pp->pio_usb_rx, pp->sm_rx);
    restart_usb_reveiver(pp);
    irq_clear(pp->device_rx_irq_num);

    if (ep->has_transfer) {
      if (res >= 0) {
        memcpy(ep->app_buf, pp->usb_rx_buffer + 2, res);
        pio_usb_ll_transfer_continue(ep, res);
      }
    }
  } else if (token_buf[1] == USB_PID_SETUP) {
    if (ep_num < 0) {
      return;
    }
    int res = pio_usb_bus_receive_packet_and_handshake(pp, USB_PID_ACK);
    pio_sm_clear_fifos(pp->pio_usb_rx, pp->sm_rx);
    restart_usb_reveiver(pp);
    irq_clear(pp->device_rx_irq_num);

    if (res >= 0) {
      rport->setup_packet = pp->usb_rx_buffer + 2;
      rport->ints |= PIO_USB_INTS_SETUP_REQ_BITS;

      // DATA1 for both data and status stage
      PIO_USB_ENDPOINT(0)->has_transfer = PIO_USB_ENDPOINT(1)->has_transfer = false;
      PIO_USB_ENDPOINT(0)->data_id = PIO_USB_ENDPOINT(1)->data_id = 1;
      PIO_USB_ENDPOINT(0)->stalled = PIO_USB_ENDPOINT(1)->stalled = false;
    }
  } else if (token_buf[1] == USB_PID_SOF) {
    // SOF interrupt
  }


  token_buf[0] = 0; // clear received token
  token_buf[1] = 0;

  if (rport->ints) {
    pio_usb_device_irq_handler(0);
  }
}

usb_device_t *pio_usb_device_init(const pio_usb_configuration_t *c,
                                  const usb_descriptor_buffers_t *buffers) {
  pio_port_t *pp = PIO_USB_PIO_PORT(0);
  root_port_t *rport = PIO_USB_ROOT_PORT(0);
  usb_device_t *dev = &pio_usb_device[0];

  pio_usb_bus_init(pp, c, rport);
  rport->mode = PIO_USB_MODE_DEVICE;

  memset(dev, 0, sizeof(*dev));
  for (int i = 0; i < PIO_USB_DEV_EP_CNT; i++) {
    dev->endpoint_id[i] = 2 * (i + 1); // only index IN endpoint
  }

  update_ep0_crc5_lut(rport->dev_addr);

  float const cpu_freq = (float)clock_get_hz(clk_sys);

  pio_calculate_clkdiv_from_float(cpu_freq / 48000000,
                                  &pp->clk_div_fs_tx.div_int,
                                  &pp->clk_div_fs_tx.div_frac);
  pio_calculate_clkdiv_from_float(cpu_freq / 96000000,
                                  &pp->clk_div_fs_rx.div_int,
                                  &pp->clk_div_fs_rx.div_frac);

  pio_sm_set_jmp_pin(pp->pio_usb_rx, pp->sm_rx, rport->pin_dp);
  SM_SET_CLKDIV_MAXSPEED(pp->pio_usb_rx, pp->sm_rx);

  pio_sm_set_jmp_pin(pp->pio_usb_rx, pp->sm_eop, rport->pin_dm);
  pio_sm_set_in_pins(pp->pio_usb_rx, pp->sm_eop, rport->pin_dp);
  SM_SET_CLKDIV(pp->pio_usb_rx, pp->sm_eop, pp->clk_div_fs_rx);

  descriptor_buffers = *buffers;

  pio_sm_set_enabled(pp->pio_usb_tx, pp->sm_tx, true);
  pio_usb_bus_prepare_receive(pp);
  pp->pio_usb_rx->ctrl |= (1 << pp->sm_rx);
  pp->pio_usb_rx->irq |= IRQ_RX_ALL_MASK;

  // configure PIOx_IRQ_0 to detect packet receive start
  pio_set_irqn_source_enabled(pp->pio_usb_rx, 0, pis_interrupt0 + IRQ_RX_START,
                              true);
  pp->device_rx_irq_num = (pp->pio_usb_rx == pio0) ? PIO0_IRQ_0 : PIO1_IRQ_0;
  irq_set_exclusive_handler(pp->device_rx_irq_num, usb_device_packet_handler);
  irq_set_enabled(pp->device_rx_irq_num, true);

  return dev;
}

//--------------------------------------------------------------------+
// Device Controller functions
//--------------------------------------------------------------------+

void pio_usb_device_set_address(uint8_t dev_addr) {
  new_devaddr = dev_addr;
}

bool __no_inline_not_in_flash_func(pio_usb_device_endpoint_open)(
    uint8_t const *desc_endpoint) {
  const endpoint_descriptor_t *d = (const endpoint_descriptor_t *)desc_endpoint;
  endpoint_t *ep = pio_usb_device_get_endpoint_by_address(d->epaddr);

  pio_usb_ll_configure_endpoint(ep, desc_endpoint);
  ep->root_idx = 0;
  ep->dev_addr = 0; // not used
  ep->need_pre = 0;
  ep->is_tx = (d->epaddr & 0x80) ? true : false; // device: endpoint in is tx

  return true;
}

bool pio_usb_device_transfer(uint8_t ep_address, uint8_t *buffer,
                             uint16_t buflen) {
  endpoint_t *ep = pio_usb_device_get_endpoint_by_address(ep_address);
  return pio_usb_ll_transfer_start(ep, buffer, buflen);
}

//--------------------------------------------------------------------+
// USB Device Stack
//--------------------------------------------------------------------+
static int8_t ep0_desc_request_type = -1;
static uint16_t ep0_desc_request_len;
static uint8_t ep0_desc_request_idx;

static void __no_inline_not_in_flash_func(prepare_ep0_data)(uint8_t *data,
                                                            uint8_t len) {
  // 0: control out (rx), 1 : control in (tx)
  endpoint_t *ep = &pio_usb_ep_pool[1];

  pio_usb_ll_transfer_start(ep, data, len);

  if (len) {
    // there is data, prepare for status as well
    pio_usb_ll_transfer_start(&pio_usb_ep_pool[0], NULL, 0);
  }
}

static void __no_inline_not_in_flash_func(prepare_ep0_rx)(uint8_t *data,
                                                          uint8_t len) {
  // 0: control out (rx), 1 : control in (tx)
  endpoint_t *ep = &pio_usb_ep_pool[0];

  pio_usb_ll_transfer_start(ep, data, len);

  if (len) {
    // there is data, prepare for status as well
    pio_usb_ll_transfer_start(&pio_usb_ep_pool[1], NULL, 0);
  }
}

void pio_usb_device_task(void) {
  switch (ep0_desc_request_type) {
    case DESC_TYPE_CONFIG: {
      uint16_t req_len = ep0_desc_request_len;
      uint16_t desc_len =
          descriptor_buffers.config[2] | (descriptor_buffers.config[3] << 8);
      req_len = req_len > desc_len ? desc_len : req_len;
      prepare_ep0_data((uint8_t *)descriptor_buffers.config, req_len);
      ep0_desc_request_type = -1;
    } break;
    case DESC_TYPE_STRING: {
      const uint16_t *str =
          (uint16_t *)&descriptor_buffers.string[ep0_desc_request_idx];
      prepare_ep0_data((uint8_t *)str, str[0] & 0xff);
      ep0_desc_request_type = -1;
    } break;
    case DESC_TYPE_HID_REPORT:{
      prepare_ep0_data(
          (uint8_t *)descriptor_buffers.hid_report[ep0_desc_request_idx],
          ep0_desc_request_len);
      ep0_desc_request_type = -1;
    }
    default:
      break;
  }

  root_port_t *rport = PIO_USB_ROOT_PORT(0);
  uint32_t se0_time_us =0;
  while (pio_usb_bus_get_line_state(rport) == PORT_PIN_SE0) {
    busy_wait_us_32(1);
    se0_time_us++;

    if (se0_time_us == 1000) {
      memset(pio_usb_ep_pool, 0, sizeof(pio_usb_ep_pool));
      rport->dev_addr = 0;
      update_ep0_crc5_lut(rport->dev_addr);

      // init endpoint control in/out
      PIO_USB_ENDPOINT(0)->size = 64;
      PIO_USB_ENDPOINT(0)->ep_num = 0;
      PIO_USB_ENDPOINT(0)->is_tx = false;

      PIO_USB_ENDPOINT(1)->size = 64;
      PIO_USB_ENDPOINT(1)->ep_num = 0x80;
      PIO_USB_ENDPOINT(1)->is_tx = true;

      // TODO should be reset end, this is reset start only
      rport->ep_complete = rport->ep_stalled = rport->ep_error = 0;
      rport->ints |= PIO_USB_INTS_RESET_END_BITS;

      pio_port_t *pp = PIO_USB_PIO_PORT(0);
      restart_usb_reveiver(pp);
    }
  }
}

static void __no_inline_not_in_flash_func(configure_all_endpoints)(uint8_t const *desc) {
  uint8_t const *desc_end = desc + (descriptor_buffers.config[2] |
                                    (descriptor_buffers.config[3] << 8));
  while (desc < desc_end) {
    if (desc[1] == DESC_TYPE_ENDPOINT) {
      pio_usb_device_endpoint_open(desc);
    }
    desc += desc[0];
  }
}

static int __no_inline_not_in_flash_func(process_device_setup_stage)(uint8_t *buffer) {
  int res = -1;
  const usb_setup_packet_t *packet = (usb_setup_packet_t *)buffer;

  if (packet->request_type == USB_REQ_DIR_IN) {
    if (packet->request == 0x06) {
      if (packet->value_msb == DESC_TYPE_DEVICE) {
        prepare_ep0_data((uint8_t *)descriptor_buffers.device, 18);
        res = 0;
      } else if (packet->value_msb == DESC_TYPE_CONFIG) {
        ep0_desc_request_len = (packet->length_lsb | (packet->length_msb << 8));
        ep0_desc_request_type = DESC_TYPE_CONFIG;
        res = 0;
      } else if (packet->value_msb == DESC_TYPE_STRING) {
        if (descriptor_buffers.string != NULL) {
          ep0_desc_request_idx = packet->value_lsb;
          ep0_desc_request_type = DESC_TYPE_STRING;
          res = 0;
        }
      }
    }
  } else if (packet->request_type == USB_REQ_DIR_OUT) {
    if (packet->request == 0x05) {
      // set address
      new_devaddr = packet->value_lsb;
      prepare_ep0_data(NULL, 0);
      res = 0;
    } else if (packet->request == 0x09) {
      // set configuration
      configure_all_endpoints(descriptor_buffers.config);
      prepare_ep0_data(NULL, 0);
      res = 0;
    }
  } else if (packet->request_type == (USB_REQ_DIR_IN | USB_REQ_REC_IFACE)) {
    if (packet->request == 0x06 && packet->value_msb == DESC_TYPE_HID_REPORT) {
      // get hid report desc
      ep0_desc_request_len = (packet->length_lsb | (packet->length_msb << 8));
      ep0_desc_request_idx = packet->index_lsb;
      ep0_desc_request_type = DESC_TYPE_HID_REPORT;
      res = 0;
    }
  } else if (packet->request_type == (USB_REQ_TYP_CLASS | USB_REQ_REC_IFACE)) {
    if (packet->request == 0x09) {
      // set hid report
      static __unused uint8_t received_hid_report[8]; // not used
      prepare_ep0_rx(received_hid_report, 8);
      res = 0;
    } else if (packet->request == 0x0A) {
      // set hid idle request
      prepare_ep0_data(NULL, 0);
      res = 0;
    } else if (packet->request == 0x0B) {
      // set hid protocol request
      prepare_ep0_data(NULL, 0);
      res = 0;
    }
  } else if (packet->request_type == (USB_REQ_REC_EP)) {
      prepare_ep0_data(NULL, 0);
      res = 0;
  }

  return res;
}

// IRQ Handler
static void __no_inline_not_in_flash_func(__pio_usb_device_irq_handler)(uint8_t root_idx) {
  root_port_t *root = PIO_USB_ROOT_PORT(root_idx);
  usb_device_t *dev = &pio_usb_device[0];

  uint32_t const ints = root->ints;

  if (ints & PIO_USB_INTS_RESET_END_BITS) {
    memset(dev, 0, sizeof(*dev));
    for (int i = 0; i < PIO_USB_DEV_EP_CNT; i++) {
      dev->endpoint_id[i] = 2 * (i + 1); // only index IN endpoint
    }
  }

  if (ints & PIO_USB_INTS_SETUP_REQ_BITS) {
    process_device_setup_stage(root->setup_packet);
    dev->control_pipe.stage = STAGE_DATA;
  }

  if (ints & PIO_USB_INTS_ENDPOINT_COMPLETE_BITS) {
    const uint32_t ep_all = root->ep_complete;

    // control out
    if (ep_all & 0x01) {
      if (dev->control_pipe.stage == STAGE_STATUS) {
        dev->control_pipe.stage = STAGE_COMPLETE;
      } else if (dev->control_pipe.stage == STAGE_DATA) {
        dev->control_pipe.stage = STAGE_STATUS;
        prepare_ep0_data(NULL, 0);
      }
    }

    // control in
    if (ep_all & 0x02) {
      if (dev->control_pipe.stage == STAGE_STATUS) {
        dev->control_pipe.stage = STAGE_COMPLETE;
      }
    }

    // clear all
    root->ep_complete &= ~ep_all;
  }

  // clear all
  root->ints &= ~ints;
}

// weak alias to __pio_usb_device_irq_handler
void pio_usb_device_irq_handler(uint8_t root_id) __attribute__ ((weak, alias("__pio_usb_device_irq_handler")));

#pragma GCC pop_options


================================================
FILE: Pico-PIO-USB/src/pio_usb_host.c
================================================
/**
 * Copyright (c) 2021 sekigon-gonnoc
 *                    Ha Thach (thach@tinyusb.org)
 */

#pragma GCC push_options
#pragma GCC optimize("-O3")

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>

#include "hardware/sync.h"

#include "pio_usb.h"
#include "pio_usb_ll.h"
#include "usb_crc.h"
#include "usb_rx.pio.h"
#include "usb_tx.pio.h"

static alarm_pool_t *_alarm_pool = NULL;
static repeating_timer_t sof_rt;
// The sof_count may be incremented and then read on different cores.
static volatile uint32_t sof_count = 0;
static bool timer_active;

static volatile bool cancel_timer_flag;
static volatile bool start_timer_flag;
static __unused uint32_t int_stat;

static bool sof_timer(repeating_timer_t *_rt);

//--------------------------------------------------------------------+
// Application API
//--------------------------------------------------------------------+

static void start_timer(alarm_pool_t *alarm_pool) {
  if (timer_active) {
    return;
  }

  if (alarm_pool != NULL) {
    alarm_pool_add_repeating_timer_us(alarm_pool, -1000, sof_timer, NULL,
                                      &sof_rt);
  }

  timer_active = true;
}

static __unused void stop_timer(void) {
  cancel_repeating_timer(&sof_rt);
  timer_active = false;
}

usb_device_t *pio_usb_host_init(const pio_usb_configuration_t *c) {
  pio_port_t *pp = PIO_USB_PIO_PORT(0);
  root_port_t *root = PIO_USB_ROOT_PORT(0);

  pio_usb_bus_init(pp, c, root);
  root->mode = PIO_USB_MODE_HOST;

  float const cpu_freq = (float)clock_get_hz(clk_sys);
  pio_calculate_clkdiv_from_float(cpu_freq / 48000000,
                                  &pp->clk_div_fs_tx.div_int,
                                  &pp->clk_div_fs_tx.div_frac);
  pio_calculate_clkdiv_from_float(cpu_freq / 6000000,
                                  &pp->clk_div_ls_tx.div_int,
                                  &pp->clk_div_ls_tx.div_frac);

  pio_calculate_clkdiv_from_float(cpu_freq / 96000000,
                                  &pp->clk_div_fs_rx.div_int,
                                  &pp->clk_div_fs_rx.div_frac);
  pio_calculate_clkdiv_from_float(cpu_freq / 12000000,
                                  &pp->clk_div_ls_rx.div_int,
                                  &pp->clk_div_ls_rx.div_frac);

  if (!c->skip_alarm_pool) {
    _alarm_pool = c->alarm_pool;
    if (!_alarm_pool) {
      _alarm_pool = alarm_pool_create(2, 1);
    }
  }
  start_timer(_alarm_pool);

  return &pio_usb_device[0];
}

void pio_usb_host_stop(void) {
  cancel_timer_flag = true;
  while (cancel_timer_flag) {
    continue;
  }
}

void pio_usb_host_restart(void) {
  start_timer_flag = true;
  while (start_timer_flag) {
    continue;
  }
}

//--------------------------------------------------------------------+
// Bus functions
//--------------------------------------------------------------------+

static void __no_inline_not_in_flash_func(override_pio_program)(PIO pio, const pio_program_t* program, uint offset) {
    for (uint i = 0; i < program->length; ++i) {
      uint16_t instr = program->instructions[i];
      pio->instr_mem[offset + i] =
          pio_instr_bits_jmp != _pio_major_instr_bits(instr) ? instr
                                                             : instr + offset;
    }
}

static __always_inline void override_pio_rx_program(PIO pio,
                                             const pio_program_t *program,
                                             const pio_program_t *debug_program,
                                             uint offset, int debug_pin) {
  if (debug_pin < 0) {
    override_pio_program(pio, program, offset);
  } else {
    override_pio_program(pio, debug_program, offset);
  }
}

static void __no_inline_not_in_flash_func(configure_fullspeed_host)(
    pio_port_t const *pp, root_port_t *port) {
  override_pio_program(pp->pio_usb_tx, pp->fs_tx_program, pp->offset_tx);
  SM_SET_CLKDIV(pp->pio_usb_tx, pp->sm_tx, pp->clk_div_fs_tx);

  pio_sm_set_jmp_pin(pp->pio_usb_rx, pp->sm_rx, port->pin_dp);
  SM_SET_CLKDIV_MAXSPEED(pp->pio_usb_rx, pp->sm_rx);

  pio_sm_set_jmp_pin(pp->pio_usb_rx, pp->sm_eop, port->pin_dm);
  pio_sm_set_in_pins(pp->pio_usb_rx, pp->sm_eop, port->pin_dp);
  SM_SET_CLKDIV(pp->pio_usb_rx, pp->sm_eop, pp->clk_div_fs_rx);

  usb_tx_configure_pins(pp->pio_usb_tx, pp->sm_tx, port->pin_dp, port->pin_dm);
}

static void __no_inline_not_in_flash_func(configure_lowspeed_host)(
    pio_port_t const *pp, root_port_t *port) {
  override_pio_program(pp->pio_usb_tx, pp->ls_tx_program, pp->offset_tx);
  SM_SET_CLKDIV(pp->pio_usb_tx, pp->sm_tx, pp->clk_div_ls_tx);

  pio_sm_set_jmp_pin(pp->pio_usb_rx, pp->sm_rx, port->pin_dm);
  SM_SET_CLKDIV_MAXSPEED(pp->pio_usb_rx, pp->sm_rx);

  pio_sm_set_jmp_pin(pp->pio_usb_rx, pp->sm_eop, port->pin_dp);
  pio_sm_set_in_pins(pp->pio_usb_rx, pp->sm_eop, port->pin_dm);
  SM_SET_CLKDIV(pp->pio_usb_rx, pp->sm_eop, pp->clk_div_ls_rx);

  usb_tx_configure_pins(pp->pio_usb_tx, pp->sm_tx, port->pin_dp, port->pin_dm);
}

static void __no_inline_not_in_flash_func(configure_root_port)(
    pio_port_t *pp, root_port_t *root) {
  if (root->is_fullspeed) {
    configure_fullspeed_host(pp, root);
  } else {
    configure_lowspeed_host(pp, root);
  }
}

static void __no_inline_not_in_flash_func(restore_fs_bus)(const pio_port_t *pp) {
  // change bus speed to full-speed
  pio_sm_set_enabled(pp->pio_usb_tx, pp->sm_tx, false);
  SM_SET_CLKDIV(pp->pio_usb_tx, pp->sm_tx, pp->clk_div_fs_tx);

  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_rx, false);
  SM_SET_CLKDIV_MAXSPEED(pp->pio_usb_rx, pp->sm_rx);
  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_rx, true);

  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_eop, false);
  SM_SET_CLKDIV(pp->pio_usb_rx, pp->sm_eop, pp->clk_div_fs_rx);
  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_eop, true);
}

// Time about 1us ourselves so it lives in RAM.
static void __not_in_flash_func(busy_wait_1_us)(void) {
  uint32_t start = timer_hw->timerawl;
  while (timer_hw->timerawl == start) {
      tight_loop_contents();
  }
}

static bool __no_inline_not_in_flash_func(connection_check)(root_port_t *port) {
  if (pio_usb_bus_get_line_state(port) == PORT_PIN_SE0) {
    busy_wait_1_us();

    if (pio_usb_bus_get_line_state(port) == PORT_PIN_SE0) {
      busy_wait_1_us();
      // device disconnect
      port->connected = false;
      port->suspended = true;
      port->ints |= PIO_USB_INTS_DISCONNECT_BITS;

      // failed/retired all queuing transfer in this root
      uint8_t root_idx = port - PIO_USB_ROOT_PORT(0);
      for (int ep_idx = 0; ep_idx < PIO_USB_EP_POOL_CNT; ep_idx++) {
        endpoint_t *ep = PIO_USB_ENDPOINT(ep_idx);
        if ((ep->root_idx == root_idx) && ep->size && ep->has_transfer) {
          pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_ERROR_BITS);
        }
      }

      return false;
    }
  }

  return true;
}

//--------------------------------------------------------------------+
// SOF
//--------------------------------------------------------------------+
static int usb_setup_transaction(pio_port_t *pp, endpoint_t *ep);
static int usb_in_transaction(pio_port_t *pp, endpoint_t *ep);
static int usb_out_transaction(pio_port_t *pp, endpoint_t *ep);

void __not_in_flash_func(pio_usb_host_frame)(void) {
  if (!timer_active) {
    return;
  }
  static uint8_t sof_packet[4] = {USB_SYNC, USB_PID_SOF, 0x00, 0x10};

  pio_port_t *pp = PIO_USB_PIO_PORT(0);

  // Send SOF
  for (int root_idx = 0; root_idx < PIO_USB_ROOT_PORT_CNT; root_idx++) {
    root_port_t *root = PIO_USB_ROOT_PORT(root_idx);
    if (!(root->initialized && root->connected && !root->suspended &&
          connection_check(root))) {
      continue;
    }
    configure_root_port(pp, root);
    pio_usb_bus_usb_transfer(pp, sof_packet, 4);
  }

  // Carry out all queued endpoint transaction
  for (int root_idx = 0; root_idx < PIO_USB_ROOT_PORT_CNT; root_idx++) {
    root_port_t *root = PIO_USB_ROOT_PORT(root_idx);
    if (!(root->initialized && root->connected && !root->suspended)) {
      continue;
    }

    configure_root_port(pp, root);

    for (int ep_pool_idx = 0; ep_pool_idx < PIO_USB_EP_POOL_CNT;
         ep_pool_idx++) {
      endpoint_t *ep = PIO_USB_ENDPOINT(ep_pool_idx);
      if ((ep->root_idx == root_idx) && ep->size) {
        bool const is_periodic = ((ep->attr & 0x03) == EP_ATTR_INTERRUPT);

        if (is_periodic && (ep->interval_counter > 0)) {
          ep->interval_counter--;
          continue;
        }

        if (ep->has_transfer && !ep->transfer_aborted) {
          ep->transfer_started = true;

          if (ep->need_pre) {
            pp->need_pre = true;
          }

          if (ep->ep_num == 0 && ep->data_id == USB_PID_SETUP) {
            usb_setup_transaction(pp, ep);
          } else {
            if (ep->ep_num & EP_IN) {
              usb_in_transaction(pp, ep);
            } else {
              usb_out_transaction(pp, ep);
            }

            if (is_periodic) {
              ep->interval_counter = ep->interval - 1;
            }
          }

          if (ep->need_pre) {
            pp->need_pre = false;
            restore_fs_bus(pp);
          }

          ep->transfer_started = false;
        }
      }
    }
  }

  // check for new connection to root hub
  for (int root_idx = 0; root_idx < PIO_USB_ROOT_PORT_CNT; root_idx++) {
    root_port_t *root = PIO_USB_ROOT_PORT(root_idx);
    if (root->initialized && !root->connected) {
      port_pin_status_t const line_state = pio_usb_bus_get_line_state(root);
      if (line_state == PORT_PIN_FS_IDLE || line_state == PORT_PIN_LS_IDLE) {
        root->is_fullspeed = (line_state == PORT_PIN_FS_IDLE);
        root->connected = true;
        root->suspended = true; // need a bus reset before operating
        root->ints |= PIO_USB_INTS_CONNECT_BITS;
      }
    }
  }

  // Invoke IRQHandler if interrupt status is set
  for (uint8_t root_idx = 0; root_idx < PIO_USB_ROOT_PORT_CNT; root_idx++) {
    if (PIO_USB_ROOT_PORT(root_idx)->ints) {
      pio_usb_host_irq_handler(root_idx);
    }
  }

  sof_count++;

  // SOF counter is 11-bit
  uint16_t const sof_count_11b = sof_count & 0x7ff;
  sof_packet[2] = sof_count_11b & 0xff;
  sof_packet[3] = (calc_usb_crc5(sof_count_11b) << 3) | (sof_count_11b >> 8);
}

static bool __no_inline_not_in_flash_func(sof_timer)(repeating_timer_t *_rt) {
  (void)_rt;

  pio_usb_host_frame();

  return true;
}

//--------------------------------------------------------------------+
// Host Controller functions
//--------------------------------------------------------------------+

uint32_t pio_usb_host_get_frame_number(void) {
  return sof_count;
}

void pio_usb_host_port_reset_start(uint8_t root_idx) {
  root_port_t *root = PIO_USB_ROOT_PORT(root_idx);
  pio_port_t *pp = PIO_USB_PIO_PORT(0);

  // bus is not operating while in reset
  root->suspended = true;

  // Force line state to SE0
  pio_sm_set_pins_with_mask(pp->pio_usb_tx, pp->sm_tx, 0,
                            (1 << root->pin_dp) | (1 << root->pin_dm));
  pio_sm_set_pindirs_with_mask(pp->pio_usb_tx, pp->sm_tx,
                               (1 << root->pin_dp) | (1 << root->pin_dm),
                               (1 << root->pin_dp) | (1 << root->pin_dm));
}

void pio_usb_host_port_reset_end(uint8_t root_idx) {
  root_port_t *root = PIO_USB_ROOT_PORT(root_idx);
  pio_port_t *pp = PIO_USB_PIO_PORT(0);

  // line state to input
  pio_sm_set_pindirs_with_mask(pp->pio_usb_tx, pp->sm_tx, 0,
                               (1 << root->pin_dp) | (1 << root->pin_dm));

  busy_wait_us(100); // TODO check if this is neccessary

  // bus back to operating
  root->suspended = false;
}

void pio_usb_host_close_device(uint8_t root_idx, uint8_t device_address) {
  for (int ep_pool_idx = 0; ep_pool_idx < PIO_USB_EP_POOL_CNT; ep_pool_idx++) {
    endpoint_t *ep = PIO_USB_ENDPOINT(ep_pool_idx);
    if ((ep->root_idx == root_idx) && (ep->dev_addr == device_address) &&
        ep->size) {
      ep->size = 0;
      ep->has_transfer = false;
    }
  }
}

static inline __force_inline endpoint_t * _find_ep(uint8_t root_idx, 
                                                   uint8_t device_address, uint8_t ep_address) {
  for (int ep_pool_idx = 0; ep_pool_idx < PIO_USB_EP_POOL_CNT; ep_pool_idx++) {
    endpoint_t *ep = PIO_USB_ENDPOINT(ep_pool_idx);
    // note 0x00 and 0x80 are matched as control endpoint of opposite direction
    if ((ep->root_idx == root_idx) && (ep->dev_addr == device_address) &&
        ep->size &&
        ((ep->ep_num == ep_address) ||
         (((ep_address & 0x7f) == 0) && ((ep->ep_num & 0x7f) == 0)))) {
      return ep;
    }
  }

  return NULL;
}

bool pio_usb_host_endpoint_open(uint8_t root_idx, uint8_t device_address,
                                uint8_t const *desc_endpoint, bool need_pre) {
  const endpoint_descriptor_t *d = (const endpoint_descriptor_t *)desc_endpoint;
  for (int ep_pool_idx = 0; ep_pool_idx < PIO_USB_EP_POOL_CNT; ep_pool_idx++) {
    endpoint_t *ep = PIO_USB_ENDPOINT(ep_pool_idx);
    // ep size is used as valid indicator
    if (ep->size == 0) {
      pio_usb_ll_configure_endpoint(ep, desc_endpoint);
      ep->root_idx = root_idx;
      ep->dev_addr = device_address;
      ep->need_pre = need_pre;
      ep->is_tx = (d->epaddr & 0x80) ? false : true; // host endpoint out is tx
      return true;
    }
  }

  return false;
}

bool pio_usb_host_send_setup(uint8_t root_idx, uint8_t device_address,
                             uint8_t const setup_packet[8]) {
  endpoint_t *ep = _find_ep(root_idx, device_address, 0);
  if (!ep) {
    dh_debug_printf("cannot find ep 0x00\r\n");
    return false;
  }

  ep->ep_num = 0; // setup is is OUT
  ep->data_id = USB_PID_SETUP;
  ep->is_tx = true;

  return pio_usb_ll_transfer_start(ep, (uint8_t *)setup_packet, 8);
}

bool pio_usb_host_endpoint_transfer(uint8_t root_idx, uint8_t device_address,
                                    uint8_t ep_address, uint8_t *buffer,
                                    uint16_t buflen) {
  endpoint_t *ep = _find_ep(root_idx, device_address, ep_address);
  if (!ep) {
    dh_debug_printf("no endpoint 0x%02X\r\n", ep_address);
    return false;
  }

  // Control endpoint, address may switch between 0x00 <-> 0x80
  // therefore we need to update ep_num and is_tx
  if ((ep_address & 0x7f) == 0) {
    ep->ep_num = ep_address;
    ep->is_tx = ep_address == 0;
    ep->data_id = 1; // data and status always start with DATA1
  }

  return pio_usb_ll_transfer_start(ep, buffer, buflen);
}

bool pio_usb_host_endpoint_abort_transfer(uint8_t root_idx, uint8_t device_address,
                                          uint8_t ep_address) {
  endpoint_t *ep = _find_ep(root_idx, device_address, ep_address);
  if (!ep) {
    dh_debug_printf("no endpoint 0x%02X\r\n", ep_address);
    return false;
  }

  if (!ep->has_transfer) {
    return false; // no transfer to abort
  }

  // mark transfer as aborted
  ep->transfer_aborted = true;

  // Race potential: SOF timer can be called before transfer_aborted is actually set
  // and started the transfer. Wait 1 usb frame for transaction to complete.
  // On the next SOF timer, transfer_aborted will be checked and skipped
  while (ep->has_transfer && ep->transfer_started) {
    busy_wait_ms(1);
  }

  // check if transfer is still active (could be completed)
  bool const still_active = ep->has_transfer;
  if (still_active) {
    ep->has_transfer = false;
  }
  ep->transfer_aborted = false;

  return still_active; // still active means transfer is successfully aborted
}

//--------------------------------------------------------------------+
// Transaction helper
//--------------------------------------------------------------------+

static int __no_inline_not_in_flash_func(usb_in_transaction)(pio_port_t *pp,
                                                             endpoint_t *ep) {
  int res = 0;
  uint8_t expect_pid = (ep->data_id == 1) ? USB_PID_DATA1 : USB_PID_DATA0;

  pio_usb_bus_prepare_receive(pp);
  pio_usb_bus_send_token(pp, USB_PID_IN, ep->dev_addr, ep->ep_num);
  pio_usb_bus_start_receive(pp);

  int receive_len = pio_usb_bus_receive_packet_and_handshake(pp, USB_PID_ACK);
  uint8_t const receive_pid = pp->usb_rx_buffer[1];

  if (receive_len >= 0) {
    if (receive_pid == expect_pid) {
      memcpy(ep->app_buf, &pp->usb_rx_buffer[2], receive_len);
      pio_usb_ll_transfer_continue(ep, receive_len);
    } else {
      // DATA0/1 mismatched, 0 for re-try next frame
    }
  } else if (receive_pid == USB_PID_NAK) {
    // NAK try again next frame
  } else if (receive_pid == USB_PID_STALL) {
    pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_STALLED_BITS);
  } else {
    res = -1;
    if ((pp->pio_usb_rx->irq & IRQ_RX_COMP_MASK) == 0) {
      res = -2;
    }
    pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_ERROR_BITS);
  }

  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_rx, false);
  pp->usb_rx_buffer[0] = 0;
  pp->usb_rx_buffer[1] = 0;

  return res;
}

static int __no_inline_not_in_flash_func(usb_out_transaction)(pio_port_t *pp,
                                                              endpoint_t *ep) {
  int res = 0;

  uint16_t const xact_len = pio_usb_ll_get_transaction_len(ep);

  pio_usb_bus_prepare_receive(pp);
  pio_usb_bus_send_token(pp, USB_PID_OUT, ep->dev_addr, ep->ep_num);
  // ensure previous tx complete
  while ((pp->pio_usb_tx->irq & IRQ_TX_COMP_MASK) == 0) {
    continue;
  }

  pio_usb_bus_usb_transfer(pp, ep->buffer, xact_len + 4);
  pio_usb_bus_start_receive(pp);

  pio_usb_bus_wait_handshake(pp);

  uint8_t const receive_token = pp->usb_rx_buffer[1];

  if (receive_token == USB_PID_ACK) {
    pio_usb_ll_transfer_continue(ep, xact_len);
  } else if (receive_token == USB_PID_NAK) {
    // NAK try again next frame
  } else if (receive_token == USB_PID_STALL) {
    pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_STALLED_BITS);
  } else {
    pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_ERROR_BITS);
  }

  pio_sm_set_enabled(pp->pio_usb_rx, pp->sm_rx, false);
  pp->usb_rx_buffer[0] = 0;
  pp->usb_rx_buffer[1] = 0;

  return res;
}

static int __no_inline_not_in_flash_func(usb_setup_transaction)(
    pio_port_t *pp,  endpoint_t *ep) {

  int res = 0;

  // Setup token
  pio_usb_bus_prepare_receive(pp);

  pio_usb_bus_send_token(pp, USB_PID_SETUP, ep->dev_addr, 0);
  // ensure previous tx complete
  while ((pp->pio_usb_tx->irq & IRQ_TX_COMP_MASK) == 0) {
    continue;
  }

  // Data
  ep->data_id = 0; // set to DATA0
  pio_usb_bus_usb_transfer(pp, ep->buffer, 12);

  // Handshake
  pio_usb_bus_start_receive(pp);
  pio_usb_bus_wait_handshake(pp);

  ep->actual_len = 8;

  if (pp->usb_rx_buffer[0] == USB_SYNC && pp->usb_rx_buffer[1] == USB_PID_ACK) {
    pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_COMPLETE_BITS);
  } else {
    res = -1;
    pio_usb_ll_transfer_complete(ep, PIO_USB_INTS_ENDPOINT_ERROR_BITS);
  }

  pp->usb_rx_buffer[1] = 0; // reset buffer

  return res;
}

//--------------------------------------------------------------------+
// USB Host Stack
//--------------------------------------------------------------------+
static void on_device_connect(pio_port_t *pp, root_port_t *root,
                              int device_idx) {
  bool fullspeed_flag = false;

  if (pio_usb_bus_get_line_state(root) == PORT_PIN_FS_IDLE) {
    fullspeed_flag = true;
  } else if (pio_usb_bus_get_line_state(root) == PORT_PIN_LS_IDLE) {
    fullspeed_flag = false;
  }

  pio_sm_set_pins_with_mask(pp->pio_usb_tx, pp->sm_tx, 0,
                            (1 << root->pin_dp) | (1 << root->pin_dm));
  pio_sm_set_pindirs_with_mask(pp->pio_usb_tx, pp->sm_tx,
                               (1 << root->pin_dp) | (1 << root->pin_dm),
                               (1 << root->pin_dp) | (1 << root->pin_dm));

  busy_wait_ms(100);

  pio_sm_set_pindirs_with_mask(pp->pio_usb_tx, pp->sm_tx, 0,
                               (1 << root->pin_dp) | (1 << root->pin_dm));

  busy_wait_us(100);

  root->suspended = false;

  if (fullspeed_flag && pio_usb_bus_get_line_state(root) == PORT_PIN_FS_IDLE) {
    root->root_device = &pio_usb_device[device_idx];
    if (!root->root_device->connected) {
      configure_fullspeed_host(pp, root);
      root->root_device->is_fullspeed = true;
      root->root_device->is_root = true;
      root->root_device->connected = true;
      root->root_device->root = root;
      root->root_device->event = EVENT_CONNECT;
    }
  } else if (!fullspeed_flag && pio_usb_bus_get_line_state(root) == PORT_PIN_LS_IDLE) {
    root->root_device = &pio_usb_device[device_idx];
    if (!root->root_device->connected) {
      configure_lowspeed_host(pp, root);
      root->root_device->is_fullspeed = false;
      root->root_device->is_root = true;
      root->root_device->connected = true;
      root->root_device->root = root;
      root->root_device->event = EVENT_CONNECT;
    }
  }

  endpoint_descriptor_t ep0_desc = {
    sizeof(endpoint_descriptor_t), DESC_TYPE_ENDPOINT, 0x00, 0x00, { 0x08, 0x00 }, 0x00
  };
  pio_usb_host_endpoint_open(root - pio_usb_root_port, 0x00,
                             (uint8_t const *)&ep0_desc, false);
}

static int __no_inline_not_in_flash_func(control_out_protocol)(
    usb_device_t *device, uint8_t *setup_data, uint16_t setup_length,
    uint8_t *out_data, uint16_t out_length) {
  int res = 0;

  control_pipe_t *pipe = &device->control_pipe;

  if (pipe->operation == CONTROL_NONE) {
    pipe->setup_packet.tx_address = setup_data;
    pipe->setup_packet.tx_length = setup_length;
    pipe->out_data_packet.tx_address = out_data;
    pipe->out_data_packet.tx_length = out_length;
    pipe->operation = CONTROL_OUT;

    pio_usb_host_send_setup(device->root - pio_usb_root_port, device->address, setup_data);
  } else {
    return -1;
  }

  const uint64_t timeout = 5000 * 1000; // 5s
  uint64_t start_time = time_us_64();
  while (pipe->operation == CONTROL_OUT &&
         time_us_64() - start_time < timeout) {
    if (!device->connected) {
      pipe->operation = CONTROL_NONE;
      return -1;
    }
  }

  if (time_us_64() - start_time >= timeout) {
    dh_debug_printf("control out[timeout]\n");
    res = -2;
  } else if (pipe->operation == CONTROL_ERROR) {
    dh_debug_printf("control out[error]\n");
    res = -1;
  } else if (pipe->operation == CONTROL_COMPLETE) {
    dh_debug_printf("control out[complete]\n");
    res = 0;
  }
  pipe->operation = CONTROL_NONE;

  return res;
}

static int __no_inline_not_in_flash_func(control_in_protocol)(
    usb_device_t *device, uint8_t *tx_data, uint16_t tx_length,
    uint8_t *rx_buffer, uint16_t request_length) {
  int res = 0;

  control_pipe_t *pipe = &device->control_pipe;

  if (pipe->operation == CONTROL_NONE) {
    pipe->setup_packet.tx_address = tx_data;
    pipe->setup_packet.tx_length = tx_length;
    pipe->rx_buffer = rx_buffer;
    pipe->request_length = request_length;
    pipe->operation = CONTROL_IN;

    pio_usb_host_send_setup(device->root - pio_usb_root_port, device->address, tx_data);
  } else {
    return -1;
  }

  const uint64_t timeout = 5000 * 1000; // 5s
  uint64_t start_time = time_us_64();
  while (pipe->operation == CONTROL_IN &&
         time_us_64() - start_time < timeout) {
    if (!device->connected) {
      pipe->operation = CONTROL_NONE;
      return -1;
    }
  }

  if (time_us_64() - start_time >= timeout) {
    dh_debug_printf("control in[timeout]\n");
    res = -2;
  } else if (pipe->operation == CONTROL_ERROR) {
    dh_debug_printf("control in[error]\n");
    res = -1;
  } else if (pipe->operation == CONTROL_COMPLETE) {
    dh_debug_printf("control in[complete]\n");
    res = 0;
  }
  pipe->operation = CONTROL_NONE;

  return res;
}

static int set_hub_feature(usb_device_t *device, uint8_t port, uint8_t value) {
  usb_setup_packet_t req = SET_HUB_FEATURE_REQUEST;
  req.index_lsb = port + 1;
  req.value_lsb = value;
  return control_out_protocol(device, (uint8_t *)&req, sizeof(req), NULL, 0);
}

static int clear_hub_feature(usb_device_t *device, uint8_t port,
                             uint8_t value) {
  usb_setup_packet_t req = CLEAR_HUB_FEATURE_REQUEST;
  req.index_lsb = port + 1;
  req.value_lsb = value;
  return control_out_protocol(device, (uint8_t *)&req, sizeof(req), NULL, 0);
}

static int get_hub_port_status(usb_device_t *device, uint8_t port,
                               hub_port_status_t *status) {
  usb_setup_packet_t req = GET_HUB_PORT_STATUS_REQUEST;
  req.index_lsb = port + 1;
  return control_in_protocol(device, (uint8_t *)&req, sizeof(req), (uint8_t*)status,
                             sizeof(*status));
}

static int initialize_hub(usb_device_t *device) {
  uint8_t rx_buffer[16];
  int res = 0;
  dh_debug_printf("USB Hub detected\n");
  usb_setup_packet_t get_hub_desc_request = GET_HUB_DESCRPTOR_REQUEST;
  control_in_protocol(device, (uint8_t *)&get_hub_desc_request,
                      sizeof(get_hub_desc_request), rx_buffer, 8);
  const hub_descriptor_t *desc = (hub_descriptor_t *)rx_buffer;
  uint8_t port_num = desc->port_num;

  dh_debug_printf("\tTurn on port powers\n");
  for (int idx = 0; idx < port_num; idx++) {
    res = set_hub_feature(device, idx, HUB_SET_PORT_POWER);
    if (res != 0) {
      dh_debug_printf("\tFailed to turn on ports\n");
      break;
    }
  }

  busy_wait_ms(500);

  return res;
}

static int get_string_descriptor(usb_device_t *device, uint8_t idx,
                                 uint8_t *rx_buffer, uint8_t *str_buffer) {
  int res = -1;
  usb_setup_packet_t req = GET_DEVICE_DESCRIPTOR_REQ_DEFAULT;
  req.value_msb = DESC_TYPE_STRING;
  req.value_lsb = idx;
  req.length_lsb = 1;
  req.length_msb = 0;
  res = control_in_protocol(device, (uint8_t *)&req, sizeof(req), rx_buffer, 1);
  if (res != 0) {
    return res;
  }

  uint8_t len = rx_buffer[0];
  req.length_lsb = len;
  req.length_msb = 0;
  res =
      control_in_protocol(device, (uint8_t *)&req, sizeof(req), rx_buffer, len);
  if (res != 0) {
    return res;
  }

  uint16_t *wchar_buffer = (uint16_t *)(uintptr_t) rx_buffer;
  for (int i = 0; i < (len - 2) / 2; i++) {
    str_buffer[i] = wchar_buffer[i + 1];
  }
  str_buffer[(len - 2) / 2] = '\0';

  return res;
}

static int enumerate_device(usb_device_t *device, uint8_t address) {
  int res = 0;
  uint8_t rx_buffer[512];

  usb_setup_packet_t get_device_descriptor_request =
      GET_DEVICE_DESCRIPTOR_REQ_DEFAULT;
  res = control_in_protocol(device, (uint8_t *)&get_device_descriptor_request,
                            sizeof(get_device_descriptor_request), rx_buffer, 18);
  if (res != 0) {
    pio_usb_host_close_device(device->root - pio_usb_root_port, 0);
    return res;
  }

  const device_descriptor_t *desc =
      (device_descriptor_t *)device->control_pipe.rx_buffer;
  device->vid = desc->vid[0] | (desc->vid[1] << 8);
  device->pid = desc->pid[0] | (desc->pid[1] << 8);
  device->device_class = desc->device_class;
  uint8_t idx_manufacture = desc->manufacture;
  uint8_t idx_product = desc->product;
  uint8_t idx_serial = desc->serial;

  dh_debug_printf("Enumerating %04x:%04x, class:%d, address:%d\n", device->vid,
         device->pid, device->device_class, address);

  usb_setup_packet_t set_address_request = SET_ADDRESS_REQ_DEFAULT;
  set_address_request.value_lsb = address;
  set_address_request.value_msb = 0;
  res = control_out_protocol(device, (uint8_t *)&set_address_request,
                             sizeof(set_address_request), NULL, 0);
  pio_usb_host_close_device(device->root - pio_usb_root_port, 0);
  if (res != 0) {
    return res;
  }
  device->address = address;

  endpoint_descriptor_t ep0_desc = {
    sizeof(endpoint_descriptor_t), DESC_TYPE_ENDPOINT, 0x00, 0x00, { desc->max_packet_size, 0x00 }, 0x00
  };
  pio_usb_host_endpoint_open(device->root - pio_usb_root_port, address,
                             (uint8_t const *)&ep0_desc,
                             !device->is_root && !device->is_fullspeed);

  uint8_t str[64];
  if (idx_manufacture != 0) {
    res = get_string_descriptor(device, idx_manufacture, rx_buffer, str);
    if (res == 0) {
      dh_debug_printf("Manufacture:%s\n", str);
    } else {
      dh_debug_printf("Failed to get string descriptor (Manufacture)\n");
    }
    stdio_flush();
  }

  if (idx_product != 0) {
    res = get_string_descriptor(device, idx_product, rx_buffer, str);
    if (res == 0) {
      dh_debug_printf("Product:%s\n", str);
    } else {
      dh_debug_printf("Failed to get string descriptor (Product)\n");
    }
    stdio_flush();
  }

  if (idx_serial != 0) {
    res = get_string_descriptor(device, idx_serial, rx_buffer, str);
    if (res == 0) {
      dh_debug_printf("Serial:%s\n", str);
    } else {
      dh_debug_printf("Failed to get string descriptor (Serial)\n");
    }
    stdio_flush();
  }

  usb_setup_packet_t get_configuration_descriptor_request =
      GET_CONFIGURATION_DESCRIPTOR_REQ_DEFAULT;
  get_configuration_descriptor_request.length_lsb = 9;
  get_configuration_descriptor_request.length_msb = 0;
  res = control_in_protocol(
      device, (uint8_t *)&get_configuration_descriptor_request,
      sizeof(get_configuration_descriptor_request), rx_buffer, 9);
  if (res != 0) {
    return res;
  }

  get_configuration_descriptor_request.length_lsb =
      ((configuration_descriptor_t *)(device->control_pipe.rx_buffer))
          ->total_length_lsb;
  get_configuration_descriptor_request.length_msb =
      ((configuration_descriptor_t *)(device->control_pipe.rx_buffer))
          ->total_length_msb;
  uint16_t request_length =
      get_configuration_descriptor_request.length_lsb |
      (get_configuration_descriptor_request.length_msb << 8);
  res = control_in_protocol(
      device, (uint8_t *)&get_configuration_descriptor_request,
      sizeof(get_configuration_descriptor_request), rx_buffer, request_length);

  if (res != 0) {
    return res;
  }
  uint8_t configuration_descrptor_data[512];
  int16_t configuration_descrptor_length =
      request_length > 512 ? 512 : request_length;
  memcpy(configuration_descrptor_data,
         (const void *)device->control_pipe.rx_buffer,
         configuration_descrptor_length);

  usb_setup_packet_t set_usb_configuration_request =
      SET_CONFIGURATION_REQ_DEFAULT;
  set_usb_configuration_request.value_lsb =
      ((configuration_descriptor_t *)(device->control_pipe.rx_buffer))
          ->configuration_value;
  res = control_out_protocol(device, (uint8_t *)&set_usb_configuration_request,
                             sizeof(set_usb_configuration_request), NULL, 0);

  if (res != 0) {
    return res;
  }
  volatile uint8_t ep_id_idx = 0;
  volatile uint8_t interface = 0;
  volatile uint8_t class = 0;
  uint8_t *descriptor = configuration_descrptor_data;
  while (configuration_descrptor_length > 0) {
    switch (descriptor[1]) {
      case DESC_TYPE_INTERFACE: {
        const interface_descriptor_t *d =
            (const interface_descriptor_t *)descriptor;
        dh_debug_printf(
            "inum:%d, altsetting:%d, numep:%d, iclass:%d, isubclass:%d, "
            "iprotcol:%d, iface:%d\n",
            d->inum, d->altsetting, d->numep, d->iclass, d->isubclass,
            d->iprotocol, d->iface);
        interface = d->inum;
        class = d->iclass;
      } break;
      case DESC_TYPE_ENDPOINT: {
        const endpoint_descriptor_t *d =
            (const endpoint_descriptor_t *)descriptor;
        dh_debug_printf("\t\t\tepaddr:0x%02x, attr:%d, size:%d, interval:%d\n",
               d->epaddr, d->attr, d->max_size[0] | (d->max_size[1] << 8),
               d->interval);

        if ((class == CLASS_HID || class == CLASS_HUB) &&
            d->attr == EP_ATTR_INTERRUPT) {
          volatile endpoint_t *ep = NULL;
          for (int ep_pool_idx = 0; ep_pool_idx < PIO_USB_EP_POOL_CNT;
               ep_pool_idx++) {
            if (pio_usb_ep_pool[ep_pool_idx].size == 0) {
              ep = &pio_usb_ep_pool[ep_pool_idx];
              device->endpoint_id[ep_id_idx] = ep_pool_idx + 1;
              ep_id_idx++;
              break;
            }
          }

          if (ep != NULL) {
            ep->interval = d->interval;
            ep->interval_counter = 0;
            ep->size = d->max_size[0] | (d->max_size[1] << 8);
            ep->attr = d->attr | EP_ATTR_ENUMERATING;
            ep->ep_num = d->epaddr;

            ep->root_idx = device->root - pio_usb_root_port;
            ep->dev_addr = device->address;
            ep->need_pre = !device->is_root && !device->is_fullspeed;
            ep->is_tx = (d->epaddr & 0x80) ? false : true;
          } else {
            dh_debug_printf("No empty EP\n");
          }
        }
      } break;
      case DESC_TYPE_HID: {
        const hid_descriptor_t *d = (const hid_descriptor_t *)descriptor;
        dh_debug_printf(
            "\tbcdHID:%x.%x, country:%d, desc num:%d, desc_type:%d, "
            "desc_size:%d\n",
            d->bcd_hid[1], d->bcd_hid[0], d->contry_code, d->num_desc,
            d->desc_type, d->desc_len[0] | (d->desc_len[1] << 8));

        usb_setup_packet_t set_hid_idle_request = SET_HID_IDLE_REQ_DEFAULT;
        set_hid_idle_request.value_lsb = interface;
        set_hid_idle_request.value_msb = 0;
        control_out_protocol(device, (uint8_t *)&set_hid_idle_request,
                             sizeof(set_hid_idle_request), NULL, 0);

        usb_setup_packet_t get_hid_report_descrpitor_request =
            GET_HID_REPORT_DESCRIPTOR_DEFAULT;
        get_hid_report_descrpitor_request.index_lsb = interface;
        get_hid_report_descrpitor_request.index_msb = 0;
        get_hid_report_descrpitor_request.length_lsb = d->desc_len[0];
        get_hid_report_descrpitor_request.length_msb = d->desc_len[1];
        uint16_t desc_len = d->desc_len[0] | (d->desc_len[1] << 8);
        control_in_protocol(
            device, (uint8_t *)&get_hid_report_descrpitor_request,
            sizeof(get_hid_report_descrpitor_request), rx_buffer, desc_len);
        dh_debug_printf("\t\tReport descriptor:");
        for (int i = 0; i < desc_len; i++) {
          dh_debug_printf("%02x ", device->control_pipe.rx_buffer[i]);
        }
        dh_debug_printf("\n");
        stdio_flush();

      } break;
      default:
        break;
    }

    configuration_descrptor_length -= descriptor[0];
    descriptor += descriptor[0];
  }

  for (int epidx = 0; epidx < PIO_USB_DEV_EP_CNT; epidx++) {
    endpoint_t *ep = pio_usb_get_endpoint(device, epidx);
    if (ep == NULL) {
      break;
    }
    ep->attr &= ~EP_ATTR_ENUMERATING;

    // prepare transfer
    if (ep->ep_num & EP_IN) {
      pio_usb_ll_transfer_start(ep, ep->buffer, ep->size);
    }
  }

  return res;
}

static void device_disconnect(usb_device_t *device) {
  dh_debug_printf("Disconnect device %d\n", device->address);
  for (int port = 0; port < PIO_USB_HUB_PORT_CNT; port++) {
    if (device->child_devices[port] != 0) {
      device_disconnect(&pio_usb_device[device->child_devices[port]]);
    }
  }

  for (int ep_idx = 0; ep_idx < PIO_USB_DEV_EP_CNT; ep_idx++) {
    endpoint_t *ep = pio_usb_get_endpoint(device, ep_idx);
    if (ep == NULL) {
      break;
    }
    memset(ep, 0, sizeof(*ep));
  }

  if (device->address == 0 && device->root != NULL) {
    device->root->addr0_exists = false;
  }

  memset(device, 0, sizeof(*device));
}

static int device_pool_vacant(void) {
  for (int idx = 0; idx < PIO_USB_DEVICE_CNT; idx++) {
    if (!pio_usb_device[idx].connected) {
      return idx;
    }
  }

  return -1;
}

static int assign_new_device_to_port(usb_device_t *hub_device, uint8_t port, bool is_ls) {
  int idx = device_pool_vacant();
  if (idx >= 0) {
    hub_device->child_devices[port] = idx;
    pio_usb_device[idx].parent_device = hub_device;
    pio_usb_device[idx].parent_port = port;
    pio_usb_device[idx].root = hub_device->root;
    pio_usb_device[idx].connected = true;
    pio_usb_device[idx].is_fullspeed = !is_ls;
    pio_usb_device[idx].event = EVENT_CONNECT;
    dh_debug_printf("Assign device %d to %d-%d\n", idx, hub_device->address, port);

    endpoint_descriptor_t ep0_desc = {
      sizeof(endpoint_descriptor_t), DESC_TYPE_ENDPOINT, 0x00, 0x00, { 0x08, 0x00 }, 0x00
    };
    pio_usb_host_endpoint_open(hub_device->root - pio_usb_root_port, 0x00,
                               (uint8_t const *)&ep0_desc, is_ls);

    return 0;
  }

  dh_debug_printf("Failed to assign device\n");

  return -1;
}

static void __no_inline_not_in_flash_func(process_hub_event)(
    usb_device_t *device) {
  volatile endpoint_t *ep = pio_usb_get_endpoint(device, 0);
  uint8_t bitmap = ep->buffer[0];
  for (int bit = 1; bit < 8; bit++) {
    if (!(bitmap & (1 << bit))) {
      continue;
    }
    uint8_t port = bit - 1;
    hub_port_status_t status;
    int res = get_hub_port_status(device, port, &status);
    if (res != 0) {
      dh_debug_printf("Failed to get port%d-%d status\n", device->address, port);
      continue;
    }
    dh_debug_printf("port%d-%d status:%d %d\n", device->address, port,
           status.port_change, status.port_status);

    if (status.port_change & HUB_CHANGE_PORT_CONNECTION) {
      if (status.port_status & HUB_STAT_PORT_CONNECTION) {
        dh_debug_printf("new device on port %d, reset port\n", port);
        if (device->child_devices[port] != 0) {
          dh_debug_printf("device is already assigned. disconnect previous\n");
          device_disconnect(&pio_usb_device[device->child_devices[port]]);
        }

        if (device->root->addr0_exists) {
          dh_debug_printf("Address 0 already exists\n");
          continue;
        }

        if (device_pool_vacant() >= 0) {
          set_hub_feature(device, port, HUB_SET_PORT_RESET);
          device->root->addr0_exists = true;
        } else {
          dh_debug_printf("No vacant in device pool\n");
        }
      } else {
        dh_debug_printf("device removed from port %d\n", port);
        if (device->child_devices[port] != 0) {
          device_disconnect(&pio_usb_device[device->child_devices[port]]);
        }
      }
      clear_hub_feature(device, port, HUB_CLR_PORT_CONNECTION);
    } else if (status.port_change & HUB_CHANGE_PORT_RESET) {
      dh_debug_printf("reset port %d complete\n", port);
      res = clear_hub_feature(device, port, HUB_CLR_PORT_RESET);
      if (res == 0) {
        assign_new_device_to_port(device, port,
                                  status.port_status & HUB_STAT_PORT_LOWSPEED);
      }
    } else if (status.port_change & HUB_CHANGE_PORT_ENABLE) {
      clear_hub_feature(device, port, HUB_CLR_PORT_ENABLE);
    }
  }

  device->event = EVENT_NONE;
}

void __no_inline_not_in_flash_func(pio_usb_host_task)(void) {
  for (int root_idx = 0; root_idx < PIO_USB_ROOT_PORT_CNT; root_idx++) {
    if (pio_usb_root_port[root_idx].event == EVENT_CONNECT) {
      dh_debug_printf("Root %d connected\n", root_idx);
      int dev_idx = device_pool_vacant();
      if (dev_idx >= 0) {
        on_device_connect(&pio_port[0], &pio_usb_root_port[root_idx], dev_idx);
        pio_usb_root_port[root_idx].addr0_exists = true;
      }
      pio_usb_root_port[root_idx].event = EVENT_NONE;
    } else if (pio_usb_root_port[root_idx].event == EVENT_DISCONNECT) {
      dh_debug_printf("Root %d disconnected\n", root_idx);
      pio_usb_host_close_device(
          root_idx, pio_usb_root_port[root_idx].root_device->address);
      pio_usb_root_port[root_idx].root_device->connected = false;
      pio_usb_root_port[root_idx].root_device->event = EVENT_DISCONNECT;
      pio_usb_root_port[root_idx].root_device = NULL;
      pio_usb_root_port[root_idx].event = EVENT_NONE;
    }
  }

  for (int idx = 0; idx < PIO_USB_DEVICE_CNT; idx++) {
    usb_device_t *device = &pio_usb_device[idx];

    if (device->event == EVENT_CONNECT) {
      device->event = EVENT_NONE;
      dh_debug_printf("Device %d Connected\n", idx);
      int res = enumerate_device(device, idx + 1);
      if (res == 0) {
        device->enumerated = true;
        device->root->addr0_exists = false;
        if (device->device_class == CLASS_HUB) {
          res = initialize_hub(device);
        }
      }

      if (res != 0) {
        dh_debug_printf("Enumeration failed(%d)\n", res);
        // retry
        if (device->is_root) {
          device->root->event = EVENT_DISCONNECT;
        } else {
          set_hub_feature(device->parent_device, device->parent_port,
                          HUB_SET_PORT_RESET);
          device_disconnect(device);
        }
      }
    } else if (device->event == EVENT_DISCONNECT) {
      device->event = EVENT_NONE;
      dh_debug_printf("Disconnect\n");
      device_disconnect(device);
    } else if (device->event == EVENT_HUB_PORT_CHANGE) {
      process_hub_event(device);
    }
  }

  if (cancel_timer_flag) {
    int_stat = save_and_disable_interrupts();
    stop_timer();
    if (pio_usb_root_port->root_device != NULL) {
      device_disconnect(pio_usb_root_port->root_device);
    }
    cancel_timer_flag = false;
  }

  if (start_timer_flag) {
    start_timer(_alarm_pool);
    restore_interrupts(int_stat);
    start_timer_flag = false;
  }
}

static void __no_inline_not_in_flash_func(handle_endpoint_irq)(
    root_port_t *root, uint32_t flag, volatile uint32_t *ep_reg) {
  (void)root;
  const uint32_t ep_all = *ep_reg;

  for (uint8_t ep_idx = 0; ep_idx < PIO_USB_EP_POOL_CNT; ep_idx++) {
    if (ep_all & (1u << ep_idx)) {
      endpoint_t *ep = PIO_USB_ENDPOINT(ep_idx);
      usb_device_t *device = NULL;

      // find device this endpoint belongs to
      for (int idx = 0; idx < PIO_USB_DEVICE_CNT; idx++) {
        usb_device_t *dev = &pio_usb_device[idx];
        if (dev->connected && (ep->dev_addr == dev->address)) {
          device = dev;
          break;
        }
      }

      if (device) {
        // control endpoint is either 0x00 or 0x80
        if ((ep->ep_num & 0x7f) == 0) {
          control_pipe_t *pipe = &device->control_pipe;

          if (flag != PIO_USB_INTS_ENDPOINT_COMPLETE_BITS) {
            pipe->stage = STAGE_SETUP;
            pipe->operation = CONTROL_ERROR;
          } else {
            ep->data_id = 1; // both data and status have DATA1
            if (pipe->stage == STAGE_SETUP) {
              if (pipe->operation == CONTROL_IN) {
                pipe->stage = STAGE_IN;
                ep->ep_num = 0x80;
                ep->is_tx = false;
                pio_usb_ll_transfer_start(ep,
                                          (uint8_t *)(uintptr_t)pipe->rx_buffer,
                                          pipe->request_length);
              } else if (pipe->operation == CONTROL_OUT) {
                if (pipe->out_data_packet.tx_address != NULL) {
                  pipe->stage = STAGE_OUT;
                  ep->ep_num = 0x00;
                  ep->is_tx = true;
                  pio_usb_ll_transfer_start(ep,
                                            pipe->out_data_packet.tx_address,
                                            pipe->out_data_packet.tx_length);
                } else {
                  pipe->stage = STAGE_STATUS;
                  ep->ep_num = 0x80;
                  ep->is_tx = false;
                  pio_usb_ll_transfer_start(ep, NULL, 0);
                }
              }
            } else if (pipe->stage == STAGE_IN) {
              pipe->stage = STAGE_STATUS;
              ep->ep_num = 0x00;
              ep->is_tx = true;
              pio_usb_ll_transfer_start(ep, NULL, 0);
            } else if (pipe->stage == STAGE_OUT) {
              pipe->stage = STAGE_STATUS;
              ep->ep_num = 0x80;
              ep->is_tx = false;
              pio_usb_ll_transfer_start(ep, NULL, 0);
            } else if (pipe->stage == STAGE_STATUS) {
              pipe->stage = STAGE_SETUP;
              pipe->operation = CONTROL_COMPLETE;
            }
          }
        } else if (device->device_class == CLASS_HUB && (ep->ep_num & EP_IN)) {
          // hub interrupt endpoint
          device->event = EVENT_HUB_PORT_CHANGE;
        }
      }
    }
  }

  // clear all
  (*ep_reg) &= ~ep_all;
}

// IRQ Handler
static void __no_inline_not_in_flash_func(__pio_usb_host_irq_handler)(uint8_t root_id) {
  root_port_t *root = PIO_USB_ROOT_PORT(root_id);
  uint32_t const ints = root->ints;

  if (ints & PIO_USB_INTS_CONNECT_BITS) {
    root->event = EVENT_CONNECT;
  }

  if (ints & PIO_USB_INTS_DISCONNECT_BITS) {
    root->event = EVENT_DISCONNECT;
  }

  if (ints & PIO_USB_INTS_ENDPOINT_COMPLETE_BITS) {
    handle_endpoint_irq(root, PIO_USB_INTS_ENDPOINT_COMPLETE_BITS,
                        &root->ep_complete);
  }

  if (ints & PIO_USB_INTS_ENDPOINT_STALLED_BITS) {
    handle_endpoint_irq(root, PIO_USB_INTS_ENDPOINT_STALLED_BITS,
                        &root->ep_stalled);
  }

  if (ints & PIO_USB_INTS_ENDPOINT_ERROR_BITS) {
    handle_endpoint_irq(root, PIO_USB_INTS_ENDPOINT_ERROR_BITS,
                        &root->ep_error);
  }

  // clear all
  root->ints &= ~ints;
}

// weak alias to __pio_usb_host_irq_handler
void pio_usb_host_irq_handler(uint8_t root_id) __attribute__ ((weak, alias("__pio_usb_host_irq_handler")));

#pragma GCC pop_options

//--------------------------------------------------------------------+
// Misc functions 
//--------------------------------------------------------------------+
int pio_usb_kbd_set_leds(usb_device_t *device, uint8_t port, uint8_t value) {
  usb_setup_packet_t req = SET_REPORT_REQ_DEFAULT;
  req.index_lsb = port;
  req.length_lsb = 1;
  req.length_msb = 0;
  return control_out_protocol(device, (uint8_t *)&req, sizeof(req), &value, 1);
}


================================================
FILE: Pico-PIO-USB/src/pio_usb_ll.h
================================================
/**
 * Copyright (c) 2021 sekigon-gonnoc
 *                    Ha Thach (thach@tinyusb.org)
 */

#pragma once

#include "hardware/pio.h"
#include "pio_usb_configuration.h"
#include "usb_definitions.h"

enum {
  PIO_USB_INTS_CONNECT_POS = 0,
  PIO_USB_INTS_DISCONNECT_POS,
  PIO_USB_INTS_RESET_END_POS,
  PIO_USB_INTS_SETUP_REQ_POS,
  PIO_USB_INTS_SOF_POS,

  PIO_USB_INTS_ENDPOINT_COMPLETE_POS,
  PIO_USB_INTS_ENDPOINT_ERROR_POS,
  PIO_USB_INTS_ENDPOINT_STALLED_POS,
};

#define PIO_USB_INTS_CONNECT_BITS (1u << PIO_USB_INTS_CONNECT_POS)
#define PIO_USB_INTS_DISCONNECT_BITS (1u << PIO_USB_INTS_DISCONNECT_POS)
#define PIO_USB_INTS_RESET_END_BITS (1u << PIO_USB_INTS_RESET_END_POS)
#define PIO_USB_INTS_SETUP_REQ_BITS (1u << PIO_USB_INTS_SETUP_REQ_POS)

#define PIO_USB_INTS_SOF_BITS (1u << PIO_USB_INTS_SOF_POS)

#define PIO_USB_INTS_ENDPOINT_COMPLETE_BITS                                    \
  (1u << PIO_USB_INTS_ENDPOINT_COMPLETE_POS)
#define PIO_USB_INTS_ENDPOINT_ERROR_BITS (1u << PIO_USB_INTS_ENDPOINT_ERROR_POS)
#define PIO_USB_INTS_ENDPOINT_STALLED_BITS                                     \
  (1u << PIO_USB_INTS_ENDPOINT_STALLED_POS)

typedef enum {
  PORT_PIN_SE0 = 0b00,
  PORT_PIN_FS_IDLE = 0b01,
  PORT_PIN_LS_IDLE = 0b10,
  PORT_PIN_SE1 = 0b11,
} port_pin_status_t;

typedef struct {
  uint16_t div_int;
  uint8_t div_frac;
} pio_clk_div_t;

typedef struct {
  PIO pio_usb_tx; // could not set to volatile
  uint sm_tx;
  uint offset_tx;
  uint tx_ch;

  PIO pio_usb_rx; // could not set to volatile
  uint sm_rx;
  uint offset_rx;
  uint sm_eop;
  uint offset_eop;
  uint rx_reset_instr;
  uint rx_reset_instr2;
  uint device_rx_irq_num;

  int8_t debug_pin_rx;
  int8_t debug_pin_eop;

  const pio_program_t *fs_tx_program;
  const pio_program_t *fs_tx_pre_program;
  const pio_program_t *ls_tx_program;

  pio_clk_div_t clk_div_fs_tx;
  pio_clk_div_t clk_div_fs_rx;
  pio_clk_div_t clk_div_ls_tx;
  pio_clk_div_t clk_div_ls_rx;

  bool need_pre;

  uint8_t usb_rx_buffer[128];
} pio_port_t;

//--------------------------------------------------------------------+
//
//--------------------------------------------------------------------+

enum {
  PIO_USB_MODE_INVALID = 0,
  PIO_USB_MODE_DEVICE,
  PIO_USB_MODE_HOST,
};

extern usb_device_t pio_usb_device[PIO_USB_DEVICE_CNT];

extern root_port_t pio_usb_root_port[PIO_USB_ROOT_PORT_CNT];
#define PIO_USB_ROOT_PORT(_idx) (pio_usb_root_port + (_idx))

extern endpoint_t pio_usb_ep_pool[PIO_USB_EP_POOL_CNT];
#define PIO_USB_ENDPOINT(_idx) (pio_usb_ep_pool + (_idx))

extern pio_port_t pio_port[1];
#define PIO_USB_PIO_PORT(_idx) (pio_port + (_idx))

//--------------------------------------------------------------------+
// Bus functions
//--------------------------------------------------------------------+

#define IRQ_TX_EOP_MASK (1 << usb_tx_dpdm_IRQ_EOP)
#define IRQ_TX_COMP_MASK (1 << usb_tx_dpdm_IRQ_COMP)
#define IRQ_TX_ALL_MASK (IRQ_TX_EOP_MASK | IRQ_TX_COMP_MASK)
#define IRQ_RX_COMP_MASK (1 << IRQ_RX_EOP)
#define IRQ_RX_ALL_MASK                                             \
  ((1 << IRQ_RX_EOP) | (1 << IRQ_RX_BS_ERR) | (1 << IRQ_RX_START) | \
   (1 << DECODER_TRIGGER))

#define SM_SET_CLKDIV(pio, sm, div)                                            \
  pio_sm_set_clkdiv_int_frac(pio, sm, div.div_int, div.div_frac)
#define SM_SET_CLKDIV_MAXSPEED(pio, sm)                                        \
  pio_sm_set_clkdiv_int_frac(pio, sm, 1, 0)

void pio_usb_bus_init(pio_port_t *pp, const pio_usb_configuration_t *c,
                      root_port_t *root);

void pio_usb_bus_start_receive(const pio_port_t *pp);
void pio_usb_bus_prepare_receive(const pio_port_t *pp);
int pio_usb_bus_receive_packet_and_handshake(pio_port_t *pp, uint8_t handshake);
void pio_usb_bus_usb_transfer(const pio_port_t *pp, uint8_t *data,
                              uint16_t len);

uint8_t pio_usb_bus_wait_handshake(pio_port_t *pp);
void pio_usb_bus_send_handshake(const pio_port_t *pp, uint8_t pid);
void pio_usb_bus_send_token(const pio_port_t *pp, uint8_t token, uint8_t addr,
                            uint8_t ep_num);

static __always_inline port_pin_status_t
pio_usb_bus_get_line_state(root_port_t *root) {
  uint8_t dp = gpio_get(root->pin_dp) ? 0 : 1;
  uint8_t dm = gpio_get(root->pin_dm) ? 0 : 1;

  return (dm << 1) | dp;
}

//--------------------------------------------------------------------+
// Low Level functions
//--------------------------------------------------------------------+

void pio_usb_ll_configure_endpoint(endpoint_t *ep,
                                   uint8_t const *desc_endpoint);
bool pio_usb_ll_transfer_start(endpoint_t *ep, uint8_t *buffer,
                               uint16_t buflen);
bool pio_usb_ll_transfer_continue(endpoint_t *ep, uint16_t xferred_bytes);
void pio_usb_ll_transfer_complete(endpoint_t *ep, uint32_t flag);

static inline __force_inline uint16_t
pio_usb_ll_get_transaction_len(endpoint_t *ep) {
  uint16_t remaining = ep->total_len - ep->actual_len;
  return (remaining < ep->size) ? remaining : ep->size;
}

//--------------------------------------------------------------------
// Host Controller functions
//--------------------------------------------------------------------

// Host IRQ Handler
void pio_usb_host_irq_handler(uint8_t root_idx);

void pio_usb_host_port_reset_start(uint8_t root_idx);
void pio_usb_host_port_reset_end(uint8_t root_idx);

void pio_usb_host_close_device(uint8_t root_idx, uint8_t device_address);

bool pio_usb_host_endpoint_open(uint8_t root_idx, uint8_t device_address,
                                uint8_t const *desc_endpoint, bool need_pre);
bool pio_usb_host_send_setup(uint8_t root_idx, uint8_t device_address,
                             uint8_t const setup_packet[8]);
bool pio_usb_host_endpoint_transfer(uint8_t root_idx, uint8_t device_address,
                                    uint8_t ep_address, uint8_t *buffer,
                                    uint16_t buflen);
bool pio_usb_host_endpoint_abort_transfer(uint8_t root_idx, uint8_t device_address,
                                          uint8_t ep_address);

//--------------------------------------------------------------------
// Device Controller functions
//--------------------------------------------------------------------

// Device IRQ Handler
void pio_usb_device_irq_handler(uint8_t root_idx);

void pio_usb_device_set_address(uint8_t dev_addr);
bool pio_usb_device_endpoint_open(uint8_t const *desc_endpoint);
bool pio_usb_device_transfer(uint8_t ep_address, uint8_t *buffer,
                             uint16_t buflen);

static inline __force_inline endpoint_t *
pio_usb_device_get_endpoint_by_address(uint8_t ep_address) {
  // index = 2*num + dir e.g out1, in1, out2, in2
  uint8_t const ep_idx = ((ep_address & 0x7f) << 1) | (ep_address >> 7);
  return PIO_USB_ENDPOINT(ep_idx);
}


================================================
FILE: Pico-PIO-USB/src/usb_crc.c
================================================

#include "usb_crc.h"

const uint8_t __not_in_flash("crc5_tbl") crc5_tbl[32] = {
    0x00, 0x0b, 0x16, 0x1d, 0x05, 0x0e, 0x13, 0x18, 0x0a, 0x01,
    0x1c, 0x17, 0x0f, 0x04, 0x19, 0x12, 0x14, 0x1f, 0x02, 0x09,
    0x11, 0x1a, 0x07, 0x0c, 0x1e, 0x15, 0x08, 0x03, 0x1b, 0x10,
    0x0d, 0x06,
};
uint8_t __not_in_flash_func(calc_usb_crc5)(uint16_t data) {
  data = data ^ 0x1f;

  const uint8_t lsb = (data >> 1) & 0x1f;
  const uint8_t msb = (data >> 6) & 0x1f;

  uint8_t crc = (data & 1) ? 0x14 : 0x00;
  crc = crc5_tbl[(lsb ^ crc)];
  crc = crc5_tbl[(msb ^ crc)];

  return crc ^ 0x1f;
}

// Place to RAM
const uint16_t __not_in_flash("crc_tbl") crc16_tbl[256] = {
    0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241, 0xc601,
    0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440, 0xcc01, 0x0cc0,
    0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40, 0x0a00, 0xcac1, 0xcb81,
    0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841, 0xd801, 0x18c0, 0x1980, 0xd941,
    0x1b00, 0xdbc1, 0xda81, 0x1a40, 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01,
    0x1dc0, 0x1c80, 0xdc41, 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0,
    0x1680, 0xd641, 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081,
    0x1040, 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240,
    0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441, 0x3c00,
    0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41, 0xfa01, 0x3ac0,
    0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840, 0x2800, 0xe8c1, 0xe981,
    0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41, 0xee01, 0x2ec0, 0x2f80, 0xef41,
    0x2d00, 0xedc1, 0xec81, 0x2c40, 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700,
    0xe7c1, 0xe681, 0x2640, 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0,
    0x2080, 0xe041, 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281,
    0x6240, 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441,
    0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41, 0xaa01,
    0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840, 0x7800, 0xb8c1,
    0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41, 0xbe01, 0x7ec0, 0x7f80,
    0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40, 0xb401, 0x74c0, 0x7580, 0xb541,
    0x7700, 0xb7c1, 0xb681, 0x7640, 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101,
    0x71c0, 0x7080, 0xb041, 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0,
    0x5280, 0x9241, 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481,
    0x5440, 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40,
    0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841, 0x8801,
    0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40, 0x4e00, 0x8ec1,
    0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41, 0x4400, 0x84c1, 0x8581,
    0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, 0x8201, 0x42c0, 0x4380, 0x8341,
    0x4100, 0x81c1, 0x8081, 0x4040};

uint16_t calc_usb_crc16(const uint8_t *data, uint16_t len) {
  uint16_t crc = 0xffff;

  for (int idx = 0; idx < len; idx++) {
    crc = (crc >> 8) ^ crc16_tbl[(crc ^ data[idx]) & 0xff];
  }

  return crc ^ 0xffff;
}

================================================
FILE: Pico-PIO-USB/src/usb_crc.h
================================================
#pragma once

#include <stdint.h>
#include "pico/stdlib.h"

// Calc CRC5-USB of 11bit data
uint8_t calc_usb_crc5(uint16_t data);
// Calc CRC16-USB of array
uint16_t calc_usb_crc16(const uint8_t *data, uint16_t len);

extern const uint16_t crc16_tbl[256];
static inline uint16_t __time_critical_func(update_usb_crc16)(uint16_t crc, uint8_t data) {
  crc = (crc >> 8) ^ crc16_tbl[(crc ^ data) & 0xff];
  return crc;
}

================================================
FILE: Pico-PIO-USB/src/usb_definitions.h
================================================

#pragma once

#include <stdint.h>

#include "pio_usb_configuration.h"

typedef enum {
  CONTROL_NONE,
  CONTROL_IN,
  CONTROL_OUT,
  CONTROL_COMPLETE,
  CONTROL_ERROR,
} control_transfer_operation_t;

typedef enum {
  EP_IN = 0x80,
  EP_OUT = 0x00,
} ep_type_t;

typedef enum {
  STAGE_SETUP,
  STAGE_DATA,
  STAGE_IN,
  STAGE_OUT,
  STAGE_STATUS,
  STAGE_COMPLETE,
  STAGE_ERROR
} setup_transfer_stage_t;

typedef enum {
  STAGE_IDLE,
  STAGE_DEVICE,
  STAGE_CONFIG,
  STAGE_CONFIG2,
  STAGE_INTERFACE,
  STAGE_ENDPOINT
} usb_enumeration_stage_t;

typedef struct {
  uint8_t *tx_address;
  uint8_t tx_length;
} packet_info_t;

typedef struct {
  volatile uint8_t data_in_num;
  volatile uint16_t buffer_idx;
  volatile uint8_t *rx_buffer;
  volatile packet_info_t setup_packet;
  volatile packet_info_t out_data_packet;
  volatile int16_t request_length;
  volatile control_transfer_operation_t operation;
  volatile setup_transfer_stage_t stage;
} control_pipe_t;

typedef struct {
  volatile uint8_t root_idx;
  volatile uint8_t dev_addr;
  bool need_pre;
  bool is_tx; // Host out or Device in

  volatile uint8_t ep_num;
  volatile bool new_data_flag;
  volatile uint16_t size;

  volatile uint8_t attr;
  volatile uint8_t interval;
  volatile uint8_t interval_counter;
  volatile uint8_t data_id; // data0 or data1

  volatile bool stalled;
  volatile bool has_transfer;
  volatile bool transfer_started;
  volatile bool transfer_aborted;

  uint8_t buffer[64 + 4];
  uint8_t *app_buf;
  uint16_t total_len;
  uint16_t actual_len;
} endpoint_t;

typedef enum {
  EVENT_NONE,
  EVENT_CONNECT,
  EVENT_DISCONNECT,
  EVENT_HUB_PORT_CHANGE,
} usb_device_event_t;

typedef struct struct_usb_device_t usb_device_t;
typedef struct struct_root_port_t {
  volatile bool initialized;
  volatile bool addr0_exists;
  volatile uint8_t pin_dp;
  volatile uint8_t pin_dm;
  volatile usb_device_event_t event;
  usb_device_t *root_device;

  volatile bool is_fullspeed;
  volatile bool connected;
  volatile bool suspended;
  uint8_t mode;

  // register interface
  volatile uint32_t ints; // interrupt status
  volatile uint32_t ep_complete;
  volatile uint32_t ep_error;
  volatile uint32_t ep_stalled;

  // device only
  uint8_t dev_addr;
  uint8_t *setup_packet;
} root_port_t;

struct struct_usb_device_t {
  volatile bool connected;
  volatile bool enumerated;
  volatile usb_device_event_t event;
  volatile uint8_t address;
  volatile uint16_t vid;
  volatile uint16_t pid;
  volatile uint8_t device_class;
  volatile bool is_fullspeed;
  volatile bool is_root;
  control_pipe_t control_pipe;
  uint8_t endpoint_id[PIO_USB_DEV_EP_CNT];
  uint8_t child_devices[PIO_USB_HUB_PORT_CNT];
  struct struct_usb_device_t *parent_device;
  uint8_t parent_port;
  root_port_t *root;
};

enum {
  USB_SYNC = 0x80,
  USB_PID_OUT = 0xe1,
  USB_PID_IN = 0x69,
  USB_PID_SOF = 0xa5,
  USB_PID_SETUP = 0x2d,
  USB_PID_DATA0 = 0xc3,
  USB_PID_DATA1 = 0x4b,
  USB_PID_ACK = 0xd2,
  USB_PID_NAK = 0x5a,
  USB_PID_STALL = 0x1e,
  USB_PID_PRE = 0x3c,
  USB_CRC16_PLACE = 0,
};

enum {
  DESC_TYPE_DEVICE = 0x01,
  DESC_TYPE_CONFIG = 0x02,
  DESC_TYPE_STRING = 0x03,
  DESC_TYPE_INTERFACE = 0x04,
  DESC_TYPE_ENDPOINT = 0x05,
  DESC_TYPE_HID = 0x21,
  DESC_TYPE_HID_REPORT = 0x22,
};

enum {
  CLASS_HID = 0x03,
  CLASS_HUB = 0x09,
};

enum {
  EP_ATTR_CONTROL = 0x00,
  EP_ATTR_ISOCHRONOUS = 0x01,
  EP_ATTR_BULK = 0x02,
  EP_ATTR_INTERRUPT = 0x03,
  EP_ATTR_ENUMERATING = 0x80
};

typedef struct {
  //  uint8_t sync;
  //  uint8_t pid;
  uint8_t request_type;
  uint8_t request;
  uint8_t value_lsb;
  uint8_t value_msb;
  uint8_t index_lsb;
  uint8_t index_msb;
  uint8_t length_lsb;
  uint8_t length_msb;
  //  uint8_t crc16[2];
} usb_setup_packet_t;

typedef struct {
  uint8_t length;
  uint8_t type;
  uint8_t bcd_usb[2];
  uint8_t device_class;
  uint8_t subclass;
  uint8_t protocol;
  uint8_t max_packet_size;
  uint8_t vid[2];
  uint8_t pid[2];
  uint8_t bcd_device[2];
  uint8_t manufacture;
  uint8_t product;
  uint8_t serial;
  uint8_t num_configu;
} device_descriptor_t;

typedef struct {
  uint8_t length;
  uint8_t type;
  uint8_t string[62];
} __attribute__((aligned(2))) string_descriptor_t;

typedef struct {
  uint8_t length;
  uint8_t type;
  uint8_t inum;
  uint8_t altsetting;
  uint8_t numep;
  uint8_t iclass;
  uint8_t isubclass;
  uint8_t iprotocol;
  uint8_t iface;
} interface_descriptor_t;

typedef struct {
  uint8_t length;
  uint8_t type;
  uint8_t epaddr;
  uint8_t attr;
  uint8_t max_size[2];
  uint8_t interval;
} endpoint_descriptor_t;

typedef struct {
  uint8_t length;
  uint8_t type;
  uint8_t bcd_hid[2];
  uint8_t contry_code;
  uint8_t num_desc;
  uint8_t desc_type;
  uint8_t desc_len[2];
} hid_descriptor_t;

typedef struct configuration_descriptor_tag {
  uint8_t length;
  uint8_t type;
  uint8_t total_length_lsb;
  uint8_t total_length_msb;
  uint8_t num_interfaces;
  uint8_t configuration_value;
  uint8_t configuration;
  uint8_t attributes;
  uint8_t max_power;
} configuration_descriptor_t;

typedef struct {
  uint8_t lenght;
  uint8_t type;
  uint8_t port_num;
  uint8_t chara_lsb;
  uint8_t chara_msb;
  uint8_t pow_on_time;
  uint8_t current;
  uint8_t removable;
} hub_descriptor_t;

typedef struct {
  uint16_t port_status;
  uint16_t port_change;
} hub_port_status_t;

enum {
  HUB_SET_PORT_RESET = 4,
  HUB_SET_PORT_POWER = 8,
  HUB_CLR_PORT_CONNECTION = 16,
  HUB_CLR_PORT_ENABLE = 17,
  HUB_CLR_PORT_SUSPEND = 18,
  HUB_CLR_PORT_RESET = 20,
};

enum {
  HUB_STAT_PORT_CONNECTION = (1 << 0),
  HUB_STAT_PORT_ENABLE = (1 << 1),
  HUB_STAT_PORT_SUSPEND = (1 << 2),
  HUB_STAT_PORT_OC = (1 << 3),
  HUB_STAT_PORT_RESET = (1 << 4),
  HUB_STAT_PORT_POWER = (1 << 8),
  HUB_STAT_PORT_LOWSPEED = (1 << 9),
};

enum {
  HUB_CHANGE_PORT_CONNECTION = (1 << 0),
  HUB_CHANGE_PORT_ENABLE = (1 << 1),
  HUB_CHANGE_PORT_SUSPEND = (1 << 2),
  HUB_CHANGE_PORT_OC = (1 << 3),
  HUB_CHANGE_PORT_RESET = (1 << 4),
};

enum {
  USB_REQ_DIR_IN = 0x80,
  USB_REQ_DIR_OUT = 0x00,
  USB_REQ_TYP_STANDARD = 0x00,
  USB_REQ_TYP_CLASS = 0x20,
  USB_REQ_TYP_VENDOR = 0x40,
  USB_REQ_REC_DEVICE = 0x00,
  USB_REQ_REC_IFACE = 0x01,
  USB_REQ_REC_EP = 0x02,
  USB_REQ_REC_OTHER = 0x03,
};

#define GET_DEVICE_DESCRIPTOR_REQ_DEFAULT                                      \
  { USB_REQ_DIR_IN, 0x06, 0, 0x01, 0, 0, 0x12, 0 }
#define GET_CONFIGURATION_DESCRIPTOR_REQ_DEFAULT                               \
  { USB_REQ_DIR_IN, 0x06, 0, 0x02, 0, 0, 0x09, 0 }
#define SET_CONFIGURATION_REQ_DEFAULT                                          \
  { USB_REQ_DIR_OUT, 0x09, 0, 0, 0, 0, 0, 0 }
#define SET_ADDRESS_REQ_DEFAULT                                                \
  { USB_REQ_DIR_OUT, 0x5, 0x02, 0, 0, 0, 0, 0 }
#define SET_HID_IDLE_REQ_DEFAULT                                               \
  { USB_REQ_TYP_CLASS | USB_REQ_REC_IFACE, 0x0A, 0, 0, 0, 0, 0, 0 }
#define GET_HID_REPORT_DESCRIPTOR_DEFAULT                                      \
  { USB_REQ_DIR_IN | USB_REQ_REC_IFACE, 0x06, 0, 0x22, 0, 0, 0xff, 0 }
#define SET_REPORT_REQ_DEFAULT                                                 \
  { USB_REQ_TYP_CLASS | USB_REQ_REC_IFACE, 0x09, 0, 0x02, 0, 0, 0, 0 }
#define GET_HUB_DESCRPTOR_REQUEST                                              \
  {                                                                            \
    USB_REQ_DIR_IN | USB_REQ_TYP_CLASS | USB_REQ_REC_DEVICE, 0x06, 0, 0x29, 0, \
        0, 8, 0                                                                \
  }
#define GET_HUB_PORT_STATUS_REQUEST                                            \
  {                                                                            \
    USB_REQ_DIR_IN | USB_REQ_TYP_CLASS | USB_REQ_REC_OTHER, 0, 0, 0, 0, 0, 4,  \
        0                                                                      \
  }
#define SET_HUB_FEATURE_REQUEST                                                \
  {                                                                            \
    USB_REQ_DIR_OUT | USB_REQ_TYP_CLASS | USB_REQ_REC_OTHER, 0x03, 0, 0, 0, 0, \
        0, 0                                                                   \
  }
#define CLEAR_HUB_FEATURE_REQUEST                                              \
  {                                                                            \
    USB_REQ_DIR_OUT | USB_REQ_TYP_CLASS | USB_REQ_REC_OTHER, 0x01, 0, 0, 0, 0, \
        0, 0                                                                   \
  }

typedef struct {
  const uint8_t *device;
  const uint8_t *config;
  const uint8_t **hid_report;
  const string_descriptor_t *string;
} usb_descriptor_buffers_t;


================================================
FILE: Pico-PIO-USB/src/usb_rx.pio
================================================

; Copyright (c) 2021-2022 sekigon-gonnoc

.define public IRQ_RX_BS_ERR    1   ; bit stuffinc error
.define public IRQ_RX_EOP       2   ; eop detect flag
.define public IRQ_RX_START     3   ; packet start flag
.define public DECODER_TRIGGER  4

.define BIT_REPEAT_COUNT 6        ; bit repeat counter

.define db0 0
.define db1 1

; USB signal edge and eop detector
; 17 instruction
;            FS(12M)  LS(1.5M)
; Run at     96MHz    12MHz
; jmp_pin    d-       d+ 
; in_pin     d+       d-
; both d+/d- pin should be input invert overrideed
.program usb_edge_detector
eop:
    irq wait IRQ_RX_EOP
start:
    jmp pin start               ; Wait fall edge
    irq IRQ_RX_START [1]

.wrap_target
pin_still_low:
    irq DECODER_TRIGGER [1]		; Trigger NRZI decoder

; Resync on rising edge
pin_low:
    jmp pin pin_went_high
pin_went_low:
    jmp pin pin_went_high
    jmp pin pin_went_high
    jmp pin pin_went_high
    jmp pin pin_went_high
    jmp pin pin_went_high
.wrap

pin_still_high:
    mov x, isr [2] 
    jmp x-- eop	     		    ; Jump to eop if jmp_pin and in_pin are high because both inputs are inverted
; Jump to here on rising edge
pin_went_high:
    mov isr, null
    in pins, 1                  ; Capture the pin to check eop.
    irq DECODER_TRIGGER			; Trigger NRZI decoder
    jmp pin pin_still_high
    jmp pin_went_low            ; To adjust interval of decoder trigger, jump to pin_went_low (not pin_low)

.program usb_edge_detector_debug
.side_set 1
eop:
    irq wait IRQ_RX_EOP     side db0
start:
    jmp pin start           side db1     ; Wait fall edge
    irq IRQ_RX_START [1]    side db0

.wrap_target
pin_still_low:
    irq DECODER_TRIGGER [1]	side db0	 ; Trigger NRZI decoder

; Resync on rising edge
pin_low:
    jmp pin pin_went_high   side db1
pin_went_low:
    jmp pin pin_went_high   side db1
    jmp pin pin_went_high   side db1
    jmp pin pin_went_high   side db1
    jmp pin pin_went_high   side db1
    jmp pin pin_went_high   side db1
.wrap

pin_still_high:
    mov x, isr [2] 			side db1
    jmp x-- eop	     		side db1     ; Jump to eop if jmp_pin and in_pin are high because both inputs are inverted
; Jump to here on rising edge
pin_went_high:
    mov isr, null			side db1
    in pins, 1				side db0     ; Capture the pin to check eop.
    irq DECODER_TRIGGER		side db0     ; Trigger NRZI decoder
    jmp pin pin_still_high  side db0
    jmp pin_went_low 		side db1     ; To adjust interval of decoder trigger, jump to pin_went_low (not pin_low)

; USB NRZI data decoder
; 15 instruction
;            FS(12M)  LS(1.5M)
; Run at     as fast as possible
; jmp_pin    d+       d- 
; both d+/d- pin should be input invert overrideed
; Fill OSR by 1 and set 0 to x before runnning this program
.program usb_nrzi_decoder
start:
    ; set x, 0
.wrap_target
set_y:
    set y, BIT_REPEAT_COUNT
irq_wait:
    wait 1 irq DECODER_TRIGGER			; wait signal from edge detector
    jmp PIN pin_high
pin_low:
    jmp !y flip			; ignore stuff bit, without error check
    jmp !x K1
K2:
    ; x==1
    in null, 1
    jmp flip
K1:
    ; x==0
    in osr, 1
    jmp y-- irq_wait
    
pin_high:
    jmp !y flip			; ignore stuff bit, without error check
    jmp !x J1
J2:
    ; x==1
    in x, 1
    jmp y-- irq_wait
J1:
    ; x==0
    in null, 1
flip:
    mov x, ~x
.wrap
.program usb_nrzi_decoder_debug
.side_set 1 opt
start:
    ; set x, 0        side db0
.wrap_target
set_y:
    set y, BIT_REPEAT_COUNT
irq_wait:
    wait 1 irq DECODER_TRIGGER    ; wait signal from edge detector
    jmp PIN pin_high
pin_low:
    jmp !y flip	side db0	; ignore stuff bit, without error check
    jmp !x K1 side db0
K2:
    ; x==1
    in null, 1
    jmp flip
K1:
    ; x==0
    in osr, 1
    jmp y-- irq_wait
    
pin_high:
    jmp !y flip	side db1	; ignore stuff bit, without error check
    jmp !x J1 side db1
J2:
    ; x==1
    in x, 1
    jmp y-- irq_wait
J1:
    ; x==0
    in null, 1
flip:
    mov x, ~x
.wrap

% c-sdk {
#include "hardware/clocks.h"

static __always_inline void pio_sm_set_jmp_pin(PIO pio, uint sm, uint jmp_pin) {
  pio->sm[sm].execctrl =
      (pio->sm[sm].execctrl & ~PIO_SM0_EXECCTRL_JMP_PIN_BITS) |
      (jmp_pin << PIO_SM0_EXECCTRL_JMP_PIN_LSB);
}

static inline void usb_rx_fs_program_init(PIO pio, uint sm, uint offset, uint pin_dp, uint pin_dm, int pin_debug) {
  if (pin_dp < pin_dm) {
    pio_sm_set_consecutive_pindirs(pio, sm, pin_dp, 2, false);
  } else {
    pio_sm_set_consecutive_pindirs(pio, sm, pin_dm, 2, false);
  }
  gpio_pull_down(pin_dp);
  gpio_pull_down(pin_dm);
  gpio_set_inover(pin_dp, GPIO_OVERRIDE_INVERT);
  gpio_set_inover(pin_dm, GPIO_OVERRIDE_INVERT);

  pio_sm_config c;

  if (pin_debug < 0) {
    c = usb_nrzi_decoder_program_get_default_config(offset);
  } else {
    c = usb_nrzi_decoder_debug_program_get_default_config(offset);

    pio_sm_set_pins_with_mask(pio, sm, 0, 1 << pin_debug);
    pio_sm_set_pindirs_with_mask(pio, sm, 1 << pin_debug, 1 << pin_debug);
    pio_gpio_init(pio, pin_debug);
    sm_config_set_sideset_pins(&c, pin_debug);
  }

  sm_config_set_in_pins(&c, pin_dp);  // for WAIT, IN
  sm_config_set_jmp_pin(&c, pin_dp);  // for JMP

  // Shift to right, autopull enabled, 8bit
  sm_config_set_in_shift(&c, true, true, 8);
  sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_RX);

  pio_sm_init(pio, sm, offset, &c);
  pio_sm_exec(pio, sm, pio_encode_mov_not(pio_osr, pio_null));
  pio_sm_set_enabled(pio, sm, false);
}

static inline void eop_detect_fs_program_init(PIO pio, uint sm, uint offset,
                                           uint pin_dp, uint pin_dm, bool is_fs, int pin_debug) {
  pio_sm_config c;

  if (pin_debug < 0) {
    c = usb_edge_detector_program_get_default_config(offset);
  } else {
    c = usb_edge_detector_debug_program_get_default_config(offset);
    pio_sm_set_pins_with_mask(pio, sm, 0, 1 << pin_debug);
    pio_sm_set_pindirs_with_mask(pio, sm, 1 << pin_debug, 1 << pin_debug);
    pio_gpio_init(pio, pin_debug);
    sm_config_set_sideset_pins(&c, pin_debug);
  }

  sm_config_set_in_pins(&c, pin_dp);  // for WAIT, IN
  sm_config_set_jmp_pin(&c, pin_dm);  // for JMP

  sm_config_set_in_shift(&c, false, false, 8);

  float div;
  if (is_fs) {
    div = (float)clock_get_hz(clk_sys) / (96000000);
  } else {
    div = (float)clock_get_hz(clk_sys) / (12000000);
  }

  sm_config_set_clkdiv(&c, div);

  pio_sm_init(pio, sm, offset + 1, &c);
  pio_sm_set_enabled(pio, sm, true);
}

%}

================================================
FILE: Pico-PIO-USB/src/usb_rx.pio.h
================================================
// -------------------------------------------------- //
// This file is autogenerated by pioasm; do not edit! //
// -------------------------------------------------- //

#pragma once

#if !PICO_NO_HARDWARE
#include "hardware/pio.h"
#endif

#define IRQ_RX_BS_ERR 1
#define IRQ_RX_EOP 2
#define IRQ_RX_START 3
#define DECODER_TRIGGER 4

// ----------------- //
// usb_edge_detector //
// ----------------- //

#define usb_edge_detector_wrap_target 3
#define usb_edge_detector_wrap 9

static const uint16_t usb_edge_detector_program_instructions[] = {
    0xc022, //  0: irq    wait 2                     
    0x00c1, //  1: jmp    pin, 1                     
    0xc103, //  2: irq    nowait 3               [1] 
            //     .wrap_target
    0xc104, //  3: irq    nowait 4               [1] 
    0x00cc, //  4: jmp    pin, 12                    
    0x00cc, //  5: jmp    pin, 12                    
    0x00cc, //  6: jmp    pin, 12                    
    0x00cc, //  7: jmp    pin, 12                    
    0x00cc, //  8: jmp    pin, 12                    
    0x00cc, //  9: jmp    pin, 12                    
            //     .wrap
    0xa226, // 10: mov    x, isr                 [2] 
    0x0040, // 11: jmp    x--, 0                     
    0xa0c3, // 12: mov    isr, null                  
    0x4001, // 13: in     pins, 1                    
    0xc004, // 14: irq    nowait 4                   
    0x00ca, // 15: jmp    pin, 10                    
    0x0005, // 16: jmp    5                          
};

#if !PICO_NO_HARDWARE
static const struct pio_program usb_edge_detector_program = {
    .instructions = usb_edge_detector_program_instructions,
    .length = 17,
    .origin = -1,
};

static inline pio_sm_config usb_edge_detector_program_get_default_config(uint offset) {
    pio_sm_config c = pio_get_default_sm_config();
    sm_config_set_wrap(&c, offset + usb_edge_detector_wrap_target, offset + usb_edge_detector_wrap);
    return c;
}
#endif

// ----------------------- //
// usb_edge_detector_debug //
// ----------------------- //

#define usb_edge_detector_debug_wrap_target 3
#define usb_edge_detector_debug_wrap 9

static const uint16_t usb_edge_detector_debug_program_instructions[] = {
    0xc022, //  0: irq    wait 2          side 0     
    0x10c1, //  1: jmp    pin, 1          side 1     
    0xc103, //  2: irq    nowait 3        side 0 [1] 
            //     .wrap_target
    0xc104, //  3: irq    nowait 4        side 0 [1] 
    0x10cc, //  4: jmp    pin, 12         side 1     
    0x10cc, //  5: jmp    pin, 12         side 1     
    0x10cc, //  6: jmp    pin, 12         side 1     
    0x10cc, //  7: jmp    pin, 12         side 1     
    0x10cc, //  8: jmp    pin, 12         side 1     
    0x10cc, //  9: jmp    pin, 12         side 1     
            //     .wrap
    0xb226, // 10: mov    x, isr          side 1 [2] 
    0x1040, // 11: jmp    x--, 0          side 1     
    0xb0c3, // 12: mov    isr, null       side 1     
    0x4001, // 13: in     pins, 1         side 0     
    0xc004, // 14: irq    nowait 4        side 0     
    0x00ca, // 15: jmp    pin, 10         side 0     
    0x1005, // 16: jmp    5               side 1     
};

#if !PICO_NO_HARDWARE
static const struct pio_program usb_edge_detector_debug_program = {
    .instructions = usb_edge_detector_debug_program_instructions,
    .length = 17,
    .origin = -1,
};

static inline pio_sm_config usb_edge_detector_debug_program_get_default_config(uint offset) {
    pio_sm_config c = pio_get_default_sm_config();
    sm_config_set_wrap(&c, offset + usb_edge_detector_debug_wrap_target, offset + usb_edge_detector_debug_wrap);
    sm_config_set_sideset(&c, 1, false, false);
    return c;
}
#endif

// ---------------- //
// usb_nrzi_decoder //
// ---------------- //

#define usb_nrzi_decoder_wrap_target 0
#define usb_nrzi_decoder_wrap 14

static const uint16_t usb_nrzi_decoder_program_instructions[] = {
            //     .wrap_target
    0xe046, //  0: set    y, 6                       
    0x20c4, //  1: wait   1 irq, 4                   
    0x00c9, //  2: jmp    pin, 9                     
    0x006e, //  3: jmp    !y, 14                     
    0x0027, //  4: jmp    !x, 7                      
    0x4061, //  5: in     null, 1                    
    0x000e, //  6: jmp    14                         
    0x40e1, //  7: in     osr, 1                     
    0x0081, //  8: jmp    y--, 1                     
    0x006e, //  9: jmp    !y, 14                     
    0x002d, // 10: jmp    !x, 13                     
    0x4021, // 11: in     x, 1                       
    0x0081, // 12: jmp    y--, 1                     
    0x4061, // 13: in     null, 1                    
    0xa029, // 14: mov    x, !x                      
            //     .wrap
};

#if !PICO_NO_HARDWARE
static const struct pio_program usb_nrzi_decoder_program = {
    .instructions = usb_nrzi_decoder_program_instructions,
    .length = 15,
    .origin = -1,
};

static inline pio_sm_config usb_nrzi_decoder_program_get_default_config(uint offset) {
    pio_sm_config c = pio_get_default_sm_config();
    sm_config_set_wrap(&c, offset + usb_nrzi_decoder_wrap_target, offset + usb_nrzi_decoder_wrap);
    return c;
}
#endif

// ---------------------- //
// usb_nrzi_decoder_debug //
// ---------------------- //

#define usb_nrzi_decoder_debug_wrap_target 0
#define usb_nrzi_decoder_debug_wrap 14

static const uint16_t usb_nrzi_decoder_debug_program_instructions[] = {
            //     .wrap_target
    0xe046, //  0: set    y, 6                       
    0x20c4, //  1: wait   1 irq, 4                   
    0x00c9, //  2: jmp    pin, 9                     
    0x106e, //  3: jmp    !y, 14          side 0     
    0x1027, //  4: jmp    !x, 7           side 0     
    0x4061, //  5: in     null, 1                    
    0x000e, //  6: jmp    14                         
    0x40e1, //  7: in     osr, 1                     
    0x0081, //  8: jmp    y--, 1                     
    0x186e, //  9: jmp    !y, 14          side 1     
    0x182d, // 10: jmp    !x, 13          side 1     
    0x4021, // 11: in     x, 1                       
    0x0081, // 12: jmp    y--, 1                     
    0x4061, // 13: in     null, 1                    
    0xa029, // 14: mov    x, !x                      
            //     .wrap
};

#if !PICO_NO_HARDWARE
static const struct pio_program usb_nrzi_decoder_debug_program = {
    .instructions = usb_nrzi_decoder_debug_program_instructions,
    .length = 15,
    .origin = -1,
};

static inline pio_sm_config usb_nrzi_decoder_debug_program_get_default_config(uint offset) {
    pio_sm_config c = pio_get_default_sm_config();
    sm_config_set_wrap(&c, offset + usb_nrzi_decoder_debug_wrap_target, offset + usb_nrzi_decoder_debug_wrap);
    sm_config_set_sideset(&c, 2, true, false);
    return c;
}

#include "hardware/clocks.h"
static __always_inline void pio_sm_set_jmp_pin(PIO pio, uint sm, uint jmp_pin) {
  pio->sm[sm].execctrl =
      (pio->sm[sm].execctrl & ~PIO_SM0_EXECCTRL_JMP_PIN_BITS) |
      (jmp_pin << PIO_SM0_EXECCTRL_JMP_PIN_LSB);
}
static inline void usb_rx_fs_program_init(PIO pio, uint sm, uint offset, uint pin_dp, uint pin_dm, int pin_debug) {
  if (pin_dp < pin_dm) {
    pio_sm_set_consecutive_pindirs(pio, sm, pin_dp, 2, false);
  } else {
    pio_sm_set_consecutive_pindirs(pio, sm, pin_dm, 2, false);
  }
  gpio_pull_down(pin_dp);
  gpio_pull_down(pin_dm);
  gpio_set_inover(pin_dp, GPIO_OVERRIDE_INVERT);
  gpio_set_inover(pin_dm, GPIO_OVERRIDE_INVERT);
  pio_sm_config c;
  if (pin_debug < 0) {
    c = usb_nrzi_decoder_program_get_default_config(offset);
  } else {
    c = usb_nrzi_decoder_debug_program_get_default_config(offset);
    pio_sm_set_pins_with_mask(pio, sm, 0, 1 << pin_debug);
    pio_sm_set_pindirs_with_mask(pio, sm, 1 << pin_debug, 1 << pin_debug);
    pio_gpio_init(pio, pin_debug);
    sm_config_set_sideset_pins(&c, pin_debug);
  }
  sm_config_set_in_pins(&c, pin_dp);  // for WAIT, IN
  sm_config_set_jmp_pin(&c, pin_dp);  // for JMP
  // Shift to right, autopull enabled, 8bit
  sm_config_set_in_shift(&c, true, true, 8);
  sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_RX);
  pio_sm_init(pio, sm, offset, &c);
  pio_sm_exec(pio, sm, pio_encode_mov_not(pio_osr, pio_null));
  pio_sm_set_enabled(pio, sm, false);
}
static inline void eop_detect_fs_program_init(PIO pio, uint sm, uint offset,
                                           uint pin_dp, uint pin_dm, bool is_fs, int pin_debug) {
  pio_sm_config c;
  if (pin_debug < 0) {
    c = usb_edge_detector_program_get_default_config(offset);
  } else {
    c = usb_edge_detector_debug_program_get_default_config(offset);
    pio_sm_set_pins_with_mask(pio, sm, 0, 1 << pin_debug);
    pio_sm_set_pindirs_with_mask(pio, sm, 1 << pin_debug, 1 << pin_debug);
    pio_gpio_init(pio, pin_debug);
    sm_config_set_sideset_pins(&c, pin_debug);
  }
  sm_config_set_in_pins(&c, pin_dp);  // for WAIT, IN
  sm_config_set_jmp_pin(&c, pin_dm);  // for JMP
  sm_config_set_in_shift(&c, false, false, 8);
  float div;
  if (is_fs) {
    div = (float)clock_get_hz(clk_sys) / (96000000);
  } else {
    div = (float)clock_get_hz(clk_sys) / (12000000);
  }
  sm_config_set_clkdiv(&c, div);
  pio_sm_init(pio, sm, offset + 1, &c);
  pio_sm_set_enabled(pio, sm, true);
}

#endif



================================================
FILE: Pico-PIO-USB/src/usb_tx.pio
================================================
; Copyright (c) 2021-2023 sekigon-gonnoc

.define public USB_TX_EOP_OFFSET 4
.define public USB_TX_EOP_DISABLER_LEN 4

; USB NRZI transmitter
; Run at 48 MHz for full-spped
; Run at 6 MHz for low-spped
; autopull enabled
.program usb_tx_dpdm
.side_set 2 opt

; J for fs, K for ls
.define FJ_LK 0b01
; K for fs, J for ls
.define FK_LJ 0b10
.define SE0 0b00
.define BR 5         ; bit repeat limit
.define public IRQ_COMP 0   ; complete flag bit
.define public IRQ_EOP 1   ; EOP start flag bit

start:
    set y, BR side FJ_LK
    set pindirs, 0b11

.wrap_target
check_eop1:
    jmp !osre load_bit1
    nop [1]
send_eop:
    irq IRQ_EOP side SE0 [3]    ; To catch quik ACK, mark as complete here
    nop [3]
    nop side FJ_LK
    set pindirs, 0b00 [3]
    irq wait IRQ_COMP
    jmp start
load_bit1:
    out x, 1
    jmp !x low1
high1:
    jmp y-- check_eop1 side FJ_LK
    nop [2]                     ; bit stuffing
low1:
    set y BR side FK_LJ

check_eop2:
    jmp !osre load_bit2
    jmp send_eop [1]
load_bit2:
    out x, 1
    jmp !x low2
high2:
    jmp y-- check_eop2 side FK_LJ
    nop [2]                     ; bit stuffing
low2:
    set y BR side FJ_LK
.wrap

; USB transmitter for PRE packet (No EOP)
; Run at 48 MHz for full-spped
; autopull enabled
.program usb_tx_pre_dpdm
.side_set 2 opt

.define J 0b01
.define K 0b10
.define SE0 0b00
.define BR 5         ; bit repeat limit
.define public IRQ_COMP 0   ; complete flag bit
.define public IRQ_EOP 1   ; EOP start flag bit

start:
    set y, BR side J
    set pindirs, 0b11

.wrap_target
check_eop1:
    jmp !osre load_bit1
    nop [1]
send_eop:
    irq IRQ_EOP side J [3]
    set pindirs, 0b00
    nop ; to align program size
    nop ; to align program size
    irq wait IRQ_COMP
    jmp start
load_bit1:
    out x, 1
    jmp !x low1
high1:
    jmp y-- check_eop1 side J
    nop [2]                     ; bit stuffing
low1:
    set y BR side K

check_eop2:
    jmp !osre load_bit2
    jmp send_eop [1]
load_bit2:
    out x, 1
    jmp !x low2
high2:
    jmp y-- check_eop2 side K
    nop [2]                     ; bit stuffing
low2:
    set y BR side J
.wrap


; USB NRZI transmitter
; Run at 48 MHz for full-spped
; Run at 6 MHz for low-spped
; autopull enabled
.program usb_tx_dmdp
.side_set 2 opt

.define FK_LJ 0b10
.define FJ_LK 0b01
.define SE0 0b00
.define BR 5         ; bit repeat limit
.define public IRQ_COMP 0   ; complete flag bit
.define public IRQ_EOP 1   ; EOP start flag bit

start:
    set y, BR side FK_LJ
    set pindirs, 0b11

.wrap_target
check_eop1:
    jmp !osre load_bit1
    nop [1]
send_eop:
    irq IRQ_EOP side SE0 [3]
    nop [3]
    nop side FK_LJ
    set pindirs, 0b00 [3]
    irq wait IRQ_COMP
    jmp start
load_bit1:
    out x, 1
    jmp !x low1
high1:
    jmp y-- check_eop1 side FK_LJ
    nop [2]                     ; bit stuffing
low1:
    set y BR side FJ_LK

check_eop2:
    jmp !osre load_bit2
    jmp send_eop [1]
load_bit2:
    out x, 1
    jmp !x low2
high2:
    jmp y-- check_eop2 side FJ_LK
    nop [2]                     ; bit stuffing
low2:
    set y BR side FK_LJ
.wrap

; USB transmitter for PRE packet (No EOP)
; Run at 48 MHz for full-spped
; autopull enabled
.program usb_tx_pre_dmdp
.side_set 2 opt

.define J 0b10
.define K 0b01
.define SE0 0b00
.define BR 5         ; bit repeat limit
.define public IRQ_COMP 0   ; complete flag bit
.define public IRQ_EOP 1   ; EOP start flag bit

start:
    set y, BR side J
    set pindirs, 0b11

.wrap_target
check_eop1:
    jmp !osre load_bit1
    nop [1]
send_eop:
    irq IRQ_EOP side J [3]
    set pindirs, 0b00
    nop ; to align program size
    nop ; to align program size
    irq wait IRQ_COMP
    jmp start
load_bit1:
    out x, 1
    jmp !x low1
high1:
    jmp y-- check_eop1 side J
    nop [2]                     ; bit stuffing
low1:
    set y BR side K

check_eop2:
    jmp !osre load_bit2
    jmp send_eop [1]
load_bit2:
    out x, 1
    jmp !x low2
high2:
    jmp y-- check_eop2 side K
    nop [2]                     ; bit stuffing
low2:
    set y BR side J
.wrap


% c-sdk {
#include "hardware/clocks.h"

  static void __no_inline_not_in_flash_func(usb_tx_configure_pins)(PIO pio, uint sm, uint pin_dp, uint pin_dm) {
    if (pin_dp < pin_dm) {
      pio_sm_set_out_pins(pio, sm, pin_dp, 2);
      pio_sm_set_set_pins(pio, sm, pin_dp, 2);
      pio_sm_set_sideset_pins(pio, sm, pin_dp);
    } else {
      pio_sm_set_out_pins(pio, sm, pin_dm, 2);
      pio_sm_set_set_pins(pio, sm, pin_dm, 2);
      pio_sm_set_sideset_pins(pio, sm, pin_dm);
    }
  }

  static inline void usb_tx_fs_program_init(PIO pio, uint sm, uint offset,
                                         uint pin_dp, uint pin_dm) {
    pio_sm_set_pins_with_mask(pio, sm, (1 << pin_dp), ((1 << pin_dp) | (1 << pin_dm)));

    gpio_pull_down(pin_dp);
    gpio_pull_down(pin_dm);
    pio_gpio_init(pio, pin_dp);
    pio_gpio_init(pio, pin_dm);

    pio_sm_config c = usb_tx_dpdm_program_get_default_config(offset);

    // shifts to left, autopull, 8bit
    sm_config_set_out_shift(&c, true, true, 8);

    sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);

    // run at 48MHz
    // clk_sys should be multiply of 12MHz
    float div = (float)clock_get_hz(clk_sys) / (48000000UL);
    sm_config_set_clkdiv(&c, div);

    pio_sm_init(pio, sm, offset, &c);
    usb_tx_configure_pins(pio, sm, pin_dp, pin_dm);
    pio_sm_set_enabled(pio, sm, true);
  }

  static inline void usb_tx_ls_program_init(PIO pio, uint sm, uint offset,
                                         uint pin_dp, uint pin_dm) {
    pio_sm_set_pins_with_mask(pio, sm, (1 << pin_dm), ((1 << pin_dp) | (1 << pin_dm)));

    gpio_pull_down(pin_dp);
    gpio_pull_down(pin_dm);
    pio_gpio_init(pio, pin_dp);
    pio_gpio_init(pio, pin_dm);

    pio_sm_config c = usb_tx_dmdp_program_get_default_config(offset);

    // shifts to left, autopull, 8bit
    sm_config_set_out_shift(&c, true, true, 8);

    sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);

    // run at 6MHz
    // clk_sys should be multiply of 12MHz
    float div = (float)clock_get_hz(clk_sys) / (6000000UL);
    sm_config_set_clkdiv(&c, div);

    pio_sm_init(pio, sm, offset, &c);
    usb_tx_configure_pins(pio, sm, pin_dp, pin_dm);
    pio_sm_set_enabled(pio, sm, true);
  }

%}

================================================
FILE: Pico-PIO-USB/src/usb_tx.pio.h
================================================
// -------------------------------------------------- //
// This file is autogenerated by pioasm; do not edit! //
// -------------------------------------------------- //

#pragma once

#if !PICO_NO_HARDWARE
#include "hardware/pio.h"
#endif

#define USB_TX_EOP_OFFSET 4
#define USB_TX_EOP_DISABLER_LEN 4

// ----------- //
// usb_tx_dpdm //
// ----------- //

#define usb_tx_dpdm_wrap_target 2
#define usb_tx_dpdm_wrap 21

#define usb_tx_dpdm_IRQ_COMP 0
#define usb_tx_dpdm_IRQ_EOP 1

static const uint16_t __not_in_flash("tx_program") usb_tx_dpdm_program_instructions[] = {
    0xf445, //  0: set    y, 5            side 1     
    0xe083, //  1: set    pindirs, 3                 
            //     .wrap_target
    0x00ea, //  2: jmp    !osre, 10                  
    0xa142, //  3: nop                           [1] 
    0xd301, //  4: irq    nowait 1        side 0 [3] 
    0xa342, //  5: nop                           [3] 
    0xb442, //  6: nop                    side 1     
    0xe380, //  7: set    pindirs, 0             [3] 
    0xc020, //  8: irq    wait 0                     
    0x0000, //  9: jmp    0                          
    0x6021, // 10: out    x, 1                       
    0x002e, // 11: jmp    !x, 14                     
    0x1482, // 12: jmp    y--, 2          side 1     
    0xa242, // 13: nop                           [2] 
    0xf845, // 14: set    y, 5            side 2     
    0x00f1, // 15: jmp    !osre, 17                  
    0x0104, // 16: jmp    4                      [1] 
    0x6021, // 17: out    x, 1                       
    0x0035, // 18: jmp    !x, 21                     
    0x188f, // 19: jmp    y--, 15         side 2     
    0xa242, // 20: nop                           [2] 
    0xf445, // 21: set    y, 5            side 1     
            //     .wrap
};

#if !PICO_NO_HARDWARE
static const struct pio_program __not_in_flash("tx_program") usb_tx_dpdm_program = {
    .instructions = usb_tx_dpdm_program_instructions,
    .length = 22,
    .origin = -1,
};

static inline pio_sm_config usb_tx_dpdm_program_get_default_config(uint offset) {
    pio_sm_config c = pio_get_default_sm_config();
    sm_config_set_wrap(&c, offset + usb_tx_dpdm_wrap_target, offset + usb_tx_dpdm_wrap);
    sm_config_set_sideset(&c, 3, true, false);
    return c;
}
#endif

// --------------- //
// usb_tx_pre_dpdm //
// --------------- //

#define usb_tx_pre_dpdm_wrap_target 2
#define usb_tx_pre_dpdm_wrap 21

#define usb_tx_pre_dpdm_IRQ_COMP 0
#define usb_tx_pre_dpdm_IRQ_EOP 1

static const uint16_t __not_in_flash("tx_program") usb_tx_pre_dpdm_program_instructions[] = {
    0xf445, //  0: set    y, 5            side 1     
    0xe083, //  1: set    pindirs, 3                 
            //     .wrap_target
    0x00ea, //  2: jmp    !osre, 10                  
    0xa142, //  3: nop                           [1] 
    0xd701, //  4: irq    nowait 1        side 1 [3] 
    0xe080, //  5: set    pindirs, 0                 
    0xa042, //  6: nop                               
    0xa042, //  7: nop                               
    0xc020, //  8: irq    wait 0                     
    0x0000, //  9: jmp    0                          
    0x6021, // 10: out    x, 1                       
    0x002e, // 11: jmp    !x, 14                     
    0x1482, // 12: jmp    y--, 2          side 1     
    0xa242, // 13: nop                           [2] 
    0xf845, // 14: set    y, 5            side 2     
    0x00f1, // 15: jmp    !osre, 17                  
    0x0104, // 16: jmp    4                      [1] 
    0x6021, // 17: out    x, 1                       
    0x0035, // 18: jmp    !x, 21                     
    0x188f, // 19: jmp    y--, 15         side 2     
    0xa242, // 20: nop                           [2] 
    0xf445, // 21: set    y, 5            side 1     
            //     .wrap
};

#if !PICO_NO_HARDWARE
static const struct pio_program __not_in_flash("tx_program") usb_tx_pre_dpdm_program = {
    .instructions = usb_tx_pre_dpdm_program_instructions,
    .length = 22,
    .origin = -1,
};

static inline pio_sm_config usb_tx_pre_dpdm_program_get_default_config(uint offset) {
    pio_sm_config c = pio_get_default_sm_config();
    sm_config_set_wrap(&c, offset + usb_tx_pre_dpdm_wrap_target, offset + usb_tx_pre_dpdm_wrap);
    sm_config_set_sideset(&c, 3, true, false);
    return c;
}
#endif

// ----------- //
// usb_tx_dmdp //
// ----------- //

#define usb_tx_dmdp_wrap_target 2
#define usb_tx_dmdp_wrap 21

#define usb_tx_dmdp_IRQ_COMP 0
#define usb_tx_dmdp_IRQ_EOP 1

static const uint16_t __not_in_flash("tx_program") usb_tx_dmdp_program_instructions[] = {
    0xf845, //  0: set    y, 5            side 2     
    0xe083, //  1: set    pindirs, 3                 
            //     .wrap_target
    0x00ea, //  2: jmp    !osre, 10                  
    0xa142, //  3: nop                           [1] 
    0xd301, //  4: irq    nowait 1        side 0 [3] 
    0xa342, //  5: nop                           [3] 
    0xb842, //  6: nop                    side 2     
    0xe380, //  7: set    pindirs, 0             [3] 
    0xc020, //  8: irq    wait 0                     
    0x0000, //  9: jmp    0                          
    0x6021, // 10: out    x, 1                       
    0x002e, // 11: jmp    !x, 14                     
    0x1882, // 12: jmp    y--, 2          side 2     
    0xa242, // 13: nop                           [2] 
    0xf445, // 14: set    y, 5            side 1     
    0x00f1, // 15: jmp    !osre, 17                  
    0x0104, // 16: jmp    4                      [1] 
    0x6021, // 17: out    x, 1                       
    0x0035, // 18: jmp    !x, 21                     
    0x148f, // 19: jmp    y--, 15         side 1     
    0xa242, // 20: nop                           [2] 
    0xf845, // 21: set    y, 5            side 2     
            //     .wrap
};

#if !PICO_NO_HARDWARE
static const struct pio_program __not_in_flash("tx_program") usb_tx_dmdp_program = {
    .instructions = usb_tx_dmdp_program_instructions,
    .length = 22,
    .origin = -1,
};

static inline pio_sm_config usb_tx_dmdp_program_get_default_config(uint offset) {
    pio_sm_config c = pio_get_default_sm_config();
    sm_config_set_wrap(&c, offset + usb_tx_dmdp_wrap_target, offset + usb_tx_dmdp_wrap);
    sm_config_set_sideset(&c, 3, true, false);
    return c;
}
#endif

// --------------- //
// usb_tx_pre_dmdp //
// --------------- //

#define usb_tx_pre_dmdp_wrap_target 2
#define usb_tx_pre_dmdp_wrap 21

#define usb_tx_pre_dmdp_IRQ_COMP 0
#define usb_tx_pre_dmdp_IRQ_EOP 1

static const uint16_t __not_in_flash("tx_program") usb_tx_pre_dmdp_program_instructions[] = {
    0xf845, //  0: set    y, 5            side 2     
    0xe083, //  1: set    pindirs, 3                 
            //     .wrap_target
    0x00ea, //  2: jmp    !osre, 10                  
    0xa142, //  3: nop                           [1] 
    0xdb01, //  4: irq    nowait 1        side 2 [3] 
    0xe080, //  5: set    pindirs, 0                 
    0xa042, //  6: nop                               
    0xa042, //  7: nop                               
    0xc020, //  8: irq    wait 0                     
    0x0000, //  9: jmp    0                          
    0x6021, // 10: out    x, 1                       
    0x002e, // 11: jmp    !x, 14                     
    0x1882, // 12: jmp    y--, 2          side 2     
    0xa242, // 13: nop                           [2] 
    0xf445, // 14: set    y, 5            side 1     
    0x00f1, // 15: jmp    !osre, 17                  
    0x0104, // 16: jmp    4                      [1] 
    0x6021, // 17: out    x, 1                       
    0x0035, // 18: jmp    !x, 21                     
    0x148f, // 19: jmp    y--, 15         side 1     
    0xa242, // 20: nop                           [2] 
    0xf845, // 21: set    y, 5            side 2     
            //     .wrap
};

#if !PICO_NO_HARDWARE
static const struct pio_program __not_in_flash("tx_program") usb_tx_pre_dmdp_program = {
    .instructions = usb_tx_pre_dmdp_program_instructions,
    .length = 22,
    .origin = -1,
};

static inline pio_sm_config usb_tx_pre_dmdp_program_get_default_config(uint offset) {
    pio_sm_config c = pio_get_default_sm_config();
    sm_config_set_wrap(&c, offset + usb_tx_pre_dmdp_wrap_target, offset + usb_tx_pre_dmdp_wrap);
    sm_config_set_sideset(&c, 3, true, false);
    return c;
}

#include "hardware/clocks.h"
  static void __no_inline_not_in_flash_func(usb_tx_configure_pins)(PIO pio, uint sm, uint pin_dp, uint pin_dm) {
    if (pin_dp < pin_dm) {
      pio_sm_set_out_pins(pio, sm, pin_dp, 2);
      pio_sm_set_set_pins(pio, sm, pin_dp, 2);
      pio_sm_set_sideset_pins(pio, sm, pin_dp);
    } else {
      pio_sm_set_out_pins(pio, sm, pin_dm, 2);
      pio_sm_set_set_pins(pio, sm, pin_dm, 2);
      pio_sm_set_sideset_pins(pio, sm, pin_dm);
    }
  }
  static inline void usb_tx_fs_program_init(PIO pio, uint sm, uint offset,
                                         uint pin_dp, uint pin_dm) {
    pio_sm_set_pins_with_mask(pio, sm, (1 << pin_dp), ((1 << pin_dp) | (1 << pin_dm)));
    gpio_pull_down(pin_dp);
    gpio_pull_down(pin_dm);
    pio_gpio_init(pio, pin_dp);
    pio_gpio_init(pio, pin_dm);
    pio_sm_config c = usb_tx_dpdm_program_get_default_config(offset);
    // shifts to left, autopull, 8bit
    sm_config_set_out_shift(&c, true, true, 8);
    sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
    // run at 48MHz
    // clk_sys should be multiply of 12MHz
    float div = (float)clock_get_hz(clk_sys) / (48000000UL);
    sm_config_set_clkdiv(&c, div);
    pio_sm_init(pio, sm, offset, &c);
    usb_tx_configure_pins(pio, sm, pin_dp, pin_dm);
    pio_sm_set_enabled(pio, sm, true);
  }
  static inline void usb_tx_ls_program_init(PIO pio, uint sm, uint offset,
                                         uint pin_dp, uint pin_dm) {
    pio_sm_set_pins_with_mask(pio, sm, (1 << pin_dm), ((1 << pin_dp) | (1 << pin_dm)));
    gpio_pull_down(pin_dp);
    gpio_pull_down(pin_dm);
    pio_gpio_init(pio, pin_dp);
    pio_gpio_init(pio, pin_dm);
    pio_sm_config c = usb_tx_dmdp_program_get_default_config(offset);
    // shifts to left, autopull, 8bit
    sm_config_set_out_shift(&c, true, true, 8);
    sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
    // run at 6MHz
    // clk_sys should be multiply of 12MHz
    float div = (float)clock_get_hz(clk_sys) / (6000000UL);
    sm_config_set_clkdiv(&c, div);
    pio_sm_init(pio, sm, offset, &c);
    usb_tx_configure_pins(pio, sm, pin_dp, pin_dm);
    pio_sm_set_enabled(pio, sm, true);
  }

#endif



================================================
FILE: README.md
================================================
# DeskHop - Fast Desktop Switching

Did you ever notice how, in the crazy world of tech, there's always that one quirky little project trying to solve a problem so niche that its only competitors might be a left-handed screwdriver and a self-hiding alarm clock?

I use two different computers in my daily workflow and share a single keyboard/mouse pair between them. Trying several USB switching boxes found on Amazon made me realize they all suffer from similar issues - it takes a while to switch, the process is quite clumsy when trying to find the button and frankly, it just doesn't get any better with time.

All I wanted was a way to use a keyboard shortcut to quickly switch outputs, paired with the ability to do the same by magically moving the mouse pointer between monitors. This project enables you to do both, even if your computers run different operating systems!

![DeskHop case and board](img/case_and_board_s.png)

## Features

- Completely **[free and open source](https://certification.oshwa.org/de000149.html)**
- No noticeable delay when switching
- Simply drag the mouse pointer between computers
- No software installed
- Affordable and obtainable components (<15€)
- 3D printable snap-fit case
- Full Galvanic isolation between your outputs
- Works with Linux, macOS and Windows

[User Manual](misc/user-manual.pdf) is now available

![Open Source Hardware Logo](img/oshw.svg)

------

## How it works

The device acts as an intermediary between your keyboard/mouse and the computer, establishing and maintaining connections with both computers at once. Then it chooses where to forward your mouse and keystrokes to, depending on your selection. Keyboard follows the mouse and vice versa, so just dragging the mouse to the other desktop will switch both.

## Mouse

To get the mouse cursor to magically jump across, the mouse hid report descriptor was changed to use absolute coordinates and then the mouse reports (that still come in relative movements) accumulate internally, keeping the accurate tally on the position.

When you try to leave the monitor area in the direction of the other monitor, it keeps the Y coordinate and swaps the maximum X for a minimum X, then flips the outputs. This ensures that the cursor seamlessly appears at the same height on the other monitor, enhancing the perception of a smooth transition.

![DeskHop Mouse Demo](img/deskhop-demo.gif)

<p align="center"> Dragging the mouse from Mac to Linux automatically switches outputs. </p>

------

The actual switch happens at the very moment when one arrow stops moving and the other one starts.

## Keyboard

Acting as a USB Host and querying your keyboard periodically, it looks for a preconfigured hotkey in the hid report (usually Ctrl + Caps Lock for me). When found, it will forward all subsequent characters to the other output.

To have a visual indication which output you are using at any given moment, you can repurpose keyboard LEDs and have them provide the necessary feedback.

It also remembers the LED state for each computer, so you can pick up exactly how you left it.

![DeskHop Typing Demo](img/demo-typing.gif)

## How to build

To avoid version mismatch and reported path issues when building, as well as to save you from having to download a large SDK, the project now bundles minimal pico sdk and tinyusb.

On a Debian/Ubuntu systems, make sure to install these:

```shell
apt update
apt install \
    build-essential \
    cmake \
    gcc-arm-none-eabi \
    libnewlib-arm-none-eabi \
    python3
```

You should be able to build by running:

```shell
cmake -S . -B build
cmake --build build
```

additionally, to rebuild web UI check webconfig/ and execute ```./render.py```, you'll need jinja2 installed.

An alternative can be to use docker via 'docker compose' or 'docker-compose':
```
docker-compose -f misc/docker.yml run --rm build_container
```
This ensures reproducible builds.

To rebuild the disk, check disk/ folder and run ```./create.sh```, tweak to your system if needed. You'll need **dosfstools** (to provide mkdosfs),

## Using a pre-built image

Alternatively, you can use the [pre-built images](https://github.com/hrvach/deskhop/releases). Since version 0.6 there is only a single universal image. You need the .uf2 file which you simply copy to the device in one of the following ways:

## Upgrading firmware

**Option 1** - (firmware 0.6 and later) Put the device in "config mode" by simultaneously pressing **left ctrl + right shift + c + o**. Device your keyboard is plugged into will reboot and turn into a USB drive called "DESKHOP". All you need to do is copy the .uf2 file to it. Once image is verified, device will flash and reboot, then proceed to upgrade the other board. During this operation the led will blink. Once it's done, it will write flash and reboot, completing the operation.

_Note_ - This is not an actual generic USB drive, you can't use it to copy files to it.

**Option 2** - Using the ROM bootloader - hold the on-board button while connecting each Pico and copy the uf2 to the flash drive that appears. Images later than 0.6 support holding the button without having to fiddle around the power supply, but the "hold button while plugging" should always work, regardless of device state.

**Option 3** - CDC Flash Command (Debug builds only) - If the firmware was built with `DH_DEBUG_CDC_FLASH=ON`, you can trigger bootloader mode via CDC serial command:
```shell
echo -n 'flash' > /dev/tty.usbmodem11104
```
This immediately resets the device into bootloader mode where it appears as "RPI-RP2" drive. This feature is intended for development workflows.

## Misc features

### Mouse slowdown

Ever tried to move that YT video slider to a specific position but your mouse moves too jumpy and suddenly you are moving your hand super-carefully like you're 5 and playing "Operation" all over again?

**Press right CTRL + right ALT** to toggle a slow-mouse mode. The mouse pointer will slow down considerably, enabling you to get the finer precision work done and still have your mouse moving normally by quickly pressing the same keys again.

### Switch Lock

If you want to lock yourself to one screen, use ```RIGHT CTRL + K```.
This will make sure you won't accidentally leave your current screen. To turn off, press the same key combo again.

### Lock Both Screens

You can lock both computers at once by using ```RIGHT CTRL + L```.
To make use of this feature, first set up the OS for each output in config (since the shortcuts are different).

### Gaming Mode

If you're gaming, there is a chance your game might not work properly with absolute mouse mode. To address that issue, a **gaming mode** is introduced, toggled by ```LEFT CTRL + RIGHT SHIFT + G```. When in gaming mode, you are locked to the current screen and your mouse behaves like a standard relative mouse. This should also fix various virtual machine issues, currently unsupported operating systems etc.

### Screensaver

Supposedly built in to prevent computer from entering standby, but truth be told - it is just fun to watch. **Off by default**, will make your mouse pointer bounce around the screen like a Pong ball. When enabled, it activates after a period of inactivity defined in user config header and automatically switches off as soon as you send any output towards that screen.

Potential usage example - I have a buggy USB dock that won't resume video from standby, so not allowing it to sleep can be a handy workaround.

## Hardware

[The circuit](schematics/DeskHop_v1.1.pdf) is based on two Raspberry Pi Pico boards, chosen because they are cheap (4.10 € / pc), can be hand soldered and most suppliers have them in stock.

The Picos are connected using UART and separated by an Analog Devices ADuM1201 dual-channel digital isolator (~3€) or a much cheaper, faster and pin-compatible TI ISO7721DR (~1.5€) which is the preferred choice.

While they normally don't have support for dual USB, thanks to an [amazing project](https://github.com/sekigon-gonnoc/Pico-PIO-USB) where USB is implemented using the programmable IO wizardry found in RP2040, there is support for it to act both as an USB host and device.

## PCB [updated]

To keep things as simple as possible for DIY builds, the traces were kept on one side and the number of parts kept to a minimum.

![PCB Image](img/plocica2.png)

USB D+/D- differential lines should be identical in length, but they are slightly asymmetrical on purpose to counter the length difference on the corresponding GPIO traces PICO PCB itself, so the overall lengths should match.

Zd (differential impedance) is aimed as 90 ohm (managed to get ~107, close enough :)).

The thickness is designed to be 1.6 mm for snap-fit to work as expected.

There are 2 versions of the PCB (no major differences for the user). Original (v1.0) is easier to solder and assemble, while v1.1 offers some upgrades like:

- added ESD protection (TPD4E1U06DBVR)
- added VBUS capacitor for the keyboard/mouse connectors
- silkscreen orientation markings
- holes for clone boards with headers pre-soldered and easier alignment
- USB 27 ohm resistors

  This version is slightly more difficult to hand solder due to the small transient voltage suppressor IC and 0805 resistors, but it's totally doable. TVS can in theory be omitted (not advised) and it will still work.

Upcoming - board with bare rp2040s that doesn't need Picos, is smaller and more convenient.

## Case

Since I'm not very good with 3d, the case is [simple and basic](case/) but does the job. It should be easy to print, uses ~33g of filament and takes a couple of hours.

Horizontal PCB movements are countered by pegs sliding through holes and vertical movements by snap-fit lugs on the sides - no screws required. The case was given a slight redesign to feature the logo and two additional snap-fit lugs, so it provides a better seal.

Micro USB connectors on both boards are offset from the side of the case, so slightly larger holes should allow for cables to reach in.

The lid is of a snap-fit design, with a screwdriver slot for opening. The markings on top are recessed and can be finished with e.g. crayons to give better contrast (or simply left as-is).

![DeskHop with 3D Printed Case](img/deskhop-case.gif)

## Bill of materials

<details closed>
  <summary>Click here to view original PCB v1.0 BOM</summary>

| Component          | Qty | Unit Price / € | Price / €|
|--------------------|-----|----------------|----------|
| Raspberry Pi Pico  | 2   | 4.10           | 8.20     |
| ADuM1201BRZ        | 1   | 2.59           | 2.59     |
| Cap 1206 SMD 100nF | 2   | 0.09           | 0.18     |
| USB-A PCB conn.    | 2   | 0.20           | 0.40     |
| Headers 2.54 1x03  | 2   | 0.08           | 0.16     |
|                    |     |                |          |
|                    |     |          Total | 11.53    |

TI ISO7721DR can be used instead of the ADuM - it's pin-compatible, much cheaper and with better specs.

</details>

### PCB v1.1

| Component      | Part                | Qty | Unit Price / € | Price / €|
|----------------|---------------------|-----|----------------|----------|
|     U1, U2     | Raspberry Pi Pico   | 2   | 4.10           | 8.20     |
|     J1, J4     | USB-A PCB conn.     | 2   | 0.20           | 0.40     |
|       U4       | TI ISO7721DR        | 1   | 1.40           | 1.40     |
|                | (**OR** ADuM1201BRZ)|     |                |          |
|     C1, C2     | Cap 0805 SMD 100nF  | 2   | 0.09           | 0.18     |
| R1, R2, R3, R4 | Res 0805 SMD 27ohm  | 4   | 0.03           | 0.12     |
|     U3, U5     | TPD4E1U06DBVR       | 2   | 0.31           | 0.62     |
|     C3, C4     | Cap 4.7uF SMD 0805  | 2   | 0.07           | 0.14     |
|     J2, J3     | Headers 2.54 1x03   | 2   | 0.08           | 0.16     |
|                |                     |     |                |          |
|                |                     |     |          Total | 11.22    |

USB-A connector can be Molex MX-67643-0910 or a cheaper/budget one that shares the same dimensions.

Additional steps:

- making the PCB ([Gerber provided](pcb/), choose 1.6 mm thickness)
- 3d printing the case ([stl files provided](case/), ~33g filament)

## Assembly guide

If you have some experience with electronics, you don't need this. However, some of you might not, and in that case this video might help guide you through the process. Please note, after soldering you should clean the flux from the PCB to prevent corrosion.

The standard process to do that is using isopropyl alcohol and an old toothbrush. But guess what? I'm not putting my old toothbrush online, so you'll just have to improvise that part :)

[![PCB Assembly Guide](img/yt-video-s.jpg)](https://www.youtube.com/watch?v=LxI9NYi_oOU)

[NOTE] The video assembly guide covers pcb v1.0. The revised version is very similar and the procedure is basically the same.

## Usage guide

### Keyboard shortcuts - (fw versions 0.68+)

_Config_:

- ~~```Left Shift```~~ ```Left Ctrl + Right Shift + C + O``` - enter config mode
- ```Right Shift + F12 + D``` - remove flash config
- ```Right Shift + F12 + Y``` - save screen switch offset

_Usage_:

- ```Right CTRL + Right ALT``` - Toggle slower mouse mode
- ```Right CTRL + K``` - Lock/Unlock mouse desktop switching
- ```Right CTRL + L``` - Lock both outputs at once (set output OS before, see shortcuts below)
- ~~```Left Shift```~~ ```Left CTRL + Right Shift + G``` - Toggle gaming mode (lock to screen, act as standard mouse)
- ```Left CTRL + Right Shift + S``` - Enable screensaver
- ```Left CTRL + Right Shift + X``` - Disable screensaver
- ```Left CTRL + Caps Lock``` - Switch between outputs

Note: some keyboards don't send both shifts at the same time properly, that's why the shortcut was changed - to work for everyone. Apologies for the confusion.

### Switch cursor height calibration

This step is not required, but it can be handy if your screens are not perfectly aligned or differ in size. The objective is to have the mouse pointer come out at exactly the same height.

![Border height difference](img/border_top_s.png)

Just park your mouse on the LARGER screen at the height of the smaller/lower screen (illustrated) and press ```Right Shift + F12 + Y```. Your LED (and caps lock) should flash in confirmation.

Repeat for the bottom border (if it's above the larger screen's border). This will get saved to flash and it should keep this calibration value from now on.

### Multiple screens per output

Windows and Mac have issues with multiple screens and absolute positioning, so workarounds are needed (still experimental). There is a better workaround under construction, but for now you have to set the operating system for each output and number of screens.

Your main screens need to be in the middle, and secondary screen(s) on the edges. To configure the actual options, open the web configuration page for your device.

![Multiple screens per output](img/deskhop-scr.png)

### Web configuration mode

Starting with fw 0.6, an improved configuration mode is introduced. To configure your device, follow these instructions:

1. Press Left Ctrl + Right Shift + C + O - your device will reboot and enter configuration mode (on the side your keyboard is plugged into). LED will keep blinking during the configuration session.

1. A new USB drive will appear named "DESKHOP" with a single file, config.htm

1. Open that file with Chromium / Chrome. Unfortunately FF is not supported right now, since they avoid implementing WebHID.

1. Click connect and allow deskhop device to pair.

   ![Web Browser with URL](img/connect-dialog.png)

1. Configure the options as you wish and click save to write to device.

1. Click "exit" in the menu to leave configuration mode for added safety.

   ![Web Config](img/config-page-big.png)

<details closed>
  <summary>Linux doesn't see device? Click here.</summary>

**Q**: Chromium on Linux doesn't work.

**A**: You probably need to tweak /dev permissions or create a corresponding udev rules file and make sure your user is in the right group, like so:

/etc/udev/rules.d/99-deskhop.rules

```plain
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1209", ATTRS{idProduct}=="c000", GROUP="plugdev", MODE="0660"
```

</details><br />

**Q**: Why not simply create a nice online web page like Via instead of dealing with this weird USB drive thing?

**A**: Loading javascript from a random online location that interacts with your input devices is a potential security risk. The configuration web page is local only and nothing is ever loaded externally.

Please note the config web page is not "weird" because of deliberate obfuscation - it's self-decompressing due to very limited storage. Entire source is 100% open and a part of this repo. You are encouraged to rebuild everything yourself.

### Functional verification

When you connect a new USB peripheral, the board will flash the led twice, and instruct the other board to do the same. This way you can test if USB and outgoing communication works for each board.

Do this test by first plugging the keyboard on one side and then on the other. If everything is OK, leds will flash quickly back and forth in both cases.

## Security and Safety

Some features are missing on purpose, despite the fact it would make the device easier to use or simpler to configure. Here is a quick breakdown of these decisions:

- There is no copy-paste or _any_ information sharing between systems. This prevents information leakage.
- No webhid device management without explicit user consent. No inbound connectivity from the output computers, with the only exception of standard keyboard LED on/off messages and hard limited to 1 byte of data.
- No FW upgrade triggering from the outputs. Only explicit and deliberate user action through a special keyboard shortcut may do that.
- No plugged-in keyboard/mouse custom endpoints are exposed or information forwarded towards these devices. Their potential vulnerabilities are effectively firewalled from the computer.
- No input history is allowed to be retained.
- No device-initiated keystrokes, for any reason. Only thing that comes out is what you type/trigger.
- Outputs are physically separated and galvanically isolated with a minimal isolation voltage of 2kV.
- All packets exchanged between devices are of fixed length, config options transferred are limited to a short list. Most options are read-only. Cross-device firmware upgrades can be disabled.
- There is no bluetooth or wifi, networking, Internet access, etc.
- No connected computer is considered trusted under any circumstances.
- Configuration mode is automatically disabled after a period of inactivity.
- Entirety of the code is open source, without any binary blobs and thoroughly commented to explain its purpose. I encourage you to never trust anyone and always make sure you know what you are running by doing a manual audit.

This still doesn't guarantee anything, but I believe it makes a reasonable set of ground rules to keep you safe and protected.

## FAQ

1. I just have two Picos, can I do without a PCB and isolator?

   _Sure. Having an isolator is recommended but it should work without it._

1. What happens if I have two different resolutions on my monitors?

   _The mouse movement is done in abstract coordinate space and your computer figures out how that corresponds with the physical screen, so it should just work._

1. Where can I buy it?

   _I'm not selling anything, this is just a personal, non-commercial hobby project._

   _**UPDATE 1**: It seems you can order it in QTY of 1 (for either PCB, assembled PCB or a fully assembled device) from [Elecrow if you follow this link](https://www.elecrow.com/deskhop-fast-desktop-switching.html)_
   _As reported by users, your **board will arrive blank** and you have to write the firmware yourself._

   _**UPDATE 2**: I never asked Elecrow for anything, but a couple of days ago they offered to sponsor the project with a small budget that will be used for future board prototyping. Since my goal is to create a better board with more than 2 outputs etc, I believe prototyping services might be beneficial to the project._

1. When the active screen is changed via the mouse, does the keyboard follow (and vice versa)?

   _Yes, the idea was to make it behave like it was one single computer._

1. Will this work with keyboard/mouse combo dongles, like the Logitech Unifying receiver?

   _It should work. After a recent FW update, support for combo receivers should be much better._

1. Will this work with wireless mice and keyboards that have separate wireless receivers (one for the mouse, another for the keyboard)?

   _It should work - tried an Anker wireless mouse with a separate receiver and that worked just fine._

1. I have issues with build or compilation

   _Check out the [Troubleshooting Wiki](https://github.com/hrvach/deskhop/wiki/Troubleshooting) that might have some answers._

## Software Alternatives

There are several software alternatives you can use if that works in your particular situation.

1. [Barrier](https://github.com/debauchee/barrier) - Free, Open Source
1. [Input Leap](https://github.com/input-leap/input-leap) - Free, Open Source
1. [Synergy](https://symless.com/synergy) - Commercial
1. [Mouse Without Borders](https://www.microsoft.com/en-us/garage/wall-of-fame/mouse-without-borders/) - Free, Windows only
1. [Universal Control](https://support.apple.com/en-my/HT212757) - Free, Apple thing

## Shortcomings

- Windows 10 broke HID absolute coordinates behavior in KB5003637, so you can't use more than 1 screen on Windows (mouse will stay on the main screen). There is an experimental workaround with a better one on the way.
- Code needs cleanup, some refactoring etc.
- Not tested with a wide variety of devices, I don't know how it will work with your hardware. There is a reasonable chance things might not work out-of-the-box.
- Advanced keyboards (with knobs, extra buttons or sliders) will probably face issues where this additional hardware doesn't work.
- Super-modern mice with 300 buttons might see some buttons not work as expected.
- NOTE: **Both computers need to be connected and provide power to the USB for this to work** (as each board gets powered by the computer it plugs into). Many desktops and laptops will provide power even when shut down nowadays. If you need to run with one board fully disconnected, you should be able to use a USB hub to plug both keyboard and mouse to a single port.
- MacOS has issues with more than one screens, latest firmware offers an experimental workaround that fixes it.

## Progress

So, what's the deal with all the enthusiasm? I can't believe it - please allow me to thank you all! I've never expected this kind of interest in a simple personal project, so the initial features are pretty basic (just like my cooking skills) and mostly cover my own usecase. Stay tuned for firmware updates that should bring wider device compatibility, more features and less bugs. As this is a hobby project, I appreciate your understanding for being time-constrained and promise to do the best I can.

Planned features:

- Better workarounds for multiscreen windows and macos
- Transparent / Gaming mode
- Support for more than 2 outputs
- Improvements on the configuration UI
- ... and more!

Working on a _lite_ version which provides basic functionality with just a single Pico W board, lowering the cost even further and enabling you to try it out even with no added hardware or PCB.

Mouse polling should now work at 1000 Hz (the dips in the graph is my arm hurting from all the movement :-)):

![Mouse polling rate](img/polling_rate.png)

## Sponsor / donate

I'm NOT doing this for profit or any other reason except to try and help people by creating a better working environment for everyone.
If you want to support the project further, please consider making a small donation towards a charity like **Doctors Without Borders**.

[![Donate to Doctors Without Borders, with PayPal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://donate.doctorswithoutborders.org/secure/donate)

Please allow me to thank everyone who helped or considering it!

## Disclaimer

I kindly request that anyone attempting to build this project understands and acknowledges that I am not liable for any injuries, damages, or other consequences. Your safety is important, and I encourage you to approach this project carefully, taking necessary precautions and assuming personal responsibility for your well-being throughout the process. Please don't get electrocuted, burned, stressed or angry. Have fun and enjoy!

Happy switchin'!


================================================
FILE: case/deskhop_case.step
================================================
ISO-10303-21;
HEADER;
/* Generated by software containing ST-Developer
 * from STEP Tools, Inc. (www.steptools.com) 
 */

FILE_DESCRIPTION(
/* description */ (''),
/* implementation_level */ '2;1');

FILE_NAME(
/* name */ 'DeskHop 3D Case.step',
/* time_stamp */ '2023-12-30T05:05:56-08:00',
/* author */ (''),
/* organization */ (''),
/* preprocessor_version */ 'ST-DEVELOPER v20',
/* originating_system */ 'Autodesk Translation Framework v12.14.0.127',

/* authorisation */ '');

FILE_SCHEMA (('AUTOMOTIVE_DESIGN { 1 0 10303 214 3 1 1 }'));
ENDSEC;

DATA;
#10=MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION('',(#717,#718,
#719,#720,#721,#722,#723,#724,#725,#726,#727,#728,#729,#730,#731,#732,#733,
#734,#735,#736,#737,#738,#739,#740,#741,#742,#743,#744,#745,#746,#747,#748,
#749,#750,#751,#752,#753,#754,#755,#756,#757,#758,#759,#760,#761,#762,#763,
#764,#765,#76
Download .txt
gitextract_phg38h2d/

├── .github/
│   └── workflows/
│       └── build.yml
├── .gitignore
├── CMakeLists.txt
├── LICENSE
├── Pico-PIO-USB/
│   ├── CMakeLists.txt
│   └── src/
│       ├── pio_usb.c
│       ├── pio_usb.h
│       ├── pio_usb_configuration.h
│       ├── pio_usb_device.c
│       ├── pio_usb_host.c
│       ├── pio_usb_ll.h
│       ├── usb_crc.c
│       ├── usb_crc.h
│       ├── usb_definitions.h
│       ├── usb_rx.pio
│       ├── usb_rx.pio.h
│       ├── usb_tx.pio
│       └── usb_tx.pio.h
├── README.md
├── case/
│   ├── bottom.stl
│   ├── deskhop_case.f3d
│   ├── deskhop_case.step
│   └── top.stl
├── disk/
│   ├── create.sh
│   ├── disk.S
│   └── disk.img
├── misc/
│   ├── .clang-format
│   ├── .editorconfig
│   ├── .markdownlint.yaml
│   ├── Dockerfile
│   ├── crc32.py
│   ├── docker.yml
│   └── memory_map.ld
├── pcb/
│   ├── v1.0/
│   │   ├── DeskHop.kicad_pcb
│   │   ├── DeskHop.kicad_prl
│   │   ├── DeskHop.kicad_pro
│   │   ├── DeskHop.kicad_sch
│   │   └── Gerber/
│   │       ├── DeskHop-B_Cu.gbr
│   │       ├── DeskHop-B_Mask.gbr
│   │       ├── DeskHop-B_Paste.gbr
│   │       ├── DeskHop-B_Silkscreen.gbr
│   │       ├── DeskHop-Edge_Cuts.gbr
│   │       ├── DeskHop-F_Cu.gbr
│   │       ├── DeskHop-F_Mask.gbr
│   │       ├── DeskHop-F_Paste.gbr
│   │       ├── DeskHop-F_Silkscreen.gbr
│   │       ├── DeskHop-NPTH.drl
│   │       ├── DeskHop-PTH.drl
│   │       └── DeskHop-job.gbrjob
│   └── v1.1/
│       ├── DeskHop_Rev1.kicad_pcb
│       ├── DeskHop_Rev1.kicad_pro
│       ├── DeskHop_Rev1.kicad_sch
│       └── Gerber/
│           ├── DeskHop_Rev1-B_Cu.gbr
│           ├── DeskHop_Rev1-B_Mask.gbr
│           ├── DeskHop_Rev1-B_Silkscreen.gbr
│           ├── DeskHop_Rev1-Edge_Cuts.gbr
│           ├── DeskHop_Rev1-F_Cu.gbr
│           ├── DeskHop_Rev1-F_Mask.gbr
│           ├── DeskHop_Rev1-F_Paste.gbr
│           ├── DeskHop_Rev1-F_Silkscreen.gbr
│           ├── DeskHop_Rev1-NPTH.drl
│           ├── DeskHop_Rev1-PTH.drl
│           └── DeskHop_Rev1-job.gbrjob
├── pico-sdk/
│   ├── CMakeLists.txt
│   ├── cmake/
│   │   ├── Platform/
│   │   │   └── PICO.cmake
│   │   ├── pico_pre_load_platform.cmake
│   │   ├── pico_pre_load_toolchain.cmake
│   │   ├── pico_utils.cmake
│   │   └── preload/
│   │       ├── platforms/
│   │       │   ├── host.cmake
│   │       │   ├── pico/
│   │       │   │   └── pico.cmake
│   │       │   └── rp2040.cmake
│   │       └── toolchains/
│   │           ├── find_compiler.cmake
│   │           ├── pico_arm_clang.cmake
│   │           ├── pico_arm_clang_arm.cmake
│   │           ├── pico_arm_gcc.cmake
│   │           └── set_flags.cmake
│   ├── lib/
│   │   └── tinyusb/
│   │       ├── LICENSE
│   │       ├── hw/
│   │       │   └── bsp/
│   │       │       ├── ansi_escape.h
│   │       │       ├── board.c
│   │       │       ├── board_api.h
│   │       │       ├── board_mcu.h
│   │       │       ├── family_support.cmake
│   │       │       └── rp2040/
│   │       │           ├── board.h
│   │       │           ├── boards/
│   │       │           │   ├── pico_sdk/
│   │       │           │   │   └── board.cmake
│   │       │           │   └── raspberry_pi_pico/
│   │       │           │       └── board.cmake
│   │       │           ├── family.c
│   │       │           ├── family.cmake
│   │       │           ├── family.mk
│   │       │           ├── pico_sdk_import.cmake
│   │       │           └── rp2040-openocd.cfg
│   │       └── src/
│   │           ├── CMakeLists.txt
│   │           ├── class/
│   │           │   ├── cdc/
│   │           │   │   ├── cdc.h
│   │           │   │   ├── cdc_device.c
│   │           │   │   ├── cdc_device.h
│   │           │   │   └── serial/
│   │           │   │       ├── cp210x.h
│   │           │   │       └── ftdi_sio.h
│   │           │   ├── hid/
│   │           │   │   ├── hid.h
│   │           │   │   ├── hid_device.c
│   │           │   │   ├── hid_device.h
│   │           │   │   ├── hid_host.c
│   │           │   │   └── hid_host.h
│   │           │   └── msc/
│   │           │       ├── msc.h
│   │           │       ├── msc_device.c
│   │           │       └── msc_device.h
│   │           ├── common/
│   │           │   ├── tusb_common.h
│   │           │   ├── tusb_compiler.h
│   │           │   ├── tusb_debug.h
│   │           │   ├── tusb_fifo.c
│   │           │   ├── tusb_fifo.h
│   │           │   ├── tusb_mcu.h
│   │           │   ├── tusb_private.h
│   │           │   ├── tusb_types.h
│   │           │   └── tusb_verify.h
│   │           ├── device/
│   │           │   ├── dcd.h
│   │           │   ├── usbd.c
│   │           │   ├── usbd.h
│   │           │   ├── usbd_control.c
│   │           │   └── usbd_pvt.h
│   │           ├── host/
│   │           │   ├── hcd.h
│   │           │   ├── hub.c
│   │           │   ├── hub.h
│   │           │   ├── usbh.c
│   │           │   ├── usbh.h
│   │           │   └── usbh_pvt.h
│   │           ├── osal/
│   │           │   ├── osal.h
│   │           │   ├── osal_none.h
│   │           │   └── osal_pico.h
│   │           ├── portable/
│   │           │   └── raspberrypi/
│   │           │       ├── pio_usb/
│   │           │       │   ├── dcd_pio_usb.c
│   │           │       │   └── hcd_pio_usb.c
│   │           │       └── rp2040/
│   │           │           ├── dcd_rp2040.c
│   │           │           ├── hcd_rp2040.c
│   │           │           ├── rp2040_usb.c
│   │           │           └── rp2040_usb.h
│   │           ├── tinyusb.mk
│   │           ├── tusb.c
│   │           ├── tusb.h
│   │           ├── tusb_option.h
│   │           └── typec/
│   │               ├── pd_types.h
│   │               ├── tcd.h
│   │               ├── usbc.c
│   │               └── usbc.h
│   ├── pico_sdk_import.cmake
│   ├── pico_sdk_init.cmake
│   ├── pico_sdk_version.cmake
│   ├── src/
│   │   ├── CMakeLists.txt
│   │   ├── board_setup.cmake
│   │   ├── boards/
│   │   │   ├── generic_board.cmake
│   │   │   ├── include/
│   │   │   │   └── boards/
│   │   │   │       ├── none.h
│   │   │   │       ├── pico.h
│   │   │   │       └── pico_w.h
│   │   │   └── pico_w.cmake
│   │   ├── common/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── README.md
│   │   │   ├── boot_picoboot/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── boot/
│   │   │   │           └── picoboot.h
│   │   │   ├── boot_uf2/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── boot/
│   │   │   │           └── uf2.h
│   │   │   ├── pico_base/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── generate_config_header.cmake
│   │   │   │   └── include/
│   │   │   │       ├── pico/
│   │   │   │       │   ├── assert.h
│   │   │   │       │   ├── config.h
│   │   │   │       │   ├── error.h
│   │   │   │       │   ├── types.h
│   │   │   │       │   └── version.h.in
│   │   │   │       └── pico.h
│   │   │   ├── pico_binary_info/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           ├── binary_info/
│   │   │   │           │   ├── code.h
│   │   │   │           │   ├── defs.h
│   │   │   │           │   └── structure.h
│   │   │   │           └── binary_info.h
│   │   │   ├── pico_bit_ops/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── bit_ops.h
│   │   │   ├── pico_divider/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── divider.h
│   │   │   ├── pico_stdlib/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── stdlib.h
│   │   │   ├── pico_sync/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── critical_section.c
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       ├── critical_section.h
│   │   │   │   │       ├── lock_core.h
│   │   │   │   │       ├── mutex.h
│   │   │   │   │       ├── sem.h
│   │   │   │   │       └── sync.h
│   │   │   │   ├── lock_core.c
│   │   │   │   ├── mutex.c
│   │   │   │   └── sem.c
│   │   │   ├── pico_time/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       ├── time.h
│   │   │   │   │       └── timeout_helper.h
│   │   │   │   ├── time.c
│   │   │   │   └── timeout_helper.c
│   │   │   ├── pico_usb_reset_interface/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── usb_reset_interface.h
│   │   │   └── pico_util/
│   │   │       ├── CMakeLists.txt
│   │   │       ├── datetime.c
│   │   │       ├── doc.h
│   │   │       ├── include/
│   │   │       │   └── pico/
│   │   │       │       └── util/
│   │   │       │           ├── datetime.h
│   │   │       │           ├── pheap.h
│   │   │       │           └── queue.h
│   │   │       ├── pheap.c
│   │   │       └── queue.c
│   │   ├── rp2040/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── README.md
│   │   │   ├── hardware_regs/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           ├── platform_defs.h
│   │   │   │           └── regs/
│   │   │   │               ├── adc.h
│   │   │   │               ├── addressmap.h
│   │   │   │               ├── busctrl.h
│   │   │   │               ├── clocks.h
│   │   │   │               ├── dma.h
│   │   │   │               ├── dreq.h
│   │   │   │               ├── i2c.h
│   │   │   │               ├── intctrl.h
│   │   │   │               ├── io_bank0.h
│   │   │   │               ├── io_qspi.h
│   │   │   │               ├── m0plus.h
│   │   │   │               ├── pads_bank0.h
│   │   │   │               ├── pads_qspi.h
│   │   │   │               ├── pio.h
│   │   │   │               ├── pll.h
│   │   │   │               ├── psm.h
│   │   │   │               ├── pwm.h
│   │   │   │               ├── resets.h
│   │   │   │               ├── rosc.h
│   │   │   │               ├── rtc.h
│   │   │   │               ├── sio.h
│   │   │   │               ├── spi.h
│   │   │   │               ├── ssi.h
│   │   │   │               ├── syscfg.h
│   │   │   │               ├── sysinfo.h
│   │   │   │               ├── tbman.h
│   │   │   │               ├── timer.h
│   │   │   │               ├── uart.h
│   │   │   │               ├── usb.h
│   │   │   │               ├── usb_device_dpram.h
│   │   │   │               ├── vreg_and_chip_reset.h
│   │   │   │               ├── watchdog.h
│   │   │   │               ├── xip.h
│   │   │   │               └── xosc.h
│   │   │   └── hardware_structs/
│   │   │       ├── CMakeLists.txt
│   │   │       └── include/
│   │   │           └── hardware/
│   │   │               └── structs/
│   │   │                   ├── adc.h
│   │   │                   ├── bus_ctrl.h
│   │   │                   ├── clocks.h
│   │   │                   ├── dma.h
│   │   │                   ├── i2c.h
│   │   │                   ├── interp.h
│   │   │                   ├── iobank0.h
│   │   │                   ├── ioqspi.h
│   │   │                   ├── mpu.h
│   │   │                   ├── nvic.h
│   │   │                   ├── pads_qspi.h
│   │   │                   ├── padsbank0.h
│   │   │                   ├── pio.h
│   │   │                   ├── pll.h
│   │   │                   ├── psm.h
│   │   │                   ├── pwm.h
│   │   │                   ├── resets.h
│   │   │                   ├── rosc.h
│   │   │                   ├── rtc.h
│   │   │                   ├── scb.h
│   │   │                   ├── sio.h
│   │   │                   ├── spi.h
│   │   │                   ├── ssi.h
│   │   │                   ├── syscfg.h
│   │   │                   ├── systick.h
│   │   │                   ├── timer.h
│   │   │                   ├── uart.h
│   │   │                   ├── usb.h
│   │   │                   ├── vreg_and_chip_reset.h
│   │   │                   ├── watchdog.h
│   │   │                   ├── xip_ctrl.h
│   │   │                   └── xosc.h
│   │   ├── rp2040.cmake
│   │   ├── rp2_common/
│   │   │   ├── CMakeLists.txt
│   │   │   ├── README.md
│   │   │   ├── boot_stage2/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── asminclude/
│   │   │   │   │   └── boot2_helpers/
│   │   │   │   │       ├── exit_from_boot2.S
│   │   │   │   │       ├── read_flash_sreg.S
│   │   │   │   │       └── wait_ssi_ready.S
│   │   │   │   ├── boot2_at25sf128a.S
│   │   │   │   ├── boot2_generic_03h.S
│   │   │   │   ├── boot2_is25lp080.S
│   │   │   │   ├── boot2_usb_blinky.S
│   │   │   │   ├── boot2_w25q080.S
│   │   │   │   ├── boot2_w25x10cl.S
│   │   │   │   ├── boot_stage2.ld
│   │   │   │   ├── compile_time_choice.S
│   │   │   │   ├── doc.h
│   │   │   │   ├── include/
│   │   │   │   │   └── boot_stage2/
│   │   │   │   │       └── config.h
│   │   │   │   └── pad_checksum
│   │   │   ├── cmsis/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── cmsis/
│   │   │   │   │       └── rename_exceptions.h
│   │   │   │   └── stub/
│   │   │   │       └── CMSIS/
│   │   │   │           ├── Core/
│   │   │   │           │   └── Include/
│   │   │   │           │       ├── cmsis_armcc.h
│   │   │   │           │       ├── cmsis_armclang.h
│   │   │   │           │       ├── cmsis_armclang_ltm.h
│   │   │   │           │       ├── cmsis_compiler.h
│   │   │   │           │       ├── cmsis_gcc.h
│   │   │   │           │       ├── cmsis_iccarm.h
│   │   │   │           │       ├── cmsis_version.h
│   │   │   │           │       ├── core_cm0plus.h
│   │   │   │           │       └── mpu_armv7.h
│   │   │   │           ├── Device/
│   │   │   │           │   └── RaspberryPi/
│   │   │   │           │       └── RP2040/
│   │   │   │           │           ├── Include/
│   │   │   │           │           │   ├── RP2040.h
│   │   │   │           │           │   └── system_RP2040.h
│   │   │   │           │           └── Source/
│   │   │   │           │               └── system_RP2040.c
│   │   │   │           └── LICENSE.txt
│   │   │   ├── hardware_adc/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── adc.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── adc.h
│   │   │   ├── hardware_base/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── address_mapped.h
│   │   │   ├── hardware_claim/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── claim.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── claim.h
│   │   │   ├── hardware_clocks/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── clocks.c
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── clocks.h
│   │   │   │   └── scripts/
│   │   │   │       └── vcocalc.py
│   │   │   ├── hardware_divider/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── divider.S
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           ├── divider.h
│   │   │   │           └── divider_helper.S
│   │   │   ├── hardware_dma/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── dma.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── dma.h
│   │   │   ├── hardware_exception/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── exception.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── exception.h
│   │   │   ├── hardware_flash/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── flash.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── flash.h
│   │   │   ├── hardware_gpio/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── gpio.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── gpio.h
│   │   │   ├── hardware_i2c/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── i2c.c
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── i2c.h
│   │   │   ├── hardware_interp/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── interp.h
│   │   │   │   └── interp.c
│   │   │   ├── hardware_irq/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── irq.h
│   │   │   │   ├── irq.c
│   │   │   │   └── irq_handler_chain.S
│   │   │   ├── hardware_pio/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       ├── pio.h
│   │   │   │   │       └── pio_instructions.h
│   │   │   │   └── pio.c
│   │   │   ├── hardware_pll/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── pll.h
│   │   │   │   └── pll.c
│   │   │   ├── hardware_pwm/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── pwm.h
│   │   │   ├── hardware_resets/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── include/
│   │   │   │       └── hardware/
│   │   │   │           └── resets.h
│   │   │   ├── hardware_rtc/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── rtc.h
│   │   │   │   └── rtc.c
│   │   │   ├── hardware_spi/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── spi.h
│   │   │   │   └── spi.c
│   │   │   ├── hardware_sync/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── sync.h
│   │   │   │   └── sync.c
│   │   │   ├── hardware_timer/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── timer.h
│   │   │   │   └── timer.c
│   │   │   ├── hardware_uart/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── uart.h
│   │   │   │   └── uart.c
│   │   │   ├── hardware_vreg/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── vreg.h
│   │   │   │   └── vreg.c
│   │   │   ├── hardware_watchdog/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── watchdog.h
│   │   │   │   └── watchdog.c
│   │   │   ├── hardware_xosc/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── hardware/
│   │   │   │   │       └── xosc.h
│   │   │   │   └── xosc.c
│   │   │   ├── pico_async_context/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── async_context_base.c
│   │   │   │   ├── async_context_freertos.c
│   │   │   │   ├── async_context_poll.c
│   │   │   │   ├── async_context_threadsafe_background.c
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           ├── async_context.h
│   │   │   │           ├── async_context_base.h
│   │   │   │           ├── async_context_freertos.h
│   │   │   │           ├── async_context_poll.h
│   │   │   │           └── async_context_threadsafe_background.h
│   │   │   ├── pico_bit_ops/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── bit_ops_aeabi.S
│   │   │   ├── pico_bootrom/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── bootrom.c
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           ├── bootrom/
│   │   │   │           │   └── sf_table.h
│   │   │   │           └── bootrom.h
│   │   │   ├── pico_bootsel_via_double_reset/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── pico_bootsel_via_double_reset.c
│   │   │   ├── pico_cxx_options/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── doc.h
│   │   │   ├── pico_divider/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── divider.S
│   │   │   ├── pico_double/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── double_aeabi.S
│   │   │   │   ├── double_init_rom.c
│   │   │   │   ├── double_math.c
│   │   │   │   ├── double_none.S
│   │   │   │   ├── double_v1_rom_shim.S
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── double.h
│   │   │   ├── pico_fix/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── rp2040_usb_device_enumeration/
│   │   │   │       ├── CMakeLists.txt
│   │   │   │       ├── include/
│   │   │   │       │   └── pico/
│   │   │   │       │       └── fix/
│   │   │   │       │           └── rp2040_usb_device_enumeration.h
│   │   │   │       └── rp2040_usb_device_enumeration.c
│   │   │   ├── pico_flash/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── flash.c
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── flash.h
│   │   │   ├── pico_float/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── float_aeabi.S
│   │   │   │   ├── float_init_rom.c
│   │   │   │   ├── float_math.c
│   │   │   │   ├── float_none.S
│   │   │   │   ├── float_v1_rom_shim.S
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── float.h
│   │   │   ├── pico_i2c_slave/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── i2c_slave.c
│   │   │   │   └── include/
│   │   │   │       └── pico/
│   │   │   │           └── i2c_slave.h
│   │   │   ├── pico_int64_ops/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── int64_ops.h
│   │   │   │   └── pico_int64_ops_aeabi.S
│   │   │   ├── pico_malloc/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── malloc.h
│   │   │   │   └── pico_malloc.c
│   │   │   ├── pico_mem_ops/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── mem_ops.h
│   │   │   │   ├── mem_ops.c
│   │   │   │   └── mem_ops_aeabi.S
│   │   │   ├── pico_multicore/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── multicore.h
│   │   │   │   └── multicore.c
│   │   │   ├── pico_platform/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       ├── asm_helper.S
│   │   │   │   │       └── platform.h
│   │   │   │   └── platform.c
│   │   │   ├── pico_printf/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── printf.h
│   │   │   │   ├── printf.c
│   │   │   │   └── printf_none.S
│   │   │   ├── pico_rand/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── rand.h
│   │   │   │   └── rand.c
│   │   │   ├── pico_runtime/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── runtime.h
│   │   │   │   └── runtime.c
│   │   │   ├── pico_standard_link/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── binary_info.c
│   │   │   │   ├── crt0.S
│   │   │   │   ├── doc.h
│   │   │   │   ├── memmap_blocked_ram.ld
│   │   │   │   ├── memmap_copy_to_ram.ld
│   │   │   │   ├── memmap_default.ld
│   │   │   │   ├── memmap_no_flash.ld
│   │   │   │   └── new_delete.cpp
│   │   │   ├── pico_stdio/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── LICENSE
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       ├── stdio/
│   │   │   │   │       │   └── driver.h
│   │   │   │   │       └── stdio.h
│   │   │   │   └── stdio.c
│   │   │   ├── pico_stdio_semihosting/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── stdio_semihosting.h
│   │   │   │   └── stdio_semihosting.c
│   │   │   ├── pico_stdio_uart/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── stdio_uart.h
│   │   │   │   └── stdio_uart.c
│   │   │   ├── pico_stdio_usb/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   ├── pico/
│   │   │   │   │   │   ├── stdio_usb/
│   │   │   │   │   │   │   └── reset_interface.h
│   │   │   │   │   │   └── stdio_usb.h
│   │   │   │   │   └── tusb_config.h
│   │   │   │   ├── reset_interface.c
│   │   │   │   ├── stdio_usb.c
│   │   │   │   └── stdio_usb_descriptors.c
│   │   │   ├── pico_stdlib/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   └── stdlib.c
│   │   │   ├── pico_unique_id/
│   │   │   │   ├── CMakeLists.txt
│   │   │   │   ├── include/
│   │   │   │   │   └── pico/
│   │   │   │   │       └── unique_id.h
│   │   │   │   └── unique_id.c
│   │   │   └── tinyusb/
│   │   │       ├── CMakeLists.txt
│   │   │       └── doc.h
│   │   └── rp2_common.cmake
│   └── tools/
│       ├── CMakeLists.txt
│       ├── FindELF2UF2.cmake
│       ├── FindPioasm.cmake
│       ├── elf2uf2/
│       │   ├── CMakeLists.txt
│       │   ├── elf.h
│       │   └── main.cpp
│       └── pioasm/
│           ├── CMakeLists.txt
│           ├── ada_output.cpp
│           ├── c_sdk_output.cpp
│           ├── gen/
│           │   ├── lexer.cpp
│           │   ├── location.h
│           │   ├── parser.cpp
│           │   └── parser.hpp
│           ├── hex_output.cpp
│           ├── lexer.ll
│           ├── main.cpp
│           ├── output_format.h
│           ├── parser.yy
│           ├── pio_assembler.cpp
│           ├── pio_assembler.h
│           ├── pio_disassembler.cpp
│           ├── pio_disassembler.h
│           ├── pio_types.h
│           └── python_output.cpp
├── src/
│   ├── constants.c
│   ├── defaults.c
│   ├── handlers.c
│   ├── hid_parser.c
│   ├── hid_report.c
│   ├── include/
│   │   ├── config.h
│   │   ├── constants.h
│   │   ├── dma.h
│   │   ├── firmware.h
│   │   ├── flash.h
│   │   ├── handlers.h
│   │   ├── hid_parser.h
│   │   ├── hid_report.h
│   │   ├── keyboard.h
│   │   ├── main.h
│   │   ├── misc.h
│   │   ├── mouse.h
│   │   ├── packet.h
│   │   ├── pinout.h
│   │   ├── protocol.h
│   │   ├── screen.h
│   │   ├── serial.h
│   │   ├── setup.h
│   │   ├── structs.h
│   │   ├── tasks.h
│   │   ├── tusb_config.h
│   │   ├── usb_descriptors.h
│   │   ├── user_config.h
│   │   └── watchdog.h
│   ├── keyboard.c
│   ├── led.c
│   ├── main.c
│   ├── mouse.c
│   ├── protocol.c
│   ├── ramdisk.c
│   ├── setup.c
│   ├── tasks.c
│   ├── uart.c
│   ├── usb.c
│   ├── usb_descriptors.c
│   └── utils.c
└── webconfig/
    ├── .gitignore
    ├── Makefile
    ├── config-unpacked.htm
    ├── config.htm
    ├── form.py
    ├── render.py
    ├── requirements.txt
    └── templates/
        ├── form.html
        ├── main.html
        ├── packer.j2
        ├── script.js
        └── style.css
Download .txt
Showing preview only (380K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3104 symbols across 243 files)

FILE: Pico-PIO-USB/src/pio_usb.c
  function __always_inline (line 205) | static __always_inline void add_pio_host_rx_program(PIO pio,
  function configure_tx_channel (line 244) | static void configure_tx_channel(uint8_t ch, PIO pio, uint sm) {
  function apply_config (line 256) | static void apply_config(pio_port_t *pp, const pio_usb_configuration_t *c,
  function port_pin_drive_setting (line 286) | static void port_pin_drive_setting(const root_port_t *port) {
  function pio_usb_bus_init (line 293) | void pio_usb_bus_init(pio_port_t *pp, const pio_usb_configuration_t *c,
  function endpoint_t (line 312) | endpoint_t *pio_usb_get_endpoint(usb_device_t *device, uint8_t idx) {
  function __force_inline (line 366) | static inline __force_inline void prepare_tx_data(endpoint_t *ep) {
  function pio_usb_host_add_port (line 445) | int pio_usb_host_add_port(uint8_t pin_dp, PIO_USB_PINOUT pinout) {

FILE: Pico-PIO-USB/src/pio_usb_configuration.h
  type PIO_USB_PINOUT (line 4) | typedef enum {
  type pio_usb_configuration_t (line 9) | typedef struct {

FILE: Pico-PIO-USB/src/pio_usb_device.c
  function __always_inline (line 39) | static __always_inline void restart_usb_reveiver(pio_port_t *pp) {
  function __always_inline (line 46) | static __always_inline int8_t device_receive_token(uint8_t *buffer,
  function usb_device_t (line 207) | usb_device_t *pio_usb_device_init(const pio_usb_configuration_t *c,
  function pio_usb_device_set_address (line 260) | void pio_usb_device_set_address(uint8_t dev_addr) {
  function pio_usb_device_transfer (line 278) | bool pio_usb_device_transfer(uint8_t ep_address, uint8_t *buffer,
  function pio_usb_device_task (line 317) | void pio_usb_device_task(void) {

FILE: Pico-PIO-USB/src/pio_usb_host.c
  function start_timer (line 38) | static void start_timer(alarm_pool_t *alarm_pool) {
  function __unused (line 51) | static __unused void stop_timer(void) {
  function usb_device_t (line 56) | usb_device_t *pio_usb_host_init(const pio_usb_configuration_t *c) {
  function pio_usb_host_stop (line 89) | void pio_usb_host_stop(void) {
  function pio_usb_host_restart (line 96) | void pio_usb_host_restart(void) {
  function __always_inline (line 116) | static __always_inline void override_pio_rx_program(PIO pio,
  function pio_usb_host_get_frame_number (line 334) | uint32_t pio_usb_host_get_frame_number(void) {
  function pio_usb_host_port_reset_start (line 338) | void pio_usb_host_port_reset_start(uint8_t root_idx) {
  function pio_usb_host_port_reset_end (line 353) | void pio_usb_host_port_reset_end(uint8_t root_idx) {
  function pio_usb_host_close_device (line 367) | void pio_usb_host_close_device(uint8_t root_idx, uint8_t device_address) {
  function __force_inline (line 378) | static inline __force_inline endpoint_t * _find_ep(uint8_t root_idx,
  function pio_usb_host_endpoint_open (line 394) | bool pio_usb_host_endpoint_open(uint8_t root_idx, uint8_t device_address,
  function pio_usb_host_send_setup (line 413) | bool pio_usb_host_send_setup(uint8_t root_idx, uint8_t device_address,
  function pio_usb_host_endpoint_transfer (line 428) | bool pio_usb_host_endpoint_transfer(uint8_t root_idx, uint8_t device_add...
  function pio_usb_host_endpoint_abort_transfer (line 448) | bool pio_usb_host_endpoint_abort_transfer(uint8_t root_idx, uint8_t devi...
  function on_device_connect (line 598) | static void on_device_connect(pio_port_t *pp, root_port_t *root,
  function set_hub_feature (line 740) | static int set_hub_feature(usb_device_t *device, uint8_t port, uint8_t v...
  function clear_hub_feature (line 747) | static int clear_hub_feature(usb_device_t *device, uint8_t port,
  function get_hub_port_status (line 755) | static int get_hub_port_status(usb_device_t *device, uint8_t port,
  function initialize_hub (line 763) | static int initialize_hub(usb_device_t *device) {
  function get_string_descriptor (line 787) | static int get_string_descriptor(usb_device_t *device, uint8_t idx,
  function enumerate_device (line 818) | static int enumerate_device(usb_device_t *device, uint8_t address) {
  function device_disconnect (line 1046) | static void device_disconnect(usb_device_t *device) {
  function device_pool_vacant (line 1069) | static int device_pool_vacant(void) {
  function assign_new_device_to_port (line 1079) | static int assign_new_device_to_port(usb_device_t *hub_device, uint8_t p...
  function pio_usb_kbd_set_leds (line 1355) | int pio_usb_kbd_set_leds(usb_device_t *device, uint8_t port, uint8_t val...

FILE: Pico-PIO-USB/src/pio_usb_ll.h
  type port_pin_status_t (line 37) | typedef enum {
  type pio_clk_div_t (line 44) | typedef struct {
  type pio_port_t (line 49) | typedef struct {
  function __always_inline (line 133) | static __always_inline port_pin_status_t
  function __force_inline (line 152) | static inline __force_inline uint16_t
  function __force_inline (line 192) | static inline __force_inline endpoint_t *

FILE: Pico-PIO-USB/src/usb_crc.c
  function calc_usb_crc16 (line 55) | uint16_t calc_usb_crc16(const uint8_t *data, uint16_t len) {

FILE: Pico-PIO-USB/src/usb_definitions.h
  type control_transfer_operation_t (line 8) | typedef enum {
  type ep_type_t (line 16) | typedef enum {
  type setup_transfer_stage_t (line 21) | typedef enum {
  type usb_enumeration_stage_t (line 31) | typedef enum {
  type packet_info_t (line 40) | typedef struct {
  type control_pipe_t (line 45) | typedef struct {
  type endpoint_t (line 56) | typedef struct {
  type usb_device_event_t (line 82) | typedef enum {
  type usb_device_t (line 89) | typedef struct struct_usb_device_t usb_device_t;
  type root_port_t (line 90) | typedef struct struct_root_port_t {
  type struct_usb_device_t (line 114) | struct struct_usb_device_t {
  type usb_setup_packet_t (line 170) | typedef struct {
  type device_descriptor_t (line 184) | typedef struct {
  type string_descriptor_t (line 201) | typedef struct {
  type interface_descriptor_t (line 207) | typedef struct {
  type endpoint_descriptor_t (line 219) | typedef struct {
  type hid_descriptor_t (line 228) | typedef struct {
  type configuration_descriptor_t (line 238) | typedef struct configuration_descriptor_tag {
  type hub_descriptor_t (line 250) | typedef struct {
  type hub_port_status_t (line 261) | typedef struct {
  type usb_descriptor_buffers_t (line 340) | typedef struct {

FILE: Pico-PIO-USB/src/usb_rx.pio.h
  type pio_program (line 46) | struct pio_program
  function pio_sm_config (line 52) | static inline pio_sm_config usb_edge_detector_program_get_default_config...
  type pio_program (line 89) | struct pio_program
  function pio_sm_config (line 95) | static inline pio_sm_config usb_edge_detector_debug_program_get_default_...
  type pio_program (line 131) | struct pio_program
  function pio_sm_config (line 137) | static inline pio_sm_config usb_nrzi_decoder_program_get_default_config(...
  type pio_program (line 172) | struct pio_program
  function pio_sm_config (line 178) | static inline pio_sm_config usb_nrzi_decoder_debug_program_get_default_c...
  function __always_inline (line 186) | static __always_inline void pio_sm_set_jmp_pin(PIO pio, uint sm, uint jm...
  function usb_rx_fs_program_init (line 191) | static inline void usb_rx_fs_program_init(PIO pio, uint sm, uint offset,...
  function eop_detect_fs_program_init (line 220) | static inline void eop_detect_fs_program_init(PIO pio, uint sm, uint off...

FILE: Pico-PIO-USB/src/usb_tx.pio.h
  type pio_program (line 52) | struct pio_program
  function pio_sm_config (line 58) | static inline pio_sm_config usb_tx_dpdm_program_get_default_config(uint ...
  type pio_program (line 104) | struct pio_program
  function pio_sm_config (line 110) | static inline pio_sm_config usb_tx_pre_dpdm_program_get_default_config(u...
  type pio_program (line 156) | struct pio_program
  function pio_sm_config (line 162) | static inline pio_sm_config usb_tx_dmdp_program_get_default_config(uint ...
  type pio_program (line 208) | struct pio_program
  function pio_sm_config (line 214) | static inline pio_sm_config usb_tx_pre_dmdp_program_get_default_config(u...
  function usb_tx_fs_program_init (line 233) | static inline void usb_tx_fs_program_init(PIO pio, uint sm, uint offset,
  function usb_tx_ls_program_init (line 252) | static inline void usb_tx_ls_program_init(PIO pio, uint sm, uint offset,

FILE: pico-sdk/lib/tinyusb/hw/bsp/board.c
  function TU_ATTR_USED (line 49) | TU_ATTR_USED int sys_write(int fhdl, const char *buf, size_t count) {
  function TU_ATTR_USED (line 55) | TU_ATTR_USED int sys_read(int fhdl, char *buf, size_t count) {
  function TU_ATTR_USED (line 67) | TU_ATTR_USED int sys_write (int fhdl, const char *buf, size_t count) {
  function TU_ATTR_USED (line 78) | TU_ATTR_USED int sys_read (int fhdl, char *buf, size_t count) {
  function TU_ATTR_USED (line 88) | TU_ATTR_USED int sys_write (int fhdl, const char *buf, size_t count) {
  function TU_ATTR_USED (line 93) | TU_ATTR_USED int sys_read (int fhdl, char *buf, size_t count) {
  function cl_putc (line 113) | static int cl_putc(char c, FILE *f) {
  function cl_getc (line 118) | static int cl_getc(FILE* f) {
  function board_getchar (line 133) | int board_getchar(void) {

FILE: pico-sdk/lib/tinyusb/hw/bsp/board_api.h
  function board_millis (line 100) | static inline uint32_t board_millis(void) {
  function board_millis (line 105) | static inline uint32_t board_millis(void) {
  function board_millis (line 111) | static inline uint32_t board_millis(void) {
  function board_millis (line 116) | static inline uint32_t board_millis(void) {
  function board_led_on (line 131) | static inline void board_led_on(void) {
  function board_led_off (line 135) | static inline void board_led_off(void) {
  function board_usb_get_serial (line 141) | static inline size_t board_usb_get_serial(uint16_t desc_str1[], size_t m...
  function board_delay (line 173) | static inline void board_delay(uint32_t ms) {

FILE: pico-sdk/lib/tinyusb/hw/bsp/rp2040/family.c
  function stdio_rtt_write (line 103) | static void stdio_rtt_write (const char *buf, int length) {
  function stdio_rtt_read (line 107) | static int stdio_rtt_read (char *buf, int len) {
  function stdio_rtt_init (line 117) | void stdio_rtt_init(void) {
  function board_init (line 126) | void board_init(void)
  function board_led_write (line 186) | void board_led_write(bool state) {
  function board_button_read (line 194) | uint32_t board_button_read(void) {
  function board_get_unique_id (line 202) | size_t board_get_unique_id(uint8_t id[], size_t max_len) {
  function board_uart_read (line 213) | int board_uart_read(uint8_t *buf, int len) {
  function board_uart_write (line 227) | int board_uart_write(void const *buf, int len) {
  function board_getchar (line 240) | int board_getchar(void) {
  function max3421_int_handler (line 255) | void max3421_int_handler(uint gpio, uint32_t event_mask) {
  function max3421_init (line 260) | static void max3421_init(void) {
  function tuh_max3421_int_api (line 281) | void tuh_max3421_int_api(uint8_t rhport, bool enabled) {
  function tuh_max3421_spi_cs_api (line 287) | void tuh_max3421_spi_cs_api(uint8_t rhport, bool active) {
  function tuh_max3421_spi_xfer_api (line 294) | bool tuh_max3421_spi_xfer_api(uint8_t rhport, uint8_t const* tx_buf, uin...

FILE: pico-sdk/lib/tinyusb/src/class/cdc/cdc.h
  type cdc_comm_sublcass_type_t (line 49) | typedef enum
  type cdc_comm_protocol_type_t (line 67) | typedef enum
  type cdc_func_desc_type_t (line 81) | typedef enum
  type cdc_data_protocol_type_t (line 119) | typedef enum{
  type cdc_management_request_t (line 139) | typedef enum {
  type cdc_control_line_state_t (line 184) | typedef enum {
  type cdc_line_coding_stopbits_t (line 189) | typedef enum {
  type cdc_line_coding_parity_t (line 200) | typedef enum {
  type cdc_notification_request_t (line 213) | typedef enum {
  type cdc_desc_func_header_t (line 234) | typedef struct TU_ATTR_PACKED
  type cdc_desc_func_union_t (line 243) | typedef struct TU_ATTR_PACKED
  type cdc_desc_func_country_selection_t (line 262) | typedef struct TU_ATTR_PACKED
  type cdc_desc_func_call_management_t (line 286) | typedef struct TU_ATTR_PACKED
  type cdc_acm_capability_t (line 301) | typedef struct TU_ATTR_PACKED
  type cdc_desc_func_acm_t (line 314) | typedef struct TU_ATTR_PACKED
  type cdc_desc_func_direct_line_management_t (line 324) | typedef struct TU_ATTR_PACKED
  type cdc_desc_func_telephone_ringer_t (line 340) | typedef struct TU_ATTR_PACKED
  type cdc_desc_func_telephone_operational_modes_t (line 352) | typedef struct TU_ATTR_PACKED
  type cdc_desc_func_telephone_call_state_reporting_capabilities_t (line 368) | typedef struct TU_ATTR_PACKED
  function cdc_functional_desc_typeof (line 387) | static inline uint8_t cdc_functional_desc_typeof(uint8_t const * p_desc)
  type cdc_line_coding_t (line 395) | typedef struct TU_ATTR_PACKED
  type cdc_line_control_state_t (line 405) | typedef struct TU_ATTR_PACKED

FILE: pico-sdk/lib/tinyusb/src/class/cdc/cdc_device.c
  type cdcd_interface_t (line 48) | typedef struct
  function _prep_out_transaction (line 85) | static bool _prep_out_transaction (cdcd_interface_t* p_cdc)
  function tud_cdc_n_connected (line 117) | bool tud_cdc_n_connected(uint8_t itf)
  function tud_cdc_n_get_line_state (line 123) | uint8_t tud_cdc_n_get_line_state (uint8_t itf)
  function tud_cdc_n_get_line_coding (line 128) | void tud_cdc_n_get_line_coding (uint8_t itf, cdc_line_coding_t* coding)
  function tud_cdc_n_set_wanted_char (line 133) | void tud_cdc_n_set_wanted_char (uint8_t itf, char wanted)
  function tud_cdc_n_available (line 142) | uint32_t tud_cdc_n_available(uint8_t itf)
  function tud_cdc_n_read (line 147) | uint32_t tud_cdc_n_read(uint8_t itf, void* buffer, uint32_t bufsize)
  function tud_cdc_n_peek (line 155) | bool tud_cdc_n_peek(uint8_t itf, uint8_t* chr)
  function tud_cdc_n_read_flush (line 160) | void tud_cdc_n_read_flush (uint8_t itf)
  function tud_cdc_n_write (line 170) | uint32_t tud_cdc_n_write(uint8_t itf, void const* buffer, uint32_t bufsize)
  function tud_cdc_n_write_flush (line 187) | uint32_t tud_cdc_n_write_flush (uint8_t itf)
  function tud_cdc_n_write_available (line 218) | uint32_t tud_cdc_n_write_available (uint8_t itf)
  function tud_cdc_n_write_clear (line 223) | bool tud_cdc_n_write_clear (uint8_t itf)
  function cdcd_init (line 231) | void cdcd_init(void)
  function cdcd_deinit (line 266) | bool cdcd_deinit(void) {
  function cdcd_reset (line 288) | void cdcd_reset(uint8_t rhport)
  function cdcd_open (line 305) | uint16_t cdcd_open(uint8_t rhport, tusb_desc_interface_t const * itf_des...
  function cdcd_control_xfer_cb (line 371) | bool cdcd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_re...
  function cdcd_xfer_cb (line 453) | bool cdcd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result,...

FILE: pico-sdk/lib/tinyusb/src/class/cdc/cdc_device.h
  function tud_cdc_n_read_char (line 158) | static inline int32_t tud_cdc_n_read_char (uint8_t itf)
  function tud_cdc_n_write_char (line 164) | static inline uint32_t tud_cdc_n_write_char(uint8_t itf, char ch)
  function tud_cdc_n_write_str (line 169) | static inline uint32_t tud_cdc_n_write_str (uint8_t itf, char const* str)
  function tud_cdc_connected (line 174) | static inline bool tud_cdc_connected (void)
  function tud_cdc_get_line_state (line 179) | static inline uint8_t tud_cdc_get_line_state (void)
  function tud_cdc_get_line_coding (line 184) | static inline void tud_cdc_get_line_coding (cdc_line_coding_t* coding)
  function tud_cdc_set_wanted_char (line 189) | static inline void tud_cdc_set_wanted_char (char wanted)
  function tud_cdc_available (line 194) | static inline uint32_t tud_cdc_available (void)
  function tud_cdc_read_char (line 199) | static inline int32_t tud_cdc_read_char (void)
  function tud_cdc_read (line 204) | static inline uint32_t tud_cdc_read (void* buffer, uint32_t bufsize)
  function tud_cdc_read_flush (line 209) | static inline void tud_cdc_read_flush (void)
  function tud_cdc_peek (line 214) | static inline bool tud_cdc_peek (uint8_t* ui8)
  function tud_cdc_write_char (line 219) | static inline uint32_t tud_cdc_write_char (char ch)
  function tud_cdc_write (line 224) | static inline uint32_t tud_cdc_write (void const* buffer, uint32_t bufsize)
  function tud_cdc_write_str (line 229) | static inline uint32_t tud_cdc_write_str (char const* str)
  function tud_cdc_write_flush (line 234) | static inline uint32_t tud_cdc_write_flush (void)
  function tud_cdc_write_available (line 239) | static inline uint32_t tud_cdc_write_available(void)
  function tud_cdc_write_clear (line 244) | static inline bool tud_cdc_write_clear(void)

FILE: pico-sdk/lib/tinyusb/src/class/hid/hid.h
  type tusb_hid_descriptor_hid_t (line 47) | typedef struct TU_ATTR_PACKED
  type hid_subclass_enum_t (line 61) | typedef enum
  type hid_interface_protocol_enum_t (line 68) | typedef enum
  type hid_descriptor_enum_t (line 76) | typedef enum
  type hid_report_type_t (line 84) | typedef enum
  type hid_request_enum_t (line 93) | typedef enum
  type hid_local_enum_t (line 104) | typedef enum
  type hid_protocol_mode_enum_t (line 145) | typedef enum
  type hid_gamepad_report_t (line 195) | typedef struct TU_ATTR_PACKED
  type hid_gamepad_button_bm_t (line 208) | typedef enum
  type hid_gamepad_hat_t (line 272) | typedef enum
  type hid_mouse_report_t (line 294) | typedef struct TU_ATTR_PACKED
  type hid_abs_mouse_report_t (line 306) | typedef struct TU_ATTR_PACKED
  type hid_mouse_button_bm_t (line 317) | typedef enum
  type hid_keyboard_report_t (line 335) | typedef struct TU_ATTR_PACKED
  type hid_keyboard_modifier_bm_t (line 343) | typedef enum
  type hid_keyboard_led_bm_t (line 355) | typedef enum

FILE: pico-sdk/lib/tinyusb/src/class/hid/hid_device.c
  type hidd_interface_t (line 42) | typedef struct {
  function get_index_by_itfnum (line 64) | static inline uint8_t get_index_by_itfnum(uint8_t itf_num)
  function tud_hid_n_ready (line 77) | bool tud_hid_n_ready(uint8_t instance)
  function tud_hid_n_report (line 84) | bool tud_hid_n_report(uint8_t instance, uint8_t report_id, void const *r...
  function tud_hid_n_interface_protocol (line 104) | uint8_t tud_hid_n_interface_protocol(uint8_t instance) { return _hidd_it...
  function tud_hid_n_get_protocol (line 106) | uint8_t tud_hid_n_get_protocol(uint8_t instance) { return _hidd_itf[inst...
  function tud_hid_n_keyboard_report (line 108) | bool tud_hid_n_keyboard_report(uint8_t instance, uint8_t report_id, uint...
  function tud_hid_n_mouse_report (line 124) | bool tud_hid_n_mouse_report(uint8_t instance, uint8_t report_id, uint8_t...
  function tud_hid_n_abs_mouse_report (line 137) | bool tud_hid_n_abs_mouse_report(uint8_t instance, uint8_t report_id, uin...
  function tud_hid_n_gamepad_report (line 149) | bool tud_hid_n_gamepad_report(uint8_t instance, uint8_t report_id, int8_...
  function hidd_init (line 168) | void hidd_init(void)
  function hidd_deinit (line 173) | bool hidd_deinit(void)
  function hidd_reset (line 178) | void hidd_reset(uint8_t rhport)
  function hidd_open (line 184) | uint16_t hidd_open(uint8_t rhport, tusb_desc_interface_t const *desc_itf...
  function hidd_control_xfer_cb (line 237) | bool hidd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_re...
  function hidd_xfer_cb (line 357) | bool hidd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result,...

FILE: pico-sdk/lib/tinyusb/src/class/hid/hid_device.h
  function tud_hid_abs_mouse_report (line 80) | static inline bool tud_hid_abs_mouse_report(uint8_t report_id, uint8_t b...
  function tud_hid_ready (line 137) | static inline bool tud_hid_ready(void)
  function tud_hid_interface_protocol (line 142) | static inline uint8_t tud_hid_interface_protocol(void)
  function tud_hid_get_protocol (line 147) | static inline uint8_t tud_hid_get_protocol(void)
  function tud_hid_report (line 152) | static inline bool tud_hid_report(uint8_t report_id, void const* report,...
  function tud_hid_keyboard_report (line 157) | static inline bool tud_hid_keyboard_report(uint8_t report_id, uint8_t mo...
  function tud_hid_mouse_report (line 162) | static inline bool tud_hid_mouse_report(uint8_t report_id, uint8_t butto...
  function tud_hid_gamepad_report (line 167) | static inline bool  tud_hid_gamepad_report(uint8_t report_id, int8_t x, ...

FILE: pico-sdk/lib/tinyusb/src/class/hid/hid_host.c
  type hidh_interface_t (line 46) | typedef struct {
  function TU_ATTR_ALWAYS_INLINE (line 75) | TU_ATTR_ALWAYS_INLINE static inline hidh_interface_t* get_hid_itf(uint8_...
  function get_idx_by_epaddr (line 82) | static uint8_t get_idx_by_epaddr(uint8_t daddr, uint8_t ep_addr) {
  function hidh_interface_t (line 93) | static hidh_interface_t* find_new_itf(void) {
  function tuh_hid_itf_get_count (line 103) | uint8_t tuh_hid_itf_get_count(uint8_t daddr) {
  function tuh_hid_itf_get_total_count (line 111) | uint8_t tuh_hid_itf_get_total_count(void) {
  function tuh_hid_mounted (line 119) | bool tuh_hid_mounted(uint8_t daddr, uint8_t idx) {
  function tuh_hid_itf_get_info (line 125) | bool tuh_hid_itf_get_info(uint8_t daddr, uint8_t idx, tuh_itf_info_t* in...
  function tuh_hid_itf_get_index (line 147) | uint8_t tuh_hid_itf_get_index(uint8_t daddr, uint8_t itf_num) {
  function tuh_hid_interface_protocol (line 156) | uint8_t tuh_hid_interface_protocol(uint8_t daddr, uint8_t idx) {
  function tuh_hid_get_protocol (line 164) | uint8_t tuh_hid_get_protocol(uint8_t daddr, uint8_t idx) {
  function set_protocol_complete (line 169) | static void set_protocol_complete(tuh_xfer_t* xfer) {
  function tuh_hid_set_default_protocol (line 186) | void tuh_hid_set_default_protocol(uint8_t protocol) {
  function _hidh_set_protocol (line 190) | static bool _hidh_set_protocol(uint8_t daddr, uint8_t itf_num, uint8_t p...
  function tuh_hid_set_protocol (line 218) | bool tuh_hid_set_protocol(uint8_t daddr, uint8_t idx, uint8_t protocol) {
  function get_report_complete (line 225) | static void get_report_complete(tuh_xfer_t* xfer) {
  function tuh_hid_get_report (line 240) | bool tuh_hid_get_report(uint8_t daddr, uint8_t idx, uint8_t report_id, u...
  function set_report_complete (line 269) | static void set_report_complete(tuh_xfer_t* xfer) {
  function tuh_hid_set_report (line 284) | bool tuh_hid_set_report(uint8_t daddr, uint8_t idx, uint8_t report_id, u...
  function _hidh_set_idle (line 313) | static bool _hidh_set_idle(uint8_t daddr, uint8_t itf_num, uint16_t idle...
  function tuh_hid_receive_ready (line 347) | bool tuh_hid_receive_ready(uint8_t dev_addr, uint8_t idx) {
  function tuh_hid_receive_report (line 353) | bool tuh_hid_receive_report(uint8_t daddr, uint8_t idx) {
  function tuh_hid_receive_abort (line 367) | bool tuh_hid_receive_abort(uint8_t dev_addr, uint8_t idx) {
  function tuh_hid_send_ready (line 373) | bool tuh_hid_send_ready(uint8_t dev_addr, uint8_t idx) {
  function tuh_hid_send_report (line 379) | bool tuh_hid_send_report(uint8_t daddr, uint8_t idx, uint8_t report_id, ...
  function hidh_init (line 419) | bool hidh_init(void) {
  function hidh_deinit (line 425) | bool hidh_deinit(void) {
  function hidh_xfer_cb (line 429) | bool hidh_xfer_cb(uint8_t daddr, uint8_t ep_addr, xfer_result_t result, ...
  function hidh_close (line 451) | void hidh_close(uint8_t daddr) {
  function hidh_open (line 466) | bool hidh_open(uint8_t rhport, uint8_t daddr, tusb_desc_interface_t cons...
  function hidh_set_config (line 537) | bool hidh_set_config(uint8_t daddr, uint8_t itf_num) {
  function process_set_config (line 553) | static void process_set_config(tuh_xfer_t* xfer) {
  function config_driver_mount_complete (line 611) | static void config_driver_mount_complete(uint8_t daddr, uint8_t idx, uin...
  function tuh_hid_parse_report_descriptor (line 627) | uint8_t tuh_hid_parse_report_descriptor(tuh_hid_report_info_t* report_in...

FILE: pico-sdk/lib/tinyusb/src/class/hid/hid_host.h
  type tuh_hid_report_info_t (line 50) | typedef struct {

FILE: pico-sdk/lib/tinyusb/src/class/msc/msc.h
  type msc_subclass_type_t (line 40) | typedef enum
  type msc_protocol_type_t (line 57) | typedef enum
  type msc_request_type_t (line 65) | typedef enum
  type msc_csw_status_t (line 74) | typedef enum
  type msc_cbw_t (line 82) | typedef struct TU_ATTR_PACKED
  type msc_csw_t (line 96) | typedef struct TU_ATTR_PACKED
  type scsi_cmd_type_t (line 111) | typedef enum
  type scsi_sense_key_type_t (line 127) | typedef enum
  type scsi_test_unit_ready_t (line 149) | typedef struct TU_ATTR_PACKED
  type scsi_inquiry_t (line 160) | typedef struct TU_ATTR_PACKED
  type scsi_inquiry_resp_t (line 173) | typedef struct TU_ATTR_PACKED
  type scsi_sense_fixed_resp_t (line 219) | typedef struct TU_ATTR_PACKED
  type scsi_mode_sense6_t (line 245) | typedef struct TU_ATTR_PACKED
  type scsi_mode_sense6_resp_t (line 264) | typedef struct TU_ATTR_PACKED
  type scsi_prevent_allow_medium_removal_t (line 277) | typedef struct TU_ATTR_PACKED
  type scsi_start_stop_unit_t (line 287) | typedef struct TU_ATTR_PACKED
  type scsi_read_format_capacity_t (line 314) | typedef struct TU_ATTR_PACKED
  type scsi_read_format_capacity_data_t (line 324) | typedef struct TU_ATTR_PACKED{
  type scsi_read_capacity10_t (line 344) | typedef struct TU_ATTR_PACKED
  type scsi_read_capacity10_resp_t (line 357) | typedef struct {
  type scsi_read10_t (line 365) | typedef struct TU_ATTR_PACKED

FILE: pico-sdk/lib/tinyusb/src/class/msc/msc_device.c
  type mscd_interface_t (line 56) | typedef struct
  function TU_ATTR_ALWAYS_INLINE (line 89) | TU_ATTR_ALWAYS_INLINE static inline bool is_data_in(uint8_t dir)
  function send_csw (line 94) | static inline bool send_csw(uint8_t rhport, mscd_interface_t* p_msc)
  function prepare_cbw (line 103) | static inline bool prepare_cbw(uint8_t rhport, mscd_interface_t* p_msc)
  function fail_scsi_op (line 109) | static void fail_scsi_op(uint8_t rhport, mscd_interface_t* p_msc, uint8_...
  function rdwr10_get_lba (line 135) | static inline uint32_t rdwr10_get_lba(uint8_t const command[])
  function rdwr10_get_blockcount (line 144) | static inline uint16_t rdwr10_get_blockcount(msc_cbw_t const* cbw)
  function rdwr10_get_blocksize (line 150) | static inline uint16_t rdwr10_get_blocksize(msc_cbw_t const* cbw)
  function rdwr10_validate_cmd (line 161) | uint8_t rdwr10_validate_cmd(msc_cbw_t const* cbw)
  function tud_msc_set_sense (line 234) | bool tud_msc_set_sense(uint8_t lun, uint8_t sense_key, uint8_t add_sense...
  function set_sense_medium_not_present (line 245) | static inline void set_sense_medium_not_present(uint8_t lun)
  function mscd_init (line 254) | void mscd_init(void) {
  function mscd_deinit (line 258) | bool mscd_deinit(void) {
  function mscd_reset (line 263) | void mscd_reset(uint8_t rhport)
  function mscd_open (line 269) | uint16_t mscd_open(uint8_t rhport, tusb_desc_interface_t const * itf_des...
  function proc_bot_reset (line 294) | static void proc_bot_reset(mscd_interface_t* p_msc)
  function mscd_control_xfer_cb (line 308) | bool mscd_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_re...
  function mscd_xfer_cb (line 393) | bool mscd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t event, ...
  function proc_builtin_scsi (line 654) | static int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16]...
  function proc_read10_cmd (line 853) | static void proc_read10_cmd(uint8_t rhport, mscd_interface_t* p_msc)
  function proc_write10_cmd (line 891) | static void proc_write10_cmd(uint8_t rhport, mscd_interface_t* p_msc)
  function proc_write10_new_data (line 918) | static void proc_write10_new_data(uint8_t rhport, mscd_interface_t* p_ms...

FILE: pico-sdk/lib/tinyusb/src/common/tusb_common.h
  function TU_ATTR_ALWAYS_INLINE (line 104) | TU_ATTR_ALWAYS_INLINE static inline int tu_memset_s(void *dest, size_t d...
  function TU_ATTR_ALWAYS_INLINE (line 114) | TU_ATTR_ALWAYS_INLINE static inline int tu_memcpy_s(void *dest, size_t d...
  function TU_ATTR_ALWAYS_INLINE (line 125) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_u32(uint8_t b3, uint8_t ...
  function TU_ATTR_ALWAYS_INLINE (line 129) | TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_u16(uint8_t high, uint8_...
  function TU_ATTR_ALWAYS_INLINE (line 133) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte3(uint32_t ui32) ...
  function TU_ATTR_ALWAYS_INLINE (line 134) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte2(uint32_t ui32) ...
  function TU_ATTR_ALWAYS_INLINE (line 135) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte1(uint32_t ui32) ...
  function TU_ATTR_ALWAYS_INLINE (line 136) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u32_byte0(uint32_t ui32) ...
  function TU_ATTR_ALWAYS_INLINE (line 138) | TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_u32_high16(uint32_t ui32...
  function TU_ATTR_ALWAYS_INLINE (line 139) | TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_u32_low16 (uint32_t ui32...
  function TU_ATTR_ALWAYS_INLINE (line 141) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u16_high(uint16_t ui16) {...
  function TU_ATTR_ALWAYS_INLINE (line 142) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_u16_low (uint16_t ui16) {...
  function TU_ATTR_ALWAYS_INLINE (line 145) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_bit_set  (uint32_t value...
  function TU_ATTR_ALWAYS_INLINE (line 146) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_bit_clear(uint32_t value...
  function TU_ATTR_ALWAYS_INLINE (line 147) | TU_ATTR_ALWAYS_INLINE static inline bool     tu_bit_test (uint32_t value...
  function TU_ATTR_ALWAYS_INLINE (line 150) | TU_ATTR_ALWAYS_INLINE static inline uint8_t  tu_min8  (uint8_t  x, uint8...
  function TU_ATTR_ALWAYS_INLINE (line 151) | TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_min16 (uint16_t x, uint1...
  function TU_ATTR_ALWAYS_INLINE (line 152) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_min32 (uint32_t x, uint3...
  function TU_ATTR_ALWAYS_INLINE (line 155) | TU_ATTR_ALWAYS_INLINE static inline uint8_t  tu_max8  (uint8_t  x, uint8...
  function TU_ATTR_ALWAYS_INLINE (line 156) | TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_max16 (uint16_t x, uint1...
  function TU_ATTR_ALWAYS_INLINE (line 157) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_max32 (uint32_t x, uint3...
  function TU_ATTR_ALWAYS_INLINE (line 160) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_align(uint32_t value, ui...
  function TU_ATTR_ALWAYS_INLINE (line 164) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_align4  (uint32_t value)...
  function TU_ATTR_ALWAYS_INLINE (line 165) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_align8  (uint32_t value)...
  function TU_ATTR_ALWAYS_INLINE (line 166) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_align16 (uint32_t value)...
  function TU_ATTR_ALWAYS_INLINE (line 167) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_align32 (uint32_t value)...
  function TU_ATTR_ALWAYS_INLINE (line 168) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_align4k (uint32_t value)...
  function TU_ATTR_ALWAYS_INLINE (line 169) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_offset4k(uint32_t value)...
  function TU_ATTR_ALWAYS_INLINE (line 171) | TU_ATTR_ALWAYS_INLINE static inline bool tu_is_aligned32(uint32_t value)...
  function TU_ATTR_ALWAYS_INLINE (line 172) | TU_ATTR_ALWAYS_INLINE static inline bool tu_is_aligned64(uint64_t value)...
  function TU_ATTR_ALWAYS_INLINE (line 175) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_div_ceil(uint32_t v, uin...
  function tu_log2 (line 179) | static inline uint8_t tu_log2(uint32_t value)
  function tu_is_power_of_two (line 191) | static inline bool tu_is_power_of_two(uint32_t value)
  type TU_ATTR_PACKED (line 200) | typedef struct { uint16_t val; } TU_ATTR_PACKED
  type TU_ATTR_PACKED (line 201) | typedef struct { uint32_t val; } TU_ATTR_PACKED
  function TU_ATTR_ALWAYS_INLINE (line 203) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_unaligned_read32(const v...
  function TU_ATTR_ALWAYS_INLINE (line 209) | TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write32(void* mem,...
  function TU_ATTR_ALWAYS_INLINE (line 215) | TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_unaligned_read16(const v...
  function TU_ATTR_ALWAYS_INLINE (line 221) | TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write16(void* mem,...
  function TU_ATTR_ALWAYS_INLINE (line 233) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_unaligned_read32(const v...
  function TU_ATTR_ALWAYS_INLINE (line 239) | TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write32(void* mem,...
  function TU_ATTR_ALWAYS_INLINE (line 248) | TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_unaligned_read16(const v...
  function TU_ATTR_ALWAYS_INLINE (line 254) | TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write16(void* mem,...
  function TU_ATTR_ALWAYS_INLINE (line 265) | TU_ATTR_ALWAYS_INLINE static inline uint32_t tu_unaligned_read32(const v...
  function TU_ATTR_ALWAYS_INLINE (line 269) | TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_unaligned_read16(const v...
  function TU_ATTR_ALWAYS_INLINE (line 273) | TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write32(void *mem,...
  function TU_ATTR_ALWAYS_INLINE (line 277) | TU_ATTR_ALWAYS_INLINE static inline void tu_unaligned_write16(void *mem,...

FILE: pico-sdk/lib/tinyusb/src/common/tusb_debug.h
  function tu_print_buf (line 61) | static inline void tu_print_buf(uint8_t const* buf, uint32_t bufsize) {
  type tu_lookup_entry_t (line 100) | typedef struct {
  type tu_lookup_table_t (line 105) | typedef struct {

FILE: pico-sdk/lib/tinyusb/src/common/tusb_fifo.c
  function TU_ATTR_ALWAYS_INLINE (line 41) | TU_ATTR_ALWAYS_INLINE static inline void _ff_lock(osal_mutex_t mutex)
  function TU_ATTR_ALWAYS_INLINE (line 46) | TU_ATTR_ALWAYS_INLINE static inline void _ff_unlock(osal_mutex_t mutex)
  type tu_fifo_copy_mode_t (line 62) | typedef enum
  function tu_fifo_config (line 70) | bool tu_fifo_config(tu_fifo_t *f, void* buffer, uint16_t depth, uint16_t...
  function _ff_push_const_addr (line 101) | static void _ff_push_const_addr(uint8_t * ff_buf, const void * app_buf, ...
  function _ff_pull_const_addr (line 124) | static void _ff_pull_const_addr(void * app_buf, const uint8_t * ff_buf, ...
  function _ff_push (line 149) | static inline void _ff_push(tu_fifo_t* f, void const * app_buf, uint16_t...
  function _ff_push_n (line 155) | static void _ff_push_n(tu_fifo_t* f, void const * app_buf, uint16_t n, u...
  function _ff_pull (line 237) | static inline void _ff_pull(tu_fifo_t* f, void * app_buf, uint16_t rel)
  function _ff_pull_n (line 243) | static void _ff_pull_n(tu_fifo_t* f, void* app_buf, uint16_t n, uint16_t...
  function TU_ATTR_ALWAYS_INLINE (line 330) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 344) | TU_ATTR_ALWAYS_INLINE static inline
  function advance_index (line 357) | static uint16_t advance_index(uint16_t depth, uint16_t idx, uint16_t off...
  function backward_index (line 374) | static uint16_t backward_index(uint16_t depth, uint16_t idx, uint16_t of...
  function TU_ATTR_ALWAYS_INLINE (line 391) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 402) | TU_ATTR_ALWAYS_INLINE static inline
  function _tu_fifo_peek (line 421) | static bool _tu_fifo_peek(tu_fifo_t* f, void * p_buffer, uint16_t wr_idx...
  function _tu_fifo_peek_n (line 445) | static uint16_t _tu_fifo_peek_n(tu_fifo_t* f, void * p_buffer, uint16_t ...
  function _tu_fifo_write_n (line 470) | static uint16_t _tu_fifo_write_n(tu_fifo_t* f, const void * data, uint16...
  function _tu_fifo_read_n (line 557) | static uint16_t _tu_fifo_read_n(tu_fifo_t* f, void * buffer, uint16_t n,...
  function tu_fifo_count (line 591) | uint16_t tu_fifo_count(tu_fifo_t* f)
  function tu_fifo_empty (line 609) | bool tu_fifo_empty(tu_fifo_t* f)
  function tu_fifo_full (line 627) | bool tu_fifo_full(tu_fifo_t* f)
  function tu_fifo_remaining (line 645) | uint16_t tu_fifo_remaining(tu_fifo_t* f)
  function tu_fifo_overflowed (line 671) | bool tu_fifo_overflowed(tu_fifo_t* f)
  function tu_fifo_correct_read_pointer (line 677) | void tu_fifo_correct_read_pointer(tu_fifo_t* f)
  function tu_fifo_read (line 700) | bool tu_fifo_read(tu_fifo_t* f, void * buffer)
  function tu_fifo_read_n (line 731) | uint16_t tu_fifo_read_n(tu_fifo_t* f, void * buffer, uint16_t n)
  function tu_fifo_read_n_const_addr_full_words (line 754) | uint16_t tu_fifo_read_n_const_addr_full_words(tu_fifo_t* f, void * buffe...
  function tu_fifo_peek (line 773) | bool tu_fifo_peek(tu_fifo_t* f, void * p_buffer)
  function tu_fifo_peek_n (line 796) | uint16_t tu_fifo_peek_n(tu_fifo_t* f, void * p_buffer, uint16_t n)
  function tu_fifo_write (line 820) | bool tu_fifo_write(tu_fifo_t* f, const void * data)
  function tu_fifo_write_n (line 862) | uint16_t tu_fifo_write_n(tu_fifo_t* f, const void * data, uint16_t n)
  function tu_fifo_write_n_const_addr_full_words (line 883) | uint16_t tu_fifo_write_n_const_addr_full_words(tu_fifo_t* f, const void ...
  function tu_fifo_clear (line 897) | bool tu_fifo_clear(tu_fifo_t *f)
  function tu_fifo_set_overwritable (line 920) | bool tu_fifo_set_overwritable(tu_fifo_t *f, bool overwritable)
  function tu_fifo_advance_write_pointer (line 949) | void tu_fifo_advance_write_pointer(tu_fifo_t *f, uint16_t n)
  function tu_fifo_advance_read_pointer (line 970) | void tu_fifo_advance_read_pointer(tu_fifo_t *f, uint16_t n)
  function tu_fifo_get_read_info (line 990) | void tu_fifo_get_read_info(tu_fifo_t *f, tu_fifo_buffer_info_t *info)
  function tu_fifo_get_write_info (line 1058) | void tu_fifo_get_write_info(tu_fifo_t *f, tu_fifo_buffer_info_t *info)

FILE: pico-sdk/lib/tinyusb/src/common/tusb_fifo.h
  type tu_fifo_t (line 106) | typedef struct {
  type tu_fifo_buffer_info_t (line 125) | typedef struct {
  function TU_ATTR_ALWAYS_INLINE (line 148) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 179) | TU_ATTR_ALWAYS_INLINE static inline

FILE: pico-sdk/lib/tinyusb/src/common/tusb_private.h
  type tu_edpt_state_t (line 37) | typedef struct TU_ATTR_PACKED
  type tu_edpt_stream_t (line 44) | typedef struct {
  function TU_ATTR_ALWAYS_INLINE (line 99) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 107) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 114) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 133) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 149) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 155) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 163) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 168) | TU_ATTR_ALWAYS_INLINE static inline

FILE: pico-sdk/lib/tinyusb/src/common/tusb_types.h
  type tusb_speed_t (line 43) | typedef enum {
  type tusb_xfer_type_t (line 51) | typedef enum {
  type tusb_dir_t (line 58) | typedef enum {
  type tusb_iso_ep_attribute_t (line 74) | typedef enum {
  type tusb_desc_type_t (line 85) | typedef enum {
  type tusb_request_code_t (line 114) | typedef enum {
  type tusb_request_feature_selector_t (line 130) | typedef enum {
  type tusb_request_type_t (line 136) | typedef enum {
  type tusb_request_recipient_t (line 143) | typedef enum {
  type tusb_class_code_t (line 151) | typedef enum {
  type misc_subclass_type_t (line 177) | typedef enum
  type misc_protocol_type_t (line 182) | typedef enum {
  type app_subclass_type_t (line 186) | typedef enum {
  type device_capability_type_t (line 191) | typedef enum {
  type xfer_result_t (line 220) | typedef enum {
  type microsoft_os_20_type_t (line 238) | typedef enum {
  type tusb_desc_device_t (line 270) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_bos_t (line 293) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_configuration_t (line 303) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_interface_t (line 318) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_endpoint_t (line 334) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_other_speed_t (line 354) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_device_qualifier_t (line 367) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_interface_assoc_t (line 384) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_string_t (line 401) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_bos_platform_t (line 408) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_webusb_url_t (line 418) | typedef struct TU_ATTR_PACKED {
  type tusb_desc_dfu_functional_t (line 426) | typedef struct TU_ATTR_PACKED {
  type tusb_control_request_t (line 451) | typedef struct TU_ATTR_PACKED {
  function TU_ATTR_ALWAYS_INLINE (line 478) | TU_ATTR_ALWAYS_INLINE static inline tusb_dir_t tu_edpt_dir(uint8_t addr) {
  function TU_ATTR_ALWAYS_INLINE (line 483) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_edpt_number(uint8_t addr) {
  function TU_ATTR_ALWAYS_INLINE (line 487) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_edpt_addr(uint8_t num, ui...
  function TU_ATTR_ALWAYS_INLINE (line 491) | TU_ATTR_ALWAYS_INLINE static inline uint16_t tu_edpt_packet_size(tusb_de...
  function TU_ATTR_ALWAYS_INLINE (line 496) | TU_ATTR_ALWAYS_INLINE static inline const char *tu_edpt_type_str(tusb_xf...
  function TU_ATTR_ALWAYS_INLINE (line 507) | TU_ATTR_ALWAYS_INLINE static inline uint8_t const * tu_desc_next(void co...
  function TU_ATTR_ALWAYS_INLINE (line 513) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_desc_type(void const* des...
  function TU_ATTR_ALWAYS_INLINE (line 518) | TU_ATTR_ALWAYS_INLINE static inline uint8_t tu_desc_len(void const* desc) {

FILE: pico-sdk/lib/tinyusb/src/device/dcd.h
  type dcd_eventid_t (line 50) | typedef enum {
  type TU_ATTR_ALIGNED (line 67) | struct TU_ATTR_ALIGNED
  type test_mode_t (line 100) | typedef enum {
  function TU_ATTR_ALWAYS_INLINE (line 216) | TU_ATTR_ALWAYS_INLINE static inline void dcd_event_bus_signal (uint8_t r...
  function TU_ATTR_ALWAYS_INLINE (line 222) | TU_ATTR_ALWAYS_INLINE static inline  void dcd_event_bus_reset (uint8_t r...
  function TU_ATTR_ALWAYS_INLINE (line 229) | TU_ATTR_ALWAYS_INLINE static inline void dcd_event_setup_received(uint8_...
  function TU_ATTR_ALWAYS_INLINE (line 237) | TU_ATTR_ALWAYS_INLINE static inline void dcd_event_xfer_complete (uint8_...
  function TU_ATTR_ALWAYS_INLINE (line 247) | TU_ATTR_ALWAYS_INLINE static inline void dcd_event_sof(uint8_t rhport, u...

FILE: pico-sdk/lib/tinyusb/src/device/usbd.c
  function TU_ATTR_WEAK (line 48) | TU_ATTR_WEAK bool dcd_deinit(uint8_t rhport) {
  function TU_ATTR_WEAK (line 53) | TU_ATTR_WEAK void tud_event_hook_cb(uint8_t rhport, uint32_t eventid, bo...
  function TU_ATTR_WEAK (line 59) | TU_ATTR_WEAK void tud_sof_cb(uint32_t frame_count) {
  type usbd_device_t (line 70) | typedef struct {
  function TU_ATTR_ALWAYS_INLINE (line 272) | TU_ATTR_ALWAYS_INLINE static inline usbd_class_driver_t const * get_driv...
  function TU_ATTR_ALWAYS_INLINE (line 304) | TU_ATTR_ALWAYS_INLINE static inline bool queue_event(dcd_event_t const *...
  function usbd_driver_print_control_complete_name (line 343) | void usbd_driver_print_control_complete_name(usbd_control_xfer_cb_t call...
  function tusb_speed_t (line 358) | tusb_speed_t tud_speed_get(void) {
  function tud_connected (line 362) | bool tud_connected(void) {
  function tud_mounted (line 366) | bool tud_mounted(void) {
  function tud_suspended (line 370) | bool tud_suspended(void) {
  function tud_remote_wakeup (line 374) | bool tud_remote_wakeup(void) {
  function tud_disconnect (line 381) | bool tud_disconnect(void) {
  function tud_connect (line 387) | bool tud_connect(void) {
  function tud_sof_cb_enable (line 393) | bool tud_sof_cb_enable(bool en)
  function tud_inited (line 402) | bool tud_inited(void) {
  function tud_init (line 406) | bool tud_init(uint8_t rhport) {
  function tud_deinit (line 450) | bool tud_deinit(uint8_t rhport) {
  function configuration_reset (line 485) | static void configuration_reset(uint8_t rhport) {
  function usbd_reset (line 497) | static void usbd_reset(uint8_t rhport) {
  function tud_task_event_ready (line 502) | bool tud_task_event_ready(void) {
  function tud_task_ext (line 522) | void tud_task_ext(uint32_t timeout_ms, bool in_isr) {
  function invoke_class_control (line 650) | static bool invoke_class_control(uint8_t rhport, usbd_class_driver_t con...
  function process_control_request (line 658) | static bool process_control_request(uint8_t rhport, tusb_control_request...
  function process_set_config (line 926) | static bool process_set_config(uint8_t rhport, uint8_t cfg_num)
  function process_get_descriptor (line 1019) | static bool process_get_descriptor(uint8_t rhport, tusb_control_request_...
  function process_test_mode_cb (line 1125) | static bool process_test_mode_cb(uint8_t rhport, uint8_t stage, tusb_con...
  function TU_ATTR_FAST_FUNC (line 1141) | TU_ATTR_FAST_FUNC void dcd_event_handler(dcd_event_t const* event, bool ...
  function usbd_int_set (line 1214) | void usbd_int_set(bool enabled)
  function usbd_open_edpt_pair (line 1226) | bool usbd_open_edpt_pair(uint8_t rhport, uint8_t const* p_desc, uint8_t ...
  function usbd_defer_func (line 1250) | void usbd_defer_func(osal_task_func_t func, void* param, bool in_isr) {
  function usbd_edpt_open (line 1265) | bool usbd_edpt_open(uint8_t rhport, tusb_desc_endpoint_t const* desc_ep) {
  function usbd_edpt_claim (line 1274) | bool usbd_edpt_claim(uint8_t rhport, uint8_t ep_addr) {
  function usbd_edpt_release (line 1287) | bool usbd_edpt_release(uint8_t rhport, uint8_t ep_addr) {
  function usbd_edpt_xfer (line 1297) | bool usbd_edpt_xfer(uint8_t rhport, uint8_t ep_addr, uint8_t* buffer, ui...
  function usbd_edpt_xfer_fifo (line 1336) | bool usbd_edpt_xfer_fifo(uint8_t rhport, uint8_t ep_addr, tu_fifo_t* ff,...
  function usbd_edpt_busy (line 1364) | bool usbd_edpt_busy(uint8_t rhport, uint8_t ep_addr) {
  function usbd_edpt_stall (line 1373) | void usbd_edpt_stall(uint8_t rhport, uint8_t ep_addr) {
  function usbd_edpt_clear_stall (line 1386) | void usbd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) {
  function usbd_edpt_stalled (line 1399) | bool usbd_edpt_stalled(uint8_t rhport, uint8_t ep_addr) {
  function usbd_edpt_close (line 1412) | void usbd_edpt_close(uint8_t rhport, uint8_t ep_addr) {
  function usbd_sof_enable (line 1429) | void usbd_sof_enable(uint8_t rhport, sof_consumer_t consumer, bool en) {
  function usbd_edpt_iso_alloc (line 1446) | bool usbd_edpt_iso_alloc(uint8_t rhport, uint8_t ep_addr, uint16_t large...
  function usbd_edpt_iso_activate (line 1455) | bool usbd_edpt_iso_activate(uint8_t rhport, tusb_desc_endpoint_t const* ...

FILE: pico-sdk/lib/tinyusb/src/device/usbd.h
  function TU_ATTR_ALWAYS_INLINE (line 55) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 84) | TU_ATTR_ALWAYS_INLINE static inline

FILE: pico-sdk/lib/tinyusb/src/device/usbd_control.c
  function TU_ATTR_WEAK (line 38) | TU_ATTR_WEAK void dcd_edpt0_status_complete(uint8_t rhport, tusb_control...
  type usbd_control_xfer_t (line 56) | typedef struct {
  function _status_stage_xact (line 74) | static inline bool _status_stage_xact(uint8_t rhport, tusb_control_reque...
  function tud_control_status (line 81) | bool tud_control_status(uint8_t rhport, tusb_control_request_t const* re...
  function _data_stage_xact (line 93) | static bool _data_stage_xact(uint8_t rhport) {
  function tud_control_xfer (line 111) | bool tud_control_xfer(uint8_t rhport, tusb_control_request_t const* requ...
  function usbd_control_reset (line 142) | void usbd_control_reset(void) {
  function usbd_control_set_complete_callback (line 147) | void usbd_control_set_complete_callback(usbd_control_xfer_cb_t fp) {
  function usbd_control_set_request (line 152) | void usbd_control_set_request(tusb_control_request_t const* request) {
  function usbd_control_xfer_cb (line 162) | bool usbd_control_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t...

FILE: pico-sdk/lib/tinyusb/src/device/usbd_pvt.h
  type sof_consumer_t (line 42) | typedef enum {
  type usbd_class_driver_t (line 51) | typedef struct {
  function TU_ATTR_ALWAYS_INLINE (line 114) | TU_ATTR_ALWAYS_INLINE static inline

FILE: pico-sdk/lib/tinyusb/src/host/hcd.h
  type hcd_eventid_t (line 56) | typedef enum
  type hcd_event_t (line 68) | typedef struct
  type hcd_devtree_info_t (line 99) | typedef struct
  function TU_ATTR_ALWAYS_INLINE (line 203) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 215) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 227) | TU_ATTR_ALWAYS_INLINE static inline

FILE: pico-sdk/lib/tinyusb/src/host/hub.c
  type hub_interface_t (line 43) | typedef struct
  function TU_ATTR_ALWAYS_INLINE (line 57) | TU_ATTR_ALWAYS_INLINE
  function hub_port_clear_feature (line 86) | bool hub_port_clear_feature(uint8_t hub_addr, uint8_t hub_port, uint8_t ...
  function hub_port_set_feature (line 118) | bool hub_port_set_feature(uint8_t hub_addr, uint8_t hub_port, uint8_t fe...
  function hub_port_get_status (line 150) | bool hub_port_get_status(uint8_t hub_addr, uint8_t hub_port, void* resp,
  function hub_init (line 185) | bool hub_init(void) {
  function hub_deinit (line 190) | bool hub_deinit(void) {
  function hub_open (line 194) | bool hub_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t co...
  function hub_close (line 224) | void hub_close(uint8_t dev_addr)
  function hub_edpt_status_xfer (line 235) | bool hub_edpt_status_xfer(uint8_t dev_addr)
  function hub_set_config (line 249) | bool hub_set_config(uint8_t dev_addr, uint8_t itf_num)
  function config_set_port_power (line 284) | static void config_set_port_power (tuh_xfer_t* xfer)
  function config_port_power_complete (line 302) | static void config_port_power_complete (tuh_xfer_t* xfer)
  function hub_xfer_cb (line 334) | bool hub_xfer_cb(uint8_t dev_addr, uint8_t ep_addr, xfer_result_t result...
  function hub_clear_feature_complete_stub (line 375) | static void hub_clear_feature_complete_stub(tuh_xfer_t* xfer)
  function hub_get_status_complete (line 381) | static void hub_get_status_complete (tuh_xfer_t* xfer)
  function hub_port_get_status_complete (line 404) | static void hub_port_get_status_complete (tuh_xfer_t* xfer)
  function connection_clear_conn_change_complete (line 451) | static void connection_clear_conn_change_complete (tuh_xfer_t* xfer)
  function connection_port_reset_complete (line 481) | static void connection_port_reset_complete (tuh_xfer_t* xfer)

FILE: pico-sdk/lib/tinyusb/src/host/hub.h
  type descriptor_hub_desc_t (line 83) | typedef struct TU_ATTR_PACKED{
  type hub_status_response_t (line 135) | typedef struct {
  type hub_port_status_response_t (line 150) | typedef struct {
  function TU_ATTR_ALWAYS_INLINE (line 190) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 196) | TU_ATTR_ALWAYS_INLINE static inline

FILE: pico-sdk/lib/tinyusb/src/host/usbh.c
  function TU_ATTR_WEAK (line 50) | TU_ATTR_WEAK bool hcd_deinit(uint8_t rhport) {
  function TU_ATTR_WEAK (line 55) | TU_ATTR_WEAK bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const v...
  function TU_ATTR_WEAK (line 62) | TU_ATTR_WEAK void tuh_event_hook_cb(uint8_t rhport, uint32_t eventid, bo...
  type usbh_dev0_t (line 71) | typedef struct {
  type usbh_device_t (line 84) | typedef struct {
  function usbh_class_driver_t (line 210) | static inline usbh_class_driver_t const *get_driver(uint8_t drv_id) {
  function CFG_TUH_MEM_SECTION (line 258) | CFG_TUH_MEM_SECTION struct {
  function TU_ATTR_ALWAYS_INLINE (line 271) | TU_ATTR_ALWAYS_INLINE static inline usbh_device_t* get_device(uint8_t de...
  function TU_ATTR_WEAK (line 284) | TU_ATTR_WEAK void osal_task_delay(uint32_t msec) {
  function TU_ATTR_ALWAYS_INLINE (line 290) | TU_ATTR_ALWAYS_INLINE static inline bool queue_event(hcd_event_t const *...
  function tuh_mounted (line 300) | bool tuh_mounted(uint8_t dev_addr) {
  function tuh_vid_pid_get (line 306) | bool tuh_vid_pid_get(uint8_t dev_addr, uint16_t *vid, uint16_t *pid) {
  function tusb_speed_t (line 318) | tusb_speed_t tuh_speed_get(uint8_t dev_addr) {
  function tuh_rhport_is_active (line 323) | bool tuh_rhport_is_active(uint8_t rhport) {
  function tuh_rhport_reset_bus (line 327) | bool tuh_rhport_reset_bus(uint8_t rhport, bool active) {
  function tuh_configure (line 341) | bool tuh_configure(uint8_t rhport, uint32_t cfg_id, const void *cfg_para...
  function clear_device (line 345) | static void clear_device(usbh_device_t* dev) {
  function tuh_inited (line 351) | bool tuh_inited(void) {
  function tuh_init (line 355) | bool tuh_init(uint8_t rhport) {
  function tuh_deinit (line 412) | bool tuh_deinit(uint8_t rhport) {
  function tuh_task_event_ready (line 447) | bool tuh_task_event_ready(void) {
  function tuh_task_ext (line 472) | void tuh_task_ext(uint32_t timeout_ms, bool in_isr) {
  function _control_blocking_complete_cb (line 591) | static void _control_blocking_complete_cb(tuh_xfer_t* xfer) {
  function tuh_control_xfer (line 597) | bool tuh_control_xfer (tuh_xfer_t* xfer) {
  function TU_ATTR_ALWAYS_INLINE (line 669) | TU_ATTR_ALWAYS_INLINE static inline void _set_control_xfer_stage(uint8_t...
  function _control_xfer_complete (line 675) | static void _control_xfer_complete(uint8_t daddr, xfer_result_t result) {
  function usbh_control_xfer_cb (line 698) | static bool usbh_control_xfer_cb (uint8_t daddr, uint8_t ep_addr, xfer_r...
  function tuh_edpt_xfer (line 760) | bool tuh_edpt_xfer(tuh_xfer_t* xfer) {
  function tuh_edpt_abort_xfer (line 776) | bool tuh_edpt_abort_xfer(uint8_t daddr, uint8_t ep_addr) {
  function usbh_get_rhport (line 807) | uint8_t usbh_get_rhport(uint8_t dev_addr) {
  function usbh_int_set (line 816) | void usbh_int_set(bool enabled) {
  function usbh_defer_func (line 825) | void usbh_defer_func(osal_task_func_t func, void *param, bool in_isr) {
  function usbh_edpt_claim (line 839) | bool usbh_edpt_claim(uint8_t dev_addr, uint8_t ep_addr) {
  function usbh_edpt_release (line 854) | bool usbh_edpt_release(uint8_t dev_addr, uint8_t ep_addr) {
  function usbh_edpt_xfer_with_callback (line 870) | bool usbh_edpt_xfer_with_callback(uint8_t dev_addr, uint8_t ep_addr, uin...
  function usbh_edpt_control_open (line 909) | static bool usbh_edpt_control_open(uint8_t dev_addr, uint8_t max_packet_...
  function tuh_edpt_open (line 923) | bool tuh_edpt_open(uint8_t dev_addr, tusb_desc_endpoint_t const* desc_ep) {
  function usbh_edpt_busy (line 928) | bool usbh_edpt_busy(uint8_t dev_addr, uint8_t ep_addr) {
  function hcd_devtree_get_info (line 942) | void hcd_devtree_get_info(uint8_t dev_addr, hcd_devtree_info_t* devtree_...
  function TU_ATTR_FAST_FUNC (line 957) | TU_ATTR_FAST_FUNC void hcd_event_handler(hcd_event_t const* event, bool ...
  function _get_descriptor (line 982) | static bool _get_descriptor(uint8_t daddr, uint8_t type, uint8_t index, ...
  function tuh_descriptor_get (line 1007) | bool tuh_descriptor_get(uint8_t daddr, uint8_t type, uint8_t index, void...
  function tuh_descriptor_get_device (line 1012) | bool tuh_descriptor_get_device(uint8_t daddr, void* buffer, uint16_t len,
  function tuh_descriptor_get_configuration (line 1018) | bool tuh_descriptor_get_configuration(uint8_t daddr, uint8_t index, void...
  function tuh_descriptor_get_string (line 1025) | bool tuh_descriptor_get_string(uint8_t daddr, uint8_t index, uint16_t la...
  function tuh_descriptor_get_manufacturer_string (line 1031) | bool tuh_descriptor_get_manufacturer_string(uint8_t daddr, uint16_t lang...
  function tuh_descriptor_get_product_string (line 1040) | bool tuh_descriptor_get_product_string(uint8_t daddr, uint16_t language_...
  function tuh_descriptor_get_serial_string (line 1048) | bool tuh_descriptor_get_serial_string(uint8_t daddr, uint16_t language_i...
  function tuh_descriptor_get_hid_report (line 1057) | bool tuh_descriptor_get_hid_report(uint8_t daddr, uint8_t itf_num, uint8...
  function tuh_configuration_set (line 1083) | bool tuh_configuration_set(uint8_t daddr, uint8_t config_num,
  function tuh_interface_set (line 1109) | bool tuh_interface_set(uint8_t daddr, uint8_t itf_num, uint8_t itf_alt,
  function tuh_descriptor_get_sync (line 1144) | uint8_t tuh_descriptor_get_sync(uint8_t daddr, uint8_t type, uint8_t index,
  function tuh_descriptor_get_device_sync (line 1149) | uint8_t tuh_descriptor_get_device_sync(uint8_t daddr, void* buffer, uint...
  function tuh_descriptor_get_configuration_sync (line 1153) | uint8_t tuh_descriptor_get_configuration_sync(uint8_t daddr, uint8_t index,
  function tuh_descriptor_get_hid_report_sync (line 1158) | uint8_t tuh_descriptor_get_hid_report_sync(uint8_t daddr, uint8_t itf_nu...
  function tuh_descriptor_get_string_sync (line 1163) | uint8_t tuh_descriptor_get_string_sync(uint8_t daddr, uint8_t index, uin...
  function tuh_descriptor_get_manufacturer_string_sync (line 1168) | uint8_t tuh_descriptor_get_manufacturer_string_sync(uint8_t daddr, uint1...
  function tuh_descriptor_get_product_string_sync (line 1173) | uint8_t tuh_descriptor_get_product_string_sync(uint8_t daddr, uint16_t l...
  function tuh_descriptor_get_serial_string_sync (line 1178) | uint8_t tuh_descriptor_get_serial_string_sync(uint8_t daddr, uint16_t la...
  function TU_ATTR_ALWAYS_INLINE (line 1187) | TU_ATTR_ALWAYS_INLINE static inline bool is_hub_addr(uint8_t daddr) {
  function process_removing_device (line 1212) | static void process_removing_device(uint8_t rhport, uint8_t hub_addr, ui...
  function process_enumeration (line 1308) | static void process_enumeration(tuh_xfer_t* xfer) {
  function enum_new_device (line 1510) | static bool enum_new_device(hcd_event_t* event) {
  function get_new_address (line 1558) | static uint8_t get_new_address(bool is_hub) {
  function enum_request_set_addr (line 1577) | static bool enum_request_set_addr(void) {
  function _parse_configuration_descriptor (line 1617) | static bool _parse_configuration_descriptor(uint8_t dev_addr, tusb_desc_...
  function usbh_driver_set_config_complete (line 1703) | void usbh_driver_set_config_complete(uint8_t dev_addr, uint8_t itf_num) {
  function enum_full_complete (line 1732) | static void enum_full_complete(void) {

FILE: pico-sdk/lib/tinyusb/src/host/usbh.h
  type tuh_xfer_s (line 41) | struct tuh_xfer_s
  type tuh_xfer_t (line 42) | typedef struct tuh_xfer_s tuh_xfer_t;
  type tuh_xfer_s (line 50) | struct tuh_xfer_s {
  type tuh_itf_info_t (line 71) | typedef struct {
  type tuh_configure_max3421_t (line 83) | typedef struct {
  type tuh_configure_param_t (line 89) | typedef union {
  function TU_ATTR_ALWAYS_INLINE (line 139) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 179) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 187) | TU_ATTR_ALWAYS_INLINE static inline

FILE: pico-sdk/lib/tinyusb/src/host/usbh_pvt.h
  type usbh_class_driver_t (line 52) | typedef struct {
  function TU_ATTR_ALWAYS_INLINE (line 86) | TU_ATTR_ALWAYS_INLINE

FILE: pico-sdk/lib/tinyusb/src/osal/osal_none.h
  type osal_semaphore_def_t (line 46) | typedef struct {
  type osal_semaphore_def_t (line 50) | typedef osal_semaphore_def_t* osal_semaphore_t;
  function TU_ATTR_ALWAYS_INLINE (line 52) | TU_ATTR_ALWAYS_INLINE static inline osal_semaphore_t osal_semaphore_crea...
  function TU_ATTR_ALWAYS_INLINE (line 57) | TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_delete(osal_sema...
  function TU_ATTR_ALWAYS_INLINE (line 63) | TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_post(osal_semaph...
  function TU_ATTR_ALWAYS_INLINE (line 70) | TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_wait(osal_semaph...
  function TU_ATTR_ALWAYS_INLINE (line 79) | TU_ATTR_ALWAYS_INLINE static inline void osal_semaphore_reset(osal_semap...
  type osal_semaphore_def_t (line 87) | typedef osal_semaphore_def_t osal_mutex_def_t;
  type osal_semaphore_t (line 88) | typedef osal_semaphore_t osal_mutex_t;
  function TU_ATTR_ALWAYS_INLINE (line 94) | TU_ATTR_ALWAYS_INLINE static inline osal_mutex_t osal_mutex_create(osal_...
  function TU_ATTR_ALWAYS_INLINE (line 99) | TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_delete(osal_mutex_t ...
  function TU_ATTR_ALWAYS_INLINE (line 104) | TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_lock (osal_mutex_t m...
  function TU_ATTR_ALWAYS_INLINE (line 108) | TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_unlock(osal_mutex_t ...
  type osal_queue_def_t (line 125) | typedef struct {
  type osal_queue_def_t (line 130) | typedef osal_queue_def_t* osal_queue_t;
  function TU_ATTR_ALWAYS_INLINE (line 141) | TU_ATTR_ALWAYS_INLINE static inline void _osal_q_lock(osal_queue_t qhdl) {
  function TU_ATTR_ALWAYS_INLINE (line 147) | TU_ATTR_ALWAYS_INLINE static inline void _osal_q_unlock(osal_queue_t qhd...
  function TU_ATTR_ALWAYS_INLINE (line 152) | TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_...
  function TU_ATTR_ALWAYS_INLINE (line 157) | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_delete(osal_queue_t ...
  function TU_ATTR_ALWAYS_INLINE (line 162) | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_receive(osal_queue_t...
  function TU_ATTR_ALWAYS_INLINE (line 172) | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_send(osal_queue_t qh...
  function TU_ATTR_ALWAYS_INLINE (line 186) | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_empty(osal_queue_t q...

FILE: pico-sdk/lib/tinyusb/src/osal/osal_pico.h
  function TU_ATTR_ALWAYS_INLINE (line 42) | TU_ATTR_ALWAYS_INLINE static inline void osal_task_delay(uint32_t msec) {
  type osal_semaphore_def_t (line 49) | typedef struct semaphore osal_semaphore_def_t, * osal_semaphore_t;
  function TU_ATTR_ALWAYS_INLINE (line 51) | TU_ATTR_ALWAYS_INLINE static inline osal_semaphore_t osal_semaphore_crea...
  function TU_ATTR_ALWAYS_INLINE (line 56) | TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_delete(osal_sema...
  function TU_ATTR_ALWAYS_INLINE (line 61) | TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_post(osal_semaph...
  function TU_ATTR_ALWAYS_INLINE (line 67) | TU_ATTR_ALWAYS_INLINE static inline bool osal_semaphore_wait(osal_semaph...
  function TU_ATTR_ALWAYS_INLINE (line 71) | TU_ATTR_ALWAYS_INLINE static inline void osal_semaphore_reset(osal_semap...
  type osal_mutex_def_t (line 79) | typedef struct mutex osal_mutex_def_t, * osal_mutex_t;
  function TU_ATTR_ALWAYS_INLINE (line 81) | TU_ATTR_ALWAYS_INLINE static inline osal_mutex_t osal_mutex_create(osal_...
  function TU_ATTR_ALWAYS_INLINE (line 86) | TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_delete(osal_mutex_t ...
  function TU_ATTR_ALWAYS_INLINE (line 91) | TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_lock(osal_mutex_t mu...
  function TU_ATTR_ALWAYS_INLINE (line 95) | TU_ATTR_ALWAYS_INLINE static inline bool osal_mutex_unlock(osal_mutex_t ...
  type osal_queue_def_t (line 105) | typedef struct {
  type osal_queue_def_t (line 110) | typedef osal_queue_def_t* osal_queue_t;
  function TU_ATTR_ALWAYS_INLINE (line 119) | TU_ATTR_ALWAYS_INLINE static inline osal_queue_t osal_queue_create(osal_...
  function TU_ATTR_ALWAYS_INLINE (line 125) | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_delete(osal_queue_t ...
  function TU_ATTR_ALWAYS_INLINE (line 131) | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_receive(osal_queue_t...
  function TU_ATTR_ALWAYS_INLINE (line 141) | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_send(osal_queue_t qh...
  function TU_ATTR_ALWAYS_INLINE (line 151) | TU_ATTR_ALWAYS_INLINE static inline bool osal_queue_empty(osal_queue_t q...

FILE: pico-sdk/lib/tinyusb/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c
  function dcd_init (line 53) | void dcd_init (uint8_t rhport)
  function dcd_int_enable (line 62) | void dcd_int_enable (uint8_t rhport)
  function dcd_int_disable (line 68) | void dcd_int_disable (uint8_t rhport)
  function dcd_set_address (line 74) | void dcd_set_address (uint8_t rhport, uint8_t dev_addr)
  function dcd_remote_wakeup (line 82) | void dcd_remote_wakeup (uint8_t rhport)
  function dcd_connect (line 88) | void dcd_connect(uint8_t rhport)
  function dcd_disconnect (line 94) | void dcd_disconnect(uint8_t rhport)
  function dcd_edpt_open (line 104) | bool dcd_edpt_open (uint8_t rhport, tusb_desc_endpoint_t const * desc_ep)
  function dcd_edpt_close_all (line 110) | void dcd_edpt_close_all (uint8_t rhport)
  function dcd_edpt_xfer (line 116) | bool dcd_edpt_xfer (uint8_t rhport, uint8_t ep_addr, uint8_t * buffer, u...
  function dcd_edpt_stall (line 134) | void dcd_edpt_stall (uint8_t rhport, uint8_t ep_addr)
  function dcd_edpt_clear_stall (line 143) | void dcd_edpt_clear_stall (uint8_t rhport, uint8_t ep_addr)

FILE: pico-sdk/lib/tinyusb/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c
  function hcd_configure (line 51) | bool hcd_configure(uint8_t rhport, uint32_t cfg_id, const void *cfg_para...
  function hcd_init (line 58) | bool hcd_init(uint8_t rhport) {
  function hcd_port_reset (line 67) | void hcd_port_reset(uint8_t rhport) {
  function hcd_port_reset_end (line 72) | void hcd_port_reset_end(uint8_t rhport) {
  function hcd_port_connect_status (line 77) | bool hcd_port_connect_status(uint8_t rhport) {
  function tusb_speed_t (line 86) | tusb_speed_t hcd_port_speed_get(uint8_t rhport) {
  function hcd_device_close (line 93) | void hcd_device_close(uint8_t rhport, uint8_t dev_addr) {
  function hcd_frame_number (line 98) | uint32_t hcd_frame_number(uint8_t rhport) {
  function hcd_int_enable (line 103) | void hcd_int_enable(uint8_t rhport) {
  function hcd_int_disable (line 107) | void hcd_int_disable(uint8_t rhport) {
  function hcd_edpt_open (line 115) | bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_...
  function hcd_edpt_xfer (line 124) | bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, ui...
  function hcd_edpt_abort_xfer (line 129) | bool hcd_edpt_abort_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_ad...
  function hcd_setup_send (line 134) | bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setu...
  function hcd_edpt_clear_stall (line 153) | bool hcd_edpt_clear_stall(uint8_t rhport, uint8_t dev_addr, uint8_t ep_a...

FILE: pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c
  type hw_endpoint (line 54) | struct hw_endpoint
  function hw_endpoint (line 59) | hw_endpoint* hw_endpoint_get_by_num(uint8_t num, tusb_dir_t dir) {
  function hw_endpoint (line 63) | hw_endpoint* hw_endpoint_get_by_addr(uint8_t ep_addr) {
  function _hw_endpoint_alloc (line 69) | static void _hw_endpoint_alloc(struct hw_endpoint* ep, uint8_t transfer_...
  function _hw_endpoint_close (line 93) | static void _hw_endpoint_close(struct hw_endpoint* ep) {
  function hw_endpoint_close (line 116) | static void hw_endpoint_close(uint8_t ep_addr) {
  function hw_endpoint_init (line 121) | static void hw_endpoint_init(uint8_t ep_addr, uint16_t wMaxPacketSize, u...
  function hw_endpoint_xfer (line 165) | static void hw_endpoint_xfer(uint8_t ep_addr, uint8_t* buffer, uint16_t ...
  type hw_endpoint (line 180) | struct hw_endpoint
  function TU_ATTR_ALWAYS_INLINE (line 195) | TU_ATTR_ALWAYS_INLINE static inline void reset_ep0(void) {
  type hw_endpoint (line 250) | struct hw_endpoint
  function dcd_init (line 372) | void dcd_init(uint8_t rhport) {
  function dcd_deinit (line 410) | bool dcd_deinit(uint8_t rhport) {
  function dcd_int_enable (line 423) | void dcd_int_enable(__unused uint8_t rhport) {
  function dcd_int_disable (line 428) | void dcd_int_disable(__unused uint8_t rhport) {
  function dcd_set_address (line 433) | void dcd_set_address(__unused uint8_t rhport, __unused uint8_t dev_addr) {
  function dcd_remote_wakeup (line 441) | void dcd_remote_wakeup(__unused uint8_t rhport) {
  function dcd_disconnect (line 452) | void dcd_disconnect(__unused uint8_t rhport) {
  function dcd_connect (line 458) | void dcd_connect(__unused uint8_t rhport) {
  function dcd_sof_enable (line 463) | void dcd_sof_enable(uint8_t rhport, bool en) {
  function dcd_edpt0_status_complete (line 484) | void dcd_edpt0_status_complete(uint8_t rhport, tusb_control_request_t co...
  function dcd_edpt_open (line 494) | bool dcd_edpt_open(__unused uint8_t rhport, tusb_desc_endpoint_t const* ...
  function dcd_edpt_close_all (line 500) | void dcd_edpt_close_all(uint8_t rhport) {
  function dcd_edpt_xfer (line 507) | bool dcd_edpt_xfer(__unused uint8_t rhport, uint8_t ep_addr, uint8_t* bu...
  function dcd_edpt_stall (line 513) | void dcd_edpt_stall(uint8_t rhport, uint8_t ep_addr) {
  function dcd_edpt_clear_stall (line 529) | void dcd_edpt_clear_stall(uint8_t rhport, uint8_t ep_addr) {
  function dcd_edpt_close (line 541) | void dcd_edpt_close(uint8_t rhport, uint8_t ep_addr) {

FILE: pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/hcd_rp2040.c
  type hw_endpoint (line 56) | struct hw_endpoint
  type hw_endpoint (line 65) | struct hw_endpoint
  type hw_endpoint (line 72) | struct hw_endpoint
  function TU_ATTR_ALWAYS_INLINE (line 79) | TU_ATTR_ALWAYS_INLINE static inline uint8_t dev_speed(void)
  function TU_ATTR_ALWAYS_INLINE (line 84) | TU_ATTR_ALWAYS_INLINE static inline bool need_pre(uint8_t dev_addr)
  type hw_endpoint (line 91) | struct hw_endpoint
  type hw_endpoint (line 101) | struct hw_endpoint
  type hw_endpoint (line 123) | struct hw_endpoint
  type hw_endpoint (line 172) | struct hw_endpoint
  type hw_endpoint (line 261) | struct hw_endpoint
  type hw_endpoint (line 263) | struct hw_endpoint
  type hw_endpoint (line 277) | struct hw_endpoint
  type hw_endpoint (line 279) | struct hw_endpoint
  function _hw_endpoint_init (line 307) | static void _hw_endpoint_init(struct hw_endpoint *ep, uint8_t dev_addr, ...
  function hcd_init (line 378) | bool hcd_init(uint8_t rhport)
  function hcd_deinit (line 412) | bool hcd_deinit(uint8_t rhport) {
  function hcd_port_reset (line 422) | void hcd_port_reset(uint8_t rhport)
  function hcd_port_reset_end (line 430) | void hcd_port_reset_end(uint8_t rhport)
  function hcd_port_connect_status (line 435) | bool hcd_port_connect_status(uint8_t rhport)
  function tusb_speed_t (line 443) | tusb_speed_t hcd_port_speed_get(uint8_t rhport)
  function hcd_device_close (line 462) | void hcd_device_close(uint8_t rhport, uint8_t dev_addr)
  function hcd_frame_number (line 488) | uint32_t hcd_frame_number(uint8_t rhport)
  function hcd_int_enable (line 494) | void hcd_int_enable(uint8_t rhport)
  function hcd_int_disable (line 501) | void hcd_int_disable(uint8_t rhport)
  function hcd_edpt_open (line 513) | bool hcd_edpt_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_endpoint_...
  function hcd_edpt_xfer (line 533) | bool hcd_edpt_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_addr, ui...
  function hcd_edpt_abort_xfer (line 587) | bool hcd_edpt_abort_xfer(uint8_t rhport, uint8_t dev_addr, uint8_t ep_ad...
  function hcd_setup_send (line 595) | bool hcd_setup_send(uint8_t rhport, uint8_t dev_addr, uint8_t const setu...
  function hcd_edpt_clear_stall (line 636) | bool hcd_edpt_clear_stall(uint8_t rhport, uint8_t dev_addr, uint8_t ep_a...

FILE: pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c
  type hw_endpoint (line 38) | struct hw_endpoint
  type hw_endpoint (line 41) | struct hw_endpoint
  type hw_endpoint (line 42) | struct hw_endpoint
  function TU_ATTR_ALWAYS_INLINE (line 49) | TU_ATTR_ALWAYS_INLINE static inline bool is_host_mode(void) {
  function rp2040_usb_init (line 57) | void rp2040_usb_init(void) {
  type hw_endpoint (line 82) | struct hw_endpoint
  type hw_endpoint (line 89) | struct hw_endpoint
  type hw_endpoint (line 116) | struct hw_endpoint
  type hw_endpoint (line 148) | struct hw_endpoint
  function hw_endpoint_xfer_start (line 187) | void hw_endpoint_xfer_start(struct hw_endpoint* ep, uint8_t* buffer, uin...
  type hw_endpoint (line 216) | struct hw_endpoint
  type hw_endpoint (line 248) | struct hw_endpoint
  type hw_endpoint (line 295) | struct hw_endpoint
  type hw_endpoint (line 351) | struct hw_endpoint
  type hw_endpoint (line 358) | struct hw_endpoint

FILE: pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.h
  type hw_endpoint_t (line 46) | typedef struct hw_endpoint
  type hw_endpoint (line 102) | struct hw_endpoint
  type hw_endpoint (line 103) | struct hw_endpoint
  type hw_endpoint (line 104) | struct hw_endpoint
  type hw_endpoint (line 105) | struct hw_endpoint
  function TU_ATTR_ALWAYS_INLINE (line 107) | TU_ATTR_ALWAYS_INLINE static inline void hw_endpoint_lock_update(__unuse...
  type hw_endpoint (line 113) | struct hw_endpoint
  function TU_ATTR_ALWAYS_INLINE (line 115) | TU_ATTR_ALWAYS_INLINE static inline uint32_t _hw_endpoint_buffer_control...
  function TU_ATTR_ALWAYS_INLINE (line 120) | TU_ATTR_ALWAYS_INLINE static inline void _hw_endpoint_buffer_control_set...
  function TU_ATTR_ALWAYS_INLINE (line 125) | TU_ATTR_ALWAYS_INLINE static inline void _hw_endpoint_buffer_control_set...
  function TU_ATTR_ALWAYS_INLINE (line 130) | TU_ATTR_ALWAYS_INLINE static inline void _hw_endpoint_buffer_control_cle...
  function hw_data_offset (line 135) | static inline uintptr_t hw_data_offset (uint8_t *buf)

FILE: pico-sdk/lib/tinyusb/src/tusb.c
  function tusb_init (line 46) | bool tusb_init(void) {
  function tusb_inited (line 60) | bool tusb_inited(void) {
  function tu_edpt_claim (line 106) | bool tu_edpt_claim(tu_edpt_state_t* ep_state, osal_mutex_t mutex) {
  function tu_edpt_release (line 123) | bool tu_edpt_release(tu_edpt_state_t* ep_state, osal_mutex_t mutex) {
  function tu_edpt_validate (line 137) | bool tu_edpt_validate(tusb_desc_endpoint_t const* desc_ep, tusb_speed_t ...
  function tu_edpt_bind_driver (line 171) | void tu_edpt_bind_driver(uint8_t ep2drv[][2], tusb_desc_interface_t cons...
  function tu_desc_get_interface_total_len (line 186) | uint16_t tu_desc_get_interface_total_len(tusb_desc_interface_t const* de...
  function tu_edpt_stream_init (line 217) | bool tu_edpt_stream_init(tu_edpt_stream_t* s, bool is_host, bool is_tx, ...
  function tu_edpt_stream_deinit (line 233) | bool tu_edpt_stream_deinit(tu_edpt_stream_t* s) {
  function TU_ATTR_ALWAYS_INLINE (line 242) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 256) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 270) | TU_ATTR_ALWAYS_INLINE static inline
  function tu_edpt_stream_write_zlp_if_needed (line 287) | bool tu_edpt_stream_write_zlp_if_needed(tu_edpt_stream_t* s, uint32_t la...
  function tu_edpt_stream_write_xfer (line 295) | uint32_t tu_edpt_stream_write_xfer(tu_edpt_stream_t* s) {
  function tu_edpt_stream_write (line 316) | uint32_t tu_edpt_stream_write(tu_edpt_stream_t* s, void const* buffer, u...
  function tu_edpt_stream_read_xfer (line 332) | uint32_t tu_edpt_stream_read_xfer(tu_edpt_stream_t* s) {
  function tu_edpt_stream_read (line 361) | uint32_t tu_edpt_stream_read(tu_edpt_stream_t* s, void* buffer, uint32_t...
  function dump_str_line (line 397) | static void dump_str_line(uint8_t const* buf, uint16_t count) {
  function tu_print_mem (line 412) | void tu_print_mem(void const* buf, uint32_t count, uint8_t indent) {

FILE: pico-sdk/lib/tinyusb/src/tusb_option.h
  type make_iso_compilers_happy (line 563) | typedef int make_iso_compilers_happy;

FILE: pico-sdk/lib/tinyusb/src/typec/pd_types.h
  type tusb_typec_port_type_t (line 46) | typedef enum {
  type pd_header_t (line 115) | typedef struct TU_ATTR_PACKED {
  type pd_header_extended_t (line 126) | typedef struct TU_ATTR_PACKED {
  type pd_pdo_fixed_t (line 148) | typedef struct TU_ATTR_PACKED {
  type pd_pdo_battery_t (line 165) | typedef struct TU_ATTR_PACKED {
  type pd_pdo_variable_t (line 174) | typedef struct TU_ATTR_PACKED {
  type pd_pdo_apdo_t (line 183) | typedef struct TU_ATTR_PACKED {
  type pd_rdo_fixed_variable_t (line 200) | typedef struct TU_ATTR_PACKED {
  type pd_rdo_battery_t (line 214) | typedef struct TU_ATTR_PACKED {

FILE: pico-sdk/lib/tinyusb/src/typec/tcd.h
  type tcd_event_t (line 51) | typedef struct TU_ATTR_PACKED {
  function TU_ATTR_ALWAYS_INLINE (line 98) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 111) | TU_ATTR_ALWAYS_INLINE static inline
  function TU_ATTR_ALWAYS_INLINE (line 125) | TU_ATTR_ALWAYS_INLINE static inline

FILE: pico-sdk/lib/tinyusb/src/typec/usbc.c
  function tuc_inited (line 65) | bool tuc_inited(uint8_t rhport) {
  function tuc_init (line 69) | bool tuc_init(uint8_t rhport, uint32_t port_type) {
  function tuc_task_ext (line 95) | void tuc_task_ext(uint32_t timeout_ms, bool in_isr) {
  function parse_msg_data (line 138) | bool parse_msg_data(uint8_t rhport, pd_header_t const* header, uint8_t c...
  function parse_msg_control (line 146) | bool parse_msg_control(uint8_t rhport, pd_header_t const* header) {
  function usbc_msg_send (line 158) | bool usbc_msg_send(uint8_t rhport, pd_header_t const* header, void const...
  function tuc_msg_request (line 171) | bool tuc_msg_request(uint8_t rhport, void const* rdo) {
  function tcd_event_handler (line 185) | void tcd_event_handler(tcd_event_t const * event, bool in_isr) {
  function usbc_int_set (line 206) | void usbc_int_set(bool enabled) {

FILE: pico-sdk/lib/tinyusb/src/typec/usbc.h
  function TU_ATTR_ALWAYS_INLINE (line 61) | TU_ATTR_ALWAYS_INLINE static inline

FILE: pico-sdk/src/common/boot_picoboot/include/boot/picoboot.h
  type picoboot_cmd_id (line 45) | enum picoboot_cmd_id {
  type picoboot_status (line 57) | enum picoboot_status {
  function picoboot_reboot_cmd (line 69) | struct __packed picoboot_reboot_cmd {
  function picoboot_address_only_cmd (line 76) | struct __packed picoboot_address_only_cmd {
  function picoboot_range_cmd (line 81) | struct __packed picoboot_range_cmd {
  type picoboot_exclusive_type (line 86) | enum picoboot_exclusive_type {
  function picoboot_exclusive_cmd (line 92) | struct __packed picoboot_exclusive_cmd {
  function __aligned (line 97) | struct __packed __aligned(4) picoboot_cmd {
  type picoboot_cmd (line 113) | struct picoboot_cmd
  function __aligned (line 115) | struct __packed __aligned(4) picoboot_cmd_status {
  type picoboot_cmd_status (line 123) | struct picoboot_cmd_status

FILE: pico-sdk/src/common/boot_uf2/include/boot/uf2.h
  type uf2_block (line 30) | struct uf2_block {
  type uf2_block (line 44) | struct uf2_block

FILE: pico-sdk/src/common/pico_base/include/pico/assert.h
  function hard_assert (line 40) | static inline void hard_assert(bool condition, ...) {

FILE: pico-sdk/src/common/pico_base/include/pico/error.h
  type pico_error_codes (line 16) | enum pico_error_codes {

FILE: pico-sdk/src/common/pico_base/include/pico/types.h
  type uint (line 18) | typedef unsigned int uint;
  type absolute_time_t (line 31) | typedef uint64_t absolute_time_t;
  type absolute_time_t (line 33) | typedef struct {
  function to_us_since_boot (line 44) | static inline uint64_t to_us_since_boot(absolute_time_t t) {
  function update_us_since_boot (line 59) | static inline void update_us_since_boot(absolute_time_t *t, uint64_t us_...
  function absolute_time_t (line 74) | static inline absolute_time_t from_us_since_boot(uint64_t us_since_boot) {
  type datetime_t (line 93) | typedef struct {

FILE: pico-sdk/src/common/pico_binary_info/include/pico/binary_info/structure.h
  type binary_info_t (line 24) | typedef struct _binary_info_core binary_info_t;
  type _binary_info_core (line 64) | typedef struct __packed _binary_info_core
  type _binary_info_raw_data (line 69) | typedef struct __packed _binary_info_raw_data
  type _binary_info_core (line 70) | struct _binary_info_core
  type _binary_info_sized_data (line 74) | typedef struct __packed _binary_info_sized_data
  type _binary_info_core (line 75) | struct _binary_info_core
  type _binary_info_list_zero_terminated (line 80) | typedef struct __packed _binary_info_list_zero_terminated
  type _binary_info_core (line 81) | struct _binary_info_core
  type _binary_info_id_and_int (line 85) | typedef struct __packed _binary_info_id_and_int
  type _binary_info_core (line 86) | struct _binary_info_core
  type _binary_info_id_and_string (line 91) | typedef struct __packed _binary_info_id_and_string
  type _binary_info_core (line 92) | struct _binary_info_core
  type _binary_info_block_device (line 97) | typedef struct __packed _binary_info_block_device
  type _binary_info_core (line 98) | struct _binary_info_core
  type _binary_info_pins_with_func (line 109) | typedef struct __packed _binary_info_pins_with_func
  type _binary_info_core (line 110) | struct _binary_info_core
  type _binary_info_pins_with_name (line 116) | typedef struct __packed _binary_info_pins_with_name
  type _binary_info_core (line 117) | struct _binary_info_core
  type _binary_info_named_group (line 127) | typedef struct __packed _binary_info_named_group
  type _binary_info_core (line 128) | struct _binary_info_core

FILE: pico-sdk/src/common/pico_divider/include/pico/divider.h
  function divmod_s32s32_rem (line 52) | static inline int32_t divmod_s32s32_rem(int32_t a, int32_t b, int32_t *r...
  function divmod_u32u32_rem (line 87) | static inline uint32_t divmod_u32u32_rem(uint32_t a, uint32_t b, uint32_...

FILE: pico-sdk/src/common/pico_stdlib/include/pico/stdlib.h
  function set_sys_clock_khz (line 126) | static inline bool set_sys_clock_khz(uint32_t freq_khz, bool required) {

FILE: pico-sdk/src/common/pico_sync/critical_section.c
  function critical_section_init (line 13) | void critical_section_init(critical_section_t *crit_sec) {
  function critical_section_init_with_lock_num (line 17) | void critical_section_init_with_lock_num(critical_section_t *crit_sec, u...
  function critical_section_deinit (line 22) | void critical_section_deinit(critical_section_t *crit_sec) {

FILE: pico-sdk/src/common/pico_sync/include/pico/critical_section.h
  type critical_section (line 29) | typedef struct __packed_aligned critical_section
  function critical_section_enter_blocking (line 61) | static inline void critical_section_enter_blocking(critical_section_t *c...
  function critical_section_exit (line 70) | static inline void critical_section_exit(critical_section_t *crit_sec) {
  function critical_section_is_initialized (line 91) | static inline bool critical_section_is_initialized(critical_section_t *c...

FILE: pico-sdk/src/common/pico_sync/include/pico/lock_core.h
  type lock_core (line 53) | struct lock_core {
  type lock_core_t (line 61) | typedef struct lock_core lock_core_t;

FILE: pico-sdk/src/common/pico_sync/include/pico/mutex.h
  type recursive_mutex_t (line 47) | typedef struct __packed_aligned  {
  type mutex (line 60) | typedef struct __packed_aligned mutex
  type recursive_mutex_t (line 65) | typedef recursive_mutex_t mutex_t;
  function mutex_is_initialized (line 248) | static inline bool mutex_is_initialized(mutex_t *mtx) {
  function recursive_mutex_is_initialized (line 258) | static inline bool recursive_mutex_is_initialized(recursive_mutex_t *mtx) {

FILE: pico-sdk/src/common/pico_sync/include/pico/sem.h
  type semaphore (line 31) | typedef struct __packed_aligned semaphore
  type lock_core (line 32) | struct lock_core

FILE: pico-sdk/src/common/pico_sync/lock_core.c
  function lock_init (line 9) | void lock_init(lock_core_t *core, uint lock_num) {

FILE: pico-sdk/src/common/pico_sync/mutex.c
  function mutex_init (line 10) | void mutex_init(mutex_t *mtx) {
  function recursive_mutex_init (line 19) | void recursive_mutex_init(recursive_mutex_t *mtx) {

FILE: pico-sdk/src/common/pico_sync/sem.c
  function sem_init (line 10) | void sem_init(semaphore_t *sem, int16_t initial_permits, int16_t max_per...

FILE: pico-sdk/src/common/pico_time/include/pico/time.h
  function absolute_time_t (line 61) | static inline absolute_time_t get_absolute_time(void) {
  function us_to_ms (line 67) | static inline uint32_t us_to_ms(uint64_t us) {
  function to_ms_since_boot (line 82) | static inline uint32_t to_ms_since_boot(absolute_time_t t) {
  function absolute_time_t (line 94) | static inline absolute_time_t delayed_by_us(const absolute_time_t t, uin...
  function absolute_time_t (line 113) | static inline absolute_time_t delayed_by_ms(const absolute_time_t t, uin...
  function absolute_time_t (line 131) | static inline absolute_time_t make_timeout_time_us(uint64_t us) {
  function absolute_time_t (line 141) | static inline absolute_time_t make_timeout_time_ms(uint32_t ms) {
  function absolute_time_diff_us (line 156) | static inline int64_t absolute_time_diff_us(absolute_time_t from, absolu...
  function absolute_time_t (line 167) | static inline absolute_time_t absolute_time_min(absolute_time_t a, absol...
  function is_at_the_end_of_time (line 184) | static inline bool is_at_the_end_of_time(absolute_time_t t) {
  function is_nil_time (line 199) | static inline bool is_nil_time(absolute_time_t t) {
  type alarm_id_t (line 359) | typedef int32_t alarm_id_t;
  type alarm_pool_t (line 372) | typedef struct alarm_pool alarm_pool_t;
  function alarm_id_t (line 520) | static inline alarm_id_t alarm_pool_add_alarm_in_us(alarm_pool_t *pool, ...
  function alarm_id_t (line 547) | static inline alarm_id_t alarm_pool_add_alarm_in_ms(alarm_pool_t *pool, ...
  function alarm_id_t (line 584) | static inline alarm_id_t add_alarm_at(absolute_time_t time, alarm_callba...
  function alarm_id_t (line 610) | static inline alarm_id_t add_alarm_in_us(uint64_t us, alarm_callback_t c...
  function alarm_id_t (line 636) | static inline alarm_id_t add_alarm_in_ms(uint32_t ms, alarm_callback_t c...
  function cancel_alarm (line 646) | static inline bool cancel_alarm(alarm_id_t alarm_id) {
  type repeating_timer_t (line 662) | typedef struct repeating_timer repeating_timer_t;
  type repeating_timer (line 677) | struct repeating_timer {
  function alarm_pool_add_repeating_timer_ms (line 723) | static inline bool alarm_pool_add_repeating_timer_ms(alarm_pool_t *pool,...
  function add_repeating_timer_us (line 745) | static inline bool add_repeating_timer_us(int64_t delay_us, repeating_ti...
  function add_repeating_timer_ms (line 766) | static inline bool add_repeating_timer_ms(int32_t delay_ms, repeating_ti...

FILE: pico-sdk/src/common/pico_time/include/pico/timeout_helper.h
  type timeout_state_t (line 16) | typedef struct timeout_state {

FILE: pico-sdk/src/common/pico_time/time.c
  type alarm_pool_entry_t (line 19) | typedef struct alarm_pool_entry {
  type alarm_pool (line 25) | struct alarm_pool {
  function default_alarm_pool_initialized (line 50) | static inline bool default_alarm_pool_initialized(void) {
  function alarm_pool_entry_t (line 59) | static inline alarm_pool_entry_t *get_entry(alarm_pool_t *pool, pheap_no...
  function timer_pool_entry_comparator (line 69) | bool timer_pool_entry_comparator(void *user_data, pheap_node_id_t a, phe...
  function alarm_id_t (line 74) | static inline alarm_id_t make_public_id(uint8_t id_high, pheap_node_id_t...
  function alarm_pool_init_default (line 78) | void alarm_pool_init_default() {
  function alarm_pool_t (line 93) | alarm_pool_t *alarm_pool_get_default() {
  function pheap_node_id_t (line 99) | static pheap_node_id_t add_alarm_under_lock(alarm_pool_t *pool, absolute...
  function alarm_pool_alarm_callback (line 124) | static void alarm_pool_alarm_callback(uint alarm_num) {
  function alarm_pool_t (line 180) | alarm_pool_t *alarm_pool_create(uint hardware_alarm_num, uint max_timers) {
  function alarm_pool_t (line 190) | alarm_pool_t *alarm_pool_create_with_unused_hardware_alarm(uint max_time...
  function alarm_pool_post_alloc_init (line 199) | void alarm_pool_post_alloc_init(alarm_pool_t *pool, uint hardware_alarm_...
  function alarm_pool_destroy (line 208) | void alarm_pool_destroy(alarm_pool_t *pool) {
  function alarm_id_t (line 226) | alarm_id_t alarm_pool_add_alarm_at(alarm_pool_t *pool, absolute_time_t t...
  function alarm_id_t (line 273) | alarm_id_t alarm_pool_add_alarm_at_force_in_context(alarm_pool_t *pool, ...
  function alarm_pool_cancel_alarm (line 293) | bool alarm_pool_cancel_alarm(alarm_pool_t *pool, alarm_id_t alarm_id) {
  function uint (line 318) | uint alarm_pool_hardware_alarm_num(alarm_pool_t *pool) {
  function uint (line 322) | uint alarm_pool_core_num(alarm_pool_t *pool) {
  function alarm_pool_dump_key (line 326) | static void alarm_pool_dump_key(pheap_node_id_t id, void *user_data) {
  function repeating_timer_callback (line 335) | static int64_t repeating_timer_callback(__unused alarm_id_t id, void *us...
  function alarm_pool_add_repeating_timer_us (line 346) | bool alarm_pool_add_repeating_timer_us(alarm_pool_t *pool, int64_t delay...
  function cancel_repeating_timer (line 359) | bool cancel_repeating_timer(repeating_timer_t *timer) {
  function alarm_pool_dump (line 368) | void alarm_pool_dump(alarm_pool_t *pool) {
  function sleep_until_callback (line 375) | static int64_t sleep_until_callback(__unused alarm_id_t id, __unused voi...
  function sleep_until (line 382) | void sleep_until(absolute_time_t t) {
  function sleep_us (line 412) | void sleep_us(uint64_t us) {
  function sleep_ms (line 429) | void sleep_ms(uint32_t ms) {
  function best_effort_wfe_or_timeout (line 433) | bool best_effort_wfe_or_timeout(absolute_time_t timeout_timestamp) {

FILE: pico-sdk/src/common/pico_time/timeout_helper.c
  function check_single_timeout_us (line 9) | static bool check_single_timeout_us(timeout_state_t *ts) {
  function check_timeout_fn (line 13) | check_timeout_fn init_single_timeout_until(timeout_state_t *ts, absolute...
  function check_per_iteration_timeout_us (line 18) | static bool check_per_iteration_timeout_us(timeout_state_t *ts) {
  function check_timeout_fn (line 26) | check_timeout_fn init_per_iteration_timeout_us(timeout_state_t *ts, uint...

FILE: pico-sdk/src/common/pico_util/datetime.c
  function datetime_to_str (line 30) | void datetime_to_str(char *buf, uint buf_size, const datetime_t *t) {

FILE: pico-sdk/src/common/pico_util/include/pico/util/pheap.h
  type pheap_node_id_t (line 44) | typedef uint8_t pheap_node_id_t;
  type pheap_node_id_t (line 46) | typedef uint16_t pheap_node_id_t;
  type pheap_node_t (line 51) | typedef struct pheap_node {
  type pheap_t (line 62) | typedef struct pheap {
  function pheap_node_t (line 103) | static inline pheap_node_t *ph_get_node(pheap_t *heap, pheap_node_id_t i...
  function ph_add_child_node (line 109) | static void ph_add_child_node(pheap_t *heap, pheap_node_id_t parent_id, ...
  function pheap_node_id_t (line 125) | static pheap_node_id_t ph_merge_nodes(pheap_t *heap, pheap_node_id_t a, ...
  function pheap_node_id_t (line 143) | static inline pheap_node_id_t ph_new_node(pheap_t *heap) {
  function pheap_node_id_t (line 164) | static inline pheap_node_id_t ph_insert_node(pheap_t *heap, pheap_node_i...
  function pheap_node_id_t (line 179) | static inline pheap_node_id_t ph_peek_head(pheap_t *heap) {
  function pheap_node_id_t (line 212) | static inline pheap_node_id_t ph_remove_and_free_head(pheap_t *heap) {
  function ph_contains_node (line 234) | static inline bool ph_contains_node(pheap_t *heap, pheap_node_id_t id) {
  function ph_free_node (line 245) | static inline void ph_free_node(pheap_t *heap, pheap_node_id_t id) {

FILE: pico-sdk/src/common/pico_util/include/pico/util/queue.h
  type queue_t (line 32) | typedef struct {
  function queue_init (line 61) | static inline void queue_init(queue_t *q, uint element_size, uint elemen...
  function uint (line 83) | static inline uint queue_get_level_unsafe(queue_t *q) {
  function uint (line 97) | static inline uint queue_get_level(queue_t *q) {
  function uint (line 112) | static inline uint queue_get_max_level(queue_t *q) {
  function queue_reset_max_level (line 123) | static inline void queue_reset_max_level(queue_t *q) {
  function queue_is_empty (line 138) | static inline bool queue_is_empty(queue_t *q) {
  function queue_is_full (line 150) | static inline bool queue_is_full(queue_t *q) {

FILE: pico-sdk/src/common/pico_util/pheap.c
  function pheap_t (line 11) | pheap_t *ph_create(uint max_nodes, pheap_comparator comparator, void *us...
  function ph_post_alloc_init (line 19) | void ph_post_alloc_init(pheap_t *heap, uint max_nodes, pheap_comparator ...
  function ph_clear (line 27) | void ph_clear(pheap_t *heap) {
  function ph_destroy (line 37) | void ph_destroy(pheap_t *heap) {
  function pheap_node_id_t (line 42) | pheap_node_id_t ph_merge_two_pass(pheap_t *heap, pheap_node_id_t id) {
  function pheap_node_id_t (line 55) | static pheap_node_id_t ph_remove_any_head(pheap_t *heap, pheap_node_id_t...
  function pheap_node_id_t (line 76) | pheap_node_id_t ph_remove_head(pheap_t *heap, bool free) {
  function ph_remove_and_free_node (line 82) | bool ph_remove_and_free_node(pheap_t *heap, pheap_node_id_t id) {
  function uint (line 118) | static uint ph_dump_node(pheap_t *heap, pheap_node_id_t id, void (*dump_...
  function ph_dump (line 135) | void ph_dump(pheap_t *heap, void (*dump_key)(pheap_node_id_t, void *), v...

FILE: pico-sdk/src/common/pico_util/queue.c
  function queue_init_with_spinlock (line 11) | void queue_init_with_spinlock(queue_t *q, uint element_size, uint elemen...
  function queue_free (line 20) | void queue_free(queue_t *q) {
  function inc_index (line 29) | static inline uint16_t inc_index(queue_t *q, uint16_t index) {
  function queue_add_internal (line 44) | static bool queue_add_internal(queue_t *q, const void *data, bool block) {
  function queue_remove_internal (line 62) | static bool queue_remove_internal(queue_t *q, void *data, bool block) {
  function queue_peek_internal (line 80) | static bool queue_peek_internal(queue_t *q, void *data, bool block) {
  function queue_try_add (line 97) | bool queue_try_add(queue_t *q, const void *data) {
  function queue_try_remove (line 101) | bool queue_try_remove(queue_t *q, void *data) {
  function queue_try_peek (line 105) | bool queue_try_peek(queue_t *q, void *data) {
  function queue_add_blocking (line 109) | void queue_add_blocking(queue_t *q, const void *data) {
  function queue_remove_blocking (line 113) | void queue_remove_blocking(queue_t *q, void *data) {
  function queue_peek_blocking (line 117) | void queue_peek_blocking(queue_t *q, void *data) {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/adc.h
  type adc_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/bus_ctrl.h
  type bus_ctrl_perf_counter (line 23) | enum bus_ctrl_perf_counter {
  type bus_ctrl_perf_hw_t (line 46) | typedef struct {
  type bus_ctrl_hw_t (line 58) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/clocks.h
  type clock_index (line 27) | enum clock_index {
  type clock_hw_t (line 43) | typedef struct {
  type clock_resus_hw_t (line 66) | typedef struct {
  type fc_hw_t (line 79) | typedef struct {
  type clocks_hw_t (line 129) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/dma.h
  type dma_channel_hw_t (line 23) | typedef struct {
  type dma_hw_t (line 105) | typedef struct {
  type dma_debug_hw_t (line 189) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/i2c.h
  type i2c_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/interp.h
  type interp_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/iobank0.h
  type iobank0_status_ctrl_hw_t (line 23) | typedef struct {
  type io_irq_ctrl_hw_t (line 46) | typedef struct {
  type iobank0_hw_t (line 163) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/ioqspi.h
  type ioqspi_status_ctrl_hw_t (line 23) | typedef struct {
  type io_qspi_ctrl_hw_t (line 46) | typedef struct {
  type ioqspi_hw_t (line 132) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/mpu.h
  type mpu_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/nvic.h
  type nvic_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/pads_qspi.h
  type pads_qspi_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/padsbank0.h
  type padsbank0_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/pio.h
  type pio_sm_hw_t (line 23) | typedef struct pio_sm_hw {
  type pio_hw_t (line 79) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/pll.h
  type pll_hw_t (line 24) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/psm.h
  type psm_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/pwm.h
  type pwm_slice_hw_t (line 23) | typedef struct pwm_slice_hw {
  type pwm_hw_t (line 58) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/resets.h
  type resets_hw_t (line 24) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/rosc.h
  type rosc_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/rtc.h
  type rtc_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/scb.h
  type armv6m_scb_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/sio.h
  type sio_hw_t (line 24) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/spi.h
  type spi_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/ssi.h
  type ssi_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/syscfg.h
  type syscfg_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/systick.h
  type systick_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/timer.h
  type timer_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/uart.h
  type uart_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/usb.h
  type usb_device_dpram_t (line 67) | typedef struct {
  type usb_host_dpram_t (line 94) | typedef struct {
  type usb_hw_t (line 124) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/vreg_and_chip_reset.h
  type vreg_and_chip_reset_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/watchdog.h
  type watchdog_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/xip_ctrl.h
  type xip_ctrl_hw_t (line 23) | typedef struct {

FILE: pico-sdk/src/rp2040/hardware_structs/include/hardware/structs/xosc.h
  type xosc_hw_t (line 24) | typedef struct {

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include/cmsis_armcc.h
  function __STATIC_INLINE (line 160) | __STATIC_INLINE uint32_t __get_CONTROL(void)
  function __STATIC_INLINE (line 172) | __STATIC_INLINE void __set_CONTROL(uint32_t control)
  function __STATIC_INLINE (line 184) | __STATIC_INLINE uint32_t __get_IPSR(void)
  function __STATIC_INLINE (line 196) | __STATIC_INLINE uint32_t __get_APSR(void)
  function __STATIC_INLINE (line 208) | __STATIC_INLINE uint32_t __get_xPSR(void)
  function __STATIC_INLINE (line 220) | __STATIC_INLINE uint32_t __get_PSP(void)
  function __STATIC_INLINE (line 232) | __STATIC_INLINE void __set_PSP(uint32_t topOfProcStack)
  function __STATIC_INLINE (line 244) | __STATIC_INLINE uint32_t __get_MSP(void)
  function __STATIC_INLINE (line 256) | __STATIC_INLINE void __set_MSP(uint32_t topOfMainStack)
  function __STATIC_INLINE (line 268) | __STATIC_INLINE uint32_t __get_PRIMASK(void)
  function __STATIC_INLINE (line 280) | __STATIC_INLINE void __set_PRIMASK(uint32_t priMask)
  function __STATIC_INLINE (line 311) | __STATIC_INLINE uint32_t  __get_BASEPRI(void)
  function __STATIC_INLINE (line 323) | __STATIC_INLINE void __set_BASEPRI(uint32_t basePri)
  function __STATIC_INLINE (line 336) | __STATIC_INLINE void __set_BASEPRI_MAX(uint32_t basePri)
  function __STATIC_INLINE (line 348) | __STATIC_INLINE uint32_t __get_FAULTMASK(void)
  function __STATIC_INLINE (line 360) | __STATIC_INLINE void __set_FAULTMASK(uint32_t faultMask)
  function __STATIC_INLINE (line 375) | __STATIC_INLINE uint32_t __get_FPSCR(void)
  function __STATIC_INLINE (line 392) | __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
  function __REV16 (line 481) | uint32_t __REV16(uint32_t value)
  function __REVSH (line 496) | int16_t __REVSH(int16_t value)
  function __STATIC_INLINE (line 534) | __attribute__((always_inline)) __STATIC_INLINE uint32_t __RBIT(uint32_t ...
  function __RRX (line 683) | uint32_t __RRX(uint32_t value)
  function __STATIC_INLINE (line 754) | __attribute__((always_inline)) __STATIC_INLINE int32_t __SSAT(int32_t va...
  function __STATIC_INLINE (line 779) | __attribute__((always_inline)) __STATIC_INLINE uint32_t __USAT(int32_t v...

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include/cmsis_armclang.h
  type T_UINT32 (line 71) | struct __attribute__((packed)) T_UINT32 { uint32_t v; }
  function __PACKED_STRUCT (line 79) | __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }
  function __PACKED_STRUCT (line 87) | __PACKED_STRUCT T_UINT16_READ { uint16_t v; }
  function __PACKED_STRUCT (line 95) | __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }
  function __PACKED_STRUCT (line 103) | __PACKED_STRUCT T_UINT32_READ { uint32_t v; }
  function __STATIC_FORCEINLINE (line 166) | __STATIC_FORCEINLINE uint32_t __get_CONTROL(void)
  function __STATIC_FORCEINLINE (line 181) | __STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)
  function __STATIC_FORCEINLINE (line 196) | __STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)
  function __STATIC_FORCEINLINE (line 208) | __STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
  function __STATIC_FORCEINLINE (line 220) | __STATIC_FORCEINLINE uint32_t __get_IPSR(void)
  function __STATIC_FORCEINLINE (line 234) | __STATIC_FORCEINLINE uint32_t __get_APSR(void)
  function __STATIC_FORCEINLINE (line 248) | __STATIC_FORCEINLINE uint32_t __get_xPSR(void)
  function __STATIC_FORCEINLINE (line 262) | __STATIC_FORCEINLINE uint32_t __get_PSP(void)
  function __STATIC_FORCEINLINE (line 277) | __STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)
  function __STATIC_FORCEINLINE (line 292) | __STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)
  function __STATIC_FORCEINLINE (line 304) | __STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
  function __STATIC_FORCEINLINE (line 316) | __STATIC_FORCEINLINE uint32_t __get_MSP(void)
  function __STATIC_FORCEINLINE (line 331) | __STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)
  function __STATIC_FORCEINLINE (line 346) | __STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)
  function __STATIC_FORCEINLINE (line 358) | __STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
  function __STATIC_FORCEINLINE (line 371) | __STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)
  function __STATIC_FORCEINLINE (line 385) | __STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)
  function __STATIC_FORCEINLINE (line 397) | __STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
  function __STATIC_FORCEINLINE (line 412) | __STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)
  function __STATIC_FORCEINLINE (line 427) | __STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)
  function __STATIC_FORCEINLINE (line 439) | __STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
  function __STATIC_FORCEINLINE (line 471) | __STATIC_FORCEINLINE uint32_t __get_BASEPRI(void)
  function __STATIC_FORCEINLINE (line 486) | __STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)
  function __STATIC_FORCEINLINE (line 501) | __STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)
  function __STATIC_FORCEINLINE (line 513) | __STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)
  function __STATIC_FORCEINLINE (line 526) | __STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)
  function __STATIC_FORCEINLINE (line 537) | __STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)
  function __STATIC_FORCEINLINE (line 552) | __STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)
  function __STATIC_FORCEINLINE (line 567) | __STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)
  function __STATIC_FORCEINLINE (line 579) | __STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
  function __STATIC_FORCEINLINE (line 604) | __STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)
  function __STATIC_FORCEINLINE (line 628) | __STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)
  function __STATIC_FORCEINLINE (line 652) | __STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
  function __STATIC_FORCEINLINE (line 675) | __STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
  function __STATIC_FORCEINLINE (line 696) | __STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)
  function __STATIC_FORCEINLINE (line 720) | __STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)
  function __STATIC_FORCEINLINE (line 743) | __STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
  function __STATIC_FORCEINLINE (line 765) | __STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
  function __STATIC_FORCEINLINE (line 914) | __STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 949) | __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)
  function __STATIC_FORCEINLINE (line 1079) | __STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)
  function __STATIC_FORCEINLINE (line 1094) | __STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1109) | __STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1124) | __STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1139) | __STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1151) | __STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1163) | __STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1180) | __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
  function __STATIC_FORCEINLINE (line 1205) | __STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
  function __STATIC_FORCEINLINE (line 1238) | __STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1253) | __STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1268) | __STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1283) | __STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1295) | __STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1307) | __STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1455) | __STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t ...

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include/cmsis_armclang_ltm.h
  type T_UINT32 (line 71) | struct __attribute__((packed)) T_UINT32 { uint32_t v; }
  function __PACKED_STRUCT (line 79) | __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }
  function __PACKED_STRUCT (line 87) | __PACKED_STRUCT T_UINT16_READ { uint16_t v; }
  function __PACKED_STRUCT (line 95) | __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }
  function __PACKED_STRUCT (line 103) | __PACKED_STRUCT T_UINT32_READ { uint32_t v; }
  function __STATIC_FORCEINLINE (line 167) | __STATIC_FORCEINLINE uint32_t __get_CONTROL(void)
  function __STATIC_FORCEINLINE (line 182) | __STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)
  function __STATIC_FORCEINLINE (line 197) | __STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)
  function __STATIC_FORCEINLINE (line 209) | __STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
  function __STATIC_FORCEINLINE (line 221) | __STATIC_FORCEINLINE uint32_t __get_IPSR(void)
  function __STATIC_FORCEINLINE (line 235) | __STATIC_FORCEINLINE uint32_t __get_APSR(void)
  function __STATIC_FORCEINLINE (line 249) | __STATIC_FORCEINLINE uint32_t __get_xPSR(void)
  function __STATIC_FORCEINLINE (line 263) | __STATIC_FORCEINLINE uint32_t __get_PSP(void)
  function __STATIC_FORCEINLINE (line 278) | __STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)
  function __STATIC_FORCEINLINE (line 293) | __STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)
  function __STATIC_FORCEINLINE (line 305) | __STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
  function __STATIC_FORCEINLINE (line 317) | __STATIC_FORCEINLINE uint32_t __get_MSP(void)
  function __STATIC_FORCEINLINE (line 332) | __STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)
  function __STATIC_FORCEINLINE (line 347) | __STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)
  function __STATIC_FORCEINLINE (line 359) | __STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
  function __STATIC_FORCEINLINE (line 372) | __STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)
  function __STATIC_FORCEINLINE (line 386) | __STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)
  function __STATIC_FORCEINLINE (line 398) | __STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
  function __STATIC_FORCEINLINE (line 413) | __STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)
  function __STATIC_FORCEINLINE (line 428) | __STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)
  function __STATIC_FORCEINLINE (line 440) | __STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
  function __STATIC_FORCEINLINE (line 471) | __STATIC_FORCEINLINE uint32_t __get_BASEPRI(void)
  function __STATIC_FORCEINLINE (line 486) | __STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)
  function __STATIC_FORCEINLINE (line 501) | __STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)
  function __STATIC_FORCEINLINE (line 513) | __STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)
  function __STATIC_FORCEINLINE (line 526) | __STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)
  function __STATIC_FORCEINLINE (line 537) | __STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)
  function __STATIC_FORCEINLINE (line 552) | __STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)
  function __STATIC_FORCEINLINE (line 567) | __STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)
  function __STATIC_FORCEINLINE (line 579) | __STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
  function __STATIC_FORCEINLINE (line 602) | __STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)
  function __STATIC_FORCEINLINE (line 625) | __STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)
  function __STATIC_FORCEINLINE (line 648) | __STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
  function __STATIC_FORCEINLINE (line 670) | __STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
  function __STATIC_FORCEINLINE (line 690) | __STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)
  function __STATIC_FORCEINLINE (line 713) | __STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)
  function __STATIC_FORCEINLINE (line 735) | __STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
  function __STATIC_FORCEINLINE (line 756) | __STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
  function __STATIC_FORCEINLINE (line 901) | __STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 936) | __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)
  function __STATIC_FORCEINLINE (line 1062) | __STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)
  function __STATIC_FORCEINLINE (line 1077) | __STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1092) | __STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1107) | __STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1122) | __STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1134) | __STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1146) | __STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1162) | __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
  function __STATIC_FORCEINLINE (line 1187) | __STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
  function __STATIC_FORCEINLINE (line 1217) | __STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1232) | __STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1247) | __STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1262) | __STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1274) | __STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1286) | __STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1365) | __STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1373) | __STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1381) | __STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1389) | __STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1397) | __STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1405) | __STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1414) | __STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1422) | __STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1430) | __STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1438) | __STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1446) | __STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1454) | __STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1463) | __STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1471) | __STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1479) | __STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1487) | __STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1495) | __STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1503) | __STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1511) | __STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1519) | __STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1527) | __STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1535) | __STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1543) | __STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1551) | __STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1559) | __STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1567) | __STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1575) | __STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1583) | __STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1591) | __STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1599) | __STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1607) | __STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1615) | __STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1623) | __STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1631) | __STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1639) | __STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1647) | __STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1655) | __STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1663) | __STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint3...
  function __STATIC_FORCEINLINE (line 1685) | __STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1)
  function __STATIC_FORCEINLINE (line 1693) | __STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1701) | __STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1)
  function __STATIC_FORCEINLINE (line 1709) | __STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1717) | __STATIC_FORCEINLINE uint32_t __SMUAD  (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1725) | __STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1733) | __STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint3...
  function __STATIC_FORCEINLINE (line 1741) | __STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint...
  function __STATIC_FORCEINLINE (line 1749) | __STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint...
  function __STATIC_FORCEINLINE (line 1766) | __STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uin...
  function __STATIC_FORCEINLINE (line 1783) | __STATIC_FORCEINLINE uint32_t __SMUSD  (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1791) | __STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1799) | __STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint3...
  function __STATIC_FORCEINLINE (line 1807) | __STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint...
  function __STATIC_FORCEINLINE (line 1815) | __STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint...
  function __STATIC_FORCEINLINE (line 1832) | __STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uin...
  function __STATIC_FORCEINLINE (line 1849) | __STATIC_FORCEINLINE uint32_t __SEL  (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1857) | __STATIC_FORCEINLINE  int32_t __QADD( int32_t op1,  int32_t op2)
  function __STATIC_FORCEINLINE (line 1865) | __STATIC_FORCEINLINE  int32_t __QSUB( int32_t op1,  int32_t op2)
  function __STATIC_FORCEINLINE (line 1881) | __STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t ...

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include/cmsis_compiler.h
  type T_UINT32 (line 101) | struct __attribute__((packed)) T_UINT32 { uint32_t v; }
  function __PACKED_STRUCT (line 105) | __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }
  function __PACKED_STRUCT (line 109) | __PACKED_STRUCT T_UINT16_READ { uint16_t v; }
  function __PACKED_STRUCT (line 113) | __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }
  function __PACKED_STRUCT (line 117) | __PACKED_STRUCT T_UINT32_READ { uint32_t v; }
  function T_UINT32 (line 173) | struct __packed__ T_UINT32 { uint32_t v; }
  function __PACKED_STRUCT (line 177) | __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }
  function __PACKED_STRUCT (line 181) | __PACKED_STRUCT T_UINT16_READ { uint16_t v; }
  function __PACKED_STRUCT (line 185) | __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }
  function __PACKED_STRUCT (line 189) | __PACKED_STRUCT T_UINT32_READ { uint32_t v; }
  function packed (line 244) | packed struct T_UINT32 { uint32_t v; }
  function __PACKED_STRUCT (line 248) | __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }
  function __PACKED_STRUCT (line 252) | __PACKED_STRUCT T_UINT16_READ { uint16_t v; }
  function __PACKED_STRUCT (line 256) | __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }
  function __PACKED_STRUCT (line 260) | __PACKED_STRUCT T_UINT32_READ { uint32_t v; }

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include/cmsis_gcc.h
  type T_UINT32 (line 74) | struct __attribute__((packed)) T_UINT32 { uint32_t v; }
  function __PACKED_STRUCT (line 82) | __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; }
  function __PACKED_STRUCT (line 90) | __PACKED_STRUCT T_UINT16_READ { uint16_t v; }
  function __PACKED_STRUCT (line 98) | __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; }
  function __PACKED_STRUCT (line 106) | __PACKED_STRUCT T_UINT32_READ { uint32_t v; }
  function __cmsis_start (line 131) | void __cmsis_start(void)
  function __STATIC_FORCEINLINE (line 233) | __STATIC_FORCEINLINE uint32_t __TZ_get_CONTROL_NS(void)
  function __STATIC_FORCEINLINE (line 248) | __STATIC_FORCEINLINE void __set_CONTROL(uint32_t control)
  function __STATIC_FORCEINLINE (line 260) | __STATIC_FORCEINLINE void __TZ_set_CONTROL_NS(uint32_t control)
  function __STATIC_FORCEINLINE (line 272) | __STATIC_FORCEINLINE uint32_t __get_IPSR(void)
  function __STATIC_FORCEINLINE (line 286) | __STATIC_FORCEINLINE uint32_t __get_APSR(void)
  function __STATIC_FORCEINLINE (line 300) | __STATIC_FORCEINLINE uint32_t __get_xPSR(void)
  function __STATIC_FORCEINLINE (line 314) | __STATIC_FORCEINLINE uint32_t __get_PSP(void)
  function __STATIC_FORCEINLINE (line 329) | __STATIC_FORCEINLINE uint32_t __TZ_get_PSP_NS(void)
  function __STATIC_FORCEINLINE (line 344) | __STATIC_FORCEINLINE void __set_PSP(uint32_t topOfProcStack)
  function __STATIC_FORCEINLINE (line 356) | __STATIC_FORCEINLINE void __TZ_set_PSP_NS(uint32_t topOfProcStack)
  function __STATIC_FORCEINLINE (line 368) | __STATIC_FORCEINLINE uint32_t __get_MSP(void)
  function __STATIC_FORCEINLINE (line 383) | __STATIC_FORCEINLINE uint32_t __TZ_get_MSP_NS(void)
  function __STATIC_FORCEINLINE (line 398) | __STATIC_FORCEINLINE void __set_MSP(uint32_t topOfMainStack)
  function __STATIC_FORCEINLINE (line 410) | __STATIC_FORCEINLINE void __TZ_set_MSP_NS(uint32_t topOfMainStack)
  function __STATIC_FORCEINLINE (line 423) | __STATIC_FORCEINLINE uint32_t __TZ_get_SP_NS(void)
  function __STATIC_FORCEINLINE (line 437) | __STATIC_FORCEINLINE void __TZ_set_SP_NS(uint32_t topOfStack)
  function __STATIC_FORCEINLINE (line 449) | __STATIC_FORCEINLINE uint32_t __get_PRIMASK(void)
  function __STATIC_FORCEINLINE (line 464) | __STATIC_FORCEINLINE uint32_t __TZ_get_PRIMASK_NS(void)
  function __STATIC_FORCEINLINE (line 479) | __STATIC_FORCEINLINE void __set_PRIMASK(uint32_t priMask)
  function __STATIC_FORCEINLINE (line 491) | __STATIC_FORCEINLINE void __TZ_set_PRIMASK_NS(uint32_t priMask)
  function __STATIC_FORCEINLINE (line 543) | __STATIC_FORCEINLINE uint32_t __TZ_get_BASEPRI_NS(void)
  function __STATIC_FORCEINLINE (line 558) | __STATIC_FORCEINLINE void __set_BASEPRI(uint32_t basePri)
  function __STATIC_FORCEINLINE (line 570) | __STATIC_FORCEINLINE void __TZ_set_BASEPRI_NS(uint32_t basePri)
  function __STATIC_FORCEINLINE (line 583) | __STATIC_FORCEINLINE void __set_BASEPRI_MAX(uint32_t basePri)
  function __STATIC_FORCEINLINE (line 594) | __STATIC_FORCEINLINE uint32_t __get_FAULTMASK(void)
  function __STATIC_FORCEINLINE (line 609) | __STATIC_FORCEINLINE uint32_t __TZ_get_FAULTMASK_NS(void)
  function __STATIC_FORCEINLINE (line 624) | __STATIC_FORCEINLINE void __set_FAULTMASK(uint32_t faultMask)
  function __STATIC_FORCEINLINE (line 636) | __STATIC_FORCEINLINE void __TZ_set_FAULTMASK_NS(uint32_t faultMask)
  function __STATIC_FORCEINLINE (line 659) | __STATIC_FORCEINLINE uint32_t __get_PSPLIM(void)
  function __STATIC_FORCEINLINE (line 681) | __STATIC_FORCEINLINE uint32_t __TZ_get_PSPLIM_NS(void)
  function __STATIC_FORCEINLINE (line 704) | __STATIC_FORCEINLINE void __set_PSPLIM(uint32_t ProcStackPtrLimit)
  function __STATIC_FORCEINLINE (line 725) | __STATIC_FORCEINLINE void __TZ_set_PSPLIM_NS(uint32_t ProcStackPtrLimit)
  function __STATIC_FORCEINLINE (line 746) | __STATIC_FORCEINLINE uint32_t __get_MSPLIM(void)
  function __STATIC_FORCEINLINE (line 769) | __STATIC_FORCEINLINE uint32_t __TZ_get_MSPLIM_NS(void)
  function __STATIC_FORCEINLINE (line 792) | __STATIC_FORCEINLINE void __set_MSPLIM(uint32_t MainStackPtrLimit)
  function __STATIC_FORCEINLINE (line 813) | __STATIC_FORCEINLINE void __TZ_set_MSPLIM_NS(uint32_t MainStackPtrLimit)
  function __STATIC_FORCEINLINE (line 833) | __STATIC_FORCEINLINE uint32_t __get_FPSCR(void)
  function __STATIC_FORCEINLINE (line 859) | __STATIC_FORCEINLINE void __set_FPSCR(uint32_t fpscr)
  function __STATIC_FORCEINLINE (line 986) | __STATIC_FORCEINLINE uint32_t __REV16(uint32_t value)
  function __STATIC_FORCEINLINE (line 1001) | __STATIC_FORCEINLINE int16_t __REVSH(int16_t value)
  function __STATIC_FORCEINLINE (line 1021) | __STATIC_FORCEINLINE uint32_t __ROR(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1048) | __STATIC_FORCEINLINE uint32_t __RBIT(uint32_t value)
  function __STATIC_FORCEINLINE (line 1078) | __STATIC_FORCEINLINE uint8_t __CLZ(uint32_t value)
  function __STATIC_FORCEINLINE (line 1107) | __STATIC_FORCEINLINE uint8_t __LDREXB(volatile uint8_t *addr)
  function __STATIC_FORCEINLINE (line 1129) | __STATIC_FORCEINLINE uint16_t __LDREXH(volatile uint16_t *addr)
  function __STATIC_FORCEINLINE (line 1151) | __STATIC_FORCEINLINE uint32_t __LDREXW(volatile uint32_t *addr)
  function __STATIC_FORCEINLINE (line 1168) | __STATIC_FORCEINLINE uint32_t __STREXB(uint8_t value, volatile uint8_t *...
  function __STATIC_FORCEINLINE (line 1185) | __STATIC_FORCEINLINE uint32_t __STREXH(uint16_t value, volatile uint16_t...
  function __STATIC_FORCEINLINE (line 1202) | __STATIC_FORCEINLINE uint32_t __STREXW(uint32_t value, volatile uint32_t...
  function __STATIC_FORCEINLINE (line 1215) | __STATIC_FORCEINLINE void __CLREX(void)
  function __STATIC_FORCEINLINE (line 1268) | __STATIC_FORCEINLINE uint32_t __RRX(uint32_t value)
  function __STATIC_FORCEINLINE (line 1283) | __STATIC_FORCEINLINE uint8_t __LDRBT(volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1305) | __STATIC_FORCEINLINE uint16_t __LDRHT(volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1327) | __STATIC_FORCEINLINE uint32_t __LDRT(volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1342) | __STATIC_FORCEINLINE void __STRBT(uint8_t value, volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1354) | __STATIC_FORCEINLINE void __STRHT(uint16_t value, volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1366) | __STATIC_FORCEINLINE void __STRT(uint32_t value, volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1382) | __STATIC_FORCEINLINE int32_t __SSAT(int32_t val, uint32_t sat)
  function __STATIC_FORCEINLINE (line 1407) | __STATIC_FORCEINLINE uint32_t __USAT(int32_t val, uint32_t sat)
  function __STATIC_FORCEINLINE (line 1437) | __STATIC_FORCEINLINE uint8_t __LDAB(volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1452) | __STATIC_FORCEINLINE uint16_t __LDAH(volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1467) | __STATIC_FORCEINLINE uint32_t __LDA(volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1482) | __STATIC_FORCEINLINE void __STLB(uint8_t value, volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1494) | __STATIC_FORCEINLINE void __STLH(uint16_t value, volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1506) | __STATIC_FORCEINLINE void __STL(uint32_t value, volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1518) | __STATIC_FORCEINLINE uint8_t __LDAEXB(volatile uint8_t *ptr)
  function __STATIC_FORCEINLINE (line 1533) | __STATIC_FORCEINLINE uint16_t __LDAEXH(volatile uint16_t *ptr)
  function __STATIC_FORCEINLINE (line 1548) | __STATIC_FORCEINLINE uint32_t __LDAEX(volatile uint32_t *ptr)
  function __STATIC_FORCEINLINE (line 1565) | __STATIC_FORCEINLINE uint32_t __STLEXB(uint8_t value, volatile uint8_t *...
  function __STATIC_FORCEINLINE (line 1582) | __STATIC_FORCEINLINE uint32_t __STLEXH(uint16_t value, volatile uint16_t...
  function __STATIC_FORCEINLINE (line 1599) | __STATIC_FORCEINLINE uint32_t __STLEX(uint32_t value, volatile uint32_t ...
  function __STATIC_FORCEINLINE (line 1621) | __STATIC_FORCEINLINE uint32_t __SADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1629) | __STATIC_FORCEINLINE uint32_t __QADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1637) | __STATIC_FORCEINLINE uint32_t __SHADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1645) | __STATIC_FORCEINLINE uint32_t __UADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1653) | __STATIC_FORCEINLINE uint32_t __UQADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1661) | __STATIC_FORCEINLINE uint32_t __UHADD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1670) | __STATIC_FORCEINLINE uint32_t __SSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1678) | __STATIC_FORCEINLINE uint32_t __QSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1686) | __STATIC_FORCEINLINE uint32_t __SHSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1694) | __STATIC_FORCEINLINE uint32_t __USUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1702) | __STATIC_FORCEINLINE uint32_t __UQSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1710) | __STATIC_FORCEINLINE uint32_t __UHSUB8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1719) | __STATIC_FORCEINLINE uint32_t __SADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1727) | __STATIC_FORCEINLINE uint32_t __QADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1735) | __STATIC_FORCEINLINE uint32_t __SHADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1743) | __STATIC_FORCEINLINE uint32_t __UADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1751) | __STATIC_FORCEINLINE uint32_t __UQADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1759) | __STATIC_FORCEINLINE uint32_t __UHADD16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1767) | __STATIC_FORCEINLINE uint32_t __SSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1775) | __STATIC_FORCEINLINE uint32_t __QSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1783) | __STATIC_FORCEINLINE uint32_t __SHSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1791) | __STATIC_FORCEINLINE uint32_t __USUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1799) | __STATIC_FORCEINLINE uint32_t __UQSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1807) | __STATIC_FORCEINLINE uint32_t __UHSUB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1815) | __STATIC_FORCEINLINE uint32_t __SASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1823) | __STATIC_FORCEINLINE uint32_t __QASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1831) | __STATIC_FORCEINLINE uint32_t __SHASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1839) | __STATIC_FORCEINLINE uint32_t __UASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1847) | __STATIC_FORCEINLINE uint32_t __UQASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1855) | __STATIC_FORCEINLINE uint32_t __UHASX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1863) | __STATIC_FORCEINLINE uint32_t __SSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1871) | __STATIC_FORCEINLINE uint32_t __QSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1879) | __STATIC_FORCEINLINE uint32_t __SHSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1887) | __STATIC_FORCEINLINE uint32_t __USAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1895) | __STATIC_FORCEINLINE uint32_t __UQSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1903) | __STATIC_FORCEINLINE uint32_t __UHSAX(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1911) | __STATIC_FORCEINLINE uint32_t __USAD8(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1919) | __STATIC_FORCEINLINE uint32_t __USADA8(uint32_t op1, uint32_t op2, uint3...
  function __STATIC_FORCEINLINE (line 1941) | __STATIC_FORCEINLINE uint32_t __UXTB16(uint32_t op1)
  function __STATIC_FORCEINLINE (line 1949) | __STATIC_FORCEINLINE uint32_t __UXTAB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1957) | __STATIC_FORCEINLINE uint32_t __SXTB16(uint32_t op1)
  function __STATIC_FORCEINLINE (line 1965) | __STATIC_FORCEINLINE uint32_t __SXTB16_RORn(uint32_t op1, uint32_t rotate)
  function __STATIC_FORCEINLINE (line 1974) | __STATIC_FORCEINLINE uint32_t __SXTAB16(uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1982) | __STATIC_FORCEINLINE uint32_t __SMUAD  (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1990) | __STATIC_FORCEINLINE uint32_t __SMUADX (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 1998) | __STATIC_FORCEINLINE uint32_t __SMLAD (uint32_t op1, uint32_t op2, uint3...
  function __STATIC_FORCEINLINE (line 2006) | __STATIC_FORCEINLINE uint32_t __SMLADX (uint32_t op1, uint32_t op2, uint...
  function __STATIC_FORCEINLINE (line 2014) | __STATIC_FORCEINLINE uint64_t __SMLALD (uint32_t op1, uint32_t op2, uint...
  function __STATIC_FORCEINLINE (line 2031) | __STATIC_FORCEINLINE uint64_t __SMLALDX (uint32_t op1, uint32_t op2, uin...
  function __STATIC_FORCEINLINE (line 2048) | __STATIC_FORCEINLINE uint32_t __SMUSD  (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 2056) | __STATIC_FORCEINLINE uint32_t __SMUSDX (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 2064) | __STATIC_FORCEINLINE uint32_t __SMLSD (uint32_t op1, uint32_t op2, uint3...
  function __STATIC_FORCEINLINE (line 2072) | __STATIC_FORCEINLINE uint32_t __SMLSDX (uint32_t op1, uint32_t op2, uint...
  function __STATIC_FORCEINLINE (line 2080) | __STATIC_FORCEINLINE uint64_t __SMLSLD (uint32_t op1, uint32_t op2, uint...
  function __STATIC_FORCEINLINE (line 2097) | __STATIC_FORCEINLINE uint64_t __SMLSLDX (uint32_t op1, uint32_t op2, uin...
  function __STATIC_FORCEINLINE (line 2114) | __STATIC_FORCEINLINE uint32_t __SEL  (uint32_t op1, uint32_t op2)
  function __STATIC_FORCEINLINE (line 2122) | __STATIC_FORCEINLINE  int32_t __QADD( int32_t op1,  int32_t op2)
  function __STATIC_FORCEINLINE (line 2130) | __STATIC_FORCEINLINE  int32_t __QSUB( int32_t op1,  int32_t op2)
  function __STATIC_FORCEINLINE (line 2163) | __STATIC_FORCEINLINE int32_t __SMMLA (int32_t op1, int32_t op2, int32_t ...

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include/cmsis_iccarm.h
  function __IAR_FT (line 183) | __IAR_FT uint16_t __iar_uint16_read(void const *ptr)
  function __IAR_FT (line 195) | __IAR_FT void __iar_uint16_write(void const *ptr, uint16_t val)
  function __IAR_FT (line 206) | __IAR_FT uint32_t __iar_uint32_read(void const *ptr)
  function __IAR_FT (line 217) | __IAR_FT void __iar_uint32_write(void const *ptr, uint32_t val)
  function __packed (line 228) | __packed struct  __iar_u32 { uint32_t v; }
  function __IAR_FT (line 405) | __IAR_FT int16_t __REVSH(int16_t val)
  function __STATIC_INLINE (line 527) | __STATIC_INLINE uint8_t __CLZ(uint32_t data)
  function __STATIC_INLINE (line 542) | __STATIC_INLINE uint32_t __RBIT(uint32_t v)
  function __STATIC_INLINE (line 555) | __STATIC_INLINE  uint32_t __get_APSR(void)
  function __IAR_FT (line 583) | __IAR_FT uint32_t __LDREXW(uint32_t volatile *ptr)
  function __IAR_FT (line 588) | __IAR_FT uint32_t __STREXW(uint32_t value, uint32_t volatile *ptr)
  function __IAR_FT (line 598) | __IAR_FT uint32_t __RRX(uint32_t value)
  function __IAR_FT (line 605) | __IAR_FT void __set_BASEPRI_MAX(uint32_t value)
  function __IAR_FT (line 617) | __IAR_FT uint32_t __ROR(uint32_t op1, uint32_t op2)
  function __IAR_FT (line 625) | __IAR_FT uint32_t __get_MSPLIM(void)
  function __IAR_FT (line 638) | __IAR_FT void   __set_MSPLIM(uint32_t value)
  function __IAR_FT (line 649) | __IAR_FT uint32_t __get_PSPLIM(void)
  function __IAR_FT (line 662) | __IAR_FT void   __set_PSPLIM(uint32_t value)
  function __IAR_FT (line 673) | __IAR_FT uint32_t __TZ_get_CONTROL_NS(void)
  function __IAR_FT (line 680) | __IAR_FT void   __TZ_set_CONTROL_NS(uint32_t value)
  function __IAR_FT (line 685) | __IAR_FT uint32_t   __TZ_get_PSP_NS(void)
  function __IAR_FT (line 692) | __IAR_FT void   __TZ_set_PSP_NS(uint32_t value)
  function __IAR_FT (line 697) | __IAR_FT uint32_t   __TZ_get_MSP_NS(void)
  function __IAR_FT (line 704) | __IAR_FT void   __TZ_set_MSP_NS(uint32_t value)
  function __IAR_FT (line 709) | __IAR_FT uint32_t   __TZ_get_SP_NS(void)
  function __IAR_FT (line 715) | __IAR_FT void   __TZ_set_SP_NS(uint32_t value)
  function __IAR_FT (line 720) | __IAR_FT uint32_t   __TZ_get_PRIMASK_NS(void)
  function __IAR_FT (line 727) | __IAR_FT void   __TZ_set_PRIMASK_NS(uint32_t value)
  function __IAR_FT (line 732) | __IAR_FT uint32_t   __TZ_get_BASEPRI_NS(void)
  function __IAR_FT (line 739) | __IAR_FT void   __TZ_set_BASEPRI_NS(uint32_t value)
  function __IAR_FT (line 744) | __IAR_FT uint32_t   __TZ_get_FAULTMASK_NS(void)
  function __IAR_FT (line 751) | __IAR_FT void   __TZ_set_FAULTMASK_NS(uint32_t value)
  function __IAR_FT (line 756) | __IAR_FT uint32_t   __TZ_get_PSPLIM_NS(void)
  function __IAR_FT (line 769) | __IAR_FT void   __TZ_set_PSPLIM_NS(uint32_t value)
  function __IAR_FT (line 780) | __IAR_FT uint32_t   __TZ_get_MSPLIM_NS(void)
  function __IAR_FT (line 787) | __IAR_FT void   __TZ_set_MSPLIM_NS(uint32_t value)
  function __STATIC_INLINE (line 799) | __STATIC_INLINE int32_t __SSAT(int32_t val, uint32_t sat)
  function __STATIC_INLINE (line 817) | __STATIC_INLINE uint32_t __USAT(int32_t val, uint32_t sat)
  function __IAR_FT (line 837) | __IAR_FT uint8_t __LDRBT(volatile uint8_t *addr)
  function __IAR_FT (line 844) | __IAR_FT uint16_t __LDRHT(volatile uint16_t *addr)
  function __IAR_FT (line 851) | __IAR_FT uint32_t __LDRT(volatile uint32_t *addr)
  function __IAR_FT (line 858) | __IAR_FT void __STRBT(uint8_t value, volatile uint8_t *addr)
  function __IAR_FT (line 863) | __IAR_FT void __STRHT(uint16_t value, volatile uint16_t *addr)
  function __IAR_FT (line 868) | __IAR_FT void __STRT(uint32_t value, volatile uint32_t *addr)
  function __IAR_FT (line 879) | __IAR_FT uint8_t __LDAB(volatile uint8_t *ptr)
  function __IAR_FT (line 886) | __IAR_FT uint16_t __LDAH(volatile uint16_t *ptr)
  function __IAR_FT (line 893) | __IAR_FT uint32_t __LDA(volatile uint32_t *ptr)
  function __IAR_FT (line 900) | __IAR_FT void __STLB(uint8_t value, volatile uint8_t *ptr)
  function __IAR_FT (line 905) | __IAR_FT void __STLH(uint16_t value, volatile uint16_t *ptr)
  function __IAR_FT (line 910) | __IAR_FT void __STL(uint32_t value, volatile uint32_t *ptr)
  function __IAR_FT (line 915) | __IAR_FT uint8_t __LDAEXB(volatile uint8_t *ptr)
  function __IAR_FT (line 922) | __IAR_FT uint16_t __LDAEXH(volatile uint16_t *ptr)
  function __IAR_FT (line 929) | __IAR_FT uint32_t __LDAEX(volatile uint32_t *ptr)
  function __IAR_FT (line 936) | __IAR_FT uint32_t __STLEXB(uint8_t value, volatile uint8_t *ptr)
  function __IAR_FT (line 943) | __IAR_FT uint32_t __STLEXH(uint16_t value, volatile uint16_t *ptr)
  function __IAR_FT (line 950) | __IAR_FT uint32_t __STLEX(uint32_t value, volatile uint32_t *ptr)

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include/core_cm0plus.h
  type APSR_Type (line 210) | typedef union
  type IPSR_Type (line 240) | typedef union
  type xPSR_Type (line 258) | typedef union
  type CONTROL_Type (line 297) | typedef union
  type NVIC_Type (line 328) | typedef struct
  type SCB_Type (line 355) | typedef struct
  type SysTick_Type (line 472) | typedef struct
  type MPU_Type (line 524) | typedef struct
  function __STATIC_INLINE (line 741) | __STATIC_INLINE void __NVIC_EnableIRQ(IRQn_Type IRQn)
  function __STATIC_INLINE (line 760) | __STATIC_INLINE uint32_t __NVIC_GetEnableIRQ(IRQn_Type IRQn)
  function __STATIC_INLINE (line 779) | __STATIC_INLINE void __NVIC_DisableIRQ(IRQn_Type IRQn)
  function __STATIC_INLINE (line 798) | __STATIC_INLINE uint32_t __NVIC_GetPendingIRQ(IRQn_Type IRQn)
  function __STATIC_INLINE (line 817) | __STATIC_INLINE void __NVIC_SetPendingIRQ(IRQn_Type IRQn)
  function __STATIC_INLINE (line 832) | __STATIC_INLINE void __NVIC_ClearPendingIRQ(IRQn_Type IRQn)
  function __STATIC_INLINE (line 850) | __STATIC_INLINE void __NVIC_SetPriority(IRQn_Type IRQn, uint32_t priority)
  function __STATIC_INLINE (line 874) | __STATIC_INLINE uint32_t __NVIC_GetPriority(IRQn_Type IRQn)
  function __STATIC_INLINE (line 899) | __STATIC_INLINE uint32_t NVIC_EncodePriority (uint32_t PriorityGroup, ui...
  function __STATIC_INLINE (line 926) | __STATIC_INLINE void NVIC_DecodePriority (uint32_t Priority, uint32_t Pr...
  function __STATIC_INLINE (line 950) | __STATIC_INLINE void __NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
  function __STATIC_INLINE (line 971) | __STATIC_INLINE uint32_t __NVIC_GetVector(IRQn_Type IRQn)
  function __NVIC_SystemReset (line 987) | void __NVIC_SystemReset(void)
  function __STATIC_INLINE (line 1027) | __STATIC_INLINE uint32_t SCB_GetFPUType(void)
  function __STATIC_INLINE (line 1058) | __STATIC_INLINE uint32_t SysTick_Config(uint32_t ticks)

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Core/Include/mpu_armv7.h
  type ARM_MPU_Region_t (line 183) | typedef struct {
  function __STATIC_INLINE (line 191) | __STATIC_INLINE void ARM_MPU_Enable(uint32_t MPU_Control)
  function __STATIC_INLINE (line 204) | __STATIC_INLINE void ARM_MPU_Disable(void)
  function __STATIC_INLINE (line 218) | __STATIC_INLINE void ARM_MPU_ClrRegion(uint32_t rnr)
  function __STATIC_INLINE (line 228) | __STATIC_INLINE void ARM_MPU_SetRegion(uint32_t rbar, uint32_t rasr)
  function __STATIC_INLINE (line 239) | __STATIC_INLINE void ARM_MPU_SetRegionEx(uint32_t rnr, uint32_t rbar, ui...
  function __STATIC_INLINE (line 251) | __STATIC_INLINE void ARM_MPU_OrderedMemcpy(volatile uint32_t* dst, const...
  function __STATIC_INLINE (line 264) | __STATIC_INLINE void ARM_MPU_Load(ARM_MPU_Region_t const* table, uint32_...

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RaspberryPi/RP2040/Include/RP2040.h
  type IRQn_Type (line 40) | typedef enum

FILE: pico-sdk/src/rp2_common/cmsis/stub/CMSIS/Device/RaspberryPi/RP2040/Source/system_RP2040.c
  function SystemCoreClockUpdate (line 41) | void SystemCoreClockUpdate (void)
  function SystemInit (line 49) | void __attribute__((constructor)) SystemInit (void)

FILE: pico-sdk/src/rp2_common/hardware_adc/adc.c
  function adc_init (line 11) | void adc_init(void) {

FILE: pico-sdk/src/rp2_common/hardware_adc/include/hardware/adc.h
  function adc_gpio_init (line 69) | static inline void adc_gpio_init(uint gpio) {
  function adc_select_input (line 86) | static inline void adc_select_input(uint input) {
  function uint (line 96) | static inline uint adc_get_selected_input(void) {
  function adc_set_round_robin (line 108) | static inline void adc_set_round_robin(uint input_mask) {
  function adc_set_temp_sensor_enabled (line 119) | static inline void adc_set_temp_sensor_enabled(bool enable) {
  function adc_read (line 133) | static inline uint16_t adc_read(void) {
  function adc_run (line 147) | static inline void adc_run(bool run) {
  function adc_set_clkdiv (line 162) | static inline void adc_set_clkdiv(float clkdiv) {
  function adc_fifo_setup (line 178) | static inline void adc_fifo_setup(bool en, bool dreq_en, uint16_t dreq_t...
  function adc_fifo_is_empty (line 198) | static inline bool adc_fifo_is_empty(void) {
  function adc_fifo_get_level (line 207) | static inline uint8_t adc_fifo_get_level(void) {
  function adc_fifo_get (line 216) | static inline uint16_t adc_fifo_get(void) {
  function adc_fifo_get_blocking (line 225) | static inline uint16_t adc_fifo_get_blocking(void) {
  function adc_fifo_drain (line 236) | static inline void adc_fifo_drain(void) {
  function adc_irq_set_enabled (line 249) | static inline void adc_irq_set_enabled(bool enabled) {

FILE: pico-sdk/src/rp2_common/hardware_base/include/hardware/address_mapped.h
  type io_rw_32 (line 63) | typedef volatile uint32_t io_rw_32;
  type io_ro_32 (line 64) | typedef const volatile uint32_t io_ro_32;
  type io_wo_32 (line 65) | typedef volatile uint32_t io_wo_32;
  type io_rw_16 (line 66) | typedef volatile uint16_t io_rw_16;
  type io_ro_16 (line 67) | typedef const volatile uint16_t io_ro_16;
  type io_wo_16 (line 68) | typedef volatile uint16_t io_wo_16;
  type io_rw_8 (line 69) | typedef volatile uint8_t io_rw_8;
  type io_ro_8 (line 70) | typedef const volatile uint8_t io_ro_8;
  type io_wo_8 (line 71) | typedef volatile uint8_t io_wo_8;
  type ioptr (line 74) | typedef ioptr const const_ioptr;
  function __force_inline (line 93) | __force_inline static uint32_t xip_alias_check_addr(const void *addr) {
  function __force_inline (line 121) | __force_inline static void hw_set_bits(io_rw_32 *addr, uint32_t mask) {
  function __force_inline (line 131) | __force_inline static void hw_clear_bits(io_rw_32 *addr, uint32_t mask) {
  function __force_inline (line 141) | __force_inline static void hw_xor_bits(io_rw_32 *addr, uint32_t mask) {
  function __force_inline (line 157) | __force_inline static void hw_write_masked(io_rw_32 *addr, uint32_t valu...

FILE: pico-sdk/src/rp2_common/hardware_claim/claim.c
  function hw_claim_lock (line 9) | uint32_t hw_claim_lock(void) {
  function hw_claim_unlock (line 13) | void hw_claim_unlock(uint32_t save) {
  function hw_is_claimed (line 17) | inline bool hw_is_claimed(const uint8_t *bits, uint bit_index) {
  function hw_claim_or_assert (line 21) | void hw_claim_or_assert(uint8_t *bits, uint bit_index, const char *messa...
  function hw_claim_unused_from_range (line 31) | int hw_claim_unused_from_range(uint8_t *bits, bool required, uint bit_ls...
  function hw_claim_clear (line 49) | void hw_claim_clear(uint8_t *bits, uint bit_index) {

FILE: pico-sdk/src/rp2_common/hardware_clocks/clocks.c
  function has_glitchless_mux (line 37) | static inline bool has_glitchless_mux(enum clock_index clk_index) {
  function clock_stop (line 41) | void clock_stop(enum clock_index clk_index) {
  function clock_configure (line 48) | bool clock_configure(enum clock_index clk_index, uint32_t src, uint32_t ...
  function clocks_init (line 121) | void clocks_init(void) {
  function clock_get_hz (line 201) | uint32_t clock_get_hz(enum clock_index clk_index) {
  function clock_set_reported_hz (line 206) | void clock_set_reported_hz(enum clock_index clk_index, uint hz) {
  function frequency_count_khz (line 211) | uint32_t frequency_count_khz(uint src) {
  function clocks_handle_resus (line 241) | static void clocks_handle_resus(void) {
  function clocks_irq_handler (line 269) | static void clocks_irq_handler(void) {
  function clocks_enable_resus (line 286) | void clocks_enable_resus(resus_callback_t resus_callback) {
  function clock_gpio_init_int_frac (line 310) | void clock_gpio_init_int_frac(uint gpio, uint src, uint32_t div_int, uin...
  function clock_configure_gpin (line 357) | bool clock_configure_gpin(enum clock_index clk_index, uint gpio, uint32_...

FILE: pico-sdk/src/rp2_common/hardware_clocks/include/hardware/clocks.h
  type clock_index (line 179) | enum clock_index
  type clock_index (line 186) | enum clock_index
  type clock_index (line 194) | enum clock_index
  type clock_index (line 209) | enum clock_index
  function frequency_count_mhz (line 212) | static inline float frequency_count_mhz(uint src) {
  function clock_gpio_init (line 251) | static inline void clock_gpio_init(uint gpio, uint src, float div)
  type clock_index (line 266) | enum clock_index

FILE: pico-sdk/src/rp2_common/hardware_divider/include/hardware/divider.h
  type divmod_result_t (line 43) | typedef uint64_t divmod_result_t;
  function hw_divider_divmod_s32_start (line 54) | static inline void hw_divider_divmod_s32_start(int32_t a, int32_t b) {
  function hw_divider_divmod_u32_start (line 69) | static inline void hw_divider_divmod_u32_start(uint32_t a, uint32_t b) {
  function hw_divider_wait_ready (line 81) | static inline void hw_divider_wait_ready(void) {
  function divmod_result_t (line 106) | static inline divmod_result_t hw_divider_result_nowait(void) {
  function divmod_result_t (line 120) | static inline divmod_result_t hw_divider_result_wait(void) {
  function hw_divider_u32_quotient_wait (line 132) | static inline uint32_t hw_divider_u32_quotient_wait(void) {
  function hw_divider_s32_quotient_wait (line 144) | static inline int32_t hw_divider_s32_quotient_wait(void) {
  function hw_divider_u32_remainder_wait (line 156) | static inline uint32_t hw_divider_u32_remainder_wait(void) {
  function hw_divider_s32_remainder_wait (line 170) | static inline int32_t hw_divider_s32_remainder_wait(void) {
  function to_quotient_u32 (line 205) | inline static uint32_t to_quotient_u32(divmod_result_t r) {
  function to_quotient_s32 (line 215) | inline static int32_t to_quotient_s32(divmod_result_t r) {
  function to_remainder_u32 (line 227) | inline static uint32_t to_remainder_u32(divmod_result_t r) {
  function to_remainder_s32 (line 239) | inline static int32_t to_remainder_s32(divmod_result_t r) {
  function hw_divider_u32_quotient (line 252) | static inline uint32_t hw_divider_u32_quotient(uint32_t a, uint32_t b) {
  function hw_divider_u32_remainder (line 265) | static inline uint32_t hw_divider_u32_remainder(uint32_t a, uint32_t b) {
  function hw_divider_quotient_s32 (line 278) | static inline int32_t hw_divider_quotient_s32(int32_t a, int32_t b) {
  function hw_divider_remainder_s32 (line 291) | static inline int32_t hw_divider_remainder_s32(int32_t a, int32_t b) {
  function hw_divider_pause (line 298) | static inline void hw_divider_pause(void) {
  function hw_divider_u32_quotient_inlined (line 320) | static inline uint32_t hw_divider_u32_quotient_inlined(uint32_t a, uint3...
  function hw_divider_u32_remainder_inlined (line 335) | static inline uint32_t hw_divider_u32_remainder_inlined(uint32_t a, uint...
  function hw_divider_s32_quotient_inlined (line 352) | static inline int32_t hw_divider_s32_quotient_inlined(int32_t a, int32_t...
  function hw_divider_s32_remainder_inlined (line 367) | static inline int32_t hw_divider_s32_remainder_inlined(int32_t a, int32_...
  type hw_divider_state_t (line 375) | typedef struct {

FILE: pico-sdk/src/rp2_common/hardware_dma/dma.c
  function dma_channel_claim (line 23) | void dma_channel_claim(uint channel) {
  function dma_claim_mask (line 28) | void dma_claim_mask(uint32_t mask) {
  function dma_channel_unclaim (line 34) | void dma_channel_unclaim(uint channel) {
  function dma_unclaim_mask (line 39) | void dma_unclaim_mask(uint32_t mask) {
  function dma_claim_unused_channel (line 45) | int dma_claim_unused_channel(bool required) {
  function dma_channel_is_claimed (line 49) | bool dma_channel_is_claimed(uint channel) {
  function dma_timer_claim (line 54) | void dma_timer_claim(uint timer) {
  function dma_timer_unclaim (line 59) | void dma_timer_unclaim(uint timer) {
  function dma_claim_unused_timer (line 64) | int dma_claim_unused_timer(bool required) {
  function dma_timer_is_claimed (line 68) | bool dma_timer_is_claimed(uint timer) {
  function dma_channel_cleanup (line 73) | void dma_channel_cleanup(uint channel) {
  function print_dma_ctrl (line 87) | void print_dma_ctrl(dma_channel_hw_t *channel) {
  function check_dma_channel_param_impl (line 109) | void check_dma_channel_param_impl(uint __unused channel) {

FILE: pico-sdk/src/rp2_common/hardware_dma/include/hardware/dma.h
  function check_dma_channel_param (line 49) | static inline void check_dma_channel_param(__unused uint channel) {
  function check_dma_timer_param (line 57) | static inline void check_dma_timer_param(__unused uint timer_num) {
  function dma_channel_hw_t (line 61) | inline static dma_channel_hw_t *dma_channel_hw_addr(uint channel) {
  type dma_channel_transfer_size (line 133) | enum dma_channel_transfer_size {
  type dma_channel_config (line 139) | typedef struct {
  function channel_config_set_read_increment (line 150) | static inline void channel_config_set_read_increment(dma_channel_config ...
  function channel_config_set_write_increment (line 161) | static inline void channel_config_set_write_increment(dma_channel_config...
  function channel_config_set_dreq (line 180) | static inline void channel_config_set_dreq(dma_channel_config *c, uint d...
  function channel_config_set_chain_to (line 194) | static inline void channel_config_set_chain_to(dma_channel_config *c, ui...
  function channel_config_set_transfer_data_size (line 208) | static inline void channel_config_set_transfer_data_size(dma_channel_con...
  function channel_config_set_ring (line 228) | static inline void channel_config_set_ring(dma_channel_config *c, bool w...
  function channel_config_set_bswap (line 244) | static inline void channel_config_set_bswap(dma_channel_config *c, bool ...
  function channel_config_set_irq_quiet (line 258) | static inline void channel_config_set_irq_quiet(dma_channel_config *c, b...
  function channel_config_set_high_priority (line 276) | static inline void channel_config_set_high_priority(dma_channel_config *...
  function channel_config_set_enable (line 291) | static inline void channel_config_set_enable(dma_channel_config *c, bool...
  function channel_config_set_sniff_enable (line 303) | static inline void channel_config_set_sniff_enable(dma_channel_config *c...
  function dma_channel_config (line 328) | static inline dma_channel_config dma_channel_get_default_config(uint cha...
  function dma_channel_config (line 350) | static inline dma_channel_config dma_get_channel_config(uint channel) {
  function channel_config_get_ctrl_value (line 362) | static inline uint32_t channel_config_get_ctrl_value(const dma_channel_c...
  function dma_channel_set_config (line 373) | static inline void dma_channel_set_config(uint channel, const dma_channe...
  function dma_channel_set_read_addr (line 389) | static inline void dma_channel_set_read_addr(uint channel, const volatil...
  function dma_channel_set_write_addr (line 404) | static inline void dma_channel_set_write_addr(uint channel, volatile voi...
  function dma_channel_set_trans_count (line 419) | static inline void dma_channel_set_trans_count(uint channel, uint32_t tr...
  function dma_channel_configure (line 437) | static inline void dma_channel_configure(uint channel, const dma_channel...
  function dma_channel_transfer_from_buffer_now (line 453) | inline static void __attribute__((always_inline)) dma_channel_transfer_f...
  function dma_channel_transfer_to_buffer_now (line 469) | inline static void dma_channel_transfer_to_buffer_now(uint channel, vola...
  function dma_start_channel_mask (line 480) | static inline void dma_start_channel_mask(uint32_t chan_mask) {
  function dma_channel_start (line 490) | static inline void dma_channel_start(uint channel) {
  function dma_channel_abort (line 527) | static inline void dma_channel_abort(uint channel) {
  function dma_channel_set_irq0_enabled (line 541) | static inline void dma_channel_set_irq0_enabled(uint channel, bool enabl...
  function dma_set_irq0_channel_mask_enabled (line 556) | static inline void dma_set_irq0_channel_mask_enabled(uint32_t channel_ma...
  function dma_channel_set_irq1_enabled (line 570) | static inline void dma_channel_set_irq1_enabled(uint channel, bool enabl...
  function dma_set_irq1_channel_mask_enabled (line 585) | static inline void dma_set_irq1_channel_mask_enabled(uint32_t channel_ma...
  function dma_irqn_set_channel_enabled (line 600) | static inline void dma_irqn_set_channel_enabled(uint irq_index, uint cha...
  function dma_irqn_set_channel_mask_enabled (line 616) | static inline void dma_irqn_set_channel_mask_enabled(uint irq_index, uin...
  function dma_channel_get_irq0_status (line 631) | static inline bool dma_channel_get_irq0_status(uint channel) {
  function dma_channel_get_irq1_status (line 642) | static inline bool dma_channel_get_irq1_status(uint channel) {
  function dma_irqn_get_channel_status (line 654) | static inline bool dma_irqn_get_channel_status(uint irq_index, uint chan...
  function dma_channel_acknowledge_irq0 (line 665) | static inline void dma_channel_acknowledge_irq0(uint channel) {
  function dma_channel_acknowledge_irq1 (line 675) | static inline void dma_channel_acknowledge_irq1(uint channel) {
  function dma_irqn_acknowledge_channel (line 686) | static inline void dma_irqn_acknowledge_channel(uint irq_index, uint cha...
  function dma_channel_is_busy (line 701) | inline static bool dma_channel_is_busy(uint channel) {
  function dma_channel_wait_for_finish_blocking (line 711) | inline static void dma_channel_wait_for_finish_blocking(uint channel) {
  function dma_sniffer_enable (line 737) | inline static void dma_sniffer_enable(uint channel, uint mode, bool forc...
  function dma_sniffer_set_byte_swap_enabled (line 763) | inline static void dma_sniffer_set_byte_swap_enabled(bool swap) {
  function dma_sniffer_set_output_invert_enabled (line 778) | inline static void dma_sniffer_set_output_invert_enabled(bool invert) {
  function dma_sniffer_set_output_reverse_enabled (line 793) | inline static void dma_sniffer_set_output_reverse_enabled(bool reverse) {
  function dma_sniffer_disable (line 804) | inline static void dma_sniffer_disable(void) {
  function dma_sniffer_set_data_accumulator (line 816) | inline static void dma_sniffer_set_data_accumulator(uint32_t seed_value) {
  function dma_sniffer_get_data_accumulator (line 825) | inline static uint32_t dma_sniffer_get_data_accumulator(void) {
  function dma_timer_set_fraction (line 876) | static inline void dma_timer_set_fraction(uint timer, uint16_t numerator...
  function uint (line 886) | static inline uint dma_get_timer_dreq(uint timer_num) {

FILE: pico-sdk/src/rp2_common/hardware_exception/exception.c
  function exception_is_compile_time_default (line 14) | static bool exception_is_compile_time_default(exception_handler_t handle...
  function exception_handler_t (line 22) | static inline exception_handler_t *get_vtable(void) {
  function set_raw_exception_handler_and_restore_interrupts (line 26) | static void set_raw_exception_handler_and_restore_interrupts(enum except...
  function check_exception_param (line 33) | static inline void check_exception_param(__unused enum exception_number ...
  function exception_handler_t (line 37) | exception_handler_t exception_get_vtable_handler(enum exception_number n...
  function exception_handler_t (line 42) | exception_handler_t exception_set_exclusive_handler(enum exception_numbe...
  function exception_restore_handler (line 55) | void exception_restore_handler(enum exception_number num, exception_hand...

FILE: pico-sdk/src/rp2_common/hardware_exception/include/hardware/exception.h
  type exception_number (line 50) | enum exception_number {
  type exception_number (line 78) | enum exception_number
  type exception_number (line 91) | enum exception_number
  type exception_number (line 100) | enum exception_number

FILE: pico-sdk/src/rp2_common/hardware_flash/flash.c
  function flash_get_unique_id (line 164) | void flash_get_unique_id(uint8_t *id_out) {

FILE: pico-sdk/src/rp2_common/hardware_gpio/gpio.c
  function gpio_get_pad (line 22) | int gpio_get_pad(uint gpio) {
  function gpio_set_function (line 32) | void gpio_set_function(uint gpio, enum gpio_function fn) {
  function gpio_get_function (line 46) | enum gpio_function gpio_get_function(uint gpio) {
  function gpio_set_pulls (line 53) | void gpio_set_pulls(uint gpio, bool up, bool down) {
  function gpio_set_irqover (line 63) | void gpio_set_irqover(uint gpio, uint value) {
  function gpio_set_inover (line 72) | void gpio_set_inover(uint gpio, uint value) {
  function gpio_set_outover (line 80) | void gpio_set_outover(uint gpio, uint value) {
  function gpio_set_oeover (line 88) | void gpio_set_oeover(uint gpio, uint value) {
  function gpio_set_input_hysteresis_enabled (line 96) | void gpio_set_input_hysteresis_enabled(uint gpio, bool enabled) {
  function gpio_is_input_hysteresis_enabled (line 105) | bool gpio_is_input_hysteresis_enabled(uint gpio) {
  function gpio_set_slew_rate (line 110) | void gpio_set_slew_rate(uint gpio, enum gpio_slew_rate slew) {
  function gpio_get_slew_rate (line 118) | enum gpio_slew_rate gpio_get_slew_rate(uint gpio) {
  function gpio_set_drive_strength (line 128) | void gpio_set_drive_strength(uint gpio, enum gpio_drive_strength drive) {
  function gpio_get_drive_strength (line 136) | enum gpio_drive_strength gpio_get_drive_strength(uint gpio) {
  function gpio_default_irq_handler (line 143) | static void gpio_default_irq_handler(void) {
  function _gpio_set_irq_enabled (line 163) | static void _gpio_set_irq_enabled(uint gpio, uint32_t events, bool enabl...
  function gpio_set_irq_enabled (line 176) | void gpio_set_irq_enabled(uint gpio, uint32_t events, bool enabled) {
  function gpio_set_irq_enabled_with_callback (line 184) | void gpio_set_irq_enabled_with_callback(uint gpio, uint32_t events, bool...
  function gpio_set_irq_callback (line 190) | void gpio_set_irq_callback(gpio_irq_callback_t callback) {
  function gpio_add_raw_irq_handler_with_order_priority_masked (line 203) | void gpio_add_raw_irq_handler_with_order_priority_masked(uint gpio_mask,...
  function gpio_add_raw_irq_handler_masked (line 209) | void gpio_add_raw_irq_handler_masked(uint gpio_mask, irq_handler_t handl...
  function gpio_remove_raw_irq_handler_masked (line 213) | void gpio_remove_raw_irq_handler_masked(uint gpio_mask, irq_handler_t ha...
  function gpio_set_dormant_irq_enabled (line 219) | void gpio_set_dormant_irq_enabled(uint gpio, uint32_t events, bool enabl...
  function gpio_acknowledge_irq (line 225) | void gpio_acknowledge_irq(uint gpio, uint32_t events) {
  function gpio_debug_pins_init (line 231) | void gpio_debug_pins_init() {
  function gpio_set_input_enabled (line 239) | void gpio_set_input_enabled(uint gpio, bool enabled) {
  function gpio_init (line 246) | void gpio_init(uint gpio) {
  function gpio_deinit (line 252) | void gpio_deinit(uint gpio) {
  function gpio_init_mask (line 256) | void gpio_init_mask(uint gpio_mask) {

FILE: pico-sdk/src/rp2_common/hardware_gpio/include/hardware/gpio.h
  type gpio_function (line 90) | enum gpio_function {
  type gpio_irq_level (line 122) | enum gpio_irq_level {
  type gpio_override (line 139) | enum gpio_override {
  type gpio_slew_rate (line 153) | enum gpio_slew_rate {
  type gpio_drive_strength (line 164) | enum gpio_drive_strength {
  function check_gpio_param (line 171) | static inline void check_gpio_param(__unused uint gpio) {
  type gpio_function (line 186) | enum gpio_function
  type gpio_function (line 194) | enum gpio_function
  function gpio_pull_up (line 213) | static inline void gpio_pull_up(uint gpio) {
  function gpio_is_pulled_up (line 223) | static inline bool gpio_is_pulled_up(uint gpio) {
  function gpio_pull_down (line 232) | static inline void gpio_pull_down(uint gpio) {
  function gpio_is_pulled_down (line 242) | static inline bool gpio_is_pulled_down(uint gpio) {
  function gpio_disable_pulls (line 251) | static inline void gpio_disable_pulls(uint gpio) {
  type gpio_slew_rate (line 327) | enum gpio_slew_rate
  type gpio_slew_rate (line 336) | enum gpio_slew_rate
  type gpio_drive_strength (line 345) | enum gpio_drive_strength
  type gpio_drive_strength (line 354) | enum gpio_drive_strength
  function gpio_get_irq_event_mask (line 461) | static inline uint32_t gpio_get_irq_event_mask(uint gpio) {
  function gpio_add_raw_irq_handler_with_order_priority (line 545) | static inline void gpio_add_raw_irq_handler_with_order_priority(uint gpi...
  function gpio_add_raw_irq_handler (line 604) | static inline void gpio_add_raw_irq_handler(uint gpio, irq_handler_t han...
  function gpio_remove_raw_irq_handler (line 633) | static inline void gpio_remove_raw_irq_handler(uint gpio, irq_handler_t ...
  function gpio_get (line 674) | static inline bool gpio_get(uint gpio) {
  function gpio_get_all (line 683) | static inline uint32_t gpio_get_all(void) {
  function gpio_set_mask (line 696) | static inline void gpio_set_mask(uint32_t mask) {
  function gpio_clr_mask (line 705) | static inline void gpio_clr_mask(uint32_t mask) {
  function gpio_xor_mask (line 714) | static inline void gpio_xor_mask(uint32_t mask) {
  function gpio_put_masked (line 729) | static inline void gpio_put_masked(uint32_t mask, uint32_t value) {
  function gpio_put_all (line 738) | static inline void gpio_put_all(uint32_t value) {
  function gpio_put (line 748) | static inline void gpio_put(uint gpio, bool value) {
  function gpio_get_out_level (line 772) | static inline bool gpio_get_out_level(uint gpio) {
  function gpio_set_dir_out_masked (line 787) | static inline void gpio_set_dir_out_masked(uint32_t mask) {
  function gpio_set_dir_in_masked (line 796) | static inline void gpio_set_dir_in_masked(uint32_t mask) {
  function gpio_set_dir_masked (line 811) | static inline void gpio_set_dir_masked(uint32_t mask, uint32_t value) {
  function gpio_set_dir_all_bits (line 820) | static inline void gpio_set_dir_all_bits(uint32_t values) {
  function gpio_set_dir (line 830) | static inline void gpio_set_dir(uint gpio, bool out) {
  function gpio_is_dir_out (line 844) | static inline bool gpio_is_dir_out(uint gpio) {
  function uint (line 854) | static inline uint gpio_get_dir(uint gpio) {

FILE: pico-sdk/src/rp2_common/hardware_i2c/i2c.c
  function i2c_reset (line 18) | static inline void i2c_reset(i2c_inst_t *i2c) {
  function i2c_unreset (line 23) | static inline void i2c_unreset(i2c_inst_t *i2c) {
  function uint (line 32) | uint i2c_init(i2c_inst_t *i2c, uint baudrate) {
  function i2c_deinit (line 58) | void i2c_deinit(i2c_inst_t *i2c) {
  function uint (line 62) | uint i2c_set_baudrate(i2c_inst_t *i2c, uint baudrate) {
  function i2c_set_slave_mode (line 112) | void i2c_set_slave_mode(i2c_inst_t *i2c, bool slave, uint8_t addr) {
  function i2c_write_blocking_internal (line 133) | static int i2c_write_blocking_internal(i2c_inst_t *i2c, uint8_t addr, co...
  function i2c_write_blocking (line 241) | int i2c_write_blocking(i2c_inst_t *i2c, uint8_t addr, const uint8_t *src...
  function i2c_write_blocking_until (line 245) | int i2c_write_blocking_until(i2c_inst_t *i2c, uint8_t addr, const uint8_...
  function i2c_write_timeout_per_char_us (line 251) | int i2c_write_timeout_per_char_us(i2c_inst_t *i2c, uint8_t addr, const u...
  function i2c_read_blocking_internal (line 258) | static int i2c_read_blocking_internal(i2c_inst_t *i2c, uint8_t addr, uin...
  function i2c_read_blocking (line 321) | int i2c_read_blocking(i2c_inst_t *i2c, uint8_t addr, uint8_t *dst, size_...
  function i2c_read_blocking_until (line 325) | int i2c_read_blocking_until(i2c_inst_t *i2c, uint8_t addr, uint8_t *dst,...
  function i2c_read_timeout_per_char_us (line 330) | int i2c_read_timeout_per_char_us(i2c_inst_t *i2c, uint8_t addr, uint8_t ...

FILE: pico-sdk/src/rp2_common/hardware_i2c/include/hardware/i2c.h
  type i2c_inst_t (line 52) | typedef struct i2c_inst i2c_inst_t;
  type i2c_inst (line 135) | struct i2c_inst {
  function uint (line 146) | static inline uint i2c_hw_index(i2c_inst_t *i2c) {
  function i2c_hw_t (line 151) | static inline i2c_hw_t *i2c_get_hw(i2c_inst_t *i2c) {
  function i2c_inst_t (line 156) | static inline i2c_inst_t *i2c_get_instance(uint instance) {
  function i2c_write_timeout_us (line 208) | static inline int i2c_write_timeout_us(i2c_inst_t *i2c, uint8_t addr, co...
  function i2c_read_timeout_us (line 227) | static inline int i2c_read_timeout_us(i2c_inst_t *i2c, uint8_t addr, uin...
  function i2c_get_write_available (line 268) | static inline size_t i2c_get_write_available(i2c_inst_t *i2c) {
  function i2c_get_read_available (line 280) | static inline size_t i2c_get_read_available(i2c_inst_t *i2c) {
  function i2c_write_raw_blocking (line 294) | static inline void i2c_write_raw_blocking(i2c_inst_t *i2c, const uint8_t...
  function i2c_read_raw_blocking (line 313) | static inline void i2c_read_raw_blocking(i2c_inst_t *i2c, uint8_t *dst, ...
  function i2c_read_byte_raw (line 330) | static inline uint8_t i2c_read_byte_raw(i2c_inst_t *i2c) {
  function i2c_write_byte_raw (line 345) | static inline void i2c_write_byte_raw(i2c_inst_t *i2c, uint8_t value) {
  function uint (line 358) | static inline uint i2c_get_dreq(i2c_inst_t *i2c, bool is_tx) {

FILE: pico-sdk/src/rp2_common/hardware_interp/include/hardware/interp.h
  type interp_config (line 53) | typedef struct {
  function uint (line 57) | static inline uint interp_index(interp_hw_t *interp) {
  function interp_config_set_shift (line 121) | static inline void interp_config_set_shift(interp_config *c, uint shift) {
  function interp_config_set_mask (line 136) | static inline void interp_config_set_mask(interp_config *c, uint mask_ls...
  function interp_config_set_cross_input (line 154) | static inline void interp_config_set_cross_input(interp_config *c, bool ...
  function interp_config_set_cross_result (line 167) | static inline void interp_config_set_cross_result(interp_config *c, bool...
  function interp_config_set_signed (line 181) | static inline void interp_config_set_signed(interp_config *c, bool _sign...
  function interp_config_set_add_raw (line 194) | static inline void interp_config_set_add_raw(interp_config *c, bool add_...
  function interp_config_set_blend (line 214) | static inline void interp_config_set_blend(interp_config *c, bool blend) {
  function interp_config_set_clamp (line 229) | static inline void interp_config_set_clamp(interp_config *c, bool clamp) {
  function interp_config_set_force_bits (line 245) | static inline void interp_config_set_force_bits(interp_config *c, uint b...
  function interp_config (line 257) | static inline interp_config interp_default_config(void) {
  function interp_set_config (line 275) | static inline void interp_set_config(interp_hw_t *interp, uint lane, int...
  function interp_set_force_bits (line 297) | static inline void interp_set_force_bits(interp_hw_t *interp, uint lane,...
  type interp_hw_save_t (line 302) | typedef struct {
  function interp_set_base (line 334) | static inline void interp_set_base(interp_hw_t *interp, uint lane, uint3...
  function interp_get_base (line 345) | static inline uint32_t interp_get_base(interp_hw_t *interp, uint lane) {
  function interp_set_base_both (line 358) | static inline void interp_set_base_both(interp_hw_t *interp, uint32_t va...
  function interp_set_accumulator (line 370) | static inline void interp_set_accumulator(interp_hw_t *interp, uint lane...
  function interp_get_accumulator (line 381) | static inline uint32_t interp_get_accumulator(interp_hw_t *interp, uint ...
  function interp_pop_lane_result (line 392) | static inline uint32_t interp_pop_lane_result(interp_hw_t *interp, uint ...
  function interp_peek_lane_result (line 403) | static inline uint32_t interp_peek_lane_result(interp_hw_t *interp, uint...
  function interp_pop_full_result (line 413) | static inline uint32_t interp_pop_full_result(interp_hw_t *interp) {
  function interp_peek_full_result (line 423) | static inline uint32_t interp_peek_full_result(interp_hw_t *interp) {
  function interp_add_accumulater (line 436) | static inline void interp_add_accumulater(interp_hw_t *interp, uint lane...
  function interp_get_raw (line 449) | static inline uint32_t interp_get_raw(interp_hw_t *interp, uint lane) {

FILE: pico-sdk/src/rp2_common/hardware_interp/interp.c
  function uint (line 19) | static inline uint interp_lane_bit(interp_hw_t * interp, uint lane) {
  function interp_claim_lane (line 23) | void interp_claim_lane(interp_hw_t *interp, uint lane) {
  function interp_claim_lane_mask (line 28) | void interp_claim_lane_mask(interp_hw_t *interp, uint lane_mask) {
  function interp_unclaim_lane (line 34) | void interp_unclaim_lane(interp_hw_t *interp, uint lane) {
  function interp_lane_is_claimed (line 39) | bool interp_lane_is_claimed(interp_hw_t *interp, uint lane) {
  function interp_unclaim_lane_mask (line 44) | void interp_unclaim_lane_mask(interp_hw_t *interp, uint lane_mask) {
  function interp_save (line 50) | void interp_save(interp_hw_t *interp, interp_hw_save_t *saver) {
  function interp_restore (line 60) | void interp_restore(interp_hw_t *interp, interp_hw_save_t *saver) {

FILE: pico-sdk/src/rp2_common/hardware_irq/include/hardware/irq.h
  function check_irq_param (line 130) | static inline void check_irq_param(__unused uint num) {
  function irq_clear (line 286) | static inline void irq_clear(uint int_num) {

FILE: pico-sdk/src/rp2_common/hardware_irq/irq.c
  function irq_handler_t (line 30) | static inline irq_handler_t *get_vtable(void) {
  function set_raw_irq_handler_and_unlock (line 42) | static void set_raw_irq_handler_and_unlock(uint num, irq_handler_t handl...
  function irq_set_enabled (line 49) | void irq_set_enabled(uint num, bool enabled) {
  function irq_is_enabled (line 54) | bool irq_is_enabled(uint num) {
  function irq_set_mask_enabled (line 59) | void irq_set_mask_enabled(uint32_t mask, bool enabled) {
  function irq_set_pending (line 70) | void irq_set_pending(uint num) {
  type irq_handler_chain_slot (line 83) | struct irq_handler_chain_slot {
  function is_shared_irq_raw_handler (line 105) | static inline bool is_shared_irq_raw_handler(irq_handler_t raw_handler) {
  function irq_has_shared_handler (line 109) | bool irq_has_shared_handler(uint irq_num) {
  function irq_has_shared_handler (line 117) | bool irq_has_shared_handler(uint irq_num) {
  function irq_handler_t (line 123) | irq_handler_t irq_get_vtable_handler(uint num) {
  function irq_set_exclusive_handler (line 128) | void irq_set_exclusive_handler(uint num, irq_handler_t handler) {
  function irq_handler_t (line 141) | irq_handler_t irq_get_exclusive_handler(uint num) {
  function make_branch (line 159) | static uint16_t make_branch(uint16_t *from, void *to) {
  function insert_branch_and_link (line 167) | static void insert_branch_and_link(uint16_t *from, void *to) {
  function slot_diff (line 184) | static inline int8_t slot_diff(struct irq_handler_chain_slot *to, struct...
  function get_slot_index (line 201) | static inline int8_t get_slot_index(struct irq_handler_chain_slot *slot) {
  function irq_add_shared_handler (line 206) | void irq_add_shared_handler(uint num, irq_handler_t handler, uint8_t ord...
  function irq_remove_handler (line 280) | void irq_remove_handler(uint num, irq_handler_t handler) {
  function irq_set_priority (line 377) | void irq_set_priority(uint num, uint8_t hardware_priority) {
  function uint (line 385) | uint irq_get_priority(uint num) {
  function irq_add_tail_to_free_list (line 396) | void irq_add_tail_to_free_list(struct irq_handler_chain_slot *slot) {
  function irq_init_priorities (line 427) | void irq_init_priorities() {
  function uint (line 438) | static uint get_user_irq_claim_index(uint irq_num) {
  function user_irq_claim (line 445) | void user_irq_claim(uint irq_num) {
  function user_irq_unclaim (line 449) | void user_irq_unclaim(uint irq_num) {
  function user_irq_claim_unused (line 453) | int user_irq_claim_unused(bool required) {
  function user_irq_is_claimed (line 459) | bool user_irq_is_claimed(uint irq_num) {

FILE: pico-sdk/src/rp2_common/hardware_pio/include/hardware/pio.h
  type pio_fifo_join (line 55) | enum pio_fifo_join {
  type pio_mov_status_type (line 64) | enum pio_mov_status_type {
  type pio_hw_t (line 69) | typedef pio_hw_t *PIO;
  type pio_sm_config (line 102) | typedef struct {
  function check_sm_param (line 109) | static inline void check_sm_param(__unused uint sm) {
  function check_sm_mask (line 113) | static inline void check_sm_mask(__unused uint mask) {
  function check_pio_param (line 118) | static inline void check_pio_param(__unused PIO pio) {
  function sm_config_set_out_pins (line 131) | static inline void sm_config_set_out_pins(pio_sm_config *c, uint out_bas...
  function sm_config_set_set_pins (line 148) | static inline void sm_config_set_set_pins(pio_sm_config *c, uint set_bas...
  function sm_config_set_in_pins (line 164) | static inline void sm_config_set_in_pins(pio_sm_config *c, uint in_base) {
  function sm_config_set_sideset_pins (line 178) | static inline void sm_config_set_sideset_pins(pio_sm_config *c, uint sid...
  function sm_config_set_sideset (line 192) | static inline void sm_config_set_sideset(pio_sm_config *c, uint bit_coun...
  function sm_config_set_clkdiv_int_frac (line 216) | static inline void sm_config_set_clkdiv_int_frac(pio_sm_config *c, uint1...
  function pio_calculate_clkdiv_from_float (line 223) | static inline void pio_calculate_clkdiv_from_float(float div, uint16_t *...
  function sm_config_set_clkdiv (line 248) | static inline void sm_config_set_clkdiv(pio_sm_config *c, float div) {
  function sm_config_set_wrap (line 263) | static inline void sm_config_set_wrap(pio_sm_config *c, uint wrap_target...
  function sm_config_set_jmp_pin (line 277) | static inline void sm_config_set_jmp_pin(pio_sm_config *c, uint pin) {
  function sm_config_set_in_shift (line 291) | static inline void sm_config_set_in_shift(pio_sm_config *c, bool shift_r...
  function sm_config_set_out_shift (line 310) | static inline void sm_config_set_out_shift(pio_sm_config *c, bool shift_...
  function sm_config_set_fifo_join (line 327) | static inline void sm_config_set_fifo_join(pio_sm_config *c, enum pio_fi...
  function sm_config_set_out_special (line 341) | static inline void sm_config_set_out_special(pio_sm_config *c, bool stic...
  function sm_config_set_mov_status (line 357) | static inline void sm_config_set_mov_status(pio_sm_config *c, enum pio_m...
  function pio_sm_config (line 385) | static inline pio_sm_config pio_get_default_sm_config(void) {
  function pio_sm_set_config (line 401) | static inline void pio_sm_set_config(PIO pio, uint sm, const pio_sm_conf...
  function uint (line 416) | static inline uint pio_get_index(PIO pio) {
  function pio_gpio_init (line 433) | static inline void pio_gpio_init(PIO pio, uint pin) {
  function uint (line 446) | static inline uint pio_get_dreq(PIO pio, uint sm, bool is_tx) {
  type pio_program_t (line 457) | typedef struct pio_program {
  function pio_sm_set_enabled (line 546) | static inline void pio_sm_set_enabled(PIO pio, uint sm, bool enabled) {
  function pio_set_sm_mask_enabled (line 565) | static inline void pio_set_sm_mask_enabled(PIO pio, uint32_t mask, bool ...
  function pio_sm_restart (line 580) | static inline void pio_sm_restart(PIO pio, uint sm) {
  function pio_restart_sm_mask (line 595) | static inline void pio_restart_sm_mask(PIO pio, uint32_t mask) {
  function pio_sm_clkdiv_restart (line 622) | static inline void pio_sm_clkdiv_restart(PIO pio, uint sm) {
  function pio_clkdiv_restart_sm_mask (line 657) | static inline void pio_clkdiv_restart_sm_mask(PIO pio, uint32_t mask) {
  function pio_enable_sm_mask_in_sync (line 674) | static inline void pio_enable_sm_mask_in_sync(PIO pio, uint32_t mask) {
  type pio_interrupt_source (line 685) | enum pio_interrupt_source {
  function pio_set_irq0_source_enabled (line 707) | static inline void pio_set_irq0_source_enabled(PIO pio, enum pio_interru...
  function pio_set_irq1_source_enabled (line 723) | static inline void pio_set_irq1_source_enabled(PIO pio, enum pio_interru...
  function pio_set_irq0_source_mask_enabled (line 739) | static inline void pio_set_irq0_source_mask_enabled(PIO pio, uint32_t so...
  function pio_set_irq1_source_mask_enabled (line 756) | static inline void pio_set_irq1_source_mask_enabled(PIO pio, uint32_t so...
  function pio_set_irqn_source_enabled (line 774) | static inline void pio_set_irqn_source_enabled(PIO pio, uint irq_index, ...
  function pio_set_irqn_source_mask_enabled (line 791) | static inline void pio_set_irqn_source_mask_enabled(PIO pio, uint irq_in...
  function pio_interrupt_get (line 807) | static inline bool pio_interrupt_get(PIO pio, uint pio_interrupt_num) {
  function pio_interrupt_clear (line 819) | static inline void pio_interrupt_clear(PIO pio, uint pio_interrupt_num) {
  function pio_sm_get_pc (line 832) | static inline uint8_t pio_sm_get_pc(PIO pio, uint sm) {
  function pio_sm_exec (line 850) | inline static void pio_sm_exec(PIO pio, uint sm, uint instr) {
  function pio_sm_is_exec_stalled (line 863) | static inline bool pio_sm_is_exec_stalled(PIO pio, uint sm) {
  function pio_sm_exec_wait_blocking (line 881) | static inline void pio_sm_exec_wait_blocking(PIO pio, uint sm, uint inst...
  function pio_sm_set_wrap (line 897) | static inline void pio_sm_set_wrap(PIO pio, uint sm, uint wrap_target, u...
  function pio_sm_set_out_pins (line 918) | static inline void pio_sm_set_out_pins(PIO pio, uint sm, uint out_base, ...
  function pio_sm_set_set_pins (line 939) | static inline void pio_sm_set_set_pins(PIO pio, uint sm, uint set_base, ...
  function pio_sm_set_in_pins (line 958) | static inline void pio_sm_set_in_pins(PIO pio, uint sm, uint in_base) {
  function pio_sm_set_sideset_pins (line 975) | static inline void pio_sm_set_sideset_pins(PIO pio, uint sm, uint sidese...
  function pio_sm_put (line 997) | static inline void pio_sm_put(PIO pio, uint sm, uint32_t data) {
  function pio_sm_get (line 1018) | static inline uint32_t pio_sm_get(PIO pio, uint sm) {
  function pio_sm_is_rx_fifo_full (line 1031) | static inline bool pio_sm_is_rx_fifo_full(PIO pio, uint sm) {
  function pio_sm_is_rx_fifo_empty (line 1044) | static inline bool pio_sm_is_rx_fifo_empty(PIO pio, uint sm) {
  function uint (line 1057) | static inline uint pio_sm_get_rx_fifo_level(PIO pio, uint sm) {
  function pio_sm_is_tx_fifo_full (line 1072) | static inline bool pio_sm_is_tx_fifo_full(PIO pio, uint sm) {
  function pio_sm_is_tx_fifo_empty (line 1085) | static inline bool pio_sm_is_tx_fifo_empty(PIO pio, uint sm) {
  function uint (line 1098) | static inline uint pio_sm_get_tx_fifo_level(PIO pio, uint sm) {
  function pio_sm_put_blocking (line 1113) | static inline void pio_sm_put_blocking(PIO pio, uint sm, uint32_t data) {
  function pio_sm_get_blocking (line 1126) | static inline uint32_t pio_sm_get_blocking(PIO pio, uint sm) {
  function pio_sm_set_clkdiv_int_frac (line 1156) | static inline void pio_sm_set_clkdiv_int_frac(PIO pio, uint sm, uint16_t...
  function pio_sm_set_clkdiv (line 1172) | static inline void pio_sm_set_clkdiv(PIO pio, uint sm, float div) {
  function pio_sm_clear_fifos (line 1187) | static inline void pio_sm_clear_fifos(PIO pio, uint sm) {

FILE: pico-sdk/src/rp2_common/hardware_pio/include/hardware/pio_instructions.h
  type pio_instr_bits (line 32) | enum pio_instr_bits {
  type pio_src_dest (line 64) | enum pio_src_dest {
  function uint (line 78) | static inline uint _pio_major_instr_bits(uint instr) {
  function uint (line 82) | static inline uint _pio_encode_instr_and_args(enum pio_instr_bits instr_...
  function uint (line 95) | static inline uint _pio_encode_instr_and_src_dest(enum pio_instr_bits in...
  function uint (line 110) | static inline uint pio_encode_delay(uint cycles) {
  function uint (line 128) | static inline uint pio_encode_sideset(uint sideset_bit_count, uint value) {
  function uint (line 146) | static inline uint pio_encode_sideset_opt(uint sideset_bit_count, uint v...
  function uint (line 161) | static inline uint pio_encode_jmp(uint addr) {
  function uint (line 174) | static inline uint pio_encode_jmp_not_x(uint addr) {
  function uint (line 187) | static inline uint pio_encode_jmp_x_dec(uint addr) {
  function uint (line 200) | static inline uint pio_encode_jmp_not_y(uint addr) {
  function uint (line 213) | static inline uint pio_encode_jmp_y_dec(uint addr) {
  function uint (line 226) | static inline uint pio_encode_jmp_x_ne_y(uint addr) {
  function uint (line 239) | static inline uint pio_encode_jmp_pin(uint addr) {
  function uint (line 252) | static inline uint pio_encode_jmp_not_osre(uint addr) {
  function uint (line 256) | static inline uint _pio_encode_irq(bool relative, uint irq) {
  function uint (line 271) | static inline uint pio_encode_wait_gpio(bool polarity, uint gpio) {
  function uint (line 285) | static inline uint pio_encode_wait_pin(bool polarity, uint pin) {
  function uint (line 300) | static inline uint pio_encode_wait_irq(bool polarity, bool relative, uin...
  function uint (line 315) | static inline uint pio_encode_in(enum pio_src_dest src, uint count) {
  function uint (line 330) | static inline uint pio_encode_out(enum pio_src_dest dest, uint count) {
  function uint (line 345) | static inline uint pio_encode_push(bool if_full, bool block) {
  function uint (line 359) | static inline uint pio_encode_pull(bool if_empty, bool block) {
  function uint (line 373) | static inline uint pio_encode_mov(enum pio_src_dest dest, enum pio_src_d...
  function uint (line 389) | static inline uint pio_encode_mov_not(enum pio_src_dest dest, enum pio_s...
  function uint (line 405) | static inline uint pio_encode_mov_reverse(enum pio_src_dest dest, enum p...
  function uint (line 421) | static inline uint pio_encode_irq_set(bool relative, uint irq) {
  function uint (line 435) | static inline uint pio_encode_irq_wait(bool relative, uint irq) {
  function uint (line 449) | static inline uint pio_encode_irq_clear(bool relative, uint irq) {
  function uint (line 463) | static inline uint pio_encode_set(enum pio_src_dest dest, uint value) {
  function uint (line 476) | static inline uint pio_encode_nop(void) {

FILE: pico-sdk/src/rp2_common/hardware_pio/pio.c
  function pio_sm_claim (line 23) | void pio_sm_claim(PIO pio, uint sm) {
  function pio_claim_sm_mask (line 33) | void pio_claim_sm_mask(PIO pio, uint sm_mask) {
  function pio_sm_unclaim (line 39) | void pio_sm_unclaim(PIO pio, uint sm) {
  function pio_claim_unused_sm (line 45) | int pio_claim_unused_sm(PIO pio, bool required) {
  function pio_sm_is_claimed (line 54) | bool pio_sm_is_claimed(PIO pio, uint sm) {
  function _pio_find_offset_for_program (line 63) | static int _pio_find_offset_for_program(PIO pio, const pio_program_t *pr...
  function pio_can_add_program (line 81) | bool pio_can_add_program(PIO pio, const pio_program_t *program) {
  function _pio_can_add_program_at_offset (line 88) | static bool _pio_can_add_program_at_offset(PIO pio, const pio_program_t ...
  function pio_can_add_program_at_offset (line 97) | bool pio_can_add_program_at_offset(PIO pio, const pio_program_t *program...
  function _pio_add_program_at_offset (line 104) | static void _pio_add_program_at_offset(PIO pio, const pio_program_t *pro...
  function uint (line 117) | uint pio_add_program(PIO pio, const pio_program_t *program) {
  function pio_add_program_at_offset (line 128) | void pio_add_program_at_offset(PIO pio, const pio_program_t *program, ui...
  function pio_remove_program (line 134) | void pio_remove_program(PIO pio, const pio_program_t *program, uint load...
  function pio_clear_instruction_memory (line 143) | void pio_clear_instruction_memory(PIO pio) {
  function pio_sm_set_pins (line 156) | void pio_sm_set_pins(PIO pio, uint sm, uint32_t pins) {
  function pio_sm_set_pins_with_mask (line 178) | void pio_sm_set_pins_with_mask(PIO pio, uint sm, uint32_t pinvals, uint3...
  function pio_sm_set_pindirs_with_mask (line 196) | void pio_sm_set_pindirs_with_mask(PIO pio, uint sm, uint32_t pindirs, ui...
  function pio_sm_set_consecutive_pindirs (line 214) | void pio_sm_set_consecutive_pindirs(PIO pio, uint sm, uint pin, uint cou...
  function pio_sm_init (line 234) | void pio_sm_init(PIO pio, uint sm, uint initial_pc, const pio_sm_config ...
  function pio_sm_drain_tx_fifo (line 262) | void pio_sm_drain_tx_fifo(PIO pio, uint sm) {

FILE: pico-sdk/src/rp2_common/hardware_pll/include/hardware/pll.h
  type pll_hw_t (line 29) | typedef pll_hw_t *PLL;

FILE: pico-sdk/src/rp2_common/hardware_pll/pll.c
  function pll_init (line 13) | void pll_init(PLL pll, uint refdiv, uint vco_freq, uint post_div1, uint ...
  function pll_deinit (line 75) | void pll_deinit(PLL pll) {

FILE: pico-sdk/src/rp2_common/hardware_pwm/include/hardware/pwm.h
  type pwm_clkdiv_mode (line 49) | enum pwm_clkdiv_mode
  type pwm_chan (line 57) | enum pwm_chan
  type pwm_config (line 63) | typedef struct {
  function check_slice_num_param (line 69) | static inline void check_slice_num_param(__unused uint slice_num) {
  function uint (line 78) | static inline uint pwm_gpio_to_slice_num(uint gpio) {
  function uint (line 90) | static inline uint pwm_gpio_to_channel(uint gpio) {
  function pwm_config_set_phase_correct (line 104) | static inline void pwm_config_set_phase_correct(pwm_config *c, bool phas...
  function pwm_config_set_clkdiv (line 119) | static inline void pwm_config_set_clkdiv(pwm_config *c, float div) {
  function pwm_config_set_clkdiv_int_frac (line 135) | static inline void pwm_config_set_clkdiv_int_frac(pwm_config *c, uint8_t...
  function pwm_config_set_clkdiv_int (line 151) | static inline void pwm_config_set_clkdiv_int(pwm_config *c, uint div) {
  function pwm_config_set_clkdiv_mode (line 166) | static inline void pwm_config_set_clkdiv_mode(pwm_config *c, enum pwm_cl...
  function pwm_config_set_output_polarity (line 182) | static inline void pwm_config_set_output_polarity(pwm_config *c, bool a,...
  function pwm_config_set_wrap (line 195) | static inline void pwm_config_set_wrap(pwm_config *c, uint16_t wrap) {
  function pwm_init (line 210) | static inline void pwm_init(uint slice_num, pwm_config *c, bool start) {
  function pwm_config (line 229) | static inline pwm_config pwm_get_default_config(void) {
  function pwm_set_wrap (line 254) | static inline void pwm_set_wrap(uint slice_num, uint16_t wrap) {
  function pwm_set_chan_level (line 274) | static inline void pwm_set_chan_level(uint slice_num, uint chan, uint16_...
  function pwm_set_both_levels (line 298) | static inline void pwm_set_both_levels(uint slice_num, uint16_t level_a,...
  function pwm_set_gpio_level (line 321) | static inline void pwm_set_gpio_level(uint gpio, uint16_t level) {
  function pwm_get_counter (line 334) | static inline uint16_t pwm_get_counter(uint slice_num) {
  function pwm_set_counter (line 348) | static inline void pwm_set_counter(uint slice_num, uint16_t c) {
  function pwm_advance_count (line 362) | static inline void pwm_advance_count(uint slice_num) {
  function pwm_retard_count (line 379) | static inline void pwm_retard_count(uint slice_num) {
  function pwm_set_clkdiv_int_frac (line 396) | static inline void pwm_set_clkdiv_int_frac(uint slice_num, uint8_t integ...
  function pwm_set_clkdiv (line 411) | static inline void pwm_set_clkdiv(uint slice_num, float divider) {
  function pwm_set_output_polarity (line 426) | static inline void pwm_set_output_polarity(uint slice_num, bool a, bool ...
  function pwm_set_clkdiv_mode (line 439) | static inline void pwm_set_clkdiv_mode(uint slice_num, enum pwm_clkdiv_m...
  function pwm_set_phase_correct (line 457) | static inline void pwm_set_phase_correct(uint slice_num, bool phase_corr...
  function pwm_set_enabled (line 488) | static inline void pwm_set_enabled(uint slice_num, bool enabled) {
  function pwm_set_mask_enabled (line 498) | static inline void pwm_set_mask_enabled(uint32_t mask) {
  function pwm_set_irq_enabled (line 510) | static inline void pwm_set_irq_enabled(uint slice_num, bool enabled) {
  function pwm_set_irq_mask_enabled (line 527) | static inline void pwm_set_irq_mask_enabled(uint32_t slice_mask, bool en...
  function pwm_clear_irq (line 541) | static inline void pwm_clear_irq(uint slice_num) {
  function pwm_get_irq_status_mask (line 550) | static inline uint32_t pwm_get_irq_status_mask(void) {
  function pwm_force_irq (line 559) | static inline void pwm_force_irq(uint slice_num) {
  function uint (line 568) | static inline uint pwm_get_dreq(uint slice_num) {

FILE: pico-sdk/src/rp2_common/hardware_resets/include/hardware/resets.h
  function reset_block (line 70) | static inline void reset_block(uint32_t bits) {
  function unreset_block (line 79) | static inline void unreset_block(uint32_t bits) {
  function unreset_block_wait (line 88) | static inline void unreset_block_wait(uint32_t bits) {

FILE: pico-sdk/src/rp2_common/hardware_rtc/rtc.c
  function rtc_running (line 18) | bool rtc_running(void) {
  function rtc_init (line 22) | void rtc_init(void) {
  function valid_datetime (line 42) | static bool valid_datetime(datetime_t *t) {
  function rtc_set_datetime (line 55) | bool rtc_set_datetime(datetime_t *t) {
  function rtc_get_datetime (line 88) | bool rtc_get_datetime(datetime_t *t) {
  function rtc_enable_alarm (line 109) | void rtc_enable_alarm(void) {
  function rtc_irq_handler (line 117) | static void rtc_irq_handler(void) {
  function rtc_alarm_repeats (line 134) | static bool rtc_alarm_repeats(datetime_t *t) {
  function rtc_set_alarm (line 147) | void rtc_set_alarm(datetime_t *t, rtc_callback_t user_callback) {
  function rtc_disable_alarm (line 185) | void rtc_disable_alarm(void) {

FILE: pico-sdk/src/rp2_common/hardware_spi/include/hardware/spi.h
  type spi_inst_t (line 47) | typedef struct spi_inst spi_inst_t;
  type spi_cpha_t (line 76) | typedef enum {
  type spi_cpol_t (line 84) | typedef enum {
  type spi_order_t (line 92) | typedef enum {
  function uint (line 151) | static inline uint spi_get_index(const spi_inst_t *spi) {
  function spi_hw_t (line 156) | static inline spi_hw_t *spi_get_hw(spi_inst_t *spi) {
  function spi_hw_t (line 161) | static inline const spi_hw_t *spi_get_const_hw(const spi_inst_t *spi) {
  function spi_set_format (line 177) | static inline void spi_set_format(spi_inst_t *spi, uint data_bits, spi_c...
  function spi_set_slave (line 209) | static inline void spi_set_slave(spi_inst_t *spi, bool slave) {
  function spi_is_writable (line 232) | static inline bool spi_is_writable(const spi_inst_t *spi) {
  function spi_is_readable (line 242) | static inline bool spi_is_readable(const spi_inst_t *spi) {
  function spi_is_busy (line 252) | static inline bool spi_is_busy(const spi_inst_t *spi) {
  function uint (line 361) | static inline uint spi_get_dreq(spi_inst_t *spi, bool is_tx) {

FILE: pico-sdk/src/rp2_common/hardware_spi/spi.c
  function spi_reset (line 11) | static inline void spi_reset(spi_inst_t *spi) {
  function spi_unreset (line 16) | static inline void spi_unreset(spi_inst_t *spi) {
  function uint (line 21) | uint spi_init(spi_inst_t *spi, uint baudrate) {
  function spi_deinit (line 36) | void spi_deinit(spi_inst_t *spi) {
  function uint (line 42) | uint spi_set_baudrate(spi_inst_t *spi, uint baudrate) {
  function uint (line 76) | uint spi_get_baudrate(const spi_inst_t *spi) {

FILE: pico-sdk/src/rp2_common/hardware_sync/include/hardware/sync.h
  type spin_lock_t (line 56) | typedef volatile uint32_t spin_lock_t;
  function __force_inline (line 118) | __force_inline static void __sev(void) {
  function __force_inline (line 130) | __force_inline static void __wfe(void) {
  function __force_inline (line 141) | __force_inline static void __wfi(void) {
  function __force_inline (line 152) | __force_inline static void __dmb(void) {
  function __force_inline (line 163) | __force_inline static void __dsb(void) {
  function __force_inline (line 174) | __force_inline static void __isb(void) {
  function __force_inline (line 181) | __force_inline static void __mem_fence_acquire(void) {
  function __force_inline (line 197) | __force_inline static void __mem_fence_release(void) {
  function __force_inline (line 214) | __force_inline static uint32_t save_and_disable_interrupts(void) {
  function __force_inline (line 228) | __force_inline static void restore_interrupts(uint32_t status) {
  function __force_inline (line 238) | __force_inline static spin_lock_t *spin_lock_instance(uint lock_num) {
  function __force_inline (line 249) | __force_inline static uint spin_lock_get_num(spin_lock_t *lock) {
  function __force_inline (line 261) | __force_inline static void spin_lock_unsafe_blocking(spin_lock_t *lock) {
  function __force_inline (line 274) | __force_inline static void spin_unlock_unsafe(spin_lock_t *lock) {
  function __force_inline (line 287) | __force_inline static uint32_t spin_lock_blocking(spin_lock_t *lock) {
  function is_spin_locked (line 298) | inline static bool is_spin_locked(spin_lock_t *lock) {
  function __force_inline (line 314) | __force_inline static void spin_unlock(spin_lock_t *lock, uint32_t saved...

FILE: pico-sdk/src/rp2_common/hardware_sync/sync.c
  function check_lock_num (line 14) | static void check_lock_num(uint __unused lock_num) {
  function spin_locks_reset (line 18) | void spin_locks_reset(void) {
  function spin_lock_t (line 24) | spin_lock_t *spin_lock_init(uint lock_num) {
  function uint (line 31) | uint next_striped_spin_lock_num() {
  function spin_lock_claim (line 39) | void spin_lock_claim(uint lock_num) {
  function spin_lock_claim_mask (line 44) | void spin_lock_claim_mask(uint32_t mask) {
  function spin_lock_unclaim (line 50) | void spin_lock_unclaim(uint lock_num) {
  function spin_lock_claim_unused (line 56) | int spin_lock_claim_unused(bool required) {
  function spin_lock_is_claimed (line 60) | bool spin_lock_is_claimed(uint lock_num) {

FILE: pico-sdk/src/r
Copy disabled (too large) Download .json
Condensed preview — 563 files, each showing path, character count, and a content snippet. Download the .json file for the full structured content (13,516K chars).
[
  {
    "path": ".github/workflows/build.yml",
    "chars": 893,
    "preview": "name: Build\n\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches: \n      - main\n  workflow_dispatch:\n\njo"
  },
  {
    "path": ".gitignore",
    "chars": 14,
    "preview": "build\n\n.idea/\n"
  },
  {
    "path": "CMakeLists.txt",
    "chars": 4385,
    "preview": "cmake_minimum_required(VERSION 3.6)\n\n## Version Configuration.\n## Define e.g. 0.72 as major 0 and minor 72\nset(VERSION_M"
  },
  {
    "path": "LICENSE",
    "chars": 35149,
    "preview": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free "
  },
  {
    "path": "Pico-PIO-USB/CMakeLists.txt",
    "chars": 608,
    "preview": "set(lib_name pico_pio_usb)\nadd_library(${lib_name} INTERFACE)\n\nset(dir ${CMAKE_CURRENT_LIST_DIR}/src)\n\npico_generate_pio"
  },
  {
    "path": "Pico-PIO-USB/src/pio_usb.c",
    "chars": 15372,
    "preview": "/**\n * Copyright (c) 2021 sekigon-gonnoc\n */\n\n#pragma GCC push_options\n#pragma GCC optimize(\"-O3\")\n\n#include <stdio.h>\n#"
  },
  {
    "path": "Pico-PIO-USB/src/pio_usb.h",
    "chars": 1113,
    "preview": "\n#pragma once\n\n#include \"pio_usb_configuration.h\"\n#include \"usb_definitions.h\"\n\n#ifdef __cplusplus\n extern \"C\" {\n#endif\n"
  },
  {
    "path": "Pico-PIO-USB/src/pio_usb_configuration.h",
    "chars": 1394,
    "preview": "\n#pragma once\n\ntypedef enum {\n  PIO_USB_PINOUT_DPDM = 0,  // DM = DP+1\n  PIO_USB_PINOUT_DMDP,      // DM = DP-1\n} PIO_US"
  },
  {
    "path": "Pico-PIO-USB/src/pio_usb_device.c",
    "chars": 15580,
    "preview": "/**\n * Copyright (c) 2021 sekigon-gonnoc\n *                    Ha Thach (thach@tinyusb.org)\n */\n\n#pragma GCC push_option"
  },
  {
    "path": "Pico-PIO-USB/src/pio_usb_host.c",
    "chars": 45614,
    "preview": "/**\n * Copyright (c) 2021 sekigon-gonnoc\n *                    Ha Thach (thach@tinyusb.org)\n */\n\n#pragma GCC push_option"
  },
  {
    "path": "Pico-PIO-USB/src/pio_usb_ll.h",
    "chars": 6850,
    "preview": "/**\n * Copyright (c) 2021 sekigon-gonnoc\n *                    Ha Thach (thach@tinyusb.org)\n */\n\n#pragma once\n\n#include "
  },
  {
    "path": "Pico-PIO-USB/src/usb_crc.c",
    "chars": 3047,
    "preview": "\n#include \"usb_crc.h\"\n\nconst uint8_t __not_in_flash(\"crc5_tbl\") crc5_tbl[32] = {\n    0x00, 0x0b, 0x16, 0x1d, 0x05, 0x0e,"
  },
  {
    "path": "Pico-PIO-USB/src/usb_crc.h",
    "chars": 415,
    "preview": "#pragma once\n\n#include <stdint.h>\n#include \"pico/stdlib.h\"\n\n// Calc CRC5-USB of 11bit data\nuint8_t calc_usb_crc5(uint16_"
  },
  {
    "path": "Pico-PIO-USB/src/usb_definitions.h",
    "chars": 8654,
    "preview": "\n#pragma once\n\n#include <stdint.h>\n\n#include \"pio_usb_configuration.h\"\n\ntypedef enum {\n  CONTROL_NONE,\n  CONTROL_IN,\n  C"
  },
  {
    "path": "Pico-PIO-USB/src/usb_rx.pio",
    "chars": 6400,
    "preview": "\n; Copyright (c) 2021-2022 sekigon-gonnoc\n\n.define public IRQ_RX_BS_ERR    1   ; bit stuffinc error\n.define public IRQ_R"
  },
  {
    "path": "Pico-PIO-USB/src/usb_rx.pio.h",
    "chars": 9346,
    "preview": "// -------------------------------------------------- //\n// This file is autogenerated by pioasm; do not edit! //\n// ---"
  },
  {
    "path": "Pico-PIO-USB/src/usb_tx.pio",
    "chars": 6243,
    "preview": "; Copyright (c) 2021-2023 sekigon-gonnoc\n\n.define public USB_TX_EOP_OFFSET 4\n.define public USB_TX_EOP_DISABLER_LEN 4\n\n;"
  },
  {
    "path": "Pico-PIO-USB/src/usb_tx.pio.h",
    "chars": 10639,
    "preview": "// -------------------------------------------------- //\n// This file is autogenerated by pioasm; do not edit! //\n// ---"
  },
  {
    "path": "README.md",
    "chars": 24745,
    "preview": "# DeskHop - Fast Desktop Switching\n\nDid you ever notice how, in the crazy world of tech, there's always that one quirky "
  },
  {
    "path": "case/deskhop_case.step",
    "chars": 2952685,
    "preview": "ISO-10303-21;\r\nHEADER;\r\n/* Generated by software containing ST-Developer\r\n * from STEP Tools, Inc. (www.steptools.com) \r"
  },
  {
    "path": "disk/create.sh",
    "chars": 285,
    "preview": "\n#!/bin/bash\n\ndd if=/dev/zero of=fat.img bs=2M count=1\n\nmkdosfs  -F12 -n DESKHOP -i 0 fat.img\n\nsudo mount -o loop,x-moun"
  },
  {
    "path": "disk/disk.S",
    "chars": 149,
    "preview": "\t.section .section_disk,\"a\"\n        .global _disk_start\n\n_disk_start:\n        .incbin __disk_file_path__\n        .global"
  },
  {
    "path": "misc/.clang-format",
    "chars": 637,
    "preview": "BasedOnStyle: LLVM\nBinPackParameters: 'false'\nBinPackArguments: 'false'\nAlignAfterOpenBracket: Align\nAlignConsecutiveMac"
  },
  {
    "path": "misc/.editorconfig",
    "chars": 134,
    "preview": "[*]\nindent_style = space\nindent_size = 4\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_n"
  },
  {
    "path": "misc/.markdownlint.yaml",
    "chars": 68,
    "preview": "# Ignore line length\nMD013: false\n\n# Allow inline HTML\nMD033: false\n"
  },
  {
    "path": "misc/Dockerfile",
    "chars": 195,
    "preview": "FROM alpine:3.21.2\n\nRUN apk add --no-cache gcc-arm-none-eabi g++-arm-none-eabi build-base cmake python3 py3-jinja2\nWORKD"
  },
  {
    "path": "misc/crc32.py",
    "chars": 429,
    "preview": "import sys\nimport struct\nimport binascii\n\nFLASH_SECTOR_SIZE = 4096\nMAGIC_VALUE = 0xf00d\n\nelf_filename = sys.argv[1]\noutp"
  },
  {
    "path": "misc/docker.yml",
    "chars": 117,
    "preview": "services:\n  build_container:\n    image: deskhop-build\n    build:\n      context: .\n    volumes:\n      - ..:/deskhop:z\n"
  },
  {
    "path": "misc/memory_map.ld",
    "chars": 8718,
    "preview": "/* Based on GCC ARM embedded samples.\n   Defines the following symbols for use by code:\n    __exidx_start\n    __exidx_en"
  },
  {
    "path": "pcb/v1.0/DeskHop.kicad_pcb",
    "chars": 641115,
    "preview": "(kicad_pcb (version 20221018) (generator pcbnew)\n\n  (general\n    (thickness 1.6)\n  )\n\n  (paper \"A4\")\n  (layers\n    (0 \"F"
  },
  {
    "path": "pcb/v1.0/DeskHop.kicad_prl",
    "chars": 1181,
    "preview": "{\n  \"board\": {\n    \"active_layer\": 37,\n    \"active_layer_preset\": \"All Layers\",\n    \"auto_track_width\": true,\n    \"hidde"
  },
  {
    "path": "pcb/v1.0/DeskHop.kicad_pro",
    "chars": 11804,
    "preview": "{\n  \"board\": {\n    \"3dviewports\": [],\n    \"design_settings\": {\n      \"defaults\": {\n        \"board_outline_line_width\": 0"
  },
  {
    "path": "pcb/v1.0/DeskHop.kicad_sch",
    "chars": 68791,
    "preview": "(kicad_sch (version 20230121) (generator eeschema)\n\n  (uuid fa1c3e0e-91b1-4532-8b22-6d396d71c75b)\n\n  (paper \"A4\")\n\n  (ti"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-B_Cu.gbr",
    "chars": 87799,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-01-21T01:35:16+01:00*%\n%TF.ProjectId,DeskHop,4465736b-"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-B_Mask.gbr",
    "chars": 1688,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-01-21T01:35:17+01:00*%\n%TF.ProjectId,DeskHop,4465736b-"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-B_Paste.gbr",
    "chars": 450,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-01-21T01:35:17+01:00*%\n%TF.ProjectId,DeskHop,4465736b-"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-B_Silkscreen.gbr",
    "chars": 33926,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-01-21T01:35:17+01:00*%\n%TF.ProjectId,DeskHop,4465736b-"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-Edge_Cuts.gbr",
    "chars": 604,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-01-21T01:35:17+01:00*%\n%TF.ProjectId,DeskHop,4465736b-"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-F_Cu.gbr",
    "chars": 208772,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-01-21T01:35:16+01:00*%\n%TF.ProjectId,DeskHop,4465736b-"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-F_Mask.gbr",
    "chars": 5076,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-01-21T01:35:17+01:00*%\n%TF.ProjectId,DeskHop,4465736b-"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-F_Paste.gbr",
    "chars": 23618,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-01-21T01:35:17+01:00*%\n%TF.ProjectId,DeskHop,4465736b-"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-F_Silkscreen.gbr",
    "chars": 273576,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-01-21T01:35:17+01:00*%\n%TF.ProjectId,DeskHop,4465736b-"
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-NPTH.drl",
    "chars": 541,
    "preview": "M48\n; DRILL file {KiCad 7.0.9} date Sunday, January 21, 2024 at 01:35:19 AM\n; FORMAT={-:-/ absolute / inch / decimal}\n; "
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-PTH.drl",
    "chars": 833,
    "preview": "M48\n; DRILL file {KiCad 7.0.9} date Sunday, January 21, 2024 at 01:35:19 AM\n; FORMAT={-:-/ absolute / inch / decimal}\n; "
  },
  {
    "path": "pcb/v1.0/Gerber/DeskHop-job.gbrjob",
    "chars": 2685,
    "preview": "{\n  \"Header\": {\n    \"GenerationSoftware\": {\n      \"Vendor\": \"KiCad\",\n      \"Application\": \"Pcbnew\",\n      \"Version\": \"7."
  },
  {
    "path": "pcb/v1.1/DeskHop_Rev1.kicad_pcb",
    "chars": 1084440,
    "preview": "(kicad_pcb (version 20221018) (generator pcbnew)\n\n  (general\n    (thickness 1.6)\n  )\n\n  (paper \"A4\")\n  (layers\n    (0 \"F"
  },
  {
    "path": "pcb/v1.1/DeskHop_Rev1.kicad_pro",
    "chars": 12644,
    "preview": "{\n  \"board\": {\n    \"3dviewports\": [],\n    \"design_settings\": {\n      \"defaults\": {\n        \"board_outline_line_width\": 0"
  },
  {
    "path": "pcb/v1.1/DeskHop_Rev1.kicad_sch",
    "chars": 94615,
    "preview": "(kicad_sch (version 20230121) (generator eeschema)\n\n  (uuid fa1c3e0e-91b1-4532-8b22-6d396d71c75b)\n\n  (paper \"A4\")\n\n  (ti"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-B_Cu.gbr",
    "chars": 186564,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-09-14T16:33:58+02:00*%\n%TF.ProjectId,DeskHop_Rev1,4465"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-B_Mask.gbr",
    "chars": 3981,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-09-14T16:33:58+02:00*%\n%TF.ProjectId,DeskHop_Rev1,4465"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-B_Silkscreen.gbr",
    "chars": 102747,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-09-14T16:33:58+02:00*%\n%TF.ProjectId,DeskHop_Rev1,4465"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-Edge_Cuts.gbr",
    "chars": 988,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-09-14T16:33:58+02:00*%\n%TF.ProjectId,DeskHop_Rev1,4465"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-F_Cu.gbr",
    "chars": 302688,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-09-14T16:33:58+02:00*%\n%TF.ProjectId,DeskHop_Rev1,4465"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-F_Mask.gbr",
    "chars": 8974,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-09-14T16:33:58+02:00*%\n%TF.ProjectId,DeskHop_Rev1,4465"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-F_Paste.gbr",
    "chars": 24612,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-09-14T16:33:58+02:00*%\n%TF.ProjectId,DeskHop_Rev1,4465"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-F_Silkscreen.gbr",
    "chars": 283546,
    "preview": "%TF.GenerationSoftware,KiCad,Pcbnew,7.0.9*%\n%TF.CreationDate,2024-09-14T16:33:58+02:00*%\n%TF.ProjectId,DeskHop_Rev1,4465"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-NPTH.drl",
    "chars": 545,
    "preview": "M48\n; DRILL file {KiCad 7.0.9} date Saturday, September 14, 2024 at 04:33:36 PM\n; FORMAT={-:-/ absolute / inch / decimal"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-PTH.drl",
    "chars": 2112,
    "preview": "M48\n; DRILL file {KiCad 7.0.9} date Saturday, September 14, 2024 at 04:33:36 PM\n; FORMAT={-:-/ absolute / inch / decimal"
  },
  {
    "path": "pcb/v1.1/Gerber/DeskHop_Rev1-job.gbrjob",
    "chars": 2604,
    "preview": "{\n  \"Header\": {\n    \"GenerationSoftware\": {\n      \"Vendor\": \"KiCad\",\n      \"Application\": \"Pcbnew\",\n      \"Version\": \"7."
  },
  {
    "path": "pico-sdk/CMakeLists.txt",
    "chars": 2194,
    "preview": "cmake_minimum_required(VERSION 3.13)\n\n# Note: this CMakeLists.txt can be used as a top-level CMakeLists.txt for the SDK "
  },
  {
    "path": "pico-sdk/cmake/Platform/PICO.cmake",
    "chars": 162,
    "preview": "# this is included because toolchain file sets SYSTEM_NAME=PICO\n\nset_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIB"
  },
  {
    "path": "pico-sdk/cmake/pico_pre_load_platform.cmake",
    "chars": 1379,
    "preview": "# PICO_CMAKE_CONFIG: PICO_PLATFORM, platform to build for e.g. rp2040/host, default=rp2040 or environment value, group=b"
  },
  {
    "path": "pico-sdk/cmake/pico_pre_load_toolchain.cmake",
    "chars": 2128,
    "preview": "# PICO_CMAKE_CONFIG: PICO_TOOLCHAIN_PATH, Path to search for compiler, default=none (i.e. search system paths), group=bu"
  },
  {
    "path": "pico-sdk/cmake/pico_utils.cmake",
    "chars": 702,
    "preview": "function(pico_message param)\n    if (${ARGC} EQUAL 1)\n        message(\"${param}\")\n        return()\n    endif ()\n\n    if "
  },
  {
    "path": "pico-sdk/cmake/preload/platforms/host.cmake",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "pico-sdk/cmake/preload/platforms/pico/pico.cmake",
    "chars": 206,
    "preview": "if (NOT (DEFINED PICO_COMPILER OR DEFINED CMAKE_TOOLCHAIN_FILE))\n    pico_message(\"Defaulting PICO platform compiler to "
  },
  {
    "path": "pico-sdk/cmake/preload/platforms/rp2040.cmake",
    "chars": 50,
    "preview": "include(${CMAKE_CURRENT_LIST_DIR}/pico/pico.cmake)"
  },
  {
    "path": "pico-sdk/cmake/preload/toolchains/find_compiler.cmake",
    "chars": 1467,
    "preview": "# Toolchain file is processed multiple times, however, it cannot access CMake cache on some runs.\n# We store the search "
  },
  {
    "path": "pico-sdk/cmake/preload/toolchains/pico_arm_clang.cmake",
    "chars": 2349,
    "preview": "# NOTE: THIS IS A WIP ONLY PICO_ARM_GCC IS CURRENTLY SUPPORTED, however should work with LLVM Embedded Toolchain for ARM"
  },
  {
    "path": "pico-sdk/cmake/preload/toolchains/pico_arm_clang_arm.cmake",
    "chars": 1922,
    "preview": "# NOTE: THIS IS A WIP ONLY PICO_ARM_GCC IS CURRENTLY SUPPORTED\n# todo there is probably a more \"cmake\" way of doing this"
  },
  {
    "path": "pico-sdk/cmake/preload/toolchains/pico_arm_gcc.cmake",
    "chars": 2269,
    "preview": "# todo there is probably a more \"cmake\" way of doing this going thru the standard path with our \"PICO\" platform\n#  i.e. "
  },
  {
    "path": "pico-sdk/cmake/preload/toolchains/set_flags.cmake",
    "chars": 755,
    "preview": "\nget_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)\nforeach(LANG IN ITEMS C CXX ASM)\n    set(CMAKE_${LANG}_F"
  },
  {
    "path": "pico-sdk/lib/tinyusb/LICENSE",
    "chars": 1089,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2018, hathach (tinyusb.org)\n\nPermission is hereby granted, free of charge, to any p"
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/ansi_escape.h",
    "chars": 3783,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/board.c",
    "chars": 3808,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2018, hathach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/board_api.h",
    "chars": 5861,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/board_mcu.h",
    "chars": 5149,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2020, Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of"
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/family_support.cmake",
    "chars": 16421,
    "preview": "include_guard(GLOBAL)\n\ninclude(CMakePrintHelpers)\n\n# TOP is path to root directory\nset(TOP \"${CMAKE_CURRENT_LIST_DIR}/.."
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/rp2040/board.h",
    "chars": 3085,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2021, Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of"
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/rp2040/boards/pico_sdk/board.cmake",
    "chars": 83,
    "preview": "# This builds with settings based purely on the current PICO_BOARD set via the SDK\n"
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/rp2040/boards/raspberry_pi_pico/board.cmake",
    "chars": 21,
    "preview": "set(PICO_BOARD pico)\n"
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/rp2040/family.c",
    "chars": 9666,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n * Copyright (c) 2021, Ha Thach (tinyus"
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/rp2040/family.cmake",
    "chars": 12038,
    "preview": "cmake_minimum_required(VERSION 3.13)\ninclude_guard(GLOBAL)\n\nif (NOT BOARD)\n\tmessage(\"BOARD not specified, defaulting to "
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/rp2040/family.mk",
    "chars": 398,
    "preview": "JLINK_DEVICE = rp2040_m0_0\nPYOCD_TARGET = rp2040\n\nDEPS_SUBMODULES += hw/mcu/raspberry_pi/Pico-PIO-USB\n\nifeq ($(DEBUG), 1"
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/rp2040/pico_sdk_import.cmake",
    "chars": 2763,
    "preview": "# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake\n\n# This can be dropped into an external project to he"
  },
  {
    "path": "pico-sdk/lib/tinyusb/hw/bsp/rp2040/rp2040-openocd.cfg",
    "chars": 89,
    "preview": "source [find interface/cmsis-dap.cfg]\nadapter speed 5000\nsource [find target/rp2040.cfg]\n"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/CMakeLists.txt",
    "chars": 3559,
    "preview": "# TODO more docs and example on how to use this file\n# Usage: requires target tinyusb_config which expose tusb_config.h "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/cdc/cdc.h",
    "chars": 24419,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/cdc/cdc_device.c",
    "chars": 15839,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/cdc/cdc_device.h",
    "chars": 8832,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/cdc/serial/cp210x.h",
    "chars": 2569,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2023 Ha Thach (thach@tinyusb.org) for Adafruit Industries\n *\n * Permissi"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/cdc/serial/ftdi_sio.h",
    "chars": 7480,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2023 Ha Thach (thach@tinyusb.org) for Adafruit Industries\n *\n * Permissi"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/hid/hid.h",
    "chars": 54687,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/hid/hid_device.c",
    "chars": 13724,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/hid/hid_device.h",
    "chars": 37420,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/hid/hid_host.c",
    "chars": 24393,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/hid/hid_host.h",
    "chars": 8257,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/msc/msc.h",
    "chars": 18109,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/msc/msc_device.c",
    "chars": 31654,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/class/msc/msc_device.h",
    "chars": 7939,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/common/tusb_common.h",
    "chars": 12664,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/common/tusb_compiler.h",
    "chars": 12447,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/common/tusb_debug.h",
    "chars": 5133,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2022, Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/common/tusb_fifo.c",
    "chars": 34737,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n * Copyright (c) 2020 Reinhard Panhuber - re"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/common/tusb_fifo.h",
    "chars": 7869,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n * Copyright (c) 2020 Reinhard Panhuber - re"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/common/tusb_mcu.h",
    "chars": 15996,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2021, Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/common/tusb_private.h",
    "chars": 5934,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2022, Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/common/tusb_types.h",
    "chars": 20957,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/common/tusb_verify.h",
    "chars": 5750,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/device/dcd.h",
    "chars": 9193,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/device/usbd.c",
    "chars": 49412,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/device/usbd.h",
    "chars": 50523,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/device/usbd_control.c",
    "chars": 7562,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/device/usbd_pvt.h",
    "chars": 5319,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/host/hcd.h",
    "chars": 7886,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/host/hub.c",
    "chars": 15933,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/host/hub.h",
    "chars": 7861,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/host/usbh.c",
    "chars": 59678,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/host/usbh.h",
    "chars": 13103,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/host/usbh_pvt.h",
    "chars": 4249,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2021, Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/osal/osal.h",
    "chars": 3655,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/osal/osal_none.h",
    "chars": 5930,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/osal/osal_pico.h",
    "chars": 5533,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * Permission is hereby granted, fre"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c",
    "chars": 6048,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2018, hathach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c",
    "chars": 6934,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2021 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/dcd_rp2040.c",
    "chars": 18372,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * Permission is hereby granted, fre"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/hcd_rp2040.c",
    "chars": 19397,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n * Copyright (c) 2021 Ha Thach (tinyusb"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.c",
    "chars": 13567,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n * Copyright (c) 2021 Ha Thach (tinyusb"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040/rp2040_usb.h",
    "chars": 4092,
    "preview": "#ifndef RP2040_COMMON_H_\n#define RP2040_COMMON_H_\n\n#if defined(RP2040_USB_HOST_MODE) && defined(RP2040_USB_DEVICE_MODE)\n"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/tinyusb.mk",
    "chars": 458,
    "preview": "# C source files\nTINYUSB_SRC_C += \\\n\tsrc/tusb.c \\\n\tsrc/common/tusb_fifo.c \\\n\tsrc/device/usbd.c \\\n\tsrc/device/usbd_contro"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/tusb.c",
    "chars": 13633,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/tusb.h",
    "chars": 3533,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/tusb_option.h",
    "chars": 18955,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2019 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/typec/pd_types.h",
    "chars": 9931,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2023 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/typec/tcd.h",
    "chars": 4045,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2023 Ha Thach (thach@tinyusb.org) for Adafruit Industries\n *\n * Permissi"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/typec/usbc.c",
    "chars": 6457,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2023 Ha Thach (thach@tinyusb.org)\n *\n * Permission is hereby granted, fr"
  },
  {
    "path": "pico-sdk/lib/tinyusb/src/typec/usbc.h",
    "chars": 3082,
    "preview": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2023 Ha Thach (tinyusb.org)\n *\n * Permission is hereby granted, free of "
  },
  {
    "path": "pico-sdk/pico_sdk_import.cmake",
    "chars": 2763,
    "preview": "# This is a copy of <PICO_SDK_PATH>/external/pico_sdk_import.cmake\n\n# This can be dropped into an external project to he"
  },
  {
    "path": "pico-sdk/pico_sdk_init.cmake",
    "chars": 3323,
    "preview": "# Pre-initialize the Raspberry Pi Pico SDK, setting up the platform and toolchain and some CMake utility functions\n# Thi"
  },
  {
    "path": "pico-sdk/pico_sdk_version.cmake",
    "chars": 1407,
    "preview": "# PICO_BUILD_DEFINE: PICO_SDK_VERSION_MAJOR, SDK major version number, type=int, group=pico_base\n# PICO_CMAKE_CONFIG: PI"
  },
  {
    "path": "pico-sdk/src/CMakeLists.txt",
    "chars": 8001,
    "preview": "cmake_policy(SET CMP0079 NEW) # allow inserting of dependencies into our INTERFACE libraries\nset(PICO_PLATFORM_CMAKE_FIL"
  },
  {
    "path": "pico-sdk/src/board_setup.cmake",
    "chars": 1468,
    "preview": "# PICO_CMAKE_CONFIG: PICO_BOARD, The board name being built for. This is overridable from the user environment, type=str"
  },
  {
    "path": "pico-sdk/src/boards/generic_board.cmake",
    "chars": 1381,
    "preview": "# For boards without their own cmake file, simply include a header\n\n# PICO_CMAKE_CONFIG: PICO_BOARD_HEADER_DIRS, Directo"
  },
  {
    "path": "pico-sdk/src/boards/include/boards/none.h",
    "chars": 380,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// ---------------"
  },
  {
    "path": "pico-sdk/src/boards/include/boards/pico.h",
    "chars": 2183,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// ---------------"
  },
  {
    "path": "pico-sdk/src/boards/include/boards/pico_w.h",
    "chars": 3044,
    "preview": "/*\n * Copyright (c) 2022 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// ---------------"
  },
  {
    "path": "pico-sdk/src/boards/pico_w.cmake",
    "chars": 138,
    "preview": "set(PICO_CYW43_SUPPORTED \"1\")\npico_register_common_scope_var(PICO_CYW43_SUPPORTED)\ninclude(${CMAKE_CURRENT_LIST_DIR}/gen"
  },
  {
    "path": "pico-sdk/src/common/CMakeLists.txt",
    "chars": 669,
    "preview": "pico_add_subdirectory(boot_picoboot)\npico_add_subdirectory(boot_uf2)\npico_add_subdirectory(pico_base)\npico_add_subdirect"
  },
  {
    "path": "pico-sdk/src/common/README.md",
    "chars": 245,
    "preview": "This directory code that is common to all builds regardless of `PICO_PLATFORM`. It is a mix\nof common header files, or h"
  },
  {
    "path": "pico-sdk/src/common/boot_picoboot/CMakeLists.txt",
    "chars": 139,
    "preview": "add_library(boot_picoboot_headers INTERFACE)\ntarget_include_directories(boot_picoboot_headers INTERFACE ${CMAKE_CURRENT_"
  },
  {
    "path": "pico-sdk/src/common/boot_picoboot/include/boot/picoboot.h",
    "chars": 3325,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _BOOT_PICO"
  },
  {
    "path": "pico-sdk/src/common/boot_uf2/CMakeLists.txt",
    "chars": 129,
    "preview": "add_library(boot_uf2_headers INTERFACE)\ntarget_include_directories(boot_uf2_headers INTERFACE ${CMAKE_CURRENT_LIST_DIR}/"
  },
  {
    "path": "pico-sdk/src/common/boot_uf2/include/boot/uf2.h",
    "chars": 1046,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _BOOT_UF2_"
  },
  {
    "path": "pico-sdk/src/common/pico_base/CMakeLists.txt",
    "chars": 617,
    "preview": "if (NOT TARGET pico_base_headers)\n    pico_add_library(pico_base NOFLAG)\n    target_include_directories(pico_base_header"
  },
  {
    "path": "pico-sdk/src/common/pico_base/generate_config_header.cmake",
    "chars": 1480,
    "preview": "# build the auto gen config headers\n\nset(header_content \"// AUTOGENERATED FROM PICO_CONFIG_HEADER_FILES and then PICO_<P"
  },
  {
    "path": "pico-sdk/src/common/pico_base/include/pico/assert.h",
    "chars": 1280,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_ASSE"
  },
  {
    "path": "pico-sdk/src/common/pico_base/include/pico/config.h",
    "chars": 872,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_CONF"
  },
  {
    "path": "pico-sdk/src/common/pico_base/include/pico/error.h",
    "chars": 663,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_ERRO"
  },
  {
    "path": "pico-sdk/src/common/pico_base/include/pico/types.h",
    "chars": 2905,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_TYPE"
  },
  {
    "path": "pico-sdk/src/common/pico_base/include/pico/version.h.in",
    "chars": 535,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n// ---------------"
  },
  {
    "path": "pico-sdk/src/common/pico_base/include/pico.h",
    "chars": 1040,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_H\n#d"
  },
  {
    "path": "pico-sdk/src/common/pico_binary_info/CMakeLists.txt",
    "chars": 1702,
    "preview": "add_library(pico_binary_info_headers INTERFACE)\n\ntarget_include_directories(pico_binary_info_headers INTERFACE ${CMAKE_C"
  },
  {
    "path": "pico-sdk/src/common/pico_binary_info/include/pico/binary_info/code.h",
    "chars": 8124,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_BINA"
  },
  {
    "path": "pico-sdk/src/common/pico_binary_info/include/pico/binary_info/defs.h",
    "chars": 1555,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_BINA"
  },
  {
    "path": "pico-sdk/src/common/pico_binary_info/include/pico/binary_info/structure.h",
    "chars": 5036,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_BINA"
  },
  {
    "path": "pico-sdk/src/common/pico_binary_info/include/pico/binary_info.h",
    "chars": 716,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_BINA"
  },
  {
    "path": "pico-sdk/src/common/pico_bit_ops/CMakeLists.txt",
    "chars": 265,
    "preview": "if (NOT TARGET pico_bit_ops_headers)\n    add_library(pico_bit_ops_headers INTERFACE)\n    target_include_directories(pico"
  },
  {
    "path": "pico-sdk/src/common/pico_bit_ops/include/pico/bit_ops.h",
    "chars": 845,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_BIT_"
  },
  {
    "path": "pico-sdk/src/common/pico_divider/CMakeLists.txt",
    "chars": 265,
    "preview": "if (NOT TARGET pico_divider_headers)\n    add_library(pico_divider_headers INTERFACE)\n    target_include_directories(pico"
  },
  {
    "path": "pico-sdk/src/common/pico_divider/include/pico/divider.h",
    "chars": 8073,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_DIVI"
  },
  {
    "path": "pico-sdk/src/common/pico_stdlib/CMakeLists.txt",
    "chars": 220,
    "preview": "if (NOT TARGET pico_stdlib_headers)\n    add_library(pico_stdlib_headers INTERFACE)\n    target_include_directories(pico_s"
  },
  {
    "path": "pico-sdk/src/common/pico_stdlib/include/pico/stdlib.h",
    "chars": 4750,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_STDL"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/CMakeLists.txt",
    "chars": 1532,
    "preview": "if (NOT TARGET pico_sync_headers)\n    add_library(pico_sync_headers INTERFACE)\n    target_link_libraries(pico_sync_heade"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/critical_section.c",
    "chars": 700,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#include \"pico/cri"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/include/pico/critical_section.h",
    "chars": 3470,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_CRIT"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/include/pico/lock_core.h",
    "chars": 9969,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_LOCK"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/include/pico/mutex.h",
    "chars": 11905,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_MUTE"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/include/pico/sem.h",
    "chars": 4789,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_SEM_"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/include/pico/sync.h",
    "chars": 346,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_SYNC"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/lock_core.c",
    "chars": 296,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#include \"pico/loc"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/mutex.c",
    "chars": 6845,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#include \"pico/mut"
  },
  {
    "path": "pico-sdk/src/common/pico_sync/sem.c",
    "chars": 3053,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#include \"pico/sem"
  },
  {
    "path": "pico-sdk/src/common/pico_time/CMakeLists.txt",
    "chars": 590,
    "preview": "if (NOT TARGET pico_time_headers)\n    add_library(pico_time_headers INTERFACE)\n    target_include_directories(pico_time_"
  },
  {
    "path": "pico-sdk/src/common/pico_time/include/pico/time.h",
    "chars": 37021,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_TIME"
  },
  {
    "path": "pico-sdk/src/common/pico_time/include/pico/timeout_helper.h",
    "chars": 619,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_TIME"
  },
  {
    "path": "pico-sdk/src/common/pico_time/time.c",
    "chars": 17699,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#include <limits.h"
  },
  {
    "path": "pico-sdk/src/common/pico_time/timeout_helper.c",
    "chars": 876,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#include \"pico/tim"
  },
  {
    "path": "pico-sdk/src/common/pico_usb_reset_interface/CMakeLists.txt",
    "chars": 368,
    "preview": "# don't use pico_add_library here as picotool includes it directly\nadd_library(pico_usb_reset_interface_headers INTERFAC"
  },
  {
    "path": "pico-sdk/src/common/pico_usb_reset_interface/include/pico/usb_reset_interface.h",
    "chars": 670,
    "preview": "/*\n * Copyright (c) 2021 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_USB_"
  },
  {
    "path": "pico-sdk/src/common/pico_util/CMakeLists.txt",
    "chars": 605,
    "preview": "if (NOT TARGET pico_util_headers)\n    add_library(pico_util_headers INTERFACE)\n    target_include_directories(pico_util_"
  },
  {
    "path": "pico-sdk/src/common/pico_util/datetime.c",
    "chars": 838,
    "preview": "#include \"pico/util/datetime.h\"\n\n#include <stdio.h>\n\nstatic const char *DATETIME_MONTHS[12] = {\n        \"January\",\n     "
  },
  {
    "path": "pico-sdk/src/common/pico_util/doc.h",
    "chars": 96,
    "preview": "/**\n * \\defgroup pico_util pico_util\n * \\brief Useful data structures and utility functions\n */\n"
  },
  {
    "path": "pico-sdk/src/common/pico_util/include/pico/util/datetime.h",
    "chars": 683,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_UTIL"
  },
  {
    "path": "pico-sdk/src/common/pico_util/include/pico/util/pheap.h",
    "chars": 9595,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_UTIL"
  },
  {
    "path": "pico-sdk/src/common/pico_util/include/pico/util/queue.h",
    "chars": 6965,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#ifndef _PICO_UTIL"
  },
  {
    "path": "pico-sdk/src/common/pico_util/pheap.c",
    "chars": 5018,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#include <stdio.h>"
  },
  {
    "path": "pico-sdk/src/common/pico_util/queue.c",
    "chars": 3463,
    "preview": "/*\n * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.\n *\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n#include <stdlib.h"
  },
  {
    "path": "pico-sdk/src/rp2040/CMakeLists.txt",
    "chars": 270,
    "preview": "# Targets specific to B0 silicon\npico_add_subdirectory(hardware_regs)\npico_add_subdirectory(hardware_structs)\n\npico_add_"
  },
  {
    "path": "pico-sdk/src/rp2040/README.md",
    "chars": 349,
    "preview": "This directory contains header files defining the RP2040 hardware. It is selected when\n`PICO_PLATFORM=rp2040` (the defau"
  },
  {
    "path": "pico-sdk/src/rp2040/hardware_regs/CMakeLists.txt",
    "chars": 225,
    "preview": "add_library(hardware_regs INTERFACE)\nadd_library(hardware_regs_headers INTERFACE)\ntarget_include_directories(hardware_re"
  }
]

// ... and 363 more files (download for full content)

About this extraction

This page contains the full source code of the hrvach/deskhop GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 563 files (12.4 MB), approximately 3.3M tokens, and a symbol index with 3104 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!