Changeset a850d04 in rtems


Ignore:
Timestamp:
Jan 28, 2014, 10:32:35 AM (6 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
a49bc35
Parents:
fe535885
git-author:
Sebastian Huber <sebastian.huber@…> (01/28/14 10:32:35)
git-committer:
Sebastian Huber <sebastian.huber@…> (02/04/14 09:06:34)
Message:

score: Add _Workspace_Allocate_aligned()

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/wkspace.h

    rfe535885 ra850d04  
    7373
    7474/**
     75 * @brief Allocate aligned memory from workspace.
     76 *
     77 * @param[in] size The size of the requested memory.
     78 * @param[in] alignment The alignment of the requested memory.
     79 *
     80 * @retval NULL Not enough resources.
     81 * @retval other The memory area begin.
     82 */
     83void *_Workspace_Allocate_aligned( size_t size, size_t alignment );
     84
     85/**
    7586 * @brief Free memory to the workspace.
    7687 *
  • cpukit/score/src/wkspace.c

    rfe535885 ra850d04  
    115115}
    116116
     117void *_Workspace_Allocate_aligned( size_t size, size_t alignment )
     118{
     119  return _Heap_Allocate_aligned( &_Workspace_Area, size, alignment );
     120}
     121
    117122/*
    118123 *  _Workspace_Free
  • testsuites/sptests/spwkspace/init.c

    rfe535885 ra850d04  
    5555}
    5656
     57static void test_workspace_allocate_aligned(void)
     58{
     59  uintptr_t align = 512;
     60  void *p = _Workspace_Allocate_aligned( 1, align );
     61
     62  rtems_test_assert( p != NULL );
     63  rtems_test_assert( ((uintptr_t) p & (align - 1)) == 0 );
     64
     65  _Workspace_Free( p );
     66}
     67
    5768rtems_task Init(
    5869  rtems_task_argument argument
     
    101112  test_workspace_string_duplicate();
    102113
     114  puts( "_Workspace_Allocate_aligned" );
     115  test_workspace_allocate_aligned();
     116
    103117  puts( "*** END OF TEST WORKSPACE CLASSIC API ***" );
    104118  rtems_test_exit( 0 );
  • testsuites/sptests/spwkspace/spwkspace.scn

    rfe535885 ra850d04  
    88rtems_workspace_free - NULL
    99rtems_workspace_free - previous pointer to 42 bytes
     10_Workspace_String_duplicate - samples
     11_Workspace_Allocate_aligned
    1012*** END OF TEST WORKSPACE CLASSIC API ***
Note: See TracChangeset for help on using the changeset viewer.