Skip to content

Commit

Permalink
Add USB_WRAP peripheral for ESP32-S2
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebraham committed Oct 25, 2022
1 parent 3ac82c5 commit 9675495
Show file tree
Hide file tree
Showing 6 changed files with 904 additions and 1 deletion.
33 changes: 33 additions & 0 deletions esp32s2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,34 @@ impl core::fmt::Debug for USB0 {
}
#[doc = "USB OTG (On-The-Go)"]
pub mod usb0;
#[doc = "Peripheral USB_WRAP"]
pub struct USB_WRAP {
_marker: PhantomData<*const ()>,
}
unsafe impl Send for USB_WRAP {}
impl USB_WRAP {
#[doc = r"Pointer to the register block"]
pub const PTR: *const usb_wrap::RegisterBlock = 0x3f43_9000 as *const _;
#[doc = r"Return the pointer to the register block"]
#[inline(always)]
pub const fn ptr() -> *const usb_wrap::RegisterBlock {
Self::PTR
}
}
impl Deref for USB_WRAP {
type Target = usb_wrap::RegisterBlock;
#[inline(always)]
fn deref(&self) -> &Self::Target {
unsafe { &*Self::PTR }
}
}
impl core::fmt::Debug for USB_WRAP {
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result {
f.debug_struct("USB_WRAP").finish()
}
}
#[doc = "Peripheral USB_WRAP"]
pub mod usb_wrap;
#[doc = "XTS-AES-128 Flash Encryption"]
pub struct XTS_AES {
_marker: PhantomData<*const ()>,
Expand Down Expand Up @@ -1619,6 +1647,8 @@ pub struct Peripherals {
pub UHCI0: UHCI0,
#[doc = "USB0"]
pub USB0: USB0,
#[doc = "USB_WRAP"]
pub USB_WRAP: USB_WRAP,
#[doc = "XTS_AES"]
pub XTS_AES: XTS_AES,
}
Expand Down Expand Up @@ -1760,6 +1790,9 @@ impl Peripherals {
USB0: USB0 {
_marker: PhantomData,
},
USB_WRAP: USB_WRAP {
_marker: PhantomData,
},
XTS_AES: XTS_AES {
_marker: PhantomData,
},
Expand Down
23 changes: 23 additions & 0 deletions esp32s2/src/usb_wrap.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - USB OTG Wrapper Configure Register"]
pub otg_conf: OTG_CONF,
#[doc = "0x04 - USB Internal PHY Testing Register"]
pub test_conf: TEST_CONF,
_reserved2: [u8; 0x03f4],
#[doc = "0x3fc - Version Control Register"]
pub date: DATE,
}
#[doc = "OTG_CONF (rw) register accessor: an alias for `Reg<OTG_CONF_SPEC>`"]
pub type OTG_CONF = crate::Reg<otg_conf::OTG_CONF_SPEC>;
#[doc = "USB OTG Wrapper Configure Register"]
pub mod otg_conf;
#[doc = "TEST_CONF (rw) register accessor: an alias for `Reg<TEST_CONF_SPEC>`"]
pub type TEST_CONF = crate::Reg<test_conf::TEST_CONF_SPEC>;
#[doc = "USB Internal PHY Testing Register"]
pub mod test_conf;
#[doc = "DATE (rw) register accessor: an alias for `Reg<DATE_SPEC>`"]
pub type DATE = crate::Reg<date::DATE_SPEC>;
#[doc = "Version Control Register"]
pub mod date;
80 changes: 80 additions & 0 deletions esp32s2/src/usb_wrap/date.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#[doc = "Register `DATE` reader"]
pub struct R(crate::R<DATE_SPEC>);
impl core::ops::Deref for R {
type Target = crate::R<DATE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl From<crate::R<DATE_SPEC>> for R {
#[inline(always)]
fn from(reader: crate::R<DATE_SPEC>) -> Self {
R(reader)
}
}
#[doc = "Register `DATE` writer"]
pub struct W(crate::W<DATE_SPEC>);
impl core::ops::Deref for W {
type Target = crate::W<DATE_SPEC>;
#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl core::ops::DerefMut for W {
#[inline(always)]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl From<crate::W<DATE_SPEC>> for W {
#[inline(always)]
fn from(writer: crate::W<DATE_SPEC>) -> Self {
W(writer)
}
}
#[doc = "Field `USB_WRAP_DATE` reader - Date register"]
pub type USB_WRAP_DATE_R = crate::FieldReader<u32, u32>;
#[doc = "Field `USB_WRAP_DATE` writer - Date register"]
pub type USB_WRAP_DATE_W<'a, const O: u8> = crate::FieldWriter<'a, u32, DATE_SPEC, u32, u32, 32, O>;
impl R {
#[doc = "Bits 0:31 - Date register"]
#[inline(always)]
pub fn usb_wrap_date(&self) -> USB_WRAP_DATE_R {
USB_WRAP_DATE_R::new(self.bits)
}
}
impl W {
#[doc = "Bits 0:31 - Date register"]
#[inline(always)]
pub fn usb_wrap_date(&mut self) -> USB_WRAP_DATE_W<0> {
USB_WRAP_DATE_W::new(self)
}
#[doc = "Writes raw bits to the register."]
#[inline(always)]
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self {
self.0.bits(bits);
self
}
}
#[doc = "Version Control Register\n\nThis register you can [`read`](crate::generic::Reg::read), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [date](index.html) module"]
pub struct DATE_SPEC;
impl crate::RegisterSpec for DATE_SPEC {
type Ux = u32;
}
#[doc = "`read()` method returns [date::R](R) reader structure"]
impl crate::Readable for DATE_SPEC {
type Reader = R;
}
#[doc = "`write(|w| ..)` method takes [date::W](W) writer structure"]
impl crate::Writable for DATE_SPEC {
type Writer = W;
}
#[doc = "`reset()` method sets DATE to value 0x0210_2010"]
impl crate::Resettable for DATE_SPEC {
#[inline(always)]
fn reset_value() -> Self::Ux {
0x0210_2010
}
}
Loading

0 comments on commit 9675495

Please sign in to comment.