1 | /*
|
---|
2 | * TECS Generator
|
---|
3 | * Generator for TOPPERS Embedded Component System
|
---|
4 | *
|
---|
5 | * Copyright (C) 2008-2013 by TOPPERS Project
|
---|
6 | *--
|
---|
7 | * ä¸è¨èä½æ¨©è
|
---|
8 | ã¯ï¼ä»¥ä¸ã®(1)(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
9 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
10 | * å¤ã»åé
|
---|
11 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
12 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
13 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
14 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
15 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
16 | * ç¨ã§ããå½¢ã§åé
|
---|
17 | å¸ããå ´åã«ã¯ï¼åé
|
---|
18 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
19 | * è
|
---|
20 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
21 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
22 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
23 | * ç¨ã§ããªãå½¢ã§åé
|
---|
24 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
25 | * ã¨ï¼
|
---|
26 | * (a) åé
|
---|
27 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
28 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
29 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
30 | * (b) åé
|
---|
31 | å¸ã®å½¢æ
|
---|
32 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
33 | * å ±åãããã¨ï¼
|
---|
34 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
35 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
36 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
37 | 責ãããã¨ï¼
|
---|
38 | * ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
39 | * ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
40 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
41 | * å
|
---|
42 | 責ãããã¨ï¼
|
---|
43 | *
|
---|
44 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
45 | ã
|
---|
46 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
47 | * ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
48 | * ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
49 | * ã®è²¬ä»»ãè² ããªãï¼
|
---|
50 | *
|
---|
51 | * $Id: tNBOTDR_inline.h 270 2017-02-09 04:03:47Z coas-nagasima $
|
---|
52 | */
|
---|
53 |
|
---|
54 | /* #[<PREAMBLE>]#
|
---|
55 | * #[<...>]# ãã #[</...>]# ã§å²ã¾ããã³ã¡ã³ãã¯ç·¨éããªãã§ãã ãã
|
---|
56 | * tecsmerge ã«ãããã¼ã¸ã«ä½¿ç¨ããã¾ã
|
---|
57 | *
|
---|
58 | * å±æ§ã¢ã¯ã»ã¹ãã¯ã #_CAAM_#
|
---|
59 | * tmo TMO VAR_tmo
|
---|
60 | *
|
---|
61 | * å¼ã³å£é¢æ° #_TCPF_#
|
---|
62 | * call port: cChannel signature: sChannel context:task
|
---|
63 | * ER cChannel_send( const int8_t* buf, int16_t size, TMO tmo );
|
---|
64 | * ER cChannel_flush( TMO tmo );
|
---|
65 | * ER_UINT cChannel_receive( int8_t* buf, int16_t size, TMO tmo );
|
---|
66 | * ER cChannel_end_receive( );
|
---|
67 | * ER cChannel_reset( );
|
---|
68 | * require port: signature:sSysLog context:task
|
---|
69 | * ER write( uint_t prio, const SYSLOG* p_syslog );
|
---|
70 | * ER_UINT read( SYSLOG* p_syslog );
|
---|
71 | * ER mask( uint_t logmask, uint_t lowmask );
|
---|
72 | * ER refer( T_SYSLOG_RLOG* pk_rlog );
|
---|
73 | *
|
---|
74 | * #[</PREAMBLE>]# */
|
---|
75 |
|
---|
76 | /*
|
---|
77 | * marhaler, unmarshaler ã使ç¨ãã STRLEN é¢æ°ãå®ç¾©ãã
|
---|
78 | * marshaler, unmarshaler ã¯å¿
|
---|
79 | ã TDR 㯠ã«çµåããããã
|
---|
80 | */
|
---|
81 | #include "rpc_string.h"
|
---|
82 |
|
---|
83 | /*
|
---|
84 | * Network Byte Order TECS Data Representation
|
---|
85 | *
|
---|
86 | * NBOTDR is one of sTDR implementation and is default TDR for OpaqueRPC.
|
---|
87 | * NBOTDR always sends and receives data in Big Endian (Network Byte Order).
|
---|
88 | * So NBOTDR is useful with distributed hybrid systems.
|
---|
89 | */
|
---|
90 |
|
---|
91 | /*
|
---|
92 | * Macro Symbols:
|
---|
93 | * 1) endian
|
---|
94 | * NBOTDR_BIGENDIAN
|
---|
95 | * NBOTDR_LITTLEENDIAN
|
---|
96 | * if these macros are not specified, endian is automatically decided.
|
---|
97 | * 2) size of each type in bits.
|
---|
98 | * NBOTDR_LONG_BIT (32)
|
---|
99 | * NBOTDR_SHORT_BIT (16)
|
---|
100 | * NBOTDR_INT_BIT (32)
|
---|
101 | * NBOTDR_INTPTR_BIT (32)
|
---|
102 | * default value in parenthesises
|
---|
103 | * normally use default value
|
---|
104 | */
|
---|
105 |
|
---|
106 | /*
|
---|
107 | * ç¡èª¿æ´åã ããããããæ«å®çãªå®è£
|
---|
108 | ã«ãªã£ã¦ãã
|
---|
109 | * ã»ntohX(), htonX() 㯠int64_t åã«å®ç¾©ããã¦ãã (32bitãªããªã¼ãããã大)
|
---|
110 | * ã»int128_t, uint128_t 㯠tecs.h 㧠typedef ãããåã§ãã
|
---|
111 | * ã»BIGENDIAN å¤å®ã¯åçã«ãªã£ã¦ãã (æããæé©åã§å®æ°å¤å®ã«ããããã¨ã¯ãªã)
|
---|
112 | */
|
---|
113 |
|
---|
114 | #if defined( NBOTDR_BIGENDIAN )
|
---|
115 | #define IS_BIGENDIAN() (1)
|
---|
116 | # if defined( NBOTDR_LITTLEENDIAN )
|
---|
117 | # error "Don't specify both NBOTDR_LITTLEENDIAN and NBOTDR_BIGENDIAN"
|
---|
118 | # endif
|
---|
119 | #elif defined( NBOTDR_LITTLEENDIAN )
|
---|
120 | #define IS_BIGENDIAN() (0)
|
---|
121 | #else
|
---|
122 | /* BIGENDIAN ãã©ããèªåå¤å® */
|
---|
123 | static const uint16_t endian_check = 0xff00;
|
---|
124 | #define IS_BIGENDIAN() (*(uint8_t *)&endian_check)
|
---|
125 | #warning "it is better to specify -D NBOTDR_BIGENDIAN or -D NBOTDR_LITTLEENDIAN"
|
---|
126 | #endif
|
---|
127 |
|
---|
128 | #if ! defined( NBOTDR_LONG_BIT )
|
---|
129 | #define NBOTDR_LONG_BIT 32
|
---|
130 | #endif
|
---|
131 | #if NBOTDR_LONG_BIT == 32
|
---|
132 | # define NTOHL( d, sz ) ntoh32( d )
|
---|
133 | # define HTONL( d, sz ) hton32( d )
|
---|
134 | typedef int32_t TDR_LONG;
|
---|
135 | typedef uint32_t TDR_ULONG;
|
---|
136 | #elif NBOTDR_LONG_BIT == 64
|
---|
137 | # define NTOHL( d, sz ) ntoh64( d )
|
---|
138 | # define HTONL( d, sz ) hton64( d )
|
---|
139 | typedef int64_t TDR_LONG;
|
---|
140 | typedef uint64_t TDR_ULONG;
|
---|
141 | #elif NBOTDR_LONG_BIT == 128
|
---|
142 | # define NTOHL( d, sz ) ntoh128( d )
|
---|
143 | # define HTONL( d, sz ) hton128( d )
|
---|
144 | typedef int128_t TDR_LONG;
|
---|
145 | typedef uint128_t TDR_ULONG;
|
---|
146 | #elif ! defined( NBOTDR_LONG_BIT )
|
---|
147 | # define NTOHL ntohX
|
---|
148 | # define HTONL htonX
|
---|
149 | # warning "it is better to specify -D NBOTDR_LONG_BIT=N N: 32, 64, 128"
|
---|
150 | #else
|
---|
151 | # error "NBOTDR_LONG_BIT must be 32, 64 or 128"
|
---|
152 | #endif
|
---|
153 |
|
---|
154 | #if ! defined( NBOTDR_SHORT_BIT )
|
---|
155 | #define NBOTDR_SHORT_BIT 16
|
---|
156 | #endif
|
---|
157 | #if NBOTDR_SHORT_BIT == 16
|
---|
158 | # define NTOHS( d, sz ) ntoh16( d )
|
---|
159 | # define HTONS( d, sz ) hton16( d )
|
---|
160 | typedef int16_t TDR_SHORT;
|
---|
161 | typedef uint16_t TDR_USHORT;
|
---|
162 | #elif NBOTDR_SHORT_BIT == 32
|
---|
163 | # define NTOHS( d, sz ) ntoh32( d )
|
---|
164 | # define HTONS( d, sz ) hton32( d )
|
---|
165 | typedef int32_t TDR_SHORT;
|
---|
166 | typedef uint32_t TDR_USHORT;
|
---|
167 | #elif NBOTDR_SHORT_BIT == 64
|
---|
168 | # define NTOHS( d, sz ) ntoh64( d )
|
---|
169 | # define HTONS( d, sz ) hton64( d )
|
---|
170 | typedef int64_t TDR_SHORT;
|
---|
171 | typedef uint64_t TDR_USHORT;
|
---|
172 | #elif ! defined( NBOTDR_SHORT_BIT )
|
---|
173 | # define NTOHS( d, sz ) ntohX( d, sz )
|
---|
174 | # define HTONS( d, sz ) htonX( d, sz )
|
---|
175 | # warning "it is better to specify -D NBOTDR_SHORT_BIT=N N: 16, 32, 64"
|
---|
176 | #else
|
---|
177 | # error "NBOTDR_SHORT_BIT must be 16, 32 or 64"
|
---|
178 | #endif
|
---|
179 |
|
---|
180 | #if ! defined( NBOTDR_INT_BIT )
|
---|
181 | #define NBOTDR_INT_BIT 32
|
---|
182 | #endif
|
---|
183 | #if NBOTDR_INT_BIT == 16
|
---|
184 | # define NTOHI( d, sz ) ntoh16( d )
|
---|
185 | # define HTONI( d, sz ) hton16( d )
|
---|
186 | typedef int16_t TDR_INT;
|
---|
187 | typedef uint16_t TDR_UINT;
|
---|
188 | #elif NBOTDR_INT_BIT == 32
|
---|
189 | # define NTOHI( d, sz ) ntoh32( d )
|
---|
190 | # define HTONI( d, sz ) hton32( d )
|
---|
191 | typedef int32_t TDR_INT;
|
---|
192 | typedef uint32_t TDR_UINT;
|
---|
193 | #elif NBOTDR_INT_BIT == 64
|
---|
194 | # define NTOHI( d, sz ) ntoh64( d )
|
---|
195 | # define HTONI( d, sz ) hton64( d )
|
---|
196 | typedef int64_t TDR_INT;
|
---|
197 | typedef uint64_t TDR_UINT;
|
---|
198 | #elif NBOTDR_INT_BIT == 128
|
---|
199 | # define NTOHI( d, sz ) ntoh128( d )
|
---|
200 | # define HTONI( d, sz ) hton128( d )
|
---|
201 | typedef int128_t TDR_INT;
|
---|
202 | typedef uint128_t TDR_UINT;
|
---|
203 | #elif ! defined( NBOTDR_INT_BIT )
|
---|
204 | # define NTOHI( d, sz ) ntohX( d, sz )
|
---|
205 | # define HTONI( d, sz ) htonX( d, sz )
|
---|
206 | # warning "it is better to specify -D NBOTDR_INT_BIT=N N: 16, 32, 64, 128"
|
---|
207 | #else
|
---|
208 | # error "NBOTDR_INT_BIT must be 16, 32, 64 or 128"
|
---|
209 | #endif
|
---|
210 |
|
---|
211 | #if ! defined( NBOTDR_INTPTR_BIT )
|
---|
212 | #define NBOTDR_INTPTR_BIT 32
|
---|
213 | #endif
|
---|
214 | #if NBOTDR_INTPTR_BIT == 16
|
---|
215 | # define NTOHIP( d, sz ) ntoh16( d )
|
---|
216 | # define HTONIP( d, sz ) hton16( d )
|
---|
217 | typedef int16_t TDR_INTPTR;
|
---|
218 | #elif NBOTDR_INTPTR_BIT == 32
|
---|
219 | # define NTOHIP( d, sz ) ntoh32( d )
|
---|
220 | # define HTONIP( d, sz ) hton32( d )
|
---|
221 | typedef int32_t TDR_INTPTR;
|
---|
222 | #elif NBOTDR_INTPTR_BIT == 64
|
---|
223 | # define NTOHIP( d, sz ) ntoh64( d )
|
---|
224 | # define HTONIP( d, sz ) hton64( d )
|
---|
225 | typedef int64_t TDR_INTPTR;
|
---|
226 | #elif NBOTDR_INTPTR_BIT == 128
|
---|
227 | # define NTOHIP( d, sz ) ntoh128( d )
|
---|
228 | # define HTONIP( d, sz ) hton128( d )
|
---|
229 | typedef int128_t TDR_INTPTR;
|
---|
230 | #elif ! defined( NBOTDR_INTPTR_BIT )
|
---|
231 | # define NTOHIP( d, sz ) ntohX( d, sz )
|
---|
232 | # define HTONIP( d, sz ) htonX( d, sz )
|
---|
233 | # warning "it is better to specify -D NBOTDR_INTPTR_BIT=N N: 16, 32, 64, 128"
|
---|
234 | #else
|
---|
235 | # error "NBOTDR_INTPTR_BIT must be 16, 32, 64 or 128 "
|
---|
236 | #endif
|
---|
237 |
|
---|
238 | Inline int16_t
|
---|
239 | hton16( int16_t d )
|
---|
240 | {
|
---|
241 | if( IS_BIGENDIAN() )
|
---|
242 | return d; // big endian
|
---|
243 | else{
|
---|
244 | union {
|
---|
245 | int8_t by[2];
|
---|
246 | int16_t d;
|
---|
247 | } d0, d1;
|
---|
248 | // syslog( LOG_INFO, "### little endian ###" );
|
---|
249 | d0.d = d;
|
---|
250 | d1.by[0] = d0.by[1];
|
---|
251 | d1.by[1] = d0.by[0];
|
---|
252 | return d1.d;
|
---|
253 | }
|
---|
254 | }
|
---|
255 |
|
---|
256 | Inline int32_t
|
---|
257 | hton32( int32_t d )
|
---|
258 | {
|
---|
259 | if( IS_BIGENDIAN() )
|
---|
260 | return d;
|
---|
261 | else{
|
---|
262 | union {
|
---|
263 | int8_t by[4];
|
---|
264 | int32_t d;
|
---|
265 | } d0, d1;
|
---|
266 | d0.d = d;
|
---|
267 | d1.by[0] = d0.by[3];
|
---|
268 | d1.by[1] = d0.by[2];
|
---|
269 | d1.by[2] = d0.by[1];
|
---|
270 | d1.by[3] = d0.by[0];
|
---|
271 | return d1.d;
|
---|
272 | }
|
---|
273 | }
|
---|
274 |
|
---|
275 | Inline int64_t
|
---|
276 | hton64( int64_t d )
|
---|
277 | {
|
---|
278 | if( IS_BIGENDIAN() )
|
---|
279 | return d;
|
---|
280 | else{
|
---|
281 | union {
|
---|
282 | int8_t by[8];
|
---|
283 | int64_t d;
|
---|
284 | } d0, d1;
|
---|
285 | d0.d = d;
|
---|
286 | d1.by[0] = d0.by[7];
|
---|
287 | d1.by[1] = d0.by[6];
|
---|
288 | d1.by[2] = d0.by[5];
|
---|
289 | d1.by[3] = d0.by[4];
|
---|
290 | d1.by[4] = d0.by[3];
|
---|
291 | d1.by[5] = d0.by[2];
|
---|
292 | d1.by[6] = d0.by[1];
|
---|
293 | d1.by[7] = d0.by[0];
|
---|
294 | return d1.d;
|
---|
295 | }
|
---|
296 | }
|
---|
297 |
|
---|
298 | Inline int128_t
|
---|
299 | hton128( int128_t d )
|
---|
300 | {
|
---|
301 | if( IS_BIGENDIAN() )
|
---|
302 | return d;
|
---|
303 | else{
|
---|
304 | /* ãã®å®è£
|
---|
305 | 㯠tecs.h 㧠typedef ãã int128_t ã«é©å */
|
---|
306 | int128_t d1;
|
---|
307 | d1.hi = hton64( d.lo );
|
---|
308 | d1.lo = hton64( d.hi );
|
---|
309 | return d1;
|
---|
310 | }
|
---|
311 | }
|
---|
312 |
|
---|
313 | Inline int16_t
|
---|
314 | ntoh16( int16_t d )
|
---|
315 | {
|
---|
316 | if( IS_BIGENDIAN() )
|
---|
317 | return d;
|
---|
318 | else{
|
---|
319 | union {
|
---|
320 | int8_t by[2];
|
---|
321 | int16_t d;
|
---|
322 | } d0, d1;
|
---|
323 | d0.d = d;
|
---|
324 | d1.by[0] = d0.by[1];
|
---|
325 | d1.by[1] = d0.by[0];
|
---|
326 | return d1.d;
|
---|
327 | }
|
---|
328 | }
|
---|
329 |
|
---|
330 | Inline int32_t
|
---|
331 | ntoh32( int32_t d )
|
---|
332 | {
|
---|
333 | if( IS_BIGENDIAN() )
|
---|
334 | return d;
|
---|
335 | else{
|
---|
336 | union {
|
---|
337 | int8_t by[4];
|
---|
338 | int32_t d;
|
---|
339 | } d0, d1;
|
---|
340 | d0.d = d;
|
---|
341 | d1.by[0] = d0.by[3];
|
---|
342 | d1.by[1] = d0.by[2];
|
---|
343 | d1.by[2] = d0.by[1];
|
---|
344 | d1.by[3] = d0.by[0];
|
---|
345 | return d1.d;
|
---|
346 | }
|
---|
347 | }
|
---|
348 |
|
---|
349 | Inline int64_t
|
---|
350 | ntoh64( int64_t d )
|
---|
351 | {
|
---|
352 | if( IS_BIGENDIAN() )
|
---|
353 | return d;
|
---|
354 | else{
|
---|
355 | union {
|
---|
356 | int8_t by[8];
|
---|
357 | int64_t d;
|
---|
358 | } d0, d1;
|
---|
359 | d0.d = d;
|
---|
360 | d1.by[0] = d0.by[7];
|
---|
361 | d1.by[1] = d0.by[6];
|
---|
362 | d1.by[2] = d0.by[5];
|
---|
363 | d1.by[3] = d0.by[4];
|
---|
364 | d1.by[4] = d0.by[3];
|
---|
365 | d1.by[5] = d0.by[2];
|
---|
366 | d1.by[6] = d0.by[1];
|
---|
367 | d1.by[7] = d0.by[0];
|
---|
368 | return d1.d;
|
---|
369 | }
|
---|
370 | }
|
---|
371 |
|
---|
372 | /*** unsigned ç¨ã®é¢æ° (128 bit çã®ã¿ç¨æ) ***/
|
---|
373 | Inline int128_t
|
---|
374 | ntoh128( int128_t d )
|
---|
375 | {
|
---|
376 | if( IS_BIGENDIAN() )
|
---|
377 | return d;
|
---|
378 | else{
|
---|
379 | /* ãã®å®è£
|
---|
380 | 㯠tecs.h 㧠typedef ãã int128_t ã«é©å */
|
---|
381 | int128_t d1;
|
---|
382 | d1.hi = ntoh64( d.lo );
|
---|
383 | d1.lo = ntoh64( d.hi );
|
---|
384 | return d1;
|
---|
385 | }
|
---|
386 | }
|
---|
387 |
|
---|
388 | Inline uint128_t
|
---|
389 | hton128u( uint128_t d )
|
---|
390 | {
|
---|
391 | if( IS_BIGENDIAN() )
|
---|
392 | return d;
|
---|
393 | else{
|
---|
394 | /* ãã®å®è£
|
---|
395 | 㯠tecs.h 㧠typedef ãã int128_t ã«é©å */
|
---|
396 | uint128_t d1;
|
---|
397 | d1.hi = hton64( d.lo );
|
---|
398 | d1.lo = hton64( d.hi );
|
---|
399 | return d1;
|
---|
400 | }
|
---|
401 | }
|
---|
402 |
|
---|
403 | Inline uint128_t
|
---|
404 | ntoh128u( uint128_t d )
|
---|
405 | {
|
---|
406 | if( IS_BIGENDIAN() )
|
---|
407 | return d;
|
---|
408 | else{
|
---|
409 | /* ãã®å®è£
|
---|
410 | 㯠tecs.h 㧠typedef ãã int128_t ã«é©å */
|
---|
411 | uint128_t d1;
|
---|
412 | d1.hi = ntoh64( d.lo );
|
---|
413 | d1.lo = ntoh64( d.hi );
|
---|
414 | return d1;
|
---|
415 | }
|
---|
416 | }
|
---|
417 |
|
---|
418 | /************************************************
|
---|
419 | * htonX, ntohX 㯠16, 32, 64 ã«ã®ã¿å¯¾å¿ã§ãã *
|
---|
420 | ************************************************/
|
---|
421 | Inline int64_t
|
---|
422 | htonX( int64_t d, int_t sz )
|
---|
423 | {
|
---|
424 | switch( sz ){
|
---|
425 | case 2: return hton16( d );
|
---|
426 | case 4: return hton32( d );
|
---|
427 | case 8: return hton64( d );
|
---|
428 | default: return 0; // # mikan
|
---|
429 | };
|
---|
430 | }
|
---|
431 |
|
---|
432 | Inline int64_t
|
---|
433 | ntohX( int64_t d, int_t sz )
|
---|
434 | {
|
---|
435 | switch( sz ){
|
---|
436 | case 2: return ntoh16( d );
|
---|
437 | case 4: return ntoh32( d );
|
---|
438 | case 8: return ntoh64( d );
|
---|
439 | default: return 0; // # mikan
|
---|
440 | };
|
---|
441 | }
|
---|
442 |
|
---|
443 | /* åãå£é¢æ° #_TEPF_# */
|
---|
444 | /* #[<ENTRY_PORT>]# eTDR
|
---|
445 | * entry port: eTDR
|
---|
446 | * signature: sTDR
|
---|
447 | * context: task
|
---|
448 | * #[</ENTRY_PORT>]# */
|
---|
449 |
|
---|
450 | /* #[<ENTRY_FUNC>]# eTDR_reset
|
---|
451 | * name: eTDR_reset
|
---|
452 | * global_name: tNBOTDR_eTDR_reset
|
---|
453 | * oneway: false
|
---|
454 | * #[</ENTRY_FUNC>]# */
|
---|
455 | Inline ER
|
---|
456 | eTDR_reset(CELLIDX idx)
|
---|
457 | {
|
---|
458 | ER ercd = E_OK;
|
---|
459 | CELLCB *p_cellcb;
|
---|
460 | if (VALID_IDX(idx)) {
|
---|
461 | p_cellcb = GET_CELLCB(idx);
|
---|
462 | }
|
---|
463 | else {
|
---|
464 | return(E_ID);
|
---|
465 | }
|
---|
466 |
|
---|
467 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
468 |
|
---|
469 | syslog( LOG_INFO, "TDR: resetting channel" );
|
---|
470 | ercd = cChannel_reset();
|
---|
471 | return(ercd);
|
---|
472 | }
|
---|
473 |
|
---|
474 | /* #[<ENTRY_FUNC>]# eTDR_sendSOP
|
---|
475 | * name: eTDR_sendSOP
|
---|
476 | * global_name: tNBOTDR_eTDR_sendSOP
|
---|
477 | * oneway: false
|
---|
478 | * #[</ENTRY_FUNC>]# */
|
---|
479 | Inline ER
|
---|
480 | eTDR_sendSOP(CELLIDX idx, bool_t b_client )
|
---|
481 | {
|
---|
482 | ER ercd = E_OK;
|
---|
483 | CELLCB *p_cellcb;
|
---|
484 | uint16_t sopMagic;
|
---|
485 | uint8_t val;
|
---|
486 | if (VALID_IDX(idx)) {
|
---|
487 | p_cellcb = GET_CELLCB(idx);
|
---|
488 | }
|
---|
489 | else {
|
---|
490 | return(E_ID);
|
---|
491 | }
|
---|
492 |
|
---|
493 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
494 | #ifdef RPC_DEBUG
|
---|
495 | syslog(LOG_INFO, "eTDR_sendSOP(b_client=%d)", b_client);
|
---|
496 | #endif
|
---|
497 | if( b_client )
|
---|
498 | sopMagic = TDR_SOP_MAGIC1;
|
---|
499 | else
|
---|
500 | sopMagic = TDR_SOP_MAGIC2;
|
---|
501 |
|
---|
502 | /*
|
---|
503 | * SOP ãã±ããã®éä¿¡
|
---|
504 | * ãã±ããã·ã¼ã±ã³ã¹ãå¤å°å´©ãã¦ãå復ã§ããããã«ããã¤ãåä½ã§éã
|
---|
505 | * ä¸ä½ãã¤ããä¸ä½ãã¤ãã®é ã«éã
|
---|
506 | */
|
---|
507 |
|
---|
508 | val = (uint8_t)(sopMagic>>8);
|
---|
509 | ercd = eTDR_putUInt8( idx, val ); /* ä¸ä½8ããã */
|
---|
510 | if( ercd != E_OK )
|
---|
511 | return ercd;
|
---|
512 |
|
---|
513 | val = (uint8_t)(sopMagic&0xff); /* ä¸ä½8ããã */
|
---|
514 | ercd = eTDR_putUInt8( idx, val );
|
---|
515 |
|
---|
516 | return ercd;
|
---|
517 | }
|
---|
518 |
|
---|
519 | /* #[<ENTRY_FUNC>]# eTDR_receiveSOP
|
---|
520 | * name: eTDR_receiveSOP
|
---|
521 | * global_name: tNBOTDR_eTDR_receiveSOP
|
---|
522 | * oneway: false
|
---|
523 | * #[</ENTRY_FUNC>]# */
|
---|
524 | Inline ER
|
---|
525 | eTDR_receiveSOP(CELLIDX idx, bool_t b_client )
|
---|
526 | {
|
---|
527 | ER ercd = E_OK;
|
---|
528 | CELLCB *p_cellcb;
|
---|
529 | uint16_t sopMagic;
|
---|
530 | uint8_t val;
|
---|
531 |
|
---|
532 | if (VALID_IDX(idx)) {
|
---|
533 | p_cellcb = GET_CELLCB(idx);
|
---|
534 | }
|
---|
535 | else {
|
---|
536 | return(E_ID);
|
---|
537 | }
|
---|
538 |
|
---|
539 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
540 | #ifdef RPC_DEBUG
|
---|
541 | syslog(LOG_INFO, "eTDR_receiveSOP(b_client=%d)", b_client);
|
---|
542 | #endif
|
---|
543 |
|
---|
544 | if( b_client )
|
---|
545 | sopMagic = TDR_SOP_MAGIC2;
|
---|
546 | else
|
---|
547 | sopMagic = TDR_SOP_MAGIC1;
|
---|
548 |
|
---|
549 | if( (ercd=eTDR_getUInt8( idx, &val )) != E_OK )
|
---|
550 | ;
|
---|
551 | else if( val != (uint8_t)(sopMagic>>8) ){
|
---|
552 | ercd = E_MAGIC;
|
---|
553 | }
|
---|
554 | else if((ercd=eTDR_getUInt8( idx, &val )) != E_OK )
|
---|
555 | ;
|
---|
556 | else if( val != (uint8_t)sopMagic ){
|
---|
557 | ercd = E_MAGIC;
|
---|
558 | }
|
---|
559 |
|
---|
560 | if( ercd != E_OK )
|
---|
561 | syslog( LOG_INFO, "receiveSOP: ERCD=%d", ercd );
|
---|
562 |
|
---|
563 | return ercd;
|
---|
564 | }
|
---|
565 |
|
---|
566 | /* #[<ENTRY_FUNC>]# eTDR_sendEOP
|
---|
567 | * name: eTDR_sendEOP
|
---|
568 | * global_name: tNBOTDR_eTDR_sendEOP
|
---|
569 | * oneway: false
|
---|
570 | * #[</ENTRY_FUNC>]# */
|
---|
571 | Inline ER
|
---|
572 | eTDR_sendEOP(CELLIDX idx, bool_t b_continue )
|
---|
573 | {
|
---|
574 | ER ercd = E_OK;
|
---|
575 | CELLCB *p_cellcb;
|
---|
576 | uint16_t magic;
|
---|
577 | if (VALID_IDX(idx)) {
|
---|
578 | p_cellcb = GET_CELLCB(idx);
|
---|
579 | }
|
---|
580 | else {
|
---|
581 | return(E_ID);
|
---|
582 | }
|
---|
583 |
|
---|
584 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
585 | #ifdef RPC_DEBUG
|
---|
586 | syslog(LOG_INFO, "eTDR_sendEOP(b_continue=%d)", b_continue);
|
---|
587 | #endif
|
---|
588 |
|
---|
589 | if( b_continue )
|
---|
590 | magic = TDR_EOP_MAGIC1;
|
---|
591 | else
|
---|
592 | magic = TDR_EOP_MAGIC2;
|
---|
593 |
|
---|
594 | /* EOP magic ã®éä¿¡ */
|
---|
595 | if( (ercd = eTDR_putUInt16( idx, magic )) != E_OK )
|
---|
596 | return ercd;
|
---|
597 |
|
---|
598 | return cChannel_flush(VAR_tmo);
|
---|
599 | }
|
---|
600 |
|
---|
601 | /* #[<ENTRY_FUNC>]# eTDR_receiveEOP
|
---|
602 | * name: eTDR_receiveEOP
|
---|
603 | * global_name: tNBOTDR_eTDR_receiveEOP
|
---|
604 | * oneway: false
|
---|
605 | * #[</ENTRY_FUNC>]# */
|
---|
606 | Inline ER
|
---|
607 | eTDR_receiveEOP(CELLIDX idx, bool_t b_continue)
|
---|
608 | {
|
---|
609 | ER ercd = E_OK, er2;
|
---|
610 | CELLCB *p_cellcb;
|
---|
611 | uint16_t magic;
|
---|
612 |
|
---|
613 | if (VALID_IDX(idx)) {
|
---|
614 | p_cellcb = GET_CELLCB(idx);
|
---|
615 | }
|
---|
616 | else {
|
---|
617 | return(E_ID);
|
---|
618 | }
|
---|
619 |
|
---|
620 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
621 | #ifdef RPC_DEBUG
|
---|
622 | syslog(LOG_INFO, "eTDR_receiveEOP(b_continue=%d)",b_continue);
|
---|
623 | #endif
|
---|
624 | /* mikan cChannel EOF get_* */
|
---|
625 | /* mikan magic EOF */
|
---|
626 |
|
---|
627 | if( (ercd=eTDR_getUInt16( idx, &magic )) == E_OK ){
|
---|
628 | if( (b_continue && magic == TDR_EOP_MAGIC1) || (!b_continue && magic == TDR_EOP_MAGIC2) ){
|
---|
629 | } else {
|
---|
630 | ercd = E_MAGIC;
|
---|
631 | }
|
---|
632 | }
|
---|
633 | er2 = cChannel_end_receive();
|
---|
634 | return ercd != E_OK ? ercd : er2;
|
---|
635 | }
|
---|
636 |
|
---|
637 | /* #[<ENTRY_FUNC>]# eTDR_putInt8
|
---|
638 | * name: eTDR_putInt8
|
---|
639 | * global_name: tNBOTDR_eTDR_putInt8
|
---|
640 | * oneway: false
|
---|
641 | * #[</ENTRY_FUNC>]# */
|
---|
642 | Inline ER
|
---|
643 | eTDR_putInt8(CELLIDX idx, int8_t in)
|
---|
644 | {
|
---|
645 | CELLCB *p_cellcb;
|
---|
646 | if (VALID_IDX(idx)) {
|
---|
647 | p_cellcb = GET_CELLCB(idx);
|
---|
648 | }
|
---|
649 | else {
|
---|
650 | return(E_ID);
|
---|
651 | }
|
---|
652 |
|
---|
653 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
654 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
655 | }
|
---|
656 |
|
---|
657 | /* #[<ENTRY_FUNC>]# eTDR_putInt16
|
---|
658 | * name: eTDR_putInt16
|
---|
659 | * global_name: tNBOTDR_eTDR_putInt16
|
---|
660 | * oneway: false
|
---|
661 | * #[</ENTRY_FUNC>]# */
|
---|
662 | Inline ER
|
---|
663 | eTDR_putInt16(CELLIDX idx, int16_t in)
|
---|
664 | {
|
---|
665 | CELLCB *p_cellcb;
|
---|
666 | if (VALID_IDX(idx)) {
|
---|
667 | p_cellcb = GET_CELLCB(idx);
|
---|
668 | }
|
---|
669 | else {
|
---|
670 | return(E_ID);
|
---|
671 | }
|
---|
672 |
|
---|
673 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
674 | in = hton16( in );
|
---|
675 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
676 | }
|
---|
677 |
|
---|
678 | /* #[<ENTRY_FUNC>]# eTDR_putInt32
|
---|
679 | * name: eTDR_putInt32
|
---|
680 | * global_name: tNBOTDR_eTDR_putInt32
|
---|
681 | * oneway: false
|
---|
682 | * #[</ENTRY_FUNC>]# */
|
---|
683 | Inline ER
|
---|
684 | eTDR_putInt32(CELLIDX idx, int32_t in)
|
---|
685 | {
|
---|
686 | CELLCB *p_cellcb;
|
---|
687 | if (VALID_IDX(idx)) {
|
---|
688 | p_cellcb = GET_CELLCB(idx);
|
---|
689 | }
|
---|
690 | else {
|
---|
691 | return(E_ID);
|
---|
692 | }
|
---|
693 |
|
---|
694 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
695 | in = hton32( in );
|
---|
696 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
697 | }
|
---|
698 |
|
---|
699 | /* #[<ENTRY_FUNC>]# eTDR_putInt64
|
---|
700 | * name: eTDR_putInt64
|
---|
701 | * global_name: tNBOTDR_eTDR_putInt64
|
---|
702 | * oneway: false
|
---|
703 | * #[</ENTRY_FUNC>]# */
|
---|
704 | Inline ER
|
---|
705 | eTDR_putInt64(CELLIDX idx, int64_t in)
|
---|
706 | {
|
---|
707 | CELLCB *p_cellcb;
|
---|
708 | if (VALID_IDX(idx)) {
|
---|
709 | p_cellcb = GET_CELLCB(idx);
|
---|
710 | }
|
---|
711 | else {
|
---|
712 | return(E_ID);
|
---|
713 | }
|
---|
714 |
|
---|
715 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
716 | in = hton64( in );
|
---|
717 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
718 | }
|
---|
719 |
|
---|
720 | /* #[<ENTRY_FUNC>]# eTDR_putInt128
|
---|
721 | * name: eTDR_putInt128
|
---|
722 | * global_name: tNBOTDR_eTDR_putInt128
|
---|
723 | * oneway: false
|
---|
724 | * #[</ENTRY_FUNC>]# */
|
---|
725 | Inline ER
|
---|
726 | eTDR_putInt128(CELLIDX idx, int128_t in)
|
---|
727 | {
|
---|
728 | CELLCB *p_cellcb;
|
---|
729 | if (VALID_IDX(idx)) {
|
---|
730 | p_cellcb = GET_CELLCB(idx);
|
---|
731 | }
|
---|
732 | else {
|
---|
733 | return(E_ID);
|
---|
734 | }
|
---|
735 |
|
---|
736 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
737 | in = hton128( in );
|
---|
738 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
739 | }
|
---|
740 |
|
---|
741 | /* #[<ENTRY_FUNC>]# eTDR_getInt8
|
---|
742 | * name: eTDR_getInt8
|
---|
743 | * global_name: tNBOTDR_eTDR_getInt8
|
---|
744 | * oneway: false
|
---|
745 | * #[</ENTRY_FUNC>]# */
|
---|
746 | Inline ER
|
---|
747 | eTDR_getInt8(CELLIDX idx, int8_t* out)
|
---|
748 | {
|
---|
749 | ER_UINT er_sz;
|
---|
750 | CELLCB *p_cellcb;
|
---|
751 | if (VALID_IDX(idx)) {
|
---|
752 | p_cellcb = GET_CELLCB(idx);
|
---|
753 | }
|
---|
754 | else {
|
---|
755 | return(E_ID);
|
---|
756 | }
|
---|
757 |
|
---|
758 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
759 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
760 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
761 | }
|
---|
762 |
|
---|
763 | /* #[<ENTRY_FUNC>]# eTDR_getInt16
|
---|
764 | * name: eTDR_getInt16
|
---|
765 | * global_name: tNBOTDR_eTDR_getInt16
|
---|
766 | * oneway: false
|
---|
767 | * #[</ENTRY_FUNC>]# */
|
---|
768 | Inline ER
|
---|
769 | eTDR_getInt16(CELLIDX idx, int16_t* out)
|
---|
770 | {
|
---|
771 | ER_UINT er_sz;
|
---|
772 | CELLCB *p_cellcb;
|
---|
773 | if (VALID_IDX(idx)) {
|
---|
774 | p_cellcb = GET_CELLCB(idx);
|
---|
775 | }
|
---|
776 | else {
|
---|
777 | return(E_ID);
|
---|
778 | }
|
---|
779 |
|
---|
780 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
781 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
782 | *out = ntoh16( *out );
|
---|
783 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
784 | }
|
---|
785 |
|
---|
786 | /* #[<ENTRY_FUNC>]# eTDR_getInt32
|
---|
787 | * name: eTDR_getInt32
|
---|
788 | * global_name: tNBOTDR_eTDR_getInt32
|
---|
789 | * oneway: false
|
---|
790 | * #[</ENTRY_FUNC>]# */
|
---|
791 | Inline ER
|
---|
792 | eTDR_getInt32(CELLIDX idx, int32_t* out)
|
---|
793 | {
|
---|
794 | ER_UINT er_sz;
|
---|
795 | CELLCB *p_cellcb;
|
---|
796 | if (VALID_IDX(idx)) {
|
---|
797 | p_cellcb = GET_CELLCB(idx);
|
---|
798 | }
|
---|
799 | else {
|
---|
800 | return(E_ID);
|
---|
801 | }
|
---|
802 |
|
---|
803 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
804 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
805 | *out = ntoh32( *out );
|
---|
806 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
807 | }
|
---|
808 |
|
---|
809 | /* #[<ENTRY_FUNC>]# eTDR_getInt64
|
---|
810 | * name: eTDR_getInt64
|
---|
811 | * global_name: tNBOTDR_eTDR_getInt64
|
---|
812 | * oneway: false
|
---|
813 | * #[</ENTRY_FUNC>]# */
|
---|
814 | Inline ER
|
---|
815 | eTDR_getInt64(CELLIDX idx, int64_t* out)
|
---|
816 | {
|
---|
817 | ER_UINT er_sz;
|
---|
818 | CELLCB *p_cellcb;
|
---|
819 | if (VALID_IDX(idx)) {
|
---|
820 | p_cellcb = GET_CELLCB(idx);
|
---|
821 | }
|
---|
822 | else {
|
---|
823 | return(E_ID);
|
---|
824 | }
|
---|
825 |
|
---|
826 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
827 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
828 | *out = ntoh64( *out );
|
---|
829 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
830 | }
|
---|
831 |
|
---|
832 | /* #[<ENTRY_FUNC>]# eTDR_getInt128
|
---|
833 | * name: eTDR_getInt128
|
---|
834 | * global_name: tNBOTDR_eTDR_getInt128
|
---|
835 | * oneway: false
|
---|
836 | * #[</ENTRY_FUNC>]# */
|
---|
837 | Inline ER
|
---|
838 | eTDR_getInt128(CELLIDX idx, int128_t* out)
|
---|
839 | {
|
---|
840 | ER_UINT er_sz;
|
---|
841 | CELLCB *p_cellcb;
|
---|
842 | if (VALID_IDX(idx)) {
|
---|
843 | p_cellcb = GET_CELLCB(idx);
|
---|
844 | }
|
---|
845 | else {
|
---|
846 | return(E_ID);
|
---|
847 | }
|
---|
848 |
|
---|
849 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
850 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
851 | *out = ntoh128( *out );
|
---|
852 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
853 | }
|
---|
854 |
|
---|
855 | /* #[<ENTRY_FUNC>]# eTDR_putUInt8
|
---|
856 | * name: eTDR_putUInt8
|
---|
857 | * global_name: tNBOTDR_eTDR_putUInt8
|
---|
858 | * oneway: false
|
---|
859 | * #[</ENTRY_FUNC>]# */
|
---|
860 | Inline ER
|
---|
861 | eTDR_putUInt8(CELLIDX idx, uint8_t in)
|
---|
862 | {
|
---|
863 | CELLCB *p_cellcb;
|
---|
864 | if (VALID_IDX(idx)) {
|
---|
865 | p_cellcb = GET_CELLCB(idx);
|
---|
866 | }
|
---|
867 | else {
|
---|
868 | return(E_ID);
|
---|
869 | } /* end if VALID_IDX(idx) */
|
---|
870 |
|
---|
871 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
872 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
873 | }
|
---|
874 |
|
---|
875 | /* #[<ENTRY_FUNC>]# eTDR_putUInt16
|
---|
876 | * name: eTDR_putUInt16
|
---|
877 | * global_name: tNBOTDR_eTDR_putUInt16
|
---|
878 | * oneway: false
|
---|
879 | * #[</ENTRY_FUNC>]# */
|
---|
880 | Inline ER
|
---|
881 | eTDR_putUInt16(CELLIDX idx, uint16_t in)
|
---|
882 | {
|
---|
883 | CELLCB *p_cellcb;
|
---|
884 | if (VALID_IDX(idx)) {
|
---|
885 | p_cellcb = GET_CELLCB(idx);
|
---|
886 | }
|
---|
887 | else {
|
---|
888 | return(E_ID);
|
---|
889 | } /* end if VALID_IDX(idx) */
|
---|
890 |
|
---|
891 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
892 | in = hton16( in );
|
---|
893 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
894 | }
|
---|
895 |
|
---|
896 | /* #[<ENTRY_FUNC>]# eTDR_putUInt32
|
---|
897 | * name: eTDR_putUInt32
|
---|
898 | * global_name: tNBOTDR_eTDR_putUInt32
|
---|
899 | * oneway: false
|
---|
900 | * #[</ENTRY_FUNC>]# */
|
---|
901 | Inline ER
|
---|
902 | eTDR_putUInt32(CELLIDX idx, uint32_t in)
|
---|
903 | {
|
---|
904 | CELLCB *p_cellcb;
|
---|
905 | if (VALID_IDX(idx)) {
|
---|
906 | p_cellcb = GET_CELLCB(idx);
|
---|
907 | }
|
---|
908 | else {
|
---|
909 | return(E_ID);
|
---|
910 | } /* end if VALID_IDX(idx) */
|
---|
911 |
|
---|
912 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
913 | in = hton32( in );
|
---|
914 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
915 | }
|
---|
916 |
|
---|
917 | /* #[<ENTRY_FUNC>]# eTDR_putUInt64
|
---|
918 | * name: eTDR_putUInt64
|
---|
919 | * global_name: tNBOTDR_eTDR_putUInt64
|
---|
920 | * oneway: false
|
---|
921 | * #[</ENTRY_FUNC>]# */
|
---|
922 | Inline ER
|
---|
923 | eTDR_putUInt64(CELLIDX idx, uint64_t in)
|
---|
924 | {
|
---|
925 | CELLCB *p_cellcb;
|
---|
926 | if (VALID_IDX(idx)) {
|
---|
927 | p_cellcb = GET_CELLCB(idx);
|
---|
928 | }
|
---|
929 | else {
|
---|
930 | return(E_ID);
|
---|
931 | } /* end if VALID_IDX(idx) */
|
---|
932 |
|
---|
933 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
934 | in = hton64( in );
|
---|
935 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
936 | }
|
---|
937 |
|
---|
938 | /* #[<ENTRY_FUNC>]# eTDR_putUInt128
|
---|
939 | * name: eTDR_putUInt128
|
---|
940 | * global_name: tNBOTDR_eTDR_putUInt128
|
---|
941 | * oneway: false
|
---|
942 | * #[</ENTRY_FUNC>]# */
|
---|
943 | Inline ER
|
---|
944 | eTDR_putUInt128(CELLIDX idx, uint128_t in)
|
---|
945 | {
|
---|
946 | CELLCB *p_cellcb;
|
---|
947 | if (VALID_IDX(idx)) {
|
---|
948 | p_cellcb = GET_CELLCB(idx);
|
---|
949 | }
|
---|
950 | else {
|
---|
951 | return(E_ID);
|
---|
952 | } /* end if VALID_IDX(idx) */
|
---|
953 |
|
---|
954 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
955 | in = hton128u( in );
|
---|
956 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
957 | }
|
---|
958 |
|
---|
959 | /* #[<ENTRY_FUNC>]# eTDR_getUInt8
|
---|
960 | * name: eTDR_getUInt8
|
---|
961 | * global_name: tNBOTDR_eTDR_getUInt8
|
---|
962 | * oneway: false
|
---|
963 | * #[</ENTRY_FUNC>]# */
|
---|
964 | Inline ER
|
---|
965 | eTDR_getUInt8(CELLIDX idx, uint8_t* out)
|
---|
966 | {
|
---|
967 | ER_UINT er_sz;
|
---|
968 | CELLCB *p_cellcb;
|
---|
969 | if (VALID_IDX(idx)) {
|
---|
970 | p_cellcb = GET_CELLCB(idx);
|
---|
971 | }
|
---|
972 | else {
|
---|
973 | return(E_ID);
|
---|
974 | } /* end if VALID_IDX(idx) */
|
---|
975 |
|
---|
976 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
977 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
978 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
979 | }
|
---|
980 |
|
---|
981 | /* #[<ENTRY_FUNC>]# eTDR_getUInt16
|
---|
982 | * name: eTDR_getUInt16
|
---|
983 | * global_name: tNBOTDR_eTDR_getUInt16
|
---|
984 | * oneway: false
|
---|
985 | * #[</ENTRY_FUNC>]# */
|
---|
986 | Inline ER
|
---|
987 | eTDR_getUInt16(CELLIDX idx, uint16_t* out)
|
---|
988 | {
|
---|
989 | ER_UINT er_sz;
|
---|
990 | CELLCB *p_cellcb;
|
---|
991 | if (VALID_IDX(idx)) {
|
---|
992 | p_cellcb = GET_CELLCB(idx);
|
---|
993 | }
|
---|
994 | else {
|
---|
995 | return(E_ID);
|
---|
996 | } /* end if VALID_IDX(idx) */
|
---|
997 |
|
---|
998 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
999 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
1000 | *out = ntoh16( *out );
|
---|
1001 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
1002 | }
|
---|
1003 |
|
---|
1004 | /* #[<ENTRY_FUNC>]# eTDR_getUInt32
|
---|
1005 | * name: eTDR_getUInt32
|
---|
1006 | * global_name: tNBOTDR_eTDR_getUInt32
|
---|
1007 | * oneway: false
|
---|
1008 | * #[</ENTRY_FUNC>]# */
|
---|
1009 | Inline ER
|
---|
1010 | eTDR_getUInt32(CELLIDX idx, uint32_t* out)
|
---|
1011 | {
|
---|
1012 | ER_UINT er_sz;
|
---|
1013 | CELLCB *p_cellcb;
|
---|
1014 | if (VALID_IDX(idx)) {
|
---|
1015 | p_cellcb = GET_CELLCB(idx);
|
---|
1016 | }
|
---|
1017 | else {
|
---|
1018 | return(E_ID);
|
---|
1019 | } /* end if VALID_IDX(idx) */
|
---|
1020 |
|
---|
1021 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1022 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
1023 | *out = ntoh32( *out );
|
---|
1024 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
1025 | }
|
---|
1026 |
|
---|
1027 | /* #[<ENTRY_FUNC>]# eTDR_getUInt64
|
---|
1028 | * name: eTDR_getUInt64
|
---|
1029 | * global_name: tNBOTDR_eTDR_getUInt64
|
---|
1030 | * oneway: false
|
---|
1031 | * #[</ENTRY_FUNC>]# */
|
---|
1032 | Inline ER
|
---|
1033 | eTDR_getUInt64(CELLIDX idx, uint64_t* out)
|
---|
1034 | {
|
---|
1035 | ER_UINT er_sz;
|
---|
1036 | CELLCB *p_cellcb;
|
---|
1037 | if (VALID_IDX(idx)) {
|
---|
1038 | p_cellcb = GET_CELLCB(idx);
|
---|
1039 | }
|
---|
1040 | else {
|
---|
1041 | return(E_ID);
|
---|
1042 | } /* end if VALID_IDX(idx) */
|
---|
1043 |
|
---|
1044 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1045 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
1046 | *out = ntoh64( *out );
|
---|
1047 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
1048 | }
|
---|
1049 |
|
---|
1050 | /* #[<ENTRY_FUNC>]# eTDR_getUInt128
|
---|
1051 | * name: eTDR_getUInt128
|
---|
1052 | * global_name: tNBOTDR_eTDR_getUInt128
|
---|
1053 | * oneway: false
|
---|
1054 | * #[</ENTRY_FUNC>]# */
|
---|
1055 | Inline ER
|
---|
1056 | eTDR_getUInt128(CELLIDX idx, uint128_t* out)
|
---|
1057 | {
|
---|
1058 | ER_UINT er_sz;
|
---|
1059 | CELLCB *p_cellcb;
|
---|
1060 | if (VALID_IDX(idx)) {
|
---|
1061 | p_cellcb = GET_CELLCB(idx);
|
---|
1062 | }
|
---|
1063 | else {
|
---|
1064 | return(E_ID);
|
---|
1065 | } /* end if VALID_IDX(idx) */
|
---|
1066 |
|
---|
1067 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1068 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
1069 | *out = ntoh128u( *out );
|
---|
1070 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
1071 | }
|
---|
1072 |
|
---|
1073 | /* #[<ENTRY_FUNC>]# eTDR_putChar
|
---|
1074 | * name: eTDR_putChar
|
---|
1075 | * global_name: tNBOTDR_eTDR_putChar
|
---|
1076 | * oneway: false
|
---|
1077 | * #[</ENTRY_FUNC>]# */
|
---|
1078 | Inline ER
|
---|
1079 | eTDR_putChar(CELLIDX idx, char_t in)
|
---|
1080 | {
|
---|
1081 | CELLCB *p_cellcb;
|
---|
1082 | if (VALID_IDX(idx)) {
|
---|
1083 | p_cellcb = GET_CELLCB(idx);
|
---|
1084 | }
|
---|
1085 | else {
|
---|
1086 | return(E_ID);
|
---|
1087 | }
|
---|
1088 |
|
---|
1089 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1090 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
1091 | }
|
---|
1092 |
|
---|
1093 | /* #[<ENTRY_FUNC>]# eTDR_getChar
|
---|
1094 | * name: eTDR_getChar
|
---|
1095 | * global_name: tNBOTDR_eTDR_getChar
|
---|
1096 | * oneway: false
|
---|
1097 | * #[</ENTRY_FUNC>]# */
|
---|
1098 | Inline ER
|
---|
1099 | eTDR_getChar(CELLIDX idx, char_t* out)
|
---|
1100 | {
|
---|
1101 | ER_UINT er_sz;
|
---|
1102 | CELLCB *p_cellcb;
|
---|
1103 | if (VALID_IDX(idx)) {
|
---|
1104 | p_cellcb = GET_CELLCB(idx);
|
---|
1105 | }
|
---|
1106 | else {
|
---|
1107 | return(E_ID);
|
---|
1108 | }
|
---|
1109 |
|
---|
1110 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1111 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
1112 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
1113 | }
|
---|
1114 |
|
---|
1115 | /* #[<ENTRY_FUNC>]# eTDR_putBool
|
---|
1116 | * name: eTDR_putBool
|
---|
1117 | * global_name: tNBOTDR_eTDR_putBool
|
---|
1118 | * oneway: false
|
---|
1119 | * #[</ENTRY_FUNC>]# */
|
---|
1120 | Inline ER
|
---|
1121 | eTDR_putBool(CELLIDX idx, bool_t in)
|
---|
1122 | {
|
---|
1123 | ER ercd = E_OK;
|
---|
1124 | CELLCB *p_cellcb;
|
---|
1125 | if (VALID_IDX(idx)) {
|
---|
1126 | p_cellcb = GET_CELLCB(idx);
|
---|
1127 | }
|
---|
1128 | else {
|
---|
1129 | return(E_ID);
|
---|
1130 | } /* end if VALID_IDX(idx) */
|
---|
1131 |
|
---|
1132 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1133 | eTDR_putUInt8(idx, (uint8_t)(in != 0) );
|
---|
1134 |
|
---|
1135 | return(ercd);
|
---|
1136 | }
|
---|
1137 |
|
---|
1138 | /* #[<ENTRY_FUNC>]# eTDR_getBool
|
---|
1139 | * name: eTDR_getBool
|
---|
1140 | * global_name: tNBOTDR_eTDR_getBool
|
---|
1141 | * oneway: false
|
---|
1142 | * #[</ENTRY_FUNC>]# */
|
---|
1143 | Inline ER
|
---|
1144 | eTDR_getBool(CELLIDX idx, bool_t* out)
|
---|
1145 | {
|
---|
1146 | ER ercd = E_OK;
|
---|
1147 | CELLCB *p_cellcb;
|
---|
1148 | uint8_t val;
|
---|
1149 | if (VALID_IDX(idx)) {
|
---|
1150 | p_cellcb = GET_CELLCB(idx);
|
---|
1151 | }
|
---|
1152 | else {
|
---|
1153 | return(E_ID);
|
---|
1154 | } /* end if VALID_IDX(idx) */
|
---|
1155 |
|
---|
1156 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1157 | ercd = eTDR_getUInt8(idx, &val );
|
---|
1158 | if( ercd != E_OK )
|
---|
1159 | return ercd;
|
---|
1160 | *out = (val != 0);
|
---|
1161 |
|
---|
1162 | return(ercd);
|
---|
1163 | }
|
---|
1164 |
|
---|
1165 | /* #[<ENTRY_FUNC>]# eTDR_putFloat32
|
---|
1166 | * name: eTDR_putFloat32
|
---|
1167 | * global_name: tNBOTDR_eTDR_putFloat32
|
---|
1168 | * oneway: false
|
---|
1169 | * #[</ENTRY_FUNC>]# */
|
---|
1170 | Inline ER
|
---|
1171 | eTDR_putFloat32(CELLIDX idx, float32_t in)
|
---|
1172 | {
|
---|
1173 | CELLCB *p_cellcb;
|
---|
1174 | int32_t val;
|
---|
1175 | if (VALID_IDX(idx)) {
|
---|
1176 | p_cellcb = GET_CELLCB(idx);
|
---|
1177 | }
|
---|
1178 | else {
|
---|
1179 | return(E_ID);
|
---|
1180 | }
|
---|
1181 |
|
---|
1182 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1183 | val = hton32( *(int32_t*)&in );
|
---|
1184 | return cChannel_send( (int8_t *)&val, (int16_t)sizeof( val ), VAR_tmo );
|
---|
1185 | }
|
---|
1186 |
|
---|
1187 | /* #[<ENTRY_FUNC>]# eTDR_putDouble64
|
---|
1188 | * name: eTDR_putDouble64
|
---|
1189 | * global_name: tNBOTDR_eTDR_putDouble64
|
---|
1190 | * oneway: false
|
---|
1191 | * #[</ENTRY_FUNC>]# */
|
---|
1192 | Inline ER
|
---|
1193 | eTDR_putDouble64(CELLIDX idx, double64_t in)
|
---|
1194 | {
|
---|
1195 | int64_t val;
|
---|
1196 | CELLCB *p_cellcb;
|
---|
1197 | if (VALID_IDX(idx)) {
|
---|
1198 | p_cellcb = GET_CELLCB(idx);
|
---|
1199 | }
|
---|
1200 | else {
|
---|
1201 | return(E_ID);
|
---|
1202 | }
|
---|
1203 |
|
---|
1204 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1205 | val = *(int64_t *)∈
|
---|
1206 | val = hton64( val );
|
---|
1207 | return cChannel_send( (int8_t *)&val, (int16_t)sizeof( val ), VAR_tmo );
|
---|
1208 | }
|
---|
1209 |
|
---|
1210 | /* #[<ENTRY_FUNC>]# eTDR_getFloat32
|
---|
1211 | * name: eTDR_getFloat32
|
---|
1212 | * global_name: tNBOTDR_eTDR_getFloat32
|
---|
1213 | * oneway: false
|
---|
1214 | * #[</ENTRY_FUNC>]# */
|
---|
1215 | Inline ER
|
---|
1216 | eTDR_getFloat32(CELLIDX idx, float32_t* out)
|
---|
1217 | {
|
---|
1218 | ER_UINT er_sz = E_OK;
|
---|
1219 | int32_t val;
|
---|
1220 | CELLCB *p_cellcb;
|
---|
1221 | if (VALID_IDX(idx)) {
|
---|
1222 | p_cellcb = GET_CELLCB(idx);
|
---|
1223 | }
|
---|
1224 | else {
|
---|
1225 | return(E_ID);
|
---|
1226 | }
|
---|
1227 |
|
---|
1228 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1229 | er_sz = cChannel_receive( (int8_t *)&val, (int16_t)sizeof( val ), VAR_tmo );
|
---|
1230 | val = ntoh32( val );
|
---|
1231 | *out = *(float32_t *)&val;
|
---|
1232 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
1233 | }
|
---|
1234 |
|
---|
1235 | /* #[<ENTRY_FUNC>]# eTDR_getDouble64
|
---|
1236 | * name: eTDR_getDouble64
|
---|
1237 | * global_name: tNBOTDR_eTDR_getDouble64
|
---|
1238 | * oneway: false
|
---|
1239 | * #[</ENTRY_FUNC>]# */
|
---|
1240 | Inline ER
|
---|
1241 | eTDR_getDouble64(CELLIDX idx, double64_t* out)
|
---|
1242 | {
|
---|
1243 | ER_UINT er_sz = E_OK;
|
---|
1244 | int64_t val;
|
---|
1245 | CELLCB *p_cellcb;
|
---|
1246 | if (VALID_IDX(idx)) {
|
---|
1247 | p_cellcb = GET_CELLCB(idx);
|
---|
1248 | }
|
---|
1249 | else {
|
---|
1250 | return(E_ID);
|
---|
1251 | }
|
---|
1252 |
|
---|
1253 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1254 | er_sz = cChannel_receive( (int8_t *)&val, (int16_t)sizeof( val ), VAR_tmo );
|
---|
1255 | val = ntoh64( val );
|
---|
1256 | *out = *(double64_t *)&val;
|
---|
1257 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
1258 | }
|
---|
1259 |
|
---|
1260 | /* #[<ENTRY_FUNC>]# eTDR_putSChar
|
---|
1261 | * name: eTDR_putSChar
|
---|
1262 | * global_name: tNBOTDR_eTDR_putSChar
|
---|
1263 | * oneway: false
|
---|
1264 | * #[</ENTRY_FUNC>]# */
|
---|
1265 | Inline ER
|
---|
1266 | eTDR_putSChar(CELLIDX idx, signed char in)
|
---|
1267 | {
|
---|
1268 | CELLCB *p_cellcb;
|
---|
1269 | if (VALID_IDX(idx)) {
|
---|
1270 | p_cellcb = GET_CELLCB(idx);
|
---|
1271 | }
|
---|
1272 | else {
|
---|
1273 | return(E_ID);
|
---|
1274 | } /* end if VALID_IDX(idx) */
|
---|
1275 |
|
---|
1276 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1277 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
1278 | }
|
---|
1279 |
|
---|
1280 | /* #[<ENTRY_FUNC>]# eTDR_putShort
|
---|
1281 | * name: eTDR_putShort
|
---|
1282 | * global_name: tNBOTDR_eTDR_putShort
|
---|
1283 | * oneway: false
|
---|
1284 | * #[</ENTRY_FUNC>]# */
|
---|
1285 | Inline ER
|
---|
1286 | eTDR_putShort(CELLIDX idx, short_t in)
|
---|
1287 | {
|
---|
1288 | CELLCB *p_cellcb;
|
---|
1289 | TDR_SHORT IN = in;
|
---|
1290 | if (VALID_IDX(idx)) {
|
---|
1291 | p_cellcb = GET_CELLCB(idx);
|
---|
1292 | }
|
---|
1293 | else {
|
---|
1294 | return(E_ID);
|
---|
1295 | }
|
---|
1296 |
|
---|
1297 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1298 | IN = HTONS( IN, sizeof IN );
|
---|
1299 | return cChannel_send( (int8_t *)&IN, (int16_t)sizeof( IN ), VAR_tmo );
|
---|
1300 | }
|
---|
1301 |
|
---|
1302 | /* #[<ENTRY_FUNC>]# eTDR_putInt
|
---|
1303 | * name: eTDR_putInt
|
---|
1304 | * global_name: tNBOTDR_eTDR_putInt
|
---|
1305 | * oneway: false
|
---|
1306 | * #[</ENTRY_FUNC>]# */
|
---|
1307 | Inline ER
|
---|
1308 | eTDR_putInt(CELLIDX idx, int_t in)
|
---|
1309 | {
|
---|
1310 | CELLCB *p_cellcb;
|
---|
1311 | TDR_INT IN = in;
|
---|
1312 | if (VALID_IDX(idx)) {
|
---|
1313 | p_cellcb = GET_CELLCB(idx);
|
---|
1314 | }
|
---|
1315 | else {
|
---|
1316 | return(E_ID);
|
---|
1317 | }
|
---|
1318 |
|
---|
1319 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1320 | IN = HTONI( IN, sizeof IN );
|
---|
1321 | return cChannel_send( (int8_t *)&IN, (int16_t)sizeof( IN ), VAR_tmo );
|
---|
1322 | }
|
---|
1323 |
|
---|
1324 | /* #[<ENTRY_FUNC>]# eTDR_putLong
|
---|
1325 | * name: eTDR_putLong
|
---|
1326 | * global_name: tNBOTDR_eTDR_putLong
|
---|
1327 | * oneway: false
|
---|
1328 | * #[</ENTRY_FUNC>]# */
|
---|
1329 | Inline ER
|
---|
1330 | eTDR_putLong(CELLIDX idx, long_t in)
|
---|
1331 | {
|
---|
1332 | CELLCB *p_cellcb;
|
---|
1333 | TDR_LONG IN = in;
|
---|
1334 | if (VALID_IDX(idx)) {
|
---|
1335 | p_cellcb = GET_CELLCB(idx);
|
---|
1336 | }
|
---|
1337 | else {
|
---|
1338 | return(E_ID);
|
---|
1339 | }
|
---|
1340 |
|
---|
1341 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1342 | IN = HTONL( IN, sizeof IN );
|
---|
1343 | return cChannel_send( (int8_t *)&IN, (int16_t)sizeof( IN ), VAR_tmo );
|
---|
1344 | }
|
---|
1345 |
|
---|
1346 | /* #[<ENTRY_FUNC>]# eTDR_getSChar
|
---|
1347 | * name: eTDR_getSChar
|
---|
1348 | * global_name: tNBOTDR_eTDR_getSChar
|
---|
1349 | * oneway: false
|
---|
1350 | * #[</ENTRY_FUNC>]# */
|
---|
1351 | Inline ER
|
---|
1352 | eTDR_getSChar(CELLIDX idx, signed char* out)
|
---|
1353 | {
|
---|
1354 | ER_UINT er_sz;
|
---|
1355 | CELLCB *p_cellcb;
|
---|
1356 | if (VALID_IDX(idx)) {
|
---|
1357 | p_cellcb = GET_CELLCB(idx);
|
---|
1358 | }
|
---|
1359 | else {
|
---|
1360 | return(E_ID);
|
---|
1361 | } /* end if VALID_IDX(idx) */
|
---|
1362 |
|
---|
1363 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1364 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
1365 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
1366 | }
|
---|
1367 |
|
---|
1368 | /* #[<ENTRY_FUNC>]# eTDR_getShort
|
---|
1369 | * name: eTDR_getShort
|
---|
1370 | * global_name: tNBOTDR_eTDR_getShort
|
---|
1371 | * oneway: false
|
---|
1372 | * #[</ENTRY_FUNC>]# */
|
---|
1373 | Inline ER
|
---|
1374 | eTDR_getShort(CELLIDX idx, short* out)
|
---|
1375 | {
|
---|
1376 | ER_UINT er_sz;
|
---|
1377 | CELLCB *p_cellcb;
|
---|
1378 | TDR_SHORT OUT;
|
---|
1379 | if (VALID_IDX(idx)) {
|
---|
1380 | p_cellcb = GET_CELLCB(idx);
|
---|
1381 | }
|
---|
1382 | else {
|
---|
1383 | return(E_ID);
|
---|
1384 | }
|
---|
1385 |
|
---|
1386 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1387 | er_sz = cChannel_receive( (int8_t *)&OUT, (int16_t)sizeof( OUT ), VAR_tmo );
|
---|
1388 | *out = NTOHS( OUT, sizeof OUT );
|
---|
1389 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( OUT ) ? E_OK : E_BOVR );
|
---|
1390 | }
|
---|
1391 |
|
---|
1392 | /* #[<ENTRY_FUNC>]# eTDR_getInt
|
---|
1393 | * name: eTDR_getInt
|
---|
1394 | * global_name: tNBOTDR_eTDR_getInt
|
---|
1395 | * oneway: false
|
---|
1396 | * #[</ENTRY_FUNC>]# */
|
---|
1397 | Inline ER
|
---|
1398 | eTDR_getInt(CELLIDX idx, int_t* out)
|
---|
1399 | {
|
---|
1400 | ER_UINT er_sz;
|
---|
1401 | CELLCB *p_cellcb;
|
---|
1402 | TDR_INT OUT;
|
---|
1403 | if (VALID_IDX(idx)) {
|
---|
1404 | p_cellcb = GET_CELLCB(idx);
|
---|
1405 | }
|
---|
1406 | else {
|
---|
1407 | return(E_ID);
|
---|
1408 | }
|
---|
1409 |
|
---|
1410 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1411 | er_sz = cChannel_receive( (int8_t *)&OUT, (int16_t)sizeof( OUT ), VAR_tmo );
|
---|
1412 | *out = NTOHI( OUT, sizeof OUT );
|
---|
1413 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( OUT ) ? E_OK : E_BOVR );
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 | /* #[<ENTRY_FUNC>]# eTDR_getLong
|
---|
1417 | * name: eTDR_getLong
|
---|
1418 | * global_name: tNBOTDR_eTDR_getLong
|
---|
1419 | * oneway: false
|
---|
1420 | * #[</ENTRY_FUNC>]# */
|
---|
1421 | Inline ER
|
---|
1422 | eTDR_getLong(CELLIDX idx, long_t* out)
|
---|
1423 | {
|
---|
1424 | ER_UINT er_sz;
|
---|
1425 | CELLCB *p_cellcb;
|
---|
1426 | TDR_LONG OUT;
|
---|
1427 | if (VALID_IDX(idx)) {
|
---|
1428 | p_cellcb = GET_CELLCB(idx);
|
---|
1429 | }
|
---|
1430 | else {
|
---|
1431 | return(E_ID);
|
---|
1432 | }
|
---|
1433 |
|
---|
1434 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1435 | er_sz = cChannel_receive( (int8_t *)&OUT, (int16_t)sizeof( OUT ), VAR_tmo );
|
---|
1436 | *out = NTOHL( OUT, sizeof OUT );
|
---|
1437 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( OUT ) ? E_OK : E_BOVR );
|
---|
1438 | }
|
---|
1439 |
|
---|
1440 | /* #[<ENTRY_FUNC>]# eTDR_putUChar
|
---|
1441 | * name: eTDR_putUChar
|
---|
1442 | * global_name: tNBOTDR_eTDR_putUChar
|
---|
1443 | * oneway: false
|
---|
1444 | * #[</ENTRY_FUNC>]# */
|
---|
1445 | Inline ER
|
---|
1446 | eTDR_putUChar(CELLIDX idx, unsigned char in)
|
---|
1447 | {
|
---|
1448 | CELLCB *p_cellcb;
|
---|
1449 | if (VALID_IDX(idx)) {
|
---|
1450 | p_cellcb = GET_CELLCB(idx);
|
---|
1451 | }
|
---|
1452 | else {
|
---|
1453 | return(E_ID);
|
---|
1454 | } /* end if VALID_IDX(idx) */
|
---|
1455 |
|
---|
1456 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1457 | return cChannel_send( (int8_t *)&in, (int16_t)sizeof( in ), VAR_tmo );
|
---|
1458 | }
|
---|
1459 |
|
---|
1460 | /* #[<ENTRY_FUNC>]# eTDR_putUShort
|
---|
1461 | * name: eTDR_putUShort
|
---|
1462 | * global_name: tNBOTDR_eTDR_putUShort
|
---|
1463 | * oneway: false
|
---|
1464 | * #[</ENTRY_FUNC>]# */
|
---|
1465 | Inline ER
|
---|
1466 | eTDR_putUShort(CELLIDX idx, ushort_t in)
|
---|
1467 | {
|
---|
1468 | CELLCB *p_cellcb;
|
---|
1469 | TDR_USHORT IN = in;
|
---|
1470 | if (VALID_IDX(idx)) {
|
---|
1471 | p_cellcb = GET_CELLCB(idx);
|
---|
1472 | }
|
---|
1473 | else {
|
---|
1474 | return(E_ID);
|
---|
1475 | } /* end if VALID_IDX(idx) */
|
---|
1476 |
|
---|
1477 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1478 | IN = HTONS( IN, sizeof IN );
|
---|
1479 | return cChannel_send( (int8_t *)&IN, (int16_t)sizeof( IN ), VAR_tmo );
|
---|
1480 | }
|
---|
1481 |
|
---|
1482 | /* #[<ENTRY_FUNC>]# eTDR_putUInt
|
---|
1483 | * name: eTDR_putUInt
|
---|
1484 | * global_name: tNBOTDR_eTDR_putUInt
|
---|
1485 | * oneway: false
|
---|
1486 | * #[</ENTRY_FUNC>]# */
|
---|
1487 | Inline ER
|
---|
1488 | eTDR_putUInt(CELLIDX idx, uint_t in)
|
---|
1489 | {
|
---|
1490 | CELLCB *p_cellcb;
|
---|
1491 | TDR_UINT IN = in;
|
---|
1492 | if (VALID_IDX(idx)) {
|
---|
1493 | p_cellcb = GET_CELLCB(idx);
|
---|
1494 | }
|
---|
1495 | else {
|
---|
1496 | return(E_ID);
|
---|
1497 | } /* end if VALID_IDX(idx) */
|
---|
1498 |
|
---|
1499 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1500 | IN = HTONI( IN, sizeof IN );
|
---|
1501 | return cChannel_send( (int8_t *)&IN, (int16_t)sizeof( IN ), VAR_tmo );
|
---|
1502 | }
|
---|
1503 |
|
---|
1504 | /* #[<ENTRY_FUNC>]# eTDR_putULong
|
---|
1505 | * name: eTDR_putULong
|
---|
1506 | * global_name: tNBOTDR_eTDR_putULong
|
---|
1507 | * oneway: false
|
---|
1508 | * #[</ENTRY_FUNC>]# */
|
---|
1509 | Inline ER
|
---|
1510 | eTDR_putULong(CELLIDX idx, ulong_t in)
|
---|
1511 | {
|
---|
1512 | CELLCB *p_cellcb;
|
---|
1513 | TDR_ULONG IN = in;
|
---|
1514 | if (VALID_IDX(idx)) {
|
---|
1515 | p_cellcb = GET_CELLCB(idx);
|
---|
1516 | }
|
---|
1517 | else {
|
---|
1518 | return(E_ID);
|
---|
1519 | } /* end if VALID_IDX(idx) */
|
---|
1520 |
|
---|
1521 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1522 | IN = HTONL( IN, sizeof IN );
|
---|
1523 | return cChannel_send( (int8_t *)&IN, (int16_t)sizeof( IN ), VAR_tmo );
|
---|
1524 | }
|
---|
1525 |
|
---|
1526 | /* #[<ENTRY_FUNC>]# eTDR_getUChar
|
---|
1527 | * name: eTDR_getUChar
|
---|
1528 | * global_name: tNBOTDR_eTDR_getUChar
|
---|
1529 | * oneway: false
|
---|
1530 | * #[</ENTRY_FUNC>]# */
|
---|
1531 | Inline ER
|
---|
1532 | eTDR_getUChar(CELLIDX idx, unsigned char* out)
|
---|
1533 | {
|
---|
1534 | ER_UINT er_sz;
|
---|
1535 | CELLCB *p_cellcb;
|
---|
1536 | if (VALID_IDX(idx)) {
|
---|
1537 | p_cellcb = GET_CELLCB(idx);
|
---|
1538 | }
|
---|
1539 | else {
|
---|
1540 | return(E_ID);
|
---|
1541 | } /* end if VALID_IDX(idx) */
|
---|
1542 |
|
---|
1543 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1544 | er_sz = cChannel_receive( (int8_t *)out, (int16_t)sizeof( *out ), VAR_tmo );
|
---|
1545 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( *out ) ? E_OK : E_BOVR );
|
---|
1546 | }
|
---|
1547 |
|
---|
1548 | /* #[<ENTRY_FUNC>]# eTDR_getUShort
|
---|
1549 | * name: eTDR_getUShort
|
---|
1550 | * global_name: tNBOTDR_eTDR_getUShort
|
---|
1551 | * oneway: false
|
---|
1552 | * #[</ENTRY_FUNC>]# */
|
---|
1553 | Inline ER
|
---|
1554 | eTDR_getUShort(CELLIDX idx, unsigned short* out)
|
---|
1555 | {
|
---|
1556 | ER_UINT er_sz;
|
---|
1557 | CELLCB *p_cellcb;
|
---|
1558 | TDR_USHORT OUT;
|
---|
1559 | if (VALID_IDX(idx)) {
|
---|
1560 | p_cellcb = GET_CELLCB(idx);
|
---|
1561 | }
|
---|
1562 | else {
|
---|
1563 | return(E_ID);
|
---|
1564 | } /* end if VALID_IDX(idx) */
|
---|
1565 |
|
---|
1566 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1567 | er_sz = cChannel_receive( (int8_t *)&OUT, (int16_t)sizeof( OUT ), VAR_tmo );
|
---|
1568 | *out = NTOHS( OUT, sizeof OUT );
|
---|
1569 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( OUT ) ? E_OK : E_BOVR );
|
---|
1570 | }
|
---|
1571 |
|
---|
1572 | /* #[<ENTRY_FUNC>]# eTDR_getUInt
|
---|
1573 | * name: eTDR_getUInt
|
---|
1574 | * global_name: tNBOTDR_eTDR_getUInt
|
---|
1575 | * oneway: false
|
---|
1576 | * #[</ENTRY_FUNC>]# */
|
---|
1577 | Inline ER
|
---|
1578 | eTDR_getUInt(CELLIDX idx, uint_t* out)
|
---|
1579 | {
|
---|
1580 | ER_UINT er_sz;
|
---|
1581 | CELLCB *p_cellcb;
|
---|
1582 | TDR_UINT OUT;
|
---|
1583 | if (VALID_IDX(idx)) {
|
---|
1584 | p_cellcb = GET_CELLCB(idx);
|
---|
1585 | }
|
---|
1586 | else {
|
---|
1587 | return(E_ID);
|
---|
1588 | } /* end if VALID_IDX(idx) */
|
---|
1589 |
|
---|
1590 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1591 | er_sz = cChannel_receive( (int8_t *)&OUT, (int16_t)sizeof( OUT ), VAR_tmo );
|
---|
1592 | *out = NTOHI( OUT, sizeof OUT );
|
---|
1593 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( OUT ) ? E_OK : E_BOVR );
|
---|
1594 | }
|
---|
1595 |
|
---|
1596 | /* #[<ENTRY_FUNC>]# eTDR_getULong
|
---|
1597 | * name: eTDR_getULong
|
---|
1598 | * global_name: tNBOTDR_eTDR_getULong
|
---|
1599 | * oneway: false
|
---|
1600 | * #[</ENTRY_FUNC>]# */
|
---|
1601 | Inline ER
|
---|
1602 | eTDR_getULong(CELLIDX idx, ulong_t* out)
|
---|
1603 | {
|
---|
1604 | ER_UINT er_sz;
|
---|
1605 | CELLCB *p_cellcb;
|
---|
1606 | TDR_ULONG OUT;
|
---|
1607 | if (VALID_IDX(idx)) {
|
---|
1608 | p_cellcb = GET_CELLCB(idx);
|
---|
1609 | }
|
---|
1610 | else {
|
---|
1611 | return(E_ID);
|
---|
1612 | } /* end if VALID_IDX(idx) */
|
---|
1613 |
|
---|
1614 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1615 | er_sz = cChannel_receive( (int8_t *)&OUT, (int16_t)sizeof( OUT ), VAR_tmo );
|
---|
1616 | *out = NTOHL( OUT, sizeof OUT );
|
---|
1617 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( OUT ) ? E_OK : E_BOVR );
|
---|
1618 | }
|
---|
1619 |
|
---|
1620 | /* #[<ENTRY_FUNC>]# eTDR_putIntptr
|
---|
1621 | * name: eTDR_putIntptr
|
---|
1622 | * global_name: tNBOTDR_eTDR_putIntptr
|
---|
1623 | * oneway: false
|
---|
1624 | * #[</ENTRY_FUNC>]# */
|
---|
1625 | Inline ER
|
---|
1626 | eTDR_putIntptr(CELLIDX idx, const intptr_t ptr)
|
---|
1627 | {
|
---|
1628 | CELLCB *p_cellcb;
|
---|
1629 | TDR_INTPTR IN = ptr;
|
---|
1630 | if (VALID_IDX(idx)) {
|
---|
1631 | p_cellcb = GET_CELLCB(idx);
|
---|
1632 | }
|
---|
1633 | else {
|
---|
1634 | return(E_ID);
|
---|
1635 | }
|
---|
1636 |
|
---|
1637 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1638 | IN = HTONIP( IN, sizeof IN );
|
---|
1639 | return cChannel_send( (int8_t *)&IN, (int16_t)sizeof( IN ), VAR_tmo );
|
---|
1640 | }
|
---|
1641 |
|
---|
1642 | /* #[<ENTRY_FUNC>]# eTDR_getIntptr
|
---|
1643 | * name: eTDR_getIntptr
|
---|
1644 | * global_name: tNBOTDR_eTDR_getIntptr
|
---|
1645 | * oneway: false
|
---|
1646 | * #[</ENTRY_FUNC>]# */
|
---|
1647 | Inline ER
|
---|
1648 | eTDR_getIntptr(CELLIDX idx, intptr_t* ptr)
|
---|
1649 | {
|
---|
1650 | ER_UINT er_sz;
|
---|
1651 | CELLCB *p_cellcb;
|
---|
1652 | TDR_INTPTR OUT;
|
---|
1653 | if (VALID_IDX(idx)) {
|
---|
1654 | p_cellcb = GET_CELLCB(idx);
|
---|
1655 | }
|
---|
1656 | else {
|
---|
1657 | return(E_ID);
|
---|
1658 | }
|
---|
1659 |
|
---|
1660 | /* ããã«å¦çæ¬ä½ãè¨è¿°ãã¾ã #_TEFB_# */
|
---|
1661 | er_sz = cChannel_receive( (int8_t *)&OUT, (int16_t)sizeof( OUT ), VAR_tmo );
|
---|
1662 | *ptr = NTOHIP( OUT, sizeof OUT );
|
---|
1663 | return er_sz < 0 ? er_sz : ( er_sz == sizeof( OUT ) ? E_OK : E_BOVR );
|
---|
1664 | }
|
---|
1665 |
|
---|
1666 | /* #[<POSTAMBLE>]#
|
---|
1667 | * ããããä¸ã«éåãå£é¢æ°ãæ¸ãã¾ã
|
---|
1668 | * #[</POSTAMBLE>]#*/
|
---|