FreeNOS
Public Types | Public Member Functions | Private Member Functions
ARMControl Class Reference

ARM System Control Coprocessor (CP15). More...

#include <ARMControl.h>

Public Types

enum  Register {
  MainID = 0, CoreID, SystemControl, AuxControl,
  DomainControl, TranslationTable0, TranslationTable1, TranslationTableCtrl,
  CacheClear, DataCacheClean, FlushPrefetchBuffer, InstructionCacheClear,
  InstructionTLBClear, DataTLBClear, UnifiedTLBClear, UserProcID,
  InstructionFaultAddress, InstructionFaultStatus, DataFaultAddress, DataFaultStatus,
  SystemFrequency
}
 System Control Registers. More...
 
enum  SystemControlFlags {
  MMUEnabled = (1 << 0), InstructionCache = (1 << 12), DataCache = (1 << 2), ExtendedPaging = (1 << 23),
  AccessPermissions = (1 << 29), BranchPrediction = (1 << 11), AlignmentCorrect = (1 << 22), AlignmentFaults = (1 << 1),
  BigEndian = (1 << 25)
}
 System Control flags. More...
 
enum  AuxControlFlags { DisablePageColoring = (1 << 6), SMPBit = (1 << 6) }
 Aux Control flags. More...
 
enum  DomainControlFlags { DomainClient = 1, DomainManager = 3 }
 Domain Control flags. More...
 

Public Member Functions

 ARMControl ()
 Constructor. More...
 
virtual ~ARMControl ()
 Destructor. More...
 
u32 read (Register reg) const
 Read a register from the CP15. More...
 
void write (Register reg, u32 value)
 Write register to the CP15. More...
 
void set (SystemControlFlags flags)
 Set system control flags in CP15. More...
 
void unset (SystemControlFlags flags)
 Unset system control flags in CP15. More...
 
void set (AuxControlFlags flags)
 Set auxillary flags in CP15. More...
 
void set (DomainControlFlags flags)
 Set domain control flags in CP15. More...
 

Private Member Functions

void set (Register reg, u32 flags)
 Set flag(s) in a CP15 register. More...
 
void unset (Register reg, u32 flags)
 Unset flag(s) in a CP15 register. More...
 

Detailed Description

ARM System Control Coprocessor (CP15).

The ARM Architecture defines a coprocessor to manage various subsystems in the ARM core, including virtual memory, interrupts, debugging and more. It appears as coprocessor number 15 to the ARM core and is accessible by the MRC (ARM Register from Coprocessor) and MCR () instructions.

See also
ARM Architecture Reference Manual, page xxx

Definition at line 47 of file ARMControl.h.

Member Enumeration Documentation

◆ AuxControlFlags

Aux Control flags.

Enumerator
DisablePageColoring 
SMPBit 

Definition at line 102 of file ARMControl.h.

◆ DomainControlFlags

Domain Control flags.

Enumerator
DomainClient 
DomainManager 

Definition at line 111 of file ARMControl.h.

◆ Register

System Control Registers.

Enumerator
MainID 
CoreID 
SystemControl 
AuxControl 
DomainControl 
TranslationTable0 
TranslationTable1 
TranslationTableCtrl 
CacheClear 
DataCacheClean 
FlushPrefetchBuffer 
InstructionCacheClear 
InstructionTLBClear 
DataTLBClear 
UnifiedTLBClear 
UserProcID 
InstructionFaultAddress 
InstructionFaultStatus 
DataFaultAddress 
DataFaultStatus 
SystemFrequency 

Definition at line 54 of file ARMControl.h.

◆ SystemControlFlags

System Control flags.

Enumerator
MMUEnabled 
InstructionCache 
DataCache 
ExtendedPaging 
AccessPermissions 
BranchPrediction 
AlignmentCorrect 
AlignmentFaults 
BigEndian 

Definition at line 82 of file ARMControl.h.

Constructor & Destructor Documentation

◆ ARMControl()

ARMControl::ARMControl ( )

Constructor.

Definition at line 21 of file ARMControl.cpp.

◆ ~ARMControl()

ARMControl::~ARMControl ( )
virtual

Destructor.

Definition at line 25 of file ARMControl.cpp.

Member Function Documentation

◆ read()

u32 ARMControl::read ( Register  reg) const

Read a register from the CP15.

Parameters
regThe Register to read.
Returns
32-bit value of the register.

Definition at line 29 of file ARMControl.cpp.

References AuxControl, CoreID, DataFaultAddress, DataFaultStatus, DomainControl, InstructionFaultAddress, InstructionFaultStatus, MainID, mrc, SystemControl, SystemFrequency, TranslationTable0, TranslationTable1, TranslationTableCtrl, and UserProcID.

Referenced by ARMCore::logState(), RaspberryKernel::RaspberryKernel(), set(), and unset().

◆ set() [1/4]

void ARMControl::set ( ARMControl::AuxControlFlags  flags)

Set auxillary flags in CP15.

Parameters
flagsAuxillary flags to set

Definition at line 98 of file ARMControl.cpp.

References AuxControl, flags, and set().

◆ set() [2/4]

void ARMControl::set ( ARMControl::DomainControlFlags  flags)

Set domain control flags in CP15.

Parameters
flagsNew domain control flags

Definition at line 103 of file ARMControl.cpp.

References DomainControl, flags, and set().

◆ set() [3/4]

void ARMControl::set ( Register  reg,
u32  flags 
)
private

Set flag(s) in a CP15 register.

Parameters
regRegister to set
flagsFlag values to set in the register

Definition at line 74 of file ARMControl.cpp.

References flags, read(), and write().

◆ set() [4/4]

void ARMControl::set ( ARMControl::SystemControlFlags  flags)

Set system control flags in CP15.

Parameters
flagsNew system control flags

Definition at line 88 of file ARMControl.cpp.

References flags, and SystemControl.

Referenced by ARMKernel::ARMKernel(), kernel_main(), and set().

◆ unset() [1/2]

void ARMControl::unset ( Register  reg,
u32  flags 
)
private

Unset flag(s) in a CP15 register.

Parameters
regRegister to unset
flagsFlag values to remove from the register

Definition at line 81 of file ARMControl.cpp.

References flags, read(), and write().

◆ unset() [2/2]

void ARMControl::unset ( ARMControl::SystemControlFlags  flags)

Unset system control flags in CP15.

Parameters
flagsSystem control flags to remove

Definition at line 93 of file ARMControl.cpp.

References flags, and SystemControl.

Referenced by ARMKernel::ARMKernel().

◆ write()

void ARMControl::write ( Register  reg,
u32  value 
)

Write register to the CP15.

Parameters
regThe Register to write.
value32-value to write.

Definition at line 52 of file ARMControl.cpp.

References AuxControl, CacheClear, DataCacheClean, DataTLBClear, DomainControl, FlushPrefetchBuffer, flushPrefetchBuffer(), InstructionCacheClear, InstructionTLBClear, mcr, SystemControl, TranslationTable0, TranslationTable1, TranslationTableCtrl, UnifiedTLBClear, and UserProcID.

Referenced by ARMPaging::activate(), set(), and unset().


The documentation for this class was generated from the following files: