Commit 9c4ede16 authored by Dorel Coman's avatar Dorel Coman Committed by Oliver Horst
Browse files

memguard: improved comments and idention, cleaned unused files

parent 49535250
......@@ -20,19 +20,6 @@
cycle counter PMCCNTR_EL0 */
#define CYLCE_CNTR_ID 31U
/*******************************************************************************
* Ids of used counters
******************************************************************************/
/* Counter used by MemGuard for counting BUS_ACCESS events */
#define MEMGUARD_CNTR_ID 0
/* Counters used by the MemgGuard benchmark functions */
#define BENCH_1_CNTR_ID_BUS_ACCESS 1
#define BENCH_2_CNTR_ID_INSTR_EX 2
#define BENCH_3_CNTR_ID_CLOCK_CYCLES 3
#define BENCH_4_CNTR_ID_CLOCK_CYCLES_OVER 4
/*******************************************************************************
* Function declaration
******************************************************************************/
......@@ -43,7 +30,10 @@
void pmu_init_counters();
/**
* This function enables the selected counter to monitor the selected event typ
* This function enables the selected counter to monitor the selected event
* type. If the function is called multiple times on the same counter, it
* will remember only the last event type selected. The counter cannot
* monitor multiple types of events at the same time.
*
* @param idx of the counter to be enabled
* @param event_type to monitored by the idx counter. The type of events, that
......@@ -67,8 +57,12 @@ uint32_t pmu_get_core_id();
uint32_t pmu_counter_has_overflowed(uint32_t idx);
/**
* This function enables the generation of interrupt requests in case of
* overflow for the selected counter
* This function enables the PMU interrupt source. Every time a PMU counter
* overflows, the interrupt no. [176 + cpu_id] is raised. To receive the PMU
* interrupt, please ensure that it is also enabled and registered with the GIC.
* The cpu_id represents the core on which the overflow was generated and its
* value can be comprised between 0 and 3.
*
* @param idx of the counter
*/
void pmu_enable_intr(uint32_t idx);
......
......@@ -1831,30 +1831,34 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
{
#if ( INCLUDE_memguard == 1 )
/* It notifies memguard that a task is resumed. It is
important to know the original status of a task
when this is being suspended by memguard */
important to know the original status of a task when
this is being suspended by memguard */
memguard_notify_task_resumed(xTaskToResume);
/* It checks if the task was suspended by memguard.
In this case the task should not be resumed until
the beginning of a new time window */
if (memguard_is_task_susp_by_memguard(xTaskToResume) == pdFALSE) {
In this case the task should not be resumed until the
beginning of a new time window */
if (memguard_is_task_susp_by_memguard(xTaskToResume) == pdFALSE)
{
#endif
traceTASK_RESUME(pxTCB);
traceTASK_RESUME( pxTCB );
/* The ready list can be accessed even if the scheduler is
suspended because this is inside a critical section. */
(void) uxListRemove(
&(pxTCB->xStateListItem));prvAddTaskToReadyList(
pxTCB);
/* The ready list can be accessed even if the
scheduler is suspended because this is inside a
critical section. */
( void ) uxListRemove( &( pxTCB->xStateListItem ) );
prvAddTaskToReadyList( pxTCB );
/* A higher priority task may have just been resumed. */
if (pxTCB->uxPriority >= pxCurrentTCB->uxPriority) {
/* This yield may not cause the task just resumed to run,
but will leave the lists in the correct state for the
next yield. */
if( pxTCB->uxPriority >= pxCurrentTCB->uxPriority )
{
/* This yield may not cause the task just
resumed to run, but will leave the lists in
the correct state for the next yield. */
taskYIELD_IF_USING_PREEMPTION();
} else {
}
else
{
mtCOVERAGE_TEST_MARKER();
}
#if (INCLUDE_memguard == 1)
......
......@@ -21,7 +21,7 @@
#include <freertos/core/timers.h>
#include "xil/drivers/xscugic.h"
#include "xil/xil_cache.h"
#include "../../../../../../runtimes/memguard/platform_info.h"
#include "platform_info.h"
#include "openamp/remoteproc.h"
#include "metal/sys.h"
#include <metal/atomic.h>
......
......@@ -177,8 +177,8 @@ void pmu_init_counters()
void pmu_enable_counter_for_event(uint32_t idx, uint32_t event_type)
{
pmu_disable_counter(idx);
pmu_type_select(idx, event_type);
pmu_enable_counter(idx);
pmu_type_select(idx, event_type);
pmu_enable_counter(idx);
}
uint32_t pmu_get_core_id()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment