-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathdbc_timer.h
executable file
·48 lines (35 loc) · 910 Bytes
/
dbc_timer.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
#ifndef __DBC_TIMER_H__
#define __DBC_TIMER_H__
#define _10msTask 1
#define _20msTask 2
#define _50msTask 3
#define _100msTask 4
#include "canbus.h"
typedef struct{
pthread_cond_t _10msThreadReady;
pthread_cond_t _20msThreadReady;
pthread_cond_t _50msThreadReady;
pthread_cond_t _100msThreadReady;
int threadStop;
pthread_mutex_t timerThreadLock;
pthread_t *timerRoutineThread;
} TimerThread_t;
typedef struct taskArg{
canBus_t * can;
unsigned int boId;
}taskArg_t;
typedef struct TaskAdd{
void(*task)(taskArg_t *);
int canID;
taskArg_t arg;
}TaskAdd_t;
TimerThread_t* TimerRoutineInit(void);
TimerThread_t* timerThread;
/*
Task->task is the thread to be run
Task->canID is the parameter of the task
*/
pthread_t AddTimerTask(TaskAdd_t * Task, int Type);
void TimerCtl(int on_off);
//void _100MsTask(void (*fun)(void));
#endif // __DBC_TIMER_H__