Skip to content

Commit

Permalink
repo: post-rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinevg committed Jan 6, 2025
1 parent 9931ce9 commit 6632da2
Show file tree
Hide file tree
Showing 180 changed files with 192 additions and 192 deletions.
8 changes: 4 additions & 4 deletions cynthion/python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ UART ?= /dev/ttyACM0
# - gateware ------------------------------------------------------------------

analyzer:
python3 -m cynthion.gateware.analyzer.top --output build/$@.bit
python -m cynthion.gateware.analyzer.top --output build/$@.bit

selftest:
mkdir -p build/
python3 -m cynthion.gateware.selftest.top --output build/$@.bit
python -m cynthion.gateware.selftest.top --output build/$@.bit

facedancer:
mkdir -p build/gensvd/
python3 -m cynthion.gateware.facedancer.top --output build/$@.bit
python -m cynthion.gateware.facedancer.top --output build/$@.bit

svd:
mkdir -p build/gensvd/
python3 -m cynthion.gateware.facedancer.top --generate-svd > build/gensvd/facedancer.svd
python -m cynthion.gateware.facedancer.top --generate-svd > build/gensvd/moondancer.svd


# - helpers -------------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions cynthion/python/src/gateware/facedancer/top.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

from luna.gateware.usb.usb2.device import USBDevice

from luna.gateware.utils.cdc import synchronize

from luna_soc.gateware.core import blockram, spiflash, timer, uart, usb2
from luna_soc.gateware.core.spiflash import ECP5ConfigurationFlashInterface, SPIPHYController
from luna_soc.gateware.cpu import InterruptController, VexRiscv
Expand Down Expand Up @@ -411,8 +409,10 @@ def elaborate(self, platform):
# - build ---------------------------------------------------------------------

if __name__ == "__main__":
from luna import configure_default_logging, top_level_cli
from luna import configure_default_logging
from luna.gateware.platform import get_appropriate_platform
#from luna import top_level_cli
from luna_soc import top_level_cli

# configure logging
configure_default_logging()
Expand All @@ -435,9 +435,9 @@ def elaborate(self, platform):
design = Top(clock_frequency_hz=clock_frequency_hz, domain=domain)

# generate soc sdk
from luna_soc.generate.svd import GenerateSVD
with open("build/gensvd/facedancer.svd", "w") as f:
GenerateSVD = GenerateSVD(design).generate(file=f)
#from luna_soc.generate.svd import GenerateSVD
#with open("build/gensvd/moondancer.svd", "w") as f:
# GenerateSVD = GenerateSVD(design).generate(file=f)

# invoke cli
_overrides = {
Expand Down
2 changes: 1 addition & 1 deletion firmware/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = [
"ladybug",
"libgreat",
"lunasoc-hal",
"facedancer-pac",
"moondancer-pac",
"moondancer",
"smolusb",
]
Expand Down
48 changes: 0 additions & 48 deletions firmware/facedancer-pac/src/generated/usb2_ep_control/reset.rs

This file was deleted.

48 changes: 0 additions & 48 deletions firmware/facedancer-pac/src/generated/usb2_ep_out/reset.rs

This file was deleted.

16 changes: 8 additions & 8 deletions firmware/lunasoc-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ default = [

# select softcore
minerva = [
"facedancer-pac/minerva",
"moondancer-pac/minerva",
]
vexriscv = [
"facedancer-pac/vexriscv",
"moondancer-pac/vexriscv",
]

# use nightly features
Expand Down Expand Up @@ -73,24 +73,24 @@ riscv-rt = { version = "=0.11.0" }

[[example]]
name = "blinky"
required-features = ["facedancer-pac/rt"]
required-features = ["moondancer-pac/rt"]

[[example]]
name = "blinky_pac"
required-features = ["facedancer-pac/rt"]
required-features = ["moondancer-pac/rt"]

[[example]]
name = "interrupts"
required-features = ["facedancer-pac/rt"]
required-features = ["moondancer-pac/rt"]

[[example]]
name = "interrupts_pac"
required-features = ["facedancer-pac/rt"]
required-features = ["moondancer-pac/rt"]

[[example]]
name = "uart"
required-features = ["facedancer-pac/rt"]
required-features = ["moondancer-pac/rt"]

[[example]]
name = "uart_pac"
required-features = ["facedancer-pac/rt"]
required-features = ["moondancer-pac/rt"]
2 changes: 1 addition & 1 deletion firmware/lunasoc-hal/examples/blinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use panic_halt as _;
use riscv_rt::entry;

use lunasoc_hal as hal;
use facedancer_pac as pac;
use moondancer_pac as pac;

use hal::hal::delay::DelayUs;

Expand Down
2 changes: 1 addition & 1 deletion firmware/lunasoc-hal/examples/blinky_pac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use panic_halt as _;
use riscv_rt::entry;

use facedancer_pac as pac;
use moondancer_pac as pac;

const SYSTEM_CLOCK_FREQUENCY: u32 = pac::clock::sysclk();

Expand Down
2 changes: 1 addition & 1 deletion firmware/lunasoc-hal/examples/interrupts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use panic_halt as _;
use riscv_rt::entry;

use lunasoc_hal as hal;
use facedancer_pac as pac;
use moondancer_pac as pac;

lunasoc_hal::impl_serial! {
Serial: pac::UART0,
Expand Down
2 changes: 1 addition & 1 deletion firmware/lunasoc-hal/examples/interrupts_pac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use panic_halt as _;
use riscv_rt::entry;

use facedancer_pac as pac;
use moondancer_pac as pac;
use pac::csr;

#[entry]
Expand Down
2 changes: 1 addition & 1 deletion firmware/lunasoc-hal/examples/uart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use panic_halt as _;
use riscv_rt::entry;

use lunasoc_hal as hal;
use facedancer_pac as pac;
use moondancer_pac as pac;

use hal::hal::delay::DelayUs;

Expand Down
2 changes: 1 addition & 1 deletion firmware/lunasoc-hal/examples/uart_pac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use panic_halt as _;
use riscv_rt::entry;

use facedancer_pac as pac;
use moondancer_pac as pac;

const SYSTEM_CLOCK_FREQUENCY: u32 = pac::clock::sysclk();

Expand Down
42 changes: 21 additions & 21 deletions firmware/lunasoc-hal/src/usb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,16 @@ macro_rules! impl_usb {
// un-prime all OUT endpoints and disable interface
for endpoint_number in 0..smolusb::EP_MAX_ENDPOINTS as u8 {
self.ep_out
.epno()
.write(|w| unsafe { w.epno().bits(endpoint_number) });
self.ep_out.prime().write(|w| w.prime().bit(false));
.endpoint()
.write(|w| unsafe { w.number().bits(endpoint_number) });
self.ep_out.prime().write(|w| w.primed().bit(false));
}
self.ep_out.enable().write(|w| w.enable().bit(false));
self.ep_out.enable().write(|w| w.enabled().bit(false));

// reset FIFOs
self.ep_control.reset().write(|w| w.high().bit(true));
self.ep_in.reset() .write(|w| w.high().bit(true));
self.ep_out.reset() .write(|w| w.high().bit(true));
self.ep_control.reset().write(|w| w.fifo().bit(true));
self.ep_in.reset() .write(|w| w.fifo().bit(true));
self.ep_out.reset() .write(|w| w.fifo().bit(true));

// connect device
self.device.control().modify(|_, w| w.connect().bit(true));
Expand All @@ -195,16 +195,16 @@ macro_rules! impl_usb {
// un-prime all OUT endpoints and disable interface
for endpoint_number in 0..smolusb::EP_MAX_ENDPOINTS as u8 {
self.ep_out
.epno()
.write(|w| unsafe { w.epno().bits(endpoint_number) });
self.ep_out.prime().write(|w| w.prime().bit(false));
.endpoint()
.write(|w| unsafe { w.number().bits(endpoint_number) });
self.ep_out.prime().write(|w| w.primed().bit(false));
}
self.ep_out.enable().write(|w| w.enable().bit(false));
self.ep_out.enable().write(|w| w.enabled().bit(false));

// reset FIFOs
self.ep_control.reset().write(|w| w.high().bit(true));
self.ep_in.reset() .write(|w| w.high().bit(true));
self.ep_out.reset() .write(|w| w.high().bit(true));
self.ep_control.reset().write(|w| w.fifo().bit(true));
self.ep_in.reset() .write(|w| w.fifo().bit(true));
self.ep_out.reset() .write(|w| w.fifo().bit(true));
}

/// Perform a bus reset of the device.
Expand All @@ -216,9 +216,9 @@ macro_rules! impl_usb {
self.set_address(0);

// reset FIFOs
self.ep_control.reset().write(|w| w.high().bit(true));
self.ep_in.reset() .write(|w| w.high().bit(true));
self.ep_out.reset() .write(|w| w.high().bit(true));
self.ep_control.reset().write(|w| w.fifo().bit(true));
self.ep_in.reset() .write(|w| w.fifo().bit(true));
self.ep_out.reset() .write(|w| w.fifo().bit(true));

// clear status for all IN endpoints
for endpoint in 0..(smolusb::EP_MAX_ENDPOINTS as u8) {
Expand Down Expand Up @@ -257,14 +257,14 @@ macro_rules! impl_usb {

/// Stall the given IN endpoint number.
fn stall_endpoint_in(&self, endpoint_number: u8) {
self.ep_in.reset().write(|w| w.high().bit(true));
self.ep_in.reset().write(|w| w.fifo().bit(true));
self.ep_in.stall().write(|w| w.stalled().bit(true));
self.ep_in.endpoint().write(|w| unsafe { w.number().bits(endpoint_number) });
}

/// Stall the given OUT endpoint number.
fn stall_endpoint_out(&self, endpoint_number: u8) {
self.ep_out.reset().write(|w| w.high().bit(true));
self.ep_out.reset().write(|w| w.fifo().bit(true));
self.ep_out.endpoint().write(|w| unsafe { w.number().bits(endpoint_number) });
self.ep_out.stall().write(|w| w.stalled().bit(true));
}
Expand Down Expand Up @@ -402,7 +402,7 @@ macro_rules! impl_usb {
// 0. clear receive fifo in case the previous transaction wasn't handled
if self.ep_out.status().read().have().bit() {
log::warn!(" {} priming out endpoint {} with unread data", stringify!($USBX), endpoint_number);
self.ep_out.reset().write(|w| w.high().bit(true));
self.ep_out.reset().write(|w| w.fifo().bit(true));
}

// 1. select endpoint
Expand Down Expand Up @@ -479,7 +479,7 @@ macro_rules! impl_usb {
if timeout == 0 {
log::warn!(" {} clear tx", stringify!($USBX));
} else if timeout > DEFAULT_TIMEOUT {
self.ep_in.reset().write(|w| w.high().bit(true));
self.ep_in.reset().write(|w| w.fifo().bit(true));
unsafe {
self.clear_tx_ack_active(endpoint_number);
}
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description = "A peripheral access crate for the Cynthion Moondancer SoC"
categories = ["embedded", "hardware-support", "no-std"]
keywords = ["cynthion", "luna", "riscv", "peripheral", "usb"]
repository = "https://github.com/greatscottgadgets/cynthion"
documentation = "https://docs.rs/facedancer-pac"
documentation = "https://docs.rs/moondancer-pac"
edition = "2021"
rust-version = "1.68"
include = ["src/**/*", "README.md", "device.x", "build.rs"]
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
#
# cargo install svd2rust form

SVD := ../../cynthion/python/build/gensvd/facedancer.svd
SVD := ../../cynthion/python/build/gensvd/moondancer.svd

svd2rust:
rm -rf build src/generated.rs src/generated/
mkdir build

cp $(SVD) svd/facedancer.svd
svd2rust -i svd/facedancer.svd -o build/ --target riscv --make_mod --ident-formats-theme legacy
cp $(SVD) svd/moondancer.svd
svd2rust -i svd/moondancer.svd -o build/ --target riscv --make_mod --ident-formats-theme legacy
mv build/mod.rs src/generated.rs
@# TODO uncomment once we no longer have to poly-fill 'target_has_atomic'
@# see: https://github.com/rust-lang/rust/issues/94039
Expand All @@ -24,4 +24,4 @@ doc:
cargo doc --no-deps --all-features --document-private-items --open

distclean:
rm -rf build/ target/ src/generated.rs src/generated/ svd/facedancer.svd
rm -rf build/ target/ src/generated.rs src/generated/ svd/moondancer.svd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
## facedancer-pac
## moondancer-pac

A peripheral access crate for the Cynthion Moondancer SoC.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 6632da2

Please sign in to comment.