Skip to content

Commit

Permalink
Ccbuf dith4 mode svd patch (#428)
Browse files Browse the repository at this point in the history
* update SVD patch files and script

* results from running update script with SVD patches

Co-authored-by: Tyler Holmes <[email protected]>
  • Loading branch information
TDHolmes and Tyler Holmes authored Apr 11, 2021
1 parent db1f9b7 commit 661c1b3
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 49 deletions.
24 changes: 12 additions & 12 deletions pac/atsamd51g/src/tcc0/ccbuf_dith4_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,52 @@ impl crate::ResetValue for super::CCBUF_DITH4_MODE {
}
}
#[doc = "Reader of field `CCBUF`"]
pub type CCBUF_R = crate::R<u8, u8>;
pub type CCBUF_R = crate::R<u32, u32>;
#[doc = "Write proxy for field `CCBUF`"]
pub struct CCBUF_W<'a> {
w: &'a mut W,
}
impl<'a> CCBUF_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x000f_ffff << 4)) | (((value as u32) & 0x000f_ffff) << 4);
self.w
}
}
#[doc = "Reader of field `DITHERBUF`"]
pub type DITHERBUF_R = crate::R<u32, u32>;
pub type DITHERBUF_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `DITHERBUF`"]
pub struct DITHERBUF_W<'a> {
w: &'a mut W,
}
impl<'a> DITHERBUF_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x000f_ffff << 4)) | (((value as u32) & 0x000f_ffff) << 4);
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
self.w
}
}
impl R {
#[doc = "Bits 0:3 - Channel Compare/Capture Buffer Value"]
#[doc = "Bits 4:23 - Channel Compare/Capture Buffer Value"]
#[inline(always)]
pub fn ccbuf(&self) -> CCBUF_R {
CCBUF_R::new((self.bits & 0x0f) as u8)
CCBUF_R::new(((self.bits >> 4) & 0x000f_ffff) as u32)
}
#[doc = "Bits 4:23 - Dithering Buffer Cycle Number"]
#[doc = "Bits 0:3 - Dithering Buffer Cycle Number"]
#[inline(always)]
pub fn ditherbuf(&self) -> DITHERBUF_R {
DITHERBUF_R::new(((self.bits >> 4) & 0x000f_ffff) as u32)
DITHERBUF_R::new((self.bits & 0x0f) as u8)
}
}
impl W {
#[doc = "Bits 0:3 - Channel Compare/Capture Buffer Value"]
#[doc = "Bits 4:23 - Channel Compare/Capture Buffer Value"]
#[inline(always)]
pub fn ccbuf(&mut self) -> CCBUF_W {
CCBUF_W { w: self }
}
#[doc = "Bits 4:23 - Dithering Buffer Cycle Number"]
#[doc = "Bits 0:3 - Dithering Buffer Cycle Number"]
#[inline(always)]
pub fn ditherbuf(&mut self) -> DITHERBUF_W {
DITHERBUF_W { w: self }
Expand Down
24 changes: 12 additions & 12 deletions pac/atsamd51j/src/tcc0/ccbuf_dith4_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,52 @@ impl crate::ResetValue for super::CCBUF_DITH4_MODE {
}
}
#[doc = "Reader of field `CCBUF`"]
pub type CCBUF_R = crate::R<u8, u8>;
pub type CCBUF_R = crate::R<u32, u32>;
#[doc = "Write proxy for field `CCBUF`"]
pub struct CCBUF_W<'a> {
w: &'a mut W,
}
impl<'a> CCBUF_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x000f_ffff << 4)) | (((value as u32) & 0x000f_ffff) << 4);
self.w
}
}
#[doc = "Reader of field `DITHERBUF`"]
pub type DITHERBUF_R = crate::R<u32, u32>;
pub type DITHERBUF_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `DITHERBUF`"]
pub struct DITHERBUF_W<'a> {
w: &'a mut W,
}
impl<'a> DITHERBUF_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x000f_ffff << 4)) | (((value as u32) & 0x000f_ffff) << 4);
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
self.w
}
}
impl R {
#[doc = "Bits 0:3 - Channel Compare/Capture Buffer Value"]
#[doc = "Bits 4:23 - Channel Compare/Capture Buffer Value"]
#[inline(always)]
pub fn ccbuf(&self) -> CCBUF_R {
CCBUF_R::new((self.bits & 0x0f) as u8)
CCBUF_R::new(((self.bits >> 4) & 0x000f_ffff) as u32)
}
#[doc = "Bits 4:23 - Dithering Buffer Cycle Number"]
#[doc = "Bits 0:3 - Dithering Buffer Cycle Number"]
#[inline(always)]
pub fn ditherbuf(&self) -> DITHERBUF_R {
DITHERBUF_R::new(((self.bits >> 4) & 0x000f_ffff) as u32)
DITHERBUF_R::new((self.bits & 0x0f) as u8)
}
}
impl W {
#[doc = "Bits 0:3 - Channel Compare/Capture Buffer Value"]
#[doc = "Bits 4:23 - Channel Compare/Capture Buffer Value"]
#[inline(always)]
pub fn ccbuf(&mut self) -> CCBUF_W {
CCBUF_W { w: self }
}
#[doc = "Bits 4:23 - Dithering Buffer Cycle Number"]
#[doc = "Bits 0:3 - Dithering Buffer Cycle Number"]
#[inline(always)]
pub fn ditherbuf(&mut self) -> DITHERBUF_W {
DITHERBUF_W { w: self }
Expand Down
24 changes: 12 additions & 12 deletions pac/atsame51g/src/tcc0/ccbuf_dith4_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,52 @@ impl crate::ResetValue for super::CCBUF_DITH4_MODE {
}
}
#[doc = "Reader of field `CCBUF`"]
pub type CCBUF_R = crate::R<u8, u8>;
pub type CCBUF_R = crate::R<u32, u32>;
#[doc = "Write proxy for field `CCBUF`"]
pub struct CCBUF_W<'a> {
w: &'a mut W,
}
impl<'a> CCBUF_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x000f_ffff << 4)) | (((value as u32) & 0x000f_ffff) << 4);
self.w
}
}
#[doc = "Reader of field `DITHERBUF`"]
pub type DITHERBUF_R = crate::R<u32, u32>;
pub type DITHERBUF_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `DITHERBUF`"]
pub struct DITHERBUF_W<'a> {
w: &'a mut W,
}
impl<'a> DITHERBUF_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x000f_ffff << 4)) | (((value as u32) & 0x000f_ffff) << 4);
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
self.w
}
}
impl R {
#[doc = "Bits 0:3 - Channel Compare/Capture Buffer Value"]
#[doc = "Bits 4:23 - Channel Compare/Capture Buffer Value"]
#[inline(always)]
pub fn ccbuf(&self) -> CCBUF_R {
CCBUF_R::new((self.bits & 0x0f) as u8)
CCBUF_R::new(((self.bits >> 4) & 0x000f_ffff) as u32)
}
#[doc = "Bits 4:23 - Dithering Buffer Cycle Number"]
#[doc = "Bits 0:3 - Dithering Buffer Cycle Number"]
#[inline(always)]
pub fn ditherbuf(&self) -> DITHERBUF_R {
DITHERBUF_R::new(((self.bits >> 4) & 0x000f_ffff) as u32)
DITHERBUF_R::new((self.bits & 0x0f) as u8)
}
}
impl W {
#[doc = "Bits 0:3 - Channel Compare/Capture Buffer Value"]
#[doc = "Bits 4:23 - Channel Compare/Capture Buffer Value"]
#[inline(always)]
pub fn ccbuf(&mut self) -> CCBUF_W {
CCBUF_W { w: self }
}
#[doc = "Bits 4:23 - Dithering Buffer Cycle Number"]
#[doc = "Bits 0:3 - Dithering Buffer Cycle Number"]
#[inline(always)]
pub fn ditherbuf(&mut self) -> DITHERBUF_W {
DITHERBUF_W { w: self }
Expand Down
24 changes: 12 additions & 12 deletions pac/atsame51j/src/tcc0/ccbuf_dith4_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,52 +12,52 @@ impl crate::ResetValue for super::CCBUF_DITH4_MODE {
}
}
#[doc = "Reader of field `CCBUF`"]
pub type CCBUF_R = crate::R<u8, u8>;
pub type CCBUF_R = crate::R<u32, u32>;
#[doc = "Write proxy for field `CCBUF`"]
pub struct CCBUF_W<'a> {
w: &'a mut W,
}
impl<'a> CCBUF_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x000f_ffff << 4)) | (((value as u32) & 0x000f_ffff) << 4);
self.w
}
}
#[doc = "Reader of field `DITHERBUF`"]
pub type DITHERBUF_R = crate::R<u32, u32>;
pub type DITHERBUF_R = crate::R<u8, u8>;
#[doc = "Write proxy for field `DITHERBUF`"]
pub struct DITHERBUF_W<'a> {
w: &'a mut W,
}
impl<'a> DITHERBUF_W<'a> {
#[doc = r"Writes raw bits to the field"]
#[inline(always)]
pub unsafe fn bits(self, value: u32) -> &'a mut W {
self.w.bits = (self.w.bits & !(0x000f_ffff << 4)) | (((value as u32) & 0x000f_ffff) << 4);
pub unsafe fn bits(self, value: u8) -> &'a mut W {
self.w.bits = (self.w.bits & !0x0f) | ((value as u32) & 0x0f);
self.w
}
}
impl R {
#[doc = "Bits 0:3 - Channel Compare/Capture Buffer Value"]
#[doc = "Bits 4:23 - Channel Compare/Capture Buffer Value"]
#[inline(always)]
pub fn ccbuf(&self) -> CCBUF_R {
CCBUF_R::new((self.bits & 0x0f) as u8)
CCBUF_R::new(((self.bits >> 4) & 0x000f_ffff) as u32)
}
#[doc = "Bits 4:23 - Dithering Buffer Cycle Number"]
#[doc = "Bits 0:3 - Dithering Buffer Cycle Number"]
#[inline(always)]
pub fn ditherbuf(&self) -> DITHERBUF_R {
DITHERBUF_R::new(((self.bits >> 4) & 0x000f_ffff) as u32)
DITHERBUF_R::new((self.bits & 0x0f) as u8)
}
}
impl W {
#[doc = "Bits 0:3 - Channel Compare/Capture Buffer Value"]
#[doc = "Bits 4:23 - Channel Compare/Capture Buffer Value"]
#[inline(always)]
pub fn ccbuf(&mut self) -> CCBUF_W {
CCBUF_W { w: self }
}
#[doc = "Bits 4:23 - Dithering Buffer Cycle Number"]
#[doc = "Bits 0:3 - Dithering Buffer Cycle Number"]
#[inline(always)]
pub fn ditherbuf(&mut self) -> DITHERBUF_W {
DITHERBUF_W { w: self }
Expand Down
1 change: 1 addition & 0 deletions svd/devices/atsamd51g19a.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="include/common.xsl"/>
<xsl:include href="include/atsamd5x.xsl"/>
<xsl:include href="include/atsamd51jg.xsl"/>
</xsl:stylesheet>
1 change: 1 addition & 0 deletions svd/devices/atsamd51j19a.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="include/common.xsl"/>
<xsl:include href="include/atsamd5x.xsl"/>
<xsl:include href="include/atsamd51jg.xsl"/>
</xsl:stylesheet>
1 change: 1 addition & 0 deletions svd/devices/atsame51g18a.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="include/common.xsl"/>
<xsl:include href="include/atsamd5x.xsl"/>
<xsl:include href="include/atsamd51jg.xsl"/>
</xsl:stylesheet>
1 change: 1 addition & 0 deletions svd/devices/atsame51j18a.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="include/common.xsl"/>
<xsl:include href="include/atsamd5x.xsl"/>
<xsl:include href="include/atsamd51jg.xsl"/>
</xsl:stylesheet>
17 changes: 17 additions & 0 deletions svd/devices/include/atsamd51jg.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<!-- CCBUF & DITHERBUF wrong offset & size for CCBUF_DITH4_MODE -->
<xsl:template match="/device/peripherals/peripheral[name='TCC0']/registers/register[name='CCBUF_DITH4_MODE[%s]']/fields/field[name='DITHERBUF']/bitOffset">
<bitOffset>0</bitOffset>
</xsl:template>
<xsl:template match="/device/peripherals/peripheral[name='TCC0']/registers/register[name='CCBUF_DITH4_MODE[%s]']/fields/field[name='DITHERBUF']/bitWidth">
<bitWidth>4</bitWidth>
</xsl:template>
<xsl:template match="/device/peripherals/peripheral[name='TCC0']/registers/register[name='CCBUF_DITH4_MODE[%s]']/fields/field[name='CCBUF']/bitOffset">
<bitOffset>4</bitOffset>
</xsl:template>
<xsl:template match="/device/peripherals/peripheral[name='TCC0']/registers/register[name='CCBUF_DITH4_MODE[%s]']/fields/field[name='CCBUF']/bitWidth">
<bitWidth>20</bitWidth>
</xsl:template>
</xsl:stylesheet>
8 changes: 7 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ for xsl in svd/devices/*\.xsl; do
CHIP=$(echo "${chip}" | tr '[:lower:]' '[:upper:]')
svd=svd/${CHIP:0:9}.svd
cp "svd/${CHIP}.svd" "$svd"

# remove last characters, because they just represent the memory size
pushd "${TOP}/pac/${chip:0:9}"

Expand All @@ -30,9 +30,15 @@ for xsl in svd/devices/*\.xsl; do
rm -rf src/
form -i lib.rs -o src
rm lib.rs

# remove last characters, because they just represent the memory size
${SED} -i "s/${CHIP}/${CHIP:0:9}/g" src/lib.rs

cargo +nightly fmt
rustfmt +nightly build.rs

# ignore all clippy warnings/errors in auto-generated code
${SED} -i "s/#\!\[no_std\]/#\!\[allow\(clippy::all\)\]\n#\!\[no_std\]/g" src/lib.rs

popd
done

0 comments on commit 661c1b3

Please sign in to comment.