cortex_a/registers/
oslar_el1.rs

1// SPDX-License-Identifier: Apache-2.0 OR MIT
2//
3// Copyright (c) 2018-2022 by the author(s)
4//
5// Author(s):
6//   - Andre Richter <andre.o.richter@gmail.com>
7//   - Javier Alvarez <javier.alvarez@allthingsembedded.net>
8
9//! OS Lock Access Register - EL1
10//!
11//! Used to lock or unlock the OS Lock.
12//!
13//! AArch64 System register `OSLAR_EL1` bits \[31:0\] are architecturally mapped to External
14//! register `OSLAR_EL1[31:0]`. The OS Lock can also be locked or unlocked using `DBGOSLAR`.
15
16use tock_registers::{
17    interfaces::{Readable, Writeable},
18    register_bitfields,
19};
20
21register_bitfields! {u64,
22    pub OSLAR_EL1 [
23        /// On writes to `OSLAR_EL1`, bit[0] is copied to the OS Lock.
24        /// Use `OSLSR_EL1.OSLK` to check the current status of the lock.
25        OSLK OFFSET(0) NUMBITS(1) [
26            Unlocked = 0,
27            Locked = 1
28        ]
29    ]
30}
31
32pub struct Reg;
33
34impl Readable for Reg {
35    type T = u64;
36    type R = OSLAR_EL1::Register;
37
38    sys_coproc_read_raw!(u64, "OSLAR_EL1", "x");
39}
40
41impl Writeable for Reg {
42    type T = u64;
43    type R = OSLAR_EL1::Register;
44
45    sys_coproc_write_raw!(u64, "OSLAR_EL1", "x");
46}
47
48pub const OSLAR_EL1: Reg = Reg {};