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

Add PAC for ATSAML22J18A #663

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions pac/atsaml22j/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "atsaml22j"
description = "Peripheral access API for ATSAML22J microcontrollers (generated using svd2rust)"
version = "0.1.0"
edition = "2021"
authors = ["Wesley Ellis <[email protected]>"]
keywords = ["no-std", "arm", "cortex-m"]
categories = ["embedded", "hardware-support", "no-std"]
license = "MIT OR Apache-2.0"

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

[dependencies]
3 changes: 3 additions & 0 deletions pac/atsaml22j/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
A periphreal access crate for the ATSAMDL22J chip from Microship for Rust Embedded Projects.

TODO
16 changes: 16 additions & 0 deletions pac/atsaml22j/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
fn main() {
if env::var_os("CARGO_FEATURE_RT").is_some() {
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
File::create(out.join("device.x"))
.unwrap()
.write_all(include_bytes!("device.x"))
.unwrap();
println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=device.x");
}
println!("cargo:rerun-if-changed=build.rs");
}
24 changes: 24 additions & 0 deletions pac/atsaml22j/device.x
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
PROVIDE(SYSTEM = DefaultHandler);
PROVIDE(WDT = DefaultHandler);
PROVIDE(RTC = DefaultHandler);
PROVIDE(EIC = DefaultHandler);
PROVIDE(FREQM = DefaultHandler);
PROVIDE(USB = DefaultHandler);
PROVIDE(NVMCTRL = DefaultHandler);
PROVIDE(DMAC = DefaultHandler);
PROVIDE(EVSYS = DefaultHandler);
PROVIDE(SERCOM0 = DefaultHandler);
PROVIDE(SERCOM1 = DefaultHandler);
PROVIDE(SERCOM2 = DefaultHandler);
PROVIDE(SERCOM3 = DefaultHandler);
PROVIDE(TCC0 = DefaultHandler);
PROVIDE(TC0 = DefaultHandler);
PROVIDE(TC1 = DefaultHandler);
PROVIDE(TC2 = DefaultHandler);
PROVIDE(TC3 = DefaultHandler);
PROVIDE(ADC = DefaultHandler);
PROVIDE(AC = DefaultHandler);
PROVIDE(SLCD = DefaultHandler);
PROVIDE(AES = DefaultHandler);
PROVIDE(TRNG = DefaultHandler);

85 changes: 85 additions & 0 deletions pac/atsaml22j/src/ac.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control A"]
pub ctrla: CTRLA,
#[doc = "0x01 - Control B"]
pub ctrlb: CTRLB,
#[doc = "0x02 - Event Control"]
pub evctrl: EVCTRL,
#[doc = "0x04 - Interrupt Enable Clear"]
pub intenclr: INTENCLR,
#[doc = "0x05 - Interrupt Enable Set"]
pub intenset: INTENSET,
#[doc = "0x06 - Interrupt Flag Status and Clear"]
pub intflag: INTFLAG,
#[doc = "0x07 - Status A"]
pub statusa: STATUSA,
#[doc = "0x08 - Status B"]
pub statusb: STATUSB,
#[doc = "0x09 - Debug Control"]
pub dbgctrl: DBGCTRL,
#[doc = "0x0a - Window Control"]
pub winctrl: WINCTRL,
_reserved10: [u8; 0x01],
#[doc = "0x0c - Scaler n"]
pub scaler: [SCALER; 2],
_reserved11: [u8; 0x02],
#[doc = "0x10..0x18 - Comparator Control n"]
pub compctrl: [COMPCTRL; 2],
_reserved12: [u8; 0x08],
#[doc = "0x20 - Synchronization Busy"]
pub syncbusy: SYNCBUSY,
}
#[doc = "CTRLA (rw) register accessor: an alias for `Reg<CTRLA_SPEC>`"]
pub type CTRLA = crate::Reg<ctrla::CTRLA_SPEC>;
#[doc = "Control A"]
pub mod ctrla;
#[doc = "CTRLB (w) register accessor: an alias for `Reg<CTRLB_SPEC>`"]
pub type CTRLB = crate::Reg<ctrlb::CTRLB_SPEC>;
#[doc = "Control B"]
pub mod ctrlb;
#[doc = "EVCTRL (rw) register accessor: an alias for `Reg<EVCTRL_SPEC>`"]
pub type EVCTRL = crate::Reg<evctrl::EVCTRL_SPEC>;
#[doc = "Event Control"]
pub mod evctrl;
#[doc = "INTENCLR (rw) register accessor: an alias for `Reg<INTENCLR_SPEC>`"]
pub type INTENCLR = crate::Reg<intenclr::INTENCLR_SPEC>;
#[doc = "Interrupt Enable Clear"]
pub mod intenclr;
#[doc = "INTENSET (rw) register accessor: an alias for `Reg<INTENSET_SPEC>`"]
pub type INTENSET = crate::Reg<intenset::INTENSET_SPEC>;
#[doc = "Interrupt Enable Set"]
pub mod intenset;
#[doc = "INTFLAG (rw) register accessor: an alias for `Reg<INTFLAG_SPEC>`"]
pub type INTFLAG = crate::Reg<intflag::INTFLAG_SPEC>;
#[doc = "Interrupt Flag Status and Clear"]
pub mod intflag;
#[doc = "STATUSA (r) register accessor: an alias for `Reg<STATUSA_SPEC>`"]
pub type STATUSA = crate::Reg<statusa::STATUSA_SPEC>;
#[doc = "Status A"]
pub mod statusa;
#[doc = "STATUSB (r) register accessor: an alias for `Reg<STATUSB_SPEC>`"]
pub type STATUSB = crate::Reg<statusb::STATUSB_SPEC>;
#[doc = "Status B"]
pub mod statusb;
#[doc = "DBGCTRL (rw) register accessor: an alias for `Reg<DBGCTRL_SPEC>`"]
pub type DBGCTRL = crate::Reg<dbgctrl::DBGCTRL_SPEC>;
#[doc = "Debug Control"]
pub mod dbgctrl;
#[doc = "WINCTRL (rw) register accessor: an alias for `Reg<WINCTRL_SPEC>`"]
pub type WINCTRL = crate::Reg<winctrl::WINCTRL_SPEC>;
#[doc = "Window Control"]
pub mod winctrl;
#[doc = "SCALER (rw) register accessor: an alias for `Reg<SCALER_SPEC>`"]
pub type SCALER = crate::Reg<scaler::SCALER_SPEC>;
#[doc = "Scaler n"]
pub mod scaler;
#[doc = "COMPCTRL (rw) register accessor: an alias for `Reg<COMPCTRL_SPEC>`"]
pub type COMPCTRL = crate::Reg<compctrl::COMPCTRL_SPEC>;
#[doc = "Comparator Control n"]
pub mod compctrl;
#[doc = "SYNCBUSY (r) register accessor: an alias for `Reg<SYNCBUSY_SPEC>`"]
pub type SYNCBUSY = crate::Reg<syncbusy::SYNCBUSY_SPEC>;
#[doc = "Synchronization Busy"]
pub mod syncbusy;
Loading