Ignore:
Timestamp:
Nov 25, 2014, 3:47:20 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
cbc433c7
Parents:
b164303
git-author:
Sebastian Huber <sebastian.huber@…> (11/25/14 15:47:20)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/27/14 09:33:30)
Message:

rtems: Add rtems_cache_coherent_allocate()

Add rtems_cache_coherent_free() and rtems_cache_coherent_add_area().

File:
1 edited

Legend:

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

    rb164303 r038faca1  
    2323#include <rtems.h>
    2424#include <rtems/counter.h>
     25#include <rtems/score/sysstate.h>
    2526
    2627#define TESTS_USE_PRINTF
     
    410411}
    411412
     413#define AREA_SIZE 256
     414
     415static char cache_coherent_area_0[AREA_SIZE];
     416
     417static char cache_coherent_area_1[AREA_SIZE];
     418
     419static char cache_coherent_area_2[AREA_SIZE];
     420
     421static void add_area(void *begin)
     422{
     423  rtems_cache_coherent_add_area(NULL, 0);
     424  rtems_cache_coherent_add_area(begin, AREA_SIZE);
     425}
     426
     427static void test_cache_coherent_alloc(void)
     428{
     429  void *p0;
     430  void *p1;
     431  System_state_Codes previous_state;
     432
     433  printf("test cache coherent allocation\n");
     434
     435  p0 = rtems_cache_coherent_allocate(1, 0, 0);
     436  rtems_test_assert(p0 != NULL);
     437
     438  rtems_cache_coherent_free(p0);
     439
     440  p0 = rtems_cache_coherent_allocate(1, 0, 0);
     441  rtems_test_assert(p0 != NULL);
     442
     443  add_area(&cache_coherent_area_0[0]);
     444  add_area(&cache_coherent_area_1[0]);
     445
     446  previous_state = _System_state_Get();
     447  _System_state_Set(previous_state + 1);
     448  add_area(&cache_coherent_area_2[0]);
     449  _System_state_Set(previous_state);
     450
     451  p1 = rtems_cache_coherent_allocate(1, 0, 0);
     452  rtems_test_assert(p1 != NULL);
     453
     454  rtems_cache_coherent_free(p0);
     455  rtems_cache_coherent_free(p1);
     456}
     457
    412458static void Init(rtems_task_argument arg)
    413459{
     
    417463  test_timing();
    418464  test_cache_aligned_alloc();
     465  test_cache_coherent_alloc();
    419466
    420467  TEST_END();
Note: See TracChangeset for help on using the changeset viewer.