UIPEthernet library for Arduino IDE, Eclipse with arduino plugin and MBED/SMeshStudio (AVR,STM32F,ESP8266,Intel ARC32,Nordic nRF51,Teensy boards,Realtek Ameba(RTL8195A,RTL8710)), ENC28j60 network chip. Compatible with Wiznet W5100 Ethernet library API. Compiled and tested on Nucleo-F302R8. Master repository is: https://github.com/UIPEthernet/UIPEthernet/

Committer:
cassyarduino
Date:
Tue Jan 23 15:08:43 2018 +0100
Revision:
39:deeb00b81cc9
Parent:
0:e3fb1267e3c3
Release: 2.0.4

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cassyarduino 0:e3fb1267e3c3 1 /*
cassyarduino 0:e3fb1267e3c3 2 mempool.h - sleek implementation of a memory pool
cassyarduino 0:e3fb1267e3c3 3 Copyright (c) 2013 Norbert Truchsess <norbert.truchsess@t-online.de>
cassyarduino 0:e3fb1267e3c3 4 All rights reserved.
cassyarduino 0:e3fb1267e3c3 5
cassyarduino 0:e3fb1267e3c3 6 This program is free software: you can redistribute it and/or modify
cassyarduino 0:e3fb1267e3c3 7 it under the terms of the GNU General Public License as published by
cassyarduino 0:e3fb1267e3c3 8 the Free Software Foundation, either version 3 of the License, or
cassyarduino 0:e3fb1267e3c3 9 (at your option) any later version.
cassyarduino 0:e3fb1267e3c3 10
cassyarduino 0:e3fb1267e3c3 11 This program is distributed in the hope that it will be useful,
cassyarduino 0:e3fb1267e3c3 12 but WITHOUT ANY WARRANTY; without even the implied warranty of
cassyarduino 0:e3fb1267e3c3 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cassyarduino 0:e3fb1267e3c3 14 GNU General Public License for more details.
cassyarduino 0:e3fb1267e3c3 15
cassyarduino 0:e3fb1267e3c3 16 You should have received a copy of the GNU General Public License
cassyarduino 0:e3fb1267e3c3 17 along with this program. If not, see <http://www.gnu.org/licenses/>.
cassyarduino 0:e3fb1267e3c3 18 */
cassyarduino 0:e3fb1267e3c3 19
cassyarduino 0:e3fb1267e3c3 20 #ifndef MEMPOOL_H
cassyarduino 0:e3fb1267e3c3 21 #define MEMPOOL_H
cassyarduino 0:e3fb1267e3c3 22
cassyarduino 0:e3fb1267e3c3 23 #include <inttypes.h>
cassyarduino 0:e3fb1267e3c3 24
cassyarduino 0:e3fb1267e3c3 25 #define POOLSTART 0
cassyarduino 0:e3fb1267e3c3 26 #define NOBLOCK 0
cassyarduino 0:e3fb1267e3c3 27
cassyarduino 0:e3fb1267e3c3 28 #include "mempool_conf.h"
cassyarduino 0:e3fb1267e3c3 29
cassyarduino 0:e3fb1267e3c3 30 struct memblock
cassyarduino 0:e3fb1267e3c3 31 {
cassyarduino 0:e3fb1267e3c3 32 memaddress begin;
cassyarduino 0:e3fb1267e3c3 33 memaddress size;
cassyarduino 0:e3fb1267e3c3 34 memhandle nextblock;
cassyarduino 0:e3fb1267e3c3 35 };
cassyarduino 0:e3fb1267e3c3 36
cassyarduino 0:e3fb1267e3c3 37 class MemoryPool
cassyarduino 0:e3fb1267e3c3 38 {
cassyarduino 0:e3fb1267e3c3 39 #ifdef MEMPOOLTEST_H
cassyarduino 0:e3fb1267e3c3 40 friend class MemoryPoolTest;
cassyarduino 0:e3fb1267e3c3 41 #endif
cassyarduino 0:e3fb1267e3c3 42
cassyarduino 0:e3fb1267e3c3 43 protected:
cassyarduino 0:e3fb1267e3c3 44 static struct memblock blocks[MEMPOOL_NUM_MEMBLOCKS+1];
cassyarduino 0:e3fb1267e3c3 45
cassyarduino 0:e3fb1267e3c3 46 public:
cassyarduino 0:e3fb1267e3c3 47 static void init();
cassyarduino 0:e3fb1267e3c3 48 static memhandle allocBlock(memaddress);
cassyarduino 0:e3fb1267e3c3 49 static void freeBlock(memhandle);
cassyarduino 0:e3fb1267e3c3 50 static void resizeBlock(memhandle handle, memaddress position);
cassyarduino 0:e3fb1267e3c3 51 static void resizeBlock(memhandle handle, memaddress position, memaddress size);
cassyarduino 0:e3fb1267e3c3 52 static memaddress blockSize(memhandle);
cassyarduino 0:e3fb1267e3c3 53 };
cassyarduino 0:e3fb1267e3c3 54 #endif