Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Version 2.0 #32

Draft
wants to merge 59 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
738218d
Switch FPGA API's to be dynamically loaded
ThadHouse Sep 2, 2023
13438c9
Finish up changes
ThadHouse Sep 2, 2023
b722aaf
Fix first round of review nits
ThadHouse Sep 2, 2023
3551844
Only have FFI code at the low level
ThadHouse Sep 2, 2023
0844fd3
Fix loading
ThadHouse Sep 2, 2023
c7c022c
Add HMB as an example of an optional api
ThadHouse Sep 2, 2023
ca4785b
Don't make general write functions mut
ThadHouse Sep 2, 2023
3f67a0b
Allow opening a non owning session
ThadHouse Sep 2, 2023
05f91f5
Add all enums
ThadHouse Sep 2, 2023
c06fc35
Some reformatting
ThadHouse Sep 2, 2023
33cdbd7
Use enums at high level
ThadHouse Sep 2, 2023
207b3a5
Add all FPGA APIs
ThadHouse Sep 3, 2023
bf0a476
Flesh out HMB API
ThadHouse Sep 3, 2023
841b9d8
Add an API to create from an existing session
ThadHouse Sep 3, 2023
3ea872b
Really fix up lifetimes this time
ThadHouse Sep 3, 2023
86376cd
Add typed register API
ThadHouse Sep 3, 2023
75f40e4
Use some lifetime hack to make alternate objects easier
ThadHouse Sep 3, 2023
3a18483
Use traits to access high level values
ThadHouse Sep 3, 2023
0c5d90b
Export high level types, so they can actually be typed out
ThadHouse Sep 3, 2023
d2895a2
Add accessors for ffi low level directly
ThadHouse Sep 3, 2023
725045c
Allow building without unstable features
ThadHouse Sep 3, 2023
ece6325
Massively improve lifetime holding for registers
ThadHouse Sep 3, 2023
96154d3
Remove missed file
ThadHouse Sep 4, 2023
0679c4d
Hide unsafe API a bit better, don't allow using register API for it
ThadHouse Sep 4, 2023
0f8d8a0
Make enums fixed types too
ThadHouse Sep 4, 2023
3447ae0
Use from for dlopen error coersion
ThadHouse Sep 6, 2023
0f4b378
Switch FPGA API's to be dynamically loaded
ThadHouse Sep 6, 2023
852453a
Merge branch 'master' into dlopenapi
ThadHouse Sep 7, 2023
92f85d4
Fixup running
ThadHouse Sep 7, 2023
e89e926
Fix integration tests
ThadHouse Sep 7, 2023
21cf98c
Merge master
ThadHouse Sep 8, 2023
3ecb57c
Make not require unsafe
ThadHouse Sep 8, 2023
85b3620
Fix session
ThadHouse Sep 8, 2023
1de06ef
Remove generated code
ThadHouse Sep 8, 2023
e528442
Remove unnecessary
ThadHouse Sep 8, 2023
02fc71d
Lots more cluster work
ThadHouse Sep 8, 2023
050b491
Delete fixed registers
ThadHouse Sep 8, 2023
f30d9d0
1 more miss
ThadHouse Sep 8, 2023
c9fc506
Add packed number
ThadHouse Sep 8, 2023
3d917b9
Add back in specializations
ThadHouse Sep 8, 2023
7856fa0
Finally found a way to specialize reads and writes
ThadHouse Sep 8, 2023
6911389
Use a builder API
ThadHouse Sep 9, 2023
16d0ea9
Fix enum macros
ThadHouse Sep 9, 2023
5fadba4
Fix lints
ThadHouse Sep 9, 2023
95ae402
Better specialization
ThadHouse Sep 9, 2023
ce8c0d2
Test and abstract out much stuff
ThadHouse Sep 9, 2023
84864ce
Split Register Read and Write
ThadHouse Sep 9, 2023
b42ce0a
Split read and write, make write unsafe
ThadHouse Sep 9, 2023
ff937b2
Remove unsafe
ThadHouse Sep 10, 2023
e993fc7
Work on generating a full high level API
ThadHouse Sep 10, 2023
ca8e10f
Lots more generation
ThadHouse Sep 10, 2023
eb44cbd
Everything needs to explicitly implement datatype
ThadHouse Sep 10, 2023
fa19b27
Add register transmute
ThadHouse Sep 10, 2023
684e231
Fix
ThadHouse Sep 10, 2023
5ec06b3
Add overflowing option for FXP
ThadHouse Sep 10, 2023
3892a05
Add raw HMB readers
ThadHouse Sep 12, 2023
82b2aba
Add interrupt manager
ThadHouse Sep 13, 2023
a80a72c
Export Interrupt Manager
ThadHouse Sep 13, 2023
cffa1d2
Export IRQ
ThadHouse Sep 13, 2023
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
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,33 @@ jobs:
with:
command: clippy
args: -- -D warnings -A incomplete_features

build_stable:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup QEMU/binfmts
run:
sudo apt-get update &&
sudo apt-get install -y binfmt-support qemu qemu-user-static qemu-system-arm &&
sudo update-binfmts --enable
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
default: true
- name: cross build
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --verbose --target=arm-unknown-linux-gnueabi --package example-arc
- name: cross test
uses: actions-rs/cargo@v1
with:
use-cross: true
command: test
args: --verbose --target=arm-unknown-linux-gnueabi --package ni-fpga
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"example",
"example-arc",
"integration",
"ni-fpga",
"ni-fpga-macros",
Expand Down
12 changes: 12 additions & 0 deletions example-arc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "example-arc"
version = "0.1.0"
authors = ["Thad House <thadhouse1>"]
edition = "2018"
publish = false

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ni-fpga = { path = "../ni-fpga" }
ni-fpga-macros = { path = "../ni-fpga-macros" }
38 changes: 38 additions & 0 deletions example-arc/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
use std::{thread, time::Duration};

use ni_fpga::RegisterRead;

use crate::registers::FpgaBitfile;

mod registers;

fn main() -> Result<(), ni_fpga::Error> {
let session = FpgaBitfile::session_builder("rio://172.22.11.2/RIO0")?.build_arc()?;
let mut regs = FpgaBitfile::take(&session).unwrap();

let frequency = regs.DutyCycle0_Frequency.take().unwrap();
let output = regs.DutyCycle0_HighTicks.take().unwrap();

let frequency1 = regs.DutyCycle1_Frequency.take().unwrap();

loop {
let o = output
.read(&session)?
.to_fxp()
.map(|f| f.to_int())
.unwrap_or(0);
let f = frequency
.read(&session)?
.to_fxp()
.map(|f| f.to_int())
.unwrap_or(0);
let f1 = frequency1
.read(&session)?
.to_fxp()
.map(|f| f.to_int())
.unwrap_or(-42);

println!("F: {f} O: {o} f1: {f1}");
thread::sleep(Duration::from_secs(1));
}
}
Loading