Skip to content
Snippets Groups Projects
Commit 06972c16 authored by Per's avatar Per
Browse files

lock public aligned

parent 63ce883e
Branches
Tags
No related merge requests found
...@@ -73,6 +73,7 @@ pub struct Dma2Channel6 { ...@@ -73,6 +73,7 @@ pub struct Dma2Channel6 {
// NOTE(packed) workaround for rust-lang/rust#41315 // NOTE(packed) workaround for rust-lang/rust#41315
#[repr(packed)] #[repr(packed)]
pub struct Buffer<T, CHANNEL> { pub struct Buffer<T, CHANNEL> {
#[repr(align(32))]
data: UnsafeCell<T>, data: UnsafeCell<T>,
flag: Cell<BorrowFlag>, flag: Cell<BorrowFlag>,
state: Cell<State>, state: Cell<State>,
...@@ -195,7 +196,9 @@ impl<T, CHANNEL> Buffer<T, CHANNEL> { ...@@ -195,7 +196,9 @@ impl<T, CHANNEL> Buffer<T, CHANNEL> {
} }
} }
pub(crate) fn lock(&self) -> &T { // shuould be pub(crate)
///
pub fn lock(&self) -> &T {
assert_eq!(self.state.get(), State::Unlocked); assert_eq!(self.state.get(), State::Unlocked);
assert_ne!(self.flag.get(), WRITING); assert_ne!(self.flag.get(), WRITING);
......
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
#![feature(get_type_id)] #![feature(get_type_id)]
#![feature(never_type)] #![feature(never_type)]
#![feature(unsize)] #![feature(unsize)]
#![feature(repr_align)]
#![feature(attr_literals)]
#![no_std] #![no_std]
extern crate cast; extern crate cast;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment