-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpcommon_cpaal5.h
79 lines (66 loc) · 1.83 KB
/
cpcommon_cpaal5.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
77
78
#ifndef _INC_CPCOMMON_H
#define _INC_CPCOMMON_H
#define VOLATILE32(addr) (*(volatile bit32u *)(addr))
#ifndef dbgPrintf
#define dbgPrintf HalDev->OsFunc->Printf
#endif
#define ChannelUpdate(Field) if(HalChn->Field != 0xFFFFFFFF) HalDev->ChData[Ch].Field = HalChn->Field
#define DBG(level) (HalDev->debug & (1<<(level)))
/*
#define DBG0() DBG(0)
#define DBG1() DBG(1)
#define DBG2() DBG(2)
#define DBG3() DBG(3)
#define DBG4() DBG(4)
#define DBG5() DBG(5)
#define DBG6() DBG(6)
#define DBG7() DBG(7)
*/
/*
* List of defined actions for use with Control().
*/
typedef enum
{
enGET=0, /**< Get the value associated with a key */
enSET, /**< Set the value associates with a key */
enCLEAR, /**<Clear the value */
enNULL /**< No data action, used to initiate a service or send a message */
}ACTION;
/*
* Enumerated hardware states.
*/
typedef enum
{
enConnected=1, enDevFound, enInitialized, enOpened
}DEVICE_STATE;
typedef enum
{
enCommonStart=0,
/* General */
enOff, enOn, enDebug,
/* Module General */
enCpuFreq,
enStatus,
enCommonEnd
}COMMON_KEY;
typedef struct
{
const char *strKey;
int enKey;
}CONTROL_KEY;
typedef struct
{
char *StatName;
unsigned int *StatPtr;
int DataType; /* 0: int, 1: hex int, 2:channel data */
}STATS_TABLE;
typedef struct
{
int NumberOfStats;
STATS_TABLE *StatTable;
}STATS_DB;
#define osfuncSioFlush() HalDev->OsFunc->Control(HalDev->OsDev,"SioFlush",pszNULL,0)
#define osfuncSleep(Ticks) HalDev->OsFunc->Control(HalDev->OsDev,pszSleep,pszNULL,Ticks)
#define osfuncStateChange() HalDev->OsFunc->Control(HalDev->OsDev,pszStateChange,pszNULL,0)
#define CHANNEL_NAMES {"Ch0","Ch1","Ch2","Ch3","Ch4","Ch5","Ch6","Ch7","Ch8","Ch9","Ch10","Ch11","Ch12","Ch13","Ch14","Ch15"}
#endif