Tiny protocol  0.7.0
Tiny communication protocol for microcontrollers
tiny_defines.h
1 /*
2  Copyright 2016 (C) Alexey Dynda
3 
4  This file is part of Tiny Protocol Library.
5 
6  Protocol Library is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Protocol Library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with Protocol Library. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef _TINY_DEFINES_H_
21 #define _TINY_DEFINES_H_
22 
23 #include "tiny_config.h"
24 
25 /* For fastest version of protocol assign all defines to zero.
26  * In this case protocol supports no CRC field, and
27  * all api functions become not thread-safe.
28  */
29 
30 #undef PLATFORM_MUTEX
31 
32 #define MUTEX_INIT(x)
33 
34 #define MUTEX_LOCK(x)
35 
36 #define MUTEX_TRY_LOCK(x) 0
37 
38 #define MUTEX_UNLOCK(x)
39 
40 #define MUTEX_DESTROY(x)
41 
42 #undef PLATFORM_COND
43 
44 #define COND_INIT(x)
45 
46 #define COND_DESTROY(x)
47 
48 #define COND_WAIT(cond, mutex)
49 
50 #define COND_SIGNAL(x)
51 
52 #define TASK_YIELD()
53 
54 #define PLATFORM_TICKS() millis()
55 
56 #ifdef __linux__
57 #include <stdint.h>
58 static inline uint32_t millis() { return 0; }
59 #endif
60 
61 #endif /* _TINY_DEFINES_H_ */
62 
63