source: rtems/c/src/lib/libcpu/shared/src/cache_aligned_malloc.c @ 5e77d129

4.104.114.84.95
Last change on this file since 5e77d129 was 5e77d129, checked in by Joel Sherrill <joel.sherrill@…>, on Jun 14, 2000 at 8:32:44 PM

Patch from John Cotton <john.cotton@…> to correct cache
routine naming to follow RTEMS package/object.method rule.
This patch also eliminated calls to the obsolete routine
m68k_enable_caching.

  • Property mode set to 100644
File size: 915 bytes
Line 
1/*
2 *  RTEMS Cache Aligned Malloc
3 *
4 *
5 *  COPYRIGHT (c) 1989-1999.
6 *  On-Line Applications Research Corporation (OAR).
7 *
8 *  The license and distribution terms for this file may be
9 *  found in the file LICENSE in this distribution or at
10 *  http://www.OARcorp.com/rtems/license.html.
11 *
12 *  $Id$
13 */
14
15#include <rtems.h>
16#include <cache_.h>
17
18/*
19 *  rtems_cache_aligned_malloc
20 *
21 *  DESCRIPTION:
22 *
23 *  This function is used to allocate storage that spans an
24 *  integral number of cache blocks.
25 */
26
27void *rtems_cache_aligned_malloc (
28  size_t nbytes
29)
30{
31  /*
32   * Arrange to have the user storage start on the first cache
33   * block beyond the header.
34   */
35#if defined(CPU_DATA_CACHE_ALIGNMENT)
36  return (void *) ((((unsigned long)
37     malloc( nbytes + CPU_DATA_CACHE_ALIGNMENT - 1 ))
38        + CPU_DATA_CACHE_ALIGNMENT - 1 ) &(~(CPU_DATA_CACHE_ALIGNMENT - 1)) );
39#else
40  return malloc( nbytes );
41#endif
42}
43
Note: See TracBrowser for help on using the repository browser.