-
Notifications
You must be signed in to change notification settings - Fork 166
/
Copy pathmcal_cpu_detail.cpp
33 lines (29 loc) · 1.05 KB
/
mcal_cpu_detail.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2014 - 2020.
// Distributed under the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// This file implements helper functions for initializing
// the ARM(R) A8 for bare-metal Beagle Bone applications.
#include <cstdint>
#include <mcal_cpu_detail.h>
#include <mcal_cpu_detail_secure.h>
void mcal::cpu::detail::init()
{
secure::invalidate_caches ();
secure::clear_branch_prediction_array();
secure::invalidate_tlb ();
secure::setup_domain_access_control ();
secure::fill_tlb_entries ();
secure::enable_mmu ();
secure::enable_branch_prediction ();
secure::enable_caches ();
}
void mcal::cpu::detail::user_mode()
{
asm volatile("mrs r1, cpsr");
asm volatile("bic r1, #0x0F");
asm volatile("orr r1, #0x10");
asm volatile("msr cpsr, r1");
}