Development mbed library for MAX32630FTHR

Dependents:   blinky_max32630fthr

Committer:
switches
Date:
Fri Dec 16 16:27:57 2016 +0000
Revision:
3:1198227e6421
Parent:
0:5c4d7b2438d3
Changed ADC scale for MAX32625 platforms to 1.2V full scale to match MAX32630 platforms

Who changed what in which revision?

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