ARM Shanghai IoT Team (Internal) / newMiniTLS-GPL

Fork of MiniTLS-GPL by Donatien Garnier

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers fwk.h Source File

fwk.h

Go to the documentation of this file.
00001 /*
00002 MiniTLS - A super trimmed down TLS/SSL Library for embedded devices
00003 Author: Donatien Garnier
00004 Copyright (C) 2013-2014 AppNearMe Ltd
00005 
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU General Public License
00008 as published by the Free Software Foundation; either version 2
00009 of the License, or (at your option) any later version.
00010 
00011 This program is distributed in the hope that it will be useful,
00012 but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 GNU General Public License for more details.
00015 
00016 You should have received a copy of the GNU General Public License
00017 along with this program; if not, write to the Free Software
00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019 *//**
00020  * \file fwk.h
00021  * \copyright Copyright (c) AppNearMe Ltd 2013
00022  * \author Donatien Garnier
00023  * \details Standard include and defines
00024  */
00025 
00026 #ifndef FWK_H_
00027 #define FWK_H_
00028 
00029 //Standard types definition
00030 #include "stdint.h"
00031 #include "stdbool.h"
00032 #include "stddef.h"
00033 
00034 #include "string.h"
00035 
00036 //NULL pointer definition
00037 #ifndef NULL
00038 #define NULL ((void*)0)
00039 #endif
00040 
00041 //Debugging
00042 #include "debug.h"
00043 
00044 //Buffer
00045 #include "buffer.h"
00046 #include "buffer_network.h"
00047 
00048 //RTOS
00049 //#include "rtos.h" -- not for mbed
00050 //Must be defined by impl
00051 struct rtos_mtx_struct;
00052 struct rtos_sem_struct;
00053 
00054 //Typedefs
00055 typedef struct rtos_mtx_struct rtos_mtx_t;
00056 typedef struct rtos_sem_struct rtos_sem_t;
00057 
00058 //Semaphores
00059 rtos_sem_t* rtos_sem_create(int max, int count);
00060 bool rtos_sem_get(rtos_sem_t* pSem, int timeout);
00061 void rtos_sem_give(rtos_sem_t* pSem/*, int timeout*/); //Saturated
00062 
00063 //Mutexes
00064 rtos_mtx_t* rtos_mtx_create(void);
00065 void rtos_mtx_lock(rtos_mtx_t* pMtx);
00066 void rtos_mtx_unlock(rtos_mtx_t* pMtx);
00067 
00068 
00069 
00070 //Macros
00071 #define MAX(a,b) (((a)>(b))?(a):(b))
00072 #define MIN(a,b) (((a)<(b))?(a):(b))
00073 
00074 //Pack
00075 #ifdef __GNUC__
00076 #define PACKED __attribute__ ((packed))
00077 #else
00078 #define PACKED
00079 #endif
00080 
00081 #endif /* FWK_H_ */