Skip to content

Commit c921d43

Browse files
committed
Auto merge of #80 - japaric:send, r=japaric
impl Send for all the peripherals closes #79
2 parents 7ab9cf4 + 1aee43c commit c921d43

File tree

3 files changed

+38
-5
lines changed

3 files changed

+38
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
## [v0.4.2] - 2018-01-17
11+
12+
### Fixed
13+
14+
- Added a missing `Send` implementation to all the peripherals.
15+
1016
## [v0.4.1] - 2018-01-16
1117

1218
### Changed
@@ -385,7 +391,8 @@ fn main() {
385391
- Functions to get the vector table
386392
- Wrappers over miscellaneous instructions like `bkpt`
387393

388-
[Unreleased]: https://github.com/japaric/cortex-m/compare/v0.4.1...HEAD
394+
[Unreleased]: https://github.com/japaric/cortex-m/compare/v0.4.2...HEAD
395+
[v0.4.2]: https://github.com/japaric/cortex-m/compare/v0.4.1...v0.4.2
389396
[v0.4.1]: https://github.com/japaric/cortex-m/compare/v0.4.0...v0.4.1
390397
[v0.4.0]: https://github.com/japaric/cortex-m/compare/v0.3.1...v0.4.0
391398
[v0.3.1]: https://github.com/japaric/cortex-m/compare/v0.3.0...v0.3.1

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ keywords = ["arm", "cortex-m", "register", "peripheral"]
77
license = "MIT OR Apache-2.0"
88
name = "cortex-m"
99
repository = "https://github.com/japaric/cortex-m"
10-
version = "0.4.1"
10+
version = "0.4.2"
1111

1212
[dependencies]
1313
aligned = "0.1.1"

src/peripheral/mod.rs

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ pub struct CBP {
220220
_marker: PhantomData<*const ()>,
221221
}
222222

223+
#[cfg(any(armv7m, target_arch = "x86_64"))]
224+
unsafe impl Send for CBP {}
225+
223226
#[cfg(any(armv7m, target_arch = "x86_64"))]
224227
impl CBP {
225228
pub(crate) unsafe fn new() -> Self {
@@ -234,9 +237,6 @@ impl CBP {
234237
}
235238
}
236239

237-
#[cfg(any(armv7m, target_arch = "x86_64"))]
238-
unsafe impl Send for CBP {}
239-
240240
#[cfg(any(armv7m, target_arch = "x86_64"))]
241241
impl ops::Deref for CBP {
242242
type Target = self::cbp::RegisterBlock;
@@ -251,6 +251,8 @@ pub struct CPUID {
251251
_marker: PhantomData<*const ()>,
252252
}
253253

254+
unsafe impl Send for CPUID {}
255+
254256
impl CPUID {
255257
/// Returns a pointer to the register block
256258
pub fn ptr() -> *const self::cpuid::RegisterBlock {
@@ -271,6 +273,8 @@ pub struct DCB {
271273
_marker: PhantomData<*const ()>,
272274
}
273275

276+
unsafe impl Send for DCB {}
277+
274278
impl DCB {
275279
/// Returns a pointer to the register block
276280
pub fn ptr() -> *const dcb::RegisterBlock {
@@ -291,6 +295,8 @@ pub struct DWT {
291295
_marker: PhantomData<*const ()>,
292296
}
293297

298+
unsafe impl Send for DWT {}
299+
294300
impl DWT {
295301
/// Returns a pointer to the register block
296302
pub fn ptr() -> *const dwt::RegisterBlock {
@@ -314,6 +320,9 @@ pub struct FPB {
314320
_marker: PhantomData<*const ()>,
315321
}
316322

323+
#[cfg(any(armv7m, target_arch = "x86_64"))]
324+
unsafe impl Send for FPB {}
325+
317326
#[cfg(any(armv7m, target_arch = "x86_64"))]
318327
impl FPB {
319328
/// Returns a pointer to the register block
@@ -339,6 +348,9 @@ pub struct FPU {
339348
_marker: PhantomData<*const ()>,
340349
}
341350

351+
#[cfg(any(has_fpu, target_arch = "x86_64"))]
352+
unsafe impl Send for FPU {}
353+
342354
#[cfg(any(has_fpu, target_arch = "x86_64"))]
343355
impl FPU {
344356
/// Returns a pointer to the register block
@@ -364,6 +376,9 @@ pub struct ITM {
364376
_marker: PhantomData<*const ()>,
365377
}
366378

379+
#[cfg(any(armv7m, target_arch = "x86_64"))]
380+
unsafe impl Send for ITM {}
381+
367382
#[cfg(any(armv7m, target_arch = "x86_64"))]
368383
impl ITM {
369384
/// Returns a pointer to the register block
@@ -393,6 +408,8 @@ pub struct MPU {
393408
_marker: PhantomData<*const ()>,
394409
}
395410

411+
unsafe impl Send for MPU {}
412+
396413
impl MPU {
397414
/// Returns a pointer to the register block
398415
pub fn ptr() -> *const mpu::RegisterBlock {
@@ -413,6 +430,8 @@ pub struct NVIC {
413430
_marker: PhantomData<*const ()>,
414431
}
415432

433+
unsafe impl Send for NVIC {}
434+
416435
impl NVIC {
417436
/// Returns a pointer to the register block
418437
pub fn ptr() -> *const nvic::RegisterBlock {
@@ -433,6 +452,8 @@ pub struct SCB {
433452
_marker: PhantomData<*const ()>,
434453
}
435454

455+
unsafe impl Send for SCB {}
456+
436457
impl SCB {
437458
/// Returns a pointer to the register block
438459
pub fn ptr() -> *const scb::RegisterBlock {
@@ -453,6 +474,8 @@ pub struct SYST {
453474
_marker: PhantomData<*const ()>,
454475
}
455476

477+
unsafe impl Send for SYST {}
478+
456479
impl SYST {
457480
/// Returns a pointer to the register block
458481
pub fn ptr() -> *const syst::RegisterBlock {
@@ -476,6 +499,9 @@ pub struct TPIU {
476499
_marker: PhantomData<*const ()>,
477500
}
478501

502+
#[cfg(any(armv7m, target_arch = "x86_64"))]
503+
unsafe impl Send for TPIU {}
504+
479505
#[cfg(any(armv7m, target_arch = "x86_64"))]
480506
impl TPIU {
481507
/// Returns a pointer to the register block

0 commit comments

Comments
 (0)