-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add basic support for the Wi-Fi peripheral on the ESP32. (#284)
* Added support for the WiFi peripheral. * Added basic crypto and cleaned up filtering. * Added some statistic registers. * Regenerated PAC. * Fixed addressOffset fields for filters. * Revert "Fixed addressOffset fields for filters." This reverts commit 6bc584d. * Added unknown PMD register. * Temporarily removed crypto support
- Loading branch information
1 parent
046f3b3
commit ffbee35
Showing
50 changed files
with
2,603 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#[repr(C)] | ||
#[cfg_attr(feature = "impl-register-debug", derive(Debug))] | ||
#[doc = "The cryptographic keys, to be used by the MAC"] | ||
pub struct CRYPTO_KEY_ENTRY { | ||
addr_low: ADDR_LOW, | ||
addr_high: ADDR_HIGH, | ||
_reserved_end: [u8; 0x20], | ||
} | ||
impl CRYPTO_KEY_ENTRY { | ||
#[doc = "0x00 - "] | ||
#[inline(always)] | ||
pub const fn addr_low(&self) -> &ADDR_LOW { | ||
&self.addr_low | ||
} | ||
#[doc = "0x04 - "] | ||
#[inline(always)] | ||
pub const fn addr_high(&self) -> &ADDR_HIGH { | ||
&self.addr_high | ||
} | ||
} | ||
#[doc = "ADDR_LOW (rw) register accessor: \n\nYou can [`read`](crate::Reg::read) this register and get [`addr_low::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`addr_low::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@addr_low`] module"] | ||
pub type ADDR_LOW = crate::Reg<addr_low::ADDR_LOW_SPEC>; | ||
#[doc = ""] | ||
pub mod addr_low; | ||
#[doc = "ADDR_HIGH (rw) register accessor: \n\nYou can [`read`](crate::Reg::read) this register and get [`addr_high::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`addr_high::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@addr_high`] module"] | ||
pub type ADDR_HIGH = crate::Reg<addr_high::ADDR_HIGH_SPEC>; | ||
#[doc = ""] | ||
pub mod addr_high; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#[doc = "Register `ADDR_HIGH` reader"] | ||
pub type R = crate::R<ADDR_HIGH_SPEC>; | ||
#[doc = "Register `ADDR_HIGH` writer"] | ||
pub type W = crate::W<ADDR_HIGH_SPEC>; | ||
#[doc = "Field `ADDR` reader - "] | ||
pub type ADDR_R = crate::FieldReader<u16>; | ||
#[doc = "Field `ADDR` writer - "] | ||
pub type ADDR_W<'a, REG> = crate::FieldWriter<'a, REG, 16, u16>; | ||
#[doc = "Field `ALGORITHM` reader - "] | ||
pub type ALGORITHM_R = crate::FieldReader; | ||
#[doc = "Field `ALGORITHM` writer - "] | ||
pub type ALGORITHM_W<'a, REG> = crate::FieldWriter<'a, REG, 3>; | ||
#[doc = "Field `INTERFACE` reader - "] | ||
pub type INTERFACE_R = crate::FieldReader; | ||
#[doc = "Field `INTERFACE` writer - "] | ||
pub type INTERFACE_W<'a, REG> = crate::FieldWriter<'a, REG, 2>; | ||
#[doc = "Field `SUPPLICANT_KEY_INDEX` reader - "] | ||
pub type SUPPLICANT_KEY_INDEX_R = crate::FieldReader; | ||
#[doc = "Field `SUPPLICANT_KEY_INDEX` writer - "] | ||
pub type SUPPLICANT_KEY_INDEX_W<'a, REG> = crate::FieldWriter<'a, REG, 2>; | ||
impl R { | ||
#[doc = "Bits 0:15"] | ||
#[inline(always)] | ||
pub fn addr(&self) -> ADDR_R { | ||
ADDR_R::new((self.bits & 0xffff) as u16) | ||
} | ||
#[doc = "Bits 18:20"] | ||
#[inline(always)] | ||
pub fn algorithm(&self) -> ALGORITHM_R { | ||
ALGORITHM_R::new(((self.bits >> 18) & 7) as u8) | ||
} | ||
#[doc = "Bits 24:25"] | ||
#[inline(always)] | ||
pub fn interface(&self) -> INTERFACE_R { | ||
INTERFACE_R::new(((self.bits >> 24) & 3) as u8) | ||
} | ||
#[doc = "Bits 30:31"] | ||
#[inline(always)] | ||
pub fn supplicant_key_index(&self) -> SUPPLICANT_KEY_INDEX_R { | ||
SUPPLICANT_KEY_INDEX_R::new(((self.bits >> 30) & 3) as u8) | ||
} | ||
} | ||
#[cfg(feature = "impl-register-debug")] | ||
impl core::fmt::Debug for R { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
f.debug_struct("ADDR_HIGH") | ||
.field("addr", &self.addr()) | ||
.field("algorithm", &self.algorithm()) | ||
.field("interface", &self.interface()) | ||
.field("supplicant_key_index", &self.supplicant_key_index()) | ||
.finish() | ||
} | ||
} | ||
impl W { | ||
#[doc = "Bits 0:15"] | ||
#[inline(always)] | ||
pub fn addr(&mut self) -> ADDR_W<ADDR_HIGH_SPEC> { | ||
ADDR_W::new(self, 0) | ||
} | ||
#[doc = "Bits 18:20"] | ||
#[inline(always)] | ||
pub fn algorithm(&mut self) -> ALGORITHM_W<ADDR_HIGH_SPEC> { | ||
ALGORITHM_W::new(self, 18) | ||
} | ||
#[doc = "Bits 24:25"] | ||
#[inline(always)] | ||
pub fn interface(&mut self) -> INTERFACE_W<ADDR_HIGH_SPEC> { | ||
INTERFACE_W::new(self, 24) | ||
} | ||
#[doc = "Bits 30:31"] | ||
#[inline(always)] | ||
pub fn supplicant_key_index(&mut self) -> SUPPLICANT_KEY_INDEX_W<ADDR_HIGH_SPEC> { | ||
SUPPLICANT_KEY_INDEX_W::new(self, 30) | ||
} | ||
} | ||
#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`addr_high::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`addr_high::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] | ||
pub struct ADDR_HIGH_SPEC; | ||
impl crate::RegisterSpec for ADDR_HIGH_SPEC { | ||
type Ux = u32; | ||
} | ||
#[doc = "`read()` method returns [`addr_high::R`](R) reader structure"] | ||
impl crate::Readable for ADDR_HIGH_SPEC {} | ||
#[doc = "`write(|w| ..)` method takes [`addr_high::W`](W) writer structure"] | ||
impl crate::Writable for ADDR_HIGH_SPEC { | ||
type Safety = crate::Unsafe; | ||
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0; | ||
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0; | ||
} | ||
#[doc = "`reset()` method sets ADDR_HIGH to value 0"] | ||
impl crate::Resettable for ADDR_HIGH_SPEC { | ||
const RESET_VALUE: u32 = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#[doc = "Register `ADDR_LOW` reader"] | ||
pub type R = crate::R<ADDR_LOW_SPEC>; | ||
#[doc = "Register `ADDR_LOW` writer"] | ||
pub type W = crate::W<ADDR_LOW_SPEC>; | ||
#[cfg(feature = "impl-register-debug")] | ||
impl core::fmt::Debug for R { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
write!(f, "{}", self.bits()) | ||
} | ||
} | ||
impl W {} | ||
#[doc = "\n\nYou can [`read`](crate::Reg::read) this register and get [`addr_low::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`addr_low::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] | ||
pub struct ADDR_LOW_SPEC; | ||
impl crate::RegisterSpec for ADDR_LOW_SPEC { | ||
type Ux = u32; | ||
} | ||
#[doc = "`read()` method returns [`addr_low::R`](R) reader structure"] | ||
impl crate::Readable for ADDR_LOW_SPEC {} | ||
#[doc = "`write(|w| ..)` method takes [`addr_low::W`](W) writer structure"] | ||
impl crate::Writable for ADDR_LOW_SPEC { | ||
type Safety = crate::Unsafe; | ||
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0; | ||
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0; | ||
} | ||
#[doc = "`reset()` method sets ADDR_LOW to value 0"] | ||
impl crate::Resettable for ADDR_LOW_SPEC { | ||
const RESET_VALUE: u32 = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#[doc = "Register `CTRL` reader"] | ||
pub type R = crate::R<CTRL_SPEC>; | ||
#[doc = "Register `CTRL` writer"] | ||
pub type W = crate::W<CTRL_SPEC>; | ||
#[cfg(feature = "impl-register-debug")] | ||
impl core::fmt::Debug for R { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
write!(f, "{}", self.bits()) | ||
} | ||
} | ||
impl W {} | ||
#[doc = "Exact name and meaning unknown, used for initializing the MAC\n\nYou can [`read`](crate::Reg::read) this register and get [`ctrl::R`](R). You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`ctrl::W`](W). You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] | ||
pub struct CTRL_SPEC; | ||
impl crate::RegisterSpec for CTRL_SPEC { | ||
type Ux = u32; | ||
} | ||
#[doc = "`read()` method returns [`ctrl::R`](R) reader structure"] | ||
impl crate::Readable for CTRL_SPEC {} | ||
#[doc = "`write(|w| ..)` method takes [`ctrl::W`](W) writer structure"] | ||
impl crate::Writable for CTRL_SPEC { | ||
type Safety = crate::Unsafe; | ||
const ZERO_TO_MODIFY_FIELDS_BITMAP: u32 = 0; | ||
const ONE_TO_MODIFY_FIELDS_BITMAP: u32 = 0; | ||
} | ||
#[doc = "`reset()` method sets CTRL to value 0"] | ||
impl crate::Resettable for CTRL_SPEC { | ||
const RESET_VALUE: u32 = 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#[repr(C)] | ||
#[cfg_attr(feature = "impl-register-debug", derive(Debug))] | ||
#[doc = "Filter banks for frame reception. Bank zero is for the BSSID and bank one for the RA. Each filter bank has registers for two interfaces."] | ||
pub struct FILTER_BANK { | ||
addr_low: (), | ||
_reserved1: [u8; 0x04], | ||
addr_high: (), | ||
_reserved2: [u8; 0x1c], | ||
mask_low: (), | ||
_reserved3: [u8; 0x04], | ||
mask_high: (), | ||
_reserved_end: [u8; 0x1c], | ||
} | ||
impl FILTER_BANK { | ||
#[doc = "0x00..0x08 - First 4 bytes of BSSID MAC address filter"] | ||
#[inline(always)] | ||
pub const fn addr_low(&self, n: usize) -> &ADDR_LOW { | ||
#[allow(clippy::no_effect)] | ||
[(); 2][n]; | ||
unsafe { &*core::ptr::from_ref(self).cast::<u8>().add(8 * n).cast() } | ||
} | ||
#[doc = "Iterator for array of:"] | ||
#[doc = "0x00..0x08 - First 4 bytes of BSSID MAC address filter"] | ||
#[inline(always)] | ||
pub fn addr_low_iter(&self) -> impl Iterator<Item = &ADDR_LOW> { | ||
(0..2).map(move |n| unsafe { &*core::ptr::from_ref(self).cast::<u8>().add(8 * n).cast() }) | ||
} | ||
#[doc = "0x04..0x0c - last 2 bytes of BSSID MAC address filter"] | ||
#[inline(always)] | ||
pub const fn addr_high(&self, n: usize) -> &ADDR_HIGH { | ||
#[allow(clippy::no_effect)] | ||
[(); 2][n]; | ||
unsafe { | ||
&*core::ptr::from_ref(self) | ||
.cast::<u8>() | ||
.add(4) | ||
.add(8 * n) | ||
.cast() | ||
} | ||
} | ||
#[doc = "Iterator for array of:"] | ||
#[doc = "0x04..0x0c - last 2 bytes of BSSID MAC address filter"] | ||
#[inline(always)] | ||
pub fn addr_high_iter(&self) -> impl Iterator<Item = &ADDR_HIGH> { | ||
(0..2).map(move |n| unsafe { | ||
&*core::ptr::from_ref(self) | ||
.cast::<u8>() | ||
.add(4) | ||
.add(8 * n) | ||
.cast() | ||
}) | ||
} | ||
#[doc = "0x20..0x28 - First 4 bytes of BSSID MAC address filter mask"] | ||
#[inline(always)] | ||
pub const fn mask_low(&self, n: usize) -> &MASK_LOW { | ||
#[allow(clippy::no_effect)] | ||
[(); 2][n]; | ||
unsafe { | ||
&*core::ptr::from_ref(self) | ||
.cast::<u8>() | ||
.add(32) | ||
.add(8 * n) | ||
.cast() | ||
} | ||
} | ||
#[doc = "Iterator for array of:"] | ||
#[doc = "0x20..0x28 - First 4 bytes of BSSID MAC address filter mask"] | ||
#[inline(always)] | ||
pub fn mask_low_iter(&self) -> impl Iterator<Item = &MASK_LOW> { | ||
(0..2).map(move |n| unsafe { | ||
&*core::ptr::from_ref(self) | ||
.cast::<u8>() | ||
.add(32) | ||
.add(8 * n) | ||
.cast() | ||
}) | ||
} | ||
#[doc = "0x24..0x2c - last 2 bytes of BSSID MAC address filter mask"] | ||
#[inline(always)] | ||
pub const fn mask_high(&self, n: usize) -> &MASK_HIGH { | ||
#[allow(clippy::no_effect)] | ||
[(); 2][n]; | ||
unsafe { | ||
&*core::ptr::from_ref(self) | ||
.cast::<u8>() | ||
.add(36) | ||
.add(8 * n) | ||
.cast() | ||
} | ||
} | ||
#[doc = "Iterator for array of:"] | ||
#[doc = "0x24..0x2c - last 2 bytes of BSSID MAC address filter mask"] | ||
#[inline(always)] | ||
pub fn mask_high_iter(&self) -> impl Iterator<Item = &MASK_HIGH> { | ||
(0..2).map(move |n| unsafe { | ||
&*core::ptr::from_ref(self) | ||
.cast::<u8>() | ||
.add(36) | ||
.add(8 * n) | ||
.cast() | ||
}) | ||
} | ||
} | ||
#[doc = "ADDR_LOW (rw) register accessor: First 4 bytes of BSSID MAC address filter\n\nYou can [`read`](crate::Reg::read) this register and get [`addr_low::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`addr_low::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@addr_low`] module"] | ||
pub type ADDR_LOW = crate::Reg<addr_low::ADDR_LOW_SPEC>; | ||
#[doc = "First 4 bytes of BSSID MAC address filter"] | ||
pub mod addr_low; | ||
#[doc = "ADDR_HIGH (rw) register accessor: last 2 bytes of BSSID MAC address filter\n\nYou can [`read`](crate::Reg::read) this register and get [`addr_high::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`addr_high::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@addr_high`] module"] | ||
pub type ADDR_HIGH = crate::Reg<addr_high::ADDR_HIGH_SPEC>; | ||
#[doc = "last 2 bytes of BSSID MAC address filter"] | ||
pub mod addr_high; | ||
#[doc = "MASK_LOW (rw) register accessor: First 4 bytes of BSSID MAC address filter mask\n\nYou can [`read`](crate::Reg::read) this register and get [`mask_low::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mask_low::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@mask_low`] module"] | ||
pub type MASK_LOW = crate::Reg<mask_low::MASK_LOW_SPEC>; | ||
#[doc = "First 4 bytes of BSSID MAC address filter mask"] | ||
pub mod mask_low; | ||
#[doc = "MASK_HIGH (rw) register accessor: last 2 bytes of BSSID MAC address filter mask\n\nYou can [`read`](crate::Reg::read) this register and get [`mask_high::R`]. You can [`reset`](crate::Reg::reset), [`write`](crate::Reg::write), [`write_with_zero`](crate::Reg::write_with_zero) this register using [`mask_high::W`]. You can also [`modify`](crate::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@mask_high`] module"] | ||
pub type MASK_HIGH = crate::Reg<mask_high::MASK_HIGH_SPEC>; | ||
#[doc = "last 2 bytes of BSSID MAC address filter mask"] | ||
pub mod mask_high; |
Oops, something went wrong.