1553.c 4.13 KB
Newer Older
1
#if (defined (__PO_HI_NEED_DRIVER_1553_RASTA))\n
2
3
4
/*
Code automatically generated by asn1scc tool
*/
yoogx's avatar
yoogx committed
5
#include <limits.h>
6
7
8
9
#include <string.h>
#include <math.h>
#include "1553.h"

yoogx's avatar
yoogx committed
10
#if !defined(_MSC_VER) || _MSC_VER >= 1800
11
12
void __po_hi_c_Node_Addr_T_Initialize(__po_hi_c_Node_Addr_T* pVal)
{
yoogx's avatar
yoogx committed
13
    *pVal = (__po_hi_c_Node_Addr_T) 0;
14
}
yoogx's avatar
yoogx committed
15
#endif
16

yoogx's avatar
yoogx committed
17
18
 
flag __po_hi_c_Node_Addr_T_IsConstraintValid(const __po_hi_c_Node_Addr_T* pVal, int* pErrCode)
19
{
yoogx's avatar
yoogx committed
20
21
22
    
    flag ret = TRUE;
	*pErrCode=0;
23

yoogx's avatar
yoogx committed
24
	(void)pVal;
25

yoogx's avatar
yoogx committed
26
27
	ret = (0 <= *pVal && *pVal <= 31);
	*pErrCode = ret ? 0 : ERR___po_hi_c_Node_Addr_T;
28

yoogx's avatar
yoogx committed
29
30
31
	return ret;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1800
32
33
void __po_hi_c_Standard_T_Initialize(__po_hi_c_Standard_T* pVal)
{
yoogx's avatar
yoogx committed
34
    *pVal = (__po_hi_c_Standard_T) __po_hi_c_mil1553a;
35
}
yoogx's avatar
yoogx committed
36
#endif
37

yoogx's avatar
yoogx committed
38
39
 
flag __po_hi_c_Standard_T_IsConstraintValid(const __po_hi_c_Standard_T* pVal, int* pErrCode)
40
{
yoogx's avatar
yoogx committed
41
42
43
    
    flag ret = TRUE;
	*pErrCode=0;
44

yoogx's avatar
yoogx committed
45
	(void)pVal;
46

yoogx's avatar
yoogx committed
47
48
	ret = ((*pVal == __po_hi_c_mil1553a) || (*pVal == __po_hi_c_mil1553b));
	*pErrCode = ret ? 0 : ERR___po_hi_c_Standard_T;
49

yoogx's avatar
yoogx committed
50
51
52
	return ret;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1800
53
54
void __po_hi_c_Mode_T_Initialize(__po_hi_c_Mode_T* pVal)
{
yoogx's avatar
yoogx committed
55
    *pVal = (__po_hi_c_Mode_T) __po_hi_c_controller;
56
}
yoogx's avatar
yoogx committed
57
#endif
58

yoogx's avatar
yoogx committed
59
60
 
flag __po_hi_c_Mode_T_IsConstraintValid(const __po_hi_c_Mode_T* pVal, int* pErrCode)
61
{
yoogx's avatar
yoogx committed
62
63
64
    
    flag ret = TRUE;
	*pErrCode=0;
65

yoogx's avatar
yoogx committed
66
	(void)pVal;
67

yoogx's avatar
yoogx committed
68
69
	ret = (((*pVal == __po_hi_c_controller) || (*pVal == __po_hi_c_terminal)) || (*pVal == __po_hi_c_monitor));
	*pErrCode = ret ? 0 : ERR___po_hi_c_Mode_T;
70

yoogx's avatar
yoogx committed
71
72
73
	return ret;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1800
74
75
void __po_hi_c_Bus_T_Initialize(__po_hi_c_Bus_T* pVal)
{
yoogx's avatar
yoogx committed
76
    *pVal = (__po_hi_c_Bus_T) __po_hi_c_none;
77
}
yoogx's avatar
yoogx committed
78
79
80
81
82
83
84
85
#endif

 
flag __po_hi_c_Bus_T_IsConstraintValid(const __po_hi_c_Bus_T* pVal, int* pErrCode)
{
    
    flag ret = TRUE;
	*pErrCode=0;
86

yoogx's avatar
yoogx committed
87
	(void)pVal;
88

yoogx's avatar
yoogx committed
89
90
91
92
93
94
95
	ret = ((((*pVal == __po_hi_c_none) || (*pVal == __po_hi_c_bus_a)) || (*pVal == __po_hi_c_bus_b)) || (*pVal == __po_hi_c_both));
	*pErrCode = ret ? 0 : ERR___po_hi_c_Bus_T;

	return ret;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1800
void __po_hi_c_mil_1553_conf_t_devname_Initialize(__po_hi_c_mil_1553_conf_t_devname pVal)
96
{
yoogx's avatar
yoogx committed
97
98
99
    static __po_hi_c_mil_1553_conf_t_devname ret = 
        " ";
    strcpy(pVal, ret);
100
}
yoogx's avatar
yoogx committed
101
#endif
102

yoogx's avatar
yoogx committed
103
104
105
106
107
108
 
flag __po_hi_c_mil_1553_conf_t_devname_IsConstraintValid(const __po_hi_c_mil_1553_conf_t_devname pVal, int* pErrCode)
{
    
    flag ret = TRUE;
	*pErrCode=0;
109

yoogx's avatar
yoogx committed
110
	(void)pVal;
111

yoogx's avatar
yoogx committed
112
113
	ret = (1 <= strlen(pVal) && strlen(pVal) <= 20);
	*pErrCode = ret ? 0 : ERR___po_hi_c_mil_1553_conf_t_devname;
114

yoogx's avatar
yoogx committed
115
116
117
	return ret;
}
#if !defined(_MSC_VER) || _MSC_VER >= 1800
118
119
void __po_hi_c_mil_1553_conf_t_Initialize(__po_hi_c_mil_1553_conf_t* pVal)
{
yoogx's avatar
yoogx committed
120
121
122
123
124
125
126
127
128
129
130
131
132
133
    *pVal = (__po_hi_c_mil_1553_conf_t) {
    .devname = " ",
    .standard = __po_hi_c_mil1553a,
    .mode = __po_hi_c_controller,
    .bus = __po_hi_c_none,
    .termaddr = 0,
    .broadcast = FALSE,
    .rxblock = FALSE,
    .txblock = FALSE,
    .exist = {
        .rxblock = 1,
        .txblock = 1
    }
};
134
}
yoogx's avatar
yoogx committed
135
#endif
136

yoogx's avatar
yoogx committed
137
138
 
flag __po_hi_c_mil_1553_conf_t_IsConstraintValid(const __po_hi_c_mil_1553_conf_t* pVal, int* pErrCode)
139
{
yoogx's avatar
yoogx committed
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
    
    flag ret = TRUE;
	*pErrCode=0;

	(void)pVal;

	ret = __po_hi_c_mil_1553_conf_t_devname_IsConstraintValid(pVal->devname, pErrCode);
	if (ret) {
	    ret = __po_hi_c_Standard_T_IsConstraintValid(&pVal->standard, pErrCode);
	    if (ret) {
	        ret = __po_hi_c_Mode_T_IsConstraintValid(&pVal->mode, pErrCode);
	        if (ret) {
	            ret = __po_hi_c_Bus_T_IsConstraintValid(&pVal->bus, pErrCode);
	            if (ret) {
	                ret = __po_hi_c_Node_Addr_T_IsConstraintValid(&pVal->termaddr, pErrCode);
	                if (ret) {
	                    ret = TRUE; *pErrCode = 0;
	                    if (ret) {
	                        if (pVal->exist.rxblock==1) {
	                            ret = TRUE; *pErrCode = 0;
	                        }
	                        if (ret) {
	                            if (pVal->exist.txblock==1) {
	                                ret = TRUE; *pErrCode = 0;
	                            }
	                        
	                        }
	                    }
	                }
	            }
	        }
	    }
172
173
	}

yoogx's avatar
yoogx committed
174
	return ret;
175
176
}

177
\n#endif