1    /* 
     2     *  Copyright (c) 2008 Texas Instruments. All rights reserved.
     3     *  This program and the accompanying materials are made available under the
     4     *  terms of the Eclipse Public License v1.0 and Eclipse Distribution License
     5     *  v. 1.0 which accompanies this distribution. The Eclipse Public License is
     6     *  available at http://www.eclipse.org/legal/epl-v10.html and the Eclipse
     7     *  Distribution License is available at
     8     *  http://www.eclipse.org/org/documents/edl-v10.php.
     9     *
    10     *  Contributors:
    11     *      Texas Instruments - initial implementation
    12     * */
    13    /*
    14     *  ======== IHeap.xdc ========
    15     *! - if we ever change the name of this interface, we should change it to
    16     *!   IMemoryProvider
    17     */
    18    
    19    /*!
    20     *  ======== IHeap ========
    21     *  Interface to heap functions.
    22     *
    23     *  All heap implementations inherit from this interface.
    24     *  The implementations can have additional configuration
    25     *  parmeters and functions.
    26     *
    27     */
    28    @DirectCall
    29    
    30    interface IHeap {
    31    
    32    instance:
    33    
    34        /*!
    35         *  ======== alloc ========
    36         *  Allocates a block of memory from the heap.
    37         *
    38         *  This method returns a block of memory from the heap.
    39         *  It is called by the `{@link xdc.runtime.Memory#alloc()}` function.
    40         *
    41         *  @param(size)     size (in MADUs) of the block
    42         *  @param(align)    alignment (in MADUs)  of the block
    43         *  @param(eb)       pointer to error block
    44         *
    45         *  @a(returns)      Returns the address of the allocated memory.
    46         */
    47        Ptr alloc(SizeT size, SizeT align, Error.Block *eb);
    48    
    49        /*!
    50         *  ======== create ========
    51         *  Create a heap.
    52         *
    53         *  See specific `IHeap` implementation for parameters used.
    54         */
    55        create();
    56    
    57        /*!
    58         *  ======== free ========
    59         *  Free a block of memory back to the heap.
    60         *
    61         *  This method gives back a block of memory to a heap.
    62         *  It is called by the `{@link xdc.runtime.Memory#free()}` function.
    63         *
    64         *  @param(block)    non-`NULL` address of allocated block to free
    65         *  @param(size)     size (in MADUs) of the block of memory to free
    66         */
    67        Void free(Ptr block, SizeT size);
    68    
    69        /*!
    70         *  ======== isBlocking ========
    71         *  Returns whether the heap may block during an `{@link #alloc()}` or
    72         *  `{@link #free()}`.
    73         *
    74         *  @a(returns)      If the heap might block, `TRUE` is returned.
    75         *                   If the heap does not block, `FALSE` is returned.
    76         */
    77        Bool isBlocking();
    78    
    79        /*!
    80         *  ======== getStats ========
    81         *  Retrieve the statistics from the heap.
    82         *
    83         *  The caller passes in a pointer to a `{@link xdc.runtime.Memory#Stats}`
    84         *  structure and `getStats` fills in this structure.
    85         *
    86         *  This function is called by the `{@link xdc.runtime.Memory#getStats()}`
    87         *  function.
    88         *
    89         *  @param(stats)    non-`NULL` pointer to an output buffer
    90         */
    91        Void getStats(Memory.Stats *stats);
    92    }
    93    /*
    94     *  @(#) xdc.runtime; 2, 1, 0,0; 2-8-2017 14:15:55; /db/ztree/library/trees/xdc/xdc-D05/src/packages/
    95     */
    96