Skip to content

Commit

Permalink
ARMv6-M: remove fields that are not available from cpuid::RegisterBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
japaric committed May 11, 2018
1 parent 17bd0c8 commit 2cd6092
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- [breaking-change] removed the `iabr` field from `scb::RegisterBlock` on ARMv6-M. This register is
not available on that sub-architecture.

- [breaking-change] removed several fields from `cpuid::RegisterBlock` on ARMv6-M. These registers
are not available on that sub-architecture.

### Removed

- [breaking-change] The `exception` module has been removed. A replacement for `Exception::active`
Expand Down
62 changes: 44 additions & 18 deletions src/peripheral/cpuid.rs
Original file line number Diff line number Diff line change
@@ -1,40 +1,66 @@
//! CPUID

use volatile_register::RO;
#[cfg(any(armv7m, target_arch = "x86_64"))]
#[cfg(not(armv6m))]
use volatile_register::RW;

#[cfg(any(armv7m, target_arch = "x86_64"))]
#[cfg(not(armv6m))]
use peripheral::CPUID;

/// Register block
#[repr(C)]
pub struct RegisterBlock {
/// CPUID base
pub base: RO<u32>,
reserved0: [u32; 15],
/// Processor Feature

_reserved0: [u32; 15],

/// Processor Feature (not present on Cortex-M0 variants)
#[cfg(not(armv6m))]
pub pfr: [RO<u32>; 2],
/// Debug Feature
#[cfg(armv6m)]
_reserved1: [u32; 2],

/// Debug Feature (not present on Cortex-M0 variants)
#[cfg(not(armv6m))]
pub dfr: RO<u32>,
/// Auxiliary Feature
#[cfg(armv6m)]
_reserved2: u32,

/// Auxiliary Feature (not present on Cortex-M0 variants)
#[cfg(not(armv6m))]
pub afr: RO<u32>,
/// Memory Model Feature
#[cfg(armv6m)]
_reserved3: u32,

/// Memory Model Feature (not present on Cortex-M0 variants)
#[cfg(not(armv6m))]
pub mmfr: [RO<u32>; 4],
/// Instruction Set Attribute
#[cfg(armv6m)]
_reserved4: [u32; 4],

/// Instruction Set Attribute (not present on Cortex-M0 variants)
#[cfg(not(armv6m))]
pub isar: [RO<u32>; 5],
reserved1: u32,
/// Cache Level ID
#[cfg(any(armv7m, target_arch = "x86_64"))]
#[cfg(armv6m)]
_reserved5: [u32; 5],

_reserved6: u32,

/// Cache Level ID (only present on Cortex-M7)
#[cfg(not(armv6m))]
pub clidr: RO<u32>,
/// Cache Type
#[cfg(any(armv7m, target_arch = "x86_64"))]

/// Cache Type (only present on Cortex-M7)
#[cfg(not(armv6m))]
pub ctr: RO<u32>,
/// Cache Size ID
#[cfg(any(armv7m, target_arch = "x86_64"))]

/// Cache Size ID (only present on Cortex-M7)
#[cfg(not(armv6m))]
pub ccsidr: RO<u32>,
/// Cache Size Selection
#[cfg(any(armv7m, target_arch = "x86_64"))]

/// Cache Size Selection (only present on Cortex-M7)
#[cfg(not(armv6m))]
pub csselr: RW<u32>,
}

Expand All @@ -47,7 +73,7 @@ pub enum CsselrCacheType {
Instruction = 1,
}

#[cfg(any(armv7m, target_arch = "x86_64"))]
#[cfg(not(armv6m))]
impl CPUID {
/// Selects the current CCSIDR
///
Expand Down

0 comments on commit 2cd6092

Please sign in to comment.