Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
8a30e33
Initial MacOS port. Needs manual codesign and dma doesn't work yet.
NateMeyer Jan 11, 2025
0914962
Update to fix DMA. Needs to be cleaned up.
NateMeyer Jan 18, 2025
88d9f0f
Cleanup DMA file handles
NateMeyer Jan 19, 2025
8c05bc3
Cleanup DMA ioctl
NateMeyer Jan 19, 2025
b079d05
Fix link issues in build
NateMeyer Mar 31, 2025
01811e0
Add reading samples from an ioctl on MacOS instead of polling. WIP.
NateMeyer Apr 4, 2025
6467e5b
Improve compatibility between beta and dev/prod designs
NateMeyer Apr 28, 2025
0cac81f
Fix pybinding bool arg
NateMeyer May 3, 2025
466a8d5
Add io test for dev peripherals and misc cleanup.
NateMeyer May 4, 2025
5168b20
Add example control util for manually setting channel config.
NateMeyer May 14, 2025
4e7d1ef
Update python module to add numpy dependency and remove 'py' prefix
NateMeyer May 18, 2025
d381a41
Make tsControl example executable
NateMeyer May 18, 2025
11af87b
Add API to query firmware update progress
NateMeyer May 20, 2025
e77e98e
Fix issues found in dev testing for TB/PCIe label and SPI Flash ID
NateMeyer May 21, 2025
a0d198b
Fix atomic support in msvc. Make the ADC test mode a top-level api fo…
NateMeyer May 22, 2025
3c7e897
Add debug print for bitslip count
NateMeyer May 22, 2025
c73ac3a
Disable data ramp in capture test
NateMeyer May 22, 2025
e7343fe
Change calibration and offset voltages to microvolts. Update AFE to …
NateMeyer May 27, 2025
a354e66
Initial support for ADC branch calibration
NateMeyer May 29, 2025
ab48da3
Initial cal test app
NateMeyer May 29, 2025
3ed1a3e
Add branch fine gain calibration calculation
NateMeyer May 30, 2025
eecd143
Fix build errors on linux
NateMeyer Jun 3, 2025
9072b99
Fix malloc error and cleanup cal functions
NateMeyer Jun 4, 2025
03f6522
Fix preamp gain manual control. Set jitter ctrl for performance in H…
NateMeyer Jun 7, 2025
621dd31
Adjust fine gain process and add std dev printout.
NateMeyer Jun 7, 2025
2e95820
Remove REQUIRED on python package
NateMeyer Jun 8, 2025
a971d5d
Merge remote-tracking branch 'origin/dev_updates' into macos_support
NateMeyer Jun 21, 2025
0f123e6
Default to polling mode for now
NateMeyer Jun 22, 2025
dd37aba
Add initial CI/CD script (#23)
NateMeyer Jun 29, 2025
150f4f7
Add targets and actions to build python wheels
NateMeyer Jul 1, 2025
4524b1a
Fix setup of python env in ci/cd
NateMeyer Jul 1, 2025
220fbd3
Build release config of wheels
NateMeyer Jul 1, 2025
298901d
Give wheel artifacts unique name
NateMeyer Jul 1, 2025
92f794e
Add versioning scheme to library
NateMeyer Jul 3, 2025
96c617c
Some cleanup of macos sample reads
NateMeyer Jul 20, 2025
59ef801
Merge remote-tracking branch 'origin/dev_updates' into macos_support
NateMeyer Jul 20, 2025
d37b2fc
Add macos to CI actions. Cleanup misc build warnings.
NateMeyer Jul 20, 2025
5830038
Update actions. Fix open name.
NateMeyer Jul 25, 2025
8b69d5b
Fix sample rate not updating on mode changes
NateMeyer Jul 30, 2025
be6e77f
Cleanup linux macro
NateMeyer Aug 1, 2025
b6e6638
Merge pull request #25 from EEVengers/macos_support
NateMeyer Aug 15, 2025
a9ce3ff
Fix clearing bits in gpio group set.
NateMeyer Aug 15, 2025
8c8c9a1
Update cmake version and python handling
NateMeyer Aug 19, 2025
b1539b1
Fix fw update mem leak. Add bitstream update status log
NateMeyer Aug 30, 2025
9adfb63
Allow attenuator and 50-Ohm termination at the same time for Rev5 uni…
NateMeyer Aug 30, 2025
ca32580
Update 12-bit mode handling. Add 12bit shuffler modes. Allow 4096 re…
NateMeyer Aug 30, 2025
04e6ac8
Fix sample rate handling for 8-bit and 12-bit modes. Add LVDS termina…
NateMeyer Sep 12, 2025
9917602
Fix Manual AFE control function to take a struct handle. Swap tsChan…
NateMeyer Sep 20, 2025
13b8bc6
Add API to read/write the User data section of flash
NateMeyer Sep 24, 2025
e348f11
Added arbitrary location/length spiflash reads. Added User read/writ…
NateMeyer Sep 25, 2025
baa4381
ADC 12-bit configuration updates
NateMeyer Sep 30, 2025
766a8fd
Merge branch 'dev_updates' into 12b_mode
NateMeyer Sep 30, 2025
e72cd56
Remove debug register from CSR header
NateMeyer Oct 2, 2025
43dde9e
Catch error on invalid file in fw app
NateMeyer Oct 3, 2025
687dbb4
Revert LVDS phase change. Add some groundwork for precision mode.
NateMeyer Oct 4, 2025
c47ece7
Merge pull request #27 from EEVengers/12b_mode
NateMeyer Oct 11, 2025
bad51b7
Upgrade SPIflash to handle new litespi register map. Add GW_ID field…
NateMeyer Oct 7, 2025
6994bb4
Set Coupling polarity by HW rev
NateMeyer Oct 17, 2025
682d8d8
Fixes for spiflash registers and divisor. Add gateware and LiteX ver…
NateMeyer Oct 19, 2025
ecf3871
Populate info fields when opening TS.
NateMeyer Oct 20, 2025
9582d3d
Merge pull request #28 from EEVengers/litex_upgrade
NateMeyer Oct 20, 2025
d781eae
Changed /std:c++17 to /std:c17
AleksaBjelogrlic Oct 27, 2025
2fcf828
Fix sleep in MacOS sample read function.
NateMeyer Nov 1, 2025
62f728a
Reorder when the ADC Frame state machine is reset on channel updates.
NateMeyer Nov 1, 2025
7bca49b
Merge pull request #29 from EEVengers/msvc_cmake_fix
NateMeyer Nov 1, 2025
49dd33c
factory data updates
NateMeyer Oct 29, 2025
71d973e
Add parsing of HWID from factory data partition.
NateMeyer Nov 6, 2025
8d13efa
Add hwid schema
NateMeyer Nov 6, 2025
e27a58b
Update DMA ioctl api
NateMeyer Nov 7, 2025
0c53180
Add sample interrupt control
NateMeyer Nov 8, 2025
c1c9277
Fix build issues and warnings on macOS
NateMeyer Nov 8, 2025
793fe2e
Update python library with new interrupt rate method
NateMeyer Nov 9, 2025
fe9f550
Merge pull request #30 from EEVengers/dma_intr_count
NateMeyer Nov 10, 2025
fdf8e00
Allow multiple TS devices on macOS
NateMeyer Nov 15, 2025
1af5126
Add api to set Ref Clock IN/OUT
NateMeyer Nov 28, 2025
655f629
Fix clock dividers and add Ref Clk settings for test app
NateMeyer Nov 29, 2025
6fa70af
Divide output clock from the correct source frequency
NateMeyer Nov 29, 2025
5cb7842
Fix typo in test app
NateMeyer Nov 29, 2025
9980b7e
Add alternate input clock configuration and PLL clock status flags
NateMeyer Nov 29, 2025
e9bdea9
Use right status bits for clock inputs
NateMeyer Nov 29, 2025
7a8e591
Fix multiple clocks. Add clock test function.
NateMeyer Nov 30, 2025
c173b2c
Update linking for py binding library
NateMeyer Nov 30, 2025
6d06605
Merge pull request #32 from EEVengers/clock_control
NateMeyer Dec 14, 2025
6b65179
Change ADC Resolution configuration to an enum.
NateMeyer Nov 11, 2025
98c3edf
Merge pull request #33 from EEVengers/adc_modes
NateMeyer Dec 15, 2025
912c9ef
Draft of initial Event/Sync API. Include simulated event generator f…
NateMeyer Dec 16, 2025
8df8aee
Add Events module
NateMeyer Dec 26, 2025
2abd2a7
Fix reading event queue
NateMeyer Dec 30, 2025
43bdff8
Fix close function
NateMeyer Dec 31, 2025
f15a307
Add sync control to capture test
NateMeyer Dec 31, 2025
d449612
Separate 8 and 16-bit wav processing in capture test
NateMeyer Dec 31, 2025
c3b02cb
Update python bindings with Event API.
NateMeyer Dec 31, 2025
c7da5b8
Merge pull request #34 from EEVengers/events_api
NateMeyer Jan 1, 2026
8a1b32d
Byte-swap factory data Tags. Fix spiflash readback for unaligned data…
NateMeyer Jan 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 90 additions & 0 deletions .github/workflows/build-cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: Build with CMake

on:
push:
branches: [ "main", "dev*" ]
pull_request:
branches: [ "main", "dev*" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
# 4. <MacOS, Release, latest Clang compiler toolchain on the default runner image, default generator>
##
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Release]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
- os: macos-latest
c_compiler: cl
- os: macos-latest
c_compiler: gcc

steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0

- name: Set Vars
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
echo "artifact-name=libtslitex-${{ matrix.os }}-${{ matrix.c_compiler }}-artifacts" >> "$GITHUB_OUTPUT"

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --clean-first --config ${{ matrix.build_type }}

# - name: Test
# working-directory: ${{ steps.strings.outputs.build-output-dir }}
# # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest --build-config ${{ matrix.build_type }}

- uses: actions/upload-artifact@v4
with:
name: ${{ steps.strings.outputs.artifact-name }}
path: ${{ steps.strings.outputs.build-output-dir }}/artifacts
71 changes: 71 additions & 0 deletions .github/workflows/build-python-bindings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This starter workflow is for a CMake project running on multiple platforms. There is a different starter workflow if you just want a single platform.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-single-platform.yml
name: Build Python Bindings with CMake

on:
push:
branches: [ "main", "dev*" ]
pull_request:
branches: [ "main", "dev*" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

# Set up a matrix to run the following configurations:
# 1. <Windows, Release, latest MSVC compiler toolchain on the default runner image, default generator>
# 2. <Linux, Release, latest GCC compiler toolchain on the default runner image, default generator>
# 3. <Linux, Release, latest Clang compiler toolchain on the default runner image, default generator>
# 4. <MacOS, Release, latest Clang compiler toolchain on the default runner image, default generator>
##
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Release] # Note, debug builds are not generated as they require the debug version of Python to be installed.
platform: [auto]
arch: [auto64]


steps:
- uses: actions/checkout@v4
with:
fetch-tags: true
fetch-depth: 0

- name: Setup Python Environment
uses: actions/setup-python@v5
with:
python-version: '3.13'
cache: 'pip'
- run: pip install -r ${{ github.workspace }}/requirements.txt

- name: Set Vars
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build/" >> "$GITHUB_OUTPUT"
echo "build-wheels-dir=${{ github.workspace }}/build/bindings/python/wheelhouse/" >> "$GITHUB_OUTPUT"

- name: Configure CMake
# Configure CMake in a 'build' subdirectory.
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DPY_PLATFORM=${{ matrix.platform }}
-DPY_ARCH=${{ matrix.arch }}
-S ${{ github.workspace }}

- name: Build Library
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --clean-first --config ${{ matrix.build_type }} -t tslitex_static

- name: Build Python Wheels
# Build Wheel from Cython code.
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} -t PyWheels

- uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.os }}-${{ matrix.arch }}
path: ${{ steps.strings.outputs.build-wheels-dir }}/*.whl
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build*
build/*
artifacts/*
.vscode
.venv
86 changes: 77 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,65 @@
cmake_minimum_required(VERSION 3.20)
cmake_minimum_required(VERSION 3.22...4.1)

project(libtslitex)

# Set Version
include(version.cmake)

enable_language(C)
set(CMAKE_C_STANDARD 17)
set(CMAKE_C_STANDARD_REQUIRED ON) # error if compiler doesn't support c17
set(CMAKE_C_EXTENSIONS ON)

if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /std:c17 /experimental:c11atomics")
endif(MSVC)

enable_language(CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) # error if compiler doesn't support c++17
set(CMAKE_CXX_EXTENSIONS ON)

################################
# Project Dependencies
################################
include(FetchContent)

# json-c Library
FetchContent_Declare(
json_c
GIT_REPOSITORY https://github.com/json-c/json-c.git
GIT_TAG 2372e9518e6ba95b48d37ec162bc7d93b297b52f
)
set(JSON_C_BUILD_APPS OFF)
set(JSON_C_BUILD_SHARED_LIBS OFF)
FetchContent_MakeAvailable(json_c)

# zlib Library
FetchContent_Declare(
zlib
GIT_REPOSITORY https://github.com/madler/zlib.git
GIT_TAG v1.3.1
)

set(ZLIB_BUILD_TESTING OFF)
set(ZLIB_BUILD_SHARED OFF)
set(ZLIB_INSTALL OFF)
FetchContent_MakeAvailable(zlib)



set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/artifacts/libtslitex")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/artifacts/libtslitex")

add_definitions(-DUNICODE -D_UNICODE)
option(ENABLE_FACTORY_PROVISIONING "Include Factory Provisioning Functions" OFF)

if(ENABLE_FACTORY_PROVISIONING)
add_compile_definitions(FACTORY_PROVISIONING_API)
endif()

add_definitions(-DEN_LOGGING)
add_compile_definitions(UNICODE _UNICODE)

add_compile_definitions(EN_LOGGING)

add_compile_definitions("$<$<CONFIG:Debug>:EN_LOGGING_DEBUG>")

Expand All @@ -33,6 +74,7 @@ set(TS_SOURCES
src/spi.c
src/afe.c
src/adc.c
src/events.c
src/hmcad15xx.c
src/lmh6518.c
src/mcp4728.c
Expand All @@ -43,6 +85,7 @@ set(TS_SOURCES
src/samples.c
src/spiflash.c
src/ts_channel.c
src/ts_data.c
src/ts_fw_manager.c
src/thunderscope.c
)
Expand All @@ -53,6 +96,7 @@ set(TS_HEADERS
src/spi.h
src/adc.h
src/afe.h
src/events.h
src/mcp_clkgen.h
src/mcp_zl3026x.h
src/platform.h
Expand All @@ -63,6 +107,7 @@ set(TS_HEADERS
src/samples.h
src/spiflash.h
src/ts_channel.h
src/ts_data.h
src/ts_fw_manager.h
src/util.h
)
Expand All @@ -80,13 +125,24 @@ add_library(tslitex SHARED ${TS_SOURCES}
${TS_LIB_HEADERS}
)


set_target_properties(tslitex PROPERTIES VERSION ${${PROJECT_NAME}_VERSION})
set_target_properties(tslitex PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<0:>
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<0:>
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/$<0:>)

target_link_libraries(tslitex litepcie)
target_link_libraries(tslitex
PUBLIC
"$<LINK_LIBRARY:WHOLE_ARCHIVE,litepcie>"
PRIVATE
json-c-static
zlibstatic
)

if(APPLE)
target_link_libraries(tslitex PRIVATE "$<LINK_LIBRARY:FRAMEWORK,IOKit>")
endif()

target_include_directories(tslitex PUBLIC include)

####
Expand All @@ -96,25 +152,37 @@ add_library(tslitex_static STATIC ${TS_SOURCES}
${TS_LIB_HEADERS}
)

set_target_properties(tslitex_static PROPERTIES VERSION ${${PROJECT_NAME}_VERSION})
set_target_properties(tslitex_static PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<0:>
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<0:>
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/$<0:>)

#target_compile_definitions(tslitex_static tslitex_static_STATIC)

set_target_properties(tslitex_static PROPERTIES POSITION_INDEPENDENT_CODE 1)

target_link_libraries(tslitex_static
PUBLIC
"$<LINK_LIBRARY:WHOLE_ARCHIVE,litepcie>"
PRIVATE
json-c-static
zlibstatic
)

target_link_libraries(tslitex_static litepcie)
target_include_directories(tslitex_static PUBLIC include)

if(APPLE)
target_link_libraries(tslitex_static PRIVATE "$<LINK_LIBRARY:FRAMEWORK,IOKit>")
endif()

file(COPY ${TS_LIB_HEADERS} DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/include)

####
# EXAMPLE APPLICATIONS
####
add_subdirectory(example)

####
# BINDINGS
####
add_subdirectory(bindings/python)
add_dependencies(PyBindings tslitex_static litepcie)

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ To build the python bindings, you must first have pipx and cython installed. The
> pip install -r requirements.txt
```

Now you can build the `PyBindings` target with cmake
Now you can build the `PyBindings` target with cmake. If you get an error about some module not being installed, recreate the cmake cache with `cmake --fresh ..`

```bash
> cd build/
> cmake --fresh ..
> cmake --build . -t PyBindings
```

Expand Down
Loading
Loading