blob: f90a265e4ea0865277817301b5b13aea71331b9e [file] [log] [blame]
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated register constants for smc_ctrl.
// This file is licensed under either of:
// Apache License, Version 2.0 (LICENSE-APACHE <http://www.apache.org/licenses/LICENSE-2.0>)
// MIT License (LICENSE-MIT <http://opensource.org/licenses/MIT>)
// Build date: 2023-02-22T01:20:33.682585
// Original reference file: hw/matcha/hw/top_matcha/ip/smc_ctrl/data/smc_ctrl.hjson
use kernel::common::registers::{
register_bitfields, register_structs, ReadWrite
};
use kernel::common::StaticRef;
// Register width
pub const SMC_CTRL_PARAM_REG_WIDTH: u32 = 32;
pub const SMC_CTRL_REGISTERS: StaticRef<SmcCtrlRegisters> =
unsafe { StaticRef::new(matcha_config::SMC_CTRL_BASE_ADDRESS as *const SmcCtrlRegisters) };
pub static mut SMC_CTRL: SmcCtrl = SmcCtrl::new(SMC_CTRL_REGISTERS /*, matcha_config::CHIP_PERIPH_FREQ*/);
register_structs! {
pub SmcCtrlRegisters {
// Register write enable for software controllable boot enable.
(0x0000 => pub(crate) smc_boot_en_regwen: ReadWrite<u32, SMC_BOOT_EN_REGWEN::Register>),
// Software controllable boot enable.
(0x0004 => pub(crate) smc_boot_en_ctrl: ReadWrite<u32, SMC_BOOT_EN_CTRL::Register>),
(0x0008 => @END),
}
}
register_bitfields![u32,
pub(crate) SMC_BOOT_EN_REGWEN [
REGWEN OFFSET(0) NUMBITS(1) []
],
pub(crate) SMC_BOOT_EN_CTRL [
EN_CTRL OFFSET(0) NUMBITS(1) []
]
];
// End generated register constants for smc_ctrl
pub struct SmcCtrl {
registers: StaticRef<SmcCtrlRegisters>,
}
pub trait SmcCtrlHal {
fn smc_ctrl_start(&self);
}
impl SmcCtrl {
pub const fn new(base: StaticRef<SmcCtrlRegisters>) -> SmcCtrl {
SmcCtrl {
registers: base,
}
}
}
impl SmcCtrlHal for SmcCtrl {
fn smc_ctrl_start(&self) {
self.registers.smc_boot_en_ctrl.modify(SMC_BOOT_EN_CTRL::EN_CTRL::SET);
}
}