Changeset 75e71b2 in rtems


Ignore:
Timestamp:
Apr 5, 2017, 7:55:45 AM (2 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
46f05b9
Parents:
1bf8b25
Message:

spcache01: Instruction cache invalidate workaround

On some systems, the instruction cache invalidation is not allowed by
the MMU.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • testsuites/sptests/spcache01/init.c

    r1bf8b25 r75e71b2  
    11/*
    2  * Copyright (c) 2014 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2014, 2017 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
     
    1717#endif
    1818
     19#include <inttypes.h>
     20#include <setjmp.h>
    1921#include <stdio.h>
    2022#include <stdlib.h>
    21 #include <inttypes.h>
    2223
    2324#include <rtems.h>
     
    4344
    4445CPU_STRUCTURE_ALIGNMENT static int data[1024];
     46
     47static bool do_longjmp;
     48
     49static jmp_buf instruction_invalidate_return_context;
    4550
    4651static void test_data_flush_and_invalidate(void)
     
    180185  uint32_t cache_level;
    181186  size_t cache_size;
     187  bool exception;
    182188
    183189  rtems_interrupt_lock_initialize(&lock, "test");
     
    364370  d[0] = do_some_work();
    365371  d[1] = do_some_work();
    366   rtems_cache_invalidate_multiple_instruction_lines(do_some_work, 4096);
     372
     373  do_longjmp = true;
     374
     375  if (setjmp(instruction_invalidate_return_context) == 0) {
     376    rtems_cache_invalidate_multiple_instruction_lines(do_some_work, 4096);
     377    exception = false;
     378  } else {
     379    exception = true;
     380  }
     381
     382  do_longjmp = false;
     383
    367384  d[2] = do_some_work();
    368385
     
    378395    d[2]
    379396  );
     397
     398  if (exception) {
     399    printf(
     400      "rtems_cache_invalidate_multiple_data_lines() generated an exception\n"
     401    );
     402  }
    380403
    381404  rtems_interrupt_lock_destroy(&lock);
     
    470493}
    471494
     495static void fatal_extension(
     496  rtems_fatal_source source,
     497  bool always_set_to_false,
     498  rtems_fatal_code error
     499)
     500{
     501  if (source == RTEMS_FATAL_SOURCE_EXCEPTION && do_longjmp) {
     502    _ISR_Set_level(0);
     503    longjmp(instruction_invalidate_return_context, 1);
     504  }
     505}
     506
    472507#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
    473508#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
     
    475510#define CONFIGURE_MAXIMUM_TASKS 1
    476511
    477 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
     512#define CONFIGURE_INITIAL_EXTENSIONS \
     513  { .fatal = fatal_extension }, \
     514  RTEMS_TEST_INITIAL_EXTENSION
    478515
    479516#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
Note: See TracChangeset for help on using the changeset viewer.