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
|
#ifndef __gpos_def_h__
#define __gpos_def_h__
typedef enum{
H_THREAD_SOUND,
H_THREAD_IDLE,
H_THREAD_GPMAIN,
H_THREAD_NET,
H_THREAD_TMR0,
H_THREAD_TMR1,
H_THREAD_TMR2,
H_THREAD_TMR3
}H_THREAD;
/*************************************************************
* OS launching flag *
*************************************************************/
#define ALLOW_PRIORITY_REVERSION 0x1 //BIT [0] flag : if set, allow reversion.
/*******************************************************************/
/*Schedule related define*/
#define GPOS_DFT_RUNNING_TIME 20 //20*2 = 40ms
#define GPOS_DFT_SUSPEND_TIME 5 //5*2 = 10ms
/*******************************************************************/
/*******************************************************************/
/*Priority define*/
#define GPOS_PRIO_ABOVE_NORMAL 2
#define GPOS_PRIO_NORMAL 3
#define GPOS_PRIO_BELOW_NORMAL 4
#define GPOS_PRIO_LOW 5
/*******************************************************************/
/*******************************************************************/
/*GP kernel related return values list*/
#define GPOS_ERR_OK 0
#define GPOS_ERR_NOEFFECT 1
#define GPOS_ERR_INVALIDARG 2
#define GPOS_ERR_ALREADY_USED 3
#define GPOS_ERR_INVALID_ACCESS 4
#define GPOS_ERR_OUTOFMEM 5
#define GPOS_ERR_STACK 6
#define GPOS_ERR_PENDED_THREAD 7
/*******************************************************************/
/*******************************************************************/
/*User thread define*/
#define GPC_MAXPROGTIMER 4
int GpTimerOptSet(int idx, int tmr_tps, int max_exec_tick, void (*irq_tmrfunc)(void));
int GpTimerSet(int idx);
int GpTimerPause(int idx);
int GpTimerResume(int idx);
void GpTimerKill(int idx);
/*******************************************************************/
/*******************************************************************/
/*GP kernel control define*/
void GpMain(void * arg);
void GpKernelInitialize(void);
void GpKernelStart(void);
void GpKernelOptSet(int flag);
void GpKernelLock(void);
void GpKernelUnlock(void);
void GpThreadSleep(unsigned int delay);
int GpThreadOptSet(H_THREAD th, int priority, int stk_size); /*return ok or err*/
H_THREAD GpThreadHandleGet(void);
void GpNetThreadAct(void (*t_func)(void));
void GpNetThreadDelete(void);
/*******************************************************************/
int GpPredefinedStackGet(H_THREAD th);
#endif
|