@@ -2,11 +2,13 @@ use arbitrary_int::{u12, u2, u3, u4};
2
2
3
3
#[ derive( Debug , thiserror:: Error ) ]
4
4
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
5
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
5
6
#[ error( "invalid L1 entry type {0:?}" ) ]
6
7
pub struct InvalidL1EntryType ( pub L1EntryType ) ;
7
8
8
9
#[ bitbybit:: bitenum( u3, exhaustive = true ) ]
9
10
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
11
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
10
12
#[ derive( Debug , PartialEq , Eq ) ]
11
13
pub enum AccessPermissions {
12
14
PermissionFault = 0b000 ,
@@ -40,6 +42,7 @@ impl AccessPermissions {
40
42
41
43
#[ bitbybit:: bitenum( u2, exhaustive = true ) ]
42
44
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
45
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
43
46
#[ derive( Debug , PartialEq , Eq ) ]
44
47
#[ repr( u8 ) ]
45
48
pub enum L1EntryType {
@@ -60,6 +63,7 @@ pub enum L1EntryType {
60
63
/// of the B, C, and TEX bits.
61
64
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
62
65
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
66
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
63
67
pub struct MemoryRegionAttributesRaw {
64
68
/// TEX bits
65
69
type_extensions : u3 ,
@@ -80,6 +84,7 @@ impl MemoryRegionAttributesRaw {
80
84
81
85
#[ bitbybit:: bitenum( u2, exhaustive = true ) ]
82
86
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
87
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
83
88
#[ derive( Debug ) ]
84
89
pub enum CacheableMemoryAttribute {
85
90
NonCacheable = 0b00 ,
@@ -90,6 +95,7 @@ pub enum CacheableMemoryAttribute {
90
95
91
96
#[ derive( Debug , Copy , Clone ) ]
92
97
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
98
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
93
99
pub enum MemoryRegionAttributes {
94
100
StronglyOrdered ,
95
101
ShareableDevice ,
@@ -142,6 +148,7 @@ impl MemoryRegionAttributes {
142
148
/// Individual section attributes for a L1 section.
143
149
#[ derive( Debug , Copy , Clone , PartialEq , Eq ) ]
144
150
#[ cfg_attr( feature = "defmt" , derive( defmt:: Format ) ) ]
151
+ #[ cfg_attr( feature = "serde" , derive( serde:: Serialize , serde:: Deserialize ) ) ]
145
152
pub struct SectionAttributes {
146
153
/// NG bit
147
154
pub non_global : bool ,
@@ -205,7 +212,8 @@ impl SectionAttributes {
205
212
///
206
213
/// The ARM Cortex-A architecture programmers manual chapter 9.4 (p.163) or the ARMv7-A and ArmV7-R
207
214
/// 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 ) ) ]
209
217
#[ derive( PartialEq , Eq ) ]
210
218
pub struct L1Section {
211
219
/// Section base address upper bits.
0 commit comments