-
Notifications
You must be signed in to change notification settings - Fork 1
/
queues_for_msgs_and_bits.h
76 lines (70 loc) · 2.15 KB
/
queues_for_msgs_and_bits.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef QUEUES_FOR_MSGS_AND_BITS_H
#define MSGQUE_BIT_PERIOD_SECS 60
#define MSGQUE_SMPL_PERIOD_MINS 30
typedef struct bitQueStruct {
PIO pio_id;
const uint sm_id;
const uint pin_rx;
repeating_timer_t rptTmr;
uint rxWrdTail;
uint rxWrdHead;
uint rxWrdCntr;
uint rxWrdHiWater;
uint rxWrdOvrRun;
uint rxWrdUndRun;
uint rxBitUndRun;
uint rxBitCnt;
uint32_t rxBitsBuf;
uint fifoHiWater;
uint totBitsCntr;
uint oneBitsCntr;
uint bQueSmplTotCnt;
uint bQueSmplOnesCnt;
uint32_t bQueSmplTimDlta;
uint32_t bQueSmplTimPrv;
uint rxWrdsMax;
void * rxWrdBuff;
} bitQue_t;
typedef struct msgQueStruct {
uint msgTail;
uint msgHead;
uint msgCntr;
uint msgOvrRun;
uint msgUndRun;
uint msgsHiWater;
uint msgVrfyCnt;
uint msgUnVrfyCnt;
uint mQueChkErr;
uint mQueHdrHits;
uint32_t mQueSmplTimPrv;
uint32_t mQueSmplTimDlta;
uint mQueSmplVrfyCnt;
uint mQueSmplUnVrfyCnt;
uint mQueSmplChkErrsCnt;
uint mQueSmplHdrHitsCnt;
uint msgMaxRecs;
uint8_t msgPrvChk;
bool msgHadPrv;
uint16_t msgPrevID;
uint16_t msgCrntID;
uint32_t msgPrvTime;
repeating_timer_t rptTmr;
spin_lock_t * msgQLock;
volatile bitQue_t * msgBitQueP;
void * mQueSubChan;
void * msgRecBuff;
uint8_t * msgPrvMsg;
} msgQue_t;
/*-----------------------------------------------------------------*/
extern void putNxtMsg( volatile msgQue_t * msgQ );
extern void freeLastMsg( volatile msgQue_t * msgQ );
extern bool tryMsgBuf( volatile msgQue_t * msgQ );
/*-----------------------------------------------------------------*/
extern void putNxtWrd( volatile bitQue_t * bitQ, uint32_t nxtWrd );
extern uint32_t getNxtWrd( volatile bitQue_t * bitQ );
extern bool tryWrdBuf( volatile bitQue_t * bitQ );
extern bool poll_FIFO_callback(struct repeating_timer *t);
extern bool tryBitBuf( volatile bitQue_t * bitQ );
extern bool getNxtBit_isSet( volatile bitQue_t * bitQ );
#define QUEUES_FOR_MSGS_AND_BITS_H
#endif