@@ -2,11 +2,13 @@ use arbitrary_int::{u12, u2, u3, u4};
22
33#[ derive( Debug , thiserror:: Error ) ]
44#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
5+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
56#[ error( "invalid L1 entry type {0:?}" ) ]
67pub struct InvalidL1EntryType ( pub L1EntryType ) ;
78
89#[ bitbybit:: bitenum( u3, exhaustive = true ) ]
910#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
11+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
1012#[ derive( Debug , PartialEq , Eq ) ]
1113pub enum AccessPermissions {
1214 PermissionFault = 0b000 ,
@@ -40,6 +42,7 @@ impl AccessPermissions {
4042
4143#[ bitbybit:: bitenum( u2, exhaustive = true ) ]
4244#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
45+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
4346#[ derive( Debug , PartialEq , Eq ) ]
4447#[ repr( u8 ) ]
4548pub enum L1EntryType {
@@ -60,6 +63,7 @@ pub enum L1EntryType {
6063/// of the B, C, and TEX bits.
6164#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
6265#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
66+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
6367pub struct MemoryRegionAttributesRaw {
6468 /// TEX bits
6569 type_extensions : u3 ,
@@ -80,6 +84,7 @@ impl MemoryRegionAttributesRaw {
8084
8185#[ bitbybit:: bitenum( u2, exhaustive = true ) ]
8286#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
87+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
8388#[ derive( Debug ) ]
8489pub enum CacheableMemoryAttribute {
8590 NonCacheable = 0b00 ,
@@ -90,6 +95,7 @@ pub enum CacheableMemoryAttribute {
9095
9196#[ derive( Debug , Copy , Clone ) ]
9297#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
98+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
9399pub enum MemoryRegionAttributes {
94100 StronglyOrdered ,
95101 ShareableDevice ,
@@ -142,6 +148,7 @@ impl MemoryRegionAttributes {
142148/// Individual section attributes for a L1 section.
143149#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
144150#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
151+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
145152pub struct SectionAttributes {
146153 /// NG bit
147154 pub non_global : bool ,
@@ -205,7 +212,8 @@ impl SectionAttributes {
205212///
206213/// The ARM Cortex-A architecture programmers manual chapter 9.4 (p.163) or the ARMv7-A and ArmV7-R
207214/// architecture reference manual p.1323 specify these attributes in more detail.
208- #[ bitbybit:: bitfield( u32 , default = 0x00 ) ]
215+ #[ bitbybit:: bitfield( u32 , default = 0 , defmt_fields( feature = "defmt" ) ) ]
216+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
209217#[ derive( PartialEq , Eq ) ]
210218pub struct L1Section {
211219 /// Section base address upper bits.
0 commit comments