1553.c 4.09 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
#include <string.h>
#include <math.h>
8
9


Maxime Perrotin's avatar
Maxime Perrotin committed
10
#include "1553.h"
11
12
13



14
15
void __po_hi_c_Node_Addr_T_Initialize(__po_hi_c_Node_Addr_T* pVal)
{
Maxime Perrotin's avatar
Maxime Perrotin committed
16
17
	(void)pVal;

18
19

	(*(pVal)) = 0;
20
21
}

yoogx's avatar
yoogx committed
22
flag __po_hi_c_Node_Addr_T_IsConstraintValid(const __po_hi_c_Node_Addr_T* pVal, int* pErrCode)
23
{
yoogx's avatar
yoogx committed
24
    flag ret = TRUE;
Maxime Perrotin's avatar
Maxime Perrotin committed
25
	(void)pVal;
26
27
	
    ret = ((*(pVal)) <= 31UL);
Maxime Perrotin's avatar
Maxime Perrotin committed
28
    *pErrCode = ret ? 0 :  ERR_NODE_ADDR_T; 
29

30
31
	return ret;
}
32
33


34

35
36
void __po_hi_c_Standard_T_Initialize(__po_hi_c_Standard_T* pVal)
{
Maxime Perrotin's avatar
Maxime Perrotin committed
37
38
	(void)pVal;

39
40

	(*(pVal)) = __po_hi_c_mil1553a;
41
42
}

yoogx's avatar
yoogx committed
43
flag __po_hi_c_Standard_T_IsConstraintValid(const __po_hi_c_Standard_T* pVal, int* pErrCode)
44
{
yoogx's avatar
yoogx committed
45
    flag ret = TRUE;
Maxime Perrotin's avatar
Maxime Perrotin committed
46
	(void)pVal;
47
48
	
    ret = ((((*(pVal)) == __po_hi_c_mil1553a)) || (((*(pVal)) == __po_hi_c_mil1553b)));
Maxime Perrotin's avatar
Maxime Perrotin committed
49
    *pErrCode = ret ? 0 :  ERR_STANDARD_T; 
50

51
52
	return ret;
}
53
54


55

56
57
void __po_hi_c_Mode_T_Initialize(__po_hi_c_Mode_T* pVal)
{
Maxime Perrotin's avatar
Maxime Perrotin committed
58
59
	(void)pVal;

60
61

	(*(pVal)) = __po_hi_c_controller;
62
63
}

yoogx's avatar
yoogx committed
64
flag __po_hi_c_Mode_T_IsConstraintValid(const __po_hi_c_Mode_T* pVal, int* pErrCode)
65
{
yoogx's avatar
yoogx committed
66
    flag ret = TRUE;
Maxime Perrotin's avatar
Maxime Perrotin committed
67
	(void)pVal;
68
69
	
    ret = ((((((*(pVal)) == __po_hi_c_controller)) || (((*(pVal)) == __po_hi_c_terminal)))) || (((*(pVal)) == __po_hi_c_monitor)));
Maxime Perrotin's avatar
Maxime Perrotin committed
70
    *pErrCode = ret ? 0 :  ERR_MODE_T; 
71

72
73
	return ret;
}
74
75


76

77
78
void __po_hi_c_Bus_T_Initialize(__po_hi_c_Bus_T* pVal)
{
Maxime Perrotin's avatar
Maxime Perrotin committed
79
80
	(void)pVal;

81
82

	(*(pVal)) = __po_hi_c_none;
83
}
yoogx's avatar
yoogx committed
84
85
86
87

flag __po_hi_c_Bus_T_IsConstraintValid(const __po_hi_c_Bus_T* pVal, int* pErrCode)
{
    flag ret = TRUE;
Maxime Perrotin's avatar
Maxime Perrotin committed
88
	(void)pVal;
89
90
	
    ret = ((((((((*(pVal)) == __po_hi_c_none)) || (((*(pVal)) == __po_hi_c_bus_a)))) || (((*(pVal)) == __po_hi_c_bus_b)))) || (((*(pVal)) == __po_hi_c_both)));
Maxime Perrotin's avatar
Maxime Perrotin committed
91
    *pErrCode = ret ? 0 :  ERR_BUS_T; 
yoogx's avatar
yoogx committed
92
93
94

	return ret;
}
95
96
97
98
99



void __po_hi_c_mil_1553_conf_t_devname_Initialize(__po_hi_c_mil_1553_conf_t_devname val)
{
Maxime Perrotin's avatar
Maxime Perrotin committed
100
101
	(void)val;

102
103
104

	memset(val, 0x0, 21);

yoogx's avatar
yoogx committed
105
}
106
107
void __po_hi_c_mil_1553_conf_t_Initialize(__po_hi_c_mil_1553_conf_t* pVal)
{
Maxime Perrotin's avatar
Maxime Perrotin committed
108
109
	(void)pVal;

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129


	/*set devname */
	__po_hi_c_mil_1553_conf_t_devname_Initialize(pVal->devname);
	/*set standard */
	__po_hi_c_Standard_T_Initialize((&(pVal->standard)));
	/*set mode */
	__po_hi_c_Mode_T_Initialize((&(pVal->mode)));
	/*set bus */
	__po_hi_c_Bus_T_Initialize((&(pVal->bus)));
	/*set termaddr */
	__po_hi_c_Node_Addr_T_Initialize((&(pVal->termaddr)));
	/*set broadcast */
	pVal->broadcast = FALSE;
	/*set rxblock */
	pVal->exist.rxblock = 1;
	pVal->rxblock = FALSE;
	/*set txblock */
	pVal->exist.txblock = 1;
	pVal->txblock = FALSE;
130
131
}

Maxime Perrotin's avatar
Maxime Perrotin committed
132
flag __po_hi_c_mil_1553_conf_t_IsConstraintValid(const __po_hi_c_mil_1553_conf_t* pVal, int* pErrCode)
133
{
yoogx's avatar
yoogx committed
134
    flag ret = TRUE;
Maxime Perrotin's avatar
Maxime Perrotin committed
135
	(void)pVal;
136
137
	
    ret = ((1 <= strlen(pVal->devname)) && (strlen(pVal->devname) <= 20));
Maxime Perrotin's avatar
Maxime Perrotin committed
138
    *pErrCode = ret ? 0 :  ERR_MIL_1553_CONF_T_DEVNAME; 
139
    if (ret) {
140
<<<<<<< HEAD
Maxime Perrotin's avatar
Maxime Perrotin committed
141
        ret = __po_hi_c_Standard_T_IsConstraintValid((&(pVal->standard)), pErrCode);
142
        if (ret) {
Maxime Perrotin's avatar
Maxime Perrotin committed
143
            ret = __po_hi_c_Mode_T_IsConstraintValid((&(pVal->mode)), pErrCode);
144
            if (ret) {
Maxime Perrotin's avatar
Maxime Perrotin committed
145
                ret = __po_hi_c_Bus_T_IsConstraintValid((&(pVal->bus)), pErrCode);
146
                if (ret) {
Maxime Perrotin's avatar
Maxime Perrotin committed
147
                    ret = __po_hi_c_Node_Addr_T_IsConstraintValid((&(pVal->termaddr)), pErrCode);
148
=======
149
150
151
152
153
154
155
156
157
158
159
        ret = (((pVal->standard == __po_hi_c_mil1553a)) || ((pVal->standard == __po_hi_c_mil1553b)));
        *pErrCode = ret ? 0 :  ERR_MIL_1553_CONF_T_STANDARD; 
        if (ret) {
            ret = (((((pVal->mode == __po_hi_c_controller)) || ((pVal->mode == __po_hi_c_terminal)))) || ((pVal->mode == __po_hi_c_monitor)));
            *pErrCode = ret ? 0 :  ERR_MIL_1553_CONF_T_MODE; 
            if (ret) {
                ret = (((((((pVal->bus == __po_hi_c_none)) || ((pVal->bus == __po_hi_c_bus_a)))) || ((pVal->bus == __po_hi_c_bus_b)))) || ((pVal->bus == __po_hi_c_both)));
                *pErrCode = ret ? 0 :  ERR_MIL_1553_CONF_T_BUS; 
                if (ret) {
                    ret = (pVal->termaddr <= 31UL);
                    *pErrCode = ret ? 0 :  ERR_MIL_1553_CONF_T_TERMADDR; 
160
>>>>>>> 0e86b129902a792f4ae0c4a6bacb781c57331060
161
162
163
164
                }
            }
        }
    }
165

yoogx's avatar
yoogx committed
166
	return ret;
167
168
}

169
\n#endif