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

memguard: small changes in code structure and fixes

parent 42788c5e
......@@ -192,8 +192,6 @@ static void memguard_overflow_interrupt_handler(void *callback_ref);
uint32_t reclaim_budget(memguard_task_info_t *task_info);
static void suspend_task_routine(void *pvParameter1, uint32_t ulParameter2);
static void memguard_vTaskSuspend(TaskHandle_t task_handle,
memguard_task_info_t *task_info);
/* Functions defined in runtimes/memguard/benchmark.c */
void memguard_trace_bw_per_tick(uint32_t bandwidth_used);
......@@ -336,8 +334,8 @@ void memguard_notify_task_suspended(TaskHandle_t task_handle)
memguard_task_info_t *task_info = (memguard_task_info_t *)
pvTaskGetMemguardTaskInfo(task_handle);
if(task_info != NULL)
task_info->tsk_susp_by_user = pdTRUE;
configASSERT(task_info != NULL);
task_info->tsk_susp_by_user = pdTRUE;
#if (INCLUDE_memguard_benchmark)
stop_memguard_trace();
......@@ -379,7 +377,7 @@ BaseType_t memguard_can_task_resume(TaskHandle_t xTask)
BaseType_t can_task_resume;
if(task_info != NULL){
can_task_resume = task_info->tsk_susp_by_memguard;
can_task_resume = !task_info->tsk_susp_by_memguard;
} else {
can_task_resume = pdFALSE;
......@@ -810,9 +808,9 @@ static void periodic_timer_handler_slave(void *callback_ref)
Xil_DCacheEnable();
Xil_SetTlbAttributes((UINTPTR) __ocm_ram_start, attrib);
/* We use cores_ready variable here in order to don't enable the
cache a second time, therefore decreasing the value of the
cores_ready by one unit for each core until it becomes 0 */
/* We use cores_ready variable here in order to don't enable the cache
a second time, therefore decreasing the value of the cores_ready by one
unit for each core until it becomes 0 */
atomic_fetch_sub(&(memguard_info.cores_ready), 1);
}
......@@ -1070,10 +1068,14 @@ static void suspend_task_routine(void *pvParameter1, uint32_t ulParameter2)
* @param task_handle of the task which has to be suspended
* @param task_info of the task which has to be suspended
*/
static void memguard_vTaskSuspend(TaskHandle_t task_handle,
memguard_task_info_t *task_info)
void memguard_vTaskSuspend(TaskHandle_t task_handle, void *task_info_ptr)
{
if(task_handle == memguard_task_handle)
memguard_task_info_t *task_info = task_info_ptr;
if( ( task_handle == memguard_task_handle ) ||
( task_handle == xTaskGetIdleTaskHandle() ) ||
( task_handle == xTimerGetTimerDaemonTaskHandle() )
)
return;
/* Storing that MemGuard susp. the task in order to don't let other tasks to
......
......@@ -6,8 +6,8 @@
******************************************************************************/
#include "memguard/perfmon.h"
#include <xil/xpseudo_asm.h>
#include "freertos/FreeRTOSConfig.h"
#include <xil/xpseudo_asm.h>
/* Macros used for accessing the register in read and write mode */
#define read_register(REG, VAL) __asm__ __volatile__("mrs %0, "#REG : "=r" (VAL))
......
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