This is an OSC library for the mbed, created to be compatible with Recotana\'s OSCClass library (http://recotana.com) for the Arduino with Ethernet shield. I have also used parts of the OSC Transceiver(Sender/Receiver) code by xshige. It has many limitations, but it works for simple things (check comments on the mbedOSC.h). It will be evolving. written by: Alvaro Cassinelli, 7.10.2011

Dependencies:   mbed

Committer:
mbedalvaro
Date:
Sat Oct 15 14:15:55 2011 +0000
Revision:
0:f76708a93fb3
First working test of this simple OSC library.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedalvaro 0:f76708a93fb3 1 /*
mbedalvaro 0:f76708a93fb3 2 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
mbedalvaro 0:f76708a93fb3 3 * All rights reserved.
mbedalvaro 0:f76708a93fb3 4 *
mbedalvaro 0:f76708a93fb3 5 * Redistribution and use in source and binary forms, with or without modification,
mbedalvaro 0:f76708a93fb3 6 * are permitted provided that the following conditions are met:
mbedalvaro 0:f76708a93fb3 7 *
mbedalvaro 0:f76708a93fb3 8 * 1. Redistributions of source code must retain the above copyright notice,
mbedalvaro 0:f76708a93fb3 9 * this list of conditions and the following disclaimer.
mbedalvaro 0:f76708a93fb3 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbedalvaro 0:f76708a93fb3 11 * this list of conditions and the following disclaimer in the documentation
mbedalvaro 0:f76708a93fb3 12 * and/or other materials provided with the distribution.
mbedalvaro 0:f76708a93fb3 13 * 3. The name of the author may not be used to endorse or promote products
mbedalvaro 0:f76708a93fb3 14 * derived from this software without specific prior written permission.
mbedalvaro 0:f76708a93fb3 15 *
mbedalvaro 0:f76708a93fb3 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
mbedalvaro 0:f76708a93fb3 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
mbedalvaro 0:f76708a93fb3 18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
mbedalvaro 0:f76708a93fb3 19 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
mbedalvaro 0:f76708a93fb3 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
mbedalvaro 0:f76708a93fb3 21 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbedalvaro 0:f76708a93fb3 22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbedalvaro 0:f76708a93fb3 23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
mbedalvaro 0:f76708a93fb3 24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
mbedalvaro 0:f76708a93fb3 25 * OF SUCH DAMAGE.
mbedalvaro 0:f76708a93fb3 26 *
mbedalvaro 0:f76708a93fb3 27 * This file is part of the lwIP TCP/IP stack.
mbedalvaro 0:f76708a93fb3 28 *
mbedalvaro 0:f76708a93fb3 29 * Author: Adam Dunkels <adam@sics.se>
mbedalvaro 0:f76708a93fb3 30 *
mbedalvaro 0:f76708a93fb3 31 */
mbedalvaro 0:f76708a93fb3 32
mbedalvaro 0:f76708a93fb3 33 #ifndef __LWIP_MEMP_H__
mbedalvaro 0:f76708a93fb3 34 #define __LWIP_MEMP_H__
mbedalvaro 0:f76708a93fb3 35
mbedalvaro 0:f76708a93fb3 36 #include "lwip/opt.h"
mbedalvaro 0:f76708a93fb3 37
mbedalvaro 0:f76708a93fb3 38 #ifdef __cplusplus
mbedalvaro 0:f76708a93fb3 39 extern "C" {
mbedalvaro 0:f76708a93fb3 40 #endif
mbedalvaro 0:f76708a93fb3 41
mbedalvaro 0:f76708a93fb3 42 /* Create the list of all memory pools managed by memp. MEMP_MAX represents a NULL pool at the end */
mbedalvaro 0:f76708a93fb3 43 typedef enum {
mbedalvaro 0:f76708a93fb3 44 #define LWIP_MEMPOOL(name,num,size,desc) MEMP_##name,
mbedalvaro 0:f76708a93fb3 45 #include "lwip/memp_std.h"
mbedalvaro 0:f76708a93fb3 46 MEMP_MAX
mbedalvaro 0:f76708a93fb3 47 } memp_t;
mbedalvaro 0:f76708a93fb3 48
mbedalvaro 0:f76708a93fb3 49 #if MEM_USE_POOLS
mbedalvaro 0:f76708a93fb3 50 /* Use a helper type to get the start and end of the user "memory pools" for mem_malloc */
mbedalvaro 0:f76708a93fb3 51 typedef enum {
mbedalvaro 0:f76708a93fb3 52 /* Get the first (via:
mbedalvaro 0:f76708a93fb3 53 MEMP_POOL_HELPER_START = ((u8_t) 1*MEMP_POOL_A + 0*MEMP_POOL_B + 0*MEMP_POOL_C + 0)*/
mbedalvaro 0:f76708a93fb3 54 MEMP_POOL_HELPER_FIRST = ((u8_t)
mbedalvaro 0:f76708a93fb3 55 #define LWIP_MEMPOOL(name,num,size,desc)
mbedalvaro 0:f76708a93fb3 56 #define LWIP_MALLOC_MEMPOOL_START 1
mbedalvaro 0:f76708a93fb3 57 #define LWIP_MALLOC_MEMPOOL(num, size) * MEMP_POOL_##size + 0
mbedalvaro 0:f76708a93fb3 58 #define LWIP_MALLOC_MEMPOOL_END
mbedalvaro 0:f76708a93fb3 59 #include "lwip/memp_std.h"
mbedalvaro 0:f76708a93fb3 60 ) ,
mbedalvaro 0:f76708a93fb3 61 /* Get the last (via:
mbedalvaro 0:f76708a93fb3 62 MEMP_POOL_HELPER_END = ((u8_t) 0 + MEMP_POOL_A*0 + MEMP_POOL_B*0 + MEMP_POOL_C*1) */
mbedalvaro 0:f76708a93fb3 63 MEMP_POOL_HELPER_LAST = ((u8_t)
mbedalvaro 0:f76708a93fb3 64 #define LWIP_MEMPOOL(name,num,size,desc)
mbedalvaro 0:f76708a93fb3 65 #define LWIP_MALLOC_MEMPOOL_START
mbedalvaro 0:f76708a93fb3 66 #define LWIP_MALLOC_MEMPOOL(num, size) 0 + MEMP_POOL_##size *
mbedalvaro 0:f76708a93fb3 67 #define LWIP_MALLOC_MEMPOOL_END 1
mbedalvaro 0:f76708a93fb3 68 #include "lwip/memp_std.h"
mbedalvaro 0:f76708a93fb3 69 )
mbedalvaro 0:f76708a93fb3 70 } memp_pool_helper_t;
mbedalvaro 0:f76708a93fb3 71
mbedalvaro 0:f76708a93fb3 72 /* The actual start and stop values are here (cast them over)
mbedalvaro 0:f76708a93fb3 73 We use this helper type and these defines so we can avoid using const memp_t values */
mbedalvaro 0:f76708a93fb3 74 #define MEMP_POOL_FIRST ((memp_t) MEMP_POOL_HELPER_FIRST)
mbedalvaro 0:f76708a93fb3 75 #define MEMP_POOL_LAST ((memp_t) MEMP_POOL_HELPER_LAST)
mbedalvaro 0:f76708a93fb3 76 #endif /* MEM_USE_POOLS */
mbedalvaro 0:f76708a93fb3 77
mbedalvaro 0:f76708a93fb3 78 #if MEMP_MEM_MALLOC || MEM_USE_POOLS
mbedalvaro 0:f76708a93fb3 79 extern const u16_t memp_sizes[MEMP_MAX];
mbedalvaro 0:f76708a93fb3 80 #endif /* MEMP_MEM_MALLOC || MEM_USE_POOLS */
mbedalvaro 0:f76708a93fb3 81
mbedalvaro 0:f76708a93fb3 82 #if MEMP_MEM_MALLOC
mbedalvaro 0:f76708a93fb3 83
mbedalvaro 0:f76708a93fb3 84 #include "mem.h"
mbedalvaro 0:f76708a93fb3 85
mbedalvaro 0:f76708a93fb3 86 #define memp_init()
mbedalvaro 0:f76708a93fb3 87 #define memp_malloc(type) mem_malloc(memp_sizes[type])
mbedalvaro 0:f76708a93fb3 88 #define memp_free(type, mem) mem_free(mem)
mbedalvaro 0:f76708a93fb3 89
mbedalvaro 0:f76708a93fb3 90 #else /* MEMP_MEM_MALLOC */
mbedalvaro 0:f76708a93fb3 91
mbedalvaro 0:f76708a93fb3 92 #if MEM_USE_POOLS
mbedalvaro 0:f76708a93fb3 93 /** This structure is used to save the pool one element came from. */
mbedalvaro 0:f76708a93fb3 94 struct memp_malloc_helper
mbedalvaro 0:f76708a93fb3 95 {
mbedalvaro 0:f76708a93fb3 96 memp_t poolnr;
mbedalvaro 0:f76708a93fb3 97 };
mbedalvaro 0:f76708a93fb3 98 #endif /* MEM_USE_POOLS */
mbedalvaro 0:f76708a93fb3 99
mbedalvaro 0:f76708a93fb3 100 void memp_init(void);
mbedalvaro 0:f76708a93fb3 101
mbedalvaro 0:f76708a93fb3 102 #if MEMP_OVERFLOW_CHECK
mbedalvaro 0:f76708a93fb3 103 void *memp_malloc_fn(memp_t type, const char* file, const int line);
mbedalvaro 0:f76708a93fb3 104 #define memp_malloc(t) memp_malloc_fn((t), __FILE__, __LINE__)
mbedalvaro 0:f76708a93fb3 105 #else
mbedalvaro 0:f76708a93fb3 106 void *memp_malloc(memp_t type);
mbedalvaro 0:f76708a93fb3 107 #endif
mbedalvaro 0:f76708a93fb3 108 void memp_free(memp_t type, void *mem);
mbedalvaro 0:f76708a93fb3 109
mbedalvaro 0:f76708a93fb3 110 #endif /* MEMP_MEM_MALLOC */
mbedalvaro 0:f76708a93fb3 111
mbedalvaro 0:f76708a93fb3 112 #ifdef __cplusplus
mbedalvaro 0:f76708a93fb3 113 }
mbedalvaro 0:f76708a93fb3 114 #endif
mbedalvaro 0:f76708a93fb3 115
mbedalvaro 0:f76708a93fb3 116 #endif /* __LWIP_MEMP_H__ */