#[doc = r" Value read from the register"]
pub struct R {
bits: u32,
}
impl super::HCSPARAMS {
#[doc = r" Reads the contents of the register"]
#[inline]
pub fn read(&self) -> R {
R {
bits: self.register.get(),
}
}
}
#[doc = r" Value of the field"]
pub struct N_PORTSR {
bits: u8,
}
impl N_PORTSR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = "Possible values of the field `PPC`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PPCR {
#[doc = "Ports have power port switches"]
_1,
#[doc = r" Reserved"]
_Reserved(bool),
}
impl PPCR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
PPCR::_1 => true,
PPCR::_Reserved(bits) => bits,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> PPCR {
match value {
true => PPCR::_1,
i => PPCR::_Reserved(i),
}
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == PPCR::_1
}
}
#[doc = r" Value of the field"]
pub struct N_PCCR {
bits: u8,
}
impl N_PCCR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct N_CCR {
bits: u8,
}
impl N_CCR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = "Possible values of the field `PI`"]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum PIR {
#[doc = "No port indicator fields"]
_0,
#[doc = "The port status and control registers include a R/W field for controlling the state of the port indicator"]
_1,
}
impl PIR {
#[doc = r" Returns `true` if the bit is clear (0)"]
#[inline]
pub fn bit_is_clear(&self) -> bool {
!self.bit()
}
#[doc = r" Returns `true` if the bit is set (1)"]
#[inline]
pub fn bit_is_set(&self) -> bool {
self.bit()
}
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bit(&self) -> bool {
match *self {
PIR::_0 => false,
PIR::_1 => true,
}
}
#[allow(missing_docs)]
#[doc(hidden)]
#[inline]
pub fn _from(value: bool) -> PIR {
match value {
false => PIR::_0,
true => PIR::_1,
}
}
#[doc = "Checks if the value of the field is `_0`"]
#[inline]
pub fn is_0(&self) -> bool {
*self == PIR::_0
}
#[doc = "Checks if the value of the field is `_1`"]
#[inline]
pub fn is_1(&self) -> bool {
*self == PIR::_1
}
}
#[doc = r" Value of the field"]
pub struct N_PTTR {
bits: u8,
}
impl N_PTTR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
#[doc = r" Value of the field"]
pub struct N_TTR {
bits: u8,
}
impl N_TTR {
#[doc = r" Value of the field as raw bits"]
#[inline]
pub fn bits(&self) -> u8 {
self.bits
}
}
impl R {
#[doc = r" Value of the register as raw bits"]
#[inline]
pub fn bits(&self) -> u32 {
self.bits
}
#[doc = "Bits 0:3 - Number of Ports"]
#[inline]
pub fn n_ports(&self) -> N_PORTSR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 0;
((self.bits >> OFFSET) & MASK as u32) as u8
};
N_PORTSR { bits }
}
#[doc = "Bit 4 - Power Port Control"]
#[inline]
pub fn ppc(&self) -> PPCR {
PPCR::_from({
const MASK: bool = true;
const OFFSET: u8 = 4;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 8:11 - Number Ports per CC"]
#[inline]
pub fn n_pcc(&self) -> N_PCCR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 8;
((self.bits >> OFFSET) & MASK as u32) as u8
};
N_PCCR { bits }
}
#[doc = "Bits 12:15 - Number of Companion Controllers"]
#[inline]
pub fn n_cc(&self) -> N_CCR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 12;
((self.bits >> OFFSET) & MASK as u32) as u8
};
N_CCR { bits }
}
#[doc = "Bit 16 - Port Indicators"]
#[inline]
pub fn pi(&self) -> PIR {
PIR::_from({
const MASK: bool = true;
const OFFSET: u8 = 16;
((self.bits >> OFFSET) & MASK as u32) != 0
})
}
#[doc = "Bits 20:23 - Ports per Transaction Translator"]
#[inline]
pub fn n_ptt(&self) -> N_PTTR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 20;
((self.bits >> OFFSET) & MASK as u32) as u8
};
N_PTTR { bits }
}
#[doc = "Bits 24:27 - Number of Transaction Translators."]
#[inline]
pub fn n_tt(&self) -> N_TTR {
let bits = {
const MASK: u8 = 15;
const OFFSET: u8 = 24;
((self.bits >> OFFSET) & MASK as u32) as u8
};
N_TTR { bits }
}
}