OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [portable/] [Softune/] [MB96340/] [__STD_LIB_sbrk.c] - Blame information for rev 572

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 572 jeremybenn
/* THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS. FUJITSU */
2
/* MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY FOR ANY ERRORS OR */
3
/* ELIGIBILITY FOR ANY PURPOSES.                                             */
4
/*                 (C) Fujitsu Microelectronics Europe GmbH                  */
5
/*---------------------------------------------------------------------------
6
  __STD_LIB_sbrk.C
7
  - Used by heap_3.c for memory accocation and deletion.
8
 
9
/*---------------------------------------------------------------------------*/
10
 
11
#include "FreeRTOSConfig.h"
12
#include <stdlib.h>
13
 
14
        static  long         brk_siz  =  0;
15
        typedef int          _heep_t;
16
        #define ROUNDUP(s)   (((s)+sizeof(_heep_t)-1)&~(sizeof(_heep_t)-1))
17
        static  _heep_t      _heep[ROUNDUP(configTOTAL_HEAP_SIZE)/sizeof(_heep_t)];
18
        #define              _heep_size      ROUNDUP(configTOTAL_HEAP_SIZE)
19
 
20
        extern  char  *sbrk(int  size)
21
        {
22
           if  (brk_siz  +  size  >  _heep_size  ||  brk_siz  +  size  <  0)
23
 
24
          return((char*)-1);
25
           brk_siz  +=  size;
26
           return(  (char*)_heep  +  brk_siz  -  size);
27
        }
28
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.