]> git.sur5r.net Git - freertos/blobdiff - FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/Renesas_Code/cg_src/r_cg_sbrk.c
Start to create an RX64M demo.
[freertos] / FreeRTOS / Demo / RX600_RX64M_RSK_Renesas_e2studio / Source / Renesas_Code / cg_src / r_cg_sbrk.c
diff --git a/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/Renesas_Code/cg_src/r_cg_sbrk.c b/FreeRTOS/Demo/RX600_RX64M_RSK_Renesas_e2studio/Source/Renesas_Code/cg_src/r_cg_sbrk.c
new file mode 100644 (file)
index 0000000..34486d3
--- /dev/null
@@ -0,0 +1,91 @@
+/***********************************************************************************************************************\r
+* DISCLAIMER\r
+* This software is supplied by Renesas Electronics Corporation and is only \r
+* intended for use with Renesas products. No other uses are authorized. This \r
+* software is owned by Renesas Electronics Corporation and is protected under \r
+* all applicable laws, including copyright laws.\r
+* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING \r
+* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT \r
+* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE \r
+* AND NON-INFRINGEMENT.  ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.\r
+* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS \r
+* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE \r
+* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR \r
+* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE \r
+* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\r
+* Renesas reserves the right, without notice, to make changes to this software \r
+* and to discontinue the availability of this software.  By using this software, \r
+* you agree to the additional terms and conditions found by accessing the \r
+* following link:\r
+* http://www.renesas.com/disclaimer\r
+*\r
+* Copyright (C) 2013 Renesas Electronics Corporation. All rights reserved.\r
+***********************************************************************************************************************/\r
+\r
+/***********************************************************************************************************************\r
+* File Name    : r_cg_sbrk.c\r
+* Version      : Applilet4 for RX64M V1.00.00.00 [02 Aug 2013]\r
+* Device(s)    : R5F564MLHxFC\r
+* Tool-Chain   : CCRX\r
+* Description  : Program of sbrk.\r
+* Creation Date: 07/02/2014\r
+***********************************************************************************************************************/\r
+\r
+/***********************************************************************************************************************\r
+Pragma directive\r
+***********************************************************************************************************************/\r
+/* Start user code for pragma. Do not edit comment generated here */\r
+/* End user code. Do not edit comment generated here */\r
+\r
+/***********************************************************************************************************************\r
+Includes\r
+***********************************************************************************************************************/\r
+#include "r_cg_macrodriver.h"\r
+#include <stddef.h>\r
+#include <stdio.h>\r
+#include "r_cg_sbrk.h"\r
+#include "r_cg_userdefine.h"\r
+\r
+/***********************************************************************************************************************\r
+Global variables and functions\r
+***********************************************************************************************************************/\r
+\r
+int8_t  *sbrk(size_t size);\r
+\r
+extern int8_t *_s1ptr;\r
+\r
+union HEAP_TYPE\r
+{\r
+    int16_t  dummy ;            /* Dummy for 4-byte boundary */\r
+    int8_t heap[HEAPSIZE];      /* Declaration of the area managed by sbrk */\r
+};\r
+\r
+static union HEAP_TYPE heap_area ;\r
+\r
+/* End address allocated by sbrk    */\r
+static int8_t *brk = (int8_t *) &heap_area;\r
+\r
+/**************************************************************************/\r
+/*      sbrk:Memory area allocation                                       */\r
+/*      Return value:Start address of allocated area    (Pass)            */\r
+/*                       -1                             (Failure)         */\r
+/**************************************************************************/\r
+int8_t *sbrk(size_t size)                       /* Assigned area size   */\r
+{\r
+    int8_t  *p;\r
+\r
+    if (brk+size > heap_area.heap + HEAPSIZE)   /* Empty area size      */\r
+    {\r
+        p = (int8_t *)-1;\r
+    }\r
+    else\r
+    {\r
+        p = brk;                                /* Area assignment      */\r
+        brk += size;                            /* End address update   */\r
+    }\r
+\r
+    return p;\r
+}\r
+\r
+/* Start user code for adding. Do not edit comment generated here */\r
+/* End user code. Do not edit comment generated here */\r