This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dmc: add DDR memory controller peripherals
Updates the DTS and `cmsis-svd-generator` to generate DDR memory controller CTRL and PHY peripheral registers.
- Loading branch information
Showing
11 changed files
with
503 additions
and
1 deletion.
There are no files selected for viewing
Submodule cmsis-svd-generator
updated
4 files
+13 −3 | generate_svd.py | |
+12 −0 | scripts/starfive_common.py | |
+22 −0 | scripts/starfive_jh7110_dmc_ctrl.py | |
+23 −0 | scripts/starfive_jh7110_dmc_phy.py |
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
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
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,40 @@ | ||
#[doc = r"Register block"] | ||
#[repr(C)] | ||
pub struct RegisterBlock { | ||
csr: [CSR; 1024], | ||
sec: [SEC; 1024], | ||
} | ||
impl RegisterBlock { | ||
#[doc = "0x00..0x1000 - DDR Memory Control CSR register"] | ||
#[inline(always)] | ||
pub const fn csr(&self, n: usize) -> &CSR { | ||
&self.csr[n] | ||
} | ||
#[doc = "Iterator for array of:"] | ||
#[doc = "0x00..0x1000 - DDR Memory Control CSR register"] | ||
#[inline(always)] | ||
pub fn csr_iter(&self) -> impl Iterator<Item = &CSR> { | ||
self.csr.iter() | ||
} | ||
#[doc = "0x1000..0x2000 - DDR Memory Control SEC register"] | ||
#[inline(always)] | ||
pub const fn sec(&self, n: usize) -> &SEC { | ||
&self.sec[n] | ||
} | ||
#[doc = "Iterator for array of:"] | ||
#[doc = "0x1000..0x2000 - DDR Memory Control SEC register"] | ||
#[inline(always)] | ||
pub fn sec_iter(&self) -> impl Iterator<Item = &SEC> { | ||
self.sec.iter() | ||
} | ||
} | ||
#[doc = "csr (rw) register accessor: DDR Memory Control CSR register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`csr::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`csr::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@csr`] | ||
module"] | ||
pub type CSR = crate::Reg<csr::CSR_SPEC>; | ||
#[doc = "DDR Memory Control CSR register"] | ||
pub mod csr; | ||
#[doc = "sec (rw) register accessor: DDR Memory Control SEC register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`sec::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`sec::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@sec`] | ||
module"] | ||
pub type SEC = crate::Reg<sec::SEC_SPEC>; | ||
#[doc = "DDR Memory Control SEC register"] | ||
pub mod sec; |
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,43 @@ | ||
#[doc = "Register `csr[%s]` reader"] | ||
pub type R = crate::R<CSR_SPEC>; | ||
#[doc = "Register `csr[%s]` writer"] | ||
pub type W = crate::W<CSR_SPEC>; | ||
impl core::fmt::Debug for R { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
write!(f, "{}", self.bits()) | ||
} | ||
} | ||
impl core::fmt::Debug for crate::generic::Reg<CSR_SPEC> { | ||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
core::fmt::Debug::fmt(&self.read(), f) | ||
} | ||
} | ||
impl W { | ||
#[doc = r" Writes raw bits to the register."] | ||
#[doc = r""] | ||
#[doc = r" # Safety"] | ||
#[doc = r""] | ||
#[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"] | ||
#[inline(always)] | ||
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { | ||
self.bits = bits; | ||
self | ||
} | ||
} | ||
#[doc = "DDR Memory Control CSR register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`csr::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`csr::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] | ||
pub struct CSR_SPEC; | ||
impl crate::RegisterSpec for CSR_SPEC { | ||
type Ux = u32; | ||
} | ||
#[doc = "`read()` method returns [`csr::R`](R) reader structure"] | ||
impl crate::Readable for CSR_SPEC {} | ||
#[doc = "`write(|w| ..)` method takes [`csr::W`](W) writer structure"] | ||
impl crate::Writable for CSR_SPEC { | ||
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; | ||
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; | ||
} | ||
#[doc = "`reset()` method sets csr[%s] | ||
to value 0"] | ||
impl crate::Resettable for CSR_SPEC { | ||
const RESET_VALUE: Self::Ux = 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,43 @@ | ||
#[doc = "Register `sec[%s]` reader"] | ||
pub type R = crate::R<SEC_SPEC>; | ||
#[doc = "Register `sec[%s]` writer"] | ||
pub type W = crate::W<SEC_SPEC>; | ||
impl core::fmt::Debug for R { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
write!(f, "{}", self.bits()) | ||
} | ||
} | ||
impl core::fmt::Debug for crate::generic::Reg<SEC_SPEC> { | ||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
core::fmt::Debug::fmt(&self.read(), f) | ||
} | ||
} | ||
impl W { | ||
#[doc = r" Writes raw bits to the register."] | ||
#[doc = r""] | ||
#[doc = r" # Safety"] | ||
#[doc = r""] | ||
#[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"] | ||
#[inline(always)] | ||
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { | ||
self.bits = bits; | ||
self | ||
} | ||
} | ||
#[doc = "DDR Memory Control SEC register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`sec::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`sec::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] | ||
pub struct SEC_SPEC; | ||
impl crate::RegisterSpec for SEC_SPEC { | ||
type Ux = u32; | ||
} | ||
#[doc = "`read()` method returns [`sec::R`](R) reader structure"] | ||
impl crate::Readable for SEC_SPEC {} | ||
#[doc = "`write(|w| ..)` method takes [`sec::W`](W) writer structure"] | ||
impl crate::Writable for SEC_SPEC { | ||
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; | ||
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; | ||
} | ||
#[doc = "`reset()` method sets sec[%s] | ||
to value 0"] | ||
impl crate::Resettable for SEC_SPEC { | ||
const RESET_VALUE: Self::Ux = 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,57 @@ | ||
#[doc = r"Register block"] | ||
#[repr(C)] | ||
pub struct RegisterBlock { | ||
csr: [CSR; 512], | ||
base: [BASE; 512], | ||
ac_base: [AC_BASE; 512], | ||
} | ||
impl RegisterBlock { | ||
#[doc = "0x00..0x800 - DDR Memory Control PHY CSR"] | ||
#[inline(always)] | ||
pub const fn csr(&self, n: usize) -> &CSR { | ||
&self.csr[n] | ||
} | ||
#[doc = "Iterator for array of:"] | ||
#[doc = "0x00..0x800 - DDR Memory Control PHY CSR"] | ||
#[inline(always)] | ||
pub fn csr_iter(&self) -> impl Iterator<Item = &CSR> { | ||
self.csr.iter() | ||
} | ||
#[doc = "0x800..0x1000 - DDR Memory Control PHY Base register"] | ||
#[inline(always)] | ||
pub const fn base(&self, n: usize) -> &BASE { | ||
&self.base[n] | ||
} | ||
#[doc = "Iterator for array of:"] | ||
#[doc = "0x800..0x1000 - DDR Memory Control PHY Base register"] | ||
#[inline(always)] | ||
pub fn base_iter(&self) -> impl Iterator<Item = &BASE> { | ||
self.base.iter() | ||
} | ||
#[doc = "0x1000..0x1800 - DDR Memory Control PHY AC Base register"] | ||
#[inline(always)] | ||
pub const fn ac_base(&self, n: usize) -> &AC_BASE { | ||
&self.ac_base[n] | ||
} | ||
#[doc = "Iterator for array of:"] | ||
#[doc = "0x1000..0x1800 - DDR Memory Control PHY AC Base register"] | ||
#[inline(always)] | ||
pub fn ac_base_iter(&self) -> impl Iterator<Item = &AC_BASE> { | ||
self.ac_base.iter() | ||
} | ||
} | ||
#[doc = "csr (rw) register accessor: DDR Memory Control PHY CSR\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`csr::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`csr::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@csr`] | ||
module"] | ||
pub type CSR = crate::Reg<csr::CSR_SPEC>; | ||
#[doc = "DDR Memory Control PHY CSR"] | ||
pub mod csr; | ||
#[doc = "base (rw) register accessor: DDR Memory Control PHY Base register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`base::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`base::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@base`] | ||
module"] | ||
pub type BASE = crate::Reg<base::BASE_SPEC>; | ||
#[doc = "DDR Memory Control PHY Base register"] | ||
pub mod base; | ||
#[doc = "ac_base (rw) register accessor: DDR Memory Control PHY AC Base register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ac_base::R`]. You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ac_base::W`]. You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [`mod@ac_base`] | ||
module"] | ||
pub type AC_BASE = crate::Reg<ac_base::AC_BASE_SPEC>; | ||
#[doc = "DDR Memory Control PHY AC Base register"] | ||
pub mod ac_base; |
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,43 @@ | ||
#[doc = "Register `ac_base[%s]` reader"] | ||
pub type R = crate::R<AC_BASE_SPEC>; | ||
#[doc = "Register `ac_base[%s]` writer"] | ||
pub type W = crate::W<AC_BASE_SPEC>; | ||
impl core::fmt::Debug for R { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
write!(f, "{}", self.bits()) | ||
} | ||
} | ||
impl core::fmt::Debug for crate::generic::Reg<AC_BASE_SPEC> { | ||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
core::fmt::Debug::fmt(&self.read(), f) | ||
} | ||
} | ||
impl W { | ||
#[doc = r" Writes raw bits to the register."] | ||
#[doc = r""] | ||
#[doc = r" # Safety"] | ||
#[doc = r""] | ||
#[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"] | ||
#[inline(always)] | ||
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { | ||
self.bits = bits; | ||
self | ||
} | ||
} | ||
#[doc = "DDR Memory Control PHY AC Base register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`ac_base::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`ac_base::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] | ||
pub struct AC_BASE_SPEC; | ||
impl crate::RegisterSpec for AC_BASE_SPEC { | ||
type Ux = u32; | ||
} | ||
#[doc = "`read()` method returns [`ac_base::R`](R) reader structure"] | ||
impl crate::Readable for AC_BASE_SPEC {} | ||
#[doc = "`write(|w| ..)` method takes [`ac_base::W`](W) writer structure"] | ||
impl crate::Writable for AC_BASE_SPEC { | ||
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; | ||
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; | ||
} | ||
#[doc = "`reset()` method sets ac_base[%s] | ||
to value 0"] | ||
impl crate::Resettable for AC_BASE_SPEC { | ||
const RESET_VALUE: Self::Ux = 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,43 @@ | ||
#[doc = "Register `base[%s]` reader"] | ||
pub type R = crate::R<BASE_SPEC>; | ||
#[doc = "Register `base[%s]` writer"] | ||
pub type W = crate::W<BASE_SPEC>; | ||
impl core::fmt::Debug for R { | ||
fn fmt(&self, f: &mut core::fmt::Formatter) -> core::fmt::Result { | ||
write!(f, "{}", self.bits()) | ||
} | ||
} | ||
impl core::fmt::Debug for crate::generic::Reg<BASE_SPEC> { | ||
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
core::fmt::Debug::fmt(&self.read(), f) | ||
} | ||
} | ||
impl W { | ||
#[doc = r" Writes raw bits to the register."] | ||
#[doc = r""] | ||
#[doc = r" # Safety"] | ||
#[doc = r""] | ||
#[doc = r" Passing incorrect value can cause undefined behaviour. See reference manual"] | ||
#[inline(always)] | ||
pub unsafe fn bits(&mut self, bits: u32) -> &mut Self { | ||
self.bits = bits; | ||
self | ||
} | ||
} | ||
#[doc = "DDR Memory Control PHY Base register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`base::R`](R). You can [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero) this register using [`base::W`](W). You can also [`modify`](crate::generic::Reg::modify) this register. See [API](https://docs.rs/svd2rust/#read--modify--write-api)."] | ||
pub struct BASE_SPEC; | ||
impl crate::RegisterSpec for BASE_SPEC { | ||
type Ux = u32; | ||
} | ||
#[doc = "`read()` method returns [`base::R`](R) reader structure"] | ||
impl crate::Readable for BASE_SPEC {} | ||
#[doc = "`write(|w| ..)` method takes [`base::W`](W) writer structure"] | ||
impl crate::Writable for BASE_SPEC { | ||
const ZERO_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; | ||
const ONE_TO_MODIFY_FIELDS_BITMAP: Self::Ux = 0; | ||
} | ||
#[doc = "`reset()` method sets base[%s] | ||
to value 0"] | ||
impl crate::Resettable for BASE_SPEC { | ||
const RESET_VALUE: Self::Ux = 0; | ||
} |
Oops, something went wrong.