Skip to content

Commit

Permalink
Some syntax and upgrade coverity
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Sep 30, 2024
1 parent a63be18 commit 4cdb1af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
20 changes: 12 additions & 8 deletions ref_app/src/mcal/stm32h7a3/mcal_cpu.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////////
// Copyright Christopher Kormanyos 2022.
// Copyright Christopher Kormanyos 2022 - 2024.
// 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)
Expand Down Expand Up @@ -47,7 +47,7 @@ void mcal::cpu::init()

void mcal::cpu::post_init()
{
// Enable the Cache-I and Cache-D.
// Enable the instruction-cache and the data-cache.
detail::enable_i_cache();
detail::enable_d_cache();
}
Expand Down Expand Up @@ -81,22 +81,25 @@ void mcal::cpu::detail::enable_d_cache()
asm volatile("dsb");

// Invalidate the data cache.
auto sets =
std::uint32_t
sets
{
static_cast<std::uint32_t>
(
static_cast<std::uint32_t>
(
mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::scb_ccsidr>::reg_get()
>> static_cast<unsigned>(UINT8_C(13))
)
&
static_cast<std::uint32_t>(UINT32_C(0x7FFF))
);
& static_cast<std::uint32_t>(UINT32_C(0x7FFF))
)
};

asm volatile("dsb");

do
{
auto ways = mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::scb_ccsidr>::reg_get();
std::uint32_t ways { mcal::reg::reg_access_static<std::uint32_t, std::uint32_t, mcal::reg::scb_ccsidr>::reg_get() };
asm volatile("dsb");

ways =
Expand All @@ -119,10 +122,11 @@ void mcal::cpu::detail::enable_d_cache()
asm volatile("dsb");
}
while(ways-- != static_cast<std::uint32_t>(UINT8_C(0)));
asm volatile("dsb");

asm volatile("dsb");
}
while(sets-- != static_cast<std::uint32_t>(UINT8_C(0)));

asm volatile("dsb");

// Enable the data cache.
Expand Down
3 changes: 3 additions & 0 deletions ref_app/src/sys/start/coverity.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
/* Coverity Scan model */

/* cd /mnt/c/Users/ckorm/Documents/Ks/uC_Software/Boards/real-time-cpp/ref_app */
/* target/build/build.sh x86_64-w64-mingw32 rebuild */

void dummy(void);

void dummy(void)
Expand Down

0 comments on commit 4cdb1af

Please sign in to comment.