-
Notifications
You must be signed in to change notification settings - Fork 0
/
queue_makePortsMacros.h
61 lines (45 loc) · 1.75 KB
/
queue_makePortsMacros.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
54
55
56
57
58
59
60
61
//
// Created by proszkowski on 13.06.2022.
//
#ifndef LOGGERDEMO_QUEUE_MAKEPORTSMACROS_H
#define LOGGERDEMO_QUEUE_MAKEPORTSMACROS_H
#include "queue.h"
#define QUEUE_STATIC_ALLOCATION(portName,elSize, elAmount) \
static Queue_t _##portName##QueCtrlMem; \
static Queue _##portName##Que = NULL; \
static uint8_t _##portName##QueElMem[elSize*elAmount];
#define QUEUE_STATIC_CREATE_PORT_HEADER(portName) \
bool Queue_##portName##TxPort_Create(void);
#define QUEUE_STATIC_CREATE_PORT(portName, elSize, elAmount) \
bool Queue_##portName##TxPort_Create(void){ \
_##portName##Que = Queue_Create(1, elSize*elAmount, _##portName##QueElMem, &_##portName##QueCtrlMem); \
if (_##portName##Que == NULL){ \
return false; \
} \
return true; \
}
#define QUEUE_STATIC_PUT_PORT_HEADER(portName) \
bool Queue_##portName##TxPort_Put(const void* elPtr);
#define QUEUE_STATIC_PUT_PORT(portName) \
bool Queue_##portName##TxPort_Put(const void* elPtr){ \
if(Queue_Put(_##portName##Que, elPtr) == Que_OK){ \
return true; \
} \
return false; \
}
#define QUEUE_STATIC_GET_PORT_HEADER(portName) \
bool Queue_##portName##TxPort_Get(void* elPtr);
#define QUEUE_STATIC_GET_PORT(portName) \
bool Queue_##portName##TxPort_Get(void* elPtr){ \
if(Queue_Get(_##portName##Que, elPtr) == Que_OK){ \
return true; \
} \
return false; \
}
#define QUEUE_STATIC_GET_MAX_DEPTH_PORT_HEADER(portName) \
uint16_t Queue_##portName##TxPortGetMaxDepth(void);
#define QUEUE_STATIC_GET_MAX_DEPTH_PORT(portName) \
uint16_t Queue_##portName##TxPortGetMaxDepth(void){ \
return Queue_GetMaxDepth(_##portName##Que); \
}
#endif //LOGGERDEMO_QUEUE_MAKEPORTSMACROS_H