This is the final version of Mini Gateway for Automation and Security desgined for Renesas GR Peach Design Contest

Dependencies:   GR-PEACH_video GraphicsFramework HTTPServer R_BSP mbed-rpc mbed-rtos Socket lwip-eth lwip-sys lwip FATFileSystem

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
vipinranka
Date:
Wed Jan 11 11:41:30 2017 +0000
Revision:
12:9a20164dcc47
This is the final version MGAS Project for Renesas GR Peach Design Contest

Who changed what in which revision?

UserRevisionLine numberNew contents of line
vipinranka 12:9a20164dcc47 1
vipinranka 12:9a20164dcc47 2 /** \addtogroup platform */
vipinranka 12:9a20164dcc47 3 /** @{*/
vipinranka 12:9a20164dcc47 4 /* mbed Microcontroller Library
vipinranka 12:9a20164dcc47 5 * Copyright (c) 2006-2016 ARM Limited
vipinranka 12:9a20164dcc47 6 *
vipinranka 12:9a20164dcc47 7 * Licensed under the Apache License, Version 2.0 (the "License");
vipinranka 12:9a20164dcc47 8 * you may not use this file except in compliance with the License.
vipinranka 12:9a20164dcc47 9 * You may obtain a copy of the License at
vipinranka 12:9a20164dcc47 10 *
vipinranka 12:9a20164dcc47 11 * http://www.apache.org/licenses/LICENSE-2.0
vipinranka 12:9a20164dcc47 12 *
vipinranka 12:9a20164dcc47 13 * Unless required by applicable law or agreed to in writing, software
vipinranka 12:9a20164dcc47 14 * distributed under the License is distributed on an "AS IS" BASIS,
vipinranka 12:9a20164dcc47 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
vipinranka 12:9a20164dcc47 16 * See the License for the specific language governing permissions and
vipinranka 12:9a20164dcc47 17 * limitations under the License.
vipinranka 12:9a20164dcc47 18 */
vipinranka 12:9a20164dcc47 19
vipinranka 12:9a20164dcc47 20 #ifndef __MBED_MEM_TRACE_H__
vipinranka 12:9a20164dcc47 21 #define __MBED_MEM_TRACE_H__
vipinranka 12:9a20164dcc47 22
vipinranka 12:9a20164dcc47 23 #ifdef __cplusplus
vipinranka 12:9a20164dcc47 24 extern "C" {
vipinranka 12:9a20164dcc47 25 #endif
vipinranka 12:9a20164dcc47 26
vipinranka 12:9a20164dcc47 27 #include <stdint.h>
vipinranka 12:9a20164dcc47 28 #include <stddef.h>
vipinranka 12:9a20164dcc47 29
vipinranka 12:9a20164dcc47 30 /* Operation types for tracer */
vipinranka 12:9a20164dcc47 31 enum {
vipinranka 12:9a20164dcc47 32 MBED_MEM_TRACE_MALLOC,
vipinranka 12:9a20164dcc47 33 MBED_MEM_TRACE_REALLOC,
vipinranka 12:9a20164dcc47 34 MBED_MEM_TRACE_CALLOC,
vipinranka 12:9a20164dcc47 35 MBED_MEM_TRACE_FREE
vipinranka 12:9a20164dcc47 36 };
vipinranka 12:9a20164dcc47 37
vipinranka 12:9a20164dcc47 38 /* Prefix for the output of the default tracer */
vipinranka 12:9a20164dcc47 39 #define MBED_MEM_DEFAULT_TRACER_PREFIX "#"
vipinranka 12:9a20164dcc47 40
vipinranka 12:9a20164dcc47 41 /**
vipinranka 12:9a20164dcc47 42 * Type of the callback used by the memory tracer. This callback is called when a memory
vipinranka 12:9a20164dcc47 43 * allocation operation (malloc, realloc, calloc, free) is called and tracing is enabled
vipinranka 12:9a20164dcc47 44 * for that memory allocation function.
vipinranka 12:9a20164dcc47 45 *
vipinranka 12:9a20164dcc47 46 * @param op the ID of the operation (MBED_MEM_TRACE_MALLOC, MBED_MEM_TRACE_REALLOC,
vipinranka 12:9a20164dcc47 47 * MBED_MEM_TRACE_CALLOC or MBED_MEM_TRACE_FREE).
vipinranka 12:9a20164dcc47 48 * @param res the result that the memory operation returned (NULL for 'free').
vipinranka 12:9a20164dcc47 49 * @param caller the caller of the memory operation. Note that the value of 'caller' might be
vipinranka 12:9a20164dcc47 50 * unreliable.
vipinranka 12:9a20164dcc47 51 *
vipinranka 12:9a20164dcc47 52 * The rest of the parameters passed 'mbed_mem_trace_cb_t' are the same as the memory operations
vipinranka 12:9a20164dcc47 53 * that triggered its call (see 'man malloc' for details):
vipinranka 12:9a20164dcc47 54 *
vipinranka 12:9a20164dcc47 55 * - for malloc: cb(MBED_MEM_TRACE_MALLOC, res, caller, size).
vipinranka 12:9a20164dcc47 56 * - for realloc: cb(MBED_MEM_TRACE_REALLOC, res, caller, ptr, size).
vipinranka 12:9a20164dcc47 57 * - for calloc: cb(MBED_MEM_TRACE_CALLOC, res, caller, nmemb, size).
vipinranka 12:9a20164dcc47 58 * - for free: cb(MBED_MEM_TRACE_FREE, NULL, caller, ptr).
vipinranka 12:9a20164dcc47 59 */
vipinranka 12:9a20164dcc47 60 typedef void (*mbed_mem_trace_cb_t)(uint8_t op, void *res, void* caller, ...);
vipinranka 12:9a20164dcc47 61
vipinranka 12:9a20164dcc47 62 /**
vipinranka 12:9a20164dcc47 63 * Set the callback used by the memory tracer (use NULL for disable tracing).
vipinranka 12:9a20164dcc47 64 *
vipinranka 12:9a20164dcc47 65 * @param cb the callback to call on each memory operation.
vipinranka 12:9a20164dcc47 66 */
vipinranka 12:9a20164dcc47 67 void mbed_mem_trace_set_callback(mbed_mem_trace_cb_t cb);
vipinranka 12:9a20164dcc47 68
vipinranka 12:9a20164dcc47 69 /**
vipinranka 12:9a20164dcc47 70 * Trace a call to 'malloc'.
vipinranka 12:9a20164dcc47 71 * @param res the result of running 'malloc'.
vipinranka 12:9a20164dcc47 72 * @param size the 'size' argument given to 'malloc'.
vipinranka 12:9a20164dcc47 73 * @param caller the caller of the memory operation.
vipinranka 12:9a20164dcc47 74 * @return 'res' (the first argument).
vipinranka 12:9a20164dcc47 75 */
vipinranka 12:9a20164dcc47 76 void *mbed_mem_trace_malloc(void *res, size_t size, void *caller);
vipinranka 12:9a20164dcc47 77
vipinranka 12:9a20164dcc47 78 /**
vipinranka 12:9a20164dcc47 79 * Trace a call to 'realloc'.
vipinranka 12:9a20164dcc47 80 * @param res the result of running 'realloc'.
vipinranka 12:9a20164dcc47 81 * @param ptr the 'ptr' argument given to 'realloc'.
vipinranka 12:9a20164dcc47 82 * @param size the 'size' argument given to 'realloc'.
vipinranka 12:9a20164dcc47 83 *
vipinranka 12:9a20164dcc47 84 * @return 'res' (the first argument).
vipinranka 12:9a20164dcc47 85 */
vipinranka 12:9a20164dcc47 86 void *mbed_mem_trace_realloc(void *res, void *ptr, size_t size, void *caller);
vipinranka 12:9a20164dcc47 87
vipinranka 12:9a20164dcc47 88 /**
vipinranka 12:9a20164dcc47 89 * Trace a call to 'calloc'.
vipinranka 12:9a20164dcc47 90 * @param res the result of running 'calloc'.
vipinranka 12:9a20164dcc47 91 * @param nmemb the 'nmemb' argument given to 'calloc'.
vipinranka 12:9a20164dcc47 92 * @param size the 'size' argument given to 'calloc'.
vipinranka 12:9a20164dcc47 93 * @param caller the caller of the memory operation.
vipinranka 12:9a20164dcc47 94 * @Return 'res' (the first argument).
vipinranka 12:9a20164dcc47 95 */
vipinranka 12:9a20164dcc47 96 void *mbed_mem_trace_calloc(void *res, size_t num, size_t size, void *caller);
vipinranka 12:9a20164dcc47 97
vipinranka 12:9a20164dcc47 98 /**
vipinranka 12:9a20164dcc47 99 * Trace a call to 'free'.
vipinranka 12:9a20164dcc47 100 * @param ptr the 'ptr' argument given to 'free'.
vipinranka 12:9a20164dcc47 101 * @param caller the caller of the memory operation.
vipinranka 12:9a20164dcc47 102 */
vipinranka 12:9a20164dcc47 103 void mbed_mem_trace_free(void *ptr, void *caller);
vipinranka 12:9a20164dcc47 104
vipinranka 12:9a20164dcc47 105 /**
vipinranka 12:9a20164dcc47 106 * Default memory trace callback. DO NOT CALL DIRECTLY. It is meant to be used
vipinranka 12:9a20164dcc47 107 * as the second argument of 'mbed_mem_trace_setup'.
vipinranka 12:9a20164dcc47 108 *
vipinranka 12:9a20164dcc47 109 * The default callback outputs trace data using 'printf', in a format that's
vipinranka 12:9a20164dcc47 110 * easily parsable by an external tool. For each memory operation, the callback
vipinranka 12:9a20164dcc47 111 * outputs a line that begins with '#<op>:<0xresult>;<0xcaller>-':
vipinranka 12:9a20164dcc47 112 *
vipinranka 12:9a20164dcc47 113 * - 'op' identifies the memory operation ('m' for 'malloc', 'r' for 'realloc',
vipinranka 12:9a20164dcc47 114 * 'c' for 'calloc' and 'f' for 'free').
vipinranka 12:9a20164dcc47 115 * - 'result' (base 16) is the result of the memor operation. This is always NULL
vipinranka 12:9a20164dcc47 116 * for 'free', since 'free' doesn't return anything.
vipinranka 12:9a20164dcc47 117 * -'caller' (base 16) is the caller of the memory operation. Note that the value
vipinranka 12:9a20164dcc47 118 * of 'caller' might be unreliable.
vipinranka 12:9a20164dcc47 119 *
vipinranka 12:9a20164dcc47 120 * The rest of the output depends on the operation being traced:
vipinranka 12:9a20164dcc47 121 *
vipinranka 12:9a20164dcc47 122 * - for 'malloc': 'size', where 'size' is the original argument to 'malloc'.
vipinranka 12:9a20164dcc47 123 * - for 'realloc': '0xptr;size', where 'ptr' (base 16) and 'size' are the original arguments to 'realloc'.
vipinranka 12:9a20164dcc47 124 * - for 'calloc': 'nmemb;size', where 'nmemb' and 'size' are the original arguments to 'calloc'.
vipinranka 12:9a20164dcc47 125 * - for 'free': '0xptr', where 'ptr' (base 16) is the original argument to 'free'.
vipinranka 12:9a20164dcc47 126 *
vipinranka 12:9a20164dcc47 127 * Examples:
vipinranka 12:9a20164dcc47 128 *
vipinranka 12:9a20164dcc47 129 * - '#m:0x20003240;0x600d-50' encodes a 'malloc' that returned 0x20003240, was called
vipinranka 12:9a20164dcc47 130 * by the instruction at 0x600D with a the 'size' argument equal to 50.
vipinranka 12:9a20164dcc47 131 * - '#f:0x0;0x602f-0x20003240' encodes a 'free' that was called by the instruction at
vipinranka 12:9a20164dcc47 132 * 0x602f with the 'ptr' argument equal to 0x20003240.
vipinranka 12:9a20164dcc47 133 */
vipinranka 12:9a20164dcc47 134 void mbed_mem_trace_default_callback(uint8_t op, void *res, void *caller, ...);
vipinranka 12:9a20164dcc47 135
vipinranka 12:9a20164dcc47 136 #ifdef __cplusplus
vipinranka 12:9a20164dcc47 137 }
vipinranka 12:9a20164dcc47 138 #endif
vipinranka 12:9a20164dcc47 139
vipinranka 12:9a20164dcc47 140 #endif// #ifndef __MBED_MEM_TRACE_H__
vipinranka 12:9a20164dcc47 141
vipinranka 12:9a20164dcc47 142
vipinranka 12:9a20164dcc47 143 /** @}*/