forked from seth4618/bbsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdefs.h
53 lines (45 loc) · 1.26 KB
/
defs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef __DEFS_H__
#define __DEFS_H__
#include <stdint.h>
// place all nicknames for standard variable types in this file
typedef uint8_t byte;
#define POINTER_SIZE sizeof(char*)
typedef uint16_t NodeID;
#if 0
// lock/unlock for simulator
#ifdef BBSIM
#define BB_LOCK(x) pthread_mutex_lock(x);
#define BB_UNLOCK(x) pthread_mutex_unlock(x);
// lock/unlock for blocks
#else
#include "util/atomic.h"
#define BB_LOCK(x) ATOMIC_BLOCK(x) {
#define BB_UNLOCK(x) }
#endif
#else
#define BB_LOCK(x) {
#define BB_UNLOCK(x) }
#endif
// These are standard definitions for the AVR compiler
//[signed | unsigned] char : 8 bits
//[signed | unsigned] short [int] : 16 bits
//[signed | unsigned] int: 16 bits
//[signed | unsigned] long [int] : 32 bits
//[signed | unsigned] long long [int] : 64 bits
//---------NAMING CONVENTIONS---------------------
//
// These are used for all globally accessible types, variables, and functions.
//
// type information -> CapitalizedCapitalized
// ex: Color, Intensity, Timer
//
// functions -> uncapitalizedCapitalized
// ex: getChunk, push, getTime
//
// global variables -> uncapitalizedCapitalized
// ex: thisChunk, thisTimeout, etc.
//
// defines -> ALLCAPS_UNDERSCORE_DELINEATION
// ex: NUM_PORTS, ACK
//
#endif